aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorNebuleon Fumika2013-02-05 19:39:09 -0500
committerNebuleon Fumika2013-02-05 19:39:09 -0500
commitf2adea7bb2250876df3d1b6e076a6b5380c6b13e (patch)
tree3c6fb146a57587ce4705cf0cea9afa3dc6488c37 /source
parente7ac6f675f9faf5894aea8dd80e01c649933c322 (diff)
downloadsnes9x2005-f2adea7bb2250876df3d1b6e076a6b5380c6b13e.tar.gz
snes9x2005-f2adea7bb2250876df3d1b6e076a6b5380c6b13e.tar.bz2
snes9x2005-f2adea7bb2250876df3d1b6e076a6b5380c6b13e.zip
Force both manual and automatic frameskipping to be at or above 2. Resets the default value for all games which previously had this value configured.
Diffstat (limited to 'source')
-rw-r--r--source/nds/entry.cpp14
-rw-r--r--source/nds/gui.c4
-rw-r--r--source/nds/gui.h22
-rw-r--r--source/nds/message.h4
4 files changed, 35 insertions, 9 deletions
diff --git a/source/nds/entry.cpp b/source/nds/entry.cpp
index 18802a0..6cbf3ef 100644
--- a/source/nds/entry.cpp
+++ b/source/nds/entry.cpp
@@ -390,7 +390,7 @@ void game_set_frameskip()
}
else
{
- Settings.SkipFrames = game_config.frameskip_value - 1 /* 1 -> 0 and so on */;
+ Settings.SkipFrames = game_config.frameskip_value + 1 /* 1 -> 2 and so on */;
}
}
@@ -639,7 +639,6 @@ int sfc_main (int argc, char **argv)
static unsigned int sync_last= 0;
static unsigned int sync_next = 0;
-static unsigned int auto_equivalent_skip = 0;
static unsigned int skip_rate= 0;
@@ -690,7 +689,16 @@ void S9xSyncSpeed ()
// If this is negative, we're late by syncdif*42.66
// microseconds.
syncdif = sync_next - syncnow;
- if (syncdif < 0 && syncdif >= -(frame_time / 2))
+ if(skip_rate < 2 /* did not skip 2 frames yet */)
+ {
+ // Skip a minimum of 2 frames between rendered frames.
+ // This prevents the DSTwo-DS link from being too busy
+ // to return button statuses.
+ ++skip_rate;
+ IPPU.RenderThisFrame = FALSE;
+ sync_next += frame_time;
+ }
+ else if (syncdif < 0 && syncdif >= -(frame_time / 2))
{
// We're late, but by less than half a frame. Draw it
// anyway. If the next frame is too late, it'll be
diff --git a/source/nds/gui.c b/source/nds/gui.c
index 764ca66..4b5955a 100644
--- a/source/nds/gui.c
+++ b/source/nds/gui.c
@@ -2826,7 +2826,7 @@ u32 menu(u16 *screen, bool8 FirstInvocation)
(char*)&msg[MSG_VIDEO_ASPECT_RATIO_3],
(char*)&msg[MSG_VIDEO_ASPECT_RATIO_4]};
- char *frameskip_options[] = { (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_AUTOMATIC], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_0], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_1], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_2], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_3], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_4], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_5], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_6], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_7], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_8], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_9], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_10] };
+ char *frameskip_options[] = { (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_AUTOMATIC], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_2], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_3], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_4], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_5], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_6], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_7], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_8], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_9], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_10] };
char *fluidity_options[] = { (char*)&msg[MSG_VIDEO_AUDIO_FLUIDITY_PREFER_VIDEO], (char*)&msg[MSG_VIDEO_AUDIO_FLUIDITY_PREFER_AUDIO] };
@@ -2858,7 +2858,7 @@ u32 menu(u16 *screen, bool8 FirstInvocation)
&game_config.SoundSync, 2, NULL, ACTION_TYPE, 4),
/* 05 */ STRING_SELECTION_OPTION(game_set_frameskip, NULL, &msg[FMT_VIDEO_FRAME_SKIPPING], frameskip_options,
- &game_config.frameskip_value, 12 /* auto (0) and 0..10 (1..11) make 12 option values */, NULL, ACTION_TYPE, 5)
+ &game_config.frameskip_value, 10 /* auto (0) and 2..10 (1..9) make 10 option values */, NULL, ACTION_TYPE, 5)
};
MAKE_MENU(graphics, NULL, NULL, NULL, NULL, 0, 0);
diff --git a/source/nds/gui.h b/source/nds/gui.h
index e8302eb..b390b69 100644
--- a/source/nds/gui.h
+++ b/source/nds/gui.h
@@ -50,7 +50,24 @@ struct _GAME_CONFIG
{
u32 clock_speed_number;
u32 Reserved0;
- u32 frameskip_value;
+ /*
+ * PreviouslyUsed_20130205_1 was formerly known as 'frameskip_value';
+ * its values were in [0, 10]. 0 was automatic frameskipping and
+ * [1, 10] were mapped to skip 0 to 9 frames respectively.
+ * Version 1.29 changes the value range for 'frameskip_value' to
+ * [0, 8], with 0 as automatic frameskipping and [1, 10] to skip 2 to
+ * 9 frames.
+ * Change rationale: Frame skip values under 2 cause too much
+ * communication between the DSTwo and the DS, therefore the DS cannot
+ * timely send controller information.
+ * If this variable were to be used as is, the meaning of the option
+ * would be changed for values in [1, 8], and values in [9, 10] would
+ * cause undefined behavior, including crashes.
+ * THIS VALUE IS NOT GUARANTEED TO BE RESERVED AND SET TO 0.
+ * DO NOT USE THIS VALUE FOR ANY PURPOSE OTHER THAN EXACTLY THE ONE
+ * FOR WHICH IT WAS INTENDED.
+ */
+ u32 PreviouslyUsed_20130205_1;
u32 graphic;
u32 enable_audio;
u32 Reserved1;
@@ -60,7 +77,8 @@ struct _GAME_CONFIG
u32 HotkeyTemporaryFastForward;
u32 HotkeyToggleSound;
u32 SoundSync;
- u32 Reserved2[44];
+ u32 frameskip_value;
+ u32 Reserved2[43];
};
typedef enum
diff --git a/source/nds/message.h b/source/nds/message.h
index b5bb47b..86389b1 100644
--- a/source/nds/message.h
+++ b/source/nds/message.h
@@ -70,8 +70,8 @@ enum MSG
MSG_VIDEO_ASPECT_RATIO_4,
MSG_VIDEO_FRAME_SKIPPING_AUTOMATIC,
- MSG_VIDEO_FRAME_SKIPPING_0,
- MSG_VIDEO_FRAME_SKIPPING_1,
+ MSG_VIDEO_FRAME_SKIPPING_0 /* unused */,
+ MSG_VIDEO_FRAME_SKIPPING_1 /* unused */,
MSG_VIDEO_FRAME_SKIPPING_2,
MSG_VIDEO_FRAME_SKIPPING_3,
MSG_VIDEO_FRAME_SKIPPING_4,