Changed the way BIOS loading works, as well as hide some options when not applicable

This commit is contained in:
DarthMew 2021-10-25 02:11:11 +02:00
commit d00a9fc720
3 changed files with 114 additions and 20 deletions

View file

@ -275,7 +275,7 @@ std::optional<std::vector<u8>> HostInterface::GetBIOSImage(ConsoleRegion region)
if (bios_name.empty())
{
// auto-detect
//auto-detect
return FindBIOSImageInDirectory(region, bios_dir.c_str());
}
@ -284,10 +284,7 @@ std::optional<std::vector<u8>> HostInterface::GetBIOSImage(ConsoleRegion region)
StringUtil::StdStringFromFormat("%s" FS_OSPATH_SEPARATOR_STR "%s", bios_dir.c_str(), bios_name.c_str()).c_str());
if (!image.has_value())
{
g_host_interface->ReportFormattedError(
g_host_interface->TranslateString("HostInterface", "Failed to load configured BIOS file '%s'"),
bios_name.c_str());
return std::nullopt;
return FindBIOSImageInDirectory(region, bios_dir.c_str());
}
BIOS::Hash found_hash = BIOS::GetHash(*image);
@ -356,7 +353,7 @@ std::optional<std::vector<u8>> HostInterface::FindBIOSImageInDirectory(ConsoleRe
if (!fallback_info)
{
Log_WarningPrintf("Using unknown BIOS '%s'. This may crash.", fallback_path.c_str());
return std::nullopt;
}
else
{

View file

@ -346,20 +346,6 @@ struct retro_core_option_v2_definition option_defs_us[] = {
"OpenGL"
#endif
},
{
"duckstation_GPU.UseThread",
"Threaded Rendering (Software)",
NULL,
"Uses a second thread for drawing graphics. Currently only available for the software renderer.",
NULL,
"enhancement",
{
{ "true", "Enabled" },
{ "false", "Disabled" },
{ NULL, NULL },
},
"true"
},
{
"duckstation_GPU.ResolutionScale",
"Internal Resolution Scale",
@ -389,6 +375,20 @@ struct retro_core_option_v2_definition option_defs_us[] = {
},
"1"
},
{
"duckstation_GPU.UseThread",
"Threaded Rendering (Software)",
NULL,
"Uses a second thread for drawing graphics. Currently only available for the software renderer.",
NULL,
"enhancement",
{
{ "true", "Enabled" },
{ "false", "Disabled" },
{ NULL, NULL },
},
"true"
},
{
"duckstation_GPU.UseSoftwareRendererForReadbacks",
"Use Software Renderer For Readbacks",
@ -1507,6 +1507,51 @@ struct retro_core_option_v2_definition option_defs_us[] = {
},
"false"
},
{
"duckstation_BIOS.PathNTSCJ",
"NTSC-J BIOS (Restart)",
NULL,
"Select which standard BIOS to use for NTSC-J",
NULL,
"advanced",
{
{ "psxonpsp660.bin", "POPS BIOS" },
{ "scph5500.bin", "SCPH5500 BIOS" },
{ "ps1_rom.bin", "PS3 BIOS" },
{ NULL, NULL },
},
"psxonpsp660.bin"
},
{
"duckstation_BIOS.PathNTSCU",
"NTSC-U BIOS (Restart)",
NULL,
"Select which standard BIOS to use for NTSC-U",
NULL,
"advanced",
{
{ "psxonpsp660.bin", "POPS BIOS" },
{ "scph5501.bin", "SCPH5501 BIOS" },
{ "ps1_rom.bin", "PS3 BIOS" },
{ NULL, NULL },
},
"psxonpsp660.bin"
},
{
"duckstation_BIOS.PathPAL",
"PAL BIOS (Restart)",
NULL,
"Select which standard BIOS to use for PAL",
NULL,
"advanced",
{
{ "psxonpsp660.bin", "POPS BIOS" },
{ "scph5502.bin", "SCPH5502 BIOS" },
{ "ps1_rom.bin", "PS3 BIOS" },
{ NULL, NULL },
},
"psxonpsp660.bin"
},
{ NULL, NULL, NULL, NULL, NULL, NULL, {{0}}, NULL },
};

View file

@ -432,6 +432,58 @@ bool LibretroHostInterface::retro_load_game(const struct retro_game_info* game)
}
}
switch (System::GetRegion())
{
case ConsoleRegion::NTSC_J:
{
struct retro_core_option_display option_display;
option_display.visible = false;
option_display.key = "duckstation_BIOS.PathNTSCU";
g_retro_environment_callback(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display);
option_display.key = "duckstation_BIOS.PathPAL";
g_retro_environment_callback(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display);
break;
}
case ConsoleRegion::NTSC_U:
{
struct retro_core_option_display option_display;
option_display.visible = false;
option_display.key = "duckstation_BIOS.PathNTSCJ";
g_retro_environment_callback(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display);
option_display.key = "duckstation_BIOS.PathPAL";
g_retro_environment_callback(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display);
break;
}
case ConsoleRegion::PAL:
{
struct retro_core_option_display option_display;
option_display.visible = false;
option_display.key = "duckstation_BIOS.PathNTSCU";
g_retro_environment_callback(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display);
option_display.key = "duckstation_BIOS.PathNTSCJ";
g_retro_environment_callback(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display);
break;
}
}
struct retro_core_option_display option_display;
option_display.visible = false;
if (g_settings.gpu_renderer == GPURenderer::Software)
{
option_display.key = "duckstation_GPU.UseSoftwareRendererForReadbacks";
g_retro_environment_callback(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display);
}
else
{
option_display.key = "duckstation_GPU.UseThread";
g_retro_environment_callback(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display);
}
return true;
}