From cf5dd6289e5f4a805131aca4b57acb6c5d66adc8 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 18 Jul 2020 13:09:21 +0300 Subject: Fix TempVertexBuffer overflow --- src/render/RenderBuffer.cpp | 4 ++-- src/render/RenderBuffer.h | 4 ++-- src/render/Sprite2d.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/render') diff --git a/src/render/RenderBuffer.cpp b/src/render/RenderBuffer.cpp index 5239dc06..b4f48a26 100644 --- a/src/render/RenderBuffer.cpp +++ b/src/render/RenderBuffer.cpp @@ -5,8 +5,8 @@ int32 TempBufferVerticesStored; int32 TempBufferIndicesStored; -RwIm2DVertex TempVertexBuffer[TEMPBUFFERVERTSIZE]; -RwIm3DVertex *TempBufferRenderVertices = (RwIm3DVertex * )TempVertexBuffer; +RwIm3DVertex TempBufferRenderVertices[TEMPBUFFERVERTSIZE]; +RwIm2DVertex *TempVertexBuffer = (RwIm2DVertex*)TempBufferRenderVertices; RwImVertexIndex TempBufferRenderIndexList[TEMPBUFFERINDEXSIZE]; int RenderBuffer::VerticesToBeStored; diff --git a/src/render/RenderBuffer.h b/src/render/RenderBuffer.h index e67a28d0..0789dfa5 100644 --- a/src/render/RenderBuffer.h +++ b/src/render/RenderBuffer.h @@ -14,6 +14,6 @@ public: extern int32 TempBufferVerticesStored; extern int32 TempBufferIndicesStored; -extern RwIm2DVertex TempVertexBuffer[TEMPBUFFERVERTSIZE]; -extern RwIm3DVertex *TempBufferRenderVertices; +extern RwIm2DVertex *TempVertexBuffer; +extern RwIm3DVertex TempBufferRenderVertices[TEMPBUFFERVERTSIZE]; extern RwImVertexIndex TempBufferRenderIndexList[TEMPBUFFERINDEXSIZE]; \ No newline at end of file diff --git a/src/render/Sprite2d.cpp b/src/render/Sprite2d.cpp index bf39d15e..5f1e79db 100644 --- a/src/render/Sprite2d.cpp +++ b/src/render/Sprite2d.cpp @@ -449,7 +449,7 @@ CSprite2d::AddToBuffer(const CRect &r, const CRGBA &c, float u0, float v0, float bool CSprite2d::IsVertexBufferFull() { - return (nextBufferVertex > ARRAY_SIZE(TempVertexBuffer)-128-4 || nextBufferIndex > ARRAY_SIZE(TempBufferRenderIndexList)-6); + return (nextBufferVertex > TEMPBUFFERINDEXSIZE-128-4 || nextBufferIndex > ARRAY_SIZE(TempBufferRenderIndexList)-6); } void -- cgit v1.2.3