@@ -35,10 +35,16 @@ # define asm __asm__ # include # include # undef asm #endif + +#ifdef OF_WII_U +# define BOOL WUT_BOOL +# include +# undef BOOL +#endif #ifdef OF_NINTENDO_DS # define asm __asm__ # include # undef asm @@ -226,53 +232,74 @@ abort(); # else abort(); # endif } +#elif defined(OF_WII_U) + @try { + return OFApplicationMain(&argc, &argv, + [[TestsAppDelegate alloc] init]); + } @catch (id e) { + OSReport("\nRuntime error: Unhandled exception:\n%s\n", + [[e description] UTF8String]); + OSReport("\nBacktrace:\n %s\n\n", + [[e backtrace] componentsJoinedByString: @"\n "] + .UTF8String); + abort(); + } #else return OFApplicationMain(&argc, &argv, [[TestsAppDelegate alloc] init]); #endif } @implementation TestsAppDelegate - (void)outputTesting: (OFString *)test inModule: (OFString *)module { +#ifndef OF_WII_U if (OFStdOut.hasTerminal) { [OFStdOut setForegroundColor: [OFColor yellow]]; [OFStdOut writeFormat: @"[%@] %@: testing...", module, test]; } else [OFStdOut writeFormat: @"[%@] %@: ", module, test]; +#else + OSReport("[%s] %s: ", module.UTF8String, test.UTF8String); +#endif #ifdef OF_NINTENDO_SWITCH updateConsole(false); #endif } - (void)outputSuccess: (OFString *)test inModule: (OFString *)module { +#ifndef OF_WII_U if (OFStdOut.hasTerminal) { [OFStdOut setForegroundColor: [OFColor lime]]; [OFStdOut eraseLine]; [OFStdOut writeFormat: @"\r[%@] %@: ok\n", module, test]; } else [OFStdOut writeLine: @"ok"]; +#else + OSReport("ok\n"); +#endif #ifdef OF_NINTENDO_SWITCH updateConsole(false); #endif } - (void)outputFailure: (OFString *)test inModule: (OFString *)module { +#ifndef OF_WII_U if (OFStdOut.hasTerminal) { [OFStdOut setForegroundColor: [OFColor red]]; [OFStdOut eraseLine]; [OFStdOut writeFormat: @"\r[%@] %@: failed\n", module, test]; } else [OFStdOut writeLine: @"failed"]; -#ifdef OF_WII +# ifdef OF_WII [OFStdOut reset]; [OFStdOut writeLine: @"Press A to continue!"]; for (;;) { WPAD_ScanPads(); @@ -280,12 +307,12 @@ if (WPAD_ButtonsDown(0) & WPAD_BUTTON_A) return; VIDEO_WaitVSync(); } -#endif -#ifdef OF_PSP +# endif +# ifdef OF_PSP [OFStdOut reset]; [OFStdOut writeLine: @"Press X to continue!"]; for (;;) { SceCtrlData pad; @@ -297,23 +324,23 @@ if (!(pad.Buttons & PSP_CTRL_CROSS)) return; } } } -#endif -#ifdef OF_NINTENDO_DS +# endif +# ifdef OF_NINTENDO_DS [OFStdOut reset]; [OFStdOut writeString: @"Press A to continue!"]; for (;;) { swiWaitForVBlank(); scanKeys(); if (keysDown() & KEY_A) break; } -#endif -#ifdef OF_NINTENDO_3DS +# endif +# ifdef OF_NINTENDO_3DS [OFStdOut reset]; [OFStdOut writeString: @"Press A to continue!"]; for (;;) { hidScanInput(); @@ -321,12 +348,12 @@ if (hidKeysDown() & KEY_A) break; gspWaitForVBlank(); } -#endif -#ifdef OF_NINTENDO_SWITCH +# endif +# ifdef OF_NINTENDO_SWITCH [OFStdOut reset]; [OFStdOut writeString: @"Press A to continue!"]; while (appletMainLoop()) { PadState pad; @@ -335,17 +362,20 @@ updateConsole(true); if (padGetButtonsDown(&pad) & HidNpadButton_A) break; } -#endif +# endif if (OFStdOut.hasTerminal) { [OFStdOut writeString: @"\r"]; [OFStdOut reset]; [OFStdOut eraseLine]; } +#else + OSReport("failed\n"); +#endif } - (void)applicationDidFinishLaunching { #if defined(OF_IOS) && defined(OF_HAVE_FILES)