cocoaTouch/SDLOverrides/SDL_uikitappdelegate.m
changeset 2691 c0da3a98c01c
parent 2689 dfda97c153a4
child 2692 ce9992075118
--- a/cocoaTouch/SDLOverrides/SDL_uikitappdelegate.m	Sat Jan 09 01:34:23 2010 +0000
+++ b/cocoaTouch/SDLOverrides/SDL_uikitappdelegate.m	Sun Jan 10 00:52:20 2010 +0000
@@ -20,19 +20,19 @@
  slouken@libsdl.org, vittorio.giovara@gmail.com
 */
 
+#import <pthread.h>
 #import "SDL_uikitappdelegate.h"
 #import "SDL_uikitopenglview.h"
 #import "SDL_events_c.h"
 #import "jumphack.h"
 #import "SDL_video.h"
+#import "gameSetup.h"
 
 #ifdef main
 #undef main
 #endif
 
 extern int SDL_main(int argc, char *argv[]);
-static int forward_argc;
-static char **forward_argv;
 
 int main (int argc, char **argv) {
 	int i;
@@ -62,10 +62,17 @@
 	return (SDLUIKitDelegate *)[[UIApplication sharedApplication] delegate];
 }
 
+
 - (void) startSDLgame {
+	pthread_t threadID;
 
+	pthread_create (&threadID, NULL, (void *) (*engineProtocolThread), NULL);
+	pthread_detach (threadID);
+
+	setupArgsForLocalPlay();
+	
 	/* run the user's application, passing argc and argv */
-	NSLog(@"Game is launching");
+	NSLog(@"Game is launching...");
 	SDL_main(forward_argc, forward_argv);
 	// can't reach here yet
 	NSLog(@"Game exited");
@@ -87,6 +94,9 @@
 	
 	[window addSubview:controller.view];
 	[window makeKeyAndVisible];
+	
+	// REMOVE ME when you're done with reverse engineering the protocol
+	[self performSelector:@selector(startSDLgame)];
 }
 
 -(void) applicationWillTerminate:(UIApplication *)application {