fix up cheat toggle
This commit is contained in:
parent
6c6cefad6c
commit
1b8daa0465
|
@ -1161,7 +1161,7 @@ std::optional<FATStorage> EmuInstance::loadSDCard(const string& key) noexcept
|
||||||
void EmuInstance::enableCheats(bool enable)
|
void EmuInstance::enableCheats(bool enable)
|
||||||
{
|
{
|
||||||
cheatsOn = enable;
|
cheatsOn = enable;
|
||||||
if (cheatFile)
|
if (cheatsOn && cheatFile)
|
||||||
nds->AREngine.Cheats = cheatFile->GetCodes();
|
nds->AREngine.Cheats = cheatFile->GetCodes();
|
||||||
else
|
else
|
||||||
nds->AREngine.Cheats.clear();
|
nds->AREngine.Cheats.clear();
|
||||||
|
|
|
@ -648,6 +648,10 @@ void EmuThread::handleMessages()
|
||||||
msgResult = 1;
|
msgResult = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case msg_EnableCheats:
|
||||||
|
emuInstance->enableCheats(msg.param.value<bool>());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
msgSemaphore.release();
|
msgSemaphore.release();
|
||||||
|
@ -815,6 +819,12 @@ int EmuThread::importSavefile(const QString& filename)
|
||||||
return msgResult;
|
return msgResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EmuThread::enableCheats(bool enable)
|
||||||
|
{
|
||||||
|
sendMessage({.type = msg_EnableCheats, .param = enable});
|
||||||
|
waitMessage();
|
||||||
|
}
|
||||||
|
|
||||||
void EmuThread::updateRenderer()
|
void EmuThread::updateRenderer()
|
||||||
{
|
{
|
||||||
if (videoRenderer != lastVideoRenderer)
|
if (videoRenderer != lastVideoRenderer)
|
||||||
|
|
|
@ -83,6 +83,8 @@ public:
|
||||||
msg_UndoStateLoad,
|
msg_UndoStateLoad,
|
||||||
|
|
||||||
msg_ImportSavefile,
|
msg_ImportSavefile,
|
||||||
|
|
||||||
|
msg_EnableCheats,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Message
|
struct Message
|
||||||
|
@ -124,6 +126,8 @@ public:
|
||||||
|
|
||||||
int importSavefile(const QString& filename);
|
int importSavefile(const QString& filename);
|
||||||
|
|
||||||
|
void enableCheats(bool enable);
|
||||||
|
|
||||||
bool emuIsRunning();
|
bool emuIsRunning();
|
||||||
bool emuIsActive();
|
bool emuIsActive();
|
||||||
|
|
||||||
|
|
|
@ -1655,7 +1655,12 @@ void MainWindow::onOpenPowerManagement()
|
||||||
void MainWindow::onEnableCheats(bool checked)
|
void MainWindow::onEnableCheats(bool checked)
|
||||||
{
|
{
|
||||||
localCfg.SetBool("EnableCheats", checked);
|
localCfg.SetBool("EnableCheats", checked);
|
||||||
emuInstance->enableCheats(checked);
|
emuThread->enableCheats(checked);
|
||||||
|
|
||||||
|
emuInstance->doOnAllWindows([=](MainWindow* win)
|
||||||
|
{
|
||||||
|
win->actEnableCheats->setChecked(checked);
|
||||||
|
}, windowID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onSetupCheats()
|
void MainWindow::onSetupCheats()
|
||||||
|
|
Loading…
Reference in New Issue