Adjust turbo logic so that when a button gets pressed, it delays this state for 2 frames. Fix some games that requires certain frame count to read button states (Double Dragon, Xevious

This commit is contained in:
negativeExponent
2025-02-04 14:57:58 +08:00
committed by LibretroAdmin
parent 449db5de6b
commit 0676a2092a
2 changed files with 11 additions and 2 deletions

View File

@@ -2528,6 +2528,8 @@ static void FCEUD_UpdateInput(void)
unsigned player, port;
bool palette_prev = false;
bool palette_next = false;
/* keeps track of button state for a number of frames */
static int turbo_button_state[4][2];
poll_cb();
@@ -2637,8 +2639,15 @@ static void FCEUD_UpdateInput(void)
{
if (input_cb(player, RETRO_DEVICE_JOYPAD, 0, turbomap[i].retro) || input_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R3))
{
if (!turbo_button_toggle[player][i])
if (!turbo_button_toggle[player][i]) {
/* keep button state for 2 frames */
turbo_button_state[player][i] = 2;
}
if (turbo_button_state[player][i]) {
turbo_button_state[player][i]--;
input_buf |= turbomap[i].nes;
}
turbo_button_toggle[player][i]++;
turbo_button_toggle[player][i] %= nes_input.turbo_delay + 1;
}

View File

@@ -495,7 +495,7 @@ struct retro_core_option_v2_definition option_defs[] = {
NULL,
"input",
{
{ "1", NULL },
/* { "1", NULL }, */
{ "2", NULL },
{ "3", NULL },
{ "5", NULL },