From 25f725c263995aac33de82cb8726351dc44858c2 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 28 Apr 2024 15:44:41 +1000 Subject: [PATCH] GPU: Fix mask for drawing area coordinates --- src/core/gpu.h | 1 + src/core/gpu_commands.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/core/gpu.h b/src/core/gpu.h index 7f534aeb0..fd2899678 100644 --- a/src/core/gpu.h +++ b/src/core/gpu.h @@ -62,6 +62,7 @@ public: HBLANK_TIMER_INDEX = 1, MAX_RESOLUTION_SCALE = 32, DEINTERLACE_BUFFER_COUNT = 4, + DRAWING_AREA_COORD_MASK = 1023, }; enum : u16 diff --git a/src/core/gpu_commands.cpp b/src/core/gpu_commands.cpp index 9d444f598..cb0e491ad 100644 --- a/src/core/gpu_commands.cpp +++ b/src/core/gpu_commands.cpp @@ -239,8 +239,8 @@ bool GPU::HandleSetTextureWindowCommand() bool GPU::HandleSetDrawingAreaTopLeftCommand() { const u32 param = FifoPop() & 0x00FFFFFFu; - const u32 left = param & VRAM_WIDTH_MASK; - const u32 top = (param >> 10) & VRAM_HEIGHT_MASK; + const u32 left = param & DRAWING_AREA_COORD_MASK; + const u32 top = (param >> 10) & DRAWING_AREA_COORD_MASK; Log_DebugPrintf("Set drawing area top-left: (%u, %u)", left, top); if (m_drawing_area.left != left || m_drawing_area.top != top) { @@ -260,8 +260,8 @@ bool GPU::HandleSetDrawingAreaBottomRightCommand() { const u32 param = FifoPop() & 0x00FFFFFFu; - const u32 right = param & VRAM_WIDTH_MASK; - const u32 bottom = (param >> 10) & VRAM_HEIGHT_MASK; + const u32 right = param & DRAWING_AREA_COORD_MASK; + const u32 bottom = (param >> 10) & DRAWING_AREA_COORD_MASK; Log_DebugPrintf("Set drawing area bottom-right: (%u, %u)", m_drawing_area.right, m_drawing_area.bottom); if (m_drawing_area.right != right || m_drawing_area.bottom != bottom) {