J3duclip, fop_actor_mng and related stuff (#131)

* J3DUClipper sinit

* sincosTable_ etc

* decompile JMATrigonometric sinit

* f_op_actor_mng

* move f_op_actor_mng and parts of mDo_ext

* J3DSys sinit

* f_op_scene_req

* failed matching attempt for decodeSZS__9JKRDecompFPUcPUcUlUl

* mX -> x

* fix mCull and fopAcM_prm_class members

* fix a few function parameters

* move missing NON_MATCHING

* remove some unneeded data

* turns out that data was not unused

* remove unused asm

* readd asm deleted by accident
This commit is contained in:
lepelog
2021-06-02 14:13:31 +02:00
committed by GitHub
parent 2c9f53e00a
commit 7b2df7551e
121 changed files with 1367 additions and 3871 deletions
+28
View File
@@ -1,6 +1,7 @@
#ifndef J3DSYS_H
#define J3DSYS_H
#include "dolphin/mtx/mtx.h"
#include "dolphin/types.h"
// Perhaps move to a new J3DEnum.h?
@@ -9,4 +10,31 @@ enum J3DError {
kJ3DError_Alloc = 4,
};
struct _GXTexCacheSize {};
struct J3DSys {
Mtx mMtx;
u8 _30[0x11C - 0x30];
/* 8030FDE8 */ J3DSys();
/* 8030FEC0 */ void loadPosMtxIndx(int, u16) const;
/* 8030FEE4 */ void loadNrmMtxIndx(int, u16) const;
/* 8030FF0C */ void setTexCacheRegion(_GXTexCacheSize);
/* 803100BC */ void drawInit();
/* 8031073C */ void reinitGX();
/* 8031079C */ void reinitGenMode();
/* 803107E8 */ void reinitLighting();
/* 80310894 */ void reinitTransform();
/* 80310998 */ void reinitTexture();
/* 80310A3C */ void reinitTevStages();
/* 80310D44 */ void reinitIndStages();
/* 80310E3C */ void reinitPixelProc();
static u8 mCurrentMtx[48];
static f32 mCurrentS[3];
static f32 mParentS[3];
static u8 sTexCoordScaleTable[64 + 4 /* padding */];
};
extern J3DSys j3dSys;
#endif /* J3DSYS_H */
+22
View File
@@ -1,6 +1,28 @@
#ifndef J3DUCLIPPER_H
#define J3DUCLIPPER_H
#include "dolphin/mtx/vec.h"
#include "dolphin/types.h"
class J3DUClipper {
public:
J3DUClipper() { init(); }
virtual ~J3DUClipper() {}
/* 80273778 */ void init();
/* 8027378C */ void calcViewFrustum();
/* 802738FC */ u32 clip(f32 const (*)[4], Vec, f32) const;
/* 80273A44 */ u32 clip(f32 const (*)[4], Vec*, Vec*) const;
private:
Vec _04;
Vec _10;
Vec _1C;
Vec _28;
u8 _34[0x4C - 0x34];
f32 mFovY;
f32 mAspect;
f32 mNear;
f32 mFar;
};
#endif /* J3DUCLIPPER_H */
+5 -4
View File
@@ -75,8 +75,9 @@ public:
/* vt[22] */ virtual bool state_compare(JKRHeap::TState const&,
JKRHeap::TState const&) const; /* override */
u8 field_0x6c;
private:
u32 field_0x6c;
u32 field_0x70;
u32 field_0x74;
CMemBlock* mHeadFreeList;
@@ -85,9 +86,9 @@ private:
CMemBlock* mTailUsedList;
public:
static void createRoot(int, bool);
static void create(u32, JKRHeap*, bool);
static void create(void*, u32, JKRHeap*, bool);
static JKRExpHeap* createRoot(int, bool);
static JKRExpHeap* create(u32, JKRHeap*, bool);
static JKRExpHeap* create(void*, u32, JKRHeap*, bool);
};
#endif /* JKREXPHEAP_H */
+2 -1
View File
@@ -18,7 +18,6 @@ protected:
JKRSolidHeap(void*, u32, JKRHeap*, bool);
virtual ~JKRSolidHeap();
s32 adjustSize(void);
void* allocFromHead(u32, int);
void* allocFromTail(u32, int);
@@ -54,6 +53,8 @@ private:
/* 0x78 */ Unknown* field_0x78;
public:
s32 adjustSize(void);
static JKRSolidHeap* create(u32, JKRHeap*, bool);
};
+32
View File
@@ -3,4 +3,36 @@
#include "dolphin/types.h"
namespace std {
template <typename A1, typename B1>
struct pair {
A1 a1;
B1 b1;
pair() {
a1 = A1();
b1 = B1();
}
};
} // namespace std
struct TSinCosTable {
std::pair<f32, f32> table[0x2000];
};
struct TAtanTable {
f32 table[1025];
u8 pad[0x1C];
};
struct TAsinAcosTable {
f32 table[1025];
u8 pad[0x1C];
};
namespace JMath {
extern TSinCosTable sincosTable_;
extern TAtanTable atanTable_;
extern TAsinAcosTable asinAcosTable_;
}; // namespace JMath
#endif /* JMATRIGONOMETRIC_H */
-4
View File
@@ -3,8 +3,4 @@
#include "dolphin/types.h"
struct JMath {
static u8 sincosTable_[65536];
};
#endif /* JMATH_H */
+1 -6
View File
@@ -1,14 +1,9 @@
#ifndef C_MALLOC_H
#define C_MALLOC_H
#include "JSystem/JKernel/JKRHeap.h"
#include "dolphin/types.h"
// TODO: move to correct include
struct JKRHeap {
/* 802CE4D4 */ void* alloc(u32, int);
/* 802CE548 */ void free(void*);
};
struct cMl {
static JKRHeap* Heap;
/* 80263220 */ static void init(JKRHeap*);
+9
View File
@@ -1,6 +1,7 @@
#ifndef C_MATH_H
#define C_MATH_H
#include "JSystem/JMath/JMATrigonometric.h"
#include "dolphin/types.h"
s16 cM_rad2s(float);
@@ -16,4 +17,12 @@ float cM_rnd2(void);
float cM_rndF2(float);
float cM_rndFX2(float);
inline f32 cM_scos(s16 s) {
return JMath::sincosTable_.table[static_cast<u16>(s) >> 3].b1;
}
inline f32 cM_ssin(s16 s) {
return JMath::sincosTable_.table[static_cast<u16>(s) >> 3].a1;
}
#endif /* C_MATH_H */
+2
View File
@@ -7,6 +7,8 @@ typedef int (*cPhs__Handler)(void*);
enum cPhs__Step {
cPhs_ZERO_e = 0x00,
cPhs_UNK_1 = 0x01,
cPhs_UNK_2 = 0x02,
// names from Wind Waker debug strings
cPhs_COMPLEATE_e = 0x04,
cPhs_ERROR_e = 0x05,
+4 -2
View File
@@ -4,9 +4,8 @@
#include "dolphin/types.h"
struct SVec {
s16 mX, mY, mZ;
s16 x, y, z;
};
class csXyz : public SVec {
public:
static const csXyz Zero;
@@ -18,6 +17,9 @@ public:
/* 8026745C */ void operator+=(csXyz&);
/* 80267490 */ csXyz operator-(csXyz&);
/* 802674E8 */ csXyz operator*(f32);
s16 GetX() const { return x; }
s16 GetY() const { return y; }
s16 GetZ() const { return z; }
};
#endif /* C_SXYZ_H */
+2 -10
View File
@@ -1,20 +1,12 @@
#ifndef D_D_RESORCE_H
#define D_D_RESORCE_H
#include "JSystem/JKernel/JKRArchive.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "SSystem/SComponent/c_xyz.h"
#include "dolphin/mtx/mtx.h"
#include "dolphin/types.h"
#include "m_Do/m_Do_ext.h"
struct JKRArchive {
/* 802D5CE4 */ void getIdxResource(u32);
/* 802D625C */ void getFileAttribute(u32) const;
/* 802D6684 */ void findIdxResource(u32) const;
/* 802D66AC */ void findNameResource(char const*) const;
/* 802D5ECC */ void readIdxResource(void*, u32, u32);
/* 802D5B38 */ void getGlbResource(u32, char const*, JKRArchive*);
};
#pragma pack(push, 1)
class dRes_info_c {
public:
+2
View File
@@ -447,4 +447,6 @@ struct objectNameInfo {
s8 unkA;
}; // Size: 0xC
const char* dStage_getName2(s16, s8);
#endif /* D_D_STAGE_H */
+11 -3
View File
@@ -34,8 +34,16 @@ public:
/* 0x4EC */ cXyz mScale;
/* 0x4F8 */ cXyz mSpeed;
/* 0x504 */ Mtx* mCullMtx;
/* 0x508 */ cXyz mCullMin;
/* 0x514 */ cXyz mCullMax;
union {
struct {
/* 0x508 */ cXyz mMin;
/* 0x514 */ cXyz mMax;
} mBox;
struct {
/* 0x508 */ cXyz mCenter;
/* 0x514 */ f32 mRadius;
} mSphere;
} mCull;
/* 0x520 */ u8 unk_0x520[0xC];
/* 0x52C */ f32 mSpeedF;
/* 0x530 */ f32 mGravity;
@@ -50,4 +58,4 @@ public:
const csXyz& getAngle() const { return mCurrent.mAngle; }
}; // Size: unknown
#endif
#endif
+20 -22
View File
@@ -2,6 +2,7 @@
#define F_OP_ACTOR_MNG_H_
#include "JSystem/J3DGraphAnimator/J3DModelData.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "SSystem/SComponent/c_m3d_g_pla.h"
#include "SSystem/SComponent/c_sxyz.h"
#include "SSystem/SComponent/c_xyz.h"
@@ -13,38 +14,36 @@
#include "f_pc/f_pc_searcher.h"
#include "f_pc/f_pc_stdcreate_req.h"
class J3DModelData; // placeholder
struct fopAcM_prm_class {
/* 0x00 */ u32 unk_0x00;
/* 0x04 */ cXyz unk_0x04;
/* 0x10 */ csXyz unk_0x10;
/* 0x16 */ u16 unk_0x16;
/* 0x18 */ u8 unk_0x18;
/* 0x19 */ u8 unk_0x19;
/* 0x1A */ u8 unk_0x1A;
/* 0x1B */ u8 unk_0x1B;
/* 0x1C */ s32 unk_0x1C;
/* 0x20 */ s8 unk_0x20;
/* 0x21 */ s8 unk_0x21;
/* 0x22 */ u8 unk_0x22;
/* 0x23 */ u8 unk_0x23;
/* 0x00 */ u32 mParameter; // single U32 Parameter
/* 0x04 */ cXyz mPos;
/* 0x10 */ csXyz mAngle; // rotation
/* 0x16 */ u16 mEnemyNo;
/* 0x18 */ u8 mScale[3];
/* 0x1B */ u8 mGbaName; // from WW, maybe a different parameter here
/* 0x1C */ s32 mParentPId; // parent process ID
/* 0x20 */ s8 mSubtype;
/* 0x21 */ s8 mRoomNo;
};
class fopAcM_lc_c {
public:
static bool lineCheck(const cXyz*, const cXyz*, const fopAc_ac_c*);
static u8 mLineCheck[112];
};
class fopAcM_rc_c {
public:
static bool roofCheck(const cXyz*);
static u8 mRoofCheck[80];
static f32 mRoofY;
};
class fopAcM_gc_c {
public:
static bool gndCheck(const cXyz*);
static u8 mGndCheck[84];
static f32 mGroundY;
};
@@ -52,7 +51,6 @@ public:
class fopAcM_wt_c {
public:
static bool waterCheck(const cXyz*);
static u8 mWaterCheck[84 + 4 /* padding */];
static f32 mWaterY[1 + 1 /* padding */];
};
@@ -145,7 +143,7 @@ s32 fopAcM_getItemEventPartner(const fopAc_ac_c*);
s32 fopAcM_getEventPartner(const fopAc_ac_c*);
s32 fopAcM_createItemForPresentDemo(const cXyz*, int, u8, int, int, const csXyz*, const cXyz*);
s32 fopAcM_createItemForTrBoxDemo(const cXyz*, int, int, int, const csXyz*, const cXyz*);
s32 fopAcM_getItemNoFromTableNo(u8);
// s32 fopAcM_getItemNoFromTableNo(u8);
s32 fopAcM_createItemFromEnemyID(u8, const cXyz*, int, int, const csXyz*, const cXyz*, f32*, f32*);
s32 fopAcM_createItemFromTable(const cXyz*, int, int, int, const csXyz*, int, const cXyz*, f32*,
f32*, bool);
@@ -172,11 +170,11 @@ s32 fopAcM_effSmokeSet1(u32*, u32*, const cXyz*, const csXyz*, f32, const dKy_te
s32 fopAcM_effHamonSet(u32*, const cXyz*, f32, f32);
s32 fopAcM_riverStream(cXyz*, s16*, f32*, f32);
s32 fopAcM_carryOffRevise(fopAc_ac_c*);
void vectle_calc(const DOUBLE_POS*, cXyz*);
void get_vectle_calc(const cXyz*, const cXyz*, cXyz*);
// void vectle_calc(const DOUBLE_POS*, cXyz*);
// void get_vectle_calc(const cXyz*, const cXyz*, cXyz*);
void fopAcM_setEffectMtx(const fopAc_ac_c*, const J3DModelData*);
const char* fopAcM_getProcNameString(const fopAc_ac_c*);
s32 fopAcM_findObjectCB(const fopAc_ac_c*, void*);
static const char* fopAcM_getProcNameString(const fopAc_ac_c*);
// s32 fopAcM_findObjectCB(const fopAc_ac_c*, void*);
s32 fopAcM_searchFromName(const char*, u32, u32);
s32 fopAcM_findObject4EventCB(fopAc_ac_c*, void*);
s32 fopAcM_searchFromName4Event(const char*, s16);
@@ -290,4 +288,4 @@ void fopAcM_GetID__FPCv(void); // mostly inlined
void fopAcM_GetParam__FPCv(void); // mostly inlined
}
#endif
#endif
+2 -2
View File
@@ -14,12 +14,12 @@ void fopScnRq_ReRequest(void);
class scene_request_class {
public:
node_create_request mCrtReq;
u32 mFadeRequest;
u32 mFadeRequest; // TODO: type is wrong
request_of_phase_process_class mReqPhsProcCls;
u8 field_0x70[4];
};
scene_request_class* fopScnRq_phase_ClearOverlap(scene_request_class* param_1);
// cPhs__Step fopScnRq_phase_ClearOverlap(scene_request_class* param_1);
s32 fopScnRq_Request(int, scene_class*, s16, void*, s16, u16);
s32 fopScnRq_ReRequest(unsigned int, s16, void*);
void fopScnRq_Handler(void);
+8
View File
@@ -128,4 +128,12 @@ private:
/* 0x4 */ J3DAnmTransform* mAnmTransform;
}; // Size = 0x8
JKRSolidHeap* mDoExt_createSolidHeapFromGame(u32, u32);
void mDoExt_destroySolidHeap(JKRSolidHeap*);
u32 mDoExt_adjustSolidHeap(JKRSolidHeap*);
void mDoExt_restoreCurrentHeap();
JKRHeap* mDoExt_getGameHeap();
void mDoExt_destroySolidHeap(JKRSolidHeap*);
JKRHeap* mDoExt_setCurrentHeap(JKRHeap*);
#endif /* M_DO_M_DO_EXT_H */
+9
View File
@@ -1,6 +1,15 @@
#ifndef M_DO_M_DO_LIB_H
#define M_DO_M_DO_LIB_H
#include "JSystem/J3DU/J3DUClipper.h"
#include "dolphin/types.h"
struct mDoLib_clipper {
/* 8001528C */ void setup(f32, f32, f32, f32);
static J3DUClipper mClipper;
static f32 mSystemFar;
static f32 mFovyRate;
};
#endif /* M_DO_M_DO_LIB_H */