mirror of
https://github.com/xmrig/xmrig.git
synced 2025-01-18 16:55:55 +00:00
Add support for new style algorithm names.
This commit is contained in:
parent
a06a224c0a
commit
779238fc85
3 changed files with 41 additions and 15 deletions
47
options.c
47
options.c
|
@ -59,6 +59,30 @@ enum Variant opt_variant = VARIANT_AUTO;
|
||||||
enum AlgoVariant opt_av = AV_AUTO;
|
enum AlgoVariant opt_av = AV_AUTO;
|
||||||
|
|
||||||
|
|
||||||
|
struct AlgoData
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
const char *shortName;
|
||||||
|
enum Algo algo;
|
||||||
|
enum Variant variant;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static struct AlgoData const algorithms[] = {
|
||||||
|
{ "cryptonight", "cn", ALGO_CRYPTONIGHT, VARIANT_AUTO },
|
||||||
|
{ "cryptonight/0", "cn/0", ALGO_CRYPTONIGHT, VARIANT_0 },
|
||||||
|
{ "cryptonight/1", "cn/1", ALGO_CRYPTONIGHT, VARIANT_1 },
|
||||||
|
{ "cryptonight/2", "cn/2", ALGO_CRYPTONIGHT, VARIANT_2 },
|
||||||
|
|
||||||
|
# ifndef XMRIG_NO_AEON
|
||||||
|
{ "cryptonight-lite", "cn-lite", ALGO_CRYPTONIGHT_LITE, VARIANT_AUTO },
|
||||||
|
{ "cryptonight-light", "cn-light", ALGO_CRYPTONIGHT_LITE, VARIANT_AUTO },
|
||||||
|
{ "cryptonight-lite/0", "cn-lite/0", ALGO_CRYPTONIGHT_LITE, VARIANT_0 },
|
||||||
|
{ "cryptonight-lite/1", "cn-lite/1", ALGO_CRYPTONIGHT_LITE, VARIANT_1 },
|
||||||
|
# endif
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static char const usage[] = "\
|
static char const usage[] = "\
|
||||||
Usage: " APP_ID " [OPTIONS]\n\
|
Usage: " APP_ID " [OPTIONS]\n\
|
||||||
Options:\n\
|
Options:\n\
|
||||||
|
@ -126,7 +150,7 @@ static const char *algo_names[] = {
|
||||||
|
|
||||||
|
|
||||||
static const char *variant_names[] = {
|
static const char *variant_names[] = {
|
||||||
"auto"
|
"auto",
|
||||||
"0",
|
"0",
|
||||||
"1",
|
"1",
|
||||||
"2",
|
"2",
|
||||||
|
@ -178,18 +202,13 @@ static void parse_arg(int key, char *arg) {
|
||||||
|
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case 'a':
|
case 'a': /* --algo */
|
||||||
for (int i = 0; i < ARRAY_SIZE(algo_names); i++) {
|
for (size_t i = 0; i < ARRAY_SIZE(algorithms); i++) {
|
||||||
if (algo_names[i] && !strcmp(arg, algo_names[i])) {
|
if ((strcasecmp(arg, algorithms[i].name) == 0) || (strcasecmp(arg, algorithms[i].shortName) == 0)) {
|
||||||
opt_algo = i;
|
opt_algo = algorithms[i].algo;
|
||||||
|
opt_variant = algorithms[i].variant;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifndef XMRIG_NO_AEON
|
|
||||||
if (i == ARRAY_SIZE(algo_names) - 1 && !strcmp(arg, "cryptonight-light")) {
|
|
||||||
opt_algo = i = ALGO_CRYPTONIGHT_LITE;
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -532,3 +551,9 @@ void show_version_and_exit(void) {
|
||||||
const char *get_current_algo_name(void) {
|
const char *get_current_algo_name(void) {
|
||||||
return algo_names[opt_algo];
|
return algo_names[opt_algo];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char *get_current_variant_name(void)
|
||||||
|
{
|
||||||
|
return variant_names[opt_variant + 1];
|
||||||
|
}
|
||||||
|
|
|
@ -95,6 +95,7 @@ void parse_cmdline(int argc, char *argv[]);
|
||||||
void show_usage_and_exit(int status);
|
void show_usage_and_exit(int status);
|
||||||
void show_version_and_exit(void);
|
void show_version_and_exit(void);
|
||||||
const char *get_current_algo_name(void);
|
const char *get_current_algo_name(void);
|
||||||
|
const char *get_current_variant_name(void);
|
||||||
|
|
||||||
extern void proper_exit(int reason);
|
extern void proper_exit(int reason);
|
||||||
|
|
||||||
|
|
|
@ -77,10 +77,10 @@ static void print_threads() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt_colors) {
|
if (opt_colors) {
|
||||||
applog_notime(LOG_INFO, CL_LGR " * " CL_WHT "THREADS: " CL_WHT "%d" CL_WHT ", av=%d, %s, donate=%d%%%s", opt_n_threads, opt_av, get_current_algo_name(), opt_donate_level, extra);
|
applog_notime(LOG_INFO, CL_LGR " * " CL_WHT "THREADS: " CL_WHT "%d" CL_WHT ", av=%d, %s/%s, donate=%d%%%s", opt_n_threads, opt_av, get_current_algo_name(), get_current_variant_name(), opt_donate_level, extra);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
applog_notime(LOG_INFO, " * THREADS: %d, av=%d, %s, donate=%d%%%s", opt_n_threads, opt_av, get_current_algo_name(), opt_donate_level, extra);
|
applog_notime(LOG_INFO, " * THREADS: %d, av=%d, %s/%s, donate=%d%%%s", opt_n_threads, opt_av, get_current_algo_name(), get_current_variant_name(), opt_donate_level, extra);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue