+ msvc build fix
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -154,3 +154,4 @@ src/ROGUE.conf
|
||||
src/rogue.scr
|
||||
|
||||
src/cc/rogue/confdefs.h
|
||||
src/cc/rogue/x64
|
||||
|
||||
@@ -107,6 +107,12 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _MSC_VER
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#undef SIGTSTP
|
||||
|
||||
#define MAXSTR 1024 /* maximum length of strings */
|
||||
@@ -142,7 +148,8 @@ void leave(int);
|
||||
void my_exit(int st);
|
||||
void playltchars(void);
|
||||
void quit(int);
|
||||
int32_t _quit();
|
||||
int32_t _quit();
|
||||
|
||||
void resetltchars(void);
|
||||
void set_order(int *order, int numthings);
|
||||
void tstp(int ignored);
|
||||
|
||||
@@ -38,6 +38,31 @@ union _bits256 { uint8_t bytes[32]; uint16_t ushorts[16]; uint32_t uints[8]; uin
|
||||
typedef union _bits256 bits256;
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _MSC_VER
|
||||
int gettimeofday(struct timeval * tp, struct timezone * tzp)
|
||||
{
|
||||
// Note: some broken versions only have 8 trailing zero's, the correct epoch has 9 trailing zero's
|
||||
static const uint64_t EPOCH = ((uint64_t)116444736000000000ULL);
|
||||
|
||||
SYSTEMTIME system_time;
|
||||
FILETIME file_time;
|
||||
uint64_t time;
|
||||
|
||||
GetSystemTime(&system_time);
|
||||
SystemTimeToFileTime(&system_time, &file_time);
|
||||
time = ((uint64_t)file_time.dwLowDateTime);
|
||||
time += ((uint64_t)file_time.dwHighDateTime) << 32;
|
||||
|
||||
tp->tv_sec = (long)((time - EPOCH) / 10000000L);
|
||||
tp->tv_usec = (long)(system_time.wMilliseconds * 1000);
|
||||
return 0;
|
||||
}
|
||||
#endif // _MSC_VER
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
double OS_milliseconds()
|
||||
{
|
||||
struct timeval tv; double millis;
|
||||
@@ -392,6 +417,12 @@ char *post_process_bitcoind_RPC(char *debugstr,char *command,char *rpcstr,char *
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _MSC_VER
|
||||
#define sleep(x) Sleep(1000*(x))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* perform the query
|
||||
@@ -919,7 +950,19 @@ int main(int argc, char **argv, char **envp)
|
||||
printf("ASSETCHAINS_SYMBOL.(%s) port.%u (%s) IPADDRESS.%s \n",ASSETCHAINS_SYMBOL,ROGUE_PORT,USERPASS,IPADDRESS); sleep(1);
|
||||
if ( argc == 2 && (fp=fopen(argv[1],"rb")) == 0 )
|
||||
{
|
||||
seed = atol(argv[1]);
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _MSC_VER
|
||||
seed = _strtoui64(argv[1], NULL, 10);
|
||||
fprintf(stderr, "replay seed.str(%s) seed.uint64_t(%I64u)", argv[1], seed);
|
||||
#else
|
||||
fprintf(stderr, "replay seed.str(%s) seed.uint64_t(%llu)", argv[1], (long long)seed);
|
||||
seed = atol(argv[1]); // windows, but not MSVC
|
||||
#endif // _MSC_VER
|
||||
#else
|
||||
seed = atol(argv[1]); // non-windows
|
||||
#endif // _WIN32
|
||||
|
||||
//fprintf(stderr,"replay %llu\n",(long long)seed);
|
||||
return(rogue_replay(seed,10));
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <signal.h>
|
||||
//#include <unistd.h>
|
||||
//#include <curses.h>
|
||||
|
||||
#include "rogue.h"
|
||||
#ifdef STANDALONE
|
||||
#include "../komodo/src/komodo_cJSON.h"
|
||||
@@ -196,6 +197,12 @@ void rogue_bailout(struct rogue_state *rs)
|
||||
fprintf(stderr,"error issuing (%s)\n",cmd);*/
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _MSC_VER
|
||||
#define sleep(x) Sleep(1000*(x))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int32_t rogue_replay2(uint8_t *newdata,uint64_t seed,char *keystrokes,int32_t num,struct rogue_player *player,int32_t sleepmillis)
|
||||
{
|
||||
struct rogue_state *rs; FILE *fp; int32_t i,n;
|
||||
@@ -215,6 +222,14 @@ int32_t rogue_replay2(uint8_t *newdata,uint64_t seed,char *keystrokes,int32_t nu
|
||||
globalR = *rs;
|
||||
uint32_t starttime = (uint32_t)time(NULL);
|
||||
rogueiterate(rs);
|
||||
|
||||
/*
|
||||
// keypress after replay
|
||||
printf("[Press return to continue]");
|
||||
fflush(stdout);
|
||||
if (fgets(prbuf, 10, stdin) != 0);
|
||||
*/
|
||||
|
||||
if ( 0 )
|
||||
{
|
||||
fprintf(stderr,"elapsed %d seconds\n",(uint32_t)time(NULL) - starttime);
|
||||
@@ -526,6 +541,18 @@ tstp(int ignored)
|
||||
#endif*/
|
||||
}
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _MSC_VER
|
||||
void usleep(int32_t micros)
|
||||
{
|
||||
if (micros < 1000)
|
||||
Sleep(1);
|
||||
else Sleep(micros / 1000);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* playit:
|
||||
* The main loop of the program. Loop until the game is over,
|
||||
|
||||
Reference in New Issue
Block a user