From ff9f7d25c582c596983272aed58fb13b6a240a26 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Mon, 24 Oct 2005 11:29:34 +0000 Subject: [PATCH] Test having SM not run in the main thread. This is most noticeable during the loading window since events are still processed. It's possible that this causes problems if something in SDL or SM absolutely must be run in the main thread. One thing to consider is lowering the main thread's precedence. --- stepmania/PBProject/SDLMain.h | 3 ++- stepmania/PBProject/SDLMain.m | 18 +++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/stepmania/PBProject/SDLMain.h b/stepmania/PBProject/SDLMain.h index 4683df57a5..4f54d7c6ae 100755 --- a/stepmania/PBProject/SDLMain.h +++ b/stepmania/PBProject/SDLMain.h @@ -7,5 +7,6 @@ #import -@interface SDLMain : NSObject +@interface SDLMain : NSObject {} +- (void) startGame:(id)obj; @end diff --git a/stepmania/PBProject/SDLMain.m b/stepmania/PBProject/SDLMain.m index 17ab86e182..9c1166334a 100755 --- a/stepmania/PBProject/SDLMain.m +++ b/stepmania/PBProject/SDLMain.m @@ -63,6 +63,12 @@ static BOOL gFinderLaunch; /* The main class of the application, the application's delegate */ @implementation SDLMain +- (void) startGame:(id)obj +{ + /* Hand off to main application code */ + exit(SDL_main (gArgc, gArgv)); +} + /* Set the working directory to the .app's parent directory */ - (void) setupWorkingDirectory:(BOOL)shouldChdir { @@ -209,8 +215,6 @@ void CustomApplicationMain (int argc, char **argv) /* Called when the internal event loop has just started running */ - (void) applicationDidFinishLaunching: (NSNotification *) note { - int status; - /* Set the working directory to the .app's parent directory */ [self setupWorkingDirectory:gFinderLaunch]; @@ -219,11 +223,11 @@ void CustomApplicationMain (int argc, char **argv) [self fixMenu:[NSApp mainMenu] withAppName:[[NSProcessInfo processInfo] processName]]; #endif - /* Hand off to main application code */ - status = SDL_main (gArgc, gArgv); - - /* We're done, thank you for playing */ - exit(status); +#if 1 + [NSThread detachNewThreadSelector:@selector(startGame:) toTarget:self withObject:nil]; +#else + [self startGame:nil]; +#endif } @end