From 33dc54d864f89b6d5b144e4ac68957458d058f75 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Tue, 7 Apr 2026 21:47:52 +0200 Subject: [PATCH] Add 3D screen size setting --- rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp | 12 ++---------- rpcs3/Emu/system_config.h | 1 + rpcs3/rpcs3qt/emu_settings_type.h | 2 ++ rpcs3/rpcs3qt/settings_dialog.cpp | 2 ++ rpcs3/rpcs3qt/settings_dialog.ui | 12 ++++++++++++ 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp b/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp index 4851895537..f57e51d2da 100644 --- a/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp +++ b/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp @@ -524,19 +524,11 @@ error_code cellVideoOutGetScreenSize(u32 videoOut, vm::ptr screenSize) { // Return Playstation 3D display value // Some games call this function when 3D is enabled - *screenSize = 24.f; + *screenSize = static_cast(g_cfg.video.screen_size.get()); return CELL_OK; } - // TODO: Use virtual screen size -#ifdef _WIN32 - // HDC screen = GetDC(NULL); - // float diagonal = roundf(sqrtf((powf(float(GetDeviceCaps(screen, HORZSIZE)), 2) + powf(float(GetDeviceCaps(screen, VERTSIZE)), 2))) * 0.0393f); -#else - // TODO: Linux implementation, without using wx - // float diagonal = roundf(sqrtf((powf(wxGetDisplaySizeMM().GetWidth(), 2) + powf(wxGetDisplaySizeMM().GetHeight(), 2))) * 0.0393f); -#endif - + // Let's just return not set for now return CELL_VIDEO_OUT_ERROR_VALUE_IS_NOT_SET; } diff --git a/rpcs3/Emu/system_config.h b/rpcs3/Emu/system_config.h index 9dbaa0c723..f00a0a5b33 100644 --- a/rpcs3/Emu/system_config.h +++ b/rpcs3/Emu/system_config.h @@ -157,6 +157,7 @@ struct cfg_root : cfg::node cfg::_bool force_hw_MSAA_resolve{ this, "Force Hardware MSAA Resolve", false, true }; cfg::_bool stereo_enabled{ this, "3D Display Enabled", false }; cfg::_enum stereo_render_mode{ this, "3D Display Mode", stereo_render_mode_options::disabled, true }; + cfg::_int<10, 99> screen_size{ this, "Screen size in inches", 24, false }; cfg::_bool debug_program_analyser{ this, "Debug Program Analyser", false }; cfg::_bool precise_zpass_count{ this, "Accurate ZCULL stats", true }; cfg::_int<1, 8> consecutive_frames_to_draw{ this, "Consecutive Frames To Draw", 1, true}; diff --git a/rpcs3/rpcs3qt/emu_settings_type.h b/rpcs3/rpcs3qt/emu_settings_type.h index db3e3556da..7d35a72a2d 100644 --- a/rpcs3/rpcs3qt/emu_settings_type.h +++ b/rpcs3/rpcs3qt/emu_settings_type.h @@ -82,6 +82,7 @@ enum class emu_settings_type ShaderPrecisionQuality, StereoRenderEnabled, StereoRenderMode, + ScreenSize, AnisotropicFilterOverride, TextureLodBias, ResolutionScale, @@ -295,6 +296,7 @@ inline static const std::map settings_location { emu_settings_type::DisableFIFOReordering, { "Video", "Disable FIFO Reordering"}}, { emu_settings_type::StereoRenderEnabled, { "Video", "3D Display Enabled"}}, { emu_settings_type::StereoRenderMode, { "Video", "3D Display Mode"}}, + { emu_settings_type::ScreenSize, { "Video", "Screen size in inches"}}, { emu_settings_type::StrictTextureFlushing, { "Video", "Strict Texture Flushing"}}, { emu_settings_type::ForceCPUBlitEmulation, { "Video", "Force CPU Blit"}}, { emu_settings_type::DisableOnDiskShaderCache, { "Video", "Disable On-Disk Shader Cache"}}, diff --git a/rpcs3/rpcs3qt/settings_dialog.cpp b/rpcs3/rpcs3qt/settings_dialog.cpp index 7e7f115d22..572a16bf7f 100644 --- a/rpcs3/rpcs3qt/settings_dialog.cpp +++ b/rpcs3/rpcs3qt/settings_dialog.cpp @@ -581,6 +581,7 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std // 3D m_emu_settings->EnhanceComboBox(ui->stereoRenderMode, emu_settings_type::StereoRenderMode); m_emu_settings->EnhanceCheckBox(ui->stereoRenderEnabled, emu_settings_type::StereoRenderEnabled); + m_emu_settings->EnhanceSpinBox(ui->sb_screen_size, emu_settings_type::ScreenSize); SubscribeTooltip(ui->gb_stereo, tooltips.settings.stereo_render_mode); if (game) { @@ -591,6 +592,7 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std const bool stereo_enabled = ui->stereoRenderEnabled->checkState() == Qt::CheckState::Checked; ui->stereoRenderMode->setEnabled(stereo_allowed && stereo_enabled); ui->stereoRenderEnabled->setEnabled(stereo_allowed); + ui->gb_screen_size->setEnabled(stereo_allowed && stereo_enabled); }; connect(ui->resBox, &QComboBox::currentIndexChanged, this, [enable_3D_modes](int){ enable_3D_modes(); }); connect(ui->stereoRenderEnabled, &QCheckBox::checkStateChanged, this, [enable_3D_modes](Qt::CheckState){ enable_3D_modes(); }); diff --git a/rpcs3/rpcs3qt/settings_dialog.ui b/rpcs3/rpcs3qt/settings_dialog.ui index d3b98a2608..a2da00a28c 100644 --- a/rpcs3/rpcs3qt/settings_dialog.ui +++ b/rpcs3/rpcs3qt/settings_dialog.ui @@ -557,6 +557,18 @@ + + + + Screen Size (Inch) + + + + + + + +