diff --git a/include/f_pc/f_pc_layer_tag.h b/include/f_pc/f_pc_layer_tag.h index 2cf25d03..0ecd8dbe 100644 --- a/include/f_pc/f_pc_layer_tag.h +++ b/include/f_pc/f_pc_layer_tag.h @@ -4,6 +4,13 @@ #include "SSystem/SComponent/c_tag.h" +enum { + fpcLy_ROOT_e = 0, + fpcLy_CURRENT_e = 0xFFFFFFFD, + fpcLy_SPECIAL_e = 0xFFFFFFFE, + fpcLy_NONE_e = 0xFFFFFFFF, +}; + typedef struct layer_class layer_class; typedef struct layer_management_tag_class { diff --git a/include/f_pc/f_pc_manager.h b/include/f_pc/f_pc_manager.h index 28d3f6c9..5b16ccd0 100644 --- a/include/f_pc/f_pc_manager.h +++ b/include/f_pc/f_pc_manager.h @@ -43,7 +43,7 @@ inline s16 fpcM_DrawPriority(const void* param_0) { } inline s32 fpcM_ChangeLayerID(void* proc, int layerID) { - return fpcPi_Change(&((base_process_class*)proc)->mPi, layerID, 0xFFFD, 0xFFFD); + return fpcPi_Change(&((base_process_class*)proc)->mPi, layerID, fpcPi_CURRENT_e, fpcPi_CURRENT_e); } inline s32 fpcM_IsJustType(int type1, int type2) { diff --git a/include/f_pc/f_pc_priority.h b/include/f_pc/f_pc_priority.h index 358ae721..d1ed8f30 100644 --- a/include/f_pc/f_pc_priority.h +++ b/include/f_pc/f_pc_priority.h @@ -4,6 +4,11 @@ #include "f_pc/f_pc_method_tag.h" +enum { + fpcPi_CURRENT_e = 0xFFFD, + fpcPi_SPECIAL_e = 0xFFFE, +}; + typedef struct process_priority_queue_info { u32 mLayer; u16 mListID; diff --git a/src/d/actor/d_a_alldie.cpp b/src/d/actor/d_a_alldie.cpp index 3fd16146..58877555 100644 --- a/src/d/actor/d_a_alldie.cpp +++ b/src/d/actor/d_a_alldie.cpp @@ -135,9 +135,9 @@ static actor_method_class l_daAlldie_Method = { }; extern actor_process_profile_definition g_profile_ALLDIE = { - -3, + fpcLy_CURRENT_e, 2, - 0xFFFD, + fpcPi_CURRENT_e, PROC_ALLDIE, &g_fpcLf_Method.mBase, sizeof(daAlldie_c), diff --git a/src/d/actor/d_a_andsw2.cpp b/src/d/actor/d_a_andsw2.cpp index 390f4b9e..46e8f787 100644 --- a/src/d/actor/d_a_andsw2.cpp +++ b/src/d/actor/d_a_andsw2.cpp @@ -284,9 +284,9 @@ static actor_method_class l_daAndsw2_Method = { }; extern actor_process_profile_definition g_profile_ANDSW2 = { - -3, + fpcLy_CURRENT_e, 7, - 0xFFFD, + fpcPi_CURRENT_e, PROC_ANDSW2, &g_fpcLf_Method.mBase, sizeof(daAndsw2_c), diff --git a/src/d/actor/d_a_item.cpp b/src/d/actor/d_a_item.cpp index c06fd40b..9dc44688 100644 --- a/src/d/actor/d_a_item.cpp +++ b/src/d/actor/d_a_item.cpp @@ -344,9 +344,9 @@ static actor_method_class l_daItem_Method = { }; extern actor_process_profile_definition g_profile_ITEM = { - -3, + fpcLy_CURRENT_e, 7, - 0xFFFD, + fpcPi_CURRENT_e, PROC_ITEM, &g_fpcLf_Method.mBase, sizeof(daItem_c), diff --git a/src/d/actor/d_a_obj_Ygush00.cpp b/src/d/actor/d_a_obj_Ygush00.cpp index 0ddefcae..531562af 100644 --- a/src/d/actor/d_a_obj_Ygush00.cpp +++ b/src/d/actor/d_a_obj_Ygush00.cpp @@ -168,7 +168,7 @@ s32 daObjYgush00_IsDelete(daObjYgush00_c* i_this) { return 1; } -static actor_method_class l_daObjYgush00_Mehtod = { +static actor_method_class l_daObjYgush00_Method = { (process_method_func)daObjYgush00_Create, (process_method_func)daObjYgush00_Delete, (process_method_func)daObjYgush00_Execute, @@ -176,10 +176,10 @@ static actor_method_class l_daObjYgush00_Mehtod = { (process_method_func)daObjYgush00_Draw, }; -extern actor_process_profile_definition g_profile_Obj_Ygish00 = { - -3, +extern actor_process_profile_definition g_profile_Obj_Ygush00 = { + fpcLy_CURRENT_e, 3, - 0xFFFD, + fpcPi_CURRENT_e, PROC_Obj_Ygush00, &g_fpcLf_Method.mBase, sizeof(daObjYgush00_c), @@ -187,7 +187,7 @@ extern actor_process_profile_definition g_profile_Obj_Ygish00 = { 0, &g_fopAc_Method.base, 0x005E, - &l_daObjYgush00_Mehtod, + &l_daObjYgush00_Method, 0x00040100, fopAc_ACTOR_e, fopAc_CULLBOX_CUSTOM_e, diff --git a/src/d/d_s_title.cpp b/src/d/d_s_title.cpp index 430b3f1a..9d443416 100644 --- a/src/d/d_s_title.cpp +++ b/src/d/d_s_title.cpp @@ -51,7 +51,9 @@ static leafdraw_method_class l_dScnTitle_Method = { }; extern scene_process_profile_definition g_profile_TITLE_SCENE = { - 0, 1, -3, + fpcLy_ROOT_e, + 1, + fpcPi_CURRENT_e, PROC_TITLE_SCENE, &g_fpcNd_Method.mBase, sizeof(title_of_scene_class), @@ -62,7 +64,9 @@ extern scene_process_profile_definition g_profile_TITLE_SCENE = { }; extern scene_process_profile_definition g_profile_ENDING_SCENE = { - 0, 1, -3, + fpcLy_ROOT_e, + 1, + fpcPi_CURRENT_e, PROC_ENDING_SCENE, &g_fpcNd_Method.mBase, sizeof(title_of_scene_class), diff --git a/src/f_pc/f_pc_layer.cpp b/src/f_pc/f_pc_layer.cpp index db5bb80f..887d9f88 100644 --- a/src/f_pc/f_pc_layer.cpp +++ b/src/f_pc/f_pc_layer.cpp @@ -4,6 +4,7 @@ // #include "f_pc/f_pc_layer.h" +#include "f_pc/f_pc_layer_tag.h" #include "f_pc/f_pc_method_iter.h" #include "f_pc/f_pc_method_tag.h" @@ -112,9 +113,9 @@ layer_class* fpcLy_Search(unsigned int i_id) { /* 8003D9C4-8003DA34 .text fpcLy_Layer__FUi */ layer_class* fpcLy_Layer(unsigned int i_id) { - if (i_id == 0 || fpcLy_RootLayer()->mLayerID == i_id) { + if (i_id == fpcLy_ROOT_e || fpcLy_RootLayer()->mLayerID == i_id) { return fpcLy_RootLayer(); - } else if (i_id == ~2 || fpcLy_CurrentLayer()->mLayerID == i_id) { + } else if (i_id == fpcLy_CURRENT_e || fpcLy_CurrentLayer()->mLayerID == i_id) { return fpcLy_CurrentLayer(); } else { return fpcLy_Search(i_id); @@ -144,9 +145,6 @@ s32 fpcLy_Cancel(layer_class* i_layer) { /* 8003DB40-8003DC78 .text fpcLy_Create__FP11layer_classPvP15node_list_classi */ void fpcLy_Create(layer_class* i_layer, void* i_node, node_list_class* i_nodeList, int i_numLists) { - void* pvVar1; - s32 iVar2; - static int IsInitOfLayerList = 1; static int layer_id = 0; *i_layer = l_fpcLy_Crear; @@ -158,9 +156,8 @@ void fpcLy_Create(layer_class* i_layer, void* i_node, node_list_class* i_nodeLis cLs_Create(&l_fpcLy_LayerList); fpcLy_SetCurrentLayer(i_layer); } - (i_layer->mNodeListTree).mpLists = i_nodeList; - (i_layer->mNodeListTree).mNumLists = i_numLists; - cTr_Create(&i_layer->mNodeListTree, (i_layer->mNodeListTree).mpLists, - (i_layer->mNodeListTree).mNumLists); + i_layer->mNodeListTree.mpLists = i_nodeList; + i_layer->mNodeListTree.mNumLists = i_numLists; + cTr_Create(&i_layer->mNodeListTree, i_layer->mNodeListTree.mpLists, i_layer->mNodeListTree.mNumLists); fpcLy_Regist(i_layer); } diff --git a/src/f_pc/f_pc_layer_tag.cpp b/src/f_pc/f_pc_layer_tag.cpp index 8b617a74..e69b09d6 100644 --- a/src/f_pc/f_pc_layer_tag.cpp +++ b/src/f_pc/f_pc_layer_tag.cpp @@ -7,27 +7,25 @@ #include "f_pc/f_pc_layer.h" /* 8003DF4C-8003E044 .text fpcLyTg_ToQueue__FP26layer_management_tag_classUiUsUs */ -s32 fpcLyTg_ToQueue(layer_management_tag_class* i_LyTag, unsigned int i_layerID, u16 i_listID, +s32 fpcLyTg_ToQueue(layer_management_tag_class* i_lyTag, unsigned int i_layerID, u16 i_listID, u16 i_listPriority) { - if (i_LyTag->mpLayer == NULL && i_layerID == -1) { + if (i_lyTag->mpLayer == NULL && i_layerID == fpcLy_NONE_e) { return 0; } else { - // ghidra says i_layerID is unsigned? - if (i_layerID != -1 && i_layerID != -3 && i_LyTag->mpLayer->mLayerID != i_layerID) { - i_LyTag->mpLayer = fpcLy_Layer(i_layerID); + if (i_layerID != fpcLy_NONE_e && i_layerID != fpcLy_CURRENT_e && i_lyTag->mpLayer->mLayerID != i_layerID) { + i_lyTag->mpLayer = fpcLy_Layer(i_layerID); } - if (i_layerID == -1 || i_layerID == -3) { - s32 tmp = fpcLy_ToQueue(i_LyTag->mpLayer, i_listID, &i_LyTag->mCreateTag); - if (tmp != 0) { - i_LyTag->mNodeListID = i_listID; - i_LyTag->mNodeListIdx = tmp - 1; + + if (i_layerID == fpcLy_NONE_e || i_layerID == fpcLy_CURRENT_e) { + s32 idx = fpcLy_ToQueue(i_lyTag->mpLayer, i_listID, &i_lyTag->mCreateTag); + if (idx != 0) { + i_lyTag->mNodeListID = i_listID; + i_lyTag->mNodeListIdx = idx - 1; return 1; } - } else if (fpcLy_IntoQueue(i_LyTag->mpLayer, i_listID, &i_LyTag->mCreateTag, - i_listPriority) != 0) - { - i_LyTag->mNodeListID = i_listID; - i_LyTag->mNodeListIdx = i_listPriority; + } else if (fpcLy_IntoQueue(i_lyTag->mpLayer, i_listID, &i_lyTag->mCreateTag, i_listPriority) != 0) { + i_lyTag->mNodeListID = i_listID; + i_lyTag->mNodeListIdx = i_listPriority; return 1; } return 0; @@ -35,11 +33,11 @@ s32 fpcLyTg_ToQueue(layer_management_tag_class* i_LyTag, unsigned int i_layerID, } /* 8003E044-8003E0A4 .text fpcLyTg_QueueTo__FP26layer_management_tag_class */ -s32 fpcLyTg_QueueTo(layer_management_tag_class* i_LyTag) { - if (fpcLy_QueueTo(i_LyTag->mpLayer, &i_LyTag->mCreateTag) == 1) { - i_LyTag->mpLayer = NULL; - i_LyTag->mNodeListID = 0xFFFF; - i_LyTag->mNodeListIdx = 0xFFFF; +s32 fpcLyTg_QueueTo(layer_management_tag_class* i_lyTag) { + if (fpcLy_QueueTo(i_lyTag->mpLayer, &i_lyTag->mCreateTag) == 1) { + i_lyTag->mpLayer = NULL; + i_lyTag->mNodeListID = 0xFFFF; + i_lyTag->mNodeListIdx = 0xFFFF; return 1; } else { return 0; @@ -47,31 +45,31 @@ s32 fpcLyTg_QueueTo(layer_management_tag_class* i_LyTag) { } /* 8003E0A4-8003E128 .text fpcLyTg_Move__FP26layer_management_tag_classUiUsUs */ -s32 fpcLyTg_Move(layer_management_tag_class* i_LyTag, unsigned int i_layerID, u16 i_listID, +s32 fpcLyTg_Move(layer_management_tag_class* i_lyTag, unsigned int i_layerID, u16 i_listID, u16 i_listPriority) { layer_class* layer = fpcLy_Layer(i_layerID); if (layer == NULL) { return 0; - } else if (fpcLyTg_QueueTo(i_LyTag) == 0x1) { - i_LyTag->mpLayer = layer; - return fpcLyTg_ToQueue(i_LyTag, i_layerID, i_listID, i_listPriority); + } else if (fpcLyTg_QueueTo(i_lyTag) == 0x1) { + i_lyTag->mpLayer = layer; + return fpcLyTg_ToQueue(i_lyTag, i_layerID, i_listID, i_listPriority); } else { return 0; } } /* 8003E128-8003E1DC .text fpcLyTg_Init__FP26layer_management_tag_classUiPv */ -s32 fpcLyTg_Init(layer_management_tag_class* i_LyTag, unsigned int i_id, void* i_data) { +s32 fpcLyTg_Init(layer_management_tag_class* i_lyTag, unsigned int i_id, void* i_data) { static layer_management_tag_class crear = { NULL, NULL, NULL, NULL, 0, NULL, 0xFFFF, 0xFFFF, }; layer_class* layer; - *i_LyTag = crear; - cTg_Create(&i_LyTag->mCreateTag, i_data); + *i_lyTag = crear; + cTg_Create(&i_lyTag->mCreateTag, i_data); layer = fpcLy_Layer(i_id); if (layer != NULL) { - i_LyTag->mpLayer = layer; + i_lyTag->mpLayer = layer; return 1; } else { return 0; diff --git a/src/f_pc/f_pc_priority.cpp b/src/f_pc/f_pc_priority.cpp index ee0a5715..19aaf346 100644 --- a/src/f_pc/f_pc_priority.cpp +++ b/src/f_pc/f_pc_priority.cpp @@ -6,6 +6,7 @@ #include "f_pc/f_pc_priority.h" #include "f_pc/f_pc_base.h" #include "f_pc/f_pc_layer.h" +#include "f_pc/f_pc_layer_tag.h" /* 8003FC08-8003FC28 .text fpcPi_IsInQueue__FP22process_priority_class */ s32 fpcPi_IsInQueue(process_priority_class* i_procPriority) { @@ -26,7 +27,7 @@ s32 fpcPi_ToQueue(process_priority_class* i_procPriority) { u32 layer = i_procPriority->mInfoQ.mLayer; if (cTg_Addition(&l_fpcPi_Queue, &i_procPriority->mBase)) { - if (layer != 0xFFFFFFFD) { + if (layer != fpcLy_CURRENT_e) { layer_class* pLayer = fpcLy_Layer(layer); if (!fpcLy_ToCancelQ(pLayer, &i_procPriority->mMtdTag)) { @@ -72,7 +73,7 @@ s32 fpcPi_Delete(process_priority_class* i_procPriority) { /* 8003FD8C-8003FDC0 .text fpcPi_IsNormal__FUiUsUs */ s32 fpcPi_IsNormal(unsigned int i_layer, u16 i_listID, u16 i_priority) { - if ((i_layer < 0xFFFFFFFE) && (i_listID < 0xFFFE) && (i_priority < 0xFFFE)) + if ((i_layer < fpcLy_SPECIAL_e) && (i_listID < fpcPi_SPECIAL_e) && (i_priority < fpcPi_SPECIAL_e)) return 1; return 0; @@ -93,17 +94,17 @@ s32 fpcPi_Change(process_priority_class* i_procPriority, unsigned int i_layer, u i_procPriority->mInfoQ.mListID = i_procPriority->mInfoCurr.mListID; i_procPriority->mInfoQ.mListPrio = i_procPriority->mInfoCurr.mListPrio; - if (i_layer != 0xFFFFFFFD && i_procPriority->mInfoCurr.mLayer != i_layer) { + if (i_layer != fpcLy_CURRENT_e && i_procPriority->mInfoCurr.mLayer != i_layer) { i_procPriority->mInfoQ.mLayer = i_layer; changed = 1; } - if (i_listID != 0xFFFD && i_procPriority->mInfoCurr.mListID != i_listID) { + if (i_listID != fpcPi_CURRENT_e && i_procPriority->mInfoCurr.mListID != i_listID) { i_procPriority->mInfoQ.mListID = i_listID; changed = 1; } - if (i_priority != 0xFFFD && i_procPriority->mInfoCurr.mListPrio != i_priority) { + if (i_priority != fpcPi_CURRENT_e && i_procPriority->mInfoCurr.mListPrio != i_priority) { i_procPriority->mInfoQ.mListPrio = i_priority; changed = 1; } @@ -128,8 +129,7 @@ s32 fpcPi_Handler() { base_process_class* pProc = (base_process_class*)i_procPriority->mBase.mpTagData; layer_management_tag_class* pLayerTag = &pProc->mLyTg; line_tag* pLineTag = &pProc->mLnTg; - if (fpcLyTg_Move(pLayerTag, i_procPriority->mInfoQ.mLayer, i_procPriority->mInfoQ.mListID, - i_procPriority->mInfoQ.mListPrio) == 1) { + if (fpcLyTg_Move(pLayerTag, i_procPriority->mInfoQ.mLayer, i_procPriority->mInfoQ.mListID, i_procPriority->mInfoQ.mListPrio) == 1) { fpcLnTg_Move(pLineTag, i_procPriority->mInfoCurr.mListID); i_procPriority->mInfoCurr.mLayer = i_procPriority->mInfoQ.mLayer; i_procPriority->mInfoCurr.mListID = i_procPriority->mInfoQ.mListID;