Overview
Comment: | OFStdIOStream: Add two methods for game consoles |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | gamecontroller |
Files: | files | file ages | folders |
SHA3-256: |
d693276d79d2be51c9d6f8c867bede05 |
User & Date: | js on 2024-05-20 03:37:52 |
Other Links: | branch diff | manifest | tags |
Context
2024-05-20
| ||
04:35 | OFGameController: Map 3DS C stick to right stick check-in: f31e553ade user: js tags: gamecontroller | |
03:37 | OFStdIOStream: Add two methods for game consoles check-in: d693276d79 user: js tags: gamecontroller | |
03:13 | OFXInputGameController: Support for Home button check-in: f609457ac5 user: js tags: gamecontroller | |
Changes
Modified src/OFStdIOStream.h from [b6911b0606] to [bf6a6dd043].
︙ | |||
67 68 69 70 71 72 73 74 75 76 77 78 79 80 | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | + + + + + + + + + + + + + + + + + + | @property (readonly, nonatomic) int columns; /** * @brief The number of rows, or -1 if there is no underlying terminal or the * number of rows could not be queried. */ @property (readonly, nonatomic) int rows; #if defined(OF_WII) || defined(OF_NINTENDO_DS) || defined(OF_NINTENDO_3DS) || \ defined(DOXYGEN) /** * @brief Sets up a console for @ref OFStdOut / @ref OFStdErr output on systems * that don't have a console by default. * * @note This method is only available on Wii, Nintendo DS and Nintendo 3DS. */ + (void)setUpConsole; /** * @brief Waits for the vertical blank of the console. * * @note This method is only available on Wii, Nintendo DS and Nintendo 3DS. */ + (void)waitForConsoleVBlank; #endif - (instancetype)init OF_UNAVAILABLE; /** * @brief Sets the foreground color on the underlying terminal. Does nothing if * there is no underlying terminal or colors are unsupported. * |
︙ |
Modified src/OFStdIOStream.m from [eed361108a] to [a1da571ef3].
︙ | |||
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | + + + + + + + + + + + + + + + + + + + | # undef Class # undef HAVE_ISATTY #endif #ifdef OF_MSDOS # include <conio.h> #endif #ifdef OF_WII # define asm __asm__ # include <gccore.h> # undef asm #endif #ifdef OF_WII_U # define BOOL WUT_BOOL # include <coreinit/debug.h> # undef BOOL #endif #ifdef OF_NINTENDO_DS # define asm __asm__ # include <nds.h> # undef asm #endif #ifdef OF_NINTENDO_3DS /* Newer versions of libctru started using id as a parameter name. */ # define id id_3ds # include <3ds.h> # undef id #endif /* References for static linking */ #ifdef OF_WINDOWS void _reference_to_OFWin32ConsoleStdIOStream(void) { [OFWin32ConsoleStdIOStream class]; |
︙ | |||
257 258 259 260 261 262 263 264 265 266 267 268 269 270 | 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | of_initWithFileDescriptor: fd]; if ((fd = fileno(stderr)) >= 0) OFStdErr = [[OFStdIOStream alloc] of_initWithFileDescriptor: fd]; # endif } #endif #if defined(OF_WII) + (void)setUpConsole { GXRModeObj *mode; void *nextFB; VIDEO_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); } + (void)waitForConsoleVBlank { VIDEO_WaitVSync(); } #elif defined(OF_NINTENDO_DS) + (void)setUpConsole { consoleDemoInit(); } + (void)waitForConsoleVBlank { swiWaitForVBlank(); } #elif defined(OF_NINTENDO_3DS) + (void)setUpConsole { gfxInitDefault(); atexit(gfxExit); consoleInit(GFX_TOP, NULL); } + (void)waitForConsoleVBlank { gspWaitForVBlank(); } #endif - (instancetype)init { OF_INVALID_INIT_METHOD } #if defined(OF_AMIGAOS) |
︙ |
Modified src/test/OTAppDelegate.m from [c350ebfc99] to [b0a9356d5a].
︙ | |||
34 35 36 37 38 39 40 | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | - - - - - - - - - - - - - - - - - - - | #import "OTAssertionFailedException.h" #import "OTTestSkippedException.h" #ifdef OF_IOS # include <CoreFoundation/CoreFoundation.h> #endif |
︙ | |||
114 115 116 117 118 119 120 | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | - + - - - + - - - - - - - - - - - - - - - - - - - - - - | [OFApplication terminateWithStatus: 1]; } [[OFFileManager defaultManager] changeCurrentDirectoryPath: [OFString stringWithUTF8String: (const char *)resourcesPath]]; CFRelease(resourcesURL); |
︙ | |||
322 323 324 325 326 327 328 | 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | - - - - - + + - - | [controller retrieveState]; if ([controller.pressedButtons containsObject: OFGameControllerEastButton]) break; |
︙ | |||
608 609 610 611 612 613 614 | 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | - - - - - + + - - | OFGameControllerHomeButton]) # else if ([controller.pressedButtons containsObject: OFGameControllerStartButton]) # endif break; |
Modified tests/gamecontroller/GameControllerTests.m from [a9aab44f99] to [2fbd7efe4d].
︙ | |||
25 26 27 28 29 30 31 | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | - - - - - - + - - - - - - - + + - - + - - - - - + + - - - + - - - + - - - - - - - - - - - - - - - - - - - - - - | #import "OFDate.h" #import "OFGameController.h" #import "OFNumber.h" #import "OFSet.h" #import "OFStdIOStream.h" #import "OFThread.h" |
︙ | |||
146 147 148 149 150 151 152 | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | - + | [OFColor green]]; else [OFStdOut setForegroundColor: [OFColor gray]]; [OFStdOut writeFormat: @"[%@]", button]; |
︙ | |||
169 170 171 172 173 174 175 176 177 178 179 180 181 | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | + + + + | controller.rightAnalogStickPosition; [OFStdOut writeFormat: @"(%5.2f, %5.2f)", position.x, position.y]; } [OFStdOut writeString: @"\n"]; } #if defined(OF_WII) || defined(OF_NINTENDO_DS) || defined(OF_NINTENDO_3DS) [OFStdIOStream waitForConsoleVBlank]; #else [OFThread sleepForTimeInterval: 1.f / 60.f]; #endif objc_autoreleasePoolPop(pool); } } @end |