From 2d40444af0327370c29ff3eb5937b189b79a55ca Mon Sep 17 00:00:00 2001 From: Sorgelig Date: Mon, 28 Nov 2022 20:46:42 +0800 Subject: [PATCH] ini option to disable autofire. --- MiSTer.ini | 3 +++ cfg.cpp | 1 + cfg.h | 1 + input.cpp | 2 +- 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/MiSTer.ini b/MiSTer.ini index 2401c7a..187cf32 100644 --- a/MiSTer.ini +++ b/MiSTer.ini @@ -270,3 +270,6 @@ vrr_min_framerate=0 vrr_max_framerate=0 ; VESA VRR base framerate. Normally set to the current video mode's output framerate vrr_vesa_framerate=0 + +; disable autofire if for some reason it's not required and accidentally triggered +disable_autofire=0 diff --git a/cfg.cpp b/cfg.cpp index 1562f1b..6bb28e6 100644 --- a/cfg.cpp +++ b/cfg.cpp @@ -107,6 +107,7 @@ static const ini_var_t ini_vars[] = { "PLAYER_2_CONTROLLER", (void*)(&(cfg.player_controller[1])), STRING, 0, sizeof(cfg.player_controller[1]) - 1 }, { "PLAYER_3_CONTROLLER", (void*)(&(cfg.player_controller[2])), STRING, 0, sizeof(cfg.player_controller[2]) - 1 }, { "PLAYER_4_CONTROLLER", (void*)(&(cfg.player_controller[3])), STRING, 0, sizeof(cfg.player_controller[3]) - 1 }, + { "DISABLE_AUTOFIRE", (void *)(&(cfg.disable_autofire)), UINT8, 0, 1}, }; static const int nvars = (int)(sizeof(ini_vars) / sizeof(ini_var_t)); diff --git a/cfg.h b/cfg.h index b0b9652..c663a97 100644 --- a/cfg.h +++ b/cfg.h @@ -79,6 +79,7 @@ typedef struct { uint8_t vrr_max_framerate; uint8_t vrr_vesa_framerate; uint16_t video_off; + uint8_t disable_autofire; } cfg_t; extern cfg_t cfg; diff --git a/input.cpp b/input.cpp index 468f80e..0ac77fd 100644 --- a/input.cpp +++ b/input.cpp @@ -1753,7 +1753,7 @@ static void joy_digital(int jnum, uint32_t mask, uint32_t code, char press, int } else { - if (!user_io_osd_is_visible() && press) + if (!user_io_osd_is_visible() && press && !cfg.disable_autofire) { if (lastcode[num] && lastmask[num]) {