mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-30 01:49:04 -04:00
f_pc_layer (#16)
* f_op_actor_tag OK * f_pc_layer_tag OK * f_pc_layer_iter * forgot a return * identation and extern var name comments * fix struct member name Co-authored-by: Pheenoh <pheenoh@gmail.com>
This commit is contained in:
@@ -1 +1,23 @@
|
||||
// ok
|
||||
#include "f/f_op/f_op_actor_tag.h"
|
||||
#include "global.h"
|
||||
#include "SComponent/c_tag.h"
|
||||
|
||||
// f_op_actor_tag::g_fopAcTg_Queue
|
||||
extern node_list_class lbl_803A35E0;
|
||||
|
||||
extern "C" {
|
||||
|
||||
u32 fopAcTg_ToActorQ(create_tag_class* c) {
|
||||
return cTg_Addition(&lbl_803A35E0, c);
|
||||
}
|
||||
|
||||
u32 fopAcTg_ActorQTo(create_tag_class* pTag) {
|
||||
return cTg_SingleCutFromTree(pTag);
|
||||
}
|
||||
|
||||
u32 fopAcTg_Init(create_tag_class* pTag, void* data) {
|
||||
cTg_Create(pTag, data);
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,16 +3,13 @@
|
||||
#include "f/f_pc/f_pc_base.h"
|
||||
#include "f/f_pc/f_pc_line_iter.h"
|
||||
#include "f/f_pc/f_pc_layer_tag.h"
|
||||
#include "f/f_pc/f_pc_layer_iter.h"
|
||||
#include "f/f_pc/f_pc_layer.h"
|
||||
#include "f/f_pc/f_pc_node.h"
|
||||
#include "f/f_pc/f_pc_searcher.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
extern int fpcLyTg_ToQueue(layer_management_tag_class *pTag, u32 layerID, u16 listID, u16 listPrio);
|
||||
extern int fpcLyTg_QueueTo(layer_management_tag_class *pTag);
|
||||
extern int fpcLyIt_OnlyHere(layer_class *pLayer, cNdIt_MethodFunc pFunc, void *pUserData);
|
||||
extern void * fpcLyIt_AllJudge(void *pFunc, void *pUserData);
|
||||
extern int fpcPause_IsEnable(base_process_class *pProc, int);
|
||||
|
||||
// g_fpcNd_type
|
||||
@@ -20,7 +17,7 @@ extern int lbl_80450D40;
|
||||
|
||||
base_process_class * fpcEx_Search(void *pFunc, void *pUserData)
|
||||
{
|
||||
return (base_process_class *) fpcLyIt_AllJudge(pFunc, pUserData);
|
||||
return (base_process_class *) fpcLyIt_AllJudge((cNdIt_MethodFunc) pFunc, pUserData);
|
||||
}
|
||||
|
||||
base_process_class * fpcEx_SearchByID(u32 id)
|
||||
|
||||
+154
-1
@@ -1 +1,154 @@
|
||||
// ok
|
||||
#include "global.h"
|
||||
#include "f/f_pc/f_pc_layer.h"
|
||||
#include "f/f_pc/f_pc_method_tag.h"
|
||||
#include "f/f_pc/f_pc_method_iter.h"
|
||||
|
||||
// f_pc_layer::l_fpcLy_CurrLayer_p
|
||||
extern layer_class *lbl_80450D18;
|
||||
extern s8 lbl_80450D20;
|
||||
// f_pc_layer::IsInitOfLayerList
|
||||
extern s32 lbl_80450D1C;
|
||||
extern s8 lbl_80450D28;
|
||||
// f_pc_layer::layer_id
|
||||
extern s32 lbl_80450D24;
|
||||
// f_pc_layer::l_fpcLy_LayerList
|
||||
extern node_list_class lbl_803A39DC;
|
||||
// f_pc_layer::l_fpcLy_Crear
|
||||
extern layer_class lbl_803A39B0;
|
||||
|
||||
extern "C" {
|
||||
|
||||
void fpcLy_CancelQTo(process_method_tag_class *pMthd) {
|
||||
fpcMtdTg_MethodQTo(pMthd);
|
||||
}
|
||||
|
||||
void fpcLy_ToCancelQ(layer_class *pLayer, process_method_tag_class *pMthd) {
|
||||
// this is obviously wrong
|
||||
fpcMtdTg_ToMethodQ((node_list_class*)&pLayer->mCancelListTree, pMthd);
|
||||
}
|
||||
|
||||
bool fpcLy_CancelMethod(process_method_tag_class *pLayer) {
|
||||
return fpcMtdTg_Do(pLayer) == 1;
|
||||
}
|
||||
|
||||
int fpcLy_IntoQueue(layer_class *pLayer, int treeListIdx, create_tag_class *pTag, int idx) {
|
||||
return cTg_InsertToTree(&pLayer->mNodeListTree, treeListIdx, pTag, idx);
|
||||
}
|
||||
|
||||
int fpcLy_ToQueue(layer_class *pLayer, int treeListIdx, create_tag_class *pTag) {
|
||||
return cTg_AdditionToTree(&pLayer->mNodeListTree, treeListIdx, pTag);
|
||||
}
|
||||
|
||||
int fpcLy_QueueTo(layer_class *pLayer, create_tag_class *pTag) {
|
||||
return cTg_SingleCutFromTree(pTag);
|
||||
}
|
||||
|
||||
bool fpcLy_IsDeletingMesg(layer_class *pLayer) {
|
||||
return pLayer->mDeletingCount > 0;
|
||||
}
|
||||
|
||||
void fpcLy_DeletingMesg(layer_class *pLayer) {
|
||||
pLayer->mDeletingCount++;
|
||||
}
|
||||
|
||||
void fpcLy_DeletedMesg(layer_class *pLayer) {
|
||||
if (pLayer->mDeletingCount > 0) {
|
||||
pLayer->mDeletingCount--;
|
||||
}
|
||||
}
|
||||
|
||||
bool fpcLy_IsCreatingMesg(layer_class *pLayer) {
|
||||
return pLayer->mCreatingCount > 0;
|
||||
}
|
||||
|
||||
void fpcLy_CreatingMesg(layer_class *pLayer) {
|
||||
pLayer->mCreatingCount++;
|
||||
}
|
||||
|
||||
void fpcLy_CreatedMesg(layer_class *pLayer) {
|
||||
if (pLayer->mCreatingCount > 0) {
|
||||
pLayer->mCreatingCount--;
|
||||
}
|
||||
}
|
||||
|
||||
layer_class * fpcLy_RootLayer(void) {
|
||||
return (layer_class*)lbl_803A39DC.mpHead;
|
||||
}
|
||||
|
||||
void fpcLy_SetCurrentLayer(layer_class *pLayer) {
|
||||
lbl_80450D18 = pLayer;
|
||||
}
|
||||
|
||||
layer_class * fpcLy_CurrentLayer(void) {
|
||||
return lbl_80450D18;
|
||||
}
|
||||
|
||||
layer_class * fpcLy_Search(unsigned int id) {
|
||||
layer_class* iVar1 = fpcLy_RootLayer();
|
||||
while (iVar1 != NULL) {
|
||||
if (iVar1->mLayerID == id) {
|
||||
return iVar1;
|
||||
}
|
||||
iVar1 = (layer_class*)iVar1->mNode.mpNextNode;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
layer_class * fpcLy_Layer(unsigned int id) {
|
||||
if (id == 0 || fpcLy_RootLayer()->mLayerID == id) {
|
||||
return fpcLy_RootLayer();
|
||||
} else if (id == ~2 || fpcLy_CurrentLayer()->mLayerID == id) {
|
||||
return fpcLy_CurrentLayer();
|
||||
} else {
|
||||
return fpcLy_Search(id);
|
||||
}
|
||||
}
|
||||
|
||||
void fpcLy_Regist(layer_class *pLayer) {
|
||||
cLs_Addition(&lbl_803A39DC, &pLayer->mNode);
|
||||
}
|
||||
|
||||
int fpcLy_Delete(layer_class *pLayer) {
|
||||
if (pLayer->mNodeListTree.mpLists->mSize == 0 && pLayer->mpUnk0 == NULL) {
|
||||
cLs_SingleCut(&pLayer->mNode);
|
||||
*pLayer = lbl_803A39B0;
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void fpcLy_Cancel(layer_class *pLayer) {
|
||||
// data structures are messed up?
|
||||
fpcMtdIt_Method((node_list_class*)&pLayer->mCancelListTree, (cNdIt_MethodFunc)fpcLy_CancelMethod);
|
||||
}
|
||||
|
||||
void fpcLy_Create(layer_class *pLayer, process_node_class *pPcNode, node_list_class *pLists, int listNum) {
|
||||
void *pvVar1;
|
||||
int iVar2;
|
||||
|
||||
if (lbl_80450D20 == 0) {
|
||||
lbl_80450D1C = 0x1; // IsInitOfLayerList
|
||||
lbl_80450D20 = 1;
|
||||
}
|
||||
if (lbl_80450D28 == 0) {
|
||||
lbl_80450D24 = 0; // layer_id
|
||||
lbl_80450D28 = 1;
|
||||
}
|
||||
*pLayer = lbl_803A39B0;
|
||||
cNd_Create(&pLayer->mNode, NULL);
|
||||
pLayer->mLayerID = lbl_80450D24++;
|
||||
pLayer->mpPcNode = pPcNode;
|
||||
if (lbl_80450D1C == 0x1) {
|
||||
lbl_80450D1C = 0x0;
|
||||
cLs_Create(&lbl_803A39DC);
|
||||
fpcLy_SetCurrentLayer(pLayer);
|
||||
}
|
||||
(pLayer->mNodeListTree).mpLists = pLists;
|
||||
(pLayer->mNodeListTree).mNumLists = listNum;
|
||||
cTr_Create(&pLayer->mNodeListTree,(pLayer->mNodeListTree).mpLists,
|
||||
(pLayer->mNodeListTree).mNumLists);
|
||||
fpcLy_Regist(pLayer);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1 +1,46 @@
|
||||
// ok
|
||||
#include "f/f_pc/f_pc_layer_iter.h"
|
||||
#include "SComponent/c_tree_iter.h"
|
||||
#include "SComponent/c_tag_iter.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
int fpcLyIt_OnlyHere(layer_class *pLayer, cNdIt_MethodFunc pFunc, void *pUserData) {
|
||||
layer_iter lIter;
|
||||
lIter.mpFunc = pFunc;
|
||||
lIter.mpUserData = pUserData;
|
||||
return cTrIt_Method(&pLayer->mNodeListTree,(cNdIt_MethodFunc) cTgIt_MethodCall, &lIter);
|
||||
}
|
||||
|
||||
int fpcLyIt_OnlyHereLY(layer_class *pLayer, cNdIt_MethodFunc pFunc, void *pUserData) {
|
||||
int result;
|
||||
layer_class* currentLayer = fpcLy_CurrentLayer();
|
||||
fpcLy_SetCurrentLayer(pLayer);
|
||||
result = fpcLyIt_OnlyHere(pLayer, pFunc, pUserData);
|
||||
fpcLy_SetCurrentLayer(currentLayer);
|
||||
return result;
|
||||
}
|
||||
|
||||
void * fpcLyIt_Judge(layer_class *pLayer, cNdIt_MethodFunc pFunc, void *pUserData) {
|
||||
layer_iter lIter;
|
||||
lIter.mpFunc = pFunc;
|
||||
lIter.mpUserData = pUserData;
|
||||
return cTrIt_Judge(&pLayer->mNodeListTree,(cNdIt_JudgeFunc) cTgIt_JudgeFilter, &lIter);
|
||||
}
|
||||
|
||||
void * fpcLyIt_AllJudge(cNdIt_MethodFunc pFunc, void *pUserData) {
|
||||
layer_iter lIter;
|
||||
lIter.mpFunc = pFunc;
|
||||
lIter.mpUserData = pUserData;
|
||||
|
||||
layer_class* current = fpcLy_RootLayer();
|
||||
while (current != NULL) {
|
||||
void* result = cTrIt_Judge(¤t->mNodeListTree,(cNdIt_JudgeFunc) cTgIt_JudgeFilter, &lIter);
|
||||
if (result != NULL) {
|
||||
return result;
|
||||
}
|
||||
current = (layer_class*)current->mNode.mpNextNode;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1 +1,70 @@
|
||||
// ok
|
||||
#include "global.h"
|
||||
#include "f/f_pc/f_pc_layer_tag.h"
|
||||
#include "f/f_pc/f_pc_layer.h"
|
||||
|
||||
// f_pc_layer_tag::crear
|
||||
extern layer_management_tag_class lbl_803A3A00;
|
||||
|
||||
extern "C" {
|
||||
|
||||
s32 fpcLyTg_ToQueue(layer_management_tag_class *pTag, u32 layerID, u16 listID, u16 listPrio) {
|
||||
if (pTag->mpLayer == NULL && layerID == -1) {
|
||||
return 0;
|
||||
} else {
|
||||
// ghidra says layerID is unsigned?
|
||||
if (layerID != -1 && layerID != -3 && pTag->mpLayer->mLayerID != layerID) {
|
||||
pTag->mpLayer = fpcLy_Layer(layerID);
|
||||
}
|
||||
if (layerID == -1 || layerID == -3) {
|
||||
int tmp = fpcLy_ToQueue(pTag->mpLayer, listID, &pTag->mCreateTag);
|
||||
if (tmp != 0x0) {
|
||||
pTag->mNodeListID = listID;
|
||||
pTag->mNodeListIdx = tmp - 1;
|
||||
return 1;
|
||||
}
|
||||
} else if (fpcLy_IntoQueue(pTag->mpLayer,listID,&pTag->mCreateTag,listPrio) != 0x0) {
|
||||
pTag->mNodeListID = listID;
|
||||
pTag->mNodeListIdx = listPrio;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
s32 fpcLyTg_QueueTo(layer_management_tag_class *pTag) {
|
||||
if (fpcLy_QueueTo(pTag->mpLayer,&pTag->mCreateTag) == 1) {
|
||||
pTag->mpLayer = NULL;
|
||||
pTag->mNodeListID = 0xFFFF;
|
||||
pTag->mNodeListIdx = 0xFFFF;
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
s32 fpcLyTg_Move(layer_management_tag_class * pTag, u32 layerID, u16 listID, u16 listPrio) {
|
||||
layer_class *layer = fpcLy_Layer(layerID);
|
||||
if (layer == NULL) {
|
||||
return 0;
|
||||
}
|
||||
else if (fpcLyTg_QueueTo(pTag) == 0x1) {
|
||||
pTag->mpLayer = layer;
|
||||
return fpcLyTg_ToQueue(pTag,layerID,listID,listPrio);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
s32 fpcLyTg_Init(layer_management_tag_class * pTag, u32 param2, void * param3) {
|
||||
*pTag = lbl_803A3A00;
|
||||
cTg_Create(&pTag->mCreateTag, param3);
|
||||
layer_class* layer = fpcLy_Layer(param2);
|
||||
if (layer != NULL) {
|
||||
pTag->mpLayer = layer;
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,9 +6,9 @@ extern node_lists_tree_class lbl_804505D8;
|
||||
|
||||
extern "C" {
|
||||
|
||||
void fpcMtdTg_Do(process_method_tag_class *pMthd)
|
||||
int fpcMtdTg_Do(process_method_tag_class *pMthd)
|
||||
{
|
||||
pMthd->mpFunc(pMthd->mpMthdData);
|
||||
return pMthd->mpFunc(pMthd->mpMthdData);
|
||||
}
|
||||
|
||||
void fpcMtdTg_ToMethodQ(node_list_class *pList, process_method_tag_class *pMthd)
|
||||
|
||||
Reference in New Issue
Block a user