mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 15:45:42 +00:00
Settings: Hook up console region
This commit is contained in:
parent
613e4f4a2a
commit
f1289d6161
|
@ -37,6 +37,8 @@ void Settings::Load(const char* filename)
|
|||
return;
|
||||
}
|
||||
|
||||
region = ParseConsoleRegionName(ini.GetValue("Console", "Region", "NTSC-U")).value_or(ConsoleRegion::NTSC_U);
|
||||
|
||||
gpu_renderer = ParseRendererName(ini.GetValue("GPU", "Renderer", "OpenGL")).value_or(GPURenderer::HardwareOpenGL);
|
||||
gpu_resolution_scale = static_cast<u32>(ini.GetLongValue("GPU", "ResolutionScale", 1));
|
||||
gpu_vsync = static_cast<u32>(ini.GetBoolValue("GPU", "VSync", true));
|
||||
|
@ -60,6 +62,8 @@ bool Settings::Save(const char* filename) const
|
|||
if (err != SI_OK)
|
||||
ini.Reset();
|
||||
|
||||
ini.SetValue("Console", "Region", GetConsoleRegionName(region));
|
||||
|
||||
ini.SetValue("GPU", "Renderer", GetRendererName(gpu_renderer));
|
||||
ini.SetLongValue("GPU", "ResolutionScale", static_cast<long>(gpu_resolution_scale));
|
||||
ini.SetBoolValue("GPU", "VSync", gpu_vsync);
|
||||
|
|
|
@ -115,7 +115,7 @@ bool System::Boot(const char* filename)
|
|||
std::optional<ConsoleRegion> detected_region = GetRegionForCDImage(media.get());
|
||||
m_region = detected_region.value_or(ConsoleRegion::NTSC_U);
|
||||
if (detected_region)
|
||||
Log_InfoPrintf("Auto-detected %s region for '%s'", Settings::GetConsoleRegionName(m_region));
|
||||
Log_InfoPrintf("Auto-detected %s region for '%s'", Settings::GetConsoleRegionName(m_region), filename);
|
||||
else
|
||||
Log_WarningPrintf("Could not determine region for CD. Defaulting to NTSC-U.");
|
||||
}
|
||||
|
|
|
@ -925,8 +925,19 @@ void SDLHostInterface::DrawSettingsWindow()
|
|||
{
|
||||
ImGui::Text("Region:");
|
||||
ImGui::SameLine(indent);
|
||||
static int region = 0;
|
||||
ImGui::Combo("##region", ®ion, "NTSC-U (US)\0NTSC-J (Japan)\0PAL (Europe, Australia)");
|
||||
|
||||
int region = static_cast<int>(m_settings.region);
|
||||
if (ImGui::Combo(
|
||||
"##region", ®ion,
|
||||
[](void*, int index, const char** out_text) {
|
||||
*out_text = Settings::GetConsoleRegionDisplayName(static_cast<ConsoleRegion>(index));
|
||||
return true;
|
||||
},
|
||||
nullptr, static_cast<int>(ConsoleRegion::Count)))
|
||||
{
|
||||
m_settings.region = static_cast<ConsoleRegion>(region);
|
||||
settings_changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::NewLine();
|
||||
|
@ -994,6 +1005,7 @@ void SDLHostInterface::DrawSettingsWindow()
|
|||
nullptr, static_cast<int>(GPURenderer::Count)))
|
||||
{
|
||||
m_settings.gpu_renderer = static_cast<GPURenderer>(gpu_renderer);
|
||||
settings_changed = true;
|
||||
SwitchGPURenderer();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue