all repos — mgba @ 64b44efbf15168b03ee5f02ca03f55f519e4824f

mGBA Game Boy Advance Emulator

Qt: State file load/save menu options
Vicki Pfau vi@endrift.com
Tue, 02 Oct 2018 09:39:27 -0700
commit

64b44efbf15168b03ee5f02ca03f55f519e4824f

parent

e26eeed02a91cc12a979af380ef5515c7bbe935e

3 files changed, 30 insertions(+), 0 deletions(-)

jump to
M CHANGESCHANGES

@@ -104,6 +104,7 @@ - Libretro: Add Game Boy cheat support

- Qt: Separate fast forward volume control (fixes mgba.io/i/846, mgba.io/i/1143) - Switch: Rumble support - Switch: Rotation support + - Qt: State file load/save menu options Bugfixes: - PSP2: Fix audio crackling after fast forward - PSP2: Fix audio crackling when buffer is full
M src/platform/qt/Window.cppsrc/platform/qt/Window.cpp

@@ -362,6 +362,22 @@ m_controller->loadSave(filename, temporary);

} } +void Window::selectState(bool load) { + QStringList formats{"*.ss0", "*.ss1", "*.ss2", "*.ss3", "*.ss4", "*.ss5", "*.ss6", "*.ss7", "*.ss8", "*.ss9"}; + QString filter = tr("mGBA savestate files (%1)").arg(formats.join(QChar(' '))); + if (load) { + QString filename = GBAApp::app()->getOpenFileName(this, tr("Select savestate"), filter); + if (!filename.isEmpty()) { + m_controller->loadState(filename); + } + } else { + QString filename = GBAApp::app()->getSaveFileName(this, tr("Select savestate"), filter); + if (!filename.isEmpty()) { + m_controller->saveState(filename); + } + } +} + void Window::multiplayerChanged() { if (!m_controller) { return;

@@ -1046,12 +1062,24 @@ m_gameActions.append(loadState);

m_nonMpActions.append(loadState); addControlledAction(fileMenu, loadState, "loadState"); + QAction* loadStateFile = new QAction(tr("Load state file..."), fileMenu); + connect(loadStateFile, &QAction::triggered, [this]() { this->selectState(true); }); + m_gameActions.append(loadStateFile); + m_nonMpActions.append(loadStateFile); + addControlledAction(fileMenu, loadStateFile, "loadStateFile"); + QAction* saveState = new QAction(tr("&Save state"), fileMenu); saveState->setShortcut(tr("Shift+F10")); connect(saveState, &QAction::triggered, [this]() { this->openStateWindow(LoadSave::SAVE); }); m_gameActions.append(saveState); m_nonMpActions.append(saveState); addControlledAction(fileMenu, saveState, "saveState"); + + QAction* saveStateFile = new QAction(tr("Save state file..."), fileMenu); + connect(saveStateFile, &QAction::triggered, [this]() { this->selectState(false); }); + m_gameActions.append(saveStateFile); + m_nonMpActions.append(saveStateFile); + addControlledAction(fileMenu, saveStateFile, "saveStateFile"); QMenu* quickLoadMenu = fileMenu->addMenu(tr("Quick load")); QMenu* quickSaveMenu = fileMenu->addMenu(tr("Quick save"));
M src/platform/qt/Window.hsrc/platform/qt/Window.h

@@ -70,6 +70,7 @@ void selectROMInArchive();

void addDirToLibrary(); #endif void selectSave(bool temporary); + void selectState(bool load); void selectPatch(); void enterFullScreen(); void exitFullScreen();