Skip to content

Commit

Permalink
cli: fix boost input detection
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rofl0r committed Oct 27, 2024
1 parent b45d249 commit 6565bd9
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 13 deletions.
3 changes: 1 addition & 2 deletions desmume/src/frontend/posix/cli/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
10 changes: 0 additions & 10 deletions desmume/src/frontend/posix/shared/ctrlssdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion desmume/src/frontend/posix/shared/ctrlssdl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6565bd9

Please sign in to comment.