Oolite
Loading...
Searching...
No Matches
Command Line Interface

Functions

(id) - OOOpenALController::init
(void) - Universe(OOPrivate)::runLocalizationTools
int main (int argc, char *argv[])
(id) - MyOpenGLView::init
(void) - PlayerEntity::setGuiToIntroFirstGo:
(void) - OOOpenGLExtensionManager(OOPrivate)::checkShadersSupported
(BOOL) + OOOXPVerifier::runVerificationIfRequested

Detailed Description

The command line is parsed and interpreted at various locations in the code. Here are the known functions that participate on cli arguments.

Function Documentation

◆ checkShadersSupported

- (void) checkShadersSupported

Scans the command line for -noshaders or –noshaders arguments.

Extends class OOOpenGLExtensionManager.

Definition at line 517 of file OOOpenGLExtensionManager.m.

518{
519 shadersAvailable = NO;
520 shadersForceDisabled = NO;
521
522 /* Some cards claim to support shaders but do so extremely
523 * badly. These are listed in gpu-settings.plist where we know
524 * about them; for those we don't being able to run with
525 * -noshaders may help get the game up and running at a frame rate
526 * where thegraphics settings can be changed. - CIM */
527 NSArray* arguments = [[NSProcessInfo processInfo] arguments];
528 NSString* arg = nil;
529 // scan for shader overrides: -noshaders || --noshaders
530 foreach (arg, arguments) {
531 if ([arg isEqual:@"-noshaders"] || [arg isEqual:@"--noshaders"]) {
532 shadersForceDisabled = YES;
533 OOLog(kOOLogOpenGLShaderSupport, @"%@", @"Shaders will not be used (disabled on command line).");
534 return;
535 }
536 }
537
538 NSString* const requiredExtension[] = {
539 @"GL_ARB_shading_language_100",
540 @"GL_ARB_fragment_shader",
541 @"GL_ARB_vertex_shader",
542 @"GL_ARB_multitexture",
543 @"GL_ARB_shader_objects",
544 nil // sentinel - don't remove!
545 };
546 NSString* const* required = NULL;
547
548 for (required = requiredExtension; *required != nil; ++required) {
549 if (![self haveExtension:*required]) {
550 OOLog(kOOLogOpenGLShaderSupport, @"Shaders will not be used (OpenGL extension %@ is not available).", *required);
551 return;
552 }
553 }
554
555#if OOLITE_WINDOWS
556 glGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC)wglGetProcAddress("glGetObjectParameterivARB");
557 glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC)wglGetProcAddress("glCreateShaderObjectARB");
558 glGetInfoLogARB = (PFNGLGETINFOLOGARBPROC)wglGetProcAddress("glGetInfoLogARB");
559 glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC)wglGetProcAddress("glCreateProgramObjectARB");
560 glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC)wglGetProcAddress("glAttachObjectARB");
561 glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC)wglGetProcAddress("glDeleteObjectARB");
562 glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC)wglGetProcAddress("glLinkProgramARB");
563 glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC)wglGetProcAddress("glCompileShaderARB");
564 glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC)wglGetProcAddress("glShaderSourceARB");
565 glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC)wglGetProcAddress("glUseProgramObjectARB");
566 glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)wglGetProcAddress("glActiveTextureARB");
567 glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC)wglGetProcAddress("glGetUniformLocationARB");
568 glUniform1iARB = (PFNGLUNIFORM1IARBPROC)wglGetProcAddress("glUniform1iARB");
569 glUniform1fARB = (PFNGLUNIFORM1FARBPROC)wglGetProcAddress("glUniform1fARB");
570 glUniformMatrix3fvARB = (PFNGLUNIFORMMATRIX3FVARBPROC)wglGetProcAddress("glUniformMatrix3fvARB");
571 glUniformMatrix4fvARB = (PFNGLUNIFORMMATRIX4FVARBPROC)wglGetProcAddress("glUniformMatrix4fvARB");
572 glUniform4fvARB = (PFNGLUNIFORM4FVARBPROC)wglGetProcAddress("glUniform4fvARB");
573 glUniform2fvARB = (PFNGLUNIFORM2FVARBPROC)wglGetProcAddress("glUniform2fvARB");
574 glBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC)wglGetProcAddress("glBindAttribLocationARB");
575 glEnableVertexAttribArrayARB = (PFNGLENABLEVERTEXATTRIBARRAYARBPROC)wglGetProcAddress("glEnableVertexAttribArrayARB");
576 glVertexAttribPointerARB = (PFNGLVERTEXATTRIBPOINTERARBPROC)wglGetProcAddress("glVertexAttribPointerARB");
577 glDisableVertexAttribArrayARB = (PFNGLDISABLEVERTEXATTRIBARRAYARBPROC)wglGetProcAddress("glDisableVertexAttribArrayARB");
578 glValidateProgramARB = (PFNGLVALIDATEPROGRAMARBPROC)wglGetProcAddress("glValidateProgramARB");
579#endif
580
581 glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &textureImageUnitCount);
582
583 shadersAvailable = YES;
584}
#define OOLog(class, format,...)
Definition OOLogging.h:84
static NSString *const kOOLogOpenGLShaderSupport
return nil

References checkShadersSupported, kOOLogOpenGLShaderSupport, nil, and OOLog.

Referenced by checkShadersSupported.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init [1/2]

- (id) init

Scans the command line for -nosplash, –nosplash, -splash, –splash- -novsync and –novsync arguments.

Definition at line 307 of file MyOpenGLView.m.

308{
309 self = [super init];
310
311 NSString* cmdLineArgsStr = @"Startup command: ";
312
313 // SDL splash screen settings
314
315 NSUserDefaults* prefs = [NSUserDefaults standardUserDefaults];
316 showSplashScreen = [prefs oo_boolForKey:@"splash-screen" defaultValue:YES];
317 vSyncPreference = [prefs oo_boolForKey:@"v-sync" defaultValue:YES];
318 bitsPerColorComponent = [prefs oo_boolForKey:@"hdr" defaultValue:NO] ? 16 : 8;
319
320 NSArray* arguments = nil;
321 NSEnumerator* argEnum = nil;
322 NSString* arg = nil;
323 BOOL noSplashArgFound = NO;
324
325 [self initKeyMappingData];
326
327 // preload the printscreen key into our translation array because SDLK_PRINTSCREEN isn't available
329
330 arguments = [[NSProcessInfo processInfo] arguments];
331
332 // scan for splash screen overrides: -nosplash || --nosplash , -splash || --splash
333 // scan for V-sync disabling overrides: -novsync || --novsync
334 for (argEnum = [arguments objectEnumerator]; (arg = [argEnum nextObject]);) {
335 if ([arg isEqual:@"-nosplash"] || [arg isEqual:@"--nosplash"]) {
336 showSplashScreen = NO;
337 noSplashArgFound = YES; // -nosplash always trumps -splash
338 } else if (([arg isEqual:@"-splash"] || [arg isEqual:@"--splash"]) && !noSplashArgFound) {
339 showSplashScreen = YES;
340 }
341
342 // if V-sync is disabled at the command line, override the defaults file
343 if ([arg isEqual:@"-novsync"] || [arg isEqual:@"--novsync"])
344 vSyncPreference = NO;
345
346 if ([arg isEqual:@"-hdr"])
348
349 // build the startup command string so that we can log it
350 cmdLineArgsStr = [cmdLineArgsStr stringByAppendingFormat:@"%@ ", arg];
351 }
352
353 OOLog(@"process.args", @"%@", cmdLineArgsStr);
354
355#if OOLITE_SPEECH_SYNTH
356#if OOLITE_ESPEAK
357 if (!SDL_getenv("ESPEAK_DATA_PATH")) {
358 espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 100, [[ResourceManager builtInPath] UTF8String], 0);
359 } else {
360 espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 100, NULL, 0);
361 }
362#endif
363#endif
364
365 matrixManager = [[OOOpenGLMatrixManager alloc] init];
366
367 // TODO: This code up to and including stickHandler really ought
368 // not to be in this class.
369 OOLog(@"sdl.init", @"%@", @"initialising SDL");
370 if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD)) {
371 OOLog(@"sdl.init.failed", @"Unable to init SDL: %s\n", SDL_GetError());
372 [self dealloc];
373 return nil;
374 }
375
376 [self populateFullScreenModelist];
377
378 // Find what the full screen and windowed settings are.
379 fullScreen = NO;
380 currentSize = 0;
381 [self loadWindowSize];
382 [self loadFullscreenSettings];
383
384 // Set up the drawing surface's dimensions.
385 firstScreen = (fullScreen) ? [self modeAsSize:currentSize] : currentWindowSize;
386 viewSize = firstScreen; // viewSize must be set prior to splash screen initialization
387
389 // end TODO
390
391 [OOSound setUp];
392 if (![OOSound isSoundOK])
393 OOLog(@"sound.init", @"%@", @"Sound system disabled.");
394
395 grabMouseStatus = NO;
396
397 OOLog(@"display.mode.list", @"%@", @"CREATING MODE LIST");
398
399 if (!showSplashScreen) {
400 // blank the surface / go to fullscreen
401 [self initialiseGLWithSize:firstScreen];
402 }
403
404 [self autoShowMouse];
405
406 virtualJoystickPosition = NSMakePoint(0.0, 0.0);
407 mouseWarped = NO;
408
409 _mouseVirtualStickSensitivityFactor = OOClamp_0_1_f([prefs oo_floatForKey:@"mouse-flight-sensitivity" defaultValue:0.95f]);
410 // ensure no chance of a divide by zero later on
413
414 typedString = [[NSMutableString alloc] initWithString:@""];
417
418 timeIntervalAtLastClick = timeSinceLastMouseWheel = [NSDate timeIntervalSinceReferenceDate];
419
420 _mouseWheelDelta = 0.0f;
421
422 return self;
423}
@ gvPrintScreenKey
@ gvStringInputNo
OOINLINE float OOClamp_0_1_f(float value) INLINE_CONST_FUNC
BOOL showSplashScreen
int bitsPerColorComponent
BOOL isAlphabetKeyDown
int scancode2Unicode[NUM_KEYS]
enum StringInput allowingStringInput
NSMutableString * typedString
float _mouseVirtualStickSensitivityFactor
float _mouseWheelDelta
NSSize currentWindowSize
OOOpenGLMatrixManager * matrixManager
NSPoint virtualJoystickPosition
NSTimeInterval timeSinceLastMouseWheel
NSSize firstScreen
NSTimeInterval timeIntervalAtLastClick
BOOL setStickHandlerClass:(Class aClass)
BOOL setUp()
Definition OOALSound.m:46

References _mouseVirtualStickSensitivityFactor, _mouseWheelDelta, allowingStringInput, autoShowMouse, bitsPerColorComponent, currentSize, currentWindowSize, dealloc, firstScreen, fullScreen, grabMouseStatus, gvPrintScreenKey, gvStringInputNo, init, initialiseGLWithSize:, initKeyMappingData, isAlphabetKeyDown, loadFullscreenSettings, loadWindowSize, matrixManager, mouseWarped, nil, OOClamp_0_1_f(), OOLog, populateFullScreenModelist, scancode2Unicode, OOJoystickManager::setStickHandlerClass:, OOSound::setUp, showSplashScreen, timeIntervalAtLastClick, timeSinceLastMouseWheel, typedString, viewSize, virtualJoystickPosition, and vSyncPreference.

Referenced by GameController::beginSplashScreen, and init.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init [2/2]

- (id) init

Scans the command line for -nosound or –nosound arguments.

Returns
returns the instance to OOOpenALController if sound shall be played and can be played, otherwise null

Definition at line 43 of file OOOpenALController.m.

44{
45 self = [super init];
46 if (self != nil) {
47 NSArray* arguments = nil;
48 NSEnumerator* argEnum = nil;
49 NSString* arg = nil;
50
51 arguments = [[NSProcessInfo processInfo] arguments];
52 for (argEnum = [arguments objectEnumerator]; (arg = [argEnum nextObject]);) {
53 if ([arg isEqual:@"-nosound"] || [arg isEqual:@"--nosound"]) {
54 [self release];
55 return nil;
56 }
57 }
58
59 ALuint error;
60 device = alcOpenDevice(NULL); // default device
61 if (!device) {
62 OOLog(kOOLogSoundInitError, @"%@", @"Failed to open default sound device");
63 [self release];
64 return nil;
65 }
66 context = alcCreateContext(device, NULL); // default context
67 if (!alcMakeContextCurrent(context)) {
68 OOLog(kOOLogSoundInitError, @"%@", @"Failed to create default sound context");
69 [self release];
70 return nil;
71 }
72 if ((error = alGetError()) != AL_NO_ERROR) {
73 OOLog(kOOLogSoundInitError, @"Error %d creating sound context", error);
74 }
75 OOAL(alDistanceModel(AL_NONE));
76 }
77 return self;
78}
static NSString *const kOOLogSoundInitError
#define OOAL(cmd)
Definition OOOpenAL.h:40

References context, device, init, kOOLogSoundInitError, nil, OOAL, and OOLog.

Referenced by init.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int argc,
char * argv[] )

Entry point for Linux and Windows systems. Initializes logging. If -load is passed, the argument after that is loaded as savegame.

Parameters
argcthe number of command line arguments
argvthe string array values of the command line arguments
Returns
returns 0 on success, or EXITFAILURE when an exception is caught

Definition at line 76 of file main.m.

77{
78#if defined(GNUSTEP_BASE_LIBRARY) || defined(OOLITE_SDL_MAC)
79 int i;
80
81#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)
82 [NSDate class]; // See github issue #202
83#endif
84
85#if OOLITE_WINDOWS
86
87#define OO_SHOW_MSG(ooMsg, ooMsgTitle, ooMsgFlags) MessageBox(NULL, ooMsg, ooMsgTitle, ooMsgFlags)
88#define TABS1 "\t"
89#define TABS2 "\t\t"
90#define TABS3 "\t\t\t"
91#define TABS4 ""
92
93// Detect current working directory and set up GNUstep environment variables
94#define MAX_PATH_LEN 256
95 char currentWorkingDir[MAX_PATH_LEN];
96 DWORD bufferSize = MAX_PATH_LEN;
97
98 QueryFullProcessImageName(GetCurrentProcess(), 0, currentWorkingDir, &bufferSize);
99 // Strip the exe filenameb (from last backslash onwards), leave just the path
100 char* probeString = strrchr(currentWorkingDir, '\\');
101 if (probeString)
102 *probeString = '\0'; // currentWorkingDir now contains the path we need
103
104 // Prepend system PATH env variable with our own executable's path
105 char* pathEnvVar = "Path";
106 const char* systemPath = SDL_getenv(pathEnvVar);
107 if (!systemPath) {
108 pathEnvVar = "PATH";
109 systemPath = SDL_getenv(pathEnvVar);
110 }
111 size_t currentWorkingDirLen = strlen(currentWorkingDir);
112 size_t systemPathLen = strlen(systemPath);
113 // the max possible length of the string below is systemPath plus the path
114 // we have determined for us, plus one char for the ";" and one char for the null terminator
115 char* finalPath = malloc(systemPathLen + currentWorkingDirLen + 2 * sizeof(char));
116 strcpy(finalPath, currentWorkingDir);
117 strcat(finalPath, ";");
118 strcat(finalPath, systemPath);
119
120 SDL_setenv_unsafe("GNUSTEP_PATH_HANDLING", "windows", YES);
121 SDL_setenv_unsafe(pathEnvVar, finalPath, YES);
122 SDL_setenv_unsafe("GNUSTEP_SYSTEM_ROOT", currentWorkingDir, YES);
123 SDL_setenv_unsafe("GNUSTEP_LOCAL_ROOT", currentWorkingDir, YES);
124 SDL_setenv_unsafe("GNUSTEP_NETWORK_ROOT", currentWorkingDir, YES);
125 SDL_setenv_unsafe("GNUSTEP_USERS_ROOT", currentWorkingDir, YES);
126#if OO_GAME_DATA_TO_USER_FOLDER
127 SDL_setenv_unsafe("HOMEPATH", strcat(SDL_getenv("LOCALAPPDATA"), "\\Oolite\\oolite.app"), YES);
128#else
129 SDL_setenv_unsafe("HOMEPATH", currentWorkingDir, YES);
130#endif
131
132 SetCurrentDirectory(currentWorkingDir);
133
134 free(finalPath);
135
136 /* Windows ambitiously starts apps with the C library locale set to the
137 system locale rather than the "C" locale as per spec. Fixing here so
138 numbers don't behave strangely.
139 */
140 setlocale(LC_ALL, "C");
141
142#else // Linux and Mac
143#if OOLITE_LINUX
144 char result[PATH_MAX];
145 ssize_t count = readlink("/proc/self/exe", result, PATH_MAX - 1);
146 result[count] = '\0';
147 char* last_slash = strrchr(result, '/');
148 if (last_slash != NULL) {
149 *last_slash = '\0'; // Chop off the executable name, leaving just the directory
150 }
151 chdir(result);
152#elif OOLITE_MAC_OS_X
153 // Run from the folder holding Resources and AddOns: Contents in an app bundle
154 // (executable in Contents/MacOS), otherwise the folder holding the executable.
155 char result[PATH_MAX];
156 uint32_t resultSize = sizeof(result);
157 char resolved[PATH_MAX];
158 if (_NSGetExecutablePath(result, &resultSize) == 0 && realpath(result, resolved) != NULL) {
159 char* last_slash = strrchr(resolved, '/');
160 if (last_slash != NULL) {
161 *last_slash = '\0';
162 }
163 chdir(resolved);
164 size_t length = strlen(resolved);
165 if (length >= 15 && strcmp(resolved + length - 15, "/Contents/MacOS") == 0) {
166 chdir("..");
167 }
168 }
169#endif
170#define OO_SHOW_MSG(ooMsg, ooTitle, ooFlags) fprintf(stdout, "%s", ooMsg)
171#define TABS1 "\t\t"
172#define TABS2 "\t\t\t"
173#define TABS3 "\t\t\t\t"
174#define TABS4 "\t"
175#endif
176
177 // Need this because we're not using the default run loop's autorelease
178 // pool.
179 NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
181
182 @try {
183 // dajt: allocate and set the NSApplication delegate manually because not
184 // using NIB to do this
185 controller = [[GameController alloc] init];
186
187 for (i = 1; i < argc; i++) {
188 if (strcmp("-load", argv[i]) == 0) {
189 i++;
190 }
191 NSString* argument = [NSString stringWithCString:argv[i]];
192 if (i < argc && [[argument lowercaseString] hasSuffix:@".oolite-save"]) {
193 [controller setPlayerFileToLoad:argument];
194 }
195
196 if (!strcmp("-help", argv[i]) || !strcmp("--help", argv[i])) {
197 char const* processName = [[[NSProcessInfo processInfo] processName] UTF8String];
198 char s[2048];
199 snprintf(s, sizeof(s), "Usage: %s [options]\n\n"
200 "Options can be any of the following: \n\n"
201 "--compile-sysdesc" TABS2 "Compile system descriptions *\n"
202 "--export-sysdesc" TABS2 "Export system descriptions *\n"
204 "-hdr" TABS3 "Start up in HDR mode\n"
205#endif
206 "-load [filepath]" TABS2 "Load commander from [filepath]\n" TABS3 TABS4 "(\"-load\" is optional)\n"
207 "-message [messageString]" TABS1 "Display [messageString] at startup\n"
208 "-nodust " TABS2 TABS4 "Do not draw space dust\n"
209 "-noshaders" TABS2 TABS4 "Start up with shaders disabled\n"
210 "-nosplash " TABS2 TABS4 "Force disable splash screen on startup\n"
211 "-nosound " TABS2 TABS4 "Start up with sound disabled\n"
212 "-novsync" TABS3 "Force disable V-Sync\n"
213 "--openstep" TABS2 TABS4 "When compiling or exporting\n" TABS3 TABS4 "system descriptions, use openstep\n" TABS3 TABS4 "format *\n"
214 "-showversion" TABS2 TABS4 "Display version at startup screen\n"
215 "-splash" TABS3 TABS4 "Force splash screen on startup\n"
216 "-verify-oxp [filepath] " TABS1 "Verify OXP at [filepath] *\n"
217 "--xml" TABS3 TABS4 "When compiling or exporting\n" TABS3 TABS4 "system descriptions, use xml\n" TABS3 TABS4 "format *\n"
218 "\n"
219 "Options marked with \"*\" are available only in Test Release configuration.\n"
220 "Version " OO_VERSION_FULL "\n"
221 "Debug functionality enabled (Test Release): "
222#ifdef OO_DEBUG_MONITOR_ENABLED
223 "yes\n"
224#else
225 "no\n"
226#endif
227 "Built with "
229 "Clang version " STRINGIFY(__clang_major__) "." STRINGIFY(__clang_minor__) "." STRINGIFY(__clang_patchlevel__)
230#else
231 "GCC version " STRINGIFY(__GNUC__) "." STRINGIFY(__GNUC_MINOR__) "." STRINGIFY(__GNUC_PATCHLEVEL__)
232#endif
233 "\n\n",
234 processName);
235 OO_SHOW_MSG(s, processName, MB_OK);
236 OOLog(@"process.args", @"%s option detected, exiting after help page has been displayed.", argv[i]);
237 return 0;
238 }
239 }
240
241 // Release anything allocated during the controller initialisation that
242 // is no longer required.
243 DESTROY(pool);
244
245 // Call applicationDidFinishLaunching because NSApp is not running in
246 // GNUstep port.
247 [controller applicationDidFinishLaunching:nil];
248 }
249 @catch (NSException* exception) {
250 OOLogERR(kOOLogException, @"Root exception handler hit - terminating. This is an internal error, please report it. Exception name: %@, reason: %@", [exception name], [exception reason]);
251 return EXIT_FAILURE;
252 }
253#endif
254
255 // never reached
256 return 0;
257}
#define OOLITE_WINDOWS
#define OOLITE_HAVE_CLANG
#define DESTROY(x)
#define OOLogERR(class, format,...)
Definition OOLogging.h:125
NSString *const kOOLogException
Definition OOLogging.m:600
void OOLoggingInit(void)
Definition OOLogging.m:534
unsigned count
#define STRINGIFY(s)
Definition main.m:58
#define OO_VERSION_FULL
Definition main.m:63

References GameController::applicationDidFinishLaunching:, count, DESTROY, kOOLogException, OO_VERSION_FULL, OOLITE_HAVE_CLANG, OOLITE_WINDOWS, OOLog, OOLogERR, OOLoggingInit(), GameController::setPlayerFileToLoad:, and STRINGIFY.

Here is the call graph for this function:

◆ runLocalizationTools

- (void) runLocalizationTools

Scans the command line for –complie-sysdesc, –export-sysdec, –xml and –penstep arguments.

Extends class Universe.

Definition at line 9873 of file Universe.m.

9874{
9875 // Handle command line options to transform system_description array for easier localization
9876
9877 NSArray* arguments = nil;
9878 NSString* arg = nil;
9879 BOOL compileSysDesc = NO, exportSysDesc = NO, xml = NO;
9880
9881 arguments = [[NSProcessInfo processInfo] arguments];
9882
9883 foreach (arg, arguments) {
9884 if ([arg isEqual:@"--compile-sysdesc"])
9885 compileSysDesc = YES;
9886 else if ([arg isEqual:@"--export-sysdesc"])
9887 exportSysDesc = YES;
9888 else if ([arg isEqual:@"--xml"])
9889 xml = YES;
9890 else if ([arg isEqual:@"--openstep"])
9891 xml = NO;
9892 }
9893
9894 if (compileSysDesc)
9896 if (exportSysDesc)
9898}
void CompileSystemDescriptions(BOOL asXML)
void ExportSystemDescriptions(BOOL asXML)

References CompileSystemDescriptions(), ExportSystemDescriptions(), nil, and runLocalizationTools.

Referenced by Universe::initWithGameView:, and runLocalizationTools.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ runVerificationIfRequested

+ (BOOL) runVerificationIfRequested

Scans the command line for -verify-oxp or –verify-oxp, followed by a path to the oxp to verify.

Returns
YES or NO

Definition at line 95 of file OOOXPVerifier.m.

96{
97 NSArray* arguments = nil;
98 NSEnumerator* argEnum = nil;
99 NSString* arg = nil;
100 NSString* foundPath = nil;
101 BOOL exists, isDirectory;
102 OOOXPVerifier* verifier = nil;
103 NSAutoreleasePool* pool = nil;
104
105 pool = [[NSAutoreleasePool alloc] init];
106
107 arguments = [[NSProcessInfo processInfo] arguments];
108
109 // Scan for -verify-oxp or --verify-oxp followed by relative path
110 for (argEnum = [arguments objectEnumerator]; (arg = [argEnum nextObject]);) {
111 if ([arg isEqual:@"-verify-oxp"] || [arg isEqual:@"--verify-oxp"]) {
112 foundPath = [argEnum nextObject];
113 if (foundPath == nil) {
114 OOLog(@"verifyOXP.noPath", @"***** ERROR: %@ passed without path argument; nothing to verify.", arg);
115 [pool release];
116 return YES;
117 }
118 foundPath = [foundPath stringByExpandingTildeInPath];
119 break;
120 }
121 }
122
123 if (foundPath == nil) {
124 [pool release];
125 return NO;
126 }
127
128 // We got a path; does it point to a directory?
129 exists = [[NSFileManager defaultManager] fileExistsAtPath:foundPath isDirectory:&isDirectory];
130 if (!exists) {
131 OOLog(@"verifyOXP.badPath", @"***** ERROR: no OXP exists at path \"%@\"; nothing to verify.", foundPath);
132 } else if (!isDirectory) {
133 OOLog(@"verifyOXP.badPath", @"***** ERROR: \"%@\" is a file, not an OXP directory; nothing to verify.", foundPath);
134 } else {
135 verifier = [[OOOXPVerifier alloc] initWithPath:foundPath];
136 [pool release];
137 pool = [[NSAutoreleasePool alloc] init];
138 [verifier run];
139 [verifier release];
140 }
141 [pool release];
142
143 // Whether or not we got a valid path, -verify-oxp was passed.
144 return YES;
145}

References nil, OOLog, run, and runVerificationIfRequested.

Referenced by runVerificationIfRequested.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setGuiToIntroFirstGo:

- (void) setGuiToIntroFirstGo: (BOOL) justCobra

Scans the command line for -message or -showversion arguments.

Definition at line 8817 of file PlayerEntity.m.

8817 :(BOOL)justCobra
8818{
8819 NSString* text = nil;
8820 GuiDisplayGen* gui = [UNIVERSE gui];
8821 OOGUIRow msgLine = 2;
8822
8823 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:NO];
8824 [[UNIVERSE gameView] clearMouse];
8825 [[UNIVERSE gameView] clearKeys];
8826
8827 if (justCobra) {
8828 [UNIVERSE removeDemoShips];
8829 [[OOCacheManager sharedCache] flush]; // At first startup, a lot of stuff is cached
8830 }
8831
8832 if (justCobra) {
8833 [self setupStartScreenGui];
8834
8835 // check for error messages from Resource Manager
8836 //[ResourceManager paths]; done in Universe already
8837 NSString* errors = [ResourceManager errors];
8838 if (errors != nil) {
8839 OOGUIRow ms_start = msgLine;
8840 OOGUIRow i = msgLine = [gui addLongText:errors startingAtRow:ms_start align:GUI_ALIGN_LEFT];
8841 for (i--; i >= ms_start; i--)
8842 [gui setColor:[OOColor redColor] forRow:i];
8843 msgLine++;
8844 }
8845
8846 // check for messages from OXPs
8847 NSArray* OXPsWithMessages = [ResourceManager OXPsWithMessagesFound];
8848 if ([OXPsWithMessages count] > 0) {
8849 NSString* messageToDisplay = @"";
8850
8851 // Show which OXPs were found with messages, but don't spam the screen if more than
8852 // a certain number of them exist
8853 if ([OXPsWithMessages count] < 5) {
8854 NSString* messageSourceList = [OXPsWithMessages componentsJoinedByString:@", "];
8855 messageToDisplay = OOExpandKey(@"oxp-containing-messages-list", messageSourceList);
8856 } else {
8857 messageToDisplay = OOExpandKey(@"oxp-containing-messages-found");
8858 }
8859
8860 OOGUIRow ms_start = msgLine;
8861 OOGUIRow i = msgLine = [gui addLongText:messageToDisplay startingAtRow:ms_start align:GUI_ALIGN_LEFT];
8862 for (i--; i >= ms_start; i--) {
8863 [gui setColor:[OOColor orangeColor] forRow:i];
8864 }
8865 msgLine++;
8866 }
8867
8868 // check for messages from the command line
8869 NSArray* arguments = [[NSProcessInfo processInfo] arguments];
8870 unsigned i;
8871 for (i = 0; i < [arguments count]; i++) {
8872 if (([[arguments objectAtIndex:i] isEqual:@"-message"]) && (i < [arguments count] - 1)) {
8873 OOGUIRow ms_start = msgLine;
8874 NSString* message = [arguments oo_stringAtIndex:i + 1];
8875 OOGUIRow i = msgLine = [gui addLongText:message startingAtRow:ms_start align:GUI_ALIGN_CENTER];
8876 for (i--; i >= ms_start; i--) {
8877 [gui setColor:[OOColor magentaColor] forRow:i];
8878 }
8879 }
8880 if ([[arguments objectAtIndex:i] isEqual:@"-showversion"]) {
8881 OOGUIRow ms_start = msgLine;
8882 NSString* version = @"Version " @OO_VERSION_FULL;
8883 OOGUIRow i = msgLine = [gui addLongText:version startingAtRow:ms_start align:GUI_ALIGN_CENTER];
8884 for (i--; i >= ms_start; i--) {
8885 [gui setColor:[OOColor magentaColor] forRow:i];
8886 }
8887 }
8888 }
8889 } else {
8890 [gui clear];
8891
8892 text = DESC(@"oolite-ship-library-title");
8893 [gui setTitle:text];
8894
8895 text = DESC(@"oolite-ship-library-exit");
8896 [gui setText:text forRow:27 align:GUI_ALIGN_CENTER];
8897 [gui setColor:[OOColor yellowColor] forRow:27];
8898 }
8899
8900 [gui setShowTextCursor:NO];
8901
8902 [UNIVERSE setupIntroFirstGo:justCobra];
8903
8904 if (gui != nil) {
8905 gui_screen = justCobra ? GUI_SCREEN_INTRO1 : GUI_SCREEN_SHIPLIBRARY;
8906 }
8907 if ([self status] == STATUS_START_GAME) {
8909 }
8910
8911 [self setShowDemoShips:YES];
8912 if (justCobra) {
8913 [gui setBackgroundTextureKey:@"intro"];
8914 } else {
8915 [gui setBackgroundTextureKey:@"shiplibrary"];
8916 }
8917 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
8918}
NSInteger OOGUIRow
#define OOExpandKey(key,...)
#define DESC(key)
Definition Universe.h:832
OOEntityStatus status()
Definition Entity.m:733
BOOL setBackgroundTextureKey:(NSString *key)
OOGUIRow addLongText:startingAtRow:align:(NSString *str,[startingAtRow] OOGUIRow row,[align] OOGUIAlignment alignment)
void setText:forRow:align:(NSString *str,[forRow] OOGUIRow row,[align] OOGUIAlignment alignment)
void setColor:forRow:(OOColor *color,[forRow] OOGUIRow row)
void setTitle:(NSString *str)
void setShowTextCursor:(BOOL yesno)
OOCacheManager * sharedCache()
OOColor * orangeColor()
Definition OOColor.m:289
OOColor * yellowColor()
Definition OOColor.m:279
OOColor * magentaColor()
Definition OOColor.m:284
OOMusicController * sharedController()
OOGUIScreenID gui_screen
NSArray * OXPsWithMessagesFound()

References GuiDisplayGen::addLongText:startingAtRow:align:, GuiDisplayGen::clear, count, DESC, ResourceManager::errors, OOCacheManager::flush, gui_screen, OOColor::magentaColor, nil, OO_VERSION_FULL, OOExpandKey, OOColor::orangeColor, ResourceManager::OXPsWithMessagesFound, OOMusicController::playThemeMusic, OOColor::redColor, GuiDisplayGen::setBackgroundTextureKey:, GuiDisplayGen::setColor:forRow:, setShowDemoShips:, GuiDisplayGen::setShowTextCursor:, GuiDisplayGen::setText:forRow:align:, GuiDisplayGen::setTitle:, setupStartScreenGui, OOCacheManager::sharedCache, OOMusicController::sharedController, Entity::status, and OOColor::yellowColor.

Referenced by PlayerEntity(LoadSave)::commanderSelector, PlayerEntity(OOControlsPrivate)::pollDemoControls:, Universe::reinitAndShowDemo:, and update:.

Here is the call graph for this function:
Here is the caller graph for this function: