From 3ddb2669a98a7adb3d5b695d1b410ae50d10cf8f Mon Sep 17 00:00:00 2001 From: rofl0r Date: Sun, 27 Oct 2024 17:30:21 +0000 Subject: [PATCH] cli: fix boost input detection until now, the boost key was hardcoded to 'o' even when the config said otherwise, and not treated in case of a joypad at all. when triggered with the o key, it even behaved differently than the gtk ui - the boost wasn't released together with the key, but only when pressed again, so it was more like a shortcut for "disable fps limiter". this change implements the desired outcome of the second part of PR #822, but without introducing more hacks and relying on magic values. closes #822 --- desmume/src/frontend/interface/draw_sdl_window.cpp | 1 - desmume/src/frontend/posix/cli/main.cpp | 3 +-- desmume/src/frontend/posix/shared/ctrlssdl.cpp | 10 ---------- desmume/src/frontend/posix/shared/ctrlssdl.h | 1 - 4 files changed, 1 insertion(+), 14 deletions(-) diff --git a/desmume/src/frontend/interface/draw_sdl_window.cpp b/desmume/src/frontend/interface/draw_sdl_window.cpp index 8da5d3d1b..53b1a9ccb 100755 --- a/desmume/src/frontend/interface/draw_sdl_window.cpp +++ b/desmume/src/frontend/interface/draw_sdl_window.cpp @@ -255,7 +255,6 @@ EXPORTED int desmume_draw_window_init(BOOL auto_pause, BOOL use_opengl_if_possib // TODO: Make configurable instead. load_default_config(cli_kb_cfg); - ctrls_cfg.boost = 0; ctrls_cfg.sdl_quit = 0; ctrls_cfg.auto_pause = auto_pause; ctrls_cfg.focused = 1; diff --git a/desmume/src/frontend/posix/cli/main.cpp b/desmume/src/frontend/posix/cli/main.cpp index b61844763..45f12e1e4 100644 --- a/desmume/src/frontend/posix/cli/main.cpp +++ b/desmume/src/frontend/posix/cli/main.cpp @@ -546,7 +546,6 @@ int main(int argc, char ** argv) { osd = new OSDCLASS(-1); #endif - ctrls_cfg.boost = 0; ctrls_cfg.sdl_quit = 0; ctrls_cfg.auto_pause = my_config.auto_pause; ctrls_cfg.focused = 1; @@ -577,7 +576,7 @@ int main(int argc, char ** argv) { #ifdef DISPLAY_FPS now = SDL_GetTicks(); #endif - if ( !my_config.disable_limiter && !ctrls_cfg.boost) { + if ( !my_config.disable_limiter && !(ctrls_cfg.keypad & KEYMASK_(KEY_BOOST - 1))) { #ifndef DISPLAY_FPS now = SDL_GetTicks(); #endif diff --git a/desmume/src/frontend/posix/shared/ctrlssdl.cpp b/desmume/src/frontend/posix/shared/ctrlssdl.cpp index 30a4477b4..169dba6f6 100644 --- a/desmume/src/frontend/posix/shared/ctrlssdl.cpp +++ b/desmume/src/frontend/posix/shared/ctrlssdl.cpp @@ -430,7 +430,6 @@ do_process_joystick_events( u16 *keypad, SDL_Event *event) { break; /* Joystick button pressed */ - /* FIXME: Add support for BOOST */ case SDL_JOYBUTTONDOWN: key_code = ((event->jbutton.which & 15) << 12) | JOY_BUTTON << 8 | (event->jbutton.button & 255); key = lookup_joy_key( key_code ); @@ -536,15 +535,6 @@ process_ctrls_event( SDL_Event& event, driver->AddLine("Fake mic disabled"); break; #endif - - case SDLK_o: - cfg->boost = !cfg->boost; - if (cfg->boost) - driver->AddLine("Boost mode enabled"); - else - driver->AddLine("Boost mode disabled"); - break; - case SDLK_LSHIFT: shift_pressed &= ~1; break; diff --git a/desmume/src/frontend/posix/shared/ctrlssdl.h b/desmume/src/frontend/posix/shared/ctrlssdl.h index a56c42b93..8d37029dc 100644 --- a/desmume/src/frontend/posix/shared/ctrlssdl.h +++ b/desmume/src/frontend/posix/shared/ctrlssdl.h @@ -89,7 +89,6 @@ struct ctrls_event_config { int auto_pause; int focused; int sdl_quit; - int boost; int fake_mic; void *screen_texture; void (*resize_cb)(u16 width, u16 height, void *screen_texture);