Fix libretro build
This commit is contained in:
parent
66112f4930
commit
bb5c9f7fc6
@ -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);
|
int GB_save_cheats(GB_gameboy_t *gb, const char *path);
|
||||||
|
|
||||||
#ifdef GB_INTERNAL
|
#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);
|
void GB_apply_cheat(GB_gameboy_t *gb, uint16_t address, uint8_t *value);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
size_t size;
|
size_t size;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#ifdef GB_INTERNAL
|
#ifdef GB_INTERNAL
|
||||||
#ifdef DISABLE_DEBUGGER
|
#ifdef GB_DISABLE_DEBUGGER
|
||||||
#define GB_debugger_run(gb) (void)0
|
#define GB_debugger_run(gb) (void)0
|
||||||
#define GB_debugger_handle_async_commands(gb) (void)0
|
#define GB_debugger_handle_async_commands(gb) (void)0
|
||||||
#define GB_debugger_ret_hook(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_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);
|
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);
|
const GB_bank_symbol_t *GB_debugger_find_symbol(GB_gameboy_t *gb, uint16_t addr);
|
||||||
#endif /* DISABLE_DEBUGGER */
|
#endif /* GB_DISABLE_DEBUGGER */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GB_INTERNAL
|
#ifdef GB_INTERNAL
|
||||||
|
14
Core/gb.c
14
Core/gb.c
@ -13,7 +13,7 @@
|
|||||||
#include "gb.h"
|
#include "gb.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef DISABLE_REWIND
|
#ifdef GB_DISABLE_REWIND
|
||||||
#define GB_rewind_free(...)
|
#define GB_rewind_free(...)
|
||||||
#define GB_rewind_push(...)
|
#define GB_rewind_push(...)
|
||||||
#endif
|
#endif
|
||||||
@ -57,7 +57,7 @@ void GB_log(GB_gameboy_t *gb, const char *fmt, ...)
|
|||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DISABLE_DEBUGGER
|
#ifndef GB_DISABLE_DEBUGGER
|
||||||
static char *default_input_callback(GB_gameboy_t *gb)
|
static char *default_input_callback(GB_gameboy_t *gb)
|
||||||
{
|
{
|
||||||
char *expression = NULL;
|
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);
|
gb->vram = malloc(gb->vram_size = 0x2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DISABLE_DEBUGGER
|
#ifndef GB_DISABLE_DEBUGGER
|
||||||
gb->input_callback = default_input_callback;
|
gb->input_callback = default_input_callback;
|
||||||
gb->async_input_callback = default_async_input_callback;
|
gb->async_input_callback = default_async_input_callback;
|
||||||
#endif
|
#endif
|
||||||
@ -193,13 +193,15 @@ void GB_free(GB_gameboy_t *gb)
|
|||||||
if (gb->nontrivial_jump_state) {
|
if (gb->nontrivial_jump_state) {
|
||||||
free(gb->nontrivial_jump_state);
|
free(gb->nontrivial_jump_state);
|
||||||
}
|
}
|
||||||
#ifndef DISABLE_DEBUGGER
|
#ifndef GB_DISABLE_DEBUGGER
|
||||||
GB_debugger_clear_symbols(gb);
|
GB_debugger_clear_symbols(gb);
|
||||||
#endif
|
#endif
|
||||||
GB_rewind_free(gb);
|
GB_rewind_free(gb);
|
||||||
|
#ifndef GB_DISABLE_CHEATS
|
||||||
while (gb->cheats) {
|
while (gb->cheats) {
|
||||||
GB_remove_cheat(gb, gb->cheats[0]);
|
GB_remove_cheat(gb, gb->cheats[0]);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
memset(gb, 0, sizeof(*gb));
|
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)
|
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) {
|
if (gb->input_callback == default_input_callback) {
|
||||||
gb->async_input_callback = NULL;
|
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)
|
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;
|
gb->async_input_callback = callback;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
static const unsigned GB_TAC_TRIGGER_BITS[] = {512, 8, 32, 128};
|
static const unsigned GB_TAC_TRIGGER_BITS[] = {512, 8, 32, 128};
|
||||||
|
|
||||||
#ifndef DISABLE_TIMEKEEPING
|
#ifndef GB_DISABLE_TIMEKEEPING
|
||||||
static int64_t get_nanoseconds(void)
|
static int64_t get_nanoseconds(void)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
@ -260,7 +260,7 @@ endif
|
|||||||
|
|
||||||
include Makefile.common
|
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
|
OBJOUT = -o
|
||||||
LINKOUT = -o
|
LINKOUT = -o
|
||||||
@ -306,7 +306,7 @@ else
|
|||||||
$(LD) $(fpic) $(SHARED) $(INCFLAGS) $(LINKOUT)$@ $(OBJECTS) $(LDFLAGS)
|
$(LD) $(fpic) $(SHARED) $(INCFLAGS) $(LINKOUT)$@ $(OBJECTS) $(LDFLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(CORE_DIR)/build/obj/%_libretro.c.o: %.c
|
$(CORE_DIR)/build/obj/%_libretro.c.o: $(CORE_DIR)/%.c
|
||||||
-@$(MKDIR) -p $(dir $@)
|
-@$(MKDIR) -p $(dir $@)
|
||||||
$(CC) -c $(OBJOUT)$@ $< $(CFLAGS) $(fpic) -DGB_INTERNAL
|
$(CC) -c $(OBJOUT)$@ $< $(CFLAGS) $(fpic) -DGB_INTERNAL
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ SOURCES_C := $(CORE_DIR)/Core/gb.c \
|
|||||||
$(CORE_DIR)/libretro/sgb2_boot.c \
|
$(CORE_DIR)/libretro/sgb2_boot.c \
|
||||||
$(CORE_DIR)/libretro/libretro.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 :=
|
SOURCES_CXX :=
|
||||||
|
Loading…
Reference in New Issue
Block a user