From 6442d17b4c0012a68683b052a0c1bbafd2318722 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Wed, 26 Dec 2018 13:28:08 -0800 Subject: [PATCH] Libretro: Fix adding codes with hooks --- CHANGES | 1 + src/gba/cheats.c | 3 +++ src/platform/libretro/libretro.c | 1 + 3 files changed, 5 insertions(+) diff --git a/CHANGES b/CHANGES index 1cb1e28ce..b8e12c52b 100644 --- a/CHANGES +++ b/CHANGES @@ -143,6 +143,7 @@ Bugfixes: - GB Video: Changing LYC while LCDC off doesn't affect STAT (fixes mgba.io/i/1224) - GBA I/O: SOUNDCNT_HI is readable when sound is off - SDL: Fix handling of invalid gamepads (fixes mgba.io/i/1239) + - Libretro: Fix adding codes with hooks Misc: - mGUI: Add SGB border configuration option - mGUI: Add support for different settings types diff --git a/src/gba/cheats.c b/src/gba/cheats.c index 19e80b0b1..8999abc23 100644 --- a/src/gba/cheats.c +++ b/src/gba/cheats.c @@ -276,6 +276,9 @@ static void GBACheatRefresh(struct mCheatSet* cheats, struct mCheatDevice* devic struct GBACheatSet* gbaset = (struct GBACheatSet*) cheats; if (cheats->enabled) { _patchROM(device, gbaset); + if (gbaset->hook && !gbaset->hook->reentries) { + _addBreakpoint(device, gbaset); + } } else { _unpatchROM(device, gbaset); } diff --git a/src/platform/libretro/libretro.c b/src/platform/libretro/libretro.c index 57bd74296..6caa5d866 100644 --- a/src/platform/libretro/libretro.c +++ b/src/platform/libretro/libretro.c @@ -657,6 +657,7 @@ void retro_cheat_set(unsigned index, bool enabled, const char* code) { } } #endif + cheatSet->refresh(cheatSet, device); } unsigned retro_get_region(void) {