From 93031fc27ff111c44ab91a46f3292881360d01e2 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 17 May 2020 01:00:42 +1000 Subject: [PATCH] SDL: Re-add frame step hotkey Needs porting to Qt at some point. --- src/duckstation-sdl/sdl_host_interface.cpp | 12 ++++++++++++ src/duckstation-sdl/sdl_host_interface.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/duckstation-sdl/sdl_host_interface.cpp b/src/duckstation-sdl/sdl_host_interface.cpp index 4f9d264e4..4dbca0678 100644 --- a/src/duckstation-sdl/sdl_host_interface.cpp +++ b/src/duckstation-sdl/sdl_host_interface.cpp @@ -351,6 +351,8 @@ bool SDLHostInterface::Initialize() return false; } + RegisterHotkeys(); + ImGui::NewFrame(); // process events to pick up controllers before updating input map @@ -1334,6 +1336,16 @@ void SDLHostInterface::ClearImGuiFocus() ImGui::SetWindowFocus(nullptr); } +void SDLHostInterface::RegisterHotkeys() +{ + RegisterHotkey(StaticString("General"), StaticString("FrameStep"), StaticString("Frame Step"), [this](bool pressed) { + if (!pressed) + { + DoFrameStep(); + } + }); +} + void SDLHostInterface::DoStartDisc() { Assert(!m_system); diff --git a/src/duckstation-sdl/sdl_host_interface.h b/src/duckstation-sdl/sdl_host_interface.h index 13a13cd53..3625b4de0 100644 --- a/src/duckstation-sdl/sdl_host_interface.h +++ b/src/duckstation-sdl/sdl_host_interface.h @@ -72,6 +72,7 @@ private: void DestroyDisplay(); void CreateImGuiContext(); void UpdateFramebufferScale(); + void RegisterHotkeys(); /// Executes a callback later, after the UI has finished rendering. Needed to boot while rendering ImGui. void RunLater(std::function callback);