aboutsummaryrefslogtreecommitdiff
path: root/source/gfx.cpp
diff options
context:
space:
mode:
authorNebuleon Fumika2013-02-03 19:26:34 -0500
committerNebuleon Fumika2013-02-03 19:26:34 -0500
commitb3a7f8f1fceddcd45ec62bcbf75ba128e4f84f5a (patch)
treeb1bb5a056cf23ca56a480f4c2bfe92f6f0daafc0 /source/gfx.cpp
parent1ddc8b53fe92a88578f23ace849168bc19ca0cd0 (diff)
downloadsnes9x2005-b3a7f8f1fceddcd45ec62bcbf75ba128e4f84f5a.tar.gz
snes9x2005-b3a7f8f1fceddcd45ec62bcbf75ba128e4f84f5a.tar.bz2
snes9x2005-b3a7f8f1fceddcd45ec62bcbf75ba128e4f84f5a.zip
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.
Diffstat (limited to 'source/gfx.cpp')
-rw-r--r--source/gfx.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/gfx.cpp b/source/gfx.cpp
index 1b429c6..9ea0a97 100644
--- a/source/gfx.cpp
+++ b/source/gfx.cpp
@@ -1169,6 +1169,14 @@ void S9xSetupOBJ ()
static void DrawOBJS (bool8 OnMain = FALSE, uint8 D = 0)
{
+#ifdef ACCUMULATE_JOYPAD
+/*
+ * This call allows NDSSFC to synchronise the DS controller more often.
+ * If porting a later version of Snes9x into NDSSFC, it is essential to
+ * preserve it.
+ */
+ NDSSFCAccumulateJoypad ();
+#endif
#ifdef MK_DEBUG_RTO
if(Settings.BGLayering) fprintf(stderr, "Entering DrawOBJS() for %d-%d\n", GFX.StartY, GFX.EndY);
#endif
@@ -2314,6 +2322,14 @@ static void DrawBackgroundMode5 (uint32 /* BGMODE */, uint32 bg, uint8 Z1, uint8
static void DrawBackground (uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
{
+#ifdef ACCUMULATE_JOYPAD
+/*
+ * This call allows NDSSFC to synchronise the DS controller more often.
+ * If porting a later version of Snes9x into NDSSFC, it is essential to
+ * preserve it.
+ */
+ NDSSFCAccumulateJoypad ();
+#endif
GFX.PixSize = 1;
BG.TileSize = BGSizes [PPU.BG[bg].BGSize];