diff --git a/src/App.cpp b/src/App.cpp index 8f6ed148..091fbb8a 100644 --- a/src/App.cpp +++ b/src/App.cpp @@ -48,10 +48,11 @@ App::App(int argc, char **argv) : { m_self = this; - Console::init(); + m_options = Options::parse(argc, argv); + + Console::init(m_options->colors(), m_options->background()); Cpu::init(); - m_options = Options::parse(argc, argv); m_network = new Network(m_options); uv_signal_init(uv_default_loop(), &m_signal); @@ -69,17 +70,17 @@ int App::exec() return 0; } - if (!CryptoNight::init(m_options->algo(), m_options->algoVariant())) { - LOG_ERR("\"%s\" hash self-test failed.", m_options->algoName()); - return 1; - } - uv_signal_start(&m_signal, App::onSignal, SIGHUP); uv_signal_start(&m_signal, App::onSignal, SIGTERM); uv_signal_start(&m_signal, App::onSignal, SIGINT); background(); + if (!CryptoNight::init(m_options->algo(), m_options->algoVariant())) { + LOG_ERR("\"%s\" hash self-test failed.", m_options->algoName()); + return 1; + } + Mem::allocate(m_options->algo(), m_options->threads(), m_options->doubleHash()); Summary::print(); diff --git a/src/Console.cpp b/src/Console.cpp index 558c1e8d..8f160760 100644 --- a/src/Console.cpp +++ b/src/Console.cpp @@ -40,10 +40,10 @@ Console *Console::m_self = nullptr; -void Console::init() +void Console::init(bool colors, bool background) { if (!m_self) { - m_self = new Console(); + m_self = new Console(colors, background); } } @@ -97,7 +97,7 @@ void Console::message(Console::Level level, const char* fmt, ...) stime.tm_hour, stime.tm_min, stime.tm_sec, - color, + m_colors ? color : "", fmt, m_colors ? kCL_N : "" ); @@ -121,10 +121,7 @@ void Console::text(const char* fmt, ...) const int len = 64 + strlen(fmt) + 2; char *buf = static_cast(alloca(len)); - sprintf(buf, "%s%s\n", - fmt, - m_colors ? kCL_N : "" - ); + sprintf(buf, "%s%s\n", fmt, m_colors ? kCL_N : ""); uv_mutex_lock(&m_mutex); @@ -137,8 +134,9 @@ void Console::text(const char* fmt, ...) } -Console::Console() : - m_colors(true) +Console::Console(bool colors, bool background) : + m_background(background), + m_colors(colors) { uv_mutex_init(&m_mutex); } diff --git a/src/Console.h b/src/Console.h index 73e04706..6e74aa46 100644 --- a/src/Console.h +++ b/src/Console.h @@ -51,16 +51,17 @@ public: # endif static inline Console* i() { return m_self; } - static void init(); + static void init(bool colors, bool background); void message(Level level, const char* fmt, ...); void text(const char* fmt, ...); private: - Console(); + Console(bool colors, bool background); - static Console *m_self; + bool m_background; bool m_colors; + static Console *m_self; uv_mutex_t m_mutex; }; diff --git a/src/Options.cpp b/src/Options.cpp index 4da75923..6fccbe4c 100644 --- a/src/Options.cpp +++ b/src/Options.cpp @@ -34,7 +34,6 @@ #endif -#include "Console.h" #include "Cpu.h" #include "donate.h" #include "net/Url.h" @@ -173,7 +172,7 @@ Options::Options(int argc, char **argv) : } if (!m_url) { - LOG_ERR("No pool URL supplied. Exiting.", argv[0]); + fprintf(stderr, "No pool URL supplied. Exiting."); return; } diff --git a/src/version.h b/src/version.h index 6bc3c855..7382070b 100644 --- a/src/version.h +++ b/src/version.h @@ -27,14 +27,14 @@ #define APP_ID "xmrig" #define APP_NAME "XMRig" #define APP_DESC "Monero (XMR) CPU miner" -#define APP_VERSION "1.0.1" +#define APP_VERSION "1.1.0-dev" #define APP_DOMAIN "xmrig.com" #define APP_SITE "www.xmrig.com" #define APP_COPYRIGHT "Copyright (C) 2016-2017 xmrig.com" #define APP_VER_MAJOR 1 -#define APP_VER_MINOR 0 -#define APP_VER_BUILD 1 +#define APP_VER_MINOR 1 +#define APP_VER_BUILD 0 #define APP_VER_REV 0 #ifdef _MSC_VER