From 65c016d1542e4f744d2ecdd1e6c7fc7465e8e70d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 4 Sep 2022 00:41:52 +0200 Subject: [PATCH] Fix dialog rendering (PPGe). Fixes #15954 Was caused by 867eb99 , part of #15950 . --- Core/MemMap.h | 5 +++++ Core/Util/PPGeDraw.cpp | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Core/MemMap.h b/Core/MemMap.h index 0e8863b090..b123af4f3a 100644 --- a/Core/MemMap.h +++ b/Core/MemMap.h @@ -467,6 +467,11 @@ struct PSPPointer PSPPointerNotifyRW(2, (uint32_t)ptr, (uint32_t)sizeof(T), tag, tagLen - 1); } + size_t ElementSize() const + { + return sizeof(T); + } + static PSPPointer Create(u32 ptr) { PSPPointer p; p = ptr; diff --git a/Core/Util/PPGeDraw.cpp b/Core/Util/PPGeDraw.cpp index 2b83bb4ccd..13fd62a22f 100644 --- a/Core/Util/PPGeDraw.cpp +++ b/Core/Util/PPGeDraw.cpp @@ -182,13 +182,13 @@ static void Vertex(float x, float y, float u, float v, int tw, int th, u32 color vtx->x = x; vtx->y = y; vtx->z = 0; vtx->u = u * tw; vtx->v = v * th; vtx->color = color; - dataWritePtr += sizeof(vtx); + dataWritePtr += (u32)vtx.ElementSize(); } else { auto vtx = PSPPointer::Create(dataWritePtr); vtx->x = x; vtx->y = y; vtx->z = 0; vtx->u = u * tw; vtx->v = v * th; vtx->color = color; - dataWritePtr += sizeof(vtx); + dataWritePtr += (u32)vtx.ElementSize(); } _dbg_assert_(dataWritePtr <= dataPtr + dataSize); vertexCount++;