mirror of https://github.com/mgba-emu/mgba.git
Qt: State file load/save menu options
This commit is contained in:
parent
e26eeed02a
commit
64b44efbf1
1
CHANGES
1
CHANGES
|
@ -104,6 +104,7 @@ Features:
|
||||||
- Qt: Separate fast forward volume control (fixes mgba.io/i/846, mgba.io/i/1143)
|
- Qt: Separate fast forward volume control (fixes mgba.io/i/846, mgba.io/i/1143)
|
||||||
- Switch: Rumble support
|
- Switch: Rumble support
|
||||||
- Switch: Rotation support
|
- Switch: Rotation support
|
||||||
|
- Qt: State file load/save menu options
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
- PSP2: Fix audio crackling after fast forward
|
- PSP2: Fix audio crackling after fast forward
|
||||||
- PSP2: Fix audio crackling when buffer is full
|
- PSP2: Fix audio crackling when buffer is full
|
||||||
|
|
|
@ -362,6 +362,22 @@ void Window::selectSave(bool 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() {
|
void Window::multiplayerChanged() {
|
||||||
if (!m_controller) {
|
if (!m_controller) {
|
||||||
return;
|
return;
|
||||||
|
@ -1046,6 +1062,12 @@ void Window::setupMenu(QMenuBar* menubar) {
|
||||||
m_nonMpActions.append(loadState);
|
m_nonMpActions.append(loadState);
|
||||||
addControlledAction(fileMenu, loadState, "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);
|
QAction* saveState = new QAction(tr("&Save state"), fileMenu);
|
||||||
saveState->setShortcut(tr("Shift+F10"));
|
saveState->setShortcut(tr("Shift+F10"));
|
||||||
connect(saveState, &QAction::triggered, [this]() { this->openStateWindow(LoadSave::SAVE); });
|
connect(saveState, &QAction::triggered, [this]() { this->openStateWindow(LoadSave::SAVE); });
|
||||||
|
@ -1053,6 +1075,12 @@ void Window::setupMenu(QMenuBar* menubar) {
|
||||||
m_nonMpActions.append(saveState);
|
m_nonMpActions.append(saveState);
|
||||||
addControlledAction(fileMenu, saveState, "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* quickLoadMenu = fileMenu->addMenu(tr("Quick load"));
|
||||||
QMenu* quickSaveMenu = fileMenu->addMenu(tr("Quick save"));
|
QMenu* quickSaveMenu = fileMenu->addMenu(tr("Quick save"));
|
||||||
m_shortcutController->addMenu(quickLoadMenu);
|
m_shortcutController->addMenu(quickLoadMenu);
|
||||||
|
|
|
@ -70,6 +70,7 @@ public slots:
|
||||||
void addDirToLibrary();
|
void addDirToLibrary();
|
||||||
#endif
|
#endif
|
||||||
void selectSave(bool temporary);
|
void selectSave(bool temporary);
|
||||||
|
void selectState(bool load);
|
||||||
void selectPatch();
|
void selectPatch();
|
||||||
void enterFullScreen();
|
void enterFullScreen();
|
||||||
void exitFullScreen();
|
void exitFullScreen();
|
||||||
|
|
Loading…
Reference in New Issue