From a85eebe496b1b1afca23d8898f0c08b58e899d79 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sun, 27 Mar 2022 14:07:50 -0700 Subject: [PATCH] CMaterialList: Fix BitPosition with matching implementation CAuiImagePane: Fix animated scans... again --- Runtime/Collision/CMaterialList.hpp | 10 ++++++---- Runtime/GuiSys/CAuiImagePane.cpp | 8 ++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Runtime/Collision/CMaterialList.hpp b/Runtime/Collision/CMaterialList.hpp index 12684a67b..b2c5311c1 100644 --- a/Runtime/Collision/CMaterialList.hpp +++ b/Runtime/Collision/CMaterialList.hpp @@ -102,11 +102,13 @@ public: constexpr u64 GetValue() const noexcept { return x0_list; } - static constexpr s32 BitPosition(u64 flag) noexcept { - for (u32 i = 0; i < 64; ++i) { - if ((flag & (u64{1} << i)) != 0) { - return static_cast(i); + static constexpr s32 BitPosition(u64 flags) noexcept { + for (s32 ret = 0, i = 0; i < 32; ++i) { + if ((flags & 1) != 0u) { + return ret; } + flags >>= 1; + ++ret; } return -1; } diff --git a/Runtime/GuiSys/CAuiImagePane.cpp b/Runtime/GuiSys/CAuiImagePane.cpp index 9ade09dfb..d8c00049a 100644 --- a/Runtime/GuiSys/CAuiImagePane.cpp +++ b/Runtime/GuiSys/CAuiImagePane.cpp @@ -103,13 +103,13 @@ void CAuiImagePane::DoDrawImagePane(const zeus::CColor& color, CTexture& tex, in float rgba2 = 1.f - rgba1; tex.LoadMipLevel(mip1, GX::TexMapID::TEXMAP0, EClampMode::Repeat); tex.LoadMipLevel(mip2, GX::TexMapID::TEXMAP1, EClampMode::Repeat); - const GX::VtxDescList list[3]{ + std::array list{{ {GX::VA_POS, GX::DIRECT}, {GX::VA_TEX0, GX::DIRECT}, - {GX::VA_NULL, GX::NONE}, - }; + GX::VtxDescList{}, + }}; - CGX::SetVtxDescv(reinterpret_cast(&list)); + CGX::SetVtxDescv(list.data()); CGX::SetNumChans(0); CGX::SetNumTexGens(2); CGX::SetNumTevStages(2);