Add crop overscan option

This option fixes NTSC video output for CRT displays by cropping the 528-line EFB to standard 480i/p resolution.
This commit is contained in:
Kev authored and Eric Warmenhoven committed 2025-11-21 22:36:55 -05:00
1 parent fd1aca3af7
commit df2b1a754b
4 files changed
+45 -4

No files matched your search

@@ -563,6 +563,20 @@ static struct retro_core_option_v2_definition option_defs[] = {
},
"disabled"
},
{
Libretro::Options::gfx_settings::CROP_OVERSCAN,
"Graphics > Settings > Crop Overscan",
"Crop Overscan",
"Crop overscan to match standard NTSC output resolutions. Recommended for NTSC CRTs.",
nullptr,
CATEGORY_GFX_SETTINGS,
{
{ "disabled", nullptr },
{ "enabled", nullptr },
{ nullptr, nullptr }
},
"disabled"
},
{
Libretro::Options::gfx_settings::EFB_SCALE,
"Graphics > Settings > Internal Resolution",
@@ -182,6 +182,7 @@ namespace gfx_hardware {
namespace gfx_settings {
constexpr const char RENDERER[] = "dolphin_renderer";
constexpr const char WIDESCREEN_HACK[] = "dolphin_widescreen_hack";
constexpr const char CROP_OVERSCAN[] = "dolphin_crop_overscan";
constexpr const char EFB_SCALE[] = "dolphin_efb_scale";
constexpr const char SHADER_COMPILATION_MODE[] = "dolphin_shader_compilation_mode";
constexpr const char WAIT_FOR_SHADERS[] = "dolphin_wait_for_shaders";
+16 -1
View File
@@ -102,8 +102,15 @@ void retro_get_system_av_info(retro_system_av_info* info)
int efbScale = Libretro::Options::GetCached<int>(
Libretro::Options::gfx_settings::EFB_SCALE);
int base_height = EFB_HEIGHT;
const bool crop_overscan = Libretro::Options::GetCached<bool>(
Libretro::Options::gfx_settings::CROP_OVERSCAN);
if (crop_overscan && retro_get_region() == RETRO_REGION_NTSC)
base_height = 480;
info->geometry.base_width = EFB_WIDTH * efbScale;
info->geometry.base_height = EFB_HEIGHT * efbScale;
info->geometry.base_height = base_height * efbScale;
info->geometry.max_width = info->geometry.base_width;
info->geometry.max_height = info->geometry.base_height;
@@ -142,6 +149,14 @@ void retro_run(void)
g_Config.bWidescreenHack = Libretro::Options::GetCached<bool>(
Libretro::Options::gfx_settings::WIDESCREEN_HACK);
const bool crop_overscan = Libretro::Options::GetCached<bool>(
Libretro::Options::gfx_settings::CROP_OVERSCAN);
if (crop_overscan && retro_get_region() == RETRO_REGION_NTSC)
g_Config.bCrop = true;
else
g_Config.bCrop = false;
Libretro::Input::Update();
Core::System& system = Core::System::GetInstance();
+14 -3
View File
@@ -65,6 +65,17 @@ static Common::DynamicLibrary d3d11_library;
static Common::DynamicLibrary d3d12_library;
#endif
static int GetAdjustedBaseHeight()
{
const bool crop_overscan = Libretro::Options::GetCached<bool>(
Libretro::Options::gfx_settings::CROP_OVERSCAN);
if (crop_overscan && retro_get_region() == RETRO_REGION_NTSC)
return 480;
return EFB_HEIGHT;
}
void Init()
{
DEBUG_LOG_FMT(VIDEO, "Video - Init");
@@ -239,7 +250,7 @@ void ContextReset(void)
int efbScale = Libretro::Options::GetCached<int>(
Libretro::Options::gfx_settings::EFB_SCALE, 1);
Vk::SetSurfaceSize(EFB_WIDTH * efbScale,
EFB_HEIGHT * efbScale);
GetAdjustedBaseHeight() * efbScale);
}
#endif
@@ -296,7 +307,7 @@ void ContextReset(void)
UpdateActiveConfig();
std::unique_ptr<DX11SwapChain> swap_chain = std::make_unique<DX11SwapChain>(
wsi, EFB_WIDTH * efbScale, EFB_HEIGHT * efbScale,
wsi, EFB_WIDTH * efbScale, GetAdjustedBaseHeight() * efbScale,
nullptr, nullptr);
auto gfx = std::make_unique<DX11::Gfx>(std::move(swap_chain), wsi.render_surface_scale);
@@ -373,7 +384,7 @@ void ContextReset(void)
UpdateActiveConfig();
auto swap_chain = std::make_unique<DX12SwapChain>(
wsi, EFB_WIDTH * efbScale, EFB_HEIGHT * efbScale, d3d12);
wsi, EFB_WIDTH * efbScale, GetAdjustedBaseHeight() * efbScale, d3d12);
if (!swap_chain->Initialize())
{