TObj mostly matched, GXSetTexCoordGen2 match, and various GX type cleanup/additions (#1184)

* Match TObjSetupMtx

* Match GXSetTexCoordGen2

* Match HSD_TexCoordID2TexGenSrc

* Attempted match on HSD_TObjSetupTextureCoordGen

* Match HSD_TObjSetupVolatileTev

* Match MakeColorGenTExp

* Match most of TObj, add partial matches for TObjSetupTextureCoordGen, TObjSetup

* Match TObjMakeTExp

* Match TObjInfoInit

* Fixup .data matching

* Cleanup GXTexture params and mark function as static in TObj

* Fixup type to match HSD_TObjSetup

* More type cleanup in TObj

* Fixup define usage

* Address most issues

* Remove warnings for tautological comparisons
This commit is contained in:
Will 2024-02-02 13:27:22 -05:00 committed by GitHub
parent 515bb53b6d
commit 028fb72db7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 1502 additions and 111 deletions

View File

@ -42,7 +42,7 @@
/* 0000006C 000000AC 48 00 00 01 */ bl memset
/* 00000070 000000B0 48 00 00 01 */ bl HSD_CObjAlloc
/* 00000074 000000B4 90 7D 00 04 */ stw r3, 0x4(r29)
/* 00000078 000000B8 48 00 00 01 */ bl allocShadowTObj
/* 00000078 000000B8 48 00 00 01 */ bl HSD_TObjAlloc
/* 0000007C 000000BC 3B C3 00 00 */ addi r30, r3, 0x0
/* 00000080 000000C0 3B E0 00 00 */ li r31, 0x0
/* 00000084 000000C4 93 E3 00 10 */ stw r31, 0x10(r3)

View File

@ -80,7 +80,7 @@
/* 000000EC 0000012C 54 1D 10 3A */ slwi r29, r0, 2
/* 000000F0 00000130 48 00 00 0C */ b .L_000000FC
.L_000000F4:
/* 000000F4 00000134 48 00 00 01 */ bl HSD_TlutFree
/* 000000F4 00000134 48 00 00 01 */ bl HSD_TlutRemove
/* 000000F8 00000138 3B BD 00 04 */ addi r29, r29, 0x4
.L_000000FC:
/* 000000FC 0000013C 80 9F 00 6C */ lwz r4, 0x6c(r31)
@ -609,7 +609,7 @@
/* 000007F4 00000834 28 03 00 00 */ cmplwi r3, 0x0
/* 000007F8 00000838 40 82 00 10 */ bne .L_00000808
.L_000007FC:
/* 000007FC 0000083C 48 00 00 01 */ bl allocShadowTObj
/* 000007FC 0000083C 48 00 00 01 */ bl HSD_TObjAlloc
/* 00000800 00000840 7C 7F 1B 78 */ mr r31, r3
/* 00000804 00000844 48 00 00 20 */ b .L_00000824
.L_00000808:
@ -3305,7 +3305,7 @@
/* 00002C28 00002C68 4E 80 00 20 */ blr
.endfn HSD_TObjGetNext
.fn allocShadowTObj, global
.fn HSD_TObjAlloc, global
/* 00002C2C 00002C6C 7C 08 02 A6 */ mflr r0
/* 00002C30 00002C70 90 01 00 04 */ stw r0, 0x4(r1)
/* 00002C34 00002C74 94 21 FF F0 */ stwu r1, -0x10(r1)
@ -3332,7 +3332,7 @@
/* 00002C7C 00002CBC 38 21 00 10 */ addi r1, r1, 0x10
/* 00002C80 00002CC0 7C 08 03 A6 */ mtlr r0
/* 00002C84 00002CC4 4E 80 00 20 */ blr
.endfn allocShadowTObj
.endfn HSD_TObjAlloc
.fn HSD_TObjFree, global
/* 00002C88 00002CC8 7C 08 02 A6 */ mflr r0
@ -3377,7 +3377,7 @@
/* 00002D10 00002D50 4E 80 00 20 */ blr
.endfn HSD_TlutAlloc
.fn HSD_TlutFree, global
.fn HSD_TlutRemove, global
/* 00002D14 00002D54 7C 08 02 A6 */ mflr r0
/* 00002D18 00002D58 28 03 00 00 */ cmplwi r3, 0x0
/* 00002D1C 00002D5C 90 01 00 04 */ stw r0, 0x4(r1)
@ -3390,7 +3390,7 @@
/* 00002D34 00002D74 38 21 00 08 */ addi r1, r1, 0x8
/* 00002D38 00002D78 7C 08 03 A6 */ mtlr r0
/* 00002D3C 00002D7C 4E 80 00 20 */ blr
.endfn HSD_TlutFree
.endfn HSD_TlutRemove
.fn HSD_TObjTevAlloc, global
/* 00002D40 00002D80 7C 08 02 A6 */ mflr r0

View File

@ -26,6 +26,7 @@
-Wno-missing-braces
-Wno-missing-field-initializers
-Wno-switch
-Wno-tautological-compare
-Wno-tautological-bitwise-compare
-Wno-undefined-internal
-Wno-unknown-pragmas

View File

@ -19211,10 +19211,10 @@ HSD_Index2TexMap = .text:0x80360FE0; // type:function size:0x90 scope:global
HSD_TexMap2Index = .text:0x80361070; // type:function size:0x90 scope:local
HSD_TObjRemoveAll = .text:0x80361100; // type:function size:0x74 scope:global
HSD_TObjGetNext = .text:0x80361174; // type:function size:0x18 scope:global
allocShadowTObj = .text:0x8036118C; // type:function size:0x5C scope:global
HSD_TObjAlloc = .text:0x8036118C; // type:function size:0x5C scope:global
HSD_TObjFree = .text:0x803611E8; // type:function size:0x34 scope:global
HSD_TlutAlloc = .text:0x8036121C; // type:function size:0x58 scope:global
HSD_TlutFree = .text:0x80361274; // type:function size:0x2C scope:global
HSD_TlutRemove = .text:0x80361274; // type:function size:0x2C scope:global
HSD_TObjTevAlloc = .text:0x803612A0; // type:function size:0x58 scope:global
HSD_ImageDescAlloc = .text:0x803612F8; // type:function size:0x58 scope:global
HSD_ImageDescFree = .text:0x80361350; // type:function size:0x24 scope:global

View File

@ -6,6 +6,7 @@
#include <dolphin/gx/__types.h>
#include <dolphin/gx/GXAttr.h>
#include <dolphin/gx/GXEnum.h>
#include <dolphin/gx/GXTransform.h>
// https://decomp.me/scratch/d4i4k // 95 (98.90%)
void __GXXfVtxSpecs(void)
@ -374,11 +375,133 @@ void GXInvalidateVtxCache(void)
WGPIPE.u8 = GX_CMD_INVL_VC;
}
// https://decomp.me/scratch/9TphI // 640 (96.44%)
void GXSetTexCoordGen2(u32 arg0, s32 arg1, u32 arg2, s32 arg3, s32 arg4,
s32 arg5)
void GXSetTexCoordGen2(GXTexCoordID arg0, GXTexGenType arg1, GXTexGenSrc arg2,
u32 arg3, GXBool arg4, u32 arg5)
{
NOT_IMPLEMENTED;
s32 var_r0;
s32 var_r10;
s32 var_r11;
s32 var_r12;
var_r11 = 0;
var_r12 = 0;
var_r10 = 5;
switch (arg2) {
case GX_TG_POS:
var_r10 = 0;
var_r12 = 1;
break;
case GX_TG_NRM:
var_r10 = 1;
var_r12 = 1;
break;
case GX_TG_BINRM:
var_r10 = 3;
var_r12 = 1;
break;
case GX_TG_TANGENT:
var_r10 = 4;
var_r12 = 1;
break;
case GX_TG_COLOR0:
var_r10 = 2;
break;
case GX_TG_COLOR1:
var_r10 = 2;
break;
case GX_TG_TEX0:
var_r10 = 5;
break;
case GX_TG_TEX1:
var_r10 = 6;
break;
case GX_TG_TEX2:
var_r10 = 7;
break;
case GX_TG_TEX3:
var_r10 = 8;
break;
case GX_TG_TEX4:
var_r10 = 9;
break;
case GX_TG_TEX5:
var_r10 = 0xA;
break;
case GX_TG_TEX6:
var_r10 = 0xB;
break;
case GX_TG_TEX7:
var_r10 = 0xC;
break;
}
switch (arg1) {
case GX_TG_MTX2x4:
var_r11 = var_r12 * 4;
INSERT_FIELD(var_r11, var_r10 << 3, 8, 4);
break;
case GX_TG_MTX3x4:
var_r11 = var_r12 * 4 | 2;
INSERT_FIELD(var_r11, var_r10 << 3, 8, 4);
break;
case GX_TG_BUMP0:
case GX_TG_BUMP1:
case GX_TG_BUMP2:
case GX_TG_BUMP3:
case GX_TG_BUMP4:
case GX_TG_BUMP5:
case GX_TG_BUMP6:
case GX_TG_BUMP7:
var_r11 = var_r12 * 4;
INSERT_FIELD(var_r11, 1, 3, 4);
INSERT_FIELD(var_r11, var_r10, 5, 7);
INSERT_FIELD(var_r11, arg2 - 12, 3, 12);
INSERT_FIELD(var_r11, arg1 - 2, 3, 15);
break;
case GX_TG_SRTG:
var_r11 = var_r12 * 4;
if (arg2 == 0x13) {
INSERT_FIELD(var_r11, 2, 3, 4);
} else {
INSERT_FIELD(var_r11, 3, 3, 4);
}
INSERT_FIELD(var_r11, 2, 5, 7);
break;
}
WGPIPE.u8 = GX_LOAD_XF_REG;
WGPIPE.u32 = arg0 + 0x1040;
WGPIPE.u32 = var_r11;
WGPIPE.u8 = GX_LOAD_XF_REG;
arg5 -= 0x40;
INSERT_FIELD(arg5, arg4, 1, 8);
WGPIPE.u32 = arg0 + 0x1050;
WGPIPE.u32 = arg5;
switch (arg0) {
case GX_TEXCOORD0:
INSERT_FIELD(__GXContexts.main->x80, arg3, 6, 6);
break;
case GX_TEXCOORD1:
INSERT_FIELD(__GXContexts.main->x80, arg3, 6, 12);
break;
case GX_TEXCOORD2:
INSERT_FIELD(__GXContexts.main->x80, arg3, 6, 18);
break;
case GX_TEXCOORD3:
INSERT_FIELD(__GXContexts.main->x80, arg3, 6, 24);
break;
case GX_TEXCOORD4:
INSERT_FIELD(__GXContexts.main->x84, arg3, 6, 0);
break;
case GX_TEXCOORD5:
INSERT_FIELD(__GXContexts.main->x84, arg3, 6, 6);
break;
case GX_TEXCOORD6:
INSERT_FIELD(__GXContexts.main->x84, arg3, 6, 12);
break;
default:
INSERT_FIELD(__GXContexts.main->x84, arg3, 6, 18);
break;
}
__GXSetMatrixIndex(arg0 + 1);
}
/**
@ -386,7 +509,7 @@ void GXSetTexCoordGen2(u32 arg0, s32 arg1, u32 arg2, s32 arg3, s32 arg4,
* use in the Texture Environment (TEV) stages.
*
* Texture coordinates are generated from input data as described by
* #GXSetTexCoordGen. The generated texture coordinates are linked to specific
* #GXSetTexCoordGen2. The generated texture coordinates are linked to specific
* textures and specific Texture Environment (TEV) stages using #GXSetTevOrder.
*
* A consecutive number of texture coordinates may be generated, starting

View File

@ -6,7 +6,8 @@
#include <dolphin/gx/GXEnum.h>
void GXSetNumTexGens(u8 num);
void GXSetTexCoordGen2(u32, s32, u32, s32, s32, s32);
void GXSetTexCoordGen2(GXTexCoordID, GXTexGenType, GXTexGenSrc, u32, GXBool,
u32);
void GXInvalidateVtxCache(void);
void GXSetArray(GXAttr attr, s32 base_ptr, u8 stride);
void GXSetVtxAttrFmt(size_t vtxfmt, GXAttr attr, enum_t count, GXCompType type,

View File

@ -155,6 +155,12 @@ typedef enum {
GX_TF_A8 = GX_CTF_A8,
} GXTexFmt;
typedef enum {
GX_TF_C4 = 0x8,
GX_TF_C8 = 0x9,
GX_TF_C14X2 = 0xA,
} GXCITexFmt;
typedef enum {
GX_CLAMP,
GX_REPEAT,
@ -178,6 +184,36 @@ typedef enum {
GX_MAX_ANISOTROPY,
} GXAnisotropy;
typedef enum {
GX_TLUT0 = 0,
GX_TLUT1,
GX_TLUT2,
GX_TLUT3,
GX_TLUT4,
GX_TLUT5,
GX_TLUT6,
GX_TLUT7,
GX_TLUT8,
GX_TLUT9,
GX_TLUT10,
GX_TLUT11,
GX_TLUT12,
GX_TLUT13,
GX_TLUT14,
GX_TLUT15,
GX_BIGTLUT0,
GX_BIGTLUT1,
GX_BIGTLUT2,
GX_BIGTLUT3
} GXTlut;
typedef enum {
GX_TL_IA8 = 0x0,
GX_TL_RGB565 = 0x1,
GX_TL_RGB5A3 = 0x2,
GX_MAX_TLUTFMT
} GXTlutFmt;
typedef enum {
GX_TEXMAP0,
GX_TEXMAP1,

View File

@ -157,17 +157,17 @@ void GXSetDispCopySrc(u16 left, u16 top, u16 wd, u16 ht)
INSERT_FIELD(__GXContexts.main->x1D0[5], 74, 8, 24);
}
void GXSetTexCopySrc(u16 arg0, u32 arg1, u16 arg2, u16 arg3)
void GXSetTexCopySrc(u16 left, u16 top, u16 wd, u16 ht)
{
__GXContexts.main->x1D0[8] = 0;
INSERT_FIELD(__GXContexts.main->x1D0[8], arg0, 10, 0);
INSERT_FIELD(__GXContexts.main->x1D0[8], left, 10, 0);
__GXContexts.main->x1D0[8] =
(((u32) __GXContexts.main->x1D0[8] & 0xFFF003FF) |
((u32) (arg1 << 10) & 0x03FFFC00));
((u32) (top << 10) & 0x03FFFC00));
INSERT_FIELD(__GXContexts.main->x1D0[8], 73, 8, 24);
__GXContexts.main->x1D0[9] = 0;
INSERT_FIELD(__GXContexts.main->x1D0[9], arg2 - 1, 10, 0);
INSERT_FIELD(__GXContexts.main->x1D0[9], arg3 - 1, 10, 10);
INSERT_FIELD(__GXContexts.main->x1D0[9], wd - 1, 10, 0);
INSERT_FIELD(__GXContexts.main->x1D0[9], ht - 1, 10, 10);
INSERT_FIELD(__GXContexts.main->x1D0[9], 74, 8, 24);
}
@ -179,7 +179,7 @@ void GXSetDispCopyDst(u16 wd, u16 ht)
INSERT_FIELD(__GXContexts.main->x1D0[6], 77, 8, 24);
}
void GXSetTexCopyDst(s32 arg0, s32 arg1, s32 arg2, s32 arg3)
void GXSetTexCopyDst(u16 wd, u16 ht, GXTexFmt fmt, GXBool mipmap)
{
NOT_IMPLEMENTED;
}

View File

@ -23,8 +23,8 @@ void GXSetDispCopyFrame2Field(s32 arg0);
void GXSetDispCopyGamma(s32 arg0);
void GXSetDispCopySrc(u16, u16, u16, u16);
u32 GXSetDispCopyYScale(f32);
void GXSetTexCopyDst(s32, s32, s32, s32);
void GXSetTexCopySrc(u16 arg0, u32 arg1, u16 arg2, u16 arg3);
void GXSetTexCopyDst(u16, u16, GXTexFmt, GXBool);
void GXSetTexCopySrc(u16, u16, u16, u16);
void GXSetCopyClamp(s32);
void GXSetCopyClear(GXColor, u32);

View File

@ -40,20 +40,23 @@ void __GetImageTileCount(u32 arg0, s16 arg1, s16 arg2, s32* arg3, s32* arg4,
NOT_IMPLEMENTED;
}
void GXInitTexObj(unk_t arg0, u32 arg1, u16 arg2, u16 arg3, s32 arg4, s32 arg5,
s32 arg6, s8 arg7)
void GXInitTexObj(GXTexObj* obj, void* image_ptr, u16 width, u16 height,
GXTexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t,
GXBool mipmap)
{
NOT_IMPLEMENTED;
}
void GXInitTexObjCI(unk_t arg0, s32 arg1, u16 arg2, u16 arg3, s32 arg4,
s32 arg5, s32 arg6, s8 arg7)
void GXInitTexObjCI(GXTexObj* obj, void* image_ptr, u16 width, u16 height,
GXCITexFmt format, GXTexWrapMode wrap_s,
GXTexWrapMode wrap_t, GXBool mipmap, u32 tlut_name)
{
NOT_IMPLEMENTED;
}
void GXInitTexObjLOD(unk_t arg0, s32 arg1, s32 arg2, s32 arg3, s8 arg4,
s32 arg5, f32 arg6, f32 arg7, f32 arg8)
void GXInitTexObjLOD(GXTexObj* obj, GXTexFilter min_filt, GXTexFilter mag_filt,
f32 min_lod, f32 max_lod, f32 lod_bias, GXBool bias_clamp,
GXBool do_edge_lod, GXAnisotropy max_aniso)
{
NOT_IMPLEMENTED;
}
@ -73,22 +76,23 @@ GXTexFmt GXGetTexObjFmt(GXTexObj* tex_obj)
return tex_obj->tex_fmt;
}
void GXLoadTexObjPreLoaded(unk_t arg0, unk_t arg1, s32 arg2)
void GXLoadTexObjPreLoaded(const GXTexObj* arg0, unk_t arg1, GXTexMapID arg2)
{
NOT_IMPLEMENTED;
}
void GXLoadTexObj(unk_t arg0, s32 arg1)
void GXLoadTexObj(const GXTexObj* arg0, GXTexMapID arg1)
{
GXLoadTexObjPreLoaded(arg0, __GXContexts.main->callbacks[0x98](), arg1);
}
void GXInitTlutObj(unk_t arg0, u32 arg1, s32 arg2, u16 arg3)
void GXInitTlutObj(GXTlutObj* tlut_obj, void* lut, GXTlutFmt fmt,
u16 n_entries)
{
NOT_IMPLEMENTED;
}
void GXLoadTlut(unk_t arg0, s32 arg1)
void GXLoadTlut(GXTlutObj* arg0, s32 arg1)
{
NOT_IMPLEMENTED;
}

View File

@ -7,22 +7,25 @@
#include <dolphin/gx/GXEnum.h>
void __GXSetSUTexSize(void);
void GXLoadTexObjPreLoaded(unk_t, unk_t, s32);
void GXLoadTexObjPreLoaded(const GXTexObj*, unk_t, GXTexMapID);
void GXInvalidateTexAll(void);
GXTexRegionCallback GXSetTlutRegionCallback(GXTexRegionCallback arg0);
void __SetSURegs(s32, s32);
void GXInitTexObj(unk_t, u32, u16, u16, s32, s32, s32, s8);
void GXInitTexObj(GXTexObj*, void*, u16, u16, GXTexFmt, GXTexWrapMode,
GXTexWrapMode, GXBool);
s32 GXGetTexObjWidth(GXTexObj* tex_obj);
s32 GXGetTexObjHeight(GXTexObj* tex_obj);
GXTexFmt GXGetTexObjFmt(GXTexObj* tex_obj);
void GXLoadTexObj(unk_t arg0, s32 arg1);
void GXLoadTexObj(const GXTexObj*, GXTexMapID);
void GXInitTlutRegion(s32* arg0, s32 arg1, s32 arg2);
s32 GXGetTexBufferSize(u16, u16, u32, u8, u8);
void GXInitTexObjCI(unk_t, s32, u16, u16, s32, s32, s32, s8);
void GXInitTexObjLOD(unk_t, s32, s32, s32, s8, s32, f32, f32, f32);
void GXInitTlutObj(unk_t, u32, s32, u16);
void GXLoadTlut(unk_t, s32);
void GXInitTexObjCI(GXTexObj*, void*, u16, u16, GXCITexFmt, GXTexWrapMode,
GXTexWrapMode, GXBool, u32);
void GXInitTexObjLOD(GXTexObj*, GXTexFilter, GXTexFilter, f32, f32, f32,
GXBool, GXBool, GXAnisotropy);
void GXInitTlutObj(GXTlutObj*, void*, GXTlutFmt, u16);
void GXLoadTlut(GXTlutObj*, s32);
void __GXSetTmemConfig(s32);
GXTexRegionCallback GXSetTexRegionCallback(GXTexRegionCallback arg0);
void GXInitTexCacheRegion(unk_t, s8, u32, s32, u32, s32, s32);

View File

@ -138,4 +138,8 @@ struct GXTexObj {
u8 x18_pad[8]; // at 0x18
};
struct GXTlutObj {
u32 dummy[3];
};
#endif

View File

@ -6,6 +6,7 @@
#include <dolphin/gx/GXEnum.h>
typedef struct GXTexObj GXTexObj;
typedef struct GXTlutObj GXTlutObj;
typedef struct GXColor GXColor;
typedef struct GXColorS10 GXColorS10;
typedef struct GXRenderModeObj GXRenderModeObj;

View File

@ -28,7 +28,7 @@ void* cmSnap_80031618(void)
return 0;
}
cmsnap_data.unk0 = 0;
return cmsnap_data.unk1.img_ptr;
return cmsnap_data.unk1.image_ptr;
}
void cmSnap_80031640(HSD_GObj* arg0, int code)
@ -51,7 +51,7 @@ void cmSnap_80031640(HSD_GObj* arg0, int code)
void cmSnap_800316B4(void)
{
cmsnap_data.unk0 = 0;
cmsnap_data.unk1.img_ptr = 0;
cmsnap_data.unk1.image_ptr = NULL;
GObj_SetupGXLinkMax(GObj_Create(0x12, 0x12, 0), cmSnap_80031640, 4);
lb_800121FC(&cmsnap_data.unk1, 0x280, 0x1E0, 4, 0x7D6);
}

View File

@ -51,7 +51,7 @@ void HSD_LObjClearFlags(HSD_LObj* lobj, u32 flags)
lobj->flags &= ~flags;
}
s32 HSD_LObjGetLightMaskDiffuse(void)
GXLightID HSD_LObjGetLightMaskDiffuse(void)
{
return lightmask_diffuse;
}

View File

@ -118,7 +118,7 @@ extern HSD_LObjInfo hsdLobj;
u32 HSD_LObjGetFlags(HSD_LObj* lobj);
void HSD_LObjSetFlags(HSD_LObj* lobj, u32 flags);
void HSD_LObjClearFlags(HSD_LObj* lobj, u32 flags);
s32 HSD_LObjGetLightMaskDiffuse(void);
GXLightID HSD_LObjGetLightMaskDiffuse(void);
s32 HSD_LObjGetLightMaskAttnFunc(void);
s32 HSD_LObjGetLightMaskAlpha(void);
s32 HSD_LObjGetLightMaskSpecular(void);

View File

@ -43,7 +43,7 @@ void HSD_ShadowInitAllocData(void)
HSD_TObj* makeShadowTObj(void)
{
HSD_TObj* shadowTObj;
shadowTObj = allocShadowTObj();
shadowTObj = HSD_TObjAlloc();
shadowTObj->src = 0;
shadowTObj->wrap_s = 0;
shadowTObj->wrap_t = 0;
@ -94,8 +94,8 @@ void HSD_ShadowRemove(HSD_Shadow* shadow)
if (shadow->active) {
HSD_MObjDeleteShadowTexture(shadow->texture);
}
if (shadow->texture->imagedesc->img_ptr != NULL) {
HSD_Free(shadow->texture->imagedesc->img_ptr);
if (shadow->texture->imagedesc->image_ptr != NULL) {
HSD_Free(shadow->texture->imagedesc->image_ptr);
}
tobj = shadow->texture;
HSD_ImageDescFree(tobj->imagedesc);
@ -128,14 +128,15 @@ void HSD_ShadowSetSize(HSD_Shadow* shadow, u16 width, u16 height)
HSD_ASSERT(279, height > 0);
idesc = shadow->texture->imagedesc;
if (!idesc->img_ptr || idesc->width != width || idesc->height != height) {
if (idesc->img_ptr) {
HSD_Free(idesc->img_ptr);
if (!idesc->image_ptr || idesc->width != width || idesc->height != height)
{
if (idesc->image_ptr) {
HSD_Free(idesc->image_ptr);
}
size = GXGetTexBufferSize(width, height, GX_TF_I4, GX_FALSE, 0);
HSD_ASSERT(0x122, size > 0);
idesc->img_ptr = HSD_MemAlloc(size);
idesc->image_ptr = HSD_MemAlloc(size);
idesc->width = width;
idesc->height = height;
@ -274,11 +275,11 @@ void HSD_ShadowEndRender(HSD_Shadow* shadow)
HSD_ASSERT(501, shadow);
idesc = shadow->texture->imagedesc;
if (!idesc->img_ptr) {
if (!idesc->image_ptr) {
HSD_ShadowSetSize(shadow, idesc->width, idesc->height);
}
GXCopyTex(idesc->img_ptr, GX_TRUE);
GXCopyTex(idesc->image_ptr, GX_TRUE);
GXPixModeSync();
GXInvalidateTexAll();
@ -299,7 +300,7 @@ void HSD_ShadowSetActive(HSD_Shadow* shadow, int active)
shadow->active = active;
if (active) {
idesc = shadow->texture->imagedesc;
if (!idesc->img_ptr) {
if (!idesc->image_ptr) {
HSD_ShadowSetSize(shadow, idesc->width, idesc->height);
}

View File

@ -129,7 +129,6 @@ void HSD_SetupTevStage(HSD_TevDesc* desc)
u8 _[8] = { 0 };
GXSetTevOrder(desc->stage, desc->coord, desc->map, desc->color);
if (desc->flags == 0) {
/// @todo Incorrect cast.
GXSetTevOp(desc->stage, (GXTevMode) desc->u.tevconf.clr_op);
GXSetTevSwapMode(desc->stage, GX_TEV_SWAP0, GX_TEV_SWAP0);
return;

File diff suppressed because it is too large Load Diff

View File

@ -132,19 +132,19 @@ struct HSD_TObj;
struct HSD_TObj {
HSD_Obj parent;
HSD_TObj* next;
s32 id; // GXTexMapID
u32 src; // GXTexGenSrc
GXTexMtx mtxid;
GXTexMapID id;
GXTexGenSrc src;
u32 mtxid;
Quaternion rotate;
Vec3 scale;
Vec3 translate;
u32 wrap_s; // GXTexWrapMode
s32 wrap_t; // GXTexWrapMode
GXTexWrapMode wrap_s;
GXTexWrapMode wrap_t;
u8 repeat_s;
u8 repeat_t;
u32 flags;
f32 blending;
u32 magFilt; // GXTexFilter
GXTexFilter magFilt;
struct _HSD_ImageDesc* imagedesc;
struct _HSD_Tlut* tlut;
struct _HSD_TexLODDesc* lod;
@ -153,25 +153,25 @@ struct HSD_TObj {
struct _HSD_Tlut** tluttbl;
u8 tlut_no;
Mtx mtx;
u32 coord; // GXTexCoordID
GXTexCoordID coord;
struct _HSD_TObjTev* tev;
};
typedef struct _HSD_TObjDesc {
char* class_name;
struct _HSD_TObjDesc* next;
u32 id; // GXTexMapID
u32 src; // GXTexGenSrc
GXTexMapID id;
GXTexGenSrc src;
Vec3 rotate;
Vec3 scale;
Vec3 translate;
u32 wrap_s; // GXTexWrapMode
u32 wrap_t; // GXTexWrapMode
GXTexWrapMode wrap_s;
GXTexWrapMode wrap_t;
u8 repeat_s;
u8 repeat_t;
u32 blend_flags;
f32 blending;
u32 magFilt; // GXTexFilter
GXTexFilter magFilt;
struct _HSD_ImageDesc* imagedesc;
struct _HSD_TlutDesc* tlutdesc;
struct _HSD_TexLODDesc* lod;
@ -180,31 +180,31 @@ typedef struct _HSD_TObjDesc {
typedef struct _HSD_Tlut {
void* lut;
u32 fmt;
GXTlutFmt fmt;
u32 tlut_name;
u16 n_entries;
} HSD_Tlut;
typedef struct _HSD_TlutDesc {
void* lut;
u32 fmt;
GXTlutFmt fmt;
u32 tlut_name;
u16 n_entries;
} HSD_TlutDesc;
typedef struct _HSD_TexLODDesc {
u32 minFilt; // GXTexFilter
GXTexFilter minFilt;
f32 LODBias;
u8 bias_clamp; // GXBool
u8 edgeLODEnable; // GXBool
u32 max_anisotropy; // GXAnisotropy
GXBool bias_clamp;
GXBool edgeLODEnable;
GXAnisotropy max_anisotropy;
} HSD_TexLODDesc;
struct _HSD_ImageDesc {
void* img_ptr;
void* image_ptr;
u16 width;
u16 height;
u32 format;
GXTexFmt format;
u32 mipmap;
f32 minLOD;
f32 maxLOD;
@ -250,7 +250,7 @@ typedef struct _HSD_TObjInfo {
typedef struct _HSD_TexAnim {
struct _HSD_TexAnim* next;
s32 id; // GXTexMapID
GXTexMapID id;
HSD_AObjDesc* aobjdesc;
struct _HSD_ImageDesc** imagetbl;
struct _HSD_TlutDesc** tluttbl;
@ -273,8 +273,6 @@ void HSD_TObjReqAnimAll(HSD_TObj* tobj, f32 startframe);
void HSD_TObjAnim(HSD_TObj* tobj);
void HSD_TObjAnimAll(HSD_TObj* tobj);
int TObjLoad(HSD_TObj* tobj, HSD_TObjDesc* td);
HSD_TObj* HSD_TObjLoadDesc(HSD_TObjDesc* td);
HSD_Tlut* HSD_TlutLoadDesc(HSD_TlutDesc* tlutdesc);
HSD_TObjTev* HSD_TObjTevLoadDesc(HSD_TObjTevDesc* tevdesc);
@ -292,20 +290,20 @@ HSD_TObjTev* HSD_TObjTevAlloc(void);
HSD_ImageDesc* HSD_ImageDescAlloc(void);
void HSD_ImageDescFree(HSD_ImageDesc* idesc);
void HSD_ImageDescCopyFromEFB(HSD_ImageDesc* idesc, u16 origx, u16 origy,
u8 clear, s32 sync);
GXBool clear, int sync);
void HSD_TObjSetupTextureCoordGen(HSD_TObj* tobj);
void HSD_TObjSetupVolatileTev(HSD_TObj* tobj, u32 rendermode);
s32 HSD_TObjAssignResources(HSD_TObj* tobj_top);
void HSD_TObjSetup(HSD_TObj* tobj);
u32 HSD_TGTex2Index(u32 tgtex);
u32 HSD_TexCoordID2TexGenSrc(u32 coord);
u32 HSD_TexCoord2Index(u32 coord_id);
u32 HSD_Index2TexCoord(u32 index);
u32 HSD_TexMtx2Index(u32 texmtx);
u32 HSD_Index2TexMtx(u32 index);
u8 HSD_Index2TexMap(u32 index);
u32 HSD_TexMap2Index(u8 mapid);
HSD_TObj* allocShadowTObj(void);
u32 HSD_TGTex2Index(GXTexGenSrc tgtex);
GXTexGenSrc HSD_TexCoordID2TexGenSrc(GXTexCoordID coord);
u32 HSD_TexCoord2Index(GXTexCoordID coord_id);
GXTexCoordID HSD_Index2TexCoord(u32 index);
u32 HSD_TexMtx2Index(GXTexMtx texmtx);
GXTexMtx HSD_Index2TexMtx(u32 index);
GXTexMapID HSD_Index2TexMap(u32 index);
u32 HSD_TexMap2Index(GXTexMapID mapid);
HSD_TObj* HSD_TObjAlloc(void);
void HSD_TObjRemoveAnim(HSD_TObj* tobj);
void HSD_TObjReqAnimByFlags(HSD_TObj* tobj, f32 startframe, u32 flags);