2020-04-09 17:11:55 +00:00
|
|
|
#ifndef cheats_h
|
|
|
|
#define cheats_h
|
2021-11-07 11:39:18 +00:00
|
|
|
#include "defs.h"
|
2020-04-09 17:11:55 +00:00
|
|
|
|
|
|
|
#define GB_CHEAT_ANY_BANK 0xFFFF
|
|
|
|
|
|
|
|
typedef struct GB_cheat_s GB_cheat_t;
|
|
|
|
|
|
|
|
void GB_add_cheat(GB_gameboy_t *gb, const char *description, uint16_t address, uint16_t bank, uint8_t value, uint8_t old_value, bool use_old_value, bool enabled);
|
2020-04-11 15:03:10 +00:00
|
|
|
void GB_update_cheat(GB_gameboy_t *gb, const GB_cheat_t *cheat, const char *description, uint16_t address, uint16_t bank, uint8_t value, uint8_t old_value, bool use_old_value, bool enabled);
|
2020-04-09 17:11:55 +00:00
|
|
|
bool GB_import_cheat(GB_gameboy_t *gb, const char *cheat, const char *description, bool enabled);
|
|
|
|
const GB_cheat_t *const *GB_get_cheats(GB_gameboy_t *gb, size_t *size);
|
|
|
|
void GB_remove_cheat(GB_gameboy_t *gb, const GB_cheat_t *cheat);
|
2020-04-11 15:03:10 +00:00
|
|
|
bool GB_cheats_enabled(GB_gameboy_t *gb);
|
|
|
|
void GB_set_cheats_enabled(GB_gameboy_t *gb, bool enabled);
|
2020-04-11 16:15:40 +00:00
|
|
|
void GB_load_cheats(GB_gameboy_t *gb, const char *path);
|
|
|
|
int GB_save_cheats(GB_gameboy_t *gb, const char *path);
|
2020-04-09 17:11:55 +00:00
|
|
|
|
|
|
|
#ifdef GB_INTERNAL
|
2020-04-25 12:12:10 +00:00
|
|
|
#ifdef GB_DISABLE_CHEATS
|
|
|
|
#define GB_apply_cheat(...)
|
|
|
|
#else
|
2021-11-07 12:13:52 +00:00
|
|
|
internal void GB_apply_cheat(GB_gameboy_t *gb, uint16_t address, uint8_t *value);
|
2020-04-09 17:11:55 +00:00
|
|
|
#endif
|
2020-04-25 12:12:10 +00:00
|
|
|
#endif
|
2020-04-09 17:11:55 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
size_t size;
|
|
|
|
GB_cheat_t *cheats[];
|
|
|
|
} GB_cheat_hash_t;
|
|
|
|
|
|
|
|
struct GB_cheat_s {
|
|
|
|
uint16_t address;
|
|
|
|
uint16_t bank;
|
|
|
|
uint8_t value;
|
|
|
|
uint8_t old_value;
|
|
|
|
bool use_old_value;
|
|
|
|
bool enabled;
|
|
|
|
char description[128];
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|