From 72b949efcd1ac0ccea4bef78ed46e4b596bafd36 Mon Sep 17 00:00:00 2001 From: harry Date: Thu, 30 Nov 2023 21:09:52 -0500 Subject: [PATCH] For Qt GUI, added hot keys for certain emulation speed presets. Presets are: 1/4x, 1/2x, Normal 1x, 2x, 4x, 8x, and 16x. These hot keys can be mapped to gamepads using advanced key bindings. --- src/drivers/Qt/ConsoleWindow.cpp | 8 ++++++++ src/drivers/Qt/config.cpp | 21 +++++++++++++++++++++ src/drivers/Qt/config.h | 2 ++ 3 files changed, 31 insertions(+) diff --git a/src/drivers/Qt/ConsoleWindow.cpp b/src/drivers/Qt/ConsoleWindow.cpp index 92c87072..2b4ee2ec 100644 --- a/src/drivers/Qt/ConsoleWindow.cpp +++ b/src/drivers/Qt/ConsoleWindow.cpp @@ -855,6 +855,14 @@ void consoleWin_t::initHotKeys(void) Hotkeys[HK_FRAME_ADVANCE].getShortcut()->setEnabled(false); Hotkeys[HK_TURBO ].getShortcut()->setEnabled(false); + connect( Hotkeys[ HK_SPEED_QUARTER ].getShortcut(), &QShortcut::activated, [] { CustomEmulationSpeed( 25); } ); + connect( Hotkeys[ HK_SPEED_HALF ].getShortcut(), &QShortcut::activated, [] { CustomEmulationSpeed( 50); } ); + connect( Hotkeys[ HK_SPEED_NORMAL ].getShortcut(), &QShortcut::activated, [] { CustomEmulationSpeed( 100); } ); + connect( Hotkeys[ HK_SPEED_2X ].getShortcut(), &QShortcut::activated, [] { CustomEmulationSpeed( 200); } ); + connect( Hotkeys[ HK_SPEED_4X ].getShortcut(), &QShortcut::activated, [] { CustomEmulationSpeed( 400); } ); + connect( Hotkeys[ HK_SPEED_8X ].getShortcut(), &QShortcut::activated, [] { CustomEmulationSpeed( 800); } ); + connect( Hotkeys[ HK_SPEED_16X ].getShortcut(), &QShortcut::activated, [] { CustomEmulationSpeed(1600); } ); + connect( Hotkeys[ HK_VOLUME_MUTE ].getShortcut(), SIGNAL(activated()), this, SLOT(muteSoundVolume(void)) ); connect( Hotkeys[ HK_VOLUME_DOWN ].getShortcut(), SIGNAL(activated()), this, SLOT(decrSoundVolume(void)) ); connect( Hotkeys[ HK_VOLUME_UP ].getShortcut(), SIGNAL(activated()), this, SLOT(incrSoundVolume(void)) ); diff --git a/src/drivers/Qt/config.cpp b/src/drivers/Qt/config.cpp index 949c591e..e0c098ba 100644 --- a/src/drivers/Qt/config.cpp +++ b/src/drivers/Qt/config.cpp @@ -214,6 +214,27 @@ int getHotKeyConfig( int i, const char **nameOut, const char **keySeqOut, const case HK_TURBO: name = "Turbo"; keySeq = "Tab"; group = "Speed"; break; + case HK_SPEED_NORMAL: + name = "Normal Speed"; keySeq = ""; group = "Speed"; + break; + case HK_SPEED_QUARTER: + name = "1/4x Speed"; keySeq = ""; group = "Speed"; + break; + case HK_SPEED_HALF: + name = "1/2x Speed"; keySeq = ""; group = "Speed"; + break; + case HK_SPEED_2X: + name = "2x Speed"; keySeq = ""; group = "Speed"; + break; + case HK_SPEED_4X: + name = "4x Speed"; keySeq = ""; group = "Speed"; + break; + case HK_SPEED_8X: + name = "8x Speed"; keySeq = ""; group = "Speed"; + break; + case HK_SPEED_16X: + name = "16x Speed"; keySeq = ""; group = "Speed"; + break; case HK_TOGGLE_INPUT_DISPLAY: name = "ToggleInputDisplay"; keySeq = ","; group = "Misc"; break; diff --git a/src/drivers/Qt/config.h b/src/drivers/Qt/config.h index 60bbac7e..971ea145 100644 --- a/src/drivers/Qt/config.h +++ b/src/drivers/Qt/config.h @@ -18,6 +18,8 @@ enum HOTKEY { // Emulation Execution Control HK_FRAME_ADVANCE, HK_DECREASE_SPEED, HK_INCREASE_SPEED, HK_TURBO, + HK_SPEED_QUARTER, HK_SPEED_HALF, HK_SPEED_NORMAL, + HK_SPEED_2X, HK_SPEED_4X, HK_SPEED_8X, HK_SPEED_16X, // Save States HK_SAVE_STATE,