int Sys_Main(char* commandLine){ Q_strncpyz(cmdline, commandLine, sizeof(cmdline)); Sys_SetDefaultInstallPath( DEFAULT_BASEDIR ); Sys_TimerInit( ); Sys_PlatformInit( ); Sys_InitializeCriticalSections(); Sys_ThreadMain(); CON_Init(); /* Sys_ImageFindConstant(); */ Com_Init( commandLine ); while ( 1 ) { Com_Frame(); } }
/* ================= main ================= */ int main(int argc, char **argv) { int i; char commandLine[MAX_STRING_CHARS] = { 0 }; #ifndef DEDICATED // SDL version check // Compile time # if !SDL_VERSION_ATLEAST(MINSDL_MAJOR, MINSDL_MINOR, MINSDL_PATCH) # error A more recent version of SDL is required # endif // Run time const SDL_version *ver = SDL_Linked_Version(); #define MINSDL_VERSION \ XSTRING(MINSDL_MAJOR) "." \ XSTRING(MINSDL_MINOR) "." \ XSTRING(MINSDL_PATCH) if (SDL_VERSIONNUM(ver->major, ver->minor, ver->patch) < SDL_VERSIONNUM(MINSDL_MAJOR, MINSDL_MINOR, MINSDL_PATCH)) { Sys_Dialog(DT_ERROR, va("SDL version " MINSDL_VERSION " or greater is required, " "but only version %d.%d.%d was found. You may be able to obtain a more recent copy " "from http://www.libsdl.org/.", ver->major, ver->minor, ver->patch), "SDL Library Too Old"); Sys_Exit(1); } #endif #ifdef __MORPHOS__ // don't let locales with decimal comma screw up the string to float conversions setlocale(LC_NUMERIC, "C"); DynLoadBase = OpenLibrary("dynload.library", 51); if (DynLoadBase && DynLoadBase->lib_Revision < 3) { CloseLibrary(DynLoadBase); DynLoadBase = NULL; } if (!DynLoadBase) { Sys_Dialog(DT_ERROR, "Unable to open dynload.library version 51.3 or newer", "dynload.library error"); Sys_Exit(1); } #endif Sys_PlatformInit(); // Set the initial time base Sys_Milliseconds(); Sys_ParseArgs(argc, argv); #if defined(__APPLE__) && !defined(DEDICATED) // argv[0] would be /Users/seth/etlegacy/etl.app/Contents/MacOS // But on OS X we want to pretend the binary path is the .app's parent // So that way the base folder is right next to the .app allowing { char parentdir[1024]; CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle()); if (!url) { Sys_Dialog(DT_ERROR, "A CFURL for the app bundle could not be found.", "Can't set Sys_SetBinaryPath"); Sys_Exit(1); } CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url); if (!url2 || !CFURLGetFileSystemRepresentation(url2, 1, (UInt8 *)parentdir, 1024)) { Sys_Dialog(DT_ERROR, "CFURLGetFileSystemRepresentation returned an error when finding the app bundle's parent directory.", "Can't set Sys_SetBinaryPath"); Sys_Exit(1); } Sys_SetBinaryPath(parentdir); CFRelease(url); CFRelease(url2); } #else Sys_SetBinaryPath(Sys_Dirname(argv[0])); #endif Sys_SetDefaultInstallPath(DEFAULT_BASEDIR); // Sys_BinaryPath() by default // Concatenate the command line for passing to Com_Init for (i = 1; i < argc; i++) { const qboolean containsSpaces = (qboolean)(strchr(argv[i], ' ') != NULL); if (containsSpaces) { Q_strcat(commandLine, sizeof(commandLine), "\""); } Q_strcat(commandLine, sizeof(commandLine), argv[i]); if (containsSpaces) { Q_strcat(commandLine, sizeof(commandLine), "\""); } Q_strcat(commandLine, sizeof(commandLine), " "); } Com_Init(commandLine); NET_Init(); #ifdef FEATURE_CURSES if (nocurses) { CON_Init_tty(); } else { CON_Init(); } #else CON_Init(); #endif signal(SIGILL, Sys_SigHandler); signal(SIGFPE, Sys_SigHandler); signal(SIGSEGV, Sys_SigHandler); signal(SIGTERM, Sys_SigHandler); signal(SIGINT, Sys_SigHandler); while (1) { IN_Frame(); Com_Frame(); } return 0; }
/* ================= main ================= */ int main( int argc, char **argv ) { #ifdef VCMODS_MISC bcm_host_init(); #endif int i; char commandLine[ MAX_STRING_CHARS ] = { 0 }; #ifndef DEDICATED #ifndef VCMODS_NOSDL // SDL version check // Compile time # if !SDL_VERSION_ATLEAST(MINSDL_MAJOR,MINSDL_MINOR,MINSDL_PATCH) # error A more recent version of SDL is required # endif // Run time SDL_version ver; SDL_GetVersion( &ver ); #define MINSDL_VERSION \ XSTRING(MINSDL_MAJOR) "." \ XSTRING(MINSDL_MINOR) "." \ XSTRING(MINSDL_PATCH) if( SDL_VERSIONNUM( ver.major, ver.minor, ver.patch ) < SDL_VERSIONNUM( MINSDL_MAJOR, MINSDL_MINOR, MINSDL_PATCH ) ) { Sys_Dialog( DT_ERROR, va( "SDL version " MINSDL_VERSION " or greater is required, " "but only version %d.%d.%d was found. You may be able to obtain a more recent copy " "from http://www.libsdl.org/.", ver.major, ver.minor, ver.patch ), "SDL Library Too Old" ); Sys_Exit( 1 ); } #endif #endif Sys_PlatformInit( ); // Set the initial time base Sys_Milliseconds( ); #ifdef MACOS_X // This is passed if we are launched by double-clicking if ( argc >= 2 && Q_strncmp ( argv[1], "-psn", 4 ) == 0 ) argc = 1; #endif Sys_ParseArgs( argc, argv ); Sys_SetBinaryPath( Sys_Dirname( argv[ 0 ] ) ); Sys_SetDefaultInstallPath( DEFAULT_BASEDIR ); // Concatenate the command line for passing to Com_Init for( i = 1; i < argc; i++ ) { const qboolean containsSpaces = strchr(argv[i], ' ') != NULL; if (containsSpaces) Q_strcat( commandLine, sizeof( commandLine ), "\"" ); Q_strcat( commandLine, sizeof( commandLine ), argv[ i ] ); if (containsSpaces) Q_strcat( commandLine, sizeof( commandLine ), "\"" ); Q_strcat( commandLine, sizeof( commandLine ), " " ); } Com_Init( commandLine ); NET_Init( ); CON_Init( ); signal( SIGILL, Sys_SigHandler ); signal( SIGFPE, Sys_SigHandler ); signal( SIGSEGV, Sys_SigHandler ); signal( SIGTERM, Sys_SigHandler ); signal( SIGINT, Sys_SigHandler ); while( 1 ) { IN_Frame( ); Com_Frame( ); } return 0; }
/* ================= main ================= */ int main( int argc, char **argv ) { int i; char commandLine[ MAX_STRING_CHARS ] = { 0 }; struct MET_Freq *freq; // Look for any of my arguments first. argv = ls_pref_load(&argc, argv); MET_Init(MET_GlobalFile(), "ioquake.met"); freq = (struct MET_Freq*) malloc( sizeof(struct MET_Freq) + (sizeof(double) * 1024)); MET_FreqInit(freq, MET_GlobalFile(), freq_pattern, 1024); #ifndef DEDICATED // SDL version check // Compile time # if !SDL_VERSION_ATLEAST(MINSDL_MAJOR,MINSDL_MINOR,MINSDL_PATCH) # error A more recent version of SDL is required # endif // Run time const SDL_version *ver = SDL_Linked_Version( ); #define STRING(s) #s #define XSTRING(s) STRING(s) #define MINSDL_VERSION \ XSTRING(MINSDL_MAJOR) "." \ XSTRING(MINSDL_MINOR) "." \ XSTRING(MINSDL_PATCH) if( SDL_VERSIONNUM( ver->major, ver->minor, ver->patch ) < SDL_VERSIONNUM( MINSDL_MAJOR, MINSDL_MINOR, MINSDL_PATCH ) ) { Sys_Print( "SDL version " MINSDL_VERSION " or greater required\n" ); Sys_Exit( 1 ); } #endif Sys_PlatformInit( ); Sys_ParseArgs( argc, argv ); Sys_SetBinaryPath( Sys_Dirname( argv[ 0 ] ) ); Sys_SetDefaultInstallPath( DEFAULT_BASEDIR ); // Concatenate the command line for passing to Com_Init for( i = 1; i < argc; i++ ) { Q_strcat( commandLine, sizeof( commandLine ), argv[ i ] ); Q_strcat( commandLine, sizeof( commandLine ), " " ); } Com_Init( commandLine ); NET_Init( ); CON_Init( ); signal( SIGILL, Sys_SigHandler ); signal( SIGFPE, Sys_SigHandler ); signal( SIGSEGV, Sys_SigHandler ); signal( SIGTERM, Sys_SigHandler ); while( 1 ) { MET_FreqSample(freq); QUAKE_CORE_LOOP_START(); #ifndef DEDICATED int appState = SDL_GetAppState( ); Cvar_SetValue( "com_unfocused", !( appState & SDL_APPINPUTFOCUS ) ); Cvar_SetValue( "com_minimized", !( appState & SDL_APPACTIVE ) ); #endif IN_Frame( ); // (LS) Input processing Com_Frame( ); // (LS) Everything else. QUAKE_CORE_LOOP_END(); MET_ClientCount(); } return 0; }
/* ================= main ================= */ int main(int argc, char **argv) { char commandLine[MAX_STRING_CHARS] = { 0 }; Sys_PlatformInit(); // Set the initial time base Sys_Milliseconds(); #ifdef __APPLE__ // This is passed if we are launched by double-clicking if (argc >= 2 && Q_strncmp(argv[1], "-psn", 4) == 0) { argc = 1; } #endif Sys_ParseArgs(argc, argv); #if defined(__APPLE__) && !defined(DEDICATED) // argv[0] would be /Users/seth/etlegacy/etl.app/Contents/MacOS // But on OS X we want to pretend the binary path is the .app's parent // So that way the base folder is right next to the .app allowing { char parentdir[1024]; CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle()); if (!url) { Sys_Dialog(DT_ERROR, "A CFURL for the app bundle could not be found.", "Can't set Sys_SetBinaryPath"); Sys_Exit(1); } CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url); if (!url2 || !CFURLGetFileSystemRepresentation(url2, 1, (UInt8 *)parentdir, 1024)) { Sys_Dialog(DT_ERROR, "CFURLGetFileSystemRepresentation returned an error when finding the app bundle's parent directory.", "Can't set Sys_SetBinaryPath"); Sys_Exit(1); } Sys_SetBinaryPath(parentdir); CFRelease(url); CFRelease(url2); } #else Sys_SetBinaryPath(Sys_Dirname(argv[0])); #endif Sys_SetDefaultInstallPath(DEFAULT_BASEDIR); // Sys_BinaryPath() by default // Concatenate the command line for passing to Com_Init Sys_BuildCommandLine(argc, argv, commandLine, sizeof(commandLine)); Com_Init(commandLine); NET_Init(); Sys_SetUpConsoleAndSignals(); Sys_GameLoop(); return 0; }
/* ================= main ================= */ int main( int argc, char **argv ) { int i; char commandLine[ MAX_STRING_CHARS ] = { 0 }; qboolean useBacktrace; #ifndef DEDICATED // SDL version check // Compile time # if !SDL_VERSION_ATLEAST(MINSDL_MAJOR,MINSDL_MINOR,MINSDL_PATCH) # error A more recent version of SDL is required # endif // Run time const SDL_version *ver = SDL_Linked_Version( ); #define MINSDL_VERSION \ XSTRING(MINSDL_MAJOR) "." \ XSTRING(MINSDL_MINOR) "." \ XSTRING(MINSDL_PATCH) if( SDL_VERSIONNUM( ver->major, ver->minor, ver->patch ) < SDL_VERSIONNUM( MINSDL_MAJOR, MINSDL_MINOR, MINSDL_PATCH ) ) { Sys_Print( "SDL version " MINSDL_VERSION " or greater required\n" ); Sys_Exit( 1 ); } #endif // Set the initial time base StartTime = Sys_Milliseconds(); useBacktrace = qtrue; for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "--nobacktrace")) { useBacktrace = qfalse; } } Sys_PlatformInit(useBacktrace); // Set the initial time base //Sys_Milliseconds( ); Sys_ParseArgs( argc, argv ); Sys_SetBinaryPath( Sys_Dirname( argv[ 0 ] ) ); Sys_SetDefaultInstallPath( DEFAULT_BASEDIR ); // Concatenate the command line for passing to Com_Init for( i = 1; i < argc; i++ ) { const qboolean containsSpaces = strchr(argv[i], ' ') != NULL; if (containsSpaces) Q_strcat( commandLine, sizeof( commandLine ), "\"" ); Q_strcat( commandLine, sizeof( commandLine ), argv[ i ] ); if (containsSpaces) Q_strcat( commandLine, sizeof( commandLine ), "\"" ); Q_strcat( commandLine, sizeof( commandLine ), " " ); } Com_Init( commandLine ); NET_Init( ); CON_Init( ); if (!useBacktrace) { signal( SIGILL, Sys_SigHandler ); signal( SIGFPE, Sys_SigHandler ); signal( SIGSEGV, Sys_SigHandler ); signal( SIGTERM, Sys_SigHandler ); signal( SIGINT, Sys_SigHandler ); } while( 1 ) { IN_Frame( ); Com_Frame( ); } return 0; }
/* ================= main ================= */ int main(int argc, char **argv) { int i; char commandLine[MAX_STRING_CHARS] = { 0 }; #ifndef DEDICATED // SDL version check // Compile time # if !SDL_VERSION_ATLEAST(MINSDL_MAJOR, MINSDL_MINOR, MINSDL_PATCH) # error A more recent version of SDL is required # endif // Run time const SDL_version *ver = SDL_Linked_Version(); #define MINSDL_VERSION \ XSTRING(MINSDL_MAJOR) "." \ XSTRING(MINSDL_MINOR) "." \ XSTRING(MINSDL_PATCH) if (SDL_VERSIONNUM(ver->major, ver->minor, ver->patch) < SDL_VERSIONNUM(MINSDL_MAJOR, MINSDL_MINOR, MINSDL_PATCH)) { Sys_Dialog(DT_ERROR, va("SDL version " MINSDL_VERSION " or greater is required, " "but only version %d.%d.%d was found. You may be able to obtain a more recent copy " "from http://www.libsdl.org/.", ver->major, ver->minor, ver->patch), "SDL Library Too Old"); Sys_Exit(1); } #endif Sys_PlatformInit(); // Set the initial time base Sys_Milliseconds(); Sys_ParseArgs(argc, argv); Sys_SetBinaryPath(Sys_Dirname(argv[0])); Sys_SetDefaultInstallPath(DEFAULT_BASEDIR); // Concatenate the command line for passing to Com_Init for (i = 1; i < argc; i++) { const qboolean containsSpaces = (qboolean)(strchr(argv[i], ' ') != NULL); if (containsSpaces) { Q_strcat(commandLine, sizeof(commandLine), "\""); } Q_strcat(commandLine, sizeof(commandLine), argv[i]); if (containsSpaces) { Q_strcat(commandLine, sizeof(commandLine), "\""); } Q_strcat(commandLine, sizeof(commandLine), " "); } Com_Init(commandLine); NET_Init(); #ifdef FEATURE_CURSES if (nocurses) { CON_Init_tty(); } else { CON_Init(); } #else CON_Init(); #endif signal(SIGILL, Sys_SigHandler); signal(SIGFPE, Sys_SigHandler); signal(SIGSEGV, Sys_SigHandler); signal(SIGTERM, Sys_SigHandler); signal(SIGINT, Sys_SigHandler); while (1) { IN_Frame(); Com_Frame(); } return 0; }
/* ================= main ================= */ int main( int argc, char **argv ) { int i; char commandLine[ MAX_STRING_CHARS ] = { 0 }; #if !defined(NOKIA) #ifndef DEDICATED // SDL version check // Compile time # if !SDL_VERSION_ATLEAST(MINSDL_MAJOR,MINSDL_MINOR,MINSDL_PATCH) # error A more recent version of SDL is required # endif // Run time const SDL_version *ver = SDL_Linked_Version( ); #define MINSDL_VERSION \ XSTRING(MINSDL_MAJOR) "." \ XSTRING(MINSDL_MINOR) "." \ XSTRING(MINSDL_PATCH) if( SDL_VERSIONNUM( ver->major, ver->minor, ver->patch ) < SDL_VERSIONNUM( MINSDL_MAJOR, MINSDL_MINOR, MINSDL_PATCH ) ) { Sys_Print( "SDL version " MINSDL_VERSION " or greater required\n" ); Sys_Exit( 1 ); } #endif #endif Sys_PlatformInit( ); // Set the initial time base Sys_Milliseconds( ); Sys_ParseArgs( argc, argv ); Sys_SetBinaryPath( Sys_Dirname( argv[ 0 ] ) ); Sys_SetDefaultInstallPath( DEFAULT_BASEDIR ); // Concatenate the command line for passing to Com_Init for( i = 1; i < argc; i++ ) { Q_strcat( commandLine, sizeof( commandLine ), argv[ i ] ); Q_strcat( commandLine, sizeof( commandLine ), " " ); } Com_Init( commandLine ); NET_Init( ); CON_Init( ); signal( SIGILL, Sys_SigHandler ); signal( SIGFPE, Sys_SigHandler ); signal( SIGSEGV, Sys_SigHandler ); signal( SIGTERM, Sys_SigHandler ); while( 1 ) { #if !defined(NOKIA) #ifndef DEDICATED int appState = SDL_GetAppState( ); Cvar_SetValue( "com_unfocused", !( appState & SDL_APPINPUTFOCUS ) ); Cvar_SetValue( "com_minimized", !( appState & SDL_APPACTIVE ) ); #endif #endif IN_Frame( ); Com_Frame( ); } return 0; }
int main ( int argc, char* argv[] ) { int i; char commandLine[ MAX_STRING_CHARS ] = { 0 }; Sys_PlatformInit(); CON_Init(); // get the initial time base Sys_Milliseconds(); #ifdef MACOS_X // This is passed if we are launched by double-clicking if ( argc >= 2 && Q_strncmp ( argv[1], "-psn", 4 ) == 0 ) argc = 1; #endif Sys_SetBinaryPath( Sys_Dirname( argv[ 0 ] ) ); Sys_SetDefaultInstallPath( DEFAULT_BASEDIR ); // Concatenate the command line for passing to Com_Init for( i = 1; i < argc; i++ ) { const bool containsSpaces = (strchr(argv[i], ' ') != NULL); if (containsSpaces) Q_strcat( commandLine, sizeof( commandLine ), "\"" ); Q_strcat( commandLine, sizeof( commandLine ), argv[ i ] ); if (containsSpaces) Q_strcat( commandLine, sizeof( commandLine ), "\"" ); Q_strcat( commandLine, sizeof( commandLine ), " " ); } Com_Init (commandLine); NET_Init(); // main game loop while (1) { bool shouldSleep = false; #if !defined(_JK2EXE) if ( com_dedicated->integer ) { shouldSleep = true; } #endif #if !defined(DEDICATED) if ( com_minimized->integer ) { shouldSleep = true; } #endif if ( shouldSleep ) { Sys_Sleep( 5 ); } // make sure mouse and joystick are only called once a frame IN_Frame(); // run the game Com_Frame(); } // never gets here return 0; }
int main(int argc, char **argv) { int i; char commandLine[ MAX_STRING_CHARS ] = { 0 }; #ifndef DEDICATED /* SDL version check */ /* Compile time */ # if !SDL_VERSION_ATLEAST(MINSDL_MAJOR,MINSDL_MINOR,MINSDL_PATCH) # error A more recent version of SDL is required # endif /* Run time */ const SDL_version *ver = SDL_Linked_Version(); #define MINSDL_VERSION \ XSTRING(MINSDL_MAJOR) "." \ XSTRING(MINSDL_MINOR) "." \ XSTRING(MINSDL_PATCH) if(SDL_VERSIONNUM(ver->major, ver->minor, ver->patch) < SDL_VERSIONNUM(MINSDL_MAJOR, MINSDL_MINOR, MINSDL_PATCH)){ sysmkdialog(DT_ERROR, va( "SDL version " MINSDL_VERSION " or greater is required, " "but only version %d.%d.%d was found.", ver->major, ver->minor, ver->patch), "SDL library too old"); Sys_Exit(1); } syssetenv("SDL_DISABLE_LOCK_KEYS", "1"); #endif Sys_PlatformInit( ); /* Set the initial time base */ sysmillisecs( ); Sys_ParseArgs(argc, argv); Sys_SetBinaryPath(sysdirname(argv[ 0 ])); syssetdefaultinstallpath(DEFAULT_BASEDIR); /* Concatenate the command line for passing to cominit */ for(i = 1; i < argc; i++){ const qbool containsSpaces = strchr(argv[i], ' ') != NULL; if(containsSpaces) Q_strcat(commandLine, sizeof(commandLine), "\""); Q_strcat(commandLine, sizeof(commandLine), argv[ i ]); if(containsSpaces) Q_strcat(commandLine, sizeof(commandLine), "\""); Q_strcat(commandLine, sizeof(commandLine), " "); } cominit(commandLine); netinit(); CON_Init(); signal(SIGILL, Sys_SigHandler); signal(SIGFPE, Sys_SigHandler); signal(SIGSEGV, Sys_SigHandler); signal(SIGTERM, Sys_SigHandler); signal(SIGINT, Sys_SigHandler); for(;;){ IN_Frame(); comframe(); } return 0; }
/* ================= main ================= */ int main( int argc, char **argv ) { int i; char commandLine[ MAX_STRING_CHARS ] = { 0 }; #ifndef DEDICATED // SDL version check // Compile time # if !SDL_VERSION_ATLEAST(MINSDL_MAJOR,MINSDL_MINOR,MINSDL_PATCH) # error A more recent version of SDL is required # endif // Run time const SDL_version *ver = SDL_Linked_Version( ); #define MINSDL_VERSION \ XSTRING(MINSDL_MAJOR) "." \ XSTRING(MINSDL_MINOR) "." \ XSTRING(MINSDL_PATCH) if( SDL_VERSIONNUM( ver->major, ver->minor, ver->patch ) < SDL_VERSIONNUM( MINSDL_MAJOR, MINSDL_MINOR, MINSDL_PATCH ) ) { Sys_Dialog( DT_ERROR, va( "SDL version " MINSDL_VERSION " or greater is required, " "but only version %d.%d.%d was found. You may be able to obtain a more recent copy " "from http://www.libsdl.org/.", ver->major, ver->minor, ver->patch ), "SDL Library Too Old" ); Sys_Exit( 1 ); } #endif //SDL_Delay(7000); // Wait for debugger remove(".openarena/baseoa/pak7-android.pk3"); // If some server pushed old VM scripts to us - remove them Sys_PlatformInit( ); // Set the initial time base Sys_Milliseconds( ); Sys_ParseArgs( argc, argv ); Sys_SetBinaryPath( Sys_Dirname( argv[ 0 ] ) ); Sys_SetDefaultInstallPath( DEFAULT_BASEDIR ); #ifdef __ANDROID__ if( getenv( "APPDIR" ) ) // Shared libraries on Android are inside /data/data/<java.app.name>/files, which is not on SD card. Sys_SetBinaryPath( getenv( "APPDIR" ) ); #endif // Concatenate the command line for passing to Com_Init for( i = 1; i < argc; i++ ) { const qboolean containsSpaces = strchr(argv[i], ' ') != NULL; if (containsSpaces) Q_strcat( commandLine, sizeof( commandLine ), "\"" ); Q_strcat( commandLine, sizeof( commandLine ), argv[ i ] ); if (containsSpaces) Q_strcat( commandLine, sizeof( commandLine ), "\"" ); Q_strcat( commandLine, sizeof( commandLine ), " " ); } Com_Init( commandLine ); NET_Init( ); CON_Init( ); #ifndef __ANDROID__ // Allow signals through, so Android native debugger will sohw us some stack trace signal( SIGILL, Sys_SigHandler ); signal( SIGFPE, Sys_SigHandler ); signal( SIGSEGV, Sys_SigHandler ); signal( SIGTERM, Sys_SigHandler ); signal( SIGINT, Sys_SigHandler ); #endif while( 1 ) { IN_Frame( ); Com_Frame( ); } return 0; }
/* ================= main ================= */ int main( int argc, char **argv ) { int i; char commandLine[ MAX_STRING_CHARS ] = { 0 }; extern void Sys_LaunchAutoupdater(int argc, char **argv); Sys_LaunchAutoupdater(argc, argv); #ifndef DEDICATED // SDL version check // Compile time # if !SDL_VERSION_ATLEAST(MINSDL_MAJOR,MINSDL_MINOR,MINSDL_PATCH) # error A more recent version of SDL is required # endif // Run time SDL_version ver; SDL_GetVersion( &ver ); #define MINSDL_VERSION \ XSTRING(MINSDL_MAJOR) "." \ XSTRING(MINSDL_MINOR) "." \ XSTRING(MINSDL_PATCH) if( SDL_VERSIONNUM( ver.major, ver.minor, ver.patch ) < SDL_VERSIONNUM( MINSDL_MAJOR, MINSDL_MINOR, MINSDL_PATCH ) ) { Sys_Dialog( DT_ERROR, va( "SDL version " MINSDL_VERSION " or greater is required, " "but only version %d.%d.%d was found. You may be able to obtain a more recent copy " "from http://www.libsdl.org/.", ver.major, ver.minor, ver.patch ), "SDL Library Too Old" ); Sys_Exit( 1 ); } SDL_EventState( SDL_DROPFILE, SDL_ENABLE ); #endif Sys_PlatformInit( ); // Set the initial time base Sys_Milliseconds( ); #ifdef __APPLE__ // This is passed if we are launched by double-clicking if ( argc >= 2 && Q_strncmp ( argv[1], "-psn", 4 ) == 0 ) argc = 1; #endif Sys_ParseArgs( argc, argv ); Sys_SetBinaryPath( Sys_Dirname( argv[ 0 ] ) ); Sys_SetDefaultInstallPath( DEFAULT_BASEDIR ); // Concatenate the command line for passing to Com_Init for( i = 1; i < argc; i++ ) { const qboolean containsSpaces = strchr(argv[i], ' ') != NULL; if (containsSpaces) Q_strcat( commandLine, sizeof( commandLine ), "\"" ); Q_strcat( commandLine, sizeof( commandLine ), argv[ i ] ); if (containsSpaces) Q_strcat( commandLine, sizeof( commandLine ), "\"" ); Q_strcat( commandLine, sizeof( commandLine ), " " ); } CON_Init( ); Com_Init( commandLine ); NET_Init( ); signal( SIGILL, Sys_SigHandler ); signal( SIGFPE, Sys_SigHandler ); signal( SIGSEGV, Sys_SigHandler ); signal( SIGTERM, Sys_SigHandler ); signal( SIGINT, Sys_SigHandler ); #if !defined DEDICATED && !defined __APPLE__ && !defined WIN32 // HACK: Before SDL 2.0.4, Linux (X11) did not set numlock or capslock state // so I made the engine always assumed num lock was on. // NOTE: The SDL mod state on X11 is not set at this point even when it's fixed // and will be corrected regardless of what is done here, // but limit to SDL 2.0.3 and earlier so that the message isn't shown. if( SDL_VERSIONNUM( ver.major, ver.minor, ver.patch ) < SDL_VERSIONNUM( 2, 0, 4 ) ) { if ( !( SDL_GetModState() & KMOD_NUM ) ) { Com_Printf("INFO: Forcing NUMLOCK modifier state to enabled (actual state unknown)!\n"); SDL_SetModState( SDL_GetModState() | KMOD_NUM ); } } #endif while( 1 ) { Com_Frame( ); } return 0; }
/* ================= main ================= */ int main( int argc, char **argv ) { int i; char commandLine[ MAX_STRING_CHARS ] = { 0 }; qboolean useBacktrace; qboolean useConsoleOutput; qboolean useDpiAware; qboolean demoNameAsArg; qboolean gotFirstArg; #ifndef DEDICATED // SDL version check // Compile time # if !SDL_VERSION_ATLEAST(MINSDL_MAJOR,MINSDL_MINOR,MINSDL_PATCH) # error A more recent version of SDL is required # endif // Run time const SDL_version *ver = SDL_Linked_Version( ); #ifdef _WIN32 InitializeCriticalSection(&printCriticalSection); #endif #define MINSDL_VERSION \ XSTRING(MINSDL_MAJOR) "." \ XSTRING(MINSDL_MINOR) "." \ XSTRING(MINSDL_PATCH) if( SDL_VERSIONNUM( ver->major, ver->minor, ver->patch ) < SDL_VERSIONNUM( MINSDL_MAJOR, MINSDL_MINOR, MINSDL_PATCH ) ) { Sys_Print( "SDL version " MINSDL_VERSION " or greater required\n" ); Sys_Exit( 1 ); } #endif // Set the initial time base StartTime = Sys_Milliseconds(); useBacktrace = qtrue; useConsoleOutput = qfalse; useDpiAware = qtrue; demoNameAsArg = qtrue; for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "--nobacktrace")) { useBacktrace = qfalse; } else if (!strcmp(argv[i], "--console-output")) { useConsoleOutput = qtrue; } else if (!strcmp(argv[i], "--no-dpi-aware")) { useDpiAware = qfalse; } else if (!strcmp(argv[i], "--no-demo-arg")) { demoNameAsArg = qfalse; } } Sys_PlatformInit(useBacktrace, useConsoleOutput, useDpiAware); // Set the initial time base //Sys_Milliseconds( ); Sys_ParseArgs( argc, argv ); Sys_SetBinaryPath( Sys_Dirname( argv[ 0 ] ) ); Sys_SetDefaultInstallPath( DEFAULT_BASEDIR ); // Concatenate the command line for passing to Com_Init gotFirstArg = qfalse; for( i = 1; i < argc; i++ ) { qboolean containsSpaces; if (!strcmp(argv[i], "--nobacktrace")) { continue; } else if (!strcmp(argv[i], "--console-output")) { continue; } else if (!strcmp(argv[i], "--no-dpi-aware")) { continue; } else if (!strcmp(argv[i], "--no-demo-arg")) { continue; } if (demoNameAsArg && !gotFirstArg) { if (argv[i][0] != '+' && argv[i][0] != '-') { Q_strcat(commandLine, sizeof(commandLine), "+demo \""); Q_strcat(commandLine, sizeof(commandLine), argv[i]); Q_strcat(commandLine, sizeof(commandLine), "\""); printf("demo: '%s'\n", argv[i]); continue; } } gotFirstArg = qtrue; containsSpaces = strchr(argv[i], ' ') != NULL; if (containsSpaces) Q_strcat( commandLine, sizeof( commandLine ), "\"" ); Q_strcat( commandLine, sizeof( commandLine ), argv[ i ] ); if (containsSpaces) Q_strcat( commandLine, sizeof( commandLine ), "\"" ); Q_strcat( commandLine, sizeof( commandLine ), " " ); } Com_Init( commandLine ); NET_Init( ); CON_Init( ); if (!useBacktrace) { signal( SIGILL, Sys_SigHandler ); signal( SIGFPE, Sys_SigHandler ); signal( SIGSEGV, Sys_SigHandler ); signal( SIGTERM, Sys_SigHandler ); signal( SIGINT, Sys_SigHandler ); } while( 1 ) { IN_Frame( ); Com_Frame( ); } return 0; }
int main(int argc, char* argv[]){ int len, i; char *cmdline; eventQue = (sysEvent_t*)evenQue_ADDR; // go back to real user for config loads Sys_LoadDifferentImage(argv); seteuid(getuid()); Sys_PlatformInit( ); Sys_ThreadInit(); Sys_ThreadMain(); Com_InitParse(); // Cvar_Init(); Sys_ParseArgs(argc, argv); // merge the command line, this is kinda silly for ( len = 1, i = 1; i < argc; i++ ) len += strlen( argv[i] ) + 1; cmdline = malloc( len ); *cmdline = 0; for ( i = 1; i < argc; i++ ){ if ( i > 1 ) { strcat( cmdline, " " ); } strcat( cmdline, argv[i] ); } // bk000306 - clear eventqueue memset( &eventQue[0], 0, MAX_QUED_EVENTS * sizeof( sysEvent_t ) ); Sys_Milliseconds(); // addrtest(); Com_Init( cmdline ); CON_Init(); signal( SIGILL, Sys_SigHandler ); // signal( SIGFPE, Sys_SigHandler ); // signal( SIGSEGV, Sys_SigHandler ); signal( SIGTERM, Sys_SigHandler ); signal( SIGINT, Sys_SigHandler ); fcntl( 0, F_SETFL, fcntl( 0, F_GETFL, 0 ) | FNDELAY ); if(!PbServerInitialize()){ Com_Printf("Unable to initialize PunkBuster. PunkBuster is disabled.\n"); } // GetVirtualFunctionArray(); // Com_Quit_f(); while ( 1 ) { static int fpu_word = _FPU_DEFAULT; _FPU_SETCW( fpu_word ); NET_Sleep(5); Com_Frame(); PbServerProcessEvents(); } }
/** * @brief SDL_main * @param[in] argc * @param[in] argv * @return */ int main(int argc, char **argv) { char commandLine[MAX_STRING_CHARS] = { 0 }; Sys_PlatformInit(); // Set the initial time base Sys_Milliseconds(); #ifdef __APPLE__ // This is passed if we are launched by double-clicking if (argc >= 2 && Q_strncmp(argv[1], "-psn", 4) == 0) { argc = 1; } #endif Sys_ParseArgs(argc, argv); #if defined(__APPLE__) && !defined(DEDICATED) // argv[0] would be /Users/seth/etlegacy/etl.app/Contents/MacOS // But on OS X we want to pretend the binary path is the .app's parent // So that way the base folder is right next to the .app allowing { char parentdir[1024]; CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle()); if (!url) { Sys_Dialog(DT_ERROR, "A CFURL for the app bundle could not be found.", "Can't set Sys_SetBinaryPath"); Sys_Exit(EXIT_FAILURE); } CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url); if (!url2 || !CFURLGetFileSystemRepresentation(url2, 1, (UInt8 *)parentdir, 1024)) { Sys_Dialog(DT_ERROR, "CFURLGetFileSystemRepresentation returned an error when finding the app bundle's parent directory.", "Can't set Sys_SetBinaryPath"); Sys_Exit(EXIT_FAILURE); } Sys_SetBinaryPath(parentdir); CFRelease(url); CFRelease(url2); } #else Sys_SetBinaryPath(Sys_Dirname(argv[0])); #endif Sys_SetDefaultInstallPath(DEFAULT_BASEDIR); // Sys_BinaryPath() by default // Concatenate the command line for passing to Com_Init Sys_BuildCommandLine(argc, argv, commandLine, sizeof(commandLine)); Com_Init(commandLine); NET_Init(); Sys_SetUpConsoleAndSignals(); #ifdef _WIN32 #ifndef DEDICATED if (com_viewlog->integer) { Sys_ShowConsoleWindow(1, qfalse); } #endif Sys_Splash(qfalse); { char cwd[MAX_OSPATH]; _getcwd(cwd, sizeof(cwd)); Com_Printf("Working directory: %s\n", cwd); } // hide the early console since we've reached the point where we // have a working graphics subsystems #ifndef LEGACY_DEBUG if (!com_dedicated->integer && !com_viewlog->integer) { Sys_ShowConsoleWindow(0, qfalse); } #endif #endif Sys_GameLoop(); return EXIT_SUCCESS; }
int main ( int argc, char* argv[] ) { int i; char commandLine[ MAX_STRING_CHARS ] = { 0 }; Sys_PlatformInit(); CON_Init(); // get the initial time base Sys_Milliseconds(); #ifdef MACOS_X // This is passed if we are launched by double-clicking if ( argc >= 2 && Q_strncmp ( argv[1], "-psn", 4 ) == 0 ) argc = 1; #endif Sys_SetBinaryPath( Sys_Dirname( argv[ 0 ] ) ); Sys_SetDefaultInstallPath( DEFAULT_BASEDIR ); // Concatenate the command line for passing to Com_Init for( i = 1; i < argc; i++ ) { const bool containsSpaces = (strchr(argv[i], ' ') != NULL); if (containsSpaces) Q_strcat( commandLine, sizeof( commandLine ), "\"" ); Q_strcat( commandLine, sizeof( commandLine ), argv[ i ] ); if (containsSpaces) Q_strcat( commandLine, sizeof( commandLine ), "\"" ); Q_strcat( commandLine, sizeof( commandLine ), " " ); } Com_Init (commandLine); #ifndef DEDICATED SDL_version compiled; SDL_version linked; SDL_VERSION( &compiled ); SDL_GetVersion( &linked ); Com_Printf( "SDL Version Compiled: %d.%d.%d\n", compiled.major, compiled.minor, compiled.patch ); Com_Printf( "SDL Version Linked: %d.%d.%d\n", linked.major, linked.minor, linked.patch ); #endif NET_Init(); // main game loop while (1) { if ( com_busyWait->integer ) { bool shouldSleep = false; #if !defined(_JK2EXE) if ( com_dedicated->integer ) { shouldSleep = true; } #endif if ( com_minimized->integer ) { shouldSleep = true; } if ( shouldSleep ) { Sys_Sleep( 5 ); } } // run the game Com_Frame(); } // never gets here return 0; }