From f25213139dd88202fe8053ea9deb2c0660b65417 Mon Sep 17 00:00:00 2001 From: spycrab Date: Thu, 17 May 2018 20:27:14 +0200 Subject: [PATCH] Qt/HotkeyScheduler: Fix state loading --- Source/Core/DolphinQt2/HotkeyScheduler.cpp | 12 ++++++------ Source/Core/DolphinQt2/HotkeyScheduler.h | 6 ++++++ Source/Core/DolphinQt2/MainWindow.cpp | 14 ++++++++++++++ Source/Core/DolphinQt2/MainWindow.h | 1 + 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/Source/Core/DolphinQt2/HotkeyScheduler.cpp b/Source/Core/DolphinQt2/HotkeyScheduler.cpp index b411494e4d..f986feaf9a 100644 --- a/Source/Core/DolphinQt2/HotkeyScheduler.cpp +++ b/Source/Core/DolphinQt2/HotkeyScheduler.cpp @@ -446,25 +446,25 @@ void HotkeyScheduler::Run() for (u32 i = 0; i < State::NUM_STATES; i++) { if (IsHotkey(HK_LOAD_STATE_SLOT_1 + i)) - State::Load(i + 1); + emit StateLoadSlot(i + 1); if (IsHotkey(HK_SAVE_STATE_SLOT_1 + i)) - State::Save(i + 1); + emit StateSaveSlot(i + 1); if (IsHotkey(HK_LOAD_LAST_STATE_1 + i)) - State::LoadLastSaved(i + 1); + emit StateLoadLastSaved(i + 1); if (IsHotkey(HK_SELECT_STATE_SLOT_1 + i)) emit SetStateSlotHotkey(i + 1); } if (IsHotkey(HK_SAVE_FIRST_STATE)) - State::SaveFirstSaved(); + emit StateSaveOldest(); if (IsHotkey(HK_UNDO_LOAD_STATE)) - State::UndoLoadState(); + emit StateLoadUndo(); if (IsHotkey(HK_UNDO_SAVE_STATE)) - State::UndoSaveState(); + emit StateSaveUndo(); } } diff --git a/Source/Core/DolphinQt2/HotkeyScheduler.h b/Source/Core/DolphinQt2/HotkeyScheduler.h index 3d2a9741a3..27d0d36134 100644 --- a/Source/Core/DolphinQt2/HotkeyScheduler.h +++ b/Source/Core/DolphinQt2/HotkeyScheduler.h @@ -33,6 +33,12 @@ signals: void SetStateSlotHotkey(int slot); void StateLoadSlotHotkey(); void StateSaveSlotHotkey(); + void StateLoadSlot(int state); + void StateSaveSlot(int state); + void StateLoadLastSaved(int state); + void StateSaveOldest(); + void StateLoadUndo(); + void StateSaveUndo(); void StartRecording(); void ExportRecording(); void ToggleReadOnlyMode(); diff --git a/Source/Core/DolphinQt2/MainWindow.cpp b/Source/Core/DolphinQt2/MainWindow.cpp index 50bc8ff032..bfc99aabe0 100644 --- a/Source/Core/DolphinQt2/MainWindow.cpp +++ b/Source/Core/DolphinQt2/MainWindow.cpp @@ -364,6 +364,15 @@ void MainWindow::ConnectHotkeys() connect(m_hotkey_scheduler, &HotkeyScheduler::ScreenShotHotkey, this, &MainWindow::ScreenShot); connect(m_hotkey_scheduler, &HotkeyScheduler::FullScreenHotkey, this, &MainWindow::FullScreen); + connect(m_hotkey_scheduler, &HotkeyScheduler::StateLoadSlot, this, &MainWindow::StateLoadSlotAt); + connect(m_hotkey_scheduler, &HotkeyScheduler::StateSaveSlot, this, &MainWindow::StateSaveSlotAt); + connect(m_hotkey_scheduler, &HotkeyScheduler::StateLoadLastSaved, this, + &MainWindow::StateLoadLastSavedAt); + connect(m_hotkey_scheduler, &HotkeyScheduler::StateLoadUndo, this, &MainWindow::StateLoadUndo); + connect(m_hotkey_scheduler, &HotkeyScheduler::StateSaveUndo, this, &MainWindow::StateSaveUndo); + connect(m_hotkey_scheduler, &HotkeyScheduler::StateSaveOldest, this, + &MainWindow::StateSaveOldest); + connect(m_hotkey_scheduler, &HotkeyScheduler::StateLoadSlotHotkey, this, &MainWindow::StateLoadSlot); connect(m_hotkey_scheduler, &HotkeyScheduler::StateSaveSlotHotkey, this, @@ -898,6 +907,11 @@ void MainWindow::StateLoadSlotAt(int slot) State::Load(slot); } +void MainWindow::StateLoadLastSavedAt(int slot) +{ + State::LoadLastSaved(slot); +} + void MainWindow::StateSaveSlotAt(int slot) { State::Save(slot, true); diff --git a/Source/Core/DolphinQt2/MainWindow.h b/Source/Core/DolphinQt2/MainWindow.h index 82520f68cb..cb0c26e772 100644 --- a/Source/Core/DolphinQt2/MainWindow.h +++ b/Source/Core/DolphinQt2/MainWindow.h @@ -83,6 +83,7 @@ private: void StateSaveSlot(); void StateLoadSlotAt(int slot); void StateSaveSlotAt(int slot); + void StateLoadLastSavedAt(int slot); void StateLoadUndo(); void StateSaveUndo(); void StateSaveOldest();