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

Functions

int main (int argc, const char *argv[])
 
(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.

Definition at line 528 of file OOOpenGLExtensionManager.m.

555{
556 shadersAvailable = NO;
557 shadersForceDisabled = NO;
558
559 /* Some cards claim to support shaders but do so extremely
560 * badly. These are listed in gpu-settings.plist where we know
561 * about them; for those we don't being able to run with
562 * -noshaders may help get the game up and running at a frame rate
563 * where thegraphics settings can be changed. - CIM */
564 NSArray *arguments = [[NSProcessInfo processInfo] arguments];
565 NSString *arg = nil;
566 // scan for shader overrides: -noshaders || --noshaders
567 foreach (arg, arguments)
568 {
569 if ([arg isEqual:@"-noshaders"] || [arg isEqual:@"--noshaders"])
570 {
571 shadersForceDisabled = YES;
572 OOLog(kOOLogOpenGLShaderSupport, @"%@", @"Shaders will not be used (disabled on command line).");
573 return;
574 }
575 }
576
577 NSString * const requiredExtension[] =
578 {
579 @"GL_ARB_shading_language_100",
580 @"GL_ARB_fragment_shader",
581 @"GL_ARB_vertex_shader",
582 @"GL_ARB_multitexture",
583 @"GL_ARB_shader_objects",
584 nil // sentinel - don't remove!
585 };
586 NSString * const *required = NULL;
587
588 for (required = requiredExtension; *required != nil; ++required)
589 {
590 if (![self haveExtension:*required])
591 {
592 OOLog(kOOLogOpenGLShaderSupport, @"Shaders will not be used (OpenGL extension %@ is not available).", *required);
593 return;
594 }
595 }
596
597#if OOLITE_WINDOWS
598 glGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC)wglGetProcAddress("glGetObjectParameterivARB");
599 glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC)wglGetProcAddress("glCreateShaderObjectARB");
600 glGetInfoLogARB = (PFNGLGETINFOLOGARBPROC)wglGetProcAddress("glGetInfoLogARB");
601 glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC)wglGetProcAddress("glCreateProgramObjectARB");
602 glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC)wglGetProcAddress("glAttachObjectARB");
603 glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC)wglGetProcAddress("glDeleteObjectARB");
604 glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC)wglGetProcAddress("glLinkProgramARB");
605 glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC)wglGetProcAddress("glCompileShaderARB");
606 glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC)wglGetProcAddress("glShaderSourceARB");
607 glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC)wglGetProcAddress("glUseProgramObjectARB");
608 glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)wglGetProcAddress("glActiveTextureARB");
609 glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC)wglGetProcAddress("glGetUniformLocationARB");
610 glUniform1iARB = (PFNGLUNIFORM1IARBPROC)wglGetProcAddress("glUniform1iARB");
611 glUniform1fARB = (PFNGLUNIFORM1FARBPROC)wglGetProcAddress("glUniform1fARB");
612 glUniformMatrix3fvARB = (PFNGLUNIFORMMATRIX3FVARBPROC)wglGetProcAddress("glUniformMatrix3fvARB");
613 glUniformMatrix4fvARB = (PFNGLUNIFORMMATRIX4FVARBPROC)wglGetProcAddress("glUniformMatrix4fvARB");
614 glUniform4fvARB = (PFNGLUNIFORM4FVARBPROC)wglGetProcAddress("glUniform4fvARB");
615 glUniform2fvARB = (PFNGLUNIFORM2FVARBPROC)wglGetProcAddress("glUniform2fvARB");
616 glBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC)wglGetProcAddress("glBindAttribLocationARB");
617 glEnableVertexAttribArrayARB = (PFNGLENABLEVERTEXATTRIBARRAYARBPROC)wglGetProcAddress("glEnableVertexAttribArrayARB");
618 glVertexAttribPointerARB = (PFNGLVERTEXATTRIBPOINTERARBPROC)wglGetProcAddress("glVertexAttribPointerARB");
619 glDisableVertexAttribArrayARB = (PFNGLDISABLEVERTEXATTRIBARRAYARBPROC)wglGetProcAddress("glDisableVertexAttribArrayARB");
620 glValidateProgramARB = (PFNGLVALIDATEPROGRAMARBPROC)wglGetProcAddress("glValidateProgramARB");
621#endif
622
623 glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &textureImageUnitCount);
624
625 shadersAvailable = YES;
626}
#define OOLog(class, format,...)
Definition OOLogging.h:88
static NSString *const kOOLogOpenGLShaderSupport
return nil

References EXPECT_NOT.

◆ init [1/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 30 of file OOOpenALController.m.

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

References nil, and sSingleton.

◆ init [2/2]

- (id) init

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

Definition at line 50 of file MyOpenGLView.m.

357{
358 self = [super init];
359
360 NSString *cmdLineArgsStr = @"Startup command: ";
361
362 // SDL splash screen settings
363
364 NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
365 showSplashScreen = [prefs oo_boolForKey:@"splash-screen" defaultValue:YES];
366 vSyncPreference = [prefs oo_boolForKey:@"v-sync" defaultValue:YES];
367 bitsPerColorComponent = [prefs oo_boolForKey:@"hdr" defaultValue:NO] ? 16 : 8;
368
369 NSArray *arguments = nil;
370 NSEnumerator *argEnum = nil;
371 NSString *arg = nil;
372 BOOL noSplashArgFound = NO;
373
374 [self initKeyMappingData];
375
376 // preload the printscreen key into our translation array because SDLK_PRINTSCREEN isn't available
378
379 arguments = [[NSProcessInfo processInfo] arguments];
380
381 // scan for splash screen overrides: -nosplash || --nosplash , -splash || --splash
382 // scan for V-sync disabling overrides: -novsync || --novsync
383 for (argEnum = [arguments objectEnumerator]; (arg = [argEnum nextObject]); )
384 {
385 if ([arg isEqual:@"-nosplash"] || [arg isEqual:@"--nosplash"])
386 {
387 showSplashScreen = NO;
388 noSplashArgFound = YES; // -nosplash always trumps -splash
389 }
390 else if (([arg isEqual:@"-splash"] || [arg isEqual:@"--splash"]) && !noSplashArgFound)
391 {
392 showSplashScreen = YES;
393 }
394
395 // if V-sync is disabled at the command line, override the defaults file
396 if ([arg isEqual:@"-novsync"] || [arg isEqual:@"--novsync"]) vSyncPreference = NO;
397
398 if ([arg isEqual: @"-hdr"]) bitsPerColorComponent = 16;
399
400 // build the startup command string so that we can log it
401 cmdLineArgsStr = [cmdLineArgsStr stringByAppendingFormat:@"%@ ", arg];
402 }
403
404 OOLog(@"process.args", @"%@", cmdLineArgsStr);
405
406 matrixManager = [[OOOpenGLMatrixManager alloc] init];
407
408 // TODO: This code up to and including stickHandler really ought
409 // not to be in this class.
410 OOLog(@"sdl.init", @"%@", @"initialising SDL");
411 if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD))
412 {
413 OOLog(@"sdl.init.failed", @"Unable to init SDL: %s\n", SDL_GetError());
414 [self dealloc];
415 return nil;
416 }
417
418 [self populateFullScreenModelist];
419
420 // Find what the full screen and windowed settings are.
421 fullScreen = NO;
422 currentSize = 0;
423 [self loadWindowSize];
424 [self loadFullscreenSettings];
425
426 // Set up the drawing surface's dimensions.
427 firstScreen = (fullScreen) ? [self modeAsSize: currentSize] : currentWindowSize;
428 viewSize = firstScreen; // viewSize must be set prior to splash screen initialization
429
431 // end TODO
432
433 [OOSound setUp];
434 if (![OOSound isSoundOK]) OOLog(@"sound.init", @"%@", @"Sound system disabled.");
435
436 grabMouseStatus = NO;
437
438 OOLog(@"display.mode.list", @"%@", @"CREATING MODE LIST");
439
440
441
442#if OOLITE_WINDOWS
443 ShowWindow(windowHandle,SW_SHOWMINIMIZED);
444 updateContext = !showSplashScreen;
445#elif OOLITE_LINUX
446 if (!showSplashScreen)
447 {
448 // blank the surface / go to fullscreen
449 [self initialiseGLWithSize: firstScreen];
450 }
451#endif
452
453 [self autoShowMouse];
454
455 virtualJoystickPosition = NSMakePoint(0.0,0.0);
456 mouseWarped = NO;
457
458 _mouseVirtualStickSensitivityFactor = OOClamp_0_1_f([prefs oo_floatForKey:@"mouse-flight-sensitivity" defaultValue:0.95f]);
459 // ensure no chance of a divide by zero later on
461
462 typedString = [[NSMutableString alloc] initWithString:@""];
465
466 timeIntervalAtLastClick = timeSinceLastMouseWheel = [NSDate timeIntervalSinceReferenceDate];
467
468 _mouseWheelDelta = 0.0f;
469
471
472 return self;
473}
@ gvPrintScreenKey
@ gvStringInputNo
BOOL m_glContextInitialized
BOOL showSplashScreen
int bitsPerColorComponent
BOOL isAlphabetKeyDown
BOOL allowingStringInput
float _mouseVirtualStickSensitivityFactor
float _mouseWheelDelta
NSSize currentWindowSize
NSMutableString * typedString
int scancode2Unicode[NUM_KEYS]
NSPoint virtualJoystickPosition
NSTimeInterval timeSinceLastMouseWheel
OOOpenGLMatrixManager * matrixManager
NSSize firstScreen
NSTimeInterval timeIntervalAtLastClick
BOOL setStickHandlerClass:(Class aClass)
BOOL setUp()
Definition OOALSound.m:46

◆ main() [1/2]

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 68 of file main.m.

69{
70#ifdef GNUSTEP_BASE_LIBRARY
71 int i;
72
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)
74 [NSDate class]; // See github issue #202
75#endif
76
77#if OOLITE_WINDOWS
78
79 #define OO_SHOW_MSG(ooMsg, ooMsgTitle, ooMsgFlags) MessageBox(NULL, ooMsg, ooMsgTitle, ooMsgFlags)
80 #define TABS1 "\t"
81 #define TABS2 "\t\t"
82 #define TABS3 "\t\t\t"
83 #define TABS4 ""
84
85 // Detect current working directory and set up GNUstep environment variables
86 #define MAX_PATH_LEN 256
87 char currentWorkingDir[MAX_PATH_LEN];
88 DWORD bufferSize = MAX_PATH_LEN;
89
90 QueryFullProcessImageName(GetCurrentProcess(), 0, currentWorkingDir, &bufferSize);
91 // Strip the exe filenameb (from last backslash onwards), leave just the path
92 char *probeString = strrchr(currentWorkingDir, '\\');
93 if (probeString) *probeString = '\0'; // currentWorkingDir now contains the path we need
94
95 // Prepend system PATH env variable with our own executable's path
96 char *pathEnvVar = "Path";
97 const char *systemPath = SDL_getenv(pathEnvVar);
98 if (!systemPath)
99 {
100 pathEnvVar = "PATH";
101 systemPath = SDL_getenv(pathEnvVar);
102 }
103 size_t currentWorkingDirLen = strlen(currentWorkingDir);
104 size_t systemPathLen = strlen(systemPath);
105 // the max possible length of the string below is systemPath plus the path
106 // we have determined for us, plus one char for the ";" and one char for the null terminator
107 char *finalPath = malloc(systemPathLen + currentWorkingDirLen + 2 * sizeof(char));
108 strcpy(finalPath, currentWorkingDir);
109 strcat(finalPath, ";");
110 strcat(finalPath, systemPath);
111
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);
120#else
121 SDL_setenv_unsafe("HOMEPATH", currentWorkingDir, YES);
122#endif
123
124 SetCurrentDirectory(currentWorkingDir);
125
126 free(finalPath);
127
128 /* Windows amibtiously starts apps with the C library locale set to the
129 system locale rather than the "C" locale as per spec. Fixing here so
130 numbers don't behave strangely.
131 */
132 setlocale(LC_ALL, "C");
133
134#else // Linux
135 #define OO_SHOW_MSG(ooMsg, ooTitle, ooFlags) fprintf(stdout, "%s", ooMsg)
136 #define TABS1 "\t\t"
137 #define TABS2 "\t\t\t"
138 #define TABS3 "\t\t\t\t"
139 #define TABS4 "\t"
140#endif
141
142 // Need this because we're not using the default run loop's autorelease
143 // pool.
144 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
146
147 @try
148 {
149 // dajt: allocate and set the NSApplication delegate manually because not
150 // using NIB to do this
151 controller = [[GameController alloc] init];
152
153 for (i = 1; i < argc; i++)
154 {
155 if (strcmp("-load", argv[i]) == 0)
156 {
157 i++;
158 }
159 NSString *argument = [NSString stringWithCString:argv[i]];
160 if (i < argc && [[argument lowercaseString] hasSuffix:@".oolite-save"])
161 {
162 [controller setPlayerFileToLoad:argument];
163 }
164
165 if (!strcmp("-help", argv[i]) || !strcmp("--help", argv[i]))
166 {
167 char const *processName = [[[NSProcessInfo processInfo] processName] UTF8String];
168 char s[2048];
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"
175#endif
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"
188 "\n"
189 "Options marked with \"*\" are available only in Test Release configuration.\n"
190 "Version "OO_VERSION_FULL"\n"
191 "Debug functionality enabled (Test Release): "
192#ifndef NDEBUG
193 "yes\n"
194#else
195 "no\n"
196#endif
197 "Built with "
199 "Clang version " STRINGIFY(__clang_major__) "." STRINGIFY(__clang_minor__) "." STRINGIFY(__clang_patchlevel__)
200#else
201 "GCC version " STRINGIFY(__GNUC__) "." STRINGIFY(__GNUC_MINOR__) "." STRINGIFY(__GNUC_PATCHLEVEL__)
202#endif
203 "\n\n", processName
204 );
205 OO_SHOW_MSG(s, processName, MB_OK);
206 OOLog(@"process.args", @"%s option detected, exiting after help page has been displayed.", argv[i]);
207 return 0;
208 }
209 }
210
211 // Release anything allocated during the controller initialisation that
212 // is no longer required.
213 DESTROY(pool);
214
215 // Call applicationDidFinishLaunching because NSApp is not running in
216 // GNUstep port.
217 [controller applicationDidFinishLaunching: nil];
218 }
219 @catch (NSException *exception)
220 {
221 OOLogERR(kOOLogException, @"Root exception handler hit - terminating. This is an internal error, please report it. Exception name: %@, reason: %@", [exception name], [exception reason]);
222 return EXIT_FAILURE;
223 }
224#endif
225
226 // never reached
227 return 0;
228}
#define OOLITE_WINDOWS
Definition OOCocoa.h:249
#define OOLITE_HAVE_CLANG
Definition OOCocoa.h:104
#define DESTROY(x)
Definition OOCocoa.h:75
#define OOLogERR(class, format,...)
Definition OOLogging.h:112
NSString *const kOOLogException
Definition OOLogging.m:651
void OOLoggingInit(void)
Definition OOLogging.m:585
#define OO_VERSION_FULL
Definition main.m:55

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

+ Here is the call graph for this function:

◆ main() [2/2]

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

Entry point for MacOS. Initializes logging and runs NSApplicationMain.

Parameters
argcthe number of command line arguments
argvthe string array values of the command line arguments
Returns
whatever NSApplicationMain returns

Definition at line 18 of file main.m.

19{
21 return NSApplicationMain(argc, argv);
22}

References OOLoggingInit().

+ 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 10753 of file Universe.m.

11005{
11006 // Handle command line options to transform system_description array for easier localization
11007
11008 NSArray *arguments = nil;
11009 NSString *arg = nil;
11010 BOOL compileSysDesc = NO, exportSysDesc = NO, xml = NO;
11011
11012 arguments = [[NSProcessInfo processInfo] arguments];
11013
11014 foreach (arg, arguments)
11015 {
11016 if ([arg isEqual:@"--compile-sysdesc"]) compileSysDesc = YES;
11017 else if ([arg isEqual:@"--export-sysdesc"]) exportSysDesc = YES;
11018 else if ([arg isEqual:@"--xml"]) xml = YES;
11019 else if ([arg isEqual:@"--openstep"]) xml = NO;
11020 }
11021
11022 if (compileSysDesc) CompileSystemDescriptions(xml);
11023 if (exportSysDesc) ExportSystemDescriptions(xml);
11024}
void CompileSystemDescriptions(BOOL asXML)
void ExportSystemDescriptions(BOOL asXML)

◆ 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 736 of file OOOXPVerifier.m.

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

◆ setGuiToIntroFirstGo:

- (void) setGuiToIntroFirstGo: (BOOL justCobra

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

Definition at line 9242 of file PlayerEntity.m.

9995 :(BOOL)justCobra
9996{
9997 NSString *text = nil;
9998 GuiDisplayGen *gui = [UNIVERSE gui];
9999 OOGUIRow msgLine = 2;
10000
10001 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:NO];
10002 [[UNIVERSE gameView] clearMouse];
10003 [[UNIVERSE gameView] clearKeys];
10004
10005
10006 if (justCobra)
10007 {
10008 [UNIVERSE removeDemoShips];
10009 [[OOCacheManager sharedCache] flush]; // At first startup, a lot of stuff is cached
10010 }
10011
10012 if (justCobra)
10013 {
10014 [self setupStartScreenGui];
10015
10016 // check for error messages from Resource Manager
10017 //[ResourceManager paths]; done in Universe already
10018 NSString *errors = [ResourceManager errors];
10019 if (errors != nil)
10020 {
10022 OOGUIRow i = msgLine = [gui addLongText:errors startingAtRow:ms_start align:GUI_ALIGN_LEFT];
10023 for (i-- ; i >= ms_start ; i--) [gui setColor:[OOColor redColor] forRow:i];
10024 msgLine++;
10025 }
10026
10027 // check for messages from OXPs
10029 if ([OXPsWithMessages count] > 0)
10030 {
10032
10033 // Show which OXPs were found with messages, but don't spam the screen if more than
10034 // a certain number of them exist
10035 if ([OXPsWithMessages count] < 5)
10036 {
10037 NSString *messageSourceList = [OXPsWithMessages componentsJoinedByString:@", "];
10038 messageToDisplay = OOExpandKey(@"oxp-containing-messages-list", messageSourceList);
10039 } else {
10040 messageToDisplay = OOExpandKey(@"oxp-containing-messages-found");
10041 }
10042
10044 OOGUIRow i = msgLine = [gui addLongText:messageToDisplay startingAtRow:ms_start align:GUI_ALIGN_LEFT];
10045 for (i--; i >= ms_start; i--)
10046 {
10047 [gui setColor:[OOColor orangeColor] forRow:i];
10048 }
10049 msgLine++;
10050 }
10051
10052 // check for messages from the command line
10053 NSArray* arguments = [[NSProcessInfo processInfo] arguments];
10054 unsigned i;
10055 for (i = 0; i < [arguments count]; i++)
10056 {
10057 if (([[arguments objectAtIndex:i] isEqual:@"-message"])&&(i < [arguments count] - 1))
10058 {
10060 NSString* message = [arguments oo_stringAtIndex:i + 1];
10061 OOGUIRow i = msgLine = [gui addLongText:message startingAtRow:ms_start align:GUI_ALIGN_CENTER];
10062 for (i-- ; i >= ms_start; i--)
10063 {
10064 [gui setColor:[OOColor magentaColor] forRow:i];
10065 }
10066 }
10067 if ([[arguments objectAtIndex:i] isEqual:@"-showversion"])
10068 {
10070 NSString *version = @"Version " @OO_VERSION_FULL;
10071 OOGUIRow i = msgLine = [gui addLongText:version startingAtRow:ms_start align:GUI_ALIGN_CENTER];
10072 for (i-- ; i >= ms_start; i--)
10073 {
10074 [gui setColor:[OOColor magentaColor] forRow:i];
10075 }
10076 }
10077 }
10078 }
10079 else
10080 {
10081 [gui clear];
10082
10083 text = DESC(@"oolite-ship-library-title");
10084 [gui setTitle:text];
10085
10086 text = DESC(@"oolite-ship-library-exit");
10087 [gui setText:text forRow:27 align:GUI_ALIGN_CENTER];
10088 [gui setColor:[OOColor yellowColor] forRow:27];
10089 }
10090
10091 [gui setShowTextCursor:NO];
10092
10093 [UNIVERSE setupIntroFirstGo: justCobra];
10094
10095 if (gui != nil)
10096 {
10098 }
10099 if ([self status] == STATUS_START_GAME)
10100 {
10102 }
10103
10104 [self setShowDemoShips:YES];
10105 if (justCobra)
10106 {
10107 [gui setBackgroundTextureKey:@"intro"];
10108 }
10109 else
10110 {
10111 [gui setBackgroundTextureKey:@"shiplibrary"];
10112 }
10113 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
10114}
NSInteger OOGUIRow
unsigned count
#define OOExpandKey(key,...)
#define DESC(key)
Definition Universe.h:848
OOEntityStatus status()
Definition Entity.m:794
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:304
OOColor * yellowColor()
Definition OOColor.m:292
OOColor * magentaColor()
Definition OOColor.m:298
OOMusicController * sharedController()
OOSystemID system_id
OOGUIScreenID gui_screen
NSArray * OXPsWithMessagesFound()