From e80775ed82cdcdbb924a5aa3a52300eedc7207a2 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 5 Oct 2019 14:50:23 +1000 Subject: [PATCH] Frontend: Fix invalid FPS showing when reset --- src/duckstation/sdl_interface.cpp | 12 +++++++++++- src/duckstation/sdl_interface.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/duckstation/sdl_interface.cpp b/src/duckstation/sdl_interface.cpp index 5f4a3db63..50efd0014 100644 --- a/src/duckstation/sdl_interface.cpp +++ b/src/duckstation/sdl_interface.cpp @@ -489,7 +489,7 @@ void SDLInterface::DrawMainMenuBar() if (ImGui::BeginMenu("System")) { if (ImGui::MenuItem("Reset")) - m_system->Reset(); + DoReset(); ImGui::Separator(); @@ -654,6 +654,16 @@ void SDLInterface::DrawOSDMessages() } } +void SDLInterface::DoReset() +{ + m_system->Reset(); + m_last_frame_number = 0; + m_last_internal_frame_number = 0; + m_last_global_tick_counter = 0; + m_fps_timer.Reset(); + AddOSDMessage("System reset."); +} + void SDLInterface::DoLoadState(u32 index) { LoadState(GetSaveStateFilename(index)); diff --git a/src/duckstation/sdl_interface.h b/src/duckstation/sdl_interface.h index 19d76462b..7fa0ba9d5 100644 --- a/src/duckstation/sdl_interface.h +++ b/src/duckstation/sdl_interface.h @@ -51,6 +51,7 @@ private: // We only pass mouse input through if it's grabbed bool IsWindowFullscreen() const; void DrawImGui(); + void DoReset(); void DoLoadState(u32 index); void DoSaveState(u32 index);