Qt: Fix cheats dialog.

This commit is contained in:
BearOso 2024-04-17 15:51:38 -05:00
parent e0849ab384
commit a5a0a80464
2 changed files with 6 additions and 3 deletions

View File

@ -8,6 +8,7 @@
#include "cheats.h" #include "cheats.h"
#include "snes9x.h" #include "snes9x.h"
#include "memmap.h" #include "memmap.h"
#include <cassert>
static inline uint8 S9xGetByteFree(uint32 Address) static inline uint8 S9xGetByteFree(uint32 Address)
{ {
@ -322,6 +323,8 @@ void S9xEnableCheat(SCheat &c)
void S9xEnableCheatGroup(uint32 num) void S9xEnableCheatGroup(uint32 num)
{ {
assert(num < Cheat.group.size());
for (auto &c : Cheat.group[num].cheat) for (auto &c : Cheat.group[num].cheat)
S9xEnableCheat(c); S9xEnableCheat(c);

View File

@ -543,14 +543,14 @@ void EmuApplication::disableAllCheats()
void EmuApplication::enableCheat(int index) void EmuApplication::enableCheat(int index)
{ {
emu_thread->runOnThread([&] { emu_thread->runOnThread([&, index] {
core->enableCheat(index); core->enableCheat(index);
}); });
} }
void EmuApplication::disableCheat(int index) void EmuApplication::disableCheat(int index)
{ {
emu_thread->runOnThread([&] { emu_thread->runOnThread([&, index] {
core->disableCheat(index); core->disableCheat(index);
}); });
} }
@ -565,7 +565,7 @@ bool EmuApplication::addCheat(std::string description, std::string code)
void EmuApplication::deleteCheat(int index) void EmuApplication::deleteCheat(int index)
{ {
emu_thread->runOnThread([&] { emu_thread->runOnThread([&, index] {
core->deleteCheat(index); core->deleteCheat(index);
}); });
} }