Document, fixup

This commit is contained in:
robojumper 2024-05-31 12:00:20 +02:00
parent 0e3b13ee3e
commit 374e93821e
24 changed files with 84 additions and 8 deletions

View File

@ -212,6 +212,9 @@ s/s_StateMethod.cpp:
s/s_StateMethodUsr_FI.cpp:
.text start:0x802DE540 end:0x802DE6EC
s/s_Phase.cpp:
.text start:0x802DEEB0 end:0x802DEF74
DynamicLink.cpp:
.text start:0x802DF100 end:0x802DFD74
.data start:0x805419E8 end:0x80541A70

View File

@ -17221,8 +17221,8 @@ fn_802DED40 = .text:0x802DED40; // type:function size:0x4
fn_802DED50 = .text:0x802DED50; // type:function size:0x50
fn_802DEDA0 = .text:0x802DEDA0; // type:function size:0x64
fn_802DEE10 = .text:0x802DEE10; // type:function size:0x98
fn_802DEEB0 = .text:0x802DEEB0; // type:function size:0x14
fn_802DEED0 = .text:0x802DEED0; // type:function size:0xA4
__ct__8sPhase_cFPPFPv_Q28sPhase_c15METHOD_RESULT_ei = .text:0x802DEEB0; // type:function size:0x14
callMethod__8sPhase_cFPv = .text:0x802DEED0; // type:function size:0xA4
fn_802DEF80 = .text:0x802DEF80; // type:function size:0x8
fn_802DEF90 = .text:0x802DEF90; // type:function size:0x4C
fn_802DEFE0 = .text:0x802DEFE0; // type:function size:0x80

View File

@ -314,6 +314,7 @@ config.libs = [
Object(Matching, "s/s_StateId.cpp"),
Object(Matching, "s/s_StateMethod.cpp"),
Object(Matching, "s/s_StateMethodUsr_FI.cpp"),
Object(Matching, "s/s_Phase.cpp"),
Object(Matching, "DynamicLink.cpp"),
# framework (f_name)
# d stuff (d_name)

View File

@ -6,9 +6,9 @@
#include <s/s_State.hpp>
#include <s/s_StateMgr.hpp>
class fLiNdTumbleweed_c : public fLiNdBa_c {
class fLiNdTumbleweed_c : public fLiNdBaAutoUnlink_c {
public:
fLiNdTumbleweed_c(fBase_c *owner) : fLiNdBa_c(owner) {}
fLiNdTumbleweed_c(fBase_c *owner) : fLiNdBaAutoUnlink_c(owner) {}
u16 someField;
};

View File

@ -12,7 +12,7 @@ class fBase_c;
class fLiNdBa_c : public cListNd_c {
public:
fLiNdBa_c(fBase_c *owner) : p_owner(owner) {}
~fLiNdBa_c() { unlink(); }
~fLiNdBa_c() {}
inline fLiNdBa_c *getPrev() const {
return (fLiNdBa_c *)cListNd_c::getPrev();
@ -28,4 +28,10 @@ public:
fBase_c *p_owner;
};
class fLiNdBaAutoUnlink_c : public fLiNdBa_c {
public:
fLiNdBaAutoUnlink_c(fBase_c *owner) : fLiNdBa_c(owner) {}
~fLiNdBaAutoUnlink_c() { unlink(); }
};
#endif

View File

@ -29,6 +29,7 @@ public:
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() {}
/* 802e28c0 */ int getSearchTableNum();
/* 802e28d0 */ static fBase_c *searchBaseByID(fBaseID_e id);
/* 802e2920 */ static fBase_c *searchBaseByProfName(ProfileName profID, const fBase_c *parent);

17
include/s/README.txt Normal file
View File

@ -0,0 +1,17 @@
This library was ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
with differences/modifications outlined below:
## No inline destructors
The NSMBW code uses inlined destructors. In SS, these destructors are all part of the s_StateID.cpp(?) TU,
and pretty much every generic instantiation of the state manager (which for a large part are in RELs)
will call back into those destructors in the main DOL.
## s_StateIDChk.hpp
In order for vtable ordering to match, some classes had to be extracted to a new header.
## sStateMethodIf_c
S_StateMethod_c's destructors calls back into another destructors. sStateMethodIf_c follows the example of
the other abstract interface classes and provides this dtor.

View File

@ -2,6 +2,9 @@
#include <s/s_StateInterfaces.hpp>
#include <s/s_FStateID.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
/// @brief A state holder for a given class.
/// @tparam T The class that this state belongs to.
/// @ingroup state

View File

@ -3,6 +3,9 @@
#include <s/s_FState.hpp>
#include <s/s_StateID.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
/// @brief A state factory for a given class.
/// @tparam T The class that this state belongs to.
/// @ingroup state

View File

@ -2,6 +2,9 @@
#include <s/s_StateID.hpp>
#include <MSL_C/string.h>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
/// @brief An implementation of a state ID for a given class.
/// @details It adds the ability to call the three state methods on a state owner class.
/// @tparam T The class that this state belongs to.

View File

@ -5,6 +5,9 @@
#include <s/s_FStateFct.hpp>
#include <s/s_StateIDChk.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
/// @brief A wrapper for sStateMgr_c that uses sFStateFct_c and sStateIDChk_c.
/// @tparam T The class that this state belongs to.
/// @tparam Method The method to use for the state manager.

View File

@ -1,5 +1,8 @@
#pragma once
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
/// @brief A phase is a list of methods to be called in order.
/// @ingroup slib dol
class sPhase_c {

View File

@ -2,6 +2,9 @@
#include <s/s_FStateMgr.hpp>
#include <s/s_StateMethodUsr_FI.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
#define STATE_FUNC_DECLARE(class, name) void initializeState_##name(); \
void executeState_##name(); \
void finalizeState_##name(); \

View File

@ -1,6 +1,9 @@
#pragma once
#include <s/s_StateInterfaces.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
/// @brief A generic implementation of a state ID.
/// @details It simply contains a name string and a unique number.
/// @ingroup state

View File

@ -1,6 +1,9 @@
#pragma once
#include <s/s_StateInterfaces.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
/// @brief A default implementation of a state ID checker.
/// @details ::isNormalID always returns true.
class sStateIDChk_c : public sStateIDChkIf_c {

View File

@ -1,5 +1,8 @@
#pragma once
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
/// @addtogroup state
/// @{

View File

@ -1,6 +1,9 @@
#pragma once
#include <s/s_StateInterfaces.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
/// @brief A class that handles state execution and transition.
/// @details [Presumably, sStateMethod_c actually means "methods for state interaction", or something like that].
/// @ingroup state

View File

@ -1,6 +1,9 @@
#pragma once
#include <s/s_StateMethod.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
/// @brief An extension to sStateMethod_c that implements the remaining abstract methods.
/// @details [Name might mean "Functionality implementation"].
/// @ingroup state

View File

@ -1,6 +1,9 @@
#pragma once
#include <s/s_StateInterfaces.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
/**
* @brief An implementation of sStateMgrIf_c.
*

View File

@ -24,7 +24,6 @@ void (*fBase_c::sUnloadCallback)();
fBase_c::fBase_c()
: unique_ID(m_rootUniqueID), params(m_tmpCtData.params), profile_name(m_tmpCtData.prof_name),
group_type(m_tmpCtData.group_type), manager(this) {
fManager_c *mgr = &manager;
m_rootUniqueID = (fBaseID_e)(m_rootUniqueID + 1);
if (m_rootUniqueID == INVALID) {
@ -33,8 +32,8 @@ fBase_c::fBase_c()
}
}
fManager_c::m_connectManage.addTreeNode(&mgr->connect_node, m_tmpCtData.connect_parent);
int searchTableIdx = mgr->getSearchTableNum();
fManager_c::m_connectManage.addTreeNode(&manager.connect_node, m_tmpCtData.connect_parent);
int searchTableIdx = manager.getSearchTableNum();
fManager_c::m_searchManage[searchTableIdx].prepend(&manager.search_node);
const fProfile::fBaseProfile_c *profile = (*fProfile::sProfileList)[profile_name];

View File

@ -1,5 +1,8 @@
#include <s/s_Phase.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
sPhase_c::sPhase_c(phaseMethod **methodList, int count) {
mpMethodList = methodList;
mPhaseLength = count;

View File

@ -4,6 +4,9 @@
#include <s/s_StateMethodUsr_FI.hpp>
#include <s/s_StateIDChk.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
sStateID_c::NumberMemo_c sStateID_c::sm_numberMemo;
sStateID_c sStateID::null(nullptr);

View File

@ -3,6 +3,9 @@
#include <s/s_StateMethod.hpp>
#include <s/s_StateID.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
sStateMethod_c::sStateMethod_c(sStateIDChkIf_c &checker, sStateFctIf_c &factory, const sStateIDIf_c &initialState) :
mpStateChk(checker),
mpStateFct(factory),
@ -37,6 +40,7 @@ void sStateMethod_c::initializeStateMethod() {
void sStateMethod_c::executeStateMethod() {
if (!mExecutionLock) {
// Skyward Sword change: Prevent runaway state changes?
int i = 2;
do {
if (mRefreshStateMethod) {

View File

@ -1,6 +1,9 @@
#include <common.h>
#include <s/s_StateMethodUsr_FI.hpp>
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
sStateMethodUsr_FI_c::sStateMethodUsr_FI_c(sStateIDChkIf_c &check, sStateFctIf_c &factory, const sStateIDIf_c &state) :
sStateMethod_c(check, factory, state) {
}