diff --git a/Core/cheats.h b/Core/cheats.h index 13b7d7b..cf8aa20 100644 --- a/Core/cheats.h +++ b/Core/cheats.h @@ -17,8 +17,12 @@ void GB_load_cheats(GB_gameboy_t *gb, const char *path); int GB_save_cheats(GB_gameboy_t *gb, const char *path); #ifdef GB_INTERNAL +#ifdef GB_DISABLE_CHEATS +#define GB_apply_cheat(...) +#else void GB_apply_cheat(GB_gameboy_t *gb, uint16_t address, uint8_t *value); #endif +#endif typedef struct { size_t size; diff --git a/Core/debugger.h b/Core/debugger.h index 2906ad9..4868df3 100644 --- a/Core/debugger.h +++ b/Core/debugger.h @@ -7,7 +7,7 @@ #ifdef GB_INTERNAL -#ifdef DISABLE_DEBUGGER +#ifdef GB_DISABLE_DEBUGGER #define GB_debugger_run(gb) (void)0 #define GB_debugger_handle_async_commands(gb) (void)0 #define GB_debugger_ret_hook(gb) (void)0 @@ -22,7 +22,7 @@ void GB_debugger_ret_hook(GB_gameboy_t *gb); void GB_debugger_test_write_watchpoint(GB_gameboy_t *gb, uint16_t addr, uint8_t value); void GB_debugger_test_read_watchpoint(GB_gameboy_t *gb, uint16_t addr); const GB_bank_symbol_t *GB_debugger_find_symbol(GB_gameboy_t *gb, uint16_t addr); -#endif /* DISABLE_DEBUGGER */ +#endif /* GB_DISABLE_DEBUGGER */ #endif #ifdef GB_INTERNAL diff --git a/Core/gb.c b/Core/gb.c index f6174b9..2b22f9d 100644 --- a/Core/gb.c +++ b/Core/gb.c @@ -13,7 +13,7 @@ #include "gb.h" -#ifdef DISABLE_REWIND +#ifdef GB_DISABLE_REWIND #define GB_rewind_free(...) #define GB_rewind_push(...) #endif @@ -57,7 +57,7 @@ void GB_log(GB_gameboy_t *gb, const char *fmt, ...) va_end(args); } -#ifndef DISABLE_DEBUGGER +#ifndef GB_DISABLE_DEBUGGER static char *default_input_callback(GB_gameboy_t *gb) { char *expression = NULL; @@ -148,7 +148,7 @@ void GB_init(GB_gameboy_t *gb, GB_model_t model) gb->vram = malloc(gb->vram_size = 0x2000); } -#ifndef DISABLE_DEBUGGER +#ifndef GB_DISABLE_DEBUGGER gb->input_callback = default_input_callback; gb->async_input_callback = default_async_input_callback; #endif @@ -193,13 +193,15 @@ void GB_free(GB_gameboy_t *gb) if (gb->nontrivial_jump_state) { free(gb->nontrivial_jump_state); } -#ifndef DISABLE_DEBUGGER +#ifndef GB_DISABLE_DEBUGGER GB_debugger_clear_symbols(gb); #endif GB_rewind_free(gb); +#ifndef GB_DISABLE_CHEATS while (gb->cheats) { GB_remove_cheat(gb, gb->cheats[0]); } +#endif memset(gb, 0, sizeof(*gb)); } @@ -643,7 +645,7 @@ void GB_set_log_callback(GB_gameboy_t *gb, GB_log_callback_t callback) void GB_set_input_callback(GB_gameboy_t *gb, GB_input_callback_t callback) { -#ifndef DISABLE_DEBUGGER +#ifndef GB_DISABLE_DEBUGGER if (gb->input_callback == default_input_callback) { gb->async_input_callback = NULL; } @@ -653,7 +655,7 @@ void GB_set_input_callback(GB_gameboy_t *gb, GB_input_callback_t callback) void GB_set_async_input_callback(GB_gameboy_t *gb, GB_input_callback_t callback) { -#ifndef DISABLE_DEBUGGER +#ifndef GB_DISABLE_DEBUGGER gb->async_input_callback = callback; #endif } diff --git a/Core/timing.c b/Core/timing.c index 9eb9c91..8fee590 100644 --- a/Core/timing.c +++ b/Core/timing.c @@ -10,7 +10,7 @@ static const unsigned GB_TAC_TRIGGER_BITS[] = {512, 8, 32, 128}; -#ifndef DISABLE_TIMEKEEPING +#ifndef GB_DISABLE_TIMEKEEPING static int64_t get_nanoseconds(void) { #ifndef _WIN32 diff --git a/libretro/Makefile b/libretro/Makefile index 75ddfc6..7e19893 100644 --- a/libretro/Makefile +++ b/libretro/Makefile @@ -260,7 +260,7 @@ endif include Makefile.common -OBJECTS := $(patsubst %.c,$(CORE_DIR)/build/obj/%_libretro.c.o,$(SOURCES_C)) +OBJECTS := $(patsubst $(CORE_DIR)/%.c,$(CORE_DIR)/build/obj/%_libretro.c.o,$(SOURCES_C)) OBJOUT = -o LINKOUT = -o @@ -306,7 +306,7 @@ else $(LD) $(fpic) $(SHARED) $(INCFLAGS) $(LINKOUT)$@ $(OBJECTS) $(LDFLAGS) endif -$(CORE_DIR)/build/obj/%_libretro.c.o: %.c +$(CORE_DIR)/build/obj/%_libretro.c.o: $(CORE_DIR)/%.c -@$(MKDIR) -p $(dir $@) $(CC) -c $(OBJOUT)$@ $< $(CFLAGS) $(fpic) -DGB_INTERNAL diff --git a/libretro/Makefile.common b/libretro/Makefile.common index 3bf1783..947b14c 100644 --- a/libretro/Makefile.common +++ b/libretro/Makefile.common @@ -20,7 +20,7 @@ SOURCES_C := $(CORE_DIR)/Core/gb.c \ $(CORE_DIR)/libretro/sgb2_boot.c \ $(CORE_DIR)/libretro/libretro.c -CFLAGS += -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER +CFLAGS += -DGB_DISABLE_TIMEKEEPING -DGB_DISABLE_REWIND -DGB_DISABLE_DEBUGGER -DGB_DISABLE_CHEATS SOURCES_CXX :=