Browse Source

Patch rogue msvc (#1330)

* + msvc 2015 deps headers

* + msvc deps build script

this script builds only deps, to build rogue binary, open
*.sln file in MSVC 2015 and build x64 Release version.

* + msvc solution (*.sln) update

* + msvc build fix

* fix libcurl deps install (msvc)

* [msvc] fix seed str -> uint64 conversion

* [msvc] fix config file name issue
+ debug print for send raw tx

* + comment debug printouts

* [ msvc ] display compiler version and build date on startup
pull/4/head
DeckerSU 5 years ago
committed by jl777
parent
commit
6579ea6c21
  1. 57
      src/cc/rogue/main.c
  2. 10
      src/cc/rogue/rogue.c

57
src/cc/rogue/main.c

@ -767,6 +767,17 @@ int32_t rogue_sendrawtransaction(char *rawtx)
}
free_json(retjson);
}
/* log sendrawtx result in file */
/*
FILE *debug_file;
debug_file = fopen("tx_debug.log", "a");
fprintf(debug_file, "%s\n", retstr);
fflush(debug_file);
fclose(debug_file);
*/
free(retstr);
}
free(params);
@ -930,9 +941,46 @@ int32_t rogue_setplayerdata(struct rogue_state *rs,char *gametxidstr)
return(retval);
}
#ifdef _WIN32
#ifdef _MSC_VER
__inline int msver(void) {
switch (_MSC_VER) {
case 1500: return 2008;
case 1600: return 2010;
case 1700: return 2012;
case 1800: return 2013;
case 1900: return 2015;
//case 1910: return 2017;
default: return (_MSC_VER / 100);
}
}
static inline bool is_x64(void) {
#if defined(__x86_64__) || defined(_WIN64) || defined(__aarch64__)
return 1;
#elif defined(__amd64__) || defined(__amd64) || defined(_M_X64) || defined(_M_IA64)
return 1;
#else
return 0;
#endif
}
#define BUILD_DATE __DATE__ " " __TIME__
#endif // _WIN32
#endif // _MSC_VER
int main(int argc, char **argv, char **envp)
{
uint64_t seed; FILE *fp = 0; int32_t i,j,c; char userpass[8192];
#ifdef _WIN32
#ifdef _MSC_VER
printf("*** rogue for Windows [ Build %s ] ***\n", BUILD_DATE);
const char* arch = is_x64() ? "64-bits" : "32-bits";
printf(" Built with VC++ %d (%ld) %s\n\n", msver(), _MSC_FULL_VER, arch);
#endif
#endif
for (i=j=0; argv[0][i]!=0&&j<sizeof(ASSETCHAINS_SYMBOL); i++)
{
c = argv[0][i];
@ -944,6 +992,15 @@ int main(int argc, char **argv, char **envp)
ASSETCHAINS_SYMBOL[j++] = toupper(c);
}
ASSETCHAINS_SYMBOL[j++] = 0;
#ifdef _WIN32
#ifdef _MSC_VER
if (strncmp(ASSETCHAINS_SYMBOL, "ROGUE.EXE", sizeof(ASSETCHAINS_SYMBOL)) == 0 || strncmp(ASSETCHAINS_SYMBOL, "ROGUE54.EXE", sizeof(ASSETCHAINS_SYMBOL)) == 0) {
strcpy(ASSETCHAINS_SYMBOL, "ROGUE"); // accept ROGUE.conf, instead of ROGUE.EXE.conf or ROGUE54.EXE.conf if build with MSVC
}
#endif
#endif
ROGUE_PORT = komodo_userpass(userpass,ASSETCHAINS_SYMBOL);
if ( IPADDRESS[0] == 0 )
strcpy(IPADDRESS,"127.0.0.1");

10
src/cc/rogue/rogue.c

@ -343,7 +343,15 @@ int rogue(int argc, char **argv, char **envp)
rs->sleeptime = 1; // non-zero to allow refresh()
if ( argc == 3 && strlen(argv[2]) == 64 )
{
rs->seed = atol(argv[1]);
#ifdef _WIN32
#ifdef _MSC_VER
rs->seed = _strtoui64(argv[1], NULL, 10);
#else
rs->seed = atol(argv[1]); // windows, but not MSVC
#endif // _MSC_VER
#else
rs->seed = atol(argv[1]); // non-windows
#endif // _WIN32
strcpy(Gametxidstr,argv[2]);
fprintf(stderr,"setplayerdata\n");
if ( rogue_setplayerdata(rs,Gametxidstr) < 0 )

Loading…
Cancel
Save