diff --git a/asm/f_op/f_op_camera/fopCam_Create__FPv.s b/asm/f_op/f_op_camera/fopCam_Create__FPv.s deleted file mode 100644 index a6ef1cd75c5..00000000000 --- a/asm/f_op/f_op_camera/fopCam_Create__FPv.s +++ /dev/null @@ -1,41 +0,0 @@ -lbl_8001E270: -/* 8001E270 94 21 FF F0 */ stwu r1, -0x10(r1) -/* 8001E274 7C 08 02 A6 */ mflr r0 -/* 8001E278 90 01 00 14 */ stw r0, 0x14(r1) -/* 8001E27C 93 E1 00 0C */ stw r31, 0xc(r1) -/* 8001E280 93 C1 00 08 */ stw r30, 8(r1) -/* 8001E284 7C 7F 1B 78 */ mr r31, r3 -/* 8001E288 88 03 00 0C */ lbz r0, 0xc(r3) -/* 8001E28C 7C 00 07 75 */ extsb. r0, r0 -/* 8001E290 40 82 00 30 */ bne lbl_8001E2C0 -/* 8001E294 80 63 00 10 */ lwz r3, 0x10(r3) -/* 8001E298 80 03 00 3C */ lwz r0, 0x3c(r3) -/* 8001E29C 90 1F 02 24 */ stw r0, 0x224(r31) -/* 8001E2A0 38 7F 02 10 */ addi r3, r31, 0x210 -/* 8001E2A4 7F E4 FB 78 */ mr r4, r31 -/* 8001E2A8 48 00 22 4D */ bl fopDwTg_Init__FP16create_tag_classPv -/* 8001E2AC 80 7F 00 AC */ lwz r3, 0xac(r31) -/* 8001E2B0 28 03 00 00 */ cmplwi r3, 0 -/* 8001E2B4 41 82 00 0C */ beq lbl_8001E2C0 -/* 8001E2B8 80 03 00 00 */ lwz r0, 0(r3) -/* 8001E2BC 90 1F 00 B0 */ stw r0, 0xb0(r31) -lbl_8001E2C0: -/* 8001E2C0 80 7F 02 24 */ lwz r3, 0x224(r31) -/* 8001E2C4 7F E4 FB 78 */ mr r4, r31 -/* 8001E2C8 48 00 42 05 */ bl fpcMtd_Create__FP20process_method_classPv -/* 8001E2CC 7C 7E 1B 78 */ mr r30, r3 -/* 8001E2D0 2C 1E 00 04 */ cmpwi r30, 4 -/* 8001E2D4 40 82 00 18 */ bne lbl_8001E2EC -/* 8001E2D8 7F E3 FB 78 */ mr r3, r31 -/* 8001E2DC 48 00 37 25 */ bl fpcLf_GetPriority__FPC14leafdraw_class -/* 8001E2E0 7C 64 07 34 */ extsh r4, r3 -/* 8001E2E4 38 7F 02 10 */ addi r3, r31, 0x210 -/* 8001E2E8 48 00 21 C5 */ bl fopDwTg_ToDrawQ__FP16create_tag_classi -lbl_8001E2EC: -/* 8001E2EC 7F C3 F3 78 */ mr r3, r30 -/* 8001E2F0 83 E1 00 0C */ lwz r31, 0xc(r1) -/* 8001E2F4 83 C1 00 08 */ lwz r30, 8(r1) -/* 8001E2F8 80 01 00 14 */ lwz r0, 0x14(r1) -/* 8001E2FC 7C 08 03 A6 */ mtlr r0 -/* 8001E300 38 21 00 10 */ addi r1, r1, 0x10 -/* 8001E304 4E 80 00 20 */ blr diff --git a/asm/f_op/f_op_camera/fopCam_Execute__FP12camera_class.s b/asm/f_op/f_op_camera/fopCam_Execute__FP12camera_class.s deleted file mode 100644 index d9c86f1d3e5..00000000000 --- a/asm/f_op/f_op_camera/fopCam_Execute__FP12camera_class.s +++ /dev/null @@ -1,20 +0,0 @@ -lbl_8001E180: -/* 8001E180 94 21 FF F0 */ stwu r1, -0x10(r1) -/* 8001E184 7C 08 02 A6 */ mflr r0 -/* 8001E188 90 01 00 14 */ stw r0, 0x14(r1) -/* 8001E18C 7C 64 1B 78 */ mr r4, r3 -/* 8001E190 3C A0 80 40 */ lis r5, g_dComIfG_gameInfo@ha /* 0x804061C0@ha */ -/* 8001E194 38 A5 61 C0 */ addi r5, r5, g_dComIfG_gameInfo@l /* 0x804061C0@l */ -/* 8001E198 88 05 5E B5 */ lbz r0, 0x5eb5(r5) -/* 8001E19C 28 00 00 00 */ cmplwi r0, 0 -/* 8001E1A0 40 82 00 18 */ bne lbl_8001E1B8 -/* 8001E1A4 88 0D 8B A4 */ lbz r0, pauseTimer__9dScnPly_c+0x0(r13) -/* 8001E1A8 7C 00 07 75 */ extsb. r0, r0 -/* 8001E1AC 40 82 00 0C */ bne lbl_8001E1B8 -/* 8001E1B0 80 64 02 24 */ lwz r3, 0x224(r4) -/* 8001E1B4 48 00 42 AD */ bl fpcMtd_Execute__FP20process_method_classPv -lbl_8001E1B8: -/* 8001E1B8 80 01 00 14 */ lwz r0, 0x14(r1) -/* 8001E1BC 7C 08 03 A6 */ mtlr r0 -/* 8001E1C0 38 21 00 10 */ addi r1, r1, 0x10 -/* 8001E1C4 4E 80 00 20 */ blr diff --git a/include/f_op/f_op_camera.h b/include/f_op/f_op_camera.h index f857af2a0d6..99336008cec 100644 --- a/include/f_op/f_op_camera.h +++ b/include/f_op/f_op_camera.h @@ -2,7 +2,9 @@ #define F_F_OP_CAMERA_H_ #include "f_op/f_op_camera_mng.h" + static s32 fopCam_Draw(camera_class* param_1); -static void fopCam_Execute(camera_class* pCamera); +static int fopCam_Execute(camera_class* pCamera); int fopCam_IsDelete(camera_class* pCamera); + #endif \ No newline at end of file diff --git a/include/f_pc/f_pc_leaf.h b/include/f_pc/f_pc_leaf.h index c81df8d181b..05b85796ab4 100644 --- a/include/f_pc/f_pc_leaf.h +++ b/include/f_pc/f_pc_leaf.h @@ -25,6 +25,9 @@ typedef struct leaf_process_profile_definition { /* 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; } leaf_process_profile_definition; s32 fpcLf_GetPriority(const leafdraw_class* pLeaf); diff --git a/src/f_op/f_op_camera.cpp b/src/f_op/f_op_camera.cpp index a1aebfc7334..773d521f4d7 100644 --- a/src/f_op/f_op_camera.cpp +++ b/src/f_op/f_op_camera.cpp @@ -11,35 +11,6 @@ #include "f_op/f_op_draw_tag.h" #include "f_pc/f_pc_leaf.h" -// -// Forward References: -// - -extern "C" static void fopCam_Draw__FP12camera_class(); -extern "C" static void fopCam_Execute__FP12camera_class(); -extern "C" static void fopCam_IsDelete__FP12camera_class(); -extern "C" static void fopCam_Delete__FP12camera_class(); -extern "C" static void fopCam_Create__FPv(); -extern "C" extern void* g_fopCam_Method[5 + 1 /* padding */]; - -// -// External References: -// - -extern "C" void fopDwTg_ToDrawQ__FP16create_tag_classi(); -extern "C" void fopDwTg_DrawQTo__FP16create_tag_class(); -extern "C" void fopDwTg_Init__FP16create_tag_classPv(); -extern "C" void fpcLf_GetPriority__FPC14leafdraw_class(); -extern "C" void fpcLf_DrawMethod__FP21leafdraw_method_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(); - -// -// Declarations: -// - /* 8001E140-8001E180 018A80 0040+00 1/0 0/0 0/0 .text fopCam_Draw__FP12camera_class */ static s32 fopCam_Draw(camera_class* pCamera) { s32 cam_proc = 1; @@ -51,23 +22,15 @@ static s32 fopCam_Draw(camera_class* pCamera) { } /* 8001E180-8001E1C8 018AC0 0048+00 1/0 0/0 0/0 .text fopCam_Execute__FP12camera_class */ -// Matches, but wrong registers -#ifdef NONMATCHING -static void fopCam_Execute(camera_class* pCamera) { +static int fopCam_Execute(camera_class* pCamera) { + int ret; + if (!dComIfGp_isPauseFlag() && dScnPly_c::isPause()) { - fpcMtd_Execute((process_method_class*)pCamera->mpMtd, pCamera); + ret = fpcMtd_Execute((process_method_class*)pCamera->mpMtd, pCamera); } + + return ret; } -#else -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void fopCam_Execute(camera_class* param_0) { - nofralloc -#include "asm/f_op/f_op_camera/fopCam_Execute__FP12camera_class.s" -} -#pragma pop -#endif /* 8001E1C8-8001E21C 018B08 0054+00 1/0 0/0 0/0 .text fopCam_IsDelete__FP12camera_class */ @@ -91,23 +54,37 @@ int fopCam_Delete(camera_class* pCamera) { } /* 8001E270-8001E308 018BB0 0098+00 1/0 0/0 0/0 .text fopCam_Create__FPv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void fopCam_Create(void* param_0) { - nofralloc -#include "asm/f_op/f_op_camera/fopCam_Create__FPv.s" +static int fopCam_Create(void* i_actorP) { + camera_class* camera = (camera_class*)i_actorP; + + if (fpcM_IsFirstCreating(i_actorP)) { + leaf_process_profile_definition* profile = fpcM_GetProfile(i_actorP); + camera->mpMtd = profile->mMethods; + + fopDwTg_Init(&camera->mCreateTag, camera); + u32* append = (u32*)fpcM_GetAppend(camera); + + if (append) { + fpcM_SetParam(camera, *append); + } + } + + int ret = fpcMtd_Create(&camera->mpMtd->mBase, camera); + + if (ret == 4) { + s16 prior = fpcLf_GetPriority(camera); + fopDwTg_ToDrawQ(&camera->mCreateTag, prior); + } + + return ret; } -#pragma pop /* ############################################################################################## */ /* 803A3860-803A3878 -00001 0014+04 0/0 2/0 0/0 .data g_fopCam_Method */ -SECTION_DATA extern void* g_fopCam_Method[5 + 1 /* padding */] = { - (void*)fopCam_Create, - (void*)fopCam_Delete, - (void*)fopCam_Execute, - (void*)fopCam_IsDelete, - (void*)fopCam_Draw, - /* padding */ - NULL, +void* g_fopCam_Method[5] = { + fopCam_Create, + fopCam_Delete, + fopCam_Execute, + fopCam_IsDelete, + fopCam_Draw };