X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FOpenGL_Windows.cpp;h=9d709dbc2685a0aa58e2feb7c00fe199997a5170;hb=99d73d380e7376505a4033813d5d560ebaea05d1;hp=18bb2b90382220146263b122d895ae84139f202b;hpb=8fb50ec5e055324deda9c83f74eadfbe88338344;p=lugaru.git diff --git a/Source/OpenGL_Windows.cpp b/Source/OpenGL_Windows.cpp index 18bb2b9..9d709db 100644 --- a/Source/OpenGL_Windows.cpp +++ b/Source/OpenGL_Windows.cpp @@ -525,7 +525,7 @@ static void sdlEventProc(const SDL_Event &e, Game &game) SDL_WM_ToggleFullScreen(SDL_GetVideoSurface()); } - else if (e.key.keysym.sym < SDLK_LAST) + if (e.key.keysym.sym < SDLK_LAST) { if (KeyTable[e.key.keysym.sym] != 0xffff) SetKey(KeyTable[e.key.keysym.sym]); @@ -891,9 +891,6 @@ Boolean SetUp (Game & game) SDL_WM_SetCaption("Lugaru", "lugaru"); - if (!cmdline("nomousegrab")) - SDL_WM_GrabInput(SDL_GRAB_ON); - SDL_ShowCursor(0); if (SDL_SetVideoMode(kContextWidth, kContextHeight, 0, sdlflags) == NULL) @@ -902,6 +899,8 @@ Boolean SetUp (Game & game) return false; } + if (!cmdline("nomousegrab")) + SDL_WM_GrabInput(SDL_GRAB_ON); #elif (defined WIN32) //------------------------------------------------------------------ @@ -1393,7 +1392,34 @@ static bool try_launch_browser(const char *browser, const char *url) strcat(dst, " "); strcat(dst, url); } - return(system(buf) == 0); + + #define MAX_BROWSER_ARGS 512 + char *args[MAX_BROWSER_ARGS]; + char *path = NULL; + memset(args, '\0', sizeof (args)); + path = args[0] = strtok(buf, " "); + if (path == NULL) + return false; + + size_t i = 0; + for (i = 1; i < MAX_BROWSER_ARGS; i++) + { + args[i] = strtok(NULL, " "); + if (args[i] == NULL) + break; + } + + if (i == MAX_BROWSER_ARGS) + return false; + #undef MAX_BROWSER_ARGS + + //printf("calling execvp(\"%s\"", path); + //for (i = 0; args[i]; i++) + // printf(", \"%s\"", args[i]); + //printf("); ...\n\n\n"); + + execvp(path, args); + return(false); // exec shouldn't return unless there's an error. } #endif @@ -1643,8 +1669,16 @@ int main(int argc, char **argv) // if(game.registernow){ if(regnow) { + #if PLATFORM_LINUX // (this may not be necessary any more.) + launch_web_browser("http://www.wolfire.com/registerlinux.html"); + #else launch_web_browser("http://www.wolfire.com/registerpc.html"); + #endif } + + #if PLATFORM_LINUX // (this may not be necessary any more.) + _exit(0); // !!! FIXME: hack...crashes on exit! + #endif return 0; } catch (const std::exception& error) @@ -2366,7 +2400,7 @@ int main(int argc, char **argv) extern int channels[100]; extern FSOUND_SAMPLE * samp[100]; - extern FSOUND_STREAM * strm[10]; + extern FSOUND_STREAM * strm[20]; extern "C" void PlaySoundEx(int chan, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused) {