git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

Core/cheats.h

      1 #pragma once
      2 #ifndef GB_DISABLE_CHEATS
      3 #include "defs.h"
      4 
      5 #define GB_CHEAT_ANY_BANK 0xFFFF
      6 
      7 typedef struct GB_cheat_s GB_cheat_t;
      8 
      9 const GB_cheat_t *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);
     10 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);
     11 const GB_cheat_t *GB_import_cheat(GB_gameboy_t *gb, const char *cheat, const char *description, bool enabled);
     12 const GB_cheat_t *const *GB_get_cheats(GB_gameboy_t *gb, size_t *size);
     13 void GB_remove_cheat(GB_gameboy_t *gb, const GB_cheat_t *cheat);
     14 void GB_remove_all_cheats(GB_gameboy_t *gb);
     15 bool GB_cheats_enabled(GB_gameboy_t *gb);
     16 void GB_set_cheats_enabled(GB_gameboy_t *gb, bool enabled);
     17 int GB_load_cheats(GB_gameboy_t *gb, const char *path, bool replace_existing);
     18 int GB_save_cheats(GB_gameboy_t *gb, const char *path);
     19 
     20 #ifdef GB_INTERNAL
     21 internal void GB_apply_cheat(GB_gameboy_t *gb, uint16_t address, uint8_t *value);
     22 #endif
     23 
     24 typedef struct {
     25     size_t size;
     26     GB_cheat_t *cheats[];
     27 } GB_cheat_hash_t;
     28 
     29 struct GB_cheat_s {
     30     uint16_t address;
     31     uint16_t bank;
     32     uint8_t value;
     33     uint8_t old_value;
     34     bool use_old_value;
     35     bool enabled;
     36     char description[128];
     37 };
     38 #else
     39 #ifdef GB_INTERNAL
     40 #define GB_apply_cheat(...)
     41 #endif // GB_INTERNAL
     42 #endif // GB_DISABLE_CHEATS

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.