diff --git a/polymer/eduke32/build/include/winbits.h b/polymer/eduke32/build/include/winbits.h index ac68073bd..be2afc6c5 100644 --- a/polymer/eduke32/build/include/winbits.h +++ b/polymer/eduke32/build/include/winbits.h @@ -30,3 +30,4 @@ extern LPTSTR GetWindowsErrorMsg(DWORD code); extern int32_t addsearchpath_ProgramFiles(const char *p); extern int32_t G_GetVersionFromWebsite(char *buffer); +extern int32_t win_buildargs(char **argvbuf); \ No newline at end of file diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index 978c01916..86d0e2cec 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -327,7 +327,11 @@ static void sighandler(int signum) } } +#ifdef _WIN32 +int32_t WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int32_t nCmdShow) +#else int32_t main(int32_t argc, char *argv[]) +#endif { int32_t r; @@ -346,6 +350,11 @@ int32_t main(int32_t argc, char *argv[]) signal(SIGFPE, sighandler); #ifdef _WIN32 + UNREFERENCED_PARAMETER(hInst); + UNREFERENCED_PARAMETER(hPrevInst); + UNREFERENCED_PARAMETER(lpCmdLine); + UNREFERENCED_PARAMETER(nCmdShow); + win_open(); if (!CheckWinVersion()) @@ -366,7 +375,23 @@ int32_t main(int32_t argc, char *argv[]) maybe_redirect_outputs(); baselayer_init(); +#ifdef _WIN32 + char *argvbuf; + int32_t buildargc = win_buildargs(&argvbuf); + const char **buildargv = (const char **) Bmalloc(sizeof(char *)*(buildargc+1)); + char *wp = argvbuf; + + for (int i=0; i