Skip to content

Commit

Permalink
Allow enabling GBA RTC regardless of rom types
Browse files Browse the repository at this point in the history
- Add core option to allow RTC to be enabled regardless of rom. This usuable for rom patches that requires the RTC to be enabled yet the RTC flag is not enabled. (aka Pokemon patches)
  • Loading branch information
retro-wertz committed Aug 7, 2019
1 parent 4dbdf87 commit 496b372
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/libretro/libretro.cpp
Expand Up @@ -56,6 +56,7 @@ static EmulatedSystem* core = NULL;
static IMAGE_TYPE type = IMAGE_UNKNOWN;
static unsigned current_gbPalette = 0;
static bool opt_colorizer_hack = false;
static bool opt_forceRTCenable = false;

uint16_t systemColorMap16[0x10000];
uint32_t systemColorMap32[0x10000];
Expand Down Expand Up @@ -801,6 +802,9 @@ static void load_image_preferences(void)
if (flashSize == SIZE_FLASH512 || flashSize == SIZE_FLASH1M)
flashSetSize(flashSize);

if (opt_forceRTCenable)
rtcEnabled = true;

rtcEnable(rtcEnabled);

// game code starting with 'R' or 'V' has rumble support
Expand Down Expand Up @@ -1059,6 +1063,14 @@ static void update_variables(bool startup)
usebios = newval;
}

var.key = "vbam_forceRTCenable";
var.value = NULL;

if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
bool newval = (strcmp(var.value, "enabled") == 0) ? true : false;
opt_forceRTCenable = newval;
}

var.key = "vbam_solarsensor";
var.value = NULL;

Expand Down Expand Up @@ -1221,11 +1233,12 @@ static void update_variables(bool startup)
"vbam_showborders",
"vbam_gbcoloroption"
};
char gba_options[4][22] = {
char gba_options[5][22] = {
"vbam_solarsensor",
"vbam_sound_5",
"vbam_sound_6",
"vbam_gyro_sensitivity"
"vbam_gyro_sensitivity",
"vbam_forceRTCenable"
};

// Show or hide GB/GBC only options
Expand All @@ -1238,7 +1251,7 @@ static void update_variables(bool startup)

// Show or hide GBA only options
option_display.visible = (type == IMAGE_GBA) ? 1 : 0;
for (i = 0; i < 4; i++)
for (i = 0; i < 5; i++)
{
option_display.key = gba_options[i];
environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display);
Expand Down
11 changes: 11 additions & 0 deletions src/libretro/libretro_core_options.h
Expand Up @@ -58,6 +58,17 @@ struct retro_core_option_definition option_defs_us[] = {
},
"disabled"
},
{
"vbam_forceRTCenable",
"Force enable RTC",
"Forces the internal real-time clock to be enabled regardless of rom. Usuable for rom patches that requires clock to be enabled (aka Pokemon).",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"vbam_soundinterpolation",
"Sound Interpolation",
Expand Down

0 comments on commit 496b372

Please sign in to comment.