Match f_op_scene, fix profile structs

This commit is contained in:
Jasper St. Pierre 2022-12-30 16:43:15 -08:00
parent 6fec278add
commit 00e2711fc9
26 changed files with 108 additions and 133 deletions

View File

@ -1,31 +0,0 @@
lbl_8001EC00:
/* 8001EC00 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 8001EC04 7C 08 02 A6 */ mflr r0
/* 8001EC08 90 01 00 14 */ stw r0, 0x14(r1)
/* 8001EC0C 93 E1 00 0C */ stw r31, 0xc(r1)
/* 8001EC10 7C 7F 1B 78 */ mr r31, r3
/* 8001EC14 88 03 00 0C */ lbz r0, 0xc(r3)
/* 8001EC18 7C 00 07 75 */ extsb. r0, r0
/* 8001EC1C 40 82 00 38 */ bne lbl_8001EC54
/* 8001EC20 80 7F 00 10 */ lwz r3, 0x10(r31)
/* 8001EC24 80 03 00 20 */ lwz r0, 0x20(r3)
/* 8001EC28 90 1F 01 AC */ stw r0, 0x1ac(r31)
/* 8001EC2C 38 7F 01 B0 */ addi r3, r31, 0x1b0
/* 8001EC30 7F E4 FB 78 */ mr r4, r31
/* 8001EC34 48 00 05 55 */ bl fopScnTg_Init__FP15scene_tag_classPv
/* 8001EC38 38 7F 01 B0 */ addi r3, r31, 0x1b0
/* 8001EC3C 48 00 05 21 */ bl fopScnTg_ToQueue__FP15scene_tag_class
/* 8001EC40 80 7F 00 AC */ lwz r3, 0xac(r31)
/* 8001EC44 28 03 00 00 */ cmplwi r3, 0
/* 8001EC48 41 82 00 0C */ beq lbl_8001EC54
/* 8001EC4C 80 03 00 00 */ lwz r0, 0(r3)
/* 8001EC50 90 1F 00 B0 */ stw r0, 0xb0(r31)
lbl_8001EC54:
/* 8001EC54 80 7F 01 AC */ lwz r3, 0x1ac(r31)
/* 8001EC58 7F E4 FB 78 */ mr r4, r31
/* 8001EC5C 48 00 38 71 */ bl fpcMtd_Create__FP20process_method_classPv
/* 8001EC60 83 E1 00 0C */ lwz r31, 0xc(r1)
/* 8001EC64 80 01 00 14 */ lwz r0, 0x14(r1)
/* 8001EC68 7C 08 03 A6 */ mtlr r0
/* 8001EC6C 38 21 00 10 */ addi r1, r1, 0x10
/* 8001EC70 4E 80 00 20 */ blr

View File

@ -63,6 +63,7 @@ public:
/* 8025854C */ void setRenderMode();
public:
/* 0x1C4 */ request_of_phase_process_class field_0x1c4;
/* 0x1CC */ mDoDvdThd_toMainRam_c* sceneCommand;
/* 0x1D0 */ JKRExpHeap* field_0x1d0;
/* 0x1D4 */ JKRExpHeap* field_0x1d4;

View File

@ -72,6 +72,7 @@ public:
static s8 pauseTimer;
static s8 nextPauseTimer;
/* 0x1C4 */ request_of_phase_process_class field_0x1c4;
/* 0x1CC */ mDoDvdThd_toMainRam_c* sceneCommand;
/* 0x1D0 */ mDoDvdThd_mountXArchive_c* field_0x1d0;
/* 0x1D4 */ u8 field_0x1d4;

View File

@ -7,6 +7,15 @@
#include "dolphin/mtx/mtx.h"
#include "f_pc/f_pc_leaf.h"
struct actor_process_profile_definition {
/* 0x00 */ leaf_process_profile_definition mBase;
/* 0x24 */ leafdraw_method_class* mSubMtd;
/* 0x28 */ int field_0x28; // mStatus
/* 0x2C */ u8 field_0x2c; // mActorType
/* 0x2D */ u8 field_0x2d; // mCullType
/* 0x2E */ u8 field_0x2e[2]; // Likely padding
};
struct JKRSolidHeap;
class dEvt_info_c {

View File

@ -3,6 +3,11 @@
#include "f_op/f_op_camera_mng.h"
struct camera_process_profile_definition {
/* 0x00 */ view_process_profile_definition mBase;
/* 0x3C */ leafdraw_method_class* mSubMtd; // Subclass methods
};
static s32 fopCam_Draw(camera_class* param_1);
static int fopCam_Execute(camera_class* pCamera);
int fopCam_IsDelete(camera_class* pCamera);

View File

@ -5,6 +5,11 @@
#include "dolphin/types.h"
#include "f_op/f_op_actor.h"
struct msg_process_profile_definition {
/* 0x00 */ leaf_process_profile_definition mBase;
/* 0x24 */ leafdraw_method_class* mSubMtd; // Subclass methods
};
struct fopMsg_prm_class {
/* 0x00 */ fopAc_ac_c* mpActor;
/* 0x04 */ cXyz mPos;

View File

@ -11,15 +11,16 @@
struct request_of_phase_process_class;
class mDoDvdThd_command_c;
typedef struct scene_process_profile_definition {
/* 0x00 */ node_process_profile_definition mBase;
/* 0x20 */ process_method_class* mpMtd; // Subclass methods
} scene_process_profile_definition;
class scene_class {
public:
/* 0x000 */ base_process_class field_0x0;
/* 0x0B8 */ u8 field_0xb8[0x10];
/* 0x0C8 */ u32 field_0xc8;
/* 0x0CC */ u8 field_0xcc[0xE0];
/* 0x1AC */ process_method_class* mpProcessMtd;
/* 0x1B0 */ scene_tag_class field_0x1b0;
/* 0x1C4 */ request_of_phase_process_class field_0x1c4;
/* 0x000 */ process_node_class mBase;
/* 0x1AC */ process_method_class * mpMtd;
/* 0x1B0 */ scene_tag_class mScnTg;
};
#endif

View File

@ -14,7 +14,7 @@ void fopScnM_Init(void);
inline u32 fpcM_LayerID(const void* pProc) {
return fpcBs_Is_JustOfType(g_fpcNd_type, ((base_process_class*)pProc)->mSubType) != FALSE ?
((scene_class*)pProc)->field_0xc8 :
((scene_class*)pProc)->mBase.mLayer.mLayerID :
0xFFFFFFFF;
}

View File

@ -6,6 +6,16 @@
#include "dolphin/types.h"
#include "f_pc/f_pc_leaf.h"
struct view_process_profile_definition {
/* 0x00 */ leaf_process_profile_definition mBase;
/* 0x24 */ leafdraw_method_class* mSubMtd; // Subclass methods
/* 0x28 */ u32 unk28;
/* 0x2C */ u32 unk2C;
/* 0x30 */ u32 unk30;
/* 0x34 */ u32 unk34;
/* 0x38 */ u32 unk38;
};
class lookat_class {
public:
/* 0x00 */ cXyz mEye;

View File

@ -11,14 +11,14 @@ struct process_method_tag_class;
typedef struct process_node_class process_node_class;
typedef struct layer_class {
node_class mNode;
u32 mLayerID;
node_lists_tree_class mNodeListTree;
process_node_class* mpPcNode;
node_list_class mCancelList;
/* 0x00 */ node_class mNode;
/* 0x0C */ u32 mLayerID;
/* 0x10 */ node_lists_tree_class mNodeListTree;
/* 0x18 */ process_node_class* mpPcNode;
/* 0x1C */ node_list_class mCancelList;
struct {
s16 mCreatingCount;
s16 mDeletingCount;
/* 0x28 */ s16 mCreatingCount;
/* 0x2A */ s16 mDeletingCount;
} counts;
} layer_class;

View File

@ -22,12 +22,9 @@ typedef struct leafdraw_class {
typedef struct leaf_process_profile_definition {
/* 0x00 */ process_profile_definition mBase;
/* 0x28 */ int field_0x28;
/* 0x2C */ u8 field_0x2c;
/* 0x2D */ u8 field_0x2d;
/* 0x2E */ u8 field_0x2e[0x2]; // extended from here to end to make fopCam_Create match. might be wrong
/* 0x30 */ u8 field_0x30[0xc];
/* 0x3C */ leafdraw_method_class* mMethods;
/* 0x1C */ leafdraw_method_class* mSubMtd; // Subclass methods
/* 0x20 */ s16 mPriority; // mDrawPriority
/* 0x22 */ u8 unk22[2]; // Likely padding...
} leaf_process_profile_definition;
s16 fpcLf_GetPriority(const leafdraw_class* pLeaf);

View File

@ -54,8 +54,8 @@ inline bool fpcM_IsFirstCreating(void* proc) {
return ((base_process_class*)proc)->mInitState == 0;
}
inline leaf_process_profile_definition* fpcM_GetProfile(void* proc) {
return (leaf_process_profile_definition*)((base_process_class*)proc)->mpProf;
inline process_profile_definition* fpcM_GetProfile(void* proc) {
return (process_profile_definition*)((base_process_class*)proc)->mpProf;
}
inline void* fpcM_GetAppend(const void* proc) {

View File

@ -8,19 +8,20 @@
typedef struct nodedraw_method_class {
process_method_class mBase;
process_method_func mNodedrawFunc;
process_method_func mpDrawFunc;
} nodedraw_method_class;
typedef struct process_node_class {
base_process_class mBase;
nodedraw_method_class* mpNodeMtd;
layer_class mLayer;
node_list_class mLayerNodeLists[16];
s8 mUnk0;
/* 0x00 */ base_process_class mBase;
/* 0xB8 */ nodedraw_method_class* mpNodeMtd;
/* 0xBC */ layer_class mLayer;
/* 0xE8 */ node_list_class mLayerNodeLists[16];
/* 0x1A8 */ s8 mUnk0;
} process_node_class;
typedef struct node_process_profile_definition {
process_profile_definition mBase;
/* 0x00 */ process_profile_definition mBase;
/* 0x1C */ process_method_class* mSubMtd; // Subclass methods
} node_process_profile_definition;
s32 fpcNd_DrawMethod(nodedraw_method_class* pNodeMethod, void* pData);

View File

@ -14,14 +14,10 @@ typedef struct process_profile_definition {
/* 0x06 */ u16 mListPrio;
/* 0x08 */ s16 mProcName;
/* 0x0A */ s16 unkA; // probably padding
/* 0x0C */ struct process_method_class* mpPcMtd;
/* 0x0C */ process_method_class* mSubMtd; // Subclass methods
/* 0x10 */ s32 mSize;
/* 0x14 */ s32 mSizeOther;
/* 0x18 */ s32 mParameters;
/* 0x1C */ leafdraw_method_class* mLfDrwMth;
/* 0x20 */ s16 mPriority;
/* 0x22 */ u8 unk22[2];
/* 0x24 */ leafdraw_method_class* mMethods;
} process_profile_definition;
#define LAYER_DEFAULT (-2)

View File

@ -1426,13 +1426,14 @@ SECTION_DATA static leafdraw_method_class l_dMeter2_Method = {
};
/* 803BFA68-803BFA90 -00001 0028+00 0/0 0/0 1/0 .data g_profile_METER2 */
SECTION_DATA extern process_profile_definition g_profile_METER2 = {
SECTION_DATA extern msg_process_profile_definition g_profile_METER2 = {
-3, 12,
-3, 0x0316,
0, (process_method_class*)&g_fpcLf_Method,
0x4C0, 0,
0, &g_fopMsg_Method,
0x0301, 0,
0, &l_dMeter2_Method};
0, &l_dMeter2_Method
};
/* 80399338-80399338 025998 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */

View File

@ -91,6 +91,7 @@ public:
/* 802590F8 */ void changeGameScene();
private:
/* 0x1C4 */ request_of_phase_process_class field_0x1c4;
/* 0x1CC */ JKRExpHeap* mHeap;
/* 0x1D0 */ JKRExpHeap* field_0x1d0;
/* 0x1D4 */ dScnName_camera_c mCamera;

View File

@ -271,7 +271,7 @@ static int fopAc_Create(void* actor) {
fopAc_ac_c* ac = (fopAc_ac_c*)actor;
if (fpcM_IsFirstCreating(actor)) {
leaf_process_profile_definition* profile = (leaf_process_profile_definition*) fpcM_GetProfile(actor);
actor_process_profile_definition* profile = (actor_process_profile_definition*) fpcM_GetProfile(actor);
ac->mAcType = fpcBs_MakeOfType(&g_fopAc_type);
ac->mSubMtd = (profile_method_class*)profile->mBase.mMethods;

View File

@ -9,6 +9,7 @@
#include "dol2asm.h"
#include "dolphin/types.h"
#include "f_op/f_op_draw_tag.h"
#include "f_op/f_op_msg_mng.h"
#include "f_pc/f_pc_leaf.h"
/* 8001E140-8001E180 018A80 0040+00 1/0 0/0 0/0 .text fopCam_Draw__FP12camera_class */
@ -59,8 +60,8 @@ static int fopCam_Create(void* i_actorP) {
if (fpcM_IsFirstCreating(i_actorP)) {
// TODO: This should be camera_process_profile_definition
leaf_process_profile_definition* profile = (leaf_process_profile_definition*) fpcM_GetProfile(i_actorP);
camera->mpMtd = profile->mMethods;
camera_process_profile_definition* profile = (camera_process_profile_definition*) fpcM_GetProfile(i_actorP);
camera->mpMtd = profile->mSubMtd;
fopDwTg_Init(&camera->mCreateTag, camera);
u32* append = (u32*)fpcM_GetAppend(camera);

View File

@ -91,8 +91,7 @@ int fopMsg_Create(void* data) {
msg_class *msg = (msg_class*)data;
if (fpcM_IsFirstCreating(msg)) {
// TODO: This should be msg_process_profile_definition
leaf_process_profile_definition* profile = (leaf_process_profile_definition*) fpcM_GetProfile(msg);
msg_process_profile_definition* profile = (msg_process_profile_definition*) fpcM_GetProfile(msg);
msg->mMsgType = fpcBs_MakeOfType(&fopMsg_MSG_TYPE);
msg->mSubMtd = profile->mMethods;
fopDwTg_Init(&msg->mDwTg, msg);

View File

@ -4,80 +4,58 @@
//
#include "f_op/f_op_scene.h"
#include "f_op/f_op_scene_tag.h"
#include "f_pc/f_pc_manager.h"
#include "dol2asm.h"
#include "dolphin/types.h"
//
// Forward References:
//
extern "C" static void fopScn_Draw__FP11scene_class();
extern "C" static void fopScn_Execute__FP11scene_class();
extern "C" static void fopScn_IsDelete__FPv();
extern "C" static void fopScn_Delete__FPv();
extern "C" static void fopScn_Create__FPv();
extern "C" extern void* g_fopScn_Method[5 + 1 /* padding */];
//
// External References:
//
extern "C" void fopScnTg_QueueTo__FP15scene_tag_class();
extern "C" void fopScnTg_ToQueue__FP15scene_tag_class();
extern "C" void fopScnTg_Init__FP15scene_tag_classPv();
extern "C" void fpcMtd_Execute__FP20process_method_classPv();
extern "C" void fpcMtd_IsDelete__FP20process_method_classPv();
extern "C" void fpcMtd_Delete__FP20process_method_classPv();
extern "C" void fpcMtd_Create__FP20process_method_classPv();
extern "C" void fpcNd_DrawMethod__FP21nodedraw_method_classPv();
//
// Declarations:
//
/* 8001EB34-8001EB5C 019474 0028+00 1/0 0/0 0/0 .text fopScn_Draw__FP11scene_class */
static void fopScn_Draw(scene_class* pScene) {
fpcNd_DrawMethod((nodedraw_method_class*)pScene->mpProcessMtd, pScene);
fpcNd_DrawMethod((nodedraw_method_class*)pScene->mpMtd, pScene);
}
/* 8001EB5C-8001EB84 01949C 0028+00 1/0 0/0 0/0 .text fopScn_Execute__FP11scene_class */
static void fopScn_Execute(scene_class* pScene) {
fpcMtd_Execute(pScene->mpProcessMtd, pScene);
fpcMtd_Execute(pScene->mpMtd, pScene);
}
/* 8001EB84-8001EBAC 0194C4 0028+00 1/0 0/0 0/0 .text fopScn_IsDelete__FPv */
static s32 fopScn_IsDelete(void* param_1) {
return fpcMtd_IsDelete(((scene_class*)param_1)->mpProcessMtd, param_1);
static s32 fopScn_IsDelete(scene_class* pScene) {
return fpcMtd_IsDelete(pScene->mpMtd, pScene);
}
/* 8001EBAC-8001EC00 0194EC 0054+00 1/0 0/0 0/0 .text fopScn_Delete__FPv */
static s32 fopScn_Delete(void* param_1) {
scene_class* pScene = (scene_class*)param_1;
s32 ret = fpcMtd_Delete(pScene->mpProcessMtd, pScene);
s32 ret = fpcMtd_Delete(pScene->mpMtd, pScene);
if (ret == 1) {
fopScnTg_QueueTo(&pScene->field_0x1b0);
fopScnTg_QueueTo(&pScene->mScnTg);
}
return ret;
}
/* 8001EC00-8001EC74 019540 0074+00 1/0 0/0 0/0 .text fopScn_Create__FPv */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
static asm void fopScn_Create(void* param_0) {
nofralloc
#include "asm/f_op/f_op_scene/fopScn_Create__FPv.s"
static s32 fopScn_Create(scene_class * pScene) {
if (fpcM_IsFirstCreating(pScene)) {
scene_process_profile_definition* profile = (scene_process_profile_definition*) fpcM_GetProfile(pScene);
pScene->mpMtd = profile->mpMtd;
fopScnTg_Init(&pScene->mScnTg, pScene);
fopScnTg_ToQueue(&pScene->mScnTg);
if (pScene->mBase.mBase.mpUserData != NULL) {
pScene->mBase.mBase.mParameters = *(u32*)pScene->mBase.mBase.mpUserData;
}
}
return fpcMtd_Create(pScene->mpMtd, pScene);
}
#pragma pop
/* ############################################################################################## */
/* 803A38B0-803A38C8 -00001 0014+04 0/0 9/0 0/0 .data g_fopScn_Method */
SECTION_DATA extern void* g_fopScn_Method[5 + 1 /* padding */] = {
(void*)fopScn_Create,
(void*)fopScn_Delete,
(void*)fopScn_Execute,
(void*)fopScn_IsDelete,
(void*)fopScn_Draw,
/* padding */
NULL,
nodedraw_method_class g_fopScn_Method = {
(process_method_func)fopScn_Create,
(process_method_func)fopScn_Delete,
(process_method_func)fopScn_Execute,
(process_method_func)fopScn_IsDelete,
(process_method_func)fopScn_Draw,
};

View File

@ -27,7 +27,7 @@ int fopScnPause_Enable(scene_class* pScene) {
/* 80020594-8002064C 01AED4 00B8+00 0/0 2/2 0/0 .text fopScnPause_Disable__FP11scene_class */
int fopScnPause_Disable(scene_class* pScene) {
if (pScene) {
void* tmp = (void*)pScene->field_0x0.mLyTg.mpLayer->mpPcNode;
void* tmp = (void*)pScene->mBase.mBase.mLyTg.mpLayer->mpPcNode;
if (!tmp) {
fpcM_PauseDisable(pScene, 1);

View File

@ -78,7 +78,7 @@ static void fopScnRq_Execute(scene_request_class* pScnRq) {
static int fopScnRq_PostMethod(void* param_1, scene_request_class* pScnRq) {
if (pScnRq->mFadeRequest) {
fopScnPause_Enable((scene_class*)param_1);
fopOvlpM_ToldAboutID(((scene_class*)param_1)->field_0x0.mBsPcId);
fopOvlpM_ToldAboutID(((scene_class*)param_1)->mBase.mBase.mBsPcId);
}
return 1;
}

View File

@ -104,7 +104,7 @@ base_process_class* fpcBs_Create(s16 pProcTypeID, unsigned int pProcID, void* pD
procClass->mBsType = fpcBs_MakeOfType(&g_fpcBs_type);
procClass->mProcName = procProfDef->mProcName;
fpcPause_Init(procClass);
procClass->mpPcMtd = procProfDef->mpPcMtd;
procClass->mpPcMtd = procProfDef->mSubMtd;
procClass->mpProf = procProfDef;
procClass->mpUserData = pData;
procClass->mParameters = procProfDef->mParameters;

View File

@ -22,9 +22,9 @@ s32 fpcDw_Execute(base_process_class* pProc) {
process_method_func func;
curLay = fpcLy_CurrentLayer();
if (fpcBs_Is_JustOfType(g_fpcLf_type, pProc->mSubType)) {
func = ((nodedraw_method_class*)pProc->mpPcMtd)->mNodedrawFunc;
func = ((leafdraw_method_class*)pProc->mpPcMtd)->mpDrawFunc;
} else {
func = ((nodedraw_method_class*)pProc->mpPcMtd)->mNodedrawFunc;
func = ((nodedraw_method_class*)pProc->mpPcMtd)->mpDrawFunc;
}
fpcLy_SetCurrentLayer(pProc->mLyTg.mpLayer);
ret = func(pProc);

View File

@ -55,10 +55,10 @@ int g_fpcLf_type;
/* 80021B14-80021B88 0074+00 s=1 e=0 z=0 None .text fpcLf_Create__FP14leafdraw_class */
s32 fpcLf_Create(leafdraw_class* pLeaf) {
process_profile_definition* profDef;
leaf_process_profile_definition* profDef;
if (pLeaf->mBase.mInitState == 0) {
profDef = (process_profile_definition*)pLeaf->mBase.mpProf;
pLeaf->mpDrawMtd = profDef->mLfDrwMth;
profDef = (leaf_process_profile_definition*)pLeaf->mBase.mpProf;
pLeaf->mpDrawMtd = profDef->mSubMtd;
pLeaf->mBase.mSubType = fpcBs_MakeOfType(&g_fpcLf_type);
fpcDwPi_Init(&pLeaf->mDwPi, profDef->mPriority);
pLeaf->mbUnk0 = 0;

View File

@ -15,7 +15,7 @@
/* 800224F0-80022514 0024+00 s=1 e=1 z=0 None .text fpcNd_DrawMethod__FP21nodedraw_method_classPv
*/
s32 fpcNd_DrawMethod(nodedraw_method_class* pNodeMethod, void* pData) {
return fpcMtd_Method(pNodeMethod->mNodedrawFunc, pData);
return fpcMtd_Method(pNodeMethod->mpDrawFunc, pData);
}
/* 80022514-80022580 006C+00 s=1 e=0 z=0 None .text fpcNd_Draw__FP18process_node_class */
@ -104,7 +104,7 @@ s32 fpcNd_Create(process_node_class* pProcNode1) {
node_process_profile_definition* pProcProfileDef =
(node_process_profile_definition*)pProcNode->mBase.mpProf;
pProcNode->mBase.mSubType = fpcBs_MakeOfType(&g_fpcNd_type);
pProcNode->mpNodeMtd = (nodedraw_method_class*)pProcProfileDef->mBase.mLfDrwMth;
pProcNode->mpNodeMtd = (nodedraw_method_class*)pProcProfileDef->mSubMtd;
fpcLy_Create(&pProcNode->mLayer, pProcNode, pProcNode->mLayerNodeLists, 0x10);
pProcNode->mUnk0 = 0;
}