mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-07-05 17:15:52 +00:00
CSkinRules: Fix ReadCount not incrementing offset properly
This commit is contained in:
parent
7010c36056
commit
487dcc4bde
@ -12,8 +12,9 @@ static u32 ReadCount(CInputStream& in) {
|
|||||||
return in.ReadLong();
|
return in.ReadLong();
|
||||||
}
|
}
|
||||||
u8 junk[784];
|
u8 junk[784];
|
||||||
for (u32 i = 0; i < (result * 3); ++i) {
|
u32 iVar2 = 0;
|
||||||
u32 iVar2 = ((result * 3) - i);
|
for (u32 i = 0; i < (result * 3); i += iVar2) {
|
||||||
|
iVar2 = ((result * 3) - i);
|
||||||
iVar2 = 192 < iVar2 ? 192 : iVar2;
|
iVar2 = 192 < iVar2 ? 192 : iVar2;
|
||||||
in.Get(junk, iVar2 * 4);
|
in.Get(junk, iVar2 * 4);
|
||||||
}
|
}
|
||||||
|
@ -325,6 +325,10 @@ bool CTexture::sMangleMips = false;
|
|||||||
u32 CTexture::sCurrentFrameCount = 0;
|
u32 CTexture::sCurrentFrameCount = 0;
|
||||||
u32 CTexture::sTotalAllocatedMemory = 0;
|
u32 CTexture::sTotalAllocatedMemory = 0;
|
||||||
|
|
||||||
|
void CTexture::InvalidateTexMap(GX::TexMapID id) {
|
||||||
|
sLoadedTextures[id] = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
CFactoryFnReturn FTextureFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms,
|
CFactoryFnReturn FTextureFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms,
|
||||||
CObjectReference* selfRef) {
|
CObjectReference* selfRef) {
|
||||||
return TToken<CTexture>::GetIObjObjectFor(std::make_unique<CTexture>(in));
|
return TToken<CTexture>::GetIObjObjectFor(std::make_unique<CTexture>(in));
|
||||||
|
@ -95,6 +95,7 @@ public:
|
|||||||
return x0_fmt == ETexelFormat::C4 || x0_fmt == ETexelFormat::C8 || x0_fmt == ETexelFormat::C14X2;
|
return x0_fmt == ETexelFormat::C4 || x0_fmt == ETexelFormat::C8 || x0_fmt == ETexelFormat::C14X2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void InvalidateTexMap(GX::TexMapID id);
|
||||||
static void SetMangleMips(bool b) { sMangleMips = b; }
|
static void SetMangleMips(bool b) { sMangleMips = b; }
|
||||||
static void SetCurrentFrameCount(u32 frameCount) { sCurrentFrameCount = frameCount; }
|
static void SetCurrentFrameCount(u32 frameCount) { sCurrentFrameCount = frameCount; }
|
||||||
};
|
};
|
||||||
|
@ -4,8 +4,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <logvisor/logvisor.hpp>
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
|
static logvisor::Module Log("metaforce::CInputStream");
|
||||||
|
|
||||||
static u32 min_containing_bytes(u32 v) {
|
static u32 min_containing_bytes(u32 v) {
|
||||||
v = 32 - v;
|
v = 32 - v;
|
||||||
v = (v >> 3) - (static_cast<s32>(-(v & 7)) >> 31);
|
v = (v >> 3) - (static_cast<s32>(-(v & 7)) >> 31);
|
||||||
@ -46,6 +49,12 @@ void CInputStream::Get(u8* dest, u32 len) {
|
|||||||
x4_blockOffset += blockLen;
|
x4_blockOffset += blockLen;
|
||||||
} else if (len > 256) {
|
} else if (len > 256) {
|
||||||
u32 readLen = Read(dest + readCount, len);
|
u32 readLen = Read(dest + readCount, len);
|
||||||
|
#ifndef NDEBUG
|
||||||
|
if (readLen == 0) {
|
||||||
|
Log.report(logvisor::Fatal, FMT_STRING("Invalid read size!"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
len -= readLen;
|
len -= readLen;
|
||||||
readCount += readLen;
|
readCount += readLen;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user