From c42ab459d51974e9f4e494b5808df531f6ec2653 Mon Sep 17 00:00:00 2001 From: Rupert Carmichael <5050061-carmiker@users.noreply.gitlab.com> Date: Sat, 3 Aug 2024 21:59:34 -0400 Subject: [PATCH] libretro: Handle horizontal/vertical multipliers separately in video output code --- bsnes/target-libretro/program.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bsnes/target-libretro/program.cpp b/bsnes/target-libretro/program.cpp index 58544ea15..dc9b4fe0b 100644 --- a/bsnes/target-libretro/program.cpp +++ b/bsnes/target-libretro/program.cpp @@ -336,18 +336,19 @@ auto Program::load(uint id, string name, string type, vector options) -> } auto Program::videoFrame(const uint16* data, uint pitch, uint width, uint height, uint scale) -> void { - uint multiplier = height / 240; + uint hmult = width / 256; + uint vmult = height / 240; if (sgb_border_disabled && program->gameBoy.program) { // Clean up these magic numbers one day: GB width/height is 160/144. - // GB content starts 47 lines from the top and 48 colums from the left - data += (47 * (pitch >> 1) + 48) * multiplier; - width = 160 * multiplier; - height = 144 * multiplier; + // GB content starts 47 lines from the top and 48 columns from the left + data += (47 * (pitch >> 1) + (48 * hmult)) * vmult; + width = 160 * hmult; + height = 144 * vmult; } else if (overscan) { - data += overscan * (pitch >> 1) * multiplier; - height -= (overscan << 1) * multiplier; + data += overscan * (pitch >> 1) * vmult; + height -= (overscan << 1) * vmult; } uint filterWidth = width, filterHeight = height;