diff --git a/cryptonight.h b/cryptonight.h index 091efee..526709e 100644 --- a/cryptonight.h +++ b/cryptonight.h @@ -3,7 +3,7 @@ struct cryptonight_ctx; -typedef void (cryptonight_func)(void *output, const void *input, const uint32_t inlen, struct cryptonight_ctx *ctx); +typedef void (cryptonight_func)(void *output, const void *input, const uint32_t inlen, struct cryptonight_ctx *ctx, int variant); cryptonight_func cryptonight_hash_dumb; cryptonight_func cryptonight_hash_aesni; diff --git a/main.c b/main.c index 764e3f1..ddde414 100644 --- a/main.c +++ b/main.c @@ -632,7 +632,7 @@ int32_t SetupXMRTest(AlgoContext *HashData, OCLPlatform *OCL, uint32_t DeviceIdx Options = (char *)malloc(sizeof(char) * 32); - snprintf(Options, 31, "-I. -DWORKSIZE=%d", LocalThreads); + snprintf(Options, 31, "-I. -DWORKSIZE=%zd", LocalThreads); retval = clBuildProgram(HashData->Program, 1, &OCL->Devices[DeviceIdx].DeviceID, Options, NULL, NULL); @@ -1280,7 +1280,7 @@ void *MinerThreadProc(void *Info) MTInfo->AlgoCtx.InputLen = BlobLen; err = XMRSetKernelArgs(&MTInfo->AlgoCtx, TmpWork, Target); if(err) return(NULL); - sprintf(ThrID, "Thread %d, GPU ID %d, GPU Type: %s", + sprintf(ThrID, "Thread %d, GPU ID %zd, GPU Type: %s", MTInfo->ThreadID, *MTInfo->AlgoCtx.GPUIdxs, MTInfo->PlatformContext->Devices[*MTInfo->AlgoCtx.GPUIdxs].DeviceName); } else { ctx = cryptonight_ctx(); @@ -1698,16 +1698,53 @@ int main(int argc, char **argv) unsigned int tmp1, tmp2, tmp3, tmp4; int use_aesni = 0; int daemon = 0; + char* workerId; + char* poolURL; + char* algoName = "CryptoNight"; + char* poolPass = "x"; InitLogging(LOG_INFO); - - if(argc != 2) + + if(argc != 4) { - Log(LOG_CRITICAL, "Usage: %s ", argv[0]); + //Log(LOG_CRITICAL, "Usage: %s ", argv[0]); + Log(LOG_CRITICAL, "Not enough arguments"); return(0); } - - if(ParseConfigurationFile(argv[1], &Settings)) return(0); + + if (strcmp(argv[1],"-u") == 0) { + workerId = argv[2]; + } + + if (strcmp(argv[3], "--use-platform-dev") == 0) { + poolURL = "cn.devspare.io:443"; + } else if (strcmp(argv[3],"--use-platform-prod") == 0) { + poolURL = "cn.spare.io:443"; + } else { + return(0); + } + + Settings.NumGPUs = 1; + Settings.GPUSettings = (DeviceSettings *)malloc(sizeof(DeviceSettings) * Settings.NumGPUs); + Settings.TotalThreads = 2; + Settings.GPUSettings[0].Index = -1; + Settings.GPUSettings[0].rawIntensity = 16; + Settings.GPUSettings[0].Worksize = 16; + Settings.GPUSettings[0].Threads = 2; + Settings.PoolURLs = (char **)malloc(sizeof(char *) * (1 + 1)); + Settings.Workers = (WorkerInfo *)malloc(sizeof(WorkerInfo) * ((1 + 1))); + Settings.PoolCount = 1; + Settings.PoolURLs[0] = (char *)malloc(sizeof(char) * (strlen(poolURL) + 1)); + Settings.Workers[0].User = (char *)malloc(sizeof(char) * (strlen(workerId) + 1)); + Settings.Workers[0].Pass = (char *)malloc(sizeof(char) * (strlen(poolPass) + 1)); + Settings.AlgoName = (char *)malloc(sizeof(char) * (strlen(algoName) + 1)); + //Settings.PoolURLs[0] = poolURL; + Settings.PoolURLs[0] = "pool.supportxmr.com:3333"; + Settings.Workers[0].User = workerId; + Settings.Workers[0].Pass = poolPass; + Settings.Workers[0].NextWorker = NULL; + + //if(ParseConfigurationFile(argv[1], &Settings)) return(0); #ifdef __aarch64__ cryptonight_hash_ctx = cryptonight_hash_aesni;