mirror of
https://github.com/zeldaret/ss
synced 2026-08-17 13:29:24 -04:00
some fManager, fBase, mHeap, f - lists and tree stuff
This commit is contained in:
+43
-14
@@ -4,6 +4,7 @@
|
||||
// https://github.com/NSMBW-Community/NSMBW-Decomp/blob/master/include/dol/framework/f_base.hpp and the Skyward Sword
|
||||
// Ghidra database. Comments and docs can be seen above. stripped in this file for easier looking
|
||||
|
||||
#include "egg/core/eggExpHeap.h"
|
||||
#include "egg/core/eggFrmHeap.h"
|
||||
#include "f/f_base_id.h"
|
||||
#include "f/f_helper_unk.h"
|
||||
@@ -12,28 +13,36 @@
|
||||
#include "f/f_profile.h"
|
||||
#include <common.h>
|
||||
|
||||
|
||||
// Ghidra: fBase
|
||||
// size: 0x64
|
||||
// official name
|
||||
class fBase_c {
|
||||
public:
|
||||
/* 0x00 */ fBaseID_e unique_ID;
|
||||
/* 0x04 */ u32 params1; // params1
|
||||
/* 0x04 */ u32 params; // params1
|
||||
/* 0x08 */ ProfileName profile_name; // Actor Id
|
||||
/* 0x0A */ u8 lifecycle_state;
|
||||
/* 0x0B */ bool delete_request;
|
||||
/* 0x0C */ bool update_request;
|
||||
/* 0x0D */ bool retry_create;
|
||||
/* 0x0C */ s8 update_request;
|
||||
/* 0x0D */ bool create_request;
|
||||
/* 0x0E */ u8 group_type;
|
||||
/* 0x0F */ u8 proc_control;
|
||||
/* 0x10 */ fManager_c manager;
|
||||
/* 0x50 */ fBaHelper_c *p_unused_helper;
|
||||
/* 0x54 */ fLiMgBa_c unused_list;
|
||||
/* 0x50 */ fBaHelper_c *p_helper;
|
||||
/* 0x54 */ fLiMgBa_c actor_list;
|
||||
/* 0x5C */ EGG::FrmHeap *p_heap;
|
||||
/* 0x60 */ // vtable
|
||||
public:
|
||||
enum LIFECYCLE_e { WAITING_FOR_CREATE, ACTIVE, TO_BE_DELETED };
|
||||
enum UPDATE_STATUS_e {
|
||||
UPDATING,
|
||||
UPDATE_REQUEST,
|
||||
UPDATE_FORCE,
|
||||
};
|
||||
enum LIFECYCLE_e {
|
||||
WAITING_FOR_CREATE,
|
||||
ACTIVE,
|
||||
TO_BE_DELETED,
|
||||
};
|
||||
enum GROUP_TYPE_e {
|
||||
OTHER,
|
||||
SCENE,
|
||||
@@ -59,6 +68,17 @@ public:
|
||||
proc_control &= ~flag;
|
||||
}
|
||||
|
||||
fManager_c *getManager() {
|
||||
return &manager;
|
||||
}
|
||||
|
||||
void setParams() {
|
||||
unique_ID = m_rootUniqueID;
|
||||
params = m_tmpCtData.params;
|
||||
profile_name = m_tmpCtData.prof_name;
|
||||
group_type = m_tmpCtData.group_type;
|
||||
}
|
||||
|
||||
public:
|
||||
/* 802e12f0 */ fBase_c();
|
||||
/* 802e23b0 */ static void *operator new(size_t);
|
||||
@@ -78,8 +98,8 @@ public: // vtable 0x60
|
||||
/* 0x30 | 802E1AA0 */ virtual int preDraw();
|
||||
/* 0x34 | 802E1AD0 */ virtual void postDraw(MAIN_STATE_e state);
|
||||
/* 0x38 | 802E1B90 */ virtual void deleteReady();
|
||||
/* 0x3C | 802E20E0 */ virtual bool entryFrmHeap(unsigned long size, EGG::Heap *parentHeap);
|
||||
/* 0x40 | 802E22E0 */ virtual bool entryFrmHeapNonAdjust(unsigned long size, EGG::Heap *parentHeap);
|
||||
/* 0x3C | 802E20E0 */ virtual bool entryFrmHeap(size_t size, EGG::Heap *parentHeap);
|
||||
/* 0x40 | 802E22E0 */ virtual bool entryFrmHeapNonAdjust(size_t size, EGG::Heap *parentHeap);
|
||||
/* 0x44 | 802E23A0 */ virtual bool createHeap();
|
||||
/* 0x48 | 802E1480 */ virtual ~fBase_c();
|
||||
|
||||
@@ -92,9 +112,13 @@ public:
|
||||
/* 802e1ae0 */ int drawPack();
|
||||
/* 802e1ba0 */ int connectProc();
|
||||
/* 802e1e00 */ void deleteRequest();
|
||||
/* 802e1e80 */ void forceUpdate();
|
||||
/* 802e1f90 */ static fBase_c *getConnectRoot();
|
||||
/* 802e1f90 */ static fBase_c *getConnectTreeNext(fBase_c *);
|
||||
/* 802e1f90 */ fBase_c *getConnectParent() const;
|
||||
/* 802e1fb0 */ fBase_c *getConnectChild() const;
|
||||
/* 802e1fd0 */ fBase_c *getConnectBrNext() const;
|
||||
/* 802e1ff0 */ void updateExecutePriority(u16 priority);
|
||||
/* 802e2090 */ bool setConnectChild(fBase_c *child);
|
||||
/* 802e2420 */ void runCreate();
|
||||
/* 802e24a0 */ fBase_c *getChildProcessCreateState() const;
|
||||
@@ -110,16 +134,21 @@ public:
|
||||
u8 groupType);
|
||||
|
||||
public:
|
||||
/* 80575ba8 */ static fLiMgBa_c m_additional_actors;
|
||||
/* 80575ba8 */ static fLiMgBa_c m_forceExecuteList;
|
||||
/* 80575bb0 */ static int (*sLoadAsyncCallback)();
|
||||
/* 80575bb4 */ static void (*sUnloadCallback)();
|
||||
|
||||
private:
|
||||
/* 80573fb8 */ static fBaseID_e m_rootUniqueID;
|
||||
/* 805b84c8 */ static ProfileName m_tmpCtProfName;
|
||||
/* 805b84cc */ static fTrNdBa_c *m_tmpCtConnectParent;
|
||||
/* 805b84d0 */ static u32 m_tmpCtParam;
|
||||
/* 805b84d4 */ static u8 m_tmpCtGroupType;
|
||||
|
||||
struct ConstructData {
|
||||
/* 805b84c8 */ ProfileName prof_name;
|
||||
/* 805b84cc */ fTrNdBa_c *connect_parent;
|
||||
/* 805b84d0 */ u32 params;
|
||||
/* 805b84d4 */ u8 group_type;
|
||||
};
|
||||
|
||||
static ConstructData m_tmpCtData;
|
||||
|
||||
friend class fManager_c;
|
||||
friend class fLiNdBa_c;
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "f/f_profile.h"
|
||||
#include <common.h>
|
||||
|
||||
|
||||
class fBase_c;
|
||||
|
||||
/// @brief A list of fLiNdBa_c nodes.
|
||||
@@ -24,9 +23,7 @@ public:
|
||||
int countNodeByProfName(ProfileName profName) const;
|
||||
|
||||
/* 802e2760 */ const fLiNdBa_c *searchNodeByID(fBaseID_e id) const;
|
||||
/* 802e2790 */ const fLiNdBa_c *searchNodeByID(fBaseID_e id, fLiMgBa_c *start) const;
|
||||
/* 802e27d0 */ void link(fLiNdBa_c &, fBase_c *);
|
||||
/* 802e2830 */ void unlink(fLiNdBa_c &);
|
||||
/* 802e2790 */ const fLiNdBa_c *searchNodeByProfName(ProfileName name, fLiNdBa_c *start) const;
|
||||
|
||||
inline fLiNdBa_c *getFirst() const {
|
||||
return (fLiNdBa_c *)cListMg_c::getFirst();
|
||||
|
||||
@@ -15,7 +15,7 @@ class fBase_c;
|
||||
class fLiMgPTMF_c : public fLiMgBa_c {
|
||||
public:
|
||||
fLiMgPTMF_c(int (fBase_c::*procFunc)()) : mpProcFunc(procFunc) {}
|
||||
/* 802e2680 */ bool addNode(fLiNdPrio_c *node);
|
||||
/* 802e2680 */ void addNode(fLiNdPrio_c *node);
|
||||
/* 802e26e0 */ bool walkPack();
|
||||
|
||||
fLiNdPrio_c *getFirst() const {
|
||||
|
||||
@@ -6,12 +6,10 @@
|
||||
#include "c/c_list.h"
|
||||
#include <common.h>
|
||||
|
||||
|
||||
class fBase_c;
|
||||
|
||||
class fLiNdBa_c : public cListNd_c {
|
||||
public:
|
||||
fLiNdBa_c() : p_owner(nullptr) {}
|
||||
fLiNdBa_c(fBase_c *owner) : p_owner(owner) {}
|
||||
|
||||
inline fLiNdBa_c *getPrev() const {
|
||||
@@ -22,5 +20,8 @@ public:
|
||||
return (fLiNdBa_c *)cListNd_c::getNext();
|
||||
}
|
||||
|
||||
/* 802e27d0 */ void link(fBase_c *);
|
||||
/* 802e2830 */ void unlink();
|
||||
|
||||
fBase_c *p_owner;
|
||||
};
|
||||
|
||||
@@ -7,14 +7,19 @@
|
||||
#include "f/f_profile.h"
|
||||
#include <common.h>
|
||||
|
||||
|
||||
/// @brief A list node with priority fields for an order in a list.
|
||||
/// @note Unofficial name.
|
||||
class fLiNdPrio_c : public fLiNdBa_c {
|
||||
public:
|
||||
/// @brief Constructs a new list node.
|
||||
/// @param owner The node's owner.
|
||||
fLiNdPrio_c(fBase_c *owner) : fLiNdBa_c(owner), mOrder(0), mNewOrder(0) {}
|
||||
fLiNdPrio_c(fBase_c *owner) : fLiNdBa_c(owner), m_order(0), m_new_order(0) {}
|
||||
|
||||
void Initialize(fBase_c *owner) {
|
||||
p_owner = owner;
|
||||
m_order = 0;
|
||||
m_new_order = 0;
|
||||
}
|
||||
|
||||
fLiNdPrio_c *getPrev() const {
|
||||
return (fLiNdPrio_c *)fLiNdBa_c::getPrev();
|
||||
@@ -25,13 +30,26 @@ public:
|
||||
}
|
||||
|
||||
u16 getOrder() const {
|
||||
return mOrder;
|
||||
return m_order;
|
||||
}
|
||||
|
||||
u16 getNewOrder() const {
|
||||
return mNewOrder;
|
||||
return m_new_order;
|
||||
}
|
||||
|
||||
u16 mOrder; ///< The priority of this node.
|
||||
u16 mNewOrder; ///< The priority the node should change to if it differs from ::mOrder.
|
||||
bool isPriorityChange() {
|
||||
return m_new_order != m_order;
|
||||
}
|
||||
|
||||
void updatePriority() {
|
||||
m_order = m_new_order;
|
||||
}
|
||||
|
||||
void setOrder(u16 order) {
|
||||
m_order = order;
|
||||
m_new_order = order;
|
||||
}
|
||||
|
||||
u16 m_order; ///< The priority of this node.
|
||||
u16 m_new_order; ///< The priority the node should change to if it differs from ::mOrder.
|
||||
};
|
||||
|
||||
+14
-22
@@ -1,15 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
// this file was ported from https://github.com/NSMBW-Community/NSMBW-Decomp/blob/master/include/dol/framework/f_manager.hpp
|
||||
// this file was ported from
|
||||
// https://github.com/NSMBW-Community/NSMBW-Decomp/blob/master/include/dol/framework/f_manager.hpp
|
||||
|
||||
#include "f/f_base_id.h"
|
||||
#include "f/f_list_mg_ptmf.h"
|
||||
#include "f/f_list_mg.h"
|
||||
#include "f/f_list_mg_ptmf.h"
|
||||
#include "f/f_list_nd.h"
|
||||
#include "f/f_list_nd_prio.h"
|
||||
#include "f/f_profile.h"
|
||||
#include "f/f_tree_mg_ptmf.h"
|
||||
#include "f/f_tree_nd.h"
|
||||
#include "f/f_profile.h"
|
||||
|
||||
#define GET_PROC_FLAG(proc) (1 << (proc - 1))
|
||||
|
||||
@@ -17,10 +18,7 @@ class fBase_c;
|
||||
|
||||
class fManager_c {
|
||||
public:
|
||||
|
||||
enum LOOP_PROC_e {
|
||||
NOTHING, CONNECT, CREATE, EXECUTE, DELETE, DRAW
|
||||
};
|
||||
enum LOOP_PROC_e { NOTHING, CONNECT, CREATE, EXECUTE, DELETE, DRAW };
|
||||
|
||||
enum PROC_FLAGS {
|
||||
PROC_FLAG_CONNECT = GET_PROC_FLAG(CONNECT),
|
||||
@@ -29,13 +27,7 @@ public:
|
||||
PROC_FLAG_DELETE = GET_PROC_FLAG(DELETE),
|
||||
PROC_FLAG_DRAW = GET_PROC_FLAG(DRAW)
|
||||
};
|
||||
|
||||
fManager_c(fBase_c *owner) :
|
||||
connect_node(owner),
|
||||
execute_node(owner),
|
||||
draw_node(owner),
|
||||
search_node(owner) {}
|
||||
|
||||
fManager_c(fBase_c *owner) : connect_node(owner), execute_node(owner), draw_node(owner), search_node(owner) {}
|
||||
/* 802e28c0 */ int getSearchTableNum();
|
||||
/* 802e28d0 */ static fBase_c *searchBaseByID(fBaseID_e id);
|
||||
/* 802e2920 */ static fBase_c *searchBaseByProfName(ProfileName profID, const fBase_c *parent);
|
||||
@@ -43,21 +35,21 @@ public:
|
||||
/* 802e29e0 */ static void mainLoop();
|
||||
|
||||
private:
|
||||
fTrNdBa_c connect_node; ///< The node in ::m_connectManage.
|
||||
fTrNdBa_c connect_node; ///< The node in ::m_connectManage.
|
||||
fLiNdPrio_c execute_node; ///< The node in ::m_executeManage.
|
||||
fLiNdPrio_c draw_node; ///< The node in ::m_drawManage.
|
||||
fLiNdBa_c search_node; ///< The node in ::m_searchManage.
|
||||
fLiNdPrio_c draw_node; ///< The node in ::m_drawManage.
|
||||
fLiNdBa_c search_node; ///< The node in ::m_searchManage.
|
||||
|
||||
/* 805b84d8 */ static fTrMgPTMF_c m_connectManage; ///< A tree that connects all loaded bases.
|
||||
/* 805b84e8 */ static fLiMgPTMF_c m_createManage; ///< A list of all the bases scheduled for creation.
|
||||
/* 805b84e8 */ static fLiMgPTMF_c m_createManage; ///< A list of all the bases scheduled for creation.
|
||||
/* 805b84fc */ static fLiMgPTMF_c m_executeManage; ///< A list of all the bases scheduled for execution.
|
||||
/* 805b8510 */ static fLiMgPTMF_c m_drawManage; ///< A list of all the bases scheduled for drawing.
|
||||
/* 805b8524 */ static fLiMgPTMF_c m_deleteManage; ///< A list of all the bases scheduled for deletion.
|
||||
/* 805b8510 */ static fLiMgPTMF_c m_drawManage; ///< A list of all the bases scheduled for drawing.
|
||||
/* 805b8524 */ static fLiMgPTMF_c m_deleteManage; ///< A list of all the bases scheduled for deletion.
|
||||
|
||||
/* 805b8548 */ static fLiMgBa_c m_searchManage[8];
|
||||
|
||||
/* 80575bb8 */ static u32 m_StopProcInf; ///< Which processes should be executed this frame.
|
||||
/* 80575bb8 */ static u32 m_StopProcInf; ///< Which processes should be executed this frame.
|
||||
/* 80573fc0 */ static LOOP_PROC_e m_nowLoopProc; ///< The process ::mainLoop is currently in.
|
||||
|
||||
friend class fBase_c;
|
||||
};
|
||||
};
|
||||
|
||||
+35
-25
@@ -4,20 +4,30 @@
|
||||
|
||||
#include "f/f_profile_name.h"
|
||||
|
||||
|
||||
/// @brief Creates a profile of a base with given values for execute and draw order.
|
||||
#define SPECIAL_BASE_PROFILE(profName, className, executeOrder, drawOrder, baseProperties) void *className##_classInit() { return new className(); } \
|
||||
fProfile::fBaseProfile_c g_profile_##profName = { &className##_classInit, executeOrder, drawOrder, baseProperties }
|
||||
#define SPECIAL_BASE_PROFILE(profName, className, executeOrder, drawOrder, baseProperties) \
|
||||
void *className##_classInit() { \
|
||||
return new className(); \
|
||||
} \
|
||||
fProfile::fBaseProfile_c g_profile_##profName = {&className##_classInit, executeOrder, drawOrder, baseProperties}
|
||||
|
||||
/// @brief Creates a profile of an actor with given values for execute and draw order and the actor properties. @see SPECIAL_BASE_PROFILE
|
||||
#define SPECIAL_ACTOR_PROFILE(profName, className, executeOrder, drawOrder, baseProperties, properties) void *className##_classInit() { return new className(); } \
|
||||
const fProfile::fActorProfile_c g_profile_##profName = { &className##_classInit, executeOrder, drawOrder, baseProperties, properties }
|
||||
/// @brief Creates a profile of an actor with given values for execute and draw order and the actor properties. @see
|
||||
/// SPECIAL_BASE_PROFILE
|
||||
#define SPECIAL_ACTOR_PROFILE(profName, className, executeOrder, drawOrder, baseProperties, properties) \
|
||||
void *className##_classInit() { \
|
||||
return new className(); \
|
||||
} \
|
||||
const fProfile::fActorProfile_c g_profile_##profName = {&className##_classInit, executeOrder, drawOrder, \
|
||||
baseProperties, properties}
|
||||
|
||||
/// @brief Creates a profile for a base, with the profile number as the priority for both the draw and execute order. @see SPECIAL_BASE_PROFILE
|
||||
#define DEFAULT_BASE_PROFILE(profName, className) SPECIAL_BASE_PROFILE(profName, className, fProfile::profName, fProfile::profName);
|
||||
/// @brief Creates a profile for a base, with the profile number as the priority for both the draw and execute order.
|
||||
/// @see SPECIAL_BASE_PROFILE
|
||||
#define DEFAULT_BASE_PROFILE(profName, className) \
|
||||
SPECIAL_BASE_PROFILE(profName, className, fProfile::profName, fProfile::profName);
|
||||
|
||||
/// @brief Creates a profile of an actor with default values. @see DEFAULT_BASE_PROFILE
|
||||
#define DEFAULT_ACTOR_PROFILE(profName, className, baseProperties, properties) SPECIAL_ACTOR_PROFILE(profName, className, fProfile::profName, fProfile::profName, baseProperties, properties);
|
||||
#define DEFAULT_ACTOR_PROFILE(profName, className, baseProperties, properties) \
|
||||
SPECIAL_ACTOR_PROFILE(profName, className, fProfile::profName, fProfile::profName, baseProperties, properties);
|
||||
/*
|
||||
|
||||
fProfile::fActorProfile_c g_profile_NAME = {
|
||||
@@ -46,22 +56,22 @@ char *dProf_getName(ProfileName profName);
|
||||
/// @note Unofficial name.
|
||||
namespace fProfile {
|
||||
|
||||
/// @brief A set of basic information needed to construct a base.
|
||||
/// @details A profile consists of a pointer to a constructor function
|
||||
/// and a priority value for execution and drawing order.
|
||||
struct fBaseProfile_c {
|
||||
void *(*mpClassInit)(); ///< The constructor function.
|
||||
u16 mExecuteOrder; ///< The execution priority of the base.
|
||||
u16 mDrawOrder; ///< The draw priority of the base.
|
||||
u32 mBaseProperties;
|
||||
};
|
||||
/// @brief A set of basic information needed to construct a base.
|
||||
/// @details A profile consists of a pointer to a constructor function
|
||||
/// and a priority value for execution and drawing order.
|
||||
struct fBaseProfile_c {
|
||||
void *(*mpClassInit)(); ///< The constructor function.
|
||||
u16 m_execute_order; ///< The execution priority of the base.
|
||||
u16 m_draw_order; ///< The draw priority of the base.
|
||||
u32 mBaseProperties;
|
||||
};
|
||||
|
||||
/// @brief A set of basic information needed to construct an actor.
|
||||
/// @details In addition to the fields in fBaseProfile_c, it also contains some properties about the actor.
|
||||
struct fActorProfile_c : fBaseProfile_c {
|
||||
u32 mActorProperties; ///< Some actor-related properties. @todo Document the bitfield.
|
||||
};
|
||||
/// @brief A set of basic information needed to construct an actor.
|
||||
/// @details In addition to the fields in fBaseProfile_c, it also contains some properties about the actor.
|
||||
struct fActorProfile_c : fBaseProfile_c {
|
||||
u32 mActorProperties; ///< Some actor-related properties. @todo Document the bitfield.
|
||||
};
|
||||
|
||||
extern fBaseProfile_c *(*sProfileList)[NUMBER_OF_ACTORS]; ///< A list of all profiles.
|
||||
extern fBaseProfile_c *(*sProfileList)[NUMBER_OF_ACTORS]; ///< A list of all profiles.
|
||||
|
||||
} // namespace fProfile
|
||||
} // namespace fProfile
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "f/f_profile.h"
|
||||
#include <common.h>
|
||||
|
||||
|
||||
class fTrNdBa_c;
|
||||
|
||||
/// @brief A container for a tree of fTrNdBa_c nodes.
|
||||
@@ -29,4 +28,8 @@ public:
|
||||
* @return The found node, or @p nullptr if none was found.
|
||||
*/
|
||||
const fTrNdBa_c *searchNodeByGroupType(u8 groupType, const fTrNdBa_c *parent) const;
|
||||
|
||||
const fTrNdBa_c *getRoot() const {
|
||||
return (fTrNdBa_c *)cTreeMg_c::getRoot();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "f/f_tree_mg.h"
|
||||
#include <common.h>
|
||||
|
||||
|
||||
class fBase_c;
|
||||
|
||||
/// @brief A container for a tree of fTrNdBa_c nodes with a reference to a process function.
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "f/f_profile.h"
|
||||
#include <common.h>
|
||||
|
||||
|
||||
class fBase_c;
|
||||
|
||||
class fTrNdBa_c : public cTreeNd_c {
|
||||
|
||||
Reference in New Issue
Block a user