mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 13:27:41 -07:00
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)
|
||||
{
|
||||
cheatsOn = enable;
|
||||
if (cheatFile)
|
||||
if (cheatsOn && cheatFile)
|
||||
nds->AREngine.Cheats = cheatFile->GetCodes();
|
||||
else
|
||||
nds->AREngine.Cheats.clear();
|
||||
|
@ -648,6 +648,10 @@ void EmuThread::handleMessages()
|
||||
msgResult = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case msg_EnableCheats:
|
||||
emuInstance->enableCheats(msg.param.value<bool>());
|
||||
break;
|
||||
}
|
||||
|
||||
msgSemaphore.release();
|
||||
@ -815,6 +819,12 @@ int EmuThread::importSavefile(const QString& filename)
|
||||
return msgResult;
|
||||
}
|
||||
|
||||
void EmuThread::enableCheats(bool enable)
|
||||
{
|
||||
sendMessage({.type = msg_EnableCheats, .param = enable});
|
||||
waitMessage();
|
||||
}
|
||||
|
||||
void EmuThread::updateRenderer()
|
||||
{
|
||||
if (videoRenderer != lastVideoRenderer)
|
||||
|
@ -83,6 +83,8 @@ public:
|
||||
msg_UndoStateLoad,
|
||||
|
||||
msg_ImportSavefile,
|
||||
|
||||
msg_EnableCheats,
|
||||
};
|
||||
|
||||
struct Message
|
||||
@ -124,6 +126,8 @@ public:
|
||||
|
||||
int importSavefile(const QString& filename);
|
||||
|
||||
void enableCheats(bool enable);
|
||||
|
||||
bool emuIsRunning();
|
||||
bool emuIsActive();
|
||||
|
||||
|
@ -1655,7 +1655,12 @@ void MainWindow::onOpenPowerManagement()
|
||||
void MainWindow::onEnableCheats(bool checked)
|
||||
{
|
||||
localCfg.SetBool("EnableCheats", checked);
|
||||
emuInstance->enableCheats(checked);
|
||||
emuThread->enableCheats(checked);
|
||||
|
||||
emuInstance->doOnAllWindows([=](MainWindow* win)
|
||||
{
|
||||
win->actEnableCheats->setChecked(checked);
|
||||
}, windowID);
|
||||
}
|
||||
|
||||
void MainWindow::onSetupCheats()
|
||||
|
Loading…
Reference in New Issue
Block a user