update libretro core

This commit is contained in:
radius 2019-01-05 20:58:23 -05:00
parent 9fa6a2fe92
commit ca8426ea60
2 changed files with 24 additions and 11 deletions

View File

@ -1,6 +1,7 @@
INCFLAGS := -I$(CORE_DIR) INCFLAGS := -I$(CORE_DIR)
SOURCES_C := $(CORE_DIR)/Core/gb.c \ SOURCES_C := $(CORE_DIR)/Core/gb.c \
$(CORE_DIR)/Core/sgb.c \
$(CORE_DIR)/Core/apu.c \ $(CORE_DIR)/Core/apu.c \
$(CORE_DIR)/Core/memory.c \ $(CORE_DIR)/Core/memory.c \
$(CORE_DIR)/Core/mbc.c \ $(CORE_DIR)/Core/mbc.c \
@ -14,6 +15,8 @@ SOURCES_C := $(CORE_DIR)/Core/gb.c \
$(CORE_DIR)/libretro/agb_boot.c \ $(CORE_DIR)/libretro/agb_boot.c \
$(CORE_DIR)/libretro/cgb_boot.c \ $(CORE_DIR)/libretro/cgb_boot.c \
$(CORE_DIR)/libretro/dmg_boot.c \ $(CORE_DIR)/libretro/dmg_boot.c \
$(CORE_DIR)/libretro/sgb_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 += -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER

View File

@ -49,6 +49,8 @@ enum model {
MODEL_DMG, MODEL_DMG,
MODEL_CGB, MODEL_CGB,
MODEL_AGB, MODEL_AGB,
MODEL_SGB,
MODEL_SGB2,
MODEL_AUTO MODEL_AUTO
}; };
@ -56,7 +58,9 @@ static const GB_model_t libretro_to_internal_model[] =
{ {
[MODEL_DMG] = GB_MODEL_DMG_B, [MODEL_DMG] = GB_MODEL_DMG_B,
[MODEL_CGB] = GB_MODEL_CGB_E, [MODEL_CGB] = GB_MODEL_CGB_E,
[MODEL_AGB] = GB_MODEL_AGB [MODEL_AGB] = GB_MODEL_AGB,
[MODEL_SGB] = GB_MODEL_SGB,
[MODEL_SGB2] = GB_MODEL_SGB2
}; };
enum screen_layout { enum screen_layout {
@ -109,8 +113,8 @@ char retro_game_path[4096];
GB_gameboy_t gameboy[2]; GB_gameboy_t gameboy[2];
extern const unsigned char dmg_boot[], cgb_boot[], agb_boot[]; extern const unsigned char dmg_boot[], cgb_boot[], agb_boot[], sgb_boot[], sgb2_boot[];
extern const unsigned dmg_boot_length, cgb_boot_length, agb_boot_length; extern const unsigned dmg_boot_length, cgb_boot_length, agb_boot_length, sgb_boot_length, sgb2_boot_length;
bool vblank1_occurred = false, vblank2_occurred = false; bool vblank1_occurred = false, vblank2_occurred = false;
static void fallback_log(enum retro_log_level level, const char *fmt, ...) static void fallback_log(enum retro_log_level level, const char *fmt, ...)
@ -233,7 +237,7 @@ static const struct retro_variable vars_single[] = {
{ "sameboy_dual", "Single cart dual mode (reload); disabled|enabled" }, { "sameboy_dual", "Single cart dual mode (reload); disabled|enabled" },
{ "sameboy_color_correction_mode", "Color correction; off|correct curves|emulate hardware|preserve brightness" }, { "sameboy_color_correction_mode", "Color correction; off|correct curves|emulate hardware|preserve brightness" },
{ "sameboy_high_pass_filter_mode", "High-pass filter; off|accurate|remove dc offset" }, { "sameboy_high_pass_filter_mode", "High-pass filter; off|accurate|remove dc offset" },
{ "sameboy_model", "Emulated model; Game Boy Color|Game Boy Advance|Auto|Game Boy" }, { "sameboy_model", "Emulated model; Game Boy Color|Game Boy Advance|Auto|Game Boy|Super Game Boy|Super Game Boy 2" },
{ NULL } { NULL }
}; };
@ -244,8 +248,8 @@ static const struct retro_variable vars_single_dual[] = {
/*{ "sameboy_ir", "Infrared Sensor Emulation; disabled|enabled" },*/ /*{ "sameboy_ir", "Infrared Sensor Emulation; disabled|enabled" },*/
{ "sameboy_screen_layout", "Screen layout; top-down|left-right" }, { "sameboy_screen_layout", "Screen layout; top-down|left-right" },
{ "sameboy_audio_output", "Audio output; Game Boy #1|Game Boy #2" }, { "sameboy_audio_output", "Audio output; Game Boy #1|Game Boy #2" },
{ "sameboy_model_1", "Emulated model for Game Boy #1; Game Boy Color|Game Boy Advance|Auto|Game Boy" }, { "sameboy_model_1", "Emulated model for Game Boy #1; Game Boy Color|Game Boy Advance|Auto|Game Boy|Super Game Boy|Super Game Boy 2" },
{ "sameboy_model_2", "Emulated model for Game Boy #2; Game Boy Color|Game Boy Advance|Auto|Game Boy" }, { "sameboy_model_2", "Emulated model for Game Boy #2; Game Boy Color|Game Boy Advance|Auto|Game Boy|Super Game Boy|Super Game Boy 2" },
{ "sameboy_color_correction_mode_1", "Color correction for Game Boy #1; off|correct curves|emulate hardware|preserve brightness" }, { "sameboy_color_correction_mode_1", "Color correction for Game Boy #1; off|correct curves|emulate hardware|preserve brightness" },
{ "sameboy_color_correction_mode_2", "Color correction for Game Boy #2; off|correct curves|emulate hardware|preserve brightness" }, { "sameboy_color_correction_mode_2", "Color correction for Game Boy #2; off|correct curves|emulate hardware|preserve brightness" },
{ "sameboy_high_pass_filter_mode_1", "High-pass filter for Game Boy #1; off|accurate|remove dc offset" }, { "sameboy_high_pass_filter_mode_1", "High-pass filter for Game Boy #1; off|accurate|remove dc offset" },
@ -259,8 +263,8 @@ static const struct retro_variable vars_dual[] = {
/*{ "sameboy_ir", "Infrared Sensor Emulation; disabled|enabled" },*/ /*{ "sameboy_ir", "Infrared Sensor Emulation; disabled|enabled" },*/
{ "sameboy_screen_layout", "Screen layout; top-down|left-right" }, { "sameboy_screen_layout", "Screen layout; top-down|left-right" },
{ "sameboy_audio_output", "Audio output; Game Boy #1|Game Boy #2" }, { "sameboy_audio_output", "Audio output; Game Boy #1|Game Boy #2" },
{ "sameboy_model_1", "Emulated model for Game Boy #1; Game Boy Color|Game Boy Advance|Auto|Game Boy" }, { "sameboy_model_1", "Emulated model for Game Boy #1; Game Boy Color|Game Boy Advance|Auto|Game Boy|Super Game Boy 2" },
{ "sameboy_model_2", "Emulated model for Game Boy #2; Game Boy Color|Game Boy Advance|Auto|Game Boy" }, { "sameboy_model_2", "Emulated model for Game Boy #2; Game Boy Color|Game Boy Advance|Auto|Game Boy|Super Game Boy 2" },
{ "sameboy_color_correction_mode_1", "Color correction for Game Boy #1; off|correct curves|emulate hardware|preserve brightness" }, { "sameboy_color_correction_mode_1", "Color correction for Game Boy #1; off|correct curves|emulate hardware|preserve brightness" },
{ "sameboy_color_correction_mode_2", "Color correction for Game Boy #2; off|correct curves|emulate hardware|preserve brightness" }, { "sameboy_color_correction_mode_2", "Color correction for Game Boy #2; off|correct curves|emulate hardware|preserve brightness" },
{ "sameboy_high_pass_filter_mode_1", "High-pass filter for Game Boy #1; off|accurate|remove dc offset" }, { "sameboy_high_pass_filter_mode_1", "High-pass filter for Game Boy #1; off|accurate|remove dc offset" },
@ -327,9 +331,9 @@ static void init_for_current_model(unsigned id)
else { else {
GB_init(&gameboy[i], libretro_to_internal_model[effective_model]); GB_init(&gameboy[i], libretro_to_internal_model[effective_model]);
} }
const char *model_name = (const char *[]){"dmg", "cgb", "agb"}[effective_model]; const char *model_name = (const char *[]){"dmg", "cgb", "agb", "sgb", "sgb2"}[effective_model];
const unsigned char *boot_code = (const unsigned char *[]){dmg_boot, cgb_boot, agb_boot}[effective_model]; const unsigned char *boot_code = (const unsigned char *[]){dmg_boot, cgb_boot, agb_boot, sgb_boot, sgb2_boot}[effective_model];
unsigned boot_length = (unsigned []){dmg_boot_length, cgb_boot_length, agb_boot_length}[effective_model]; unsigned boot_length = (unsigned []){dmg_boot_length, cgb_boot_length, agb_boot_length, sgb_boot_length, sgb2_boot_length}[effective_model];
char buf[256]; char buf[256];
snprintf(buf, sizeof(buf), "%s%c%s_boot.bin", retro_system_directory, slash, model_name); snprintf(buf, sizeof(buf), "%s%c%s_boot.bin", retro_system_directory, slash, model_name);
@ -441,6 +445,8 @@ static void check_variables(bool link)
new_model = MODEL_CGB; new_model = MODEL_CGB;
else if (strcmp(var.value, "Game Boy Advance") == 0) else if (strcmp(var.value, "Game Boy Advance") == 0)
new_model = MODEL_AGB; new_model = MODEL_AGB;
else if (strcmp(var.value, "Super Game Boy") == 0)
new_model = MODEL_SGB;
else else
new_model = MODEL_AUTO; new_model = MODEL_AUTO;
@ -516,6 +522,8 @@ static void check_variables(bool link)
new_model = MODEL_CGB; new_model = MODEL_CGB;
else if (strcmp(var.value, "Game Boy Advance") == 0) else if (strcmp(var.value, "Game Boy Advance") == 0)
new_model = MODEL_AGB; new_model = MODEL_AGB;
else if (strcmp(var.value, "Super Game Boy") == 0)
new_model = MODEL_SGB;
else else
new_model = MODEL_AUTO; new_model = MODEL_AUTO;
@ -537,6 +545,8 @@ static void check_variables(bool link)
new_model = MODEL_CGB; new_model = MODEL_CGB;
else if (strcmp(var.value, "Game Boy Advance") == 0) else if (strcmp(var.value, "Game Boy Advance") == 0)
new_model = MODEL_AGB; new_model = MODEL_AGB;
else if (strcmp(var.value, "Super Game Boy") == 0)
new_model = MODEL_SGB;
else else
new_model = MODEL_AUTO; new_model = MODEL_AUTO;