all repos — mgba @ e436f2a7276d162dd2cd9b2f4686108820ae77b7

mGBA Game Boy Advance Emulator

GBA Cheats: Add GBACheatDeviceClear
Jeffrey Pfau jeffrey@endrift.com
Sun, 24 Jan 2016 17:48:44 -0800
commit

e436f2a7276d162dd2cd9b2f4686108820ae77b7

parent

a53c3e0628461b179ed2b605339c314617d1aa66

2 files changed, 7 insertions(+), 1 deletions(-)

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

@@ -110,13 +110,18 @@ GBACheatSetsInit(&device->cheats, 4);

} void GBACheatDeviceDestroy(struct GBACheatDevice* device) { + GBACheatDeviceClear(device); + GBACheatSetsDeinit(&device->cheats); +} + +void GBACheatDeviceClear(struct GBACheatDevice* device) { size_t i; for (i = 0; i < GBACheatSetsSize(&device->cheats); ++i) { struct GBACheatSet* set = *GBACheatSetsGetPointer(&device->cheats, i); GBACheatSetDeinit(set); free(set); } - GBACheatSetsDeinit(&device->cheats); + GBACheatSetsClear(&device->cheats); } void GBACheatSetInit(struct GBACheatSet* set, const char* name) {
M src/gba/cheats.hsrc/gba/cheats.h

@@ -192,6 +192,7 @@ struct VFile;

void GBACheatDeviceCreate(struct GBACheatDevice*); void GBACheatDeviceDestroy(struct GBACheatDevice*); +void GBACheatDeviceClear(struct GBACheatDevice*); void GBACheatSetInit(struct GBACheatSet*, const char* name); void GBACheatSetDeinit(struct GBACheatSet*);