From 69d6a2d0e3fa95718198ec079b08e455e7f7b92a Mon Sep 17 00:00:00 2001 From: kamfretoz <14798312+kamfretoz@users.noreply.github.com> Date: Mon, 30 Oct 2023 22:31:46 +0700 Subject: [PATCH] Qt: Show currently active savestate slot on status bar --- pcsx2-qt/QtHost.cpp | 6 ++++-- pcsx2/Hotkeys.cpp | 5 +++++ pcsx2/VMManager.h | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pcsx2-qt/QtHost.cpp b/pcsx2-qt/QtHost.cpp index c5bbf4d3a3a0c2..5e71bb611727c3 100644 --- a/pcsx2-qt/QtHost.cpp +++ b/pcsx2-qt/QtHost.cpp @@ -1016,7 +1016,8 @@ void EmuThread::updatePerformanceMetrics(bool force) QString gs_stat; if (THREAD_VU1) { - gs_stat = QStringLiteral("%1 | EE: %2% | VU: %3% | GS: %4%") + gs_stat = QStringLiteral("Slot: %1 | %2 | EE: %3% | VU: %4% | GS: %5%") + .arg(VMManager::GetCurrentActiveSavestateSlot()) .arg(gs_stat_str.c_str()) .arg(PerformanceMetrics::GetCPUThreadUsage(), 0, 'f', 0) .arg(PerformanceMetrics::GetVUThreadUsage(), 0, 'f', 0) @@ -1024,7 +1025,8 @@ void EmuThread::updatePerformanceMetrics(bool force) } else { - gs_stat = QStringLiteral("%1 | EE: %2% | GS: %3%") + gs_stat = QStringLiteral("Slot: %1 | %2 | EE: %3% | GS: %4%") + .arg(VMManager::GetCurrentActiveSavestateSlot()) .arg(gs_stat_str.c_str()) .arg(PerformanceMetrics::GetCPUThreadUsage(), 0, 'f', 0) .arg(PerformanceMetrics::GetGSThreadUsage(), 0, 'f', 0); diff --git a/pcsx2/Hotkeys.cpp b/pcsx2/Hotkeys.cpp index 305d447a42d09e..50127fab8acc1a 100644 --- a/pcsx2/Hotkeys.cpp +++ b/pcsx2/Hotkeys.cpp @@ -32,6 +32,11 @@ static s32 s_current_save_slot = 1; static std::optional s_limiter_mode_prior_to_hold_interaction; +s32 VMManager::GetCurrentActiveSavestateSlot() +{ + return s_current_save_slot; +} + void VMManager::Internal::ResetVMHotkeyState() { s_current_save_slot = 1; diff --git a/pcsx2/VMManager.h b/pcsx2/VMManager.h index 9f111031e48f87..785a75efd814ea 100644 --- a/pcsx2/VMManager.h +++ b/pcsx2/VMManager.h @@ -54,6 +54,9 @@ namespace VMManager /// The number of usable save state slots. static constexpr s32 NUM_SAVE_STATE_SLOTS = 10; + /// Returns the currently active savestate slot. + s32 GetCurrentActiveSavestateSlot(); + /// The stack size to use for threads running recompilers static constexpr std::size_t EMU_THREAD_STACK_SIZE = 2 * 1024 * 1024; // µVU likes recursion