From 2dfbc763b5e2a66c5fe5d9f71c31fb998987e8bb Mon Sep 17 00:00:00 2001 From: disinvite Date: Sun, 22 Dec 2024 22:15:26 -0500 Subject: [PATCH] Fix stride/length check in vtable24 and vtable28 --- LEGO1/omni/src/video/mxdisplaysurface.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/LEGO1/omni/src/video/mxdisplaysurface.cpp b/LEGO1/omni/src/video/mxdisplaysurface.cpp index 3465d5fa..d22c059b 100644 --- a/LEGO1/omni/src/video/mxdisplaysurface.cpp +++ b/LEGO1/omni/src/video/mxdisplaysurface.cpp @@ -398,7 +398,7 @@ void MxDisplaySurface::VTable0x28( MxU16* p16bitPal = m_16bitPal; MxS32 i; - if (stride || length) { + if (!stride && !length) { while (height--) { MxU8* surfaceBefore = surface; @@ -1131,8 +1131,7 @@ void MxDisplaySurface::VTable0x24( MxU16* p16bitPal = m_16bitPal; MxS32 i; - // DECOMP: branches swapped from VTable0x28 - if (stride || length) { + if (!stride && !length) { while (height--) { MxU8* surfaceBefore = surface; @@ -1146,10 +1145,7 @@ void MxDisplaySurface::VTable0x24( surface += 2; } - data += stride; - surface += length; - - memcpy(surface, surfaceBefore, p_width * 4); + memcpy(surface, surfaceBefore, copyWidth); surface += p_desc->lPitch; } } @@ -1167,7 +1163,10 @@ void MxDisplaySurface::VTable0x24( surface += 2; } - memcpy(surface, surfaceBefore, copyWidth); + data += stride; + surface += length; + + memcpy(surface, surfaceBefore, p_width * 4); surface += p_desc->lPitch; } }