GBA Cheats: Add GBACheatDeviceClear

This commit is contained in:
Jeffrey Pfau 2016-01-24 17:48:44 -08:00
parent a53c3e0628
commit e436f2a727
2 changed files with 7 additions and 1 deletions

View File

@ -110,13 +110,18 @@ void GBACheatDeviceCreate(struct GBACheatDevice* device) {
}
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) {

View File

@ -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*);