Frontend: Add frame step hotkey (SPACE)/menu item
This commit is contained in:
parent
21f555cf8f
commit
2b419fcb08
|
@ -579,12 +579,19 @@ void SDLInterface::HandleSDLKeyEvent(const SDL_Event* event)
|
|||
}
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_SPACE:
|
||||
case SDL_SCANCODE_PAUSE:
|
||||
{
|
||||
if (pressed)
|
||||
DoTogglePause();
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_SPACE:
|
||||
{
|
||||
if (pressed)
|
||||
DoFrameStep();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -705,6 +712,13 @@ void SDLInterface::DrawMainMenuBar()
|
|||
|
||||
if (ImGui::BeginMenu("System"))
|
||||
{
|
||||
if (ImGui::MenuItem("Start Disc", nullptr, false, !system_enabled))
|
||||
DoStartDisc();
|
||||
if (ImGui::MenuItem("Start BIOS", nullptr, false, !system_enabled))
|
||||
DoStartBIOS();
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::MenuItem("Power Off", nullptr, false, system_enabled))
|
||||
DoPowerOff();
|
||||
|
||||
|
@ -714,14 +728,12 @@ void SDLInterface::DrawMainMenuBar()
|
|||
if (ImGui::MenuItem("Pause", nullptr, m_paused, system_enabled))
|
||||
DoTogglePause();
|
||||
|
||||
ImGui::MenuItem("Change Disc", nullptr, false, system_enabled);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::MenuItem("Start Disc"))
|
||||
DoStartDisc();
|
||||
if (ImGui::MenuItem("Start BIOS"))
|
||||
DoStartBIOS();
|
||||
ImGui::MenuItem("Change Disc", nullptr, false, system_enabled);
|
||||
|
||||
if (ImGui::MenuItem("Frame Step", nullptr, false, system_enabled))
|
||||
DoFrameStep();
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
|
@ -1154,11 +1166,23 @@ void SDLInterface::DoSaveState(u32 index)
|
|||
|
||||
void SDLInterface::DoTogglePause()
|
||||
{
|
||||
if (!m_system)
|
||||
return;
|
||||
|
||||
m_paused = !m_paused;
|
||||
if (!m_paused)
|
||||
m_fps_timer.Reset();
|
||||
}
|
||||
|
||||
void SDLInterface::DoFrameStep()
|
||||
{
|
||||
if (!m_system)
|
||||
return;
|
||||
|
||||
m_frame_step_request = true;
|
||||
m_paused = false;
|
||||
}
|
||||
|
||||
void SDLInterface::Run()
|
||||
{
|
||||
m_audio_stream->PauseOutput(false);
|
||||
|
@ -1175,7 +1199,14 @@ void SDLInterface::Run()
|
|||
}
|
||||
|
||||
if (m_system && !m_paused)
|
||||
{
|
||||
m_system->RunFrame();
|
||||
if (m_frame_step_request)
|
||||
{
|
||||
m_frame_step_request = false;
|
||||
m_paused = true;
|
||||
}
|
||||
}
|
||||
|
||||
Render();
|
||||
|
||||
|
|
|
@ -73,6 +73,7 @@ private:
|
|||
void DoLoadState(u32 index);
|
||||
void DoSaveState(u32 index);
|
||||
void DoTogglePause();
|
||||
void DoFrameStep();
|
||||
|
||||
void HandleSDLEvent(const SDL_Event* event);
|
||||
void HandleSDLKeyEvent(const SDL_Event* event);
|
||||
|
@ -123,6 +124,7 @@ private:
|
|||
|
||||
bool m_paused = false;
|
||||
bool m_quit_request = false;
|
||||
bool m_frame_step_request = false;
|
||||
bool m_focus_main_menu_bar = false;
|
||||
bool m_about_window_open = false;
|
||||
bool m_speed_limiter_enabled = true;
|
||||
|
|
Loading…
Reference in New Issue