Add hacks to fix PCH .data causing fake mismatches with decompctx (#2606)

This commit is contained in:
Max Roncace
2025-08-30 20:57:35 -07:00
committed by GitHub
parent abf5f59f0c
commit 8c94dc8608
8 changed files with 99 additions and 7 deletions
@@ -103,6 +103,12 @@ inline u16 calcColorChanID(u16 enable, u8 matSrc, u8 lightMask, u8 diffuseFn, u8
return reg;
}
#ifdef DECOMPCTX
// Hack to mitigate fake mismatches when building from decompctx output -
// see comment in sqrtf in math.h
static u8 AttnArr[] = {2, 0, 2, 1};
#endif
/**
* @ingroup jsystem-j3d
*
@@ -138,7 +144,9 @@ struct J3DColorChan {
u8 getMatSrc() const { return (GXColorSrc)(mColorChanID & 1); }
u8 getDiffuseFn() const { return ((u32)(mColorChanID & (3 << 7)) >> 7); }
u8 getAttnFn() const {
#ifndef DECOMPCTX
u8 AttnArr[] = {2,0,2,1};
#endif
return AttnArr[(u32)(mColorChanID & (3 << 9)) >> 9];
}