Skip to content

Commit

Permalink
Set default core provided AR to 4:3 & force 'Corrected' when using a …
Browse files Browse the repository at this point in the history
…GunCon
  • Loading branch information
DarthMew committed Jan 18, 2023
1 parent 9c701ef commit 9c2ed9e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/core/gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,8 @@ float GPU::GetDisplayAspectRatio() const
{
return 4.0f / 3.0f;
}
else if (g_settings.display_aspect_ratio == DisplayAspectRatio::Auto)
else if (g_settings.display_aspect_ratio == DisplayAspectRatio::Auto || g_settings.controller_types[0] == ControllerType::NamcoGunCon ||
g_settings.controller_types[1] == ControllerType::NamcoGunCon)
{
const CRTCState& cs = m_crtc_state;
float relative_width = static_cast<float>(cs.horizontal_visible_end - cs.horizontal_visible_start);
Expand Down
5 changes: 3 additions & 2 deletions src/libretro/libretro_core_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,8 @@ struct retro_core_option_v2_definition option_defs_us[] = {
"duckstation_Display.AspectRatio",
"Core Provided Aspect Ratio",
NULL,
"Sets the preferred aspect ratio. Will only work when the 'Core Provided' aspect ratio is selected inside RetroArch's Video settings.",
"Sets the preferred aspect ratio. Will only work when the 'Core Provided' aspect ratio is selected inside RetroArch's Video settings. "
"Will be forced to 'Corrected' when using a Namco GunCon controller in either port 1 or 2",
NULL,
"display",
{
Expand All @@ -791,7 +792,7 @@ struct retro_core_option_v2_definition option_defs_us[] = {
{ "Native", "Game Native" },
{ NULL, NULL },
},
"Auto"
"4:3"
},
{
"duckstation_Display.CustomAspectRatioNumerator",
Expand Down
20 changes: 14 additions & 6 deletions src/libretro/libretro_host_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -955,12 +955,6 @@ bool LibretroHostInterface::UpdateCoreOptionsDisplay(bool controller)
option_display.key = "duckstation_CDROM.PreCacheCHD";
g_retro_environment_callback(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display);

option_display.visible = custom_aspect_ratio;
option_display.key = "duckstation_Display.CustomAspectRatioNumerator";
g_retro_environment_callback(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display);
option_display.key = "duckstation_Display.CustomAspectRatioDenominator";
g_retro_environment_callback(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display);

option_display.visible = pgxp_depth_buffer_enable;
option_display.key = "duckstation_GPU.PGXPDepthClearThreshold";
g_retro_environment_callback(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display);
Expand Down Expand Up @@ -1005,6 +999,20 @@ bool LibretroHostInterface::UpdateCoreOptionsDisplay(bool controller)
g_retro_environment_callback(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display);
}

const bool guncon_aspect = (retropad_device[0] == RETRO_DEVICE_PS_GUNCON || retropad_device[1] == RETRO_DEVICE_PS_GUNCON);
const bool show_custom_ar = (!guncon_aspect && custom_aspect_ratio);

option_display.visible = !guncon_aspect;
option_display.key = "duckstation_Display.AspectRatio";
g_retro_environment_callback(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display);

option_display.visible = show_custom_ar;
option_display.key = "duckstation_Display.CustomAspectRatioNumerator";
g_retro_environment_callback(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display);
option_display.key = "duckstation_Display.CustomAspectRatioDenominator";
g_retro_environment_callback(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display);


return true;
}
bool LibretroHostInterface::HasCoreVariablesChanged()
Expand Down

0 comments on commit 9c2ed9e

Please sign in to comment.