Overview
Comment: | Move +[waitForConsoleVBlank] to OFThread |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | gamecontroller |
Files: | files | file ages | folders |
SHA3-256: |
684435a48d4d04f7991c82b86d89057e |
User & Date: | js on 2024-05-20 10:29:47 |
Other Links: | branch diff | manifest | tags |
Context
2024-05-20
| ||
10:45 | OFStdIOStream: Use bottom screen on 3DS check-in: 3bc1f4ac3c user: js tags: gamecontroller | |
10:29 | Move +[waitForConsoleVBlank] to OFThread check-in: 684435a48d user: js tags: gamecontroller | |
09:53 | OFGameController: Support 3DS analog right stick check-in: d5329de5f4 user: js tags: gamecontroller | |
Changes
Modified src/OFStdIOStream.h from [bf6a6dd043] to [6c775cbf62].
︙ | ︙ | |||
77 78 79 80 81 82 83 | /** * @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; | < < < < < < < | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | /** * @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; #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 [a1da571ef3] to [e861d0675e].
︙ | ︙ | |||
299 300 301 302 303 304 305 | 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); } | < < < < < < < < < < < < < < < | 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 | 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); } #elif defined(OF_NINTENDO_DS) + (void)setUpConsole { consoleDemoInit(); } #elif defined(OF_NINTENDO_3DS) + (void)setUpConsole { gfxInitDefault(); atexit(gfxExit); consoleInit(GFX_TOP, NULL); } #endif - (instancetype)init { OF_INVALID_INIT_METHOD } |
︙ | ︙ |
Modified src/OFThread.h from [c158340505] to [93ed835b5a].
︙ | ︙ | |||
242 243 244 245 246 247 248 249 250 251 252 253 254 255 | + (void)sleepUntilDate: (OFDate *)date; /** * @brief Yields a processor voluntarily and moves the thread to the end of the * queue for its priority. */ + (void)yield; #ifdef OF_HAVE_THREADS /** * @brief Terminates the current thread, letting it return `nil`. */ + (void)terminate OF_NO_RETURN; | > > > > > > > > > > | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | + (void)sleepUntilDate: (OFDate *)date; /** * @brief Yields a processor voluntarily and moves the thread to the end of the * queue for its priority. */ + (void)yield; #if defined(OF_WII) || defined(OF_NINTENDO_DS) || defined(OF_NINTENDO_3DS) || \ defined(DOXYGEN) /** * @brief Waits for the vertical blank. * * @note This method is only available on Wii, Nintendo DS and Nintendo 3DS. */ + (void)waitForVerticalBlank; #endif #ifdef OF_HAVE_THREADS /** * @brief Terminates the current thread, letting it return `nil`. */ + (void)terminate OF_NO_RETURN; |
︙ | ︙ |
Modified src/OFThread.m from [f0b78222ad] to [9e1f600d33].
︙ | ︙ | |||
38 39 40 41 42 43 44 45 46 47 48 49 50 | # define Class IntuitionClass # include <proto/exec.h> # include <proto/dos.h> # undef Class #endif #ifdef OF_WII # define nanosleep ogc_nanosleep # include <ogcsys.h> # undef nanosleep #endif #ifdef OF_NINTENDO_3DS | > > > > > > > > > > > | > | 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 68 69 70 | # define Class IntuitionClass # include <proto/exec.h> # include <proto/dos.h> # undef Class #endif #ifdef OF_WII # define asm __asm__ # define nanosleep ogc_nanosleep # include <gccore.h> # include <ogcsys.h> # undef nanosleep # undef asm #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 #import "OFThread.h" #import "OFThread+Private.h" #ifdef OF_HAVE_ATOMIC_OPS # import "OFAtomic.h" #endif |
︙ | ︙ | |||
308 309 310 311 312 313 314 315 316 317 318 319 320 321 | { #ifdef OF_HAVE_SCHED_YIELD sched_yield(); #else [self sleepForTimeInterval: 0]; #endif } #ifdef OF_HAVE_THREADS + (void)terminate { [self terminateWithObject: nil]; /* | > > > > > > > > > > > > > > > > > | 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | { #ifdef OF_HAVE_SCHED_YIELD sched_yield(); #else [self sleepForTimeInterval: 0]; #endif } #if defined(OF_WII) + (void)waitForVerticalBlank { VIDEO_WaitVSync(); } #elif defined(OF_NINTENDO_DS) + (void)waitForVerticalBlank { swiWaitForVBlank(); } #elif defined(OF_NINTENDO_3DS) + (void)waitForVerticalBlank { gspWaitForVBlank(); } #endif #ifdef OF_HAVE_THREADS + (void)terminate { [self terminateWithObject: nil]; /* |
︙ | ︙ |
Modified src/test/OTAppDelegate.m from [b0a9356d5a] to [5bb1d1d168].
︙ | ︙ | |||
21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #import "OFApplication.h" #import "OFColor.h" #import "OFDictionary.h" #import "OFMethodSignature.h" #import "OFSet.h" #import "OFStdIOStream.h" #import "OFValue.h" #import "OTTestCase.h" #import "OFGameController.h" #import "OTAssertionFailedException.h" | > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #import "OFApplication.h" #import "OFColor.h" #import "OFDictionary.h" #import "OFMethodSignature.h" #import "OFSet.h" #import "OFStdIOStream.h" #import "OFThread.h" #import "OFValue.h" #import "OTTestCase.h" #import "OFGameController.h" #import "OTAssertionFailedException.h" |
︙ | ︙ | |||
279 280 281 282 283 284 285 | [controller retrieveState]; if ([controller.pressedButtons containsObject: OFGameControllerEastButton]) break; | | | 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | [controller retrieveState]; if ([controller.pressedButtons containsObject: OFGameControllerEastButton]) break; [OFThread waitForVerticalBlank]; objc_autoreleasePoolPop(pool); } #elif defined(OF_NINTENDO_SWITCH) [OFStdOut setForegroundColor: [OFColor silver]]; [OFStdOut writeLine: @"Press A to continue"]; |
︙ | ︙ | |||
560 561 562 563 564 565 566 | OFGameControllerHomeButton]) # else if ([controller.pressedButtons containsObject: OFGameControllerStartButton]) # endif break; | | | 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 | OFGameControllerHomeButton]) # else if ([controller.pressedButtons containsObject: OFGameControllerStartButton]) # endif break; [OFThread waitForVerticalBlank]; objc_autoreleasePoolPop(pool); } #elif defined(OF_NINTENDO_SWITCH) while (appletMainLoop()) updateConsole(true); consoleExit(NULL); #endif [OFApplication terminateWithStatus: (int)numFailed]; } @end |
Modified tests/gamecontroller/GameControllerTests.m from [2fbd7efe4d] to [9d9395a639].
︙ | ︙ | |||
25 26 27 28 29 30 31 | #import "OFDate.h" #import "OFGameController.h" #import "OFNumber.h" #import "OFSet.h" #import "OFStdIOStream.h" #import "OFThread.h" | < | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #import "OFDate.h" #import "OFGameController.h" #import "OFNumber.h" #import "OFSet.h" #import "OFStdIOStream.h" #import "OFThread.h" #if defined(OF_NINTENDO_DS) static size_t buttonsPerLine = 2; #elif defined(OF_NINTENDO_3DS) static size_t buttonsPerLine = 3; #else static size_t buttonsPerLine = 5; #endif |
︙ | ︙ | |||
130 131 132 133 134 135 136 | [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) | | | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | [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) [OFThread waitForVerticalBlank]; #else [OFThread sleepForTimeInterval: 1.f / 60.f]; #endif objc_autoreleasePoolPop(pool); } } @end |