@@ -42,10 +42,16 @@ # include # undef BOOL # undef asm #endif +#ifdef OF_NINTENDO_DS +# define asm __asm__ +# include +# undef asm +#endif + enum { NO_COLOR, RED, GREEN, YELLOW @@ -117,11 +123,15 @@ if ((tid = sceKernelCreateThread("update_thread", callback_thread, 0x11, 0xFA0, 0, 0)) >= 0) sceKernelStartThread(tid, 0, 0); #endif -#if defined(__wii__) || defined(_PSP) +#ifdef OF_NINTENDO_DS + consoleDemoInit(); +#endif + +#if defined(__wii__) || defined(_PSP) || defined(OF_NINTENDO_DS) @try { return of_application_main(&argc, &argv, [TestsAppDelegate class]); } @catch (id e) { TestsAppDelegate *delegate = @@ -137,11 +147,10 @@ [delegate outputString: backtrace inColor: RED]; # if defined(__wii__) [delegate outputString: @"Press home button to exit!\n" inColor: NO_COLOR]; - for (;;) { WPAD_ScanPads(); if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) [OFApplication terminateWithStatus: 1]; @@ -148,10 +157,19 @@ VIDEO_WaitVSync(); } # elif defined(_PSP) sceKernelSleepThreadCB(); +# elif defined(OF_NINTENDO_DS) + [delegate outputString: @"Press start button to exit!" + inColor: NO_COLOR]; + for (;;) { + swiWaitForVBlank(); + scanKeys(); + if (keysDown() & KEY_START) + [OFApplication terminateWithStatus: 1]; + } # else abort(); # endif } #else @@ -190,11 +208,11 @@ pspDebugScreenPrintData([str UTF8String], [str UTF8StringLength]); #elif defined(STDOUT) switch (color) { case NO_COLOR: [of_stdout writeString: @"\r\033[K"]; -# ifdef __wii__ +# if defined(__wii__) || defined(OF_NINTENDO_DS) [of_stdout writeString: @"\033[37m"]; # endif break; case RED: [of_stdout writeString: @"\r\033[K\033[31;1m"]; @@ -282,10 +300,20 @@ if (!(pad.Buttons & PSP_CTRL_CROSS)) return; } } } +# endif +# ifdef OF_NINTENDO_DS + [self outputString: @"Press A to continue!" + inColor: NO_COLOR]; + for (;;) { + swiWaitForVBlank(); + scanKeys(); + if (keysDown() & KEY_A) + break; + } # endif #else [self outputString: @"failed\n" inColor: RED]; #endif @@ -355,10 +383,19 @@ #elif defined(_PSP) [self outputString: [OFString stringWithFormat: @"%d tests failed!", _fails] inColor: NO_COLOR]; sceKernelSleepThreadCB(); +#elif defined(OF_NINTENDO_DS) + [self outputString: @"Press start button to exit!" + inColor: NO_COLOR]; + for (;;) { + swiWaitForVBlank(); + scanKeys(); + if (keysDown() & KEY_START) + [OFApplication terminateWithStatus: _fails]; + } #else [OFApplication terminateWithStatus: _fails]; #endif } @end