all repos — mgba @ 4827daf5a6e30ed9b147b814e7ca165dab395a4f

mGBA Game Boy Advance Emulator

Core: Fix some cheats API change fallout (fixes #2053)
Vicki Pfau vi@endrift.com
Tue, 23 Feb 2021 22:36:23 -0800
commit

4827daf5a6e30ed9b147b814e7ca165dab395a4f

parent

c21f9e81bb272fba1b341e8b7fe15e8a8e44ed56

2 files changed, 9 insertions(+), 3 deletions(-)

jump to
M src/core/cheats.csrc/core/cheats.c

@@ -775,7 +775,9 @@ struct mCheatDevice* device = (struct mCheatDevice*) component;

size_t i; for (i = 0; i < mCheatSetsSize(&device->cheats); ++i) { struct mCheatSet* cheats = *mCheatSetsGetPointer(&device->cheats, i); - cheats->add(cheats, device); + if (cheats->add) { + cheats->add(cheats, device); + } } }

@@ -784,6 +786,8 @@ struct mCheatDevice* device = (struct mCheatDevice*) component;

size_t i; for (i = mCheatSetsSize(&device->cheats); i--;) { struct mCheatSet* cheats = *mCheatSetsGetPointer(&device->cheats, i); - cheats->remove(cheats, device); + if (cheats->remove) { + cheats->remove(cheats, device); + } } }
M src/platform/qt/CheatsView.cppsrc/platform/qt/CheatsView.cpp

@@ -165,6 +165,8 @@ m_model.beginAppendRow(index);

mCheatAddLine(set, string.toUtf8().constData(), codeType); m_model.endAppendRow(); } - set->refresh(set, m_controller->cheatDevice()); + if (set->refresh) { + set->refresh(set, m_controller->cheatDevice()); + } m_ui.codeEntry->clear(); }