Merge pull request #40 from Monroe88/force_dmg

Add core option to force DMG mode
This commit is contained in:
Twinaphex 2015-06-14 06:48:11 +02:00
commit 627c1191aa

View File

@ -150,6 +150,7 @@ void retro_set_environment(retro_environment_t cb)
{ "gambatte_gb_gbamode", "GBA mode; disabled|enabled" }, { "gambatte_gb_gbamode", "GBA mode; disabled|enabled" },
{ "gambatte_gb_colorization", "GB Colorization; disabled|enabled|custom" }, { "gambatte_gb_colorization", "GB Colorization; disabled|enabled|custom" },
{ "gambatte_gbc_color_correction", "Color correction; enabled|disabled" }, { "gambatte_gbc_color_correction", "Color correction; enabled|disabled" },
{ "gambatte_gb_force_dmg", "Force DMG Mode; disabled|enabled" },
{ NULL, NULL }, { NULL, NULL },
}; };
@ -482,6 +483,13 @@ bool retro_load_game(const struct retro_game_info *info)
if (gb.load(info->data, info->size, gbamode ? gambatte::GB::GBA_CGB : 0) != 0) if (gb.load(info->data, info->size, gbamode ? gambatte::GB::GBA_CGB : 0) != 0)
return false; return false;
bool force_dmg = false;
var.key = "gambatte_gb_force_dmg";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value && !strcmp(var.value, "enabled")) force_dmg=true;
if (gb.load(info->data, info->size, force_dmg ? gambatte::GB::FORCE_DMG : 0) != 0)
return false;
rom_path = info->path ? info->path : ""; rom_path = info->path ? info->path : "";
strncpy(internal_game_name, (const char*)info->data + 0x134, sizeof(internal_game_name) - 1); strncpy(internal_game_name, (const char*)info->data + 0x134, sizeof(internal_game_name) - 1);
internal_game_name[sizeof(internal_game_name)-1]='\0'; internal_game_name[sizeof(internal_game_name)-1]='\0';