diff options
| author | Max Roncace <me@caseif.net> | 2025-08-08 05:56:18 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-08 12:56:18 +0300 |
| commit | 156d2b24c36309f455e0284806ae9d2170775bdb (patch) | |
| tree | ce861916f208d60d0e75ca0f0417c06c9db377cf /src/JSystem/J3DGraphBase/J3DTexture.cpp | |
| parent | 57c9d6430818186504cd0457313a0197e0f4b84c (diff) | |
Misc. J3D improvements (#2570)
Diffstat (limited to 'src/JSystem/J3DGraphBase/J3DTexture.cpp')
| -rw-r--r-- | src/JSystem/J3DGraphBase/J3DTexture.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/JSystem/J3DGraphBase/J3DTexture.cpp b/src/JSystem/J3DGraphBase/J3DTexture.cpp index 0eb87b63e5..e4ff174899 100644 --- a/src/JSystem/J3DGraphBase/J3DTexture.cpp +++ b/src/JSystem/J3DGraphBase/J3DTexture.cpp @@ -4,10 +4,14 @@ // #include "JSystem/J3DGraphBase/J3DTexture.h" + #include "dolphin/gx.h" +#include "global.h" /* 8031204C-803121A4 30C98C 0158+00 0/0 1/1 0/0 .text loadGX__10J3DTextureCFUs11_GXTexMapID */ void J3DTexture::loadGX(u16 idx, GXTexMapID texMapID) const { + J3D_ASSERT(0, idx < mNum, "Error : range over."); + ResTIMG* timg = getResTIMG(idx); GXTexObj texObj; @@ -37,8 +41,11 @@ void J3DTexture::loadGX(u16 idx, GXTexMapID texMapID) const { /* 803121A4-8031221C 30CAE4 0078+00 1/1 0/0 0/0 .text entryNum__10J3DTextureFUs */ void J3DTexture::entryNum(u16 num) { + J3D_ASSERT(79, num != 0, "Error : non-zero argument is specified 0."); + mNum = num; mpRes = new ResTIMG[num](); + J3D_ASSERT(83, mpRes != 0, "Error : allocate memory."); for (s32 i = 0; i < mNum; i++) { mpRes[i].paletteOffset = 0; @@ -51,20 +58,18 @@ void J3DTexture::addResTIMG(u16 newNum, ResTIMG const* newRes) { if (newNum == 0) return; + J3D_ASSERT(105, newRes != 0, "Error : null pointer."); + u16 oldNum = mNum; ResTIMG* oldRes = mpRes; entryNum(mNum + newNum); for (u16 i = 0; i < oldNum; i++) { - mpRes[i] = oldRes[i]; - mpRes[i].imageOffset = (u32)(&oldRes[i]) + mpRes[i].imageOffset - (u32)(&mpRes[i]); - mpRes[i].paletteOffset = (u32)(&oldRes[i]) + mpRes[i].paletteOffset - (u32)(&mpRes[i]); + setResTIMG(i, oldRes[i]); } for (u16 i = oldNum; i < mNum; i++) { - mpRes[i] = newRes[i]; - mpRes[i].imageOffset = (u32)(&newRes[i]) + mpRes[i].imageOffset - (u32)(&mpRes[i]); - mpRes[i].paletteOffset = (u32)(&newRes[i]) + mpRes[i].paletteOffset - (u32)(&mpRes[i]); + setResTIMG(i, newRes[i]); } -}
\ No newline at end of file +} |
