62int main(
int argc,
char *argv[])
67#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)
73 #define OO_SHOW_MSG(ooMsg, ooMsgTitle, ooMsgFlags) MessageBox(NULL, ooMsg, ooMsgTitle, ooMsgFlags)
76 #define TABS3 "\t\t\t"
80 #define MAX_PATH_LEN 256
81 char currentWorkingDir[MAX_PATH_LEN];
82 DWORD bufferSize = MAX_PATH_LEN;
84 QueryFullProcessImageName(GetCurrentProcess(), 0, currentWorkingDir, &bufferSize);
86 char *probeString = strrchr(currentWorkingDir,
'\\');
87 if (probeString) *probeString =
'\0';
90 char pathEnvVar[] =
"PATH";
91 char *systemPath = SDL_getenv(pathEnvVar);
92 size_t currentWorkingDirLen = strlen(currentWorkingDir);
93 size_t systemPathLen = strlen(systemPath);
96 char *finalPath = malloc(systemPathLen + currentWorkingDirLen + 2 *
sizeof(
char));
100 char *envVarString = malloc(systemPathLen + currentWorkingDirLen + strlen(pathEnvVar) + 3 *
sizeof(
char));
101 strcpy(finalPath, currentWorkingDir);
102 strcat(finalPath,
";");
103 strcat(finalPath, systemPath);
105 #define SETENVVAR(var, value) do {\
106 sprintf(envVarString, "%s=%s", (var), (value));\
107 SDL_putenv (envVarString);\
110 SETENVVAR(
"GNUSTEP_PATH_HANDLING",
"windows");
111 SETENVVAR(pathEnvVar, finalPath);
112 SETENVVAR(
"GNUSTEP_SYSTEM_ROOT", currentWorkingDir);
113 SETENVVAR(
"GNUSTEP_LOCAL_ROOT", currentWorkingDir);
114 SETENVVAR(
"GNUSTEP_NETWORK_ROOT", currentWorkingDir);
115 SETENVVAR(
"GNUSTEP_USERS_ROOT", currentWorkingDir);
116 SETENVVAR(
"HOMEPATH", currentWorkingDir);
118 SetCurrentDirectory(currentWorkingDir);
127 setlocale(LC_ALL,
"C");
130 #define OO_SHOW_MSG(ooMsg, ooTitle, ooFlags) fprintf(stdout, "%s", ooMsg)
132 #define TABS2 "\t\t\t"
133 #define TABS3 "\t\t\t\t"
139 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
148 for (i = 1; i < argc; i++)
150 if (strcmp(
"-load", argv[i]) == 0)
157 if (!strcmp(
"-help", argv[i]) || !strcmp(
"--help", argv[i]))
159 char const *processName = [[[NSProcessInfo processInfo] processName] UTF8String];
161 snprintf(s,
sizeof(s),
"Usage: %s [options]\n\n"
162 "Options can be any of the following: \n\n"
163 "--compile-sysdesc"TABS2
"Compile system descriptions *\n"
164 "--export-sysdesc"TABS2
"Export system descriptions *\n"
166 "-hdr"TABS3
"Start up in HDR mode\n"
168 "-load [filepath]"TABS2
"Load commander from [filepath]\n"
169 "-message [messageString]"TABS1
"Display [messageString] at startup\n"
170 "-nodust "TABS2 TABS4
"Do not draw space dust\n"
171 "-noshaders"TABS2 TABS4
"Start up with shaders disabled\n"
172 "-nosplash "TABS2 TABS4
"Force disable splash screen on startup\n"
173 "-nosound "TABS2 TABS4
"Start up with sound disabled\n"
174 "-novsync"TABS3
"Force disable V-Sync\n"
175 "--openstep"TABS2 TABS4
"When compiling or exporting\n"TABS3 TABS4
"system descriptions, use openstep\n"TABS3 TABS4
"format *\n"
176 "-showversion"TABS2 TABS4
"Display version at startup screen\n"
177 "-splash"TABS3 TABS4
"Force splash screen on startup\n"
178 "-verify-oxp [filepath] "TABS1
"Verify OXP at [filepath] *\n"
179 "--xml"TABS3 TABS4
"When compiling or exporting\n"TABS3 TABS4
"system descriptions, use xml\n"TABS3 TABS4
"format *\n"
181 "Options marked with \"*\" are available only in Test Release configuration.\n\n", processName);
182 OO_SHOW_MSG(s, processName, MB_OK);
183 OOLog(
@"process.args",
@"%s option detected, exiting after help page has been displayed.", argv[i]);
196 @catch (NSException *exception)
198 OOLogERR(
kOOLogException,
@"Root exception handler hit - terminating. This is an internal error, please report it. Exception name: %@, reason: %@", [exception name], [exception reason]);