From 5cab9282e7a7f1407cde18b6e5d1630f3c156042 Mon Sep 17 00:00:00 2001 From: Rosalie Wanders Date: Sun, 18 May 2025 19:16:18 +0200 Subject: [PATCH] 3rdParty: allow cropping each side separately in mupen64plus-video-parallel --- .../mupen64plus-video-parallel/.gitrepo | 4 +- .../UserInterface/MainDialog.cpp | 32 ++++++--- .../UserInterface/MainDialog.ui | 68 +++++++++++++------ .../mupen64plus-video-parallel/gfx_m64p.cpp | 12 +++- .../mupen64plus-video-parallel/gfx_m64p.h | 6 +- .../parallel_imp.cpp | 16 +++-- .../mupen64plus-video-parallel/parallel_imp.h | 10 ++- 7 files changed, 104 insertions(+), 44 deletions(-) diff --git a/Source/3rdParty/mupen64plus-video-parallel/.gitrepo b/Source/3rdParty/mupen64plus-video-parallel/.gitrepo index 933eec0a..9d353c32 100644 --- a/Source/3rdParty/mupen64plus-video-parallel/.gitrepo +++ b/Source/3rdParty/mupen64plus-video-parallel/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = git@github.com:/Rosalie241/parallel-rdp-standalone.git branch = RMG - commit = 74a9badf728fcb6a01ceb2ca9668aae5d1f1157c - parent = cb2948ec7404a7ee91e08fd5c3acb65c41629856 + commit = 7d1281997ff5a03378c9dd51fefb164cdb4e7877 + parent = fddf5eb4a7e99767c4095b34f542098670cdc78b method = merge cmdver = 0.4.6 diff --git a/Source/3rdParty/mupen64plus-video-parallel/UserInterface/MainDialog.cpp b/Source/3rdParty/mupen64plus-video-parallel/UserInterface/MainDialog.cpp index f8b2333b..e15fc6dc 100644 --- a/Source/3rdParty/mupen64plus-video-parallel/UserInterface/MainDialog.cpp +++ b/Source/3rdParty/mupen64plus-video-parallel/UserInterface/MainDialog.cpp @@ -61,17 +61,15 @@ MainDialog::MainDialog(QWidget* parent) : QDialog(parent) } this->resolutionUpscaleComboBox->setCurrentIndex(comboBoxIndex); - // set deinterlacer combobox this->deinterlacerComboBox->setCurrentIndex(ConfigGetParamBool(configVideoParallel, KEY_DEINTERLACE) ? 1 : 0); - - // set downscaling combobox this->downscalerComboBox->setCurrentIndex(ConfigGetParamInt(configVideoParallel, KEY_DOWNSCALE)); - - // set cropOverscan combobox - this->cropOverscanSpinBox->setValue(ConfigGetParamInt(configVideoParallel, KEY_OVERSCANCROP)); - - // set verticalStretch combobox this->verticalStretchSpinBox->setValue(ConfigGetParamInt(configVideoParallel, KEY_VERTICAL_STRETCH)); + + this->overscanGroupBox->setChecked(ConfigGetParamBool(configVideoParallel, KEY_OVERSCANCROPENABLE)); + this->overscanLeftSpinBox->setValue(ConfigGetParamInt(configVideoParallel, KEY_OVERSCANCROPLEFT)); + this->overscanRightSpinBox->setValue(ConfigGetParamInt(configVideoParallel, KEY_OVERSCANCROPRIGHT)); + this->overscanTopSpinBox->setValue(ConfigGetParamInt(configVideoParallel, KEY_OVERSCANCROPTOP)); + this->overscanBottomSpinBox->setValue(ConfigGetParamInt(configVideoParallel, KEY_OVERSCANCROPBOTTOM)); this->superSampledDitherCheckBox->setChecked(ConfigGetParamBool(configVideoParallel, KEY_SSDITHER)); this->viAaCheckBox->setChecked(ConfigGetParamBool(configVideoParallel, KEY_AA)); @@ -127,8 +125,16 @@ void MainDialog::on_buttonBox_clicked(QAbstractButton* button) ConfigSetParameter(configVideoParallel, KEY_DOWNSCALE, M64TYPE_INT, &downscalingValue); // cropOverscan - int cropOverscanValue = this->cropOverscanSpinBox->value(); - ConfigSetParameter(configVideoParallel, KEY_OVERSCANCROP, M64TYPE_INT, &cropOverscanValue); + int overscanEnabled = this->overscanGroupBox->isChecked(); + int overscanLeft = this->overscanLeftSpinBox->value(); + int overscanRight = this->overscanRightSpinBox->value(); + int overscanTop = this->overscanTopSpinBox->value(); + int overscanBottom = this->overscanBottomSpinBox->value(); + ConfigSetParameter(configVideoParallel, KEY_OVERSCANCROPENABLE, M64TYPE_BOOL, &overscanEnabled); + ConfigSetParameter(configVideoParallel, KEY_OVERSCANCROPLEFT, M64TYPE_INT, &overscanLeft); + ConfigSetParameter(configVideoParallel, KEY_OVERSCANCROPRIGHT, M64TYPE_INT, &overscanRight); + ConfigSetParameter(configVideoParallel, KEY_OVERSCANCROPTOP, M64TYPE_INT, &overscanTop); + ConfigSetParameter(configVideoParallel, KEY_OVERSCANCROPBOTTOM, M64TYPE_INT, &overscanBottom); // verticalStretch int verticalStretchValue = this->verticalStretchSpinBox->value(); @@ -167,8 +173,12 @@ void MainDialog::on_buttonBox_clicked(QAbstractButton* button) this->resolutionUpscaleComboBox->setCurrentText("None"); this->deinterlacerComboBox->setCurrentIndex(0); this->downscalerComboBox->setCurrentIndex(0); - this->cropOverscanSpinBox->setValue(0); this->verticalStretchSpinBox->setValue(0); + this->overscanGroupBox->setChecked(false); + this->overscanLeftSpinBox->setValue(0); + this->overscanRightSpinBox->setValue(0); + this->overscanTopSpinBox->setValue(0); + this->overscanBottomSpinBox->setValue(0); this->superSampledDitherCheckBox->setChecked(true); this->viAaCheckBox->setChecked(true); diff --git a/Source/3rdParty/mupen64plus-video-parallel/UserInterface/MainDialog.ui b/Source/3rdParty/mupen64plus-video-parallel/UserInterface/MainDialog.ui index a47c79cd..7c44859e 100644 --- a/Source/3rdParty/mupen64plus-video-parallel/UserInterface/MainDialog.ui +++ b/Source/3rdParty/mupen64plus-video-parallel/UserInterface/MainDialog.ui @@ -201,27 +201,6 @@ - - - - 0 - - - - - Crop overscan - - - - - - - px - - - - - @@ -358,6 +337,53 @@ + + + + Overscan + + + true + + + false + + + + + + -99 + + + + + + + -99 + + + + + + + -99 + + + + + + + -99 + + + + + overscanBottomSpinBox + overscanRightSpinBox + overscanLeftSpinBox + overscanTopSpinBox + + diff --git a/Source/3rdParty/mupen64plus-video-parallel/gfx_m64p.cpp b/Source/3rdParty/mupen64plus-video-parallel/gfx_m64p.cpp index bfa88807..4d47ca66 100644 --- a/Source/3rdParty/mupen64plus-video-parallel/gfx_m64p.cpp +++ b/Source/3rdParty/mupen64plus-video-parallel/gfx_m64p.cpp @@ -181,7 +181,11 @@ EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle _CoreLibHandle, void *Co ConfigSetDefaultBool(configVideoParallel, KEY_DEINTERLACE, 0, "Deinterlacing method. False=Bob, True=Weave"); ConfigSetDefaultBool(configVideoParallel, KEY_SSREADBACKS, 0, "Enable superscaling of readbacks when upsampling"); ConfigSetDefaultBool(configVideoParallel, KEY_SSDITHER, 1, "Enable superscaling of dithering when upsampling"); - ConfigSetDefaultInt(configVideoParallel, KEY_OVERSCANCROP, 0, "Amount of overscan pixels to crop on all sides"); + ConfigSetDefaultInt(configVideoParallel, KEY_OVERSCANCROPLEFT, 0, "Amount of overscan pixels to crop on the left side"); + ConfigSetDefaultInt(configVideoParallel, KEY_OVERSCANCROPRIGHT, 0, "Amount of overscan pixels to crop on the right side"); + ConfigSetDefaultInt(configVideoParallel, KEY_OVERSCANCROPTOP, 0, "Amount of overscan pixels to crop on the top side"); + ConfigSetDefaultInt(configVideoParallel, KEY_OVERSCANCROPBOTTOM, 0, "Amount of overscan pixels to crop on the bottom side"); + ConfigSetDefaultBool(configVideoParallel, KEY_OVERSCANCROPENABLE, 0, "Whether to enable overscan"); ConfigSetDefaultInt(configVideoParallel, KEY_VERTICAL_STRETCH, 0, "Amount of pixels to stretch by vertically. Can fix PAL ports that didn't fill the PAL resolution of 288p (use value of 24 in that case)."); ConfigSetDefaultBool(configVideoParallel, KEY_AA, 1, "VI anti-aliasing, smooths polygon edges."); ConfigSetDefaultBool(configVideoParallel, KEY_DIVOT, 1, "Allow VI divot filter, cleans up stray black pixels."); @@ -307,7 +311,11 @@ EXPORT int CALL RomOpen(void) vk_native_tex_rect = ConfigGetParamBool(configVideoParallel, KEY_NATIVETEXTRECT); vk_interlacing = ConfigGetParamBool(configVideoParallel, KEY_DEINTERLACE); vk_downscaling_steps = ConfigGetParamInt(configVideoParallel, KEY_DOWNSCALE); - vk_overscan = ConfigGetParamInt(configVideoParallel, KEY_OVERSCANCROP); + vk_overscan_left = ConfigGetParamInt(configVideoParallel, KEY_OVERSCANCROPLEFT); + vk_overscan_right = ConfigGetParamInt(configVideoParallel, KEY_OVERSCANCROPRIGHT); + vk_overscan_top = ConfigGetParamInt(configVideoParallel, KEY_OVERSCANCROPTOP); + vk_overscan_bottom = ConfigGetParamInt(configVideoParallel, KEY_OVERSCANCROPBOTTOM); + vk_overscan_enable = ConfigGetParamBool(configVideoParallel, KEY_OVERSCANCROPENABLE); vk_vertical_stretch = ConfigGetParamInt(configVideoParallel, KEY_VERTICAL_STRETCH); m64p_error netplay_init = ConfigReceiveNetplayConfig(NULL, 0); diff --git a/Source/3rdParty/mupen64plus-video-parallel/gfx_m64p.h b/Source/3rdParty/mupen64plus-video-parallel/gfx_m64p.h index c72ddf5e..057ab744 100644 --- a/Source/3rdParty/mupen64plus-video-parallel/gfx_m64p.h +++ b/Source/3rdParty/mupen64plus-video-parallel/gfx_m64p.h @@ -35,7 +35,11 @@ extern ptr_ConfigSetParameter ConfigSetParameter; #define KEY_WIDESCREEN "WidescreenStretch" #define KEY_SSDITHER "SuperscaledDither" #define KEY_SSREADBACKS "SuperscaledReads" -#define KEY_OVERSCANCROP "CropOverscan" +#define KEY_OVERSCANCROPLEFT "CropOverscanLeft" +#define KEY_OVERSCANCROPRIGHT "CropOverscanRight" +#define KEY_OVERSCANCROPTOP "CropOverscanTop" +#define KEY_OVERSCANCROPBOTTOM "CropOverscanBottom" +#define KEY_OVERSCANCROPENABLE "CropOverscanEnable" #define KEY_VERTICAL_STRETCH "VerticalStretch" #define KEY_DIVOT "Divot" #define KEY_GAMMADITHER "GammaDither" diff --git a/Source/3rdParty/mupen64plus-video-parallel/parallel_imp.cpp b/Source/3rdParty/mupen64plus-video-parallel/parallel_imp.cpp index daa0d09f..6a78873d 100644 --- a/Source/3rdParty/mupen64plus-video-parallel/parallel_imp.cpp +++ b/Source/3rdParty/mupen64plus-video-parallel/parallel_imp.cpp @@ -19,9 +19,13 @@ static std::unique_ptr wsi_platform; int32_t vk_rescaling; bool vk_ssreadbacks; bool vk_ssdither; -unsigned vk_overscan; -unsigned vk_vertical_stretch; -unsigned vk_downscaling_steps; +uint32_t vk_overscan_left; +uint32_t vk_overscan_right; +uint32_t vk_overscan_top; +uint32_t vk_overscan_bottom; +bool vk_overscan_enable; +uint32_t vk_vertical_stretch; +uint32_t vk_downscaling_steps; bool vk_native_texture_lod; bool vk_native_tex_rect; bool vk_divot_filter, vk_gamma_dither; @@ -180,7 +184,11 @@ static void render_frame(Vulkan::Device &device) opts.blend_previous_frame = vk_interlacing; opts.upscale_deinterlacing = !vk_interlacing; opts.downscale_steps = vk_downscaling_steps; - opts.crop_overscan_pixels = vk_overscan; + opts.crop_rect.left = vk_overscan_left; + opts.crop_rect.right = vk_overscan_right; + opts.crop_rect.top = vk_overscan_top; + opts.crop_rect.bottom = vk_overscan_bottom; + opts.crop_rect.enable = vk_overscan_enable; if (vk_vertical_stretch) { opts.crop_rect.top = vk_vertical_stretch; opts.crop_rect.bottom = vk_vertical_stretch; diff --git a/Source/3rdParty/mupen64plus-video-parallel/parallel_imp.h b/Source/3rdParty/mupen64plus-video-parallel/parallel_imp.h index 1618ee94..3a5d6991 100644 --- a/Source/3rdParty/mupen64plus-video-parallel/parallel_imp.h +++ b/Source/3rdParty/mupen64plus-video-parallel/parallel_imp.h @@ -13,9 +13,13 @@ extern "C" extern bool vk_ssreadbacks; extern bool vk_ssdither; - extern unsigned vk_overscan; - extern unsigned vk_vertical_stretch; - extern unsigned vk_downscaling_steps; + extern uint32_t vk_overscan_left; + extern uint32_t vk_overscan_right; + extern uint32_t vk_overscan_top; + extern uint32_t vk_overscan_bottom; + extern bool vk_overscan_enable; + extern uint32_t vk_vertical_stretch; + extern uint32_t vk_downscaling_steps; extern bool vk_native_texture_lod; extern bool vk_native_tex_rect; extern bool vk_divot_filter, vk_gamma_dither;