SComponent c_list / c_node (#5)

* SComponent c_list / c_node

* SComponent: c_tree

* SComponent: start c_phase

* SComponent: c_tag

* SComponent: c_counter

* f_pc_line / f_pc_line_tag

the beginnings of the framework process system

* f_pc_method_tag

* SComponent: c_node_iter / c_list_iter / c_tag_iter / c_tree_iter

* f_pc_draw_priority

* f_pc_method_iter

* f_pc_profile

Also add (untested) base header classes for f_pc_base

* f_pc_searcher

* f_pc_create_tag

* f_pc_creator

* f_pc_layer skeleton

* f_pc_method

* f_pc_line_iter

* f_pc_leaf somewhat

* f_pc_delete_tag

* f_pc_create_req

* Fix a few non-matchings

* c_phase: slight additional notes

* c_node: more matching

* fix build

* c_node: One more matching

* f_pc_line_iter: Matching

* f_pc_create_req: a bit more

* f_pc_load, f_pc_deletor partial

* f_pc_executor partial

* f: minor cleanups

* f_pc_executor

Co-authored-by: Pheenoh <pheenoh@gmail.com>
This commit is contained in:
Jasper St. Pierre
2020-11-30 14:26:55 -08:00
committed by GitHub
parent 51b0260c80
commit 937da3c59b
88 changed files with 2117 additions and 2243 deletions
+24
View File
@@ -0,0 +1,24 @@
#ifndef SCOMPONENT_C_LIST_H
#define SCOMPONENT_C_LIST_H
#include "SComponent/c_node.h"
struct node_list_class {
node_class *mpHead;
node_class *mpTail;
int mSize;
};
extern "C" {
void cLs_Init(node_list_class *pList);
int cLs_SingleCut(node_class *pNode);
int cLs_Addition(node_list_class *pList, node_class *pNode);
int cLs_Insert(node_list_class *pList, int idx, node_class *pNode);
node_class * cLs_GetFirst(node_list_class *pList);
void cLs_Create(node_list_class *pList);
};
#endif
+15
View File
@@ -0,0 +1,15 @@
#ifndef SCOMPONENT_C_LIST_ITER_H
#define SCOMPONENT_C_LIST_ITER_H
#include "SComponent/c_list.h"
#include "SComponent/c_node_iter.h"
extern "C" {
int cLsIt_Method(node_list_class *pList, cNdIt_MethodFunc pMethod, void *pUserData);
void * cLsIt_Judge(node_list_class *pList, cNdIt_JudgeFunc pJudge, void *pUserData);
};
#endif
+29
View File
@@ -0,0 +1,29 @@
#ifndef SCOMPONENT_C_NODE_H
#define SCOMPONENT_C_NODE_H
struct node_class {
node_class *mpPrevNode;
void *mpData;
node_class *mpNextNode;
};
extern "C" {
void cNd_Join(node_class *pA, node_class *pB);
int cNd_LengthOf(node_class *pNode);
node_class * cNd_First(node_class *pNode);
node_class * cNd_Last(node_class *pNode);
node_class * cNd_Order(node_class *pNode, int idx);
void cNd_SingleCut(node_class *pNode);
void cNd_Cut(node_class *pNode);
void cNd_Addition(node_class *pA, node_class *pB);
void cNd_Insert(node_class *pA, node_class *pB);
void cNd_SetObject(node_class *pNode, void *pData);
void cNd_ClearObject(node_class *pNode);
void cNd_ForcedClear(node_class *pNode);
void cNd_Create(node_class *pNode, void *pData);
};
#endif
+17
View File
@@ -0,0 +1,17 @@
#ifndef SCOMPONENT_C_NODE_ITER_H
#define SCOMPONENT_C_NODE_ITER_H
#include "SComponent/c_node.h"
extern "C" {
typedef int (*cNdIt_MethodFunc)(node_class *pNode, void *pUserData);
int cNdIt_Method(node_class *pNode, cNdIt_MethodFunc pMethod, void *pUserData);
typedef void * (*cNdIt_JudgeFunc)(node_class *pNode, void *pUserData);
void * cNdIt_Judge(node_class *pNode, cNdIt_JudgeFunc pJudge, void *pUserData);
};
#endif
+32
View File
@@ -0,0 +1,32 @@
#ifndef SCOMPONENT_C_PHASE_H
#define SCOMPONENT_C_PHASE_H
typedef int (*cPhs__Handler)(void *);
enum cPhs__Step {
cPhs_ZERO_e = 0x00,
// names from Wind Waker debug strings
cPhs_COMPLEATE_e = 0x04,
cPhs_ERROR_e = 0x05,
cPhs_NEXT_e = 0x06,
};
struct request_of_phase_process_class {
cPhs__Handler *mpHandlerTable;
int mPhaseStep;
};
extern "C" {
void cPhs_Reset(request_of_phase_process_class *pPhase);
void cPhs_Set(request_of_phase_process_class *pPhase, cPhs__Handler *pHandlerTable);
void cPhs_UnCompleate(request_of_phase_process_class *pPhase);
int cPhs_Compleate(request_of_phase_process_class *pPhase);
int cPhs_Next(request_of_phase_process_class *pPhase);
int cPhs_Do(request_of_phase_process_class *pPhase, void *pUserData);
int cPhs_Handler(request_of_phase_process_class *pPhase, cPhs__Handler *pHandlerTable, void *pUserData);
};
#endif
+28
View File
@@ -0,0 +1,28 @@
#ifndef SCOMPONENT_C_TAG_H
#define SCOMPONENT_C_TAG_H
#include "global.h"
#include "SComponent/c_node.h"
#include "SComponent/c_list.h"
#include "SComponent/c_tree.h"
struct create_tag_class : public node_class {
void *mpTagData;
s8 mbIsUse;
};
extern "C" {
int cTg_IsUse(create_tag_class *pTag);
int cTg_SingleCutFromTree(create_tag_class *pTag);
int cTg_AdditionToTree(node_lists_tree_class *pTree, int listIdx, create_tag_class *pTag);
int cTg_InsertToTree(node_lists_tree_class *pTree, int listIdx, create_tag_class *pTag, int idx);
node_class * cTg_GetFirst(node_list_class *pTag);
int cTg_SingleCut(create_tag_class *pTag);
int cTg_Addition(node_list_class *pList, create_tag_class *pTag);
void cTg_Create(create_tag_class *pTag, void *pData);
};
#endif
+25
View File
@@ -0,0 +1,25 @@
#ifndef SCOMPONENT_C_TAG_ITER_H
#define SCOMPONENT_C_TAG_ITER_H
#include "SComponent/c_tag.h"
#include "SComponent/c_node_iter.h"
struct method_filter {
cNdIt_MethodFunc mpMethodFunc;
void *mpUserData;
};
struct judge_filter {
cNdIt_JudgeFunc mpJudgeFunc;
void *mpUserData;
};
extern "C" {
int cTgIt_MethodCall(create_tag_class *pTag, method_filter *pMethodFilter);
void * cTgIt_JudgeFilter(create_tag_class *pTag, judge_filter *pJudgeFilter);
};
#endif
+23
View File
@@ -0,0 +1,23 @@
#ifndef SCOMPONENT_C_TREE_H
#define SCOMPONENT_C_TREE_H
#include "global.h"
#include "SComponent/c_list.h"
#include "SComponent/c_node.h"
struct node_lists_tree_class {
node_list_class *mpLists;
int mNumLists;
};
extern "C" {
int cTr_SingleCut(node_class *pNode);
int cTr_Addition(node_lists_tree_class *pTree, int listIdx, node_class *pNode);
int cTr_Insert(node_lists_tree_class *pTree, int listIdx, node_class *pNode, int idx);
void cTr_Create(node_lists_tree_class *pTree, node_list_class *pLists, int numLists);
};
#endif
+15
View File
@@ -0,0 +1,15 @@
#ifndef SCOMPONENT_C_TREE_ITER_H
#define SCOMPONENT_C_TREE_ITER_H
#include "SComponent/c_tree.h"
#include "SComponent/c_node_iter.h"
extern "C" {
int cTrIt_Method(node_lists_tree_class *pTree, cNdIt_MethodFunc pJudgeFunc, void *pUserData);
void * cTrIt_Judge(node_lists_tree_class *pTree, cNdIt_JudgeFunc pJudgeFunc, void *pUserData);
};
#endif
+1 -1
View File
@@ -29,6 +29,6 @@ typedef int BOOL;
#define TRUE 1
#define FALSE 0
#define NULL ((void*)0)
#define NULL (0)
#endif
+43
View File
@@ -0,0 +1,43 @@
#ifndef F_PC_BASE_H
#define F_PC_BASE_H
#include "global.h"
#include "SComponent/c_tag.h"
#include "f/f_pc/f_pc_line_tag.h"
#include "f/f_pc/f_pc_layer_tag.h"
#include "f/f_pc/f_pc_delete_tag.h"
#include "f/f_pc/f_pc_priority.h"
struct create_request;
struct profile_method_class;
struct base_process_class {
u32 mBsType;
u32 mBsPcId;
s16 mProcName;
u8 mUnk0;
u8 mUnk1;
s8 mInitState;
u8 mUnk2;
s16 mBsTypeId;
void *mpProf;
create_request *mpCtRq;
layer_management_tag_class mLyTg;
line_tag mLnTg;
delete_tag_class mDtTg;
process_priority_class mPi;
profile_method_class *mpPcMtd;
void *mpUserData;
u32 mParameters;
u32 mSubType;
};
extern "C" {
extern int fpcBs_Is_JustOfType(int a, int b);
extern int fpcBs_Execute(base_process_class *pProc);
};
#endif
+14
View File
@@ -0,0 +1,14 @@
#ifndef F_PC_CREATE_ITER_H
#define F_PC_CREATE_ITER_H
#include "SComponent/c_node_iter.h"
extern "C" {
int fpcCtIt_Method(cNdIt_MethodFunc pJudge, void *pUserData);
void * fpcCtIt_Judge(cNdIt_JudgeFunc pJudge, void *pUserData);
};
#endif
+46
View File
@@ -0,0 +1,46 @@
#ifndef F_PC_CREATE_REQ_H
#define F_PC_CREATE_REQ_H
#include "global.h"
#include "SComponent/c_phase.h"
#include "SComponent/c_tag.h"
#include "f/f_pc/f_pc_create_tag.h"
#include "f/f_pc/f_pc_method.h"
#include "f/f_pc/f_pc_method_tag.h"
struct base_process_class;
struct layer_class;
struct create_request_method_class {
cPhs__Handler mpHandler;
process_method_func mpCancel;
process_method_func mpDelete;
};
struct create_request : public create_tag {
s8 mbIsCreating;
s8 mbIsCancelling;
process_method_tag_class mMtdTg;
create_request_method_class *mpCtRqMtd;
void *mpUnk1;
int mBsPcId;
base_process_class *mpRes;
layer_class *mpLayer;
};
extern "C" {
bool fpcCtRq_isCreatingByID(create_tag *pTag, int *pId);
bool fpcCtRq_IsCreatingByID(unsigned int id);
void fpcCtRq_CreateQTo(create_request *pReq);
void fpcCtRq_ToCreateQ(create_request *pReq);
bool fpcCtRq_Delete(create_request *pReq);
bool fpcCtRq_Cancel(create_request *pReq);
int fpcCtRq_IsDoing(create_request *pReq);
void fpcCtRq_Handler(void);
create_request * fpcCtRq_Create(layer_class *pLayer, unsigned long size, create_request_method_class *pCtRqMtd);
};
#endif
+19
View File
@@ -0,0 +1,19 @@
#ifndef F_PC_CREATE_TAG_H
#define F_PC_CREATE_TAG_H
#include "global.h"
#include "SComponent/c_tag.h"
struct create_tag : public create_tag_class {
};
extern "C" {
void fpcCtTg_ToCreateQ(create_tag_class *pTag);
void fpcCtTg_CreateQTo(create_tag_class *pTag);
int fpcCtTg_Init(create_tag *pTag, void *pUserData);
};
#endif
+18
View File
@@ -0,0 +1,18 @@
#ifndef F_PC_CREATOR_H
#define F_PC_CREATOR_H
#include "global.h"
struct base_process_class;
extern "C" {
bool fpcCt_IsCreatingByID(unsigned int id);
int fpcCt_IsDoing(base_process_class *pProc);
void fpcCt_Abort(base_process_class *pProc);
void fpcCt_Handler(void);
};
#endif
+27
View File
@@ -0,0 +1,27 @@
#ifndef F_PC_DELETE_TAG_H
#define F_PC_DELETE_TAG_H
#include "global.h"
#include "SComponent/c_tag.h"
struct layer_class;
typedef int (*delete_tag_func)(void*);
struct delete_tag_class : public create_tag_class {
layer_class *mpLayer;
s16 mTimer;
};
extern "C" {
bool fpcDtTg_IsEmpty(delete_tag_class *pTag);
void fpcDtTg_ToDeleteQ(delete_tag_class *pTag);
void fpcDtTg_DeleteQTo(delete_tag_class *pTag);
int fpcDtTg_Do(delete_tag_class *pTag, delete_tag_func pFunc);
int fpcDtTg_Init(delete_tag_class *pTag, void *pUserData);
};
#endif
+19
View File
@@ -0,0 +1,19 @@
#ifndef F_PC_DELETOR_H
#define F_PC_DELETOR_H
#include "global.h"
struct base_process_class;
extern "C" {
bool fpcDt_IsComplete(void);
int fpcDt_ToDeleteQ(base_process_class *pProc);
int fpcDt_ToQueue(base_process_class *pProc);
void fpcDt_Handler(void);
int fpcDt_Delete(base_process_class *pProc);
};
#endif
+17
View File
@@ -0,0 +1,17 @@
#ifndef F_PC_DRAW_PRIORITY_H
#define F_PC_DRAW_PRIORITY_H
struct draw_priority_class {
short mPriority;
};
extern "C" {
int fpcDwPi_Get(draw_priority_class *pDwPi);
void fpcDwPi_Set(draw_priority_class *pDwPi, int p);
void fpcDwPi_Init(draw_priority_class *pDwPi, int p);
};
#endif
+18
View File
@@ -0,0 +1,18 @@
#ifndef F_PC_EXECUTOR_H
#define F_PC_EXECUTOR_H
#include "SComponent/c_node_iter.h"
struct base_process_class;
extern "C" {
int fpcEx_ToLineQ(base_process_class *pProc);
int fpcEx_ExecuteQTo(base_process_class *pProc);
int fpcEx_ToExecuteQ(base_process_class *pProc);
void fpcEx_Handler(cNdIt_MethodFunc pFunc);
};
#endif
+54
View File
@@ -0,0 +1,54 @@
#ifndef F_PC_LAYER_H
#define F_PC_LAYER_H
#include "global.h"
#include "SComponent/c_node.h"
#include "SComponent/c_tree.h"
#include "SComponent/c_tag.h"
struct process_method_tag_class;
struct process_node_class;
struct layer_class : public node_class {
u32 mLayerID;
node_lists_tree_class mNodeListTree;
process_node_class *mpPcNode;
node_lists_tree_class mCancelListTree;
void *mpUnk0;
short mCreatingCount;
short mDeletingCount;
};
extern "C" {
void fpcLy_SetCurrentLayer(layer_class *pLayer);
layer_class * fpcLy_CurrentLayer(void);
layer_class * fpcLy_RootLayer(void);
layer_class * fpcLy_Layer(unsigned int id);
layer_class * fpcLy_Search(unsigned int id);
void fpcLy_Regist(layer_class *pLayer);
void fpcLy_CreatedMesg(layer_class *pLayer);
void fpcLy_CreatingMesg(layer_class *pLayer);
void fpcLy_DeletedMesg(layer_class *pLayer);
void fpcLy_DeletingMesg(layer_class *pLayer);
int fpcLy_IsCreatingMesg(layer_class *pLayer);
int fpcLy_IsDeletingMesg(layer_class *pLayer);
void fpcLy_IntoQueue(layer_class *pLayer, int treeListIdx, create_tag_class *pTag, int idx);
void fpcLy_ToQueue(layer_class *pLayer, int treeListIdx, create_tag_class *pTag);
void fpcLy_QueueTo(layer_class *pLayer, create_tag_class *pTag);
void fpcLy_Cancel(layer_class *pLayer);
int fpcLy_CancelMethod(layer_class *pLayer);
void fpcLy_CancelQTo(process_method_tag_class *pMthd);
void fpcLy_ToCancelQ(layer_class *pLayer, process_method_tag_class *pMthd);
void fpcLy_Create(layer_class *pLayer, void *pPcNode, node_list_class *pLists, int listNum);
void fpcLy_Delete(layer_class *pLayer);
};
#endif
+16
View File
@@ -0,0 +1,16 @@
#ifndef F_PC_LAYER_TAG_H
#define F_PC_LAYER_TAG_H
#include "global.h"
#include "SComponent/c_tag.h"
struct layer_class;
struct layer_management_tag_class : public create_tag_class {
layer_class *mpLayer;
s16 mNodeListID;
s16 mNodeListIdx;
};
#endif
+28
View File
@@ -0,0 +1,28 @@
#ifndef F_PC_LEAF_H
#define F_PC_LEAF_H
#include "f/f_pc/f_pc_base.h"
#include "f/f_pc/f_pc_draw_priority.h"
#include "f/f_pc/f_pc_method.h"
struct leafdraw_method_class : public process_method_class {
process_method_func mpDrawFunc;
};
struct leafdraw_class : public base_process_class {
leafdraw_method_class *mpDrawMtd;
u8 mbUnk0;
u8 mbUnk1;
draw_priority_class mDwPi;
};
extern "C" {
int fpcLf_GetPriority(leafdraw_class *pLeaf);
int fpcLf_DrawMethod(leafdraw_method_class *pMthd, void *pUserData);
int fpcLf_Draw(leafdraw_class *pMthd);
};
#endif
+13
View File
@@ -0,0 +1,13 @@
#ifndef F_PC_LINE_ITER_H
#define F_PC_LINE_ITER_H
#include "SComponent/c_node_iter.h"
extern "C" {
void fpcLnIt_Queue(cNdIt_MethodFunc pFunc);
};
#endif
+20
View File
@@ -0,0 +1,20 @@
#ifndef F_PC_LINE_TAG_H
#define F_PC_LINE_TAG_H
#include "SComponent/c_tag.h"
struct line_tag : public create_tag_class {
int mLineListID;
};
extern "C" {
int fpcLnTg_Move(line_tag *pLineTag, int newLineListID);
void fpcLnTg_QueueTo(line_tag *pLineTag);
int fpcLnTg_ToQueue(line_tag *pLineTag, int lineListID);
void fpcLnTg_Init(line_tag *pLineTag, void *pData);
};
#endif
+16
View File
@@ -0,0 +1,16 @@
#ifndef F_PC_LOAD_H
#define F_PC_LOAD_H
#include "global.h"
extern "C" {
bool fpcLd_Use(u16 procName);
int fpcLd_IsLoaded(u16 procName);
void fpcLd_Free(u16 procName);
int fpcLd_Load(u16 procName);
};
#endif
+24
View File
@@ -0,0 +1,24 @@
#ifndef F_PC_METHOD_H
#define F_PC_METHOD_H
typedef int (*process_method_func)(void *);
struct process_method_class {
process_method_func mpCreateFunc;
process_method_func mpDeleteFunc;
process_method_func mpExecuteFunc;
process_method_func mpIsDeleteFunc;
};
extern "C" {
int fpcMtd_Method(process_method_func pFunc, void *pUserData);
int fpcMtd_Execute(process_method_class *pMthd, void *pUserData);
int fpcMtd_IsDelete(process_method_class *pMthd, void *pUserData);
int fpcMtd_Delete(process_method_class *pMthd, void *pUserData);
int fpcMtd_Create(process_method_class *pMthd, void *pUserData);
};
#endif
+13
View File
@@ -0,0 +1,13 @@
#ifndef F_PC_METHOD_ITER_H
#define F_PC_METHOD_ITER_H
#include "SComponent/c_list_iter.h"
extern "C" {
void fpcMtdIt_Method(node_list_class *pList, cNdIt_MethodFunc pMethod);
};
#endif
+21
View File
@@ -0,0 +1,21 @@
#ifndef F_PC_METHOD_TAG_H
#define F_PC_METHOD_TAG_H
#include "SComponent/c_tag.h"
typedef int (*process_method_tag_func)(void *);
struct process_method_tag_class : public create_tag_class {
process_method_tag_func mpFunc;
void *mpMthdData;
};
extern "C" {
void fpcMtdTg_MethodQTo(process_method_tag_class *pMthd);
int fpcMtdTg_Init(process_method_tag_class *pMthd, process_method_tag_func pFunc, void *pMthdData);
};
#endif
+23
View File
@@ -0,0 +1,23 @@
#ifndef F_PC_NODE_H
#define F_PC_NODE_H
#include "f/f_pc/f_pc_base.h"
#include "f/f_pc/f_pc_method.h"
#include "f/f_pc/f_pc_layer.h"
struct process_node_class : public base_process_class {
process_method_class *mpNodeMtd;
layer_class mLayer;
node_list_class mLayerNodeLists[16];
u8 mUnk0;
};
extern "C" {
int fpcNd_Create(process_node_class *pNode);
bool fpcNd_IsDeleteTiming(void);
};
#endif
+32
View File
@@ -0,0 +1,32 @@
#ifndef F_PC_PRIORITY_H
#define F_PC_PRIORITY_H
#include "global.h"
#include "SComponent/c_tag.h"
#include "f/f_pc/f_pc_method_tag.h"
struct process_priority_class : public create_tag_class {
process_method_tag_class mMtdTag;
struct {
u32 mLayer;
u16 mListID;
u16 mListPrio;
} a, b;
};
extern "C" {
int fpcPi_IsInQueue(process_priority_class *pProc);
int fpcPi_QueueTo(process_priority_class *pProc);
int fpcPi_ToQueue(process_priority_class *pProc);
process_priority_class * fpcPi_GetFromQueue(void);
int fpcPi_Delete(process_priority_class *pProc);
int fpcPi_IsNormal(process_priority_class *pProc);
int fpcPi_Change(process_priority_class *pProc, unsigned int layer, unsigned short listID, unsigned short priority);
void fpcPi_Handler(void);
int fpcPi_Init(process_priority_class *pProc, void *pUserData, unsigned int layer, unsigned short listID, unsigned short priority);
};
#endif
+13
View File
@@ -0,0 +1,13 @@
#ifndef F_PC_PROFILE_H
#define F_PC_PROFILE_H
#include "global.h"
extern "C" {
void * fpcPf_Get(s16 profileID);
};
#endif
+16
View File
@@ -0,0 +1,16 @@
#ifndef F_PC_SEARCHER_H
#define F_PC_SEARCHER_H
#include "global.h"
struct base_process_class;
extern "C" {
void * fpcSch_JudgeForPName(base_process_class *pProc, void *pUserData);
void * fpcSch_JudgeByID(base_process_class *pProc, void *pUserData);
};
#endif
+2
View File
@@ -1,6 +1,8 @@
#ifndef _global_h_
#define _global_h_
#define ARRAY_SIZE(o) (sizeof((o)) / sizeof(*(o)))
#include "dolphin/types.h"
#include "functions.h"