Fix libretro build

This commit is contained in:
Lior Halphon 2020-04-25 15:12:10 +03:00
parent 66112f4930
commit bb5c9f7fc6
6 changed files with 18 additions and 12 deletions

View File

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

View File

@ -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

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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 :=