From 076d165154b767de93f50c00f2136db4429afa70 Mon Sep 17 00:00:00 2001 From: Hyper <34012267+hyperbx@users.noreply.github.com> Date: Sun, 12 Jan 2025 15:37:32 +0000 Subject: [PATCH] api: move Vertex struct --- UnleashedRecomp/api/SWA.inl | 9 --------- .../Sequence/Utility/SequencePlayMovieWrapper.h | 17 +++++++++++++---- UnleashedRecomp/patches/video_patches.cpp | 10 ++++++---- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/UnleashedRecomp/api/SWA.inl b/UnleashedRecomp/api/SWA.inl index 757f45bd..acffd8fc 100644 --- a/UnleashedRecomp/api/SWA.inl +++ b/UnleashedRecomp/api/SWA.inl @@ -19,12 +19,3 @@ GuestToHostFunction(*(be*)(g_memory.Translate(*(be*)(this) + (4 * virtualIndex))), __VA_ARGS__) struct swa_null_ctor {}; - -struct Vertex -{ - be X; - be Y; - be Z; - be U; - be V; -}; diff --git a/UnleashedRecomp/api/SWA/Sequence/Utility/SequencePlayMovieWrapper.h b/UnleashedRecomp/api/SWA/Sequence/Utility/SequencePlayMovieWrapper.h index b4a69830..a10d6f67 100644 --- a/UnleashedRecomp/api/SWA/Sequence/Utility/SequencePlayMovieWrapper.h +++ b/UnleashedRecomp/api/SWA/Sequence/Utility/SequencePlayMovieWrapper.h @@ -11,15 +11,24 @@ namespace SWA::Sequence::Utility class CRender : public Hedgehog::Mirage::CRenderable { public: + struct SVertexData + { + be X; + be Y; + be Z; + be U; + be V; + }; + be m_ScreenWidth; be m_ScreenHeight; be m_MovieWidth; be m_MovieHeight; SWA_INSERT_PADDING(0x74); - Vertex m_TopLeft; - Vertex m_TopRight; - Vertex m_BottomRight; - Vertex m_BottomLeft; + SVertexData m_TopLeft; + SVertexData m_TopRight; + SVertexData m_BottomRight; + SVertexData m_BottomLeft; bool m_MaintainAspectRatio; SWA_INSERT_PADDING(0x18); be m_TimeElapsed; diff --git a/UnleashedRecomp/patches/video_patches.cpp b/UnleashedRecomp/patches/video_patches.cpp index 849d31f6..04fde68a 100644 --- a/UnleashedRecomp/patches/video_patches.cpp +++ b/UnleashedRecomp/patches/video_patches.cpp @@ -2,6 +2,8 @@ #include #include +using SVertexData = SWA::Sequence::Utility::CPlayMovieWrapper::CRender::SVertexData; + // Update movie player aspect ratio. PPC_FUNC_IMPL(__imp__sub_82AE30D8); PPC_FUNC(sub_82AE30D8) @@ -11,10 +13,10 @@ PPC_FUNC(sub_82AE30D8) auto movieAspectRatio = movieWidth / movieHeight; auto windowAspectRatio = (float)GameWindow::s_width / (float)GameWindow::s_height; - auto pTopLeft = (Vertex*)g_memory.Translate(ctx.r4.u32 + 0x6C); - auto pTopRight = (Vertex*)g_memory.Translate(ctx.r4.u32 + 0x6C + sizeof(Vertex)); - auto pBottomRight = (Vertex*)g_memory.Translate(ctx.r4.u32 + 0x6C + sizeof(Vertex) * 2); - auto pBottomLeft = (Vertex*)g_memory.Translate(ctx.r4.u32 + 0x6C + sizeof(Vertex) * 3); + auto pTopLeft = (SVertexData*)g_memory.Translate(ctx.r4.u32 + 0x6C); + auto pTopRight = (SVertexData*)g_memory.Translate(ctx.r4.u32 + 0x6C + sizeof(SVertexData)); + auto pBottomRight = (SVertexData*)g_memory.Translate(ctx.r4.u32 + 0x6C + sizeof(SVertexData) * 2); + auto pBottomLeft = (SVertexData*)g_memory.Translate(ctx.r4.u32 + 0x6C + sizeof(SVertexData) * 3); auto a = -1.00078f; auto b = 1.00139f;