Skip to content

Commit 319fd65

Browse files
committed
2 parents 4a17a66 + 4fbcfc4 commit 319fd65

File tree

17 files changed

+382
-134
lines changed

17 files changed

+382
-134
lines changed

base/symbols_resort.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3034,6 +3034,7 @@ GXGetTevOrder__Q34nw4r3g3d6ResTevCF13_GXTevStageIDP13_GXTexCoordIDP11_GXTexMapID
30343034
GXSetTevOrder__Q34nw4r3g3d6ResTevF13_GXTevStageID13_GXTexCoordID11_GXTexMapID12_GXChannelID=0x8016dec0
30353035
CallDisplayList__Q34nw4r3g3d6ResTevCFb=0x8016dfe0
30363036
CopyTo__Q34nw4r3g3d6ResTevFPv=0x8016e040
3037+
DCStore__Q34nw4r3g3d6ResTevFb=0x8016e0b0
30373038
DCStore__Q34nw4r3g3d14ResMatTevColorFb=0x8016e110
30383039
DCStore__Q34nw4r3g3d20ResMatIndMtxAndScaleFb=0x8016e130
30393040
DCStore__Q34nw4r3g3d17ResMatTexCoordGenFb=0x8016e150
@@ -3050,6 +3051,7 @@ SetEffectMtx__Q34nw4r3g3d9ResTexSrtFUlPCQ34nw4r4math5MTX34=0x8016e610
30503051
GetEffectMtx__Q34nw4r3g3d9ResTexSrtCFUlPQ34nw4r4math5MTX34=0x8016e690
30513052
SetMapMode__Q34nw4r3g3d9ResTexSrtFUlUlii=0x8016e6e0
30523053
GetMapMode__Q34nw4r3g3d9ResTexSrtCFUlPUlPiPi=0x8016e760
3054+
GXSetNumTevStages__Q34nw4r3g3d10ResGenModeFUc=0x8016e800
30533055
CopyTo__Q34nw4r3g3d10ResGenModeCFPv=0x8016e860
30543056
GXGetZCompLoc__Q34nw4r3g3d10ResMatMiscCFv=0x8016e8a0
30553057
SetLightSetIdx__Q34nw4r3g3d10ResMatMiscFi=0x8016e8c0

include/Pack/RPGraphics.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <RPGraphics/RPGrpModelBoundingInfo.h>
88
#include <RPGraphics/RPGrpModelG3D.h>
99
#include <RPGraphics/RPGrpModelManager.h>
10+
#include <RPGraphics/RPGrpModelMaterial.h>
1011
#include <RPGraphics/RPGrpModelResManager.h>
1112
#include <RPGraphics/RPGrpRenderer.h>
1213
#include <RPGraphics/RPGrpScreen.h>

include/Pack/RPGraphics/RPGrpModel.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,28 @@
44

55
#include <egg/gfx/eggModelEx.h>
66

7+
class RPGrpModelMaterial;
8+
79
class RPGrpModel {
810
public:
911
EGG::ModelEx* GetModelEx() const {
1012
return mModelEx;
1113
}
1214

15+
RPGrpModelMaterial* GetMaterial(u32 id) const {
16+
return mppMaterials[id];
17+
}
18+
1319
private:
14-
char _00[0x40];
1520
#if defined(PACK_RESORT)
16-
char _40[0x4];
17-
#endif
21+
char _00[0x38];
22+
RPGrpModelMaterial** mppMaterials; // at 0x38
23+
char _3C[0x44 - 0x3C];
24+
EGG::ModelEx* mModelEx; // at 0x44
25+
#else
26+
char _00[0x40];
1827
EGG::ModelEx* mModelEx; // at 0x40
28+
#endif
1929
};
2030

2131
#endif
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#ifndef RP_GRAPHICS_MODEL_MATERIAL_H
2+
#define RP_GRAPHICS_MODEL_MATERIAL_H
3+
#include "RPTypes.h"
4+
5+
#include <nw4r/g3d.h>
6+
7+
class RPGrpModelMaterial {
8+
public:
9+
void SetTevKColor(GXTevKColorID id, GXColor color) {
10+
mTevKColors[id] = color;
11+
}
12+
void SetTevColor(GXTevRegID id, GXColorS10 color) {
13+
mTevColors[id - GX_TEVREG0] = color;
14+
}
15+
16+
nw4r::g3d::ScnMdl::CopiedMatAccess& GetCopiedMatAccess() {
17+
return mCopiedMatAccess;
18+
}
19+
20+
private:
21+
char _00[0xC];
22+
GXColor mTevKColors[GX_MAX_KCOLOR]; // at 0xC
23+
GXColorS10 mTevColors[GX_MAX_TEVREG - GX_TEVREG0]; // at 0x1C
24+
char _34[0x80 - 0x34];
25+
nw4r::g3d::ScnMdl::CopiedMatAccess mCopiedMatAccess; // at 0x80
26+
// . . .
27+
};
28+
29+
#endif

include/nw4r/g3d/g3d_draw.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ G3DState::IndMtxOp* GetIndMtxOp(ResMat mat, ResNode node, ResShp shp);
2424
} // namespace detail
2525

2626
struct DrawResMdlReplacement {
27+
#if defined(PACK_RESORT)
28+
u32 flag;
29+
#endif
2730
u8* visArray; // at 0x0
2831
ResTexObjData* texObjDataArray; // at 0x4
2932
ResTlutObjData* tlutObjDataArray; // at 0x8

include/nw4r/g3d/g3d_scnmdl.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ class ScnMdl : public ScnMdlSimple {
159159
u32 mFlagVisBuffer; // at 0x13C
160160
u32* mpMatBufferDirtyFlag; // at 0x140
161161
DrawResMdlReplacement mReplacement; // at 0x144
162+
#if defined(PACK_RESORT)
163+
u32 mReplacementFlag; // at 0x184
164+
#endif
162165

163166
NW4R_G3D_RTTI_DECL_DERIVED(ScnMdl, ScnMdlSimple);
164167
};

include/nw4r/g3d/res/g3d_restev.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ class ResTev : public ResCommon<ResTevData> {
7979
void GXSetTevColorIn(GXTevStageID stage, GXTevColorArg a, GXTevColorArg b,
8080
GXTevColorArg c, GXTevColorArg d);
8181

82+
void GXSetTevColorOp(GXTevStageID stage, GXTevOp op, GXTevBias bias,
83+
GXTevScale scale, GXBool clamp, GXTevRegID output);
84+
8285
void CallDisplayList(bool sync) const;
8386

8487
ResTev CopyTo(void* pDst);

lib/libkiwi/core/kiwiColor.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ Color Color::ToYuv() const {
1414
return Color(y, u, v, a);
1515
}
1616

17+
/**
18+
* @brief Converts RGB color to GX signed 10-bit format
19+
*/
20+
GXColorS10 Color::ToS10() const {
21+
const GXColorS10 color = {r, g, b, a};
22+
return color;
23+
}
24+
1725
/**
1826
* @brief Creates RGB color from HSV format
1927
*

lib/libkiwi/core/kiwiColor.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ class Color : public nw4r::ut::Color {
8383
*/
8484
Color ToYuv() const;
8585

86+
/**
87+
* @brief Converts RGB color to GX signed 10-bit format
88+
*/
89+
GXColorS10 ToS10() const;
90+
8691
/**
8792
* @brief Converts HSV color to RGB format
8893
*

lib/libkiwi/fun/kiwiGameCorruptor.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void** GetRandomAddr(const void* pBegin, const void* pEnd) {
2323

2424
do {
2525
// Make sure to align the address to 4 bytes
26-
offset = Random().NextU32(size);
26+
offset = RNG.NextU32(size);
2727
offset = RoundUp(offset, 4);
2828
}
2929
// Adjusting for alignment may take us out of the range
@@ -89,7 +89,7 @@ void GameCorruptor::Corrupt() const {
8989

9090
case ECorruptDomain_DolData: {
9191
// 50/50 between .data and .rodata
92-
if (Random().CoinFlip()) {
92+
if (RNG.CoinFlip()) {
9393
CorruptData(GetDolDataStart(), GetDolDataEnd());
9494
} else {
9595
CorruptData(GetDolRodataStart(), GetDolRodataEnd());
@@ -170,11 +170,11 @@ void GameCorruptor::CorruptData(const void* pBegin, const void* pEnd) const {
170170
// Corrupt float
171171
if (PtrUtil::IsFloat(ppAddr)) {
172172
*reinterpret_cast<f32*>(ppAddr) =
173-
Random().NextF32(10000000.0f) * Random().Sign();
173+
RNG.NextF32(10000000.0f) * RNG.Sign();
174174
}
175175
// Corrupt integer
176176
else {
177-
*reinterpret_cast<u32*>(ppAddr) = Random().NextU32();
177+
*reinterpret_cast<u32*>(ppAddr) = RNG.NextU32();
178178
}
179179

180180
i++;

0 commit comments

Comments
 (0)