mirror of
https://github.com/pret/pokediamond.git
synced 2026-08-25 18:25:04 -05:00
more sdk inlines
This commit is contained in:
@@ -203,5 +203,18 @@ GXBoxTestParam;
|
||||
((alpha) << REG_G3_POLYGON_ATTR_ALPHA_SHIFT)))
|
||||
|
||||
|
||||
#define GX_PACK_TEXPLTTBASE_PARAM(addr, texFmt) \
|
||||
((u32)((addr) >> (4 - ((texFmt) == GX_TEXFMT_PLTT4))))
|
||||
|
||||
|
||||
#define GX_PACK_DIFFAMB_PARAM(diffuse, ambient, IsSetVtxColor) \
|
||||
((u32)((diffuse) | \
|
||||
((ambient) << REG_G3_DIF_AMB_AMBIENT_RED_SHIFT) | \
|
||||
((IsSetVtxColor != FALSE) << REG_G3_DIF_AMB_C_SHIFT)))
|
||||
|
||||
#define GX_PACK_SPECEMI_PARAM(specular, emission, IsShininess) \
|
||||
((u32)((specular) | \
|
||||
((emission) << REG_G3_SPE_EMI_EMISSION_RED_SHIFT) | \
|
||||
((IsShininess != FALSE) << REG_G3_SPE_EMI_S_SHIFT)))
|
||||
|
||||
#endif //GUARD_GX_G3_H
|
||||
|
||||
@@ -8,6 +8,31 @@ void G3_LoadMtx43(struct Mtx43 *mtx);
|
||||
void G3_MultMtx43(struct Mtx43 *mtx);
|
||||
void G3_MultMtx33(struct Mtx33 *mtx);
|
||||
|
||||
|
||||
static inline void G3_PushMtx()
|
||||
{
|
||||
reg_G3_MTX_PUSH = 0;
|
||||
}
|
||||
|
||||
static inline void G3_PopMtx(int num)
|
||||
{
|
||||
reg_G3_MTX_POP = (u32)num;
|
||||
}
|
||||
|
||||
static inline void G3_Identity()
|
||||
{
|
||||
reg_G3_MTX_IDENTITY = 0;
|
||||
}
|
||||
|
||||
|
||||
static inline void G3_Translate(fx32 x, fx32 y, fx32 z)
|
||||
{
|
||||
reg_G3_MTX_TRANS = (u32)x;
|
||||
reg_G3_MTX_TRANS = (u32)y;
|
||||
reg_G3_MTX_TRANS = (u32)z;
|
||||
}
|
||||
|
||||
|
||||
static inline void G3_PolygonAttr(int light, GXPolygonMode polyMode, GXCull cullMode, int polygonID, int alpha, int misc) {
|
||||
reg_G3_POLYGON_ATTR = GX_PACK_POLYGONATTR_PARAM(light,
|
||||
polyMode, cullMode, polygonID, alpha, misc);
|
||||
@@ -23,4 +48,21 @@ static inline void G3_TexImageParam(GXTexFmt texFmt,
|
||||
}
|
||||
|
||||
|
||||
static inline void G3_TexPlttBase(u32 addr, GXTexFmt texfmt)
|
||||
{
|
||||
u32 param = GX_PACK_TEXPLTTBASE_PARAM(addr, texfmt);
|
||||
reg_G3_TEXPLTT_BASE = param;
|
||||
}
|
||||
|
||||
|
||||
static inline void G3_MaterialColorDiffAmb(GXRgb diffuse, GXRgb ambient, BOOL IsSetVtxColor)
|
||||
{
|
||||
reg_G3_DIF_AMB = GX_PACK_DIFFAMB_PARAM(diffuse, ambient, IsSetVtxColor);
|
||||
}
|
||||
|
||||
static inline void G3_MaterialColorSpecEmi(GXRgb specular, GXRgb emission, BOOL IsShininess)
|
||||
{
|
||||
reg_G3_SPE_EMI = GX_PACK_SPECEMI_PARAM(specular, emission, IsShininess);
|
||||
}
|
||||
|
||||
#endif //GUARD_GX_G3IMM_H
|
||||
|
||||
@@ -1154,4 +1154,66 @@
|
||||
#define REG_G3_TEXIMAGE_PARAM_TEX_ADDR_SIZE 16
|
||||
#define REG_G3_TEXIMAGE_PARAM_TEX_ADDR_MASK 0x0000ffff
|
||||
|
||||
|
||||
// DIF_AMB
|
||||
|
||||
#define REG_G3_DIF_AMB_AMBIENT_BLUE_SHIFT 26
|
||||
#define REG_G3_DIF_AMB_AMBIENT_BLUE_SIZE 5
|
||||
#define REG_G3_DIF_AMB_AMBIENT_BLUE_MASK 0x7c000000
|
||||
|
||||
#define REG_G3_DIF_AMB_AMBIENT_GREEN_SHIFT 21
|
||||
#define REG_G3_DIF_AMB_AMBIENT_GREEN_SIZE 5
|
||||
#define REG_G3_DIF_AMB_AMBIENT_GREEN_MASK 0x03e00000
|
||||
|
||||
#define REG_G3_DIF_AMB_AMBIENT_RED_SHIFT 16
|
||||
#define REG_G3_DIF_AMB_AMBIENT_RED_SIZE 5
|
||||
#define REG_G3_DIF_AMB_AMBIENT_RED_MASK 0x001f0000
|
||||
|
||||
#define REG_G3_DIF_AMB_C_SHIFT 15
|
||||
#define REG_G3_DIF_AMB_C_SIZE 1
|
||||
#define REG_G3_DIF_AMB_C_MASK 0x00008000
|
||||
|
||||
#define REG_G3_DIF_AMB_DIFFUSE_BLUE_SHIFT 10
|
||||
#define REG_G3_DIF_AMB_DIFFUSE_BLUE_SIZE 5
|
||||
#define REG_G3_DIF_AMB_DIFFUSE_BLUE_MASK 0x00007c00
|
||||
|
||||
#define REG_G3_DIF_AMB_DIFFUSE_GREEN_SHIFT 5
|
||||
#define REG_G3_DIF_AMB_DIFFUSE_GREEN_SIZE 5
|
||||
#define REG_G3_DIF_AMB_DIFFUSE_GREEN_MASK 0x000003e0
|
||||
|
||||
#define REG_G3_DIF_AMB_DIFFUSE_RED_SHIFT 0
|
||||
#define REG_G3_DIF_AMB_DIFFUSE_RED_SIZE 5
|
||||
#define REG_G3_DIF_AMB_DIFFUSE_RED_MASK 0x0000001f
|
||||
|
||||
|
||||
// SPE_EMI
|
||||
|
||||
#define REG_G3_SPE_EMI_EMISSION_BLUE_SHIFT 26
|
||||
#define REG_G3_SPE_EMI_EMISSION_BLUE_SIZE 5
|
||||
#define REG_G3_SPE_EMI_EMISSION_BLUE_MASK 0x7c000000
|
||||
|
||||
#define REG_G3_SPE_EMI_EMISSION_GREEN_SHIFT 21
|
||||
#define REG_G3_SPE_EMI_EMISSION_GREEN_SIZE 5
|
||||
#define REG_G3_SPE_EMI_EMISSION_GREEN_MASK 0x03e00000
|
||||
|
||||
#define REG_G3_SPE_EMI_EMISSION_RED_SHIFT 16
|
||||
#define REG_G3_SPE_EMI_EMISSION_RED_SIZE 5
|
||||
#define REG_G3_SPE_EMI_EMISSION_RED_MASK 0x001f0000
|
||||
|
||||
#define REG_G3_SPE_EMI_S_SHIFT 15
|
||||
#define REG_G3_SPE_EMI_S_SIZE 1
|
||||
#define REG_G3_SPE_EMI_S_MASK 0x00008000
|
||||
|
||||
#define REG_G3_SPE_EMI_SPECULAR_BLUE_SHIFT 10
|
||||
#define REG_G3_SPE_EMI_SPECULAR_BLUE_SIZE 5
|
||||
#define REG_G3_SPE_EMI_SPECULAR_BLUE_MASK 0x00007c00
|
||||
|
||||
#define REG_G3_SPE_EMI_SPECULAR_GREEN_SHIFT 5
|
||||
#define REG_G3_SPE_EMI_SPECULAR_GREEN_SIZE 5
|
||||
#define REG_G3_SPE_EMI_SPECULAR_GREEN_MASK 0x000003e0
|
||||
|
||||
#define REG_G3_SPE_EMI_SPECULAR_RED_SHIFT 0
|
||||
#define REG_G3_SPE_EMI_SPECULAR_RED_SIZE 5
|
||||
#define REG_G3_SPE_EMI_SPECULAR_RED_MASK 0x0000001f
|
||||
|
||||
#endif //POKEDIAMOND_ARM9_REGISTERS_H
|
||||
|
||||
@@ -360,7 +360,7 @@ THUMB_FUNC void FUN_02006ED4(struct UnkStruct_02006D98 *param0)
|
||||
|
||||
NNS_G3dGeFlushBuffer();
|
||||
|
||||
reg_G3_MTX_PUSH = 0;
|
||||
G3_PushMtx();
|
||||
|
||||
G3_TexImageParam(param0->unk260.attr.fmt,
|
||||
GX_TEXGEN_TEXCOORD,
|
||||
@@ -388,30 +388,15 @@ THUMB_FUNC void FUN_02006ED4(struct UnkStruct_02006D98 *param0)
|
||||
|
||||
if (param0->unk2E3 != 1)
|
||||
{
|
||||
reg_G3_MTX_IDENTITY = 0;
|
||||
G3_Identity();
|
||||
}
|
||||
|
||||
FUN_02007F48(¶m0->unk000[st18]);
|
||||
|
||||
u32 shift;
|
||||
if (param0->unk260.attr.fmt == 2)
|
||||
{
|
||||
shift = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
shift = 0;
|
||||
}
|
||||
|
||||
reg_G3_TEXPLTT_BASE = (param0->unk2A4 + st18 * 0x20) >> (4 - shift);
|
||||
|
||||
u32 r1 = param0->unk000[st18].unk28 << 0xc;
|
||||
u32 r0 = (u32)((param0->unk000[st18].unk26 + param0->unk000[st18].unk42) << 0xc);
|
||||
u32 r3 = (u32)((param0->unk000[st18].unk24 + param0->unk000[st18].unk40) << 0xc);
|
||||
|
||||
reg_G3_MTX_TRANS = r3;
|
||||
reg_G3_MTX_TRANS = r0;
|
||||
reg_G3_MTX_TRANS = r1;
|
||||
G3_TexPlttBase(param0->unk2A4 + st18 * 0x20, param0->unk260.attr.fmt);
|
||||
G3_Translate((fx32)((param0->unk000[st18].unk24 + param0->unk000[st18].unk40) << 0xc),
|
||||
(fx32)((param0->unk000[st18].unk26 + param0->unk000[st18].unk42) << 0xc),
|
||||
(fx32)(param0->unk000[st18].unk28 << 0xc));
|
||||
|
||||
s32 idx = ((s32)param0->unk000[st18].unk38) >> 4;
|
||||
G3_RotX(FX_SinCosTable_[idx * 2], FX_SinCosTable_[idx * 2 + 1]);
|
||||
@@ -422,23 +407,18 @@ THUMB_FUNC void FUN_02006ED4(struct UnkStruct_02006D98 *param0)
|
||||
s32 idz = ((s32)param0->unk000[st18].unk3C) >> 4;
|
||||
G3_RotZ(FX_SinCosTable_[idz * 2], FX_SinCosTable_[idz * 2 + 1]);
|
||||
|
||||
r1 = -(param0->unk000[st18].unk28 << 0xc);
|
||||
r0 = -(u32)((param0->unk000[st18].unk26 + param0->unk000[st18].unk42) << 0xc);
|
||||
r3 = -(u32)((param0->unk000[st18].unk24 + param0->unk000[st18].unk40) << 0xc);
|
||||
G3_Translate(-(fx32)((param0->unk000[st18].unk24 + param0->unk000[st18].unk40) << 0xc),
|
||||
-(fx32)((param0->unk000[st18].unk26 + param0->unk000[st18].unk42) << 0xc),
|
||||
-(fx32)(param0->unk000[st18].unk28 << 0xc));
|
||||
|
||||
reg_G3_MTX_TRANS = r3;
|
||||
reg_G3_MTX_TRANS = r0;
|
||||
reg_G3_MTX_TRANS = r1;
|
||||
G3_MaterialColorDiffAmb(
|
||||
(GXRgb)(param0->unk000[st18].unk50_0 | (param0->unk000[st18].unk50_5 << 5) |
|
||||
(param0->unk000[st18].unk50_a << 10)),
|
||||
(GXRgb)(param0->unk000[st18].unk50_f | (param0->unk000[st18].unk50_14 << 5) |
|
||||
(param0->unk000[st18].unk50_19 << 10)),
|
||||
TRUE);
|
||||
|
||||
reg_G3_DIF_AMB =
|
||||
(u32)(((u16)(param0->unk000[st18].unk50_0 | (param0->unk000[st18].unk50_5 << 5) |
|
||||
(param0->unk000[st18].unk50_a << 10))) |
|
||||
(((u16)(param0->unk000[st18].unk50_f | (param0->unk000[st18].unk50_14 << 5) |
|
||||
(param0->unk000[st18].unk50_19 << 10)))
|
||||
<< 16) |
|
||||
0x8000);
|
||||
|
||||
reg_G3_SPE_EMI = 0x4210;
|
||||
G3_MaterialColorSpecEmi(0x4210, 0, FALSE);
|
||||
|
||||
G3_PolygonAttr(GX_LIGHTMASK_NONE,
|
||||
GX_POLYGONMODE_MODULATE,
|
||||
@@ -455,10 +435,10 @@ THUMB_FUNC void FUN_02006ED4(struct UnkStruct_02006D98 *param0)
|
||||
int r7 = param0->unk000[st18].unk47;
|
||||
int r0 = r12 + r6;
|
||||
|
||||
NNS_G2dDrawSpriteFast((s16)(param0->unk000[st18].unk24 - 40 + param0->unk000[st18].unk44 +
|
||||
param0->unk000[st18].unk2C),
|
||||
NNS_G2dDrawSpriteFast((s16)(param0->unk000[st18].unk24 - 40 +
|
||||
param0->unk000[st18].unk44 + param0->unk000[st18].unk2C),
|
||||
(s16)(param0->unk000[st18].unk26 - 40 + param0->unk000[st18].unk45 +
|
||||
param0->unk000[st18].unk2E - param0->unk000[st18].unk6C.unk2),
|
||||
param0->unk000[st18].unk2E - param0->unk000[st18].unk6C.unk2),
|
||||
(int)(param0->unk000[st18].unk28 + param0->unk000[st18].unk30),
|
||||
r12,
|
||||
r7,
|
||||
@@ -475,7 +455,7 @@ THUMB_FUNC void FUN_02006ED4(struct UnkStruct_02006D98 *param0)
|
||||
NNS_G2dDrawSpriteFast(
|
||||
(s16)(param0->unk000[st18].unk24 - (arg3 / 2) + param0->unk000[st18].unk2C),
|
||||
(s16)(param0->unk000[st18].unk26 - (arg4 / 2) + param0->unk000[st18].unk2E -
|
||||
param0->unk000[st18].unk6C.unk2),
|
||||
param0->unk000[st18].unk6C.unk2),
|
||||
(int)(param0->unk000[st18].unk28 + param0->unk000[st18].unk30),
|
||||
arg3,
|
||||
arg4,
|
||||
@@ -493,20 +473,11 @@ THUMB_FUNC void FUN_02006ED4(struct UnkStruct_02006D98 *param0)
|
||||
|
||||
if (param0->unk2E3 != 1)
|
||||
{
|
||||
reg_G3_MTX_IDENTITY = 0;
|
||||
G3_Identity();
|
||||
}
|
||||
|
||||
u32 shift2;
|
||||
if (param0->unk260.attr.fmt == 2)
|
||||
{
|
||||
shift2 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
shift2 = 0;
|
||||
}
|
||||
reg_G3_TEXPLTT_BASE =
|
||||
(param0->unk2A4 + ((param0->unk000[st18].unk6C.unk0_0 + 3) << 5)) >> (4 - shift2);
|
||||
G3_TexPlttBase((param0->unk2A4 + ((param0->unk000[st18].unk6C.unk0_0 + 3) << 5)),
|
||||
param0->unk260.attr.fmt);
|
||||
|
||||
if (param0->unk000[st18].unk6C.unk0_4 != 0)
|
||||
{
|
||||
@@ -521,16 +492,16 @@ THUMB_FUNC void FUN_02006ED4(struct UnkStruct_02006D98 *param0)
|
||||
|
||||
if (param0->unk000[st18].unk6C.unk0_2 != 0)
|
||||
{
|
||||
param0->unk000[st18].unk6C.unk4 = (s16)(param0->unk000[st18].unk24 +
|
||||
param0->unk000[st18].unk2C +
|
||||
param0->unk000[st18].unk6C.unk8);
|
||||
param0->unk000[st18].unk6C.unk4 =
|
||||
(s16)(param0->unk000[st18].unk24 + param0->unk000[st18].unk2C +
|
||||
param0->unk000[st18].unk6C.unk8);
|
||||
}
|
||||
|
||||
if (param0->unk000[st18].unk6C.unk0_3 != 0)
|
||||
{
|
||||
param0->unk000[st18].unk6C.unk6 = (s16)(param0->unk000[st18].unk26 +
|
||||
param0->unk000[st18].unk2E +
|
||||
param0->unk000[st18].unk6C.unka);
|
||||
param0->unk000[st18].unk6C.unk6 =
|
||||
(s16)(param0->unk000[st18].unk26 + param0->unk000[st18].unk2E +
|
||||
param0->unk000[st18].unk6C.unka);
|
||||
}
|
||||
|
||||
NNS_G2dDrawSpriteFast((s16)(param0->unk000[st18].unk6C.unk4 - (arg3 / 2)),
|
||||
@@ -544,7 +515,7 @@ THUMB_FUNC void FUN_02006ED4(struct UnkStruct_02006D98 *param0)
|
||||
UNK_020ECBD0[param0->unk000[st18].unk6C.unk0_5][3]);
|
||||
}
|
||||
|
||||
reg_G3_MTX_POP = 1;
|
||||
G3_PopMtx(1);
|
||||
}
|
||||
|
||||
THUMB_FUNC void FUN_020072E8(struct UnkStruct_02006D98 *param0)
|
||||
@@ -1243,7 +1214,8 @@ THUMB_FUNC void FUN_02007F48(struct UnkStruct_02006D98_2 *param0)
|
||||
param0->unk84);
|
||||
}
|
||||
|
||||
THUMB_FUNC void FUN_02008010(struct UnkStruct_02006D98_5 *param0, struct UnkStruct_02006D98_sub *param1)
|
||||
THUMB_FUNC void FUN_02008010(
|
||||
struct UnkStruct_02006D98_5 *param0, struct UnkStruct_02006D98_sub *param1)
|
||||
{
|
||||
param0->unk00 = 1;
|
||||
param0->unk02 = 0;
|
||||
|
||||
Reference in New Issue
Block a user