Add "frame step" hotkey and function (#1119)
This commit is contained in:
parent
af36d10023
commit
2494058a71
|
@ -52,6 +52,7 @@ const int hk_general[] =
|
||||||
{
|
{
|
||||||
HK_Pause,
|
HK_Pause,
|
||||||
HK_Reset,
|
HK_Reset,
|
||||||
|
HK_FrameStep,
|
||||||
HK_FastForward,
|
HK_FastForward,
|
||||||
HK_FastForwardToggle,
|
HK_FastForwardToggle,
|
||||||
HK_FullscreenToggle,
|
HK_FullscreenToggle,
|
||||||
|
@ -64,6 +65,7 @@ const char* hk_general_labels[] =
|
||||||
{
|
{
|
||||||
"Pause/resume",
|
"Pause/resume",
|
||||||
"Reset",
|
"Reset",
|
||||||
|
"Frame step",
|
||||||
"Fast forward",
|
"Fast forward",
|
||||||
"Toggle FPS limit",
|
"Toggle FPS limit",
|
||||||
"Toggle Fullscreen",
|
"Toggle Fullscreen",
|
||||||
|
|
|
@ -124,6 +124,7 @@ ConfigEntry PlatformConfigFile[] =
|
||||||
{"HKKey_SwapScreens", 0, &HKKeyMapping[HK_SwapScreens], -1, NULL, 0},
|
{"HKKey_SwapScreens", 0, &HKKeyMapping[HK_SwapScreens], -1, NULL, 0},
|
||||||
{"HKKey_SolarSensorDecrease", 0, &HKKeyMapping[HK_SolarSensorDecrease], -1, NULL, 0},
|
{"HKKey_SolarSensorDecrease", 0, &HKKeyMapping[HK_SolarSensorDecrease], -1, NULL, 0},
|
||||||
{"HKKey_SolarSensorIncrease", 0, &HKKeyMapping[HK_SolarSensorIncrease], -1, NULL, 0},
|
{"HKKey_SolarSensorIncrease", 0, &HKKeyMapping[HK_SolarSensorIncrease], -1, NULL, 0},
|
||||||
|
{"HKKey_FrameStep", 0, &HKKeyMapping[HK_FrameStep], -1, NULL, 0},
|
||||||
|
|
||||||
{"HKJoy_Lid", 0, &HKJoyMapping[HK_Lid], -1, NULL, 0},
|
{"HKJoy_Lid", 0, &HKJoyMapping[HK_Lid], -1, NULL, 0},
|
||||||
{"HKJoy_Mic", 0, &HKJoyMapping[HK_Mic], -1, NULL, 0},
|
{"HKJoy_Mic", 0, &HKJoyMapping[HK_Mic], -1, NULL, 0},
|
||||||
|
@ -135,6 +136,7 @@ ConfigEntry PlatformConfigFile[] =
|
||||||
{"HKJoy_SwapScreens", 0, &HKJoyMapping[HK_SwapScreens], -1, NULL, 0},
|
{"HKJoy_SwapScreens", 0, &HKJoyMapping[HK_SwapScreens], -1, NULL, 0},
|
||||||
{"HKJoy_SolarSensorDecrease", 0, &HKJoyMapping[HK_SolarSensorDecrease], -1, NULL, 0},
|
{"HKJoy_SolarSensorDecrease", 0, &HKJoyMapping[HK_SolarSensorDecrease], -1, NULL, 0},
|
||||||
{"HKJoy_SolarSensorIncrease", 0, &HKJoyMapping[HK_SolarSensorIncrease], -1, NULL, 0},
|
{"HKJoy_SolarSensorIncrease", 0, &HKJoyMapping[HK_SolarSensorIncrease], -1, NULL, 0},
|
||||||
|
{"HKJoy_FrameStep", 0, &HKJoyMapping[HK_FrameStep], -1, NULL, 0},
|
||||||
|
|
||||||
{"JoystickID", 0, &JoystickID, 0, NULL, 0},
|
{"JoystickID", 0, &JoystickID, 0, NULL, 0},
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ enum
|
||||||
HK_SwapScreens,
|
HK_SwapScreens,
|
||||||
HK_SolarSensorDecrease,
|
HK_SolarSensorDecrease,
|
||||||
HK_SolarSensorIncrease,
|
HK_SolarSensorIncrease,
|
||||||
|
HK_FrameStep,
|
||||||
HK_MAX
|
HK_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -281,6 +281,7 @@ EmuThread::EmuThread(QObject* parent) : QThread(parent)
|
||||||
connect(this, SIGNAL(windowEmuStop()), mainWindow, SLOT(onEmuStop()));
|
connect(this, SIGNAL(windowEmuStop()), mainWindow, SLOT(onEmuStop()));
|
||||||
connect(this, SIGNAL(windowEmuPause()), mainWindow->actPause, SLOT(trigger()));
|
connect(this, SIGNAL(windowEmuPause()), mainWindow->actPause, SLOT(trigger()));
|
||||||
connect(this, SIGNAL(windowEmuReset()), mainWindow->actReset, SLOT(trigger()));
|
connect(this, SIGNAL(windowEmuReset()), mainWindow->actReset, SLOT(trigger()));
|
||||||
|
connect(this, SIGNAL(windowEmuFrameStep()), mainWindow->actFrameStep, SLOT(trigger()));
|
||||||
connect(this, SIGNAL(windowLimitFPSChange()), mainWindow->actLimitFramerate, SLOT(trigger()));
|
connect(this, SIGNAL(windowLimitFPSChange()), mainWindow->actLimitFramerate, SLOT(trigger()));
|
||||||
connect(this, SIGNAL(screenLayoutChange()), mainWindow->panel, SLOT(onScreenLayoutChanged()));
|
connect(this, SIGNAL(screenLayoutChange()), mainWindow->panel, SLOT(onScreenLayoutChanged()));
|
||||||
connect(this, SIGNAL(windowFullscreenToggle()), mainWindow, SLOT(onFullscreenToggled()));
|
connect(this, SIGNAL(windowFullscreenToggle()), mainWindow, SLOT(onFullscreenToggled()));
|
||||||
|
@ -377,6 +378,7 @@ void EmuThread::run()
|
||||||
|
|
||||||
if (Input::HotkeyPressed(HK_Pause)) emit windowEmuPause();
|
if (Input::HotkeyPressed(HK_Pause)) emit windowEmuPause();
|
||||||
if (Input::HotkeyPressed(HK_Reset)) emit windowEmuReset();
|
if (Input::HotkeyPressed(HK_Reset)) emit windowEmuReset();
|
||||||
|
if (Input::HotkeyPressed(HK_FrameStep)) emit windowEmuFrameStep();
|
||||||
|
|
||||||
if (Input::HotkeyPressed(HK_FullscreenToggle)) emit windowFullscreenToggle();
|
if (Input::HotkeyPressed(HK_FullscreenToggle)) emit windowFullscreenToggle();
|
||||||
|
|
||||||
|
@ -403,9 +405,10 @@ void EmuThread::run()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EmuRunning == 1)
|
if (EmuRunning == 1 || EmuRunning == 3)
|
||||||
{
|
{
|
||||||
EmuStatus = 1;
|
EmuStatus = 1;
|
||||||
|
if (EmuRunning == 3) EmuRunning = 2;
|
||||||
|
|
||||||
// update render settings if needed
|
// update render settings if needed
|
||||||
if (videoSettingsDirty)
|
if (videoSettingsDirty)
|
||||||
|
@ -655,6 +658,12 @@ void EmuThread::emuStop()
|
||||||
if (micDevice) SDL_PauseAudioDevice(micDevice, 1);
|
if (micDevice) SDL_PauseAudioDevice(micDevice, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EmuThread::emuFrameStep()
|
||||||
|
{
|
||||||
|
if (EmuPause < 1) emit windowEmuPause();
|
||||||
|
EmuRunning = 3;
|
||||||
|
}
|
||||||
|
|
||||||
bool EmuThread::emuIsRunning()
|
bool EmuThread::emuIsRunning()
|
||||||
{
|
{
|
||||||
return (EmuRunning == 1);
|
return (EmuRunning == 1);
|
||||||
|
@ -1306,6 +1315,9 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
|
||||||
actStop = menu->addAction("Stop");
|
actStop = menu->addAction("Stop");
|
||||||
connect(actStop, &QAction::triggered, this, &MainWindow::onStop);
|
connect(actStop, &QAction::triggered, this, &MainWindow::onStop);
|
||||||
|
|
||||||
|
actFrameStep = menu->addAction("Frame step");
|
||||||
|
connect(actFrameStep, &QAction::triggered, this, &MainWindow::onFrameStep);
|
||||||
|
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
|
|
||||||
actEnableCheats = menu->addAction("Enable cheats");
|
actEnableCheats = menu->addAction("Enable cheats");
|
||||||
|
@ -1509,6 +1521,7 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
|
||||||
actPause->setEnabled(false);
|
actPause->setEnabled(false);
|
||||||
actReset->setEnabled(false);
|
actReset->setEnabled(false);
|
||||||
actStop->setEnabled(false);
|
actStop->setEnabled(false);
|
||||||
|
actFrameStep->setEnabled(false);
|
||||||
|
|
||||||
actSetupCheats->setEnabled(false);
|
actSetupCheats->setEnabled(false);
|
||||||
|
|
||||||
|
@ -2271,6 +2284,13 @@ void MainWindow::onStop()
|
||||||
NDS::Stop();
|
NDS::Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::onFrameStep()
|
||||||
|
{
|
||||||
|
if (!RunningSomething) return;
|
||||||
|
|
||||||
|
emuThread->emuFrameStep();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::onEnableCheats(bool checked)
|
void MainWindow::onEnableCheats(bool checked)
|
||||||
{
|
{
|
||||||
Config::EnableCheats = checked?1:0;
|
Config::EnableCheats = checked?1:0;
|
||||||
|
@ -2540,6 +2560,7 @@ void MainWindow::onEmuStart()
|
||||||
actPause->setChecked(false);
|
actPause->setChecked(false);
|
||||||
actReset->setEnabled(true);
|
actReset->setEnabled(true);
|
||||||
actStop->setEnabled(true);
|
actStop->setEnabled(true);
|
||||||
|
actFrameStep->setEnabled(true);
|
||||||
actImportSavefile->setEnabled(true);
|
actImportSavefile->setEnabled(true);
|
||||||
|
|
||||||
actSetupCheats->setEnabled(true);
|
actSetupCheats->setEnabled(true);
|
||||||
|
@ -2560,6 +2581,7 @@ void MainWindow::onEmuStop()
|
||||||
actPause->setEnabled(false);
|
actPause->setEnabled(false);
|
||||||
actReset->setEnabled(false);
|
actReset->setEnabled(false);
|
||||||
actStop->setEnabled(false);
|
actStop->setEnabled(false);
|
||||||
|
actFrameStep->setEnabled(false);
|
||||||
|
|
||||||
actSetupCheats->setEnabled(false);
|
actSetupCheats->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,7 @@ public:
|
||||||
void emuPause();
|
void emuPause();
|
||||||
void emuUnpause();
|
void emuUnpause();
|
||||||
void emuStop();
|
void emuStop();
|
||||||
|
void emuFrameStep();
|
||||||
|
|
||||||
bool emuIsRunning();
|
bool emuIsRunning();
|
||||||
|
|
||||||
|
@ -72,6 +73,7 @@ signals:
|
||||||
void windowEmuStop();
|
void windowEmuStop();
|
||||||
void windowEmuPause();
|
void windowEmuPause();
|
||||||
void windowEmuReset();
|
void windowEmuReset();
|
||||||
|
void windowEmuFrameStep();
|
||||||
|
|
||||||
void windowLimitFPSChange();
|
void windowLimitFPSChange();
|
||||||
|
|
||||||
|
@ -228,6 +230,7 @@ private slots:
|
||||||
void onPause(bool checked);
|
void onPause(bool checked);
|
||||||
void onReset();
|
void onReset();
|
||||||
void onStop();
|
void onStop();
|
||||||
|
void onFrameStep();
|
||||||
void onEnableCheats(bool checked);
|
void onEnableCheats(bool checked);
|
||||||
void onSetupCheats();
|
void onSetupCheats();
|
||||||
void onCheatsDialogFinished(int res);
|
void onCheatsDialogFinished(int res);
|
||||||
|
@ -300,6 +303,7 @@ public:
|
||||||
QAction* actPause;
|
QAction* actPause;
|
||||||
QAction* actReset;
|
QAction* actReset;
|
||||||
QAction* actStop;
|
QAction* actStop;
|
||||||
|
QAction* actFrameStep;
|
||||||
QAction* actEnableCheats;
|
QAction* actEnableCheats;
|
||||||
QAction* actSetupCheats;
|
QAction* actSetupCheats;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue