68int main(
int argc,
char *argv[])
70#ifdef GNUSTEP_BASE_LIBRARY
73#if (GNUSTEP_BASE_MAJOR_VERSION == 1 && (GNUSTEP_BASE_MINOR_VERSION == 24 && GNUSTEP_BASE_SUBMINOR_VERSION >= 9) || (GNUSTEP_BASE_MINOR_VERSION > 24)) || (GNUSTEP_BASE_MAJOR_VERSION > 1)
79 #define OO_SHOW_MSG(ooMsg, ooMsgTitle, ooMsgFlags) MessageBox(NULL, ooMsg, ooMsgTitle, ooMsgFlags)
82 #define TABS3 "\t\t\t"
86 #define MAX_PATH_LEN 256
87 char currentWorkingDir[MAX_PATH_LEN];
88 DWORD bufferSize = MAX_PATH_LEN;
90 QueryFullProcessImageName(GetCurrentProcess(), 0, currentWorkingDir, &bufferSize);
92 char *probeString = strrchr(currentWorkingDir,
'\\');
93 if (probeString) *probeString =
'\0';
96 char *pathEnvVar =
"Path";
97 const char *systemPath = SDL_getenv(pathEnvVar);
101 systemPath = SDL_getenv(pathEnvVar);
103 size_t currentWorkingDirLen = strlen(currentWorkingDir);
104 size_t systemPathLen = strlen(systemPath);
107 char *finalPath = malloc(systemPathLen + currentWorkingDirLen + 2 *
sizeof(
char));
108 strcpy(finalPath, currentWorkingDir);
109 strcat(finalPath,
";");
110 strcat(finalPath, systemPath);
112 SDL_setenv_unsafe(
"GNUSTEP_PATH_HANDLING",
"windows", YES);
113 SDL_setenv_unsafe(pathEnvVar, finalPath, YES);
114 SDL_setenv_unsafe(
"GNUSTEP_SYSTEM_ROOT", currentWorkingDir, YES);
115 SDL_setenv_unsafe(
"GNUSTEP_LOCAL_ROOT", currentWorkingDir, YES);
116 SDL_setenv_unsafe(
"GNUSTEP_NETWORK_ROOT", currentWorkingDir, YES);
117 SDL_setenv_unsafe(
"GNUSTEP_USERS_ROOT", currentWorkingDir, YES);
118#if OO_GAME_DATA_TO_USER_FOLDER
119 SDL_setenv_unsafe(
"HOMEPATH", strcat(SDL_getenv(
"LOCALAPPDATA"),
"\\Oolite\\oolite.app"), YES);
121 SDL_setenv_unsafe(
"HOMEPATH", currentWorkingDir, YES);
124 SetCurrentDirectory(currentWorkingDir);
132 setlocale(LC_ALL,
"C");
135 #define OO_SHOW_MSG(ooMsg, ooTitle, ooFlags) fprintf(stdout, "%s", ooMsg)
137 #define TABS2 "\t\t\t"
138 #define TABS3 "\t\t\t\t"
144 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
153 for (i = 1; i < argc; i++)
155 if (strcmp(
"-load", argv[i]) == 0)
159 NSString *argument = [NSString stringWithCString:argv[i]];
160 if (i < argc && [[argument lowercaseString] hasSuffix:
@".oolite-save"])
165 if (!strcmp(
"-help", argv[i]) || !strcmp(
"--help", argv[i]))
167 char const *processName = [[[NSProcessInfo processInfo] processName] UTF8String];
169 snprintf(s,
sizeof(s),
"Usage: %s [options]\n\n"
170 "Options can be any of the following: \n\n"
171 "--compile-sysdesc"TABS2
"Compile system descriptions *\n"
172 "--export-sysdesc"TABS2
"Export system descriptions *\n"
174 "-hdr"TABS3
"Start up in HDR mode\n"
176 "-load [filepath]"TABS2
"Load commander from [filepath]\n"TABS3 TABS4
"(\"-load\" is optional)\n"
177 "-message [messageString]"TABS1
"Display [messageString] at startup\n"
178 "-nodust "TABS2 TABS4
"Do not draw space dust\n"
179 "-noshaders"TABS2 TABS4
"Start up with shaders disabled\n"
180 "-nosplash "TABS2 TABS4
"Force disable splash screen on startup\n"
181 "-nosound "TABS2 TABS4
"Start up with sound disabled\n"
182 "-novsync"TABS3
"Force disable V-Sync\n"
183 "--openstep"TABS2 TABS4
"When compiling or exporting\n"TABS3 TABS4
"system descriptions, use openstep\n"TABS3 TABS4
"format *\n"
184 "-showversion"TABS2 TABS4
"Display version at startup screen\n"
185 "-splash"TABS3 TABS4
"Force splash screen on startup\n"
186 "-verify-oxp [filepath] "TABS1
"Verify OXP at [filepath] *\n"
187 "--xml"TABS3 TABS4
"When compiling or exporting\n"TABS3 TABS4
"system descriptions, use xml\n"TABS3 TABS4
"format *\n"
189 "Options marked with \"*\" are available only in Test Release configuration.\n"
191 "Debug functionality enabled (Test Release): "
199 "Clang version " STRINGIFY(__clang_major__)
"." STRINGIFY(__clang_minor__)
"." STRINGIFY(__clang_patchlevel__)
201 "GCC version " STRINGIFY(__GNUC__)
"." STRINGIFY(__GNUC_MINOR__)
"." STRINGIFY(__GNUC_PATCHLEVEL__)
205 OO_SHOW_MSG(s, processName, MB_OK);
206 OOLog(
@"process.args",
@"%s option detected, exiting after help page has been displayed.", argv[i]);
219 @catch (NSException *exception)
221 OOLogERR(
kOOLogException,
@"Root exception handler hit - terminating. This is an internal error, please report it. Exception name: %@, reason: %@", [exception name], [exception reason]);