mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-05-19 07:55:42 -04:00
CommonHostInterface: Implement frame step hotkey
This commit is contained in:
parent
fe867edefb
commit
97a946bd62
@ -914,6 +914,11 @@ void QtHostInterface::threadEntryPoint()
|
|||||||
|
|
||||||
m_system->RunFrame();
|
m_system->RunFrame();
|
||||||
UpdateControllerRumble();
|
UpdateControllerRumble();
|
||||||
|
if (m_frame_step_request)
|
||||||
|
{
|
||||||
|
m_frame_step_request = false;
|
||||||
|
PauseSystem(true);
|
||||||
|
}
|
||||||
|
|
||||||
renderDisplay();
|
renderDisplay();
|
||||||
|
|
||||||
|
@ -402,8 +402,6 @@ bool SDLHostInterface::Initialize()
|
|||||||
|
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
|
||||||
RegisterHotkeys();
|
|
||||||
|
|
||||||
// process events to pick up controllers before updating input map
|
// process events to pick up controllers before updating input map
|
||||||
ProcessEvents();
|
ProcessEvents();
|
||||||
UpdateInputMap();
|
UpdateInputMap();
|
||||||
@ -1435,16 +1433,6 @@ void SDLHostInterface::ClearImGuiFocus()
|
|||||||
ImGui::SetWindowFocus(nullptr);
|
ImGui::SetWindowFocus(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLHostInterface::RegisterHotkeys()
|
|
||||||
{
|
|
||||||
RegisterHotkey(StaticString("General"), StaticString("FrameStep"), StaticString("Frame Step"), [this](bool pressed) {
|
|
||||||
if (!pressed)
|
|
||||||
{
|
|
||||||
DoFrameStep();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void SDLHostInterface::DoStartDisc()
|
void SDLHostInterface::DoStartDisc()
|
||||||
{
|
{
|
||||||
Assert(!m_system);
|
Assert(!m_system);
|
||||||
@ -1476,15 +1464,6 @@ void SDLHostInterface::DoChangeDisc()
|
|||||||
m_system->ResetPerformanceCounters();
|
m_system->ResetPerformanceCounters();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLHostInterface::DoFrameStep()
|
|
||||||
{
|
|
||||||
if (!m_system)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_frame_step_request = true;
|
|
||||||
m_paused = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SDLHostInterface::Run()
|
void SDLHostInterface::Run()
|
||||||
{
|
{
|
||||||
while (!m_quit_request)
|
while (!m_quit_request)
|
||||||
|
@ -66,7 +66,6 @@ private:
|
|||||||
void DestroyDisplay();
|
void DestroyDisplay();
|
||||||
void CreateImGuiContext();
|
void CreateImGuiContext();
|
||||||
void UpdateFramebufferScale();
|
void UpdateFramebufferScale();
|
||||||
void RegisterHotkeys();
|
|
||||||
|
|
||||||
/// Executes a callback later, after the UI has finished rendering. Needed to boot while rendering ImGui.
|
/// Executes a callback later, after the UI has finished rendering. Needed to boot while rendering ImGui.
|
||||||
void RunLater(std::function<void()> callback);
|
void RunLater(std::function<void()> callback);
|
||||||
@ -80,7 +79,6 @@ private:
|
|||||||
void DrawImGuiWindows() override;
|
void DrawImGuiWindows() override;
|
||||||
void DoStartDisc();
|
void DoStartDisc();
|
||||||
void DoChangeDisc();
|
void DoChangeDisc();
|
||||||
void DoFrameStep();
|
|
||||||
|
|
||||||
void HandleSDLEvent(const SDL_Event* event);
|
void HandleSDLEvent(const SDL_Event* event);
|
||||||
void ProcessEvents();
|
void ProcessEvents();
|
||||||
@ -101,7 +99,6 @@ private:
|
|||||||
|
|
||||||
bool m_fullscreen = false;
|
bool m_fullscreen = false;
|
||||||
bool m_quit_request = false;
|
bool m_quit_request = false;
|
||||||
bool m_frame_step_request = false;
|
|
||||||
bool m_settings_window_open = false;
|
bool m_settings_window_open = false;
|
||||||
bool m_about_window_open = false;
|
bool m_about_window_open = false;
|
||||||
|
|
||||||
|
@ -856,6 +856,16 @@ void CommonHostInterface::DrawDebugWindows()
|
|||||||
m_system->GetMDEC()->DrawDebugStateWindow();
|
m_system->GetMDEC()->DrawDebugStateWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CommonHostInterface::DoFrameStep()
|
||||||
|
{
|
||||||
|
if (!m_system)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_frame_step_request = true;
|
||||||
|
if (m_paused)
|
||||||
|
PauseSystem(false);
|
||||||
|
}
|
||||||
|
|
||||||
std::optional<CommonHostInterface::HostKeyCode>
|
std::optional<CommonHostInterface::HostKeyCode>
|
||||||
CommonHostInterface::GetHostKeyCode(const std::string_view key_code) const
|
CommonHostInterface::GetHostKeyCode(const std::string_view key_code) const
|
||||||
{
|
{
|
||||||
@ -1263,6 +1273,13 @@ void CommonHostInterface::RegisterGeneralHotkeys()
|
|||||||
if (!pressed && m_system)
|
if (!pressed && m_system)
|
||||||
SaveScreenshot();
|
SaveScreenshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
RegisterHotkey(StaticString("General"), StaticString("FrameStep"), StaticString("Frame Step"), [this](bool pressed) {
|
||||||
|
if (!pressed)
|
||||||
|
{
|
||||||
|
DoFrameStep();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommonHostInterface::RegisterGraphicsHotkeys()
|
void CommonHostInterface::RegisterGraphicsHotkeys()
|
||||||
|
@ -271,6 +271,7 @@ protected:
|
|||||||
void DrawFPSWindow();
|
void DrawFPSWindow();
|
||||||
void DrawOSDMessages();
|
void DrawOSDMessages();
|
||||||
void DrawDebugWindows();
|
void DrawDebugWindows();
|
||||||
|
void DoFrameStep();
|
||||||
|
|
||||||
std::unique_ptr<GameList> m_game_list;
|
std::unique_ptr<GameList> m_game_list;
|
||||||
|
|
||||||
@ -280,6 +281,7 @@ protected:
|
|||||||
std::mutex m_osd_messages_lock;
|
std::mutex m_osd_messages_lock;
|
||||||
|
|
||||||
bool m_paused = false;
|
bool m_paused = false;
|
||||||
|
bool m_frame_step_request = false;
|
||||||
bool m_speed_limiter_temp_disabled = false;
|
bool m_speed_limiter_temp_disabled = false;
|
||||||
bool m_speed_limiter_enabled = false;
|
bool m_speed_limiter_enabled = false;
|
||||||
bool m_timer_resolution_increased = false;
|
bool m_timer_resolution_increased = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user