From 26680ec3f72e54d47653f9867cce6dcd73bc1c25 Mon Sep 17 00:00:00 2001 From: Rosalie Wanders Date: Mon, 25 Oct 2021 16:09:15 +0200 Subject: [PATCH] RMG: use RMG-Core's SaveState functions --- Source/RMG/UserInterface/MainWindow.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Source/RMG/UserInterface/MainWindow.cpp b/Source/RMG/UserInterface/MainWindow.cpp index 1a1292f2..468afacf 100644 --- a/Source/RMG/UserInterface/MainWindow.cpp +++ b/Source/RMG/UserInterface/MainWindow.cpp @@ -9,6 +9,7 @@ */ #include "MainWindow.hpp" +#include "RMG-Core/SaveState.hpp" #include "RMG-Core/Settings/Settings.hpp" #include "UserInterface/EventFilter.hpp" #include "Utilities/QtKeyToSdl2Key.hpp" @@ -373,7 +374,7 @@ void MainWindow::menuBar_Setup(bool inEmulation, bool isPaused) QActionGroup *slotActionGroup = new QActionGroup(this); QList slotActions; QAction *slotAction; - int currentSaveslot = CoreGetSaveSlot(); + int currentSlot = CoreGetSaveStateSlot(); for (int i = 0; i < 10; i++) { slotActions.append(new QAction(this)); @@ -381,7 +382,7 @@ void MainWindow::menuBar_Setup(bool inEmulation, bool isPaused) slotAction->setText("Slot " + QString::number(i)); slotAction->setCheckable(true); - slotAction->setChecked(i == currentSaveslot); + slotAction->setChecked(i == currentSlot); slotAction->setActionGroup(slotActionGroup); connect(slotAction, &QAction::triggered, [=](bool checked) @@ -993,9 +994,9 @@ void MainWindow::on_Action_System_SwapDisk(void) void MainWindow::on_Action_System_SaveState(void) { - if (!g_MupenApi.Core.SaveState()) + if (!CoreSaveState()) { - this->ui_MessageBox("Error", "Api::Core::SaveState Failed", g_MupenApi.Core.GetLastError()); + this->ui_MessageBox("Error", "CoreSaveState Failed", g_MupenApi.Core.GetLastError()); } } @@ -1010,9 +1011,9 @@ void MainWindow::on_Action_System_SaveAs(void) QString fileName = QFileDialog::getSaveFileName(this, tr("Save State"), "", tr("SaveState (*.dat);;All Files (*)")); - if (!g_MupenApi.Core.SaveStateAsFile(fileName)) + if (!CoreSaveState(fileName.toStdString())) { - this->ui_MessageBox("Error", "Api::Core::SaveStateAsFile Failed", g_MupenApi.Core.GetLastError()); + this->ui_MessageBox("Error", "CoreSaveState Failed", g_MupenApi.Core.GetLastError()); } if (!isPaused) @@ -1023,9 +1024,9 @@ void MainWindow::on_Action_System_SaveAs(void) void MainWindow::on_Action_System_LoadState(void) { - if (!g_MupenApi.Core.LoadState()) + if (!CoreLoadSaveState()) { - this->ui_MessageBox("Error", "Api::Core::LoadState Failed", g_MupenApi.Core.GetLastError()); + this->ui_MessageBox("Error", "CoreLoadSaveState Failed", g_MupenApi.Core.GetLastError()); } } @@ -1041,9 +1042,9 @@ void MainWindow::on_Action_System_Load(void) QString fileName = QFileDialog::getOpenFileName(this, tr("Open Save State"), "", tr("SaveState (*.dat);;All Files (*)")); - if (!g_MupenApi.Core.LoadStateFromFile(fileName)) + if (!CoreLoadSaveState(fileName.toStdString())) { - this->ui_MessageBox("Error", "Api::Core::LoadStateFromFile Failed", g_MupenApi.Core.GetLastError()); + this->ui_MessageBox("Error", "CoreLoadSaveState Failed", g_MupenApi.Core.GetLastError()); } if (!isPaused) @@ -1054,9 +1055,9 @@ void MainWindow::on_Action_System_Load(void) void MainWindow::on_Action_System_CurrentSaveState(int slot) { - if (!CoreSetSaveSlot(slot)) + if (!CoreSetSaveStateSlot(slot)) { - this->ui_MessageBox("Error", "Api::Core::SetSaveSlot Failed", g_MupenApi.Core.GetLastError()); + this->ui_MessageBox("Error", "CoreSetSaveStateSlot Failed", g_MupenApi.Core.GetLastError()); } }