diff options
| author | lepelog <lepelog@users.noreply.github.com> | 2021-06-02 14:13:31 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-02 08:13:31 -0400 |
| commit | b728ec1ef544571b02ef5fe05f418b9935c2b071 (patch) | |
| tree | d9eff34f05e9f50033a1361745a98571f7354346 /include | |
| parent | e915df66c806bdff65aa243649f7abfe6cc19227 (diff) | |
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
Diffstat (limited to 'include')
| -rw-r--r-- | include/JSystem/J3DGraphBase/J3DSys.h | 28 | ||||
| -rw-r--r-- | include/JSystem/J3DU/J3DUClipper.h | 22 | ||||
| -rw-r--r-- | include/JSystem/JKernel/JKRExpHeap.h | 9 | ||||
| -rw-r--r-- | include/JSystem/JKernel/JKRSolidHeap.h | 3 | ||||
| -rw-r--r-- | include/JSystem/JMath/JMATrigonometric.h | 32 | ||||
| -rw-r--r-- | include/JSystem/JMath/JMath.h | 4 | ||||
| -rw-r--r-- | include/SSystem/SComponent/c_malloc.h | 7 | ||||
| -rw-r--r-- | include/SSystem/SComponent/c_math.h | 9 | ||||
| -rw-r--r-- | include/SSystem/SComponent/c_phase.h | 2 | ||||
| -rw-r--r-- | include/SSystem/SComponent/c_sxyz.h | 6 | ||||
| -rw-r--r-- | include/d/d_resorce.h | 12 | ||||
| -rw-r--r-- | include/d/d_stage.h | 2 | ||||
| -rw-r--r-- | include/f_op/f_op_actor.h | 14 | ||||
| -rw-r--r-- | include/f_op/f_op_actor_mng.h | 42 | ||||
| -rw-r--r-- | include/f_op/f_op_scene_req.h | 4 | ||||
| -rw-r--r-- | include/m_Do/m_Do_ext.h | 8 | ||||
| -rw-r--r-- | include/m_Do/m_Do_lib.h | 9 |
17 files changed, 159 insertions, 54 deletions
diff --git a/include/JSystem/J3DGraphBase/J3DSys.h b/include/JSystem/J3DGraphBase/J3DSys.h index 73cef8bde9..9320bcdd02 100644 --- a/include/JSystem/J3DGraphBase/J3DSys.h +++ b/include/JSystem/J3DGraphBase/J3DSys.h @@ -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 */ diff --git a/include/JSystem/J3DU/J3DUClipper.h b/include/JSystem/J3DU/J3DUClipper.h index d9d67d386a..072bbe337a 100644 --- a/include/JSystem/J3DU/J3DUClipper.h +++ b/include/JSystem/J3DU/J3DUClipper.h @@ -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 */ diff --git a/include/JSystem/JKernel/JKRExpHeap.h b/include/JSystem/JKernel/JKRExpHeap.h index 57fad0b8f6..dcadbef8d4 100644 --- a/include/JSystem/JKernel/JKRExpHeap.h +++ b/include/JSystem/JKernel/JKRExpHeap.h @@ -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 */ diff --git a/include/JSystem/JKernel/JKRSolidHeap.h b/include/JSystem/JKernel/JKRSolidHeap.h index c190314459..a61e8cc78b 100644 --- a/include/JSystem/JKernel/JKRSolidHeap.h +++ b/include/JSystem/JKernel/JKRSolidHeap.h @@ -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); }; diff --git a/include/JSystem/JMath/JMATrigonometric.h b/include/JSystem/JMath/JMATrigonometric.h index e47f6ef294..79d3798ed2 100644 --- a/include/JSystem/JMath/JMATrigonometric.h +++ b/include/JSystem/JMath/JMATrigonometric.h @@ -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 */ diff --git a/include/JSystem/JMath/JMath.h b/include/JSystem/JMath/JMath.h index 228c129d1c..802d24f2aa 100644 --- a/include/JSystem/JMath/JMath.h +++ b/include/JSystem/JMath/JMath.h @@ -3,8 +3,4 @@ #include "dolphin/types.h" -struct JMath { - static u8 sincosTable_[65536]; -}; - #endif /* JMATH_H */ diff --git a/include/SSystem/SComponent/c_malloc.h b/include/SSystem/SComponent/c_malloc.h index c7ca63e5a3..0732d73266 100644 --- a/include/SSystem/SComponent/c_malloc.h +++ b/include/SSystem/SComponent/c_malloc.h @@ -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*); diff --git a/include/SSystem/SComponent/c_math.h b/include/SSystem/SComponent/c_math.h index 25aa15451c..632fa9091e 100644 --- a/include/SSystem/SComponent/c_math.h +++ b/include/SSystem/SComponent/c_math.h @@ -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 */ diff --git a/include/SSystem/SComponent/c_phase.h b/include/SSystem/SComponent/c_phase.h index 0c7bcc7c9c..5ab4f80537 100644 --- a/include/SSystem/SComponent/c_phase.h +++ b/include/SSystem/SComponent/c_phase.h @@ -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, diff --git a/include/SSystem/SComponent/c_sxyz.h b/include/SSystem/SComponent/c_sxyz.h index 51d8beafde..61843437ef 100644 --- a/include/SSystem/SComponent/c_sxyz.h +++ b/include/SSystem/SComponent/c_sxyz.h @@ -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 */ diff --git a/include/d/d_resorce.h b/include/d/d_resorce.h index de0b4315aa..41ba119581 100644 --- a/include/d/d_resorce.h +++ b/include/d/d_resorce.h @@ -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: diff --git a/include/d/d_stage.h b/include/d/d_stage.h index aeb8a3b23d..ad130ac8d2 100644 --- a/include/d/d_stage.h +++ b/include/d/d_stage.h @@ -447,4 +447,6 @@ struct objectNameInfo { s8 unkA; }; // Size: 0xC +const char* dStage_getName2(s16, s8); + #endif /* D_D_STAGE_H */ diff --git a/include/f_op/f_op_actor.h b/include/f_op/f_op_actor.h index 024f86809d..3a517a5d9e 100644 --- a/include/f_op/f_op_actor.h +++ b/include/f_op/f_op_actor.h @@ -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
\ No newline at end of file +#endif diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index a9ec1550f4..e6b196f887 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -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
\ No newline at end of file +#endif diff --git a/include/f_op/f_op_scene_req.h b/include/f_op/f_op_scene_req.h index 0b8f44d3e8..3968124dce 100644 --- a/include/f_op/f_op_scene_req.h +++ b/include/f_op/f_op_scene_req.h @@ -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); diff --git a/include/m_Do/m_Do_ext.h b/include/m_Do/m_Do_ext.h index aa669108c9..c56cb12b18 100644 --- a/include/m_Do/m_Do_ext.h +++ b/include/m_Do/m_Do_ext.h @@ -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 */ diff --git a/include/m_Do/m_Do_lib.h b/include/m_Do/m_Do_lib.h index 29ffa9032d..c7259619ec 100644 --- a/include/m_Do/m_Do_lib.h +++ b/include/m_Do/m_Do_lib.h @@ -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 */ |
