GBA Cheats: Add GBACheatDeviceClear
Jeffrey Pfau jeffrey@endrift.com
Sun, 24 Jan 2016 17:48:44 -0800
2 files changed,
7 insertions(+),
1 deletions(-)
M
src/gba/cheats.c
→
src/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.h
→
src/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*);