Index: new_tests/OFSystemInfoTests.m ================================================================== --- new_tests/OFSystemInfoTests.m +++ new_tests/OFSystemInfoTests.m @@ -124,12 +124,11 @@ ADD_BOOL(@"Supports AVX-512 BFloat16 Instructions", [OFSystemInfo supportsAVX512BFloat16Instructions]); #endif #ifdef OF_POWERPC - ADD_BOOL(@"[OFSystemInfo] Supports AltiVec", - [OFSystemInfo supportsAltiVec]); + ADD_BOOL(@"Supports AltiVec", [OFSystemInfo supportsAltiVec]); #endif #undef ADD #undef ADD_UINT #undef ADD_ULONGLONG Index: src/OFStdIOStream.m ================================================================== --- src/OFStdIOStream.m +++ src/OFStdIOStream.m @@ -117,11 +117,10 @@ date.microsecond / 1000, me, getpid(), msg]; objc_autoreleasePoolPop(pool); } -#if defined(HAVE_ISATTY) && !defined(OF_WII_U) static int colorToANSI(OFColor *color) { if ([color isEqual: [OFColor black]]) return 30; @@ -156,11 +155,10 @@ if ([color isEqual: [OFColor white]]) return 97; return -1; } -#endif @implementation OFStdIOStream #ifndef OF_WINDOWS + (void)load { @@ -430,11 +428,13 @@ return OFMaxRetainCount; } - (bool)hasTerminal { -#if defined(HAVE_ISATTY) && !defined(OF_WII_U) +#if defined(OF_WII) + return true; +#elif defined(HAVE_ISATTY) && !defined(OF_WII_U) return isatty(_fd); #else return false; #endif } @@ -469,96 +469,81 @@ #endif } - (void)setForegroundColor: (OFColor *)color { -#if defined(HAVE_ISATTY) && !defined(OF_WII_U) int code; - if (!isatty(_fd)) + if (!self.hasTerminal) return; if ((code = colorToANSI(color)) == -1) return; [self writeFormat: @"\033[%um", code]; -#endif } - (void)setBackgroundColor: (OFColor *)color { -#if defined(HAVE_ISATTY) && !defined(OF_WII_U) int code; - if (!isatty(_fd)) + if (!self.hasTerminal) return; if ((code = colorToANSI(color)) == -1) return; [self writeFormat: @"\033[%um", code + 10]; -#endif } - (void)reset { -#if defined(HAVE_ISATTY) && !defined(OF_WII_U) - if (!isatty(_fd)) + if (!self.hasTerminal) return; [self writeString: @"\033[0m"]; -#endif } - (void)clear { -#if defined(HAVE_ISATTY) && !defined(OF_WII_U) - if (!isatty(_fd)) + if (!self.hasTerminal) return; [self writeString: @"\033[2J"]; -#endif } - (void)eraseLine { -#if defined(HAVE_ISATTY) && !defined(OF_WII_U) - if (!isatty(_fd)) + if (!self.hasTerminal) return; [self writeString: @"\033[2K"]; -#endif } - (void)setCursorColumn: (unsigned int)column { -#if defined(HAVE_ISATTY) && !defined(OF_WII_U) - if (!isatty(_fd)) + if (!self.hasTerminal) return; [self writeFormat: @"\033[%uG", column + 1]; -#endif } - (void)setCursorPosition: (OFPoint)position { if (position.x < 0 || position.y < 0) @throw [OFInvalidArgumentException exception]; -#if defined(HAVE_ISATTY) && !defined(OF_WII_U) - if (!isatty(_fd)) + if (!self.hasTerminal) return; [self writeFormat: @"\033[%u;%uH", (unsigned)position.y + 1, (unsigned)position.x + 1]; -#endif } - (void)setRelativeCursorPosition: (OFPoint)position { -#if defined(HAVE_ISATTY) && !defined(OF_WII_U) - if (!isatty(_fd)) + if (!self.hasTerminal) return; if (position.x > 0) [self writeFormat: @"\033[%uC", (unsigned)position.x]; else if (position.x < 0) @@ -566,8 +551,7 @@ if (position.y > 0) [self writeFormat: @"\033[%uB", (unsigned)position.y]; else if (position.y < 0) [self writeFormat: @"\033[%uA", (unsigned)-position.y]; -#endif } @end Index: src/test/OTAppDelegate.m ================================================================== --- src/test/OTAppDelegate.m +++ src/test/OTAppDelegate.m @@ -25,10 +25,17 @@ #import "OTTestCase.h" #import "OTAssertionFailedException.h" #import "OTTestSkippedException.h" + +#ifdef OF_WII +# define asm __asm__ +# include +# include +# undef asm +#endif @interface OTAppDelegate: OFObject @end enum Status { @@ -49,10 +56,35 @@ return false; } @implementation OTAppDelegate +#ifdef OF_WII ++ (void)initialize +{ + GXRModeObj *mode; + void *nextFB; + + VIDEO_Init(); + WPAD_Init(); + + mode = VIDEO_GetPreferredMode(NULL); + nextFB = MEM_K0_TO_K1(SYS_AllocateFramebuffer(mode)); + VIDEO_Configure(mode); + VIDEO_SetNextFramebuffer(nextFB); + VIDEO_SetBlack(FALSE); + VIDEO_Flush(); + + VIDEO_WaitVSync(); + if (mode->viTVMode & VI_NON_INTERLACE) + VIDEO_WaitVSync(); + + CON_InitEx(mode, 2, 2, mode->fbWidth - 4, mode->xfbHeight - 4); + VIDEO_ClearFrameBuffer(mode, nextFB, COLOR_BLACK); +} +#endif + - (OFSet OF_GENERIC(Class) *)testClasses { Class *classes = objc_copyClassList(NULL); OFMutableSet *testClasses; @@ -175,10 +207,26 @@ [OFStdOut writeLine: @"]: skipped"]; if (description != nil) [OFStdOut writeLine: description]; break; } + +#ifdef OF_WII + if (status == StatusFailed) { + [OFStdOut setForegroundColor: [OFColor silver]]; + [OFStdOut writeLine: @"Press A to continue"]; + + for (;;) { + WPAD_ScanPads(); + + if (WPAD_ButtonsDown(0) & WPAD_BUTTON_A) + return; + + VIDEO_WaitVSync(); + } + } +#endif } - (void)applicationDidFinishLaunching: (OFNotification *)notification { OFSet OF_GENERIC(Class) *testClasses = [self testClasses]; @@ -185,11 +233,13 @@ size_t numSucceeded = 0, numFailed = 0, numSkipped = 0; OFMutableDictionary *summaries = [OFMutableDictionary dictionary]; [OFStdOut setForegroundColor: [OFColor purple]]; [OFStdOut writeString: @"Found "]; +#ifndef OF_WII [OFStdOut setForegroundColor: [OFColor fuchsia]]; +#endif [OFStdOut writeFormat: @"%zu", testClasses.count]; [OFStdOut setForegroundColor: [OFColor purple]]; [OFStdOut writeFormat: @" test case%s\n", (testClasses.count != 1 ? "s" : "")]; @@ -287,25 +337,47 @@ [OFStdOut setForegroundColor: [OFColor blue]]; [OFStdOut writeFormat: @"%@\n", line.secondObject]; } } +#ifndef OF_WII [OFStdOut setForegroundColor: [OFColor fuchsia]]; +#else + [OFStdOut setForegroundColor: [OFColor purple]]; +#endif [OFStdOut writeFormat: @"%zu", numSucceeded]; [OFStdOut setForegroundColor: [OFColor purple]]; [OFStdOut writeFormat: @" test%s succeeded, ", (numSucceeded != 1 ? "s" : "")]; +#ifndef OF_WII [OFStdOut setForegroundColor: [OFColor fuchsia]]; +#endif [OFStdOut writeFormat: @"%zu", numFailed]; [OFStdOut setForegroundColor: [OFColor purple]]; [OFStdOut writeFormat: @" test%s failed, ", (numFailed != 1 ? "s" : "")]; +#ifndef OF_WII [OFStdOut setForegroundColor: [OFColor fuchsia]]; +#endif [OFStdOut writeFormat: @"%zu", numSkipped]; [OFStdOut setForegroundColor: [OFColor purple]]; [OFStdOut writeFormat: @" test%s skipped\n", (numSkipped != 1 ? "s" : "")]; [OFStdOut reset]; +#ifdef OF_WII + [OFStdOut setForegroundColor: [OFColor silver]]; + [OFStdOut writeLine: @"Press home button to exit"]; + + for (;;) { + WPAD_ScanPads(); + + if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) + [OFApplication terminateWithStatus: (int)numFailed]; + + VIDEO_WaitVSync(); + } +#else [OFApplication terminateWithStatus: (int)numFailed]; +#endif } @end