Permalink
Browse files

Core: Fix ROM patches not being unloaded when disabled (fixes #962)

  • Loading branch information...
endrift committed Jan 15, 2018
1 parent 38e3dbc commit d30d89245229b18be0c4ed92323a730becb2a77d
Showing with 12 additions and 3 deletions.
  1. +1 −0 CHANGES
  2. +1 −1 src/core/cheats.c
  3. +5 −1 src/gb/cheats.c
  4. +5 −1 src/gba/cheats.c
View
@@ -39,6 +39,7 @@ Bugfixes:
- 3DS: Fix opening files in directory names with trailing slashes
- GB MBC: Fix MBC2 saves (fixes mgba.io/i/954)
- GBA Memory: Fix copy-on-write memory leak
+ - Core: Fix ROM patches not being unloaded when disabled (fixes mgba.io/i/962)
Misc:
- GBA Timer: Use global cycles for timers
- GBA: Extend oddly-sized ROMs to full address space (fixes mgba.io/i/722)
View
@@ -266,10 +266,10 @@ void mCheatAutosave(struct mCheatDevice* device) {
#endif
void mCheatRefresh(struct mCheatDevice* device, struct mCheatSet* cheats) {
+ cheats->refresh(cheats, device);
if (!cheats->enabled) {
return;
}
- cheats->refresh(cheats, device);
size_t elseLoc = 0;
size_t endLoc = 0;
View
@@ -244,7 +244,11 @@ bool GBCheatAddLine(struct mCheatSet* set, const char* line, int type) {
static void GBCheatRefresh(struct mCheatSet* cheats, struct mCheatDevice* device) {
struct GBCheatSet* gbset = (struct GBCheatSet*) cheats;
- _patchROM(device, gbset);
+ if (cheats->enabled) {
+ _patchROM(device, gbset);
+ } else {
+ _unpatchROM(device, gbset);
+ }
}
static void GBCheatSetCopyProperties(struct mCheatSet* set, struct mCheatSet* oldSet) {
View
@@ -274,7 +274,11 @@ bool GBACheatAddLine(struct mCheatSet* set, const char* line, int type) {
static void GBACheatRefresh(struct mCheatSet* cheats, struct mCheatDevice* device) {
struct GBACheatSet* gbaset = (struct GBACheatSet*) cheats;
- _patchROM(device, gbaset);
+ if (cheats->enabled) {
+ _patchROM(device, gbaset);
+ } else {
+ _unpatchROM(device, gbaset);
+ }
}
static void GBACheatSetCopyProperties(struct mCheatSet* set, struct mCheatSet* oldSet) {

0 comments on commit d30d892

Please sign in to comment.