CommonHostInterface: Add undo load state feature

This commit is contained in:
Connor McLaughlin
2021-07-03 15:58:29 +10:00
parent af7dc40f5f
commit 762ab3ff43
4 changed files with 85 additions and 0 deletions

View File

@ -993,6 +993,9 @@ void QtHostInterface::populateSaveStateMenus(const char* game_code, QMenu* load_
loadState(path);
});
QAction* load_from_state = load_menu->addAction(tr("Undo Load State"));
load_from_state->setEnabled(CanUndoLoadState());
connect(load_from_state, &QAction::triggered, this, &QtHostInterface::undoLoadState);
load_menu->addSeparator();
connect(save_menu->addAction(tr("Save To File...")), &QAction::triggered, [this]() {
@ -1341,6 +1344,17 @@ void QtHostInterface::saveState(bool global, qint32 slot, bool block_until_done
SaveState(global, slot);
}
void QtHostInterface::undoLoadState()
{
if (!isOnWorkerThread())
{
QMetaObject::invokeMethod(this, "undoLoadState", Qt::QueuedConnection);
return;
}
UndoLoadState();
}
void QtHostInterface::setAudioOutputVolume(int volume, int fast_forward_volume)
{
if (!isOnWorkerThread())

View File

@ -165,6 +165,7 @@ public Q_SLOTS:
void loadState(bool global, qint32 slot);
void saveState(const QString& filename, bool block_until_done = false);
void saveState(bool global, qint32 slot, bool block_until_done = false);
void undoLoadState();
void setAudioOutputVolume(int volume, int fast_forward_volume);
void setAudioOutputMuted(bool muted);
void startDumpingAudio();