From b3a7f8f1fceddcd45ec62bcbf75ba128e4f84f5a Mon Sep 17 00:00:00 2001 From: Nebuleon Fumika Date: Sun, 3 Feb 2013 19:26:34 -0500 Subject: Synchronise the controller status more spread out inside a rendered frame: * before rendering a background; * before rendering sprites; * while rendering more than 128 samples of audio at once ("Prefer fluid video"); * after every 16 scanlines of CPU execution instead of every 1; * while waiting for an audio buffer to become available; * while killing time between frames with fast-forward disabled. Controller presses and releases are now combined in a DS button bitfield using a shorter 32-bit algorithm. See entry.cpp:NDSSFCAccumulateJoypad and #define ACCUMULATE_JOYPAD in the source. This is still not suitable for playing platformers frame-perfectly, but it's much better than half a second of latency to press or release a button, and one still needs to press buttons a bit more than just light taps. I'd say 50 milliseconds is the latency now. Platformers requiring more precision can be played with frameskip 0. DMA does not require double-buffered displaying, so synchronise the controller more often by disabling double-buffered displaying again. --- source/ppu.cpp | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'source/ppu.cpp') diff --git a/source/ppu.cpp b/source/ppu.cpp index ad937c4..179838d 100644 --- a/source/ppu.cpp +++ b/source/ppu.cpp @@ -2853,43 +2853,10 @@ void S9xUpdateJoypads () { uint32 i; -#ifdef SYNC_JOYPAD_AT_HBLANK - uint32 j, k, KeyValue; - bool8 StartedPressed; - - // For each joypad - for (i = 0; i < 5; i++) - { - IPPU.Joypads [i] = 0; - // Sync each key - for (k = 1; k != 0; k <<= 1) - { - KeyValue = IPPU.JoypadsAtHBlanks[i][0] & k; - StartedPressed = KeyValue != 0; - // from each line. - // If, initially, the key is NOT pressed, one line of it being - // pressed means that the key MUST be pressed. - // Otherwise, the key MUST be depressed if it starts pressed. - for (j = 1; j < (Settings.PAL ? SNES_MAX_PAL_VCOUNTER : SNES_MAX_NTSC_VCOUNTER); j++) - { - if ((StartedPressed) && ((IPPU.JoypadsAtHBlanks[i][j] & k) == 0)) { - KeyValue = 0; - break; - } - else if ((!StartedPressed) && ((IPPU.JoypadsAtHBlanks[i][j] & k) != 0)) { - KeyValue = k; - break; - } - } - IPPU.Joypads [i] |= KeyValue; - } - } -#else for (i = 0; i < 5; i++) { IPPU.Joypads [i] = S9xReadJoypad (i); } -#endif // S9xMovieUpdate(); -- cgit v1.2.3