d_scene OK (#114)

* d_scene OK

* d_s_boot

* Rename -> PROFILE_MAX

* Some more

---------
This commit is contained in:
robojumper
2025-02-27 02:54:21 +01:00
committed by GitHub
parent 6269e82659
commit c2b2d9700c
29 changed files with 1065 additions and 107 deletions
+9
View File
@@ -17,4 +17,13 @@ private:
int mCount;
};
namespace dDyl {
void initRelsArc();
bool destroy();
bool isLinked(u16 relId);
int tryLink(u16 relId);
} // namespace dDyl
#endif
+31 -5
View File
@@ -6,9 +6,9 @@
#include "m/m_color_fader.h"
#include "m/m_fader.h"
class dFader_c : mFader_c {
class dFader_c : public mFader_c {
public:
dFader_c() : mpColorFader(nullptr), mpLytFader(nullptr), mpScreenFader(nullptr) {}
dFader_c() : mpColorFader(nullptr), mpLytFader(nullptr), mpScreenFader(nullptr), field_0x14(0) {}
virtual ~dFader_c();
bool create();
@@ -16,15 +16,41 @@ public:
u8 getColorFaderAlpha();
bool initForLyt();
bool fadeIn() {
setFader(mFadeInType);
mpFader->setFrame(mFadeInFrame);
return mpFader->fadeIn();
}
bool fadeOut() {
setFader(mFadeOutType);
mpFader->setFrame(mFadeOutFrame);
return mpFader->fadeOut();
}
void setTypes(s32 fadeInType, s32 fadeOutType) {
mFadeInType = fadeInType;
mFadeOutType = fadeOutType;
}
void resetFrames() {
mFadeInFrame = 30;
mFadeOutFrame = 30;
}
void setFadeInFrame(u16 frame) {
mFadeInFrame = frame;
}
private:
/* 0x08 */ mColorFader_c *mpColorFader;
/* 0x0C */ dLytFader_c *mpLytFader;
/* 0x10 */ dScreenFader_c *mpScreenFader;
/* 0x14 */ UNKWORD field_0x14;
/* 0x14 */ u8 field_0x14;
/* 0x18 */ s32 mFadeInType;
/* 0x1C */ s32 mFadeOutType;
/* 0x20 */ u16 field_0x20;
/* 0x22 */ u16 field_0x22;
/* 0x20 */ u16 mFadeInFrame;
/* 0x22 */ u16 mFadeOutFrame;
};
#endif
+72 -4
View File
@@ -1,11 +1,16 @@
#ifndef D_S_BOOT_H
#define D_S_BOOT_H
#include "d/d_base.h"
#include "d/d_fader.h"
#include "d/d_scene.h"
#include "d/lyt/d2d.h"
#include "m/m2d.h"
#include "m/m_dvd.h"
#include "s/s_FPhase.h"
#include "s/s_State.hpp"
#include "s/s_StateMgr.hpp"
#include "sized_string.h"
class dScBoot_c : public dBase_c {
class dScBoot_c : public dScene_c {
public:
dScBoot_c();
virtual ~dScBoot_c();
@@ -15,8 +20,71 @@ public:
STATE_FUNC_DECLARE(dScBoot_c, Connect);
STATE_FUNC_DECLARE(dScBoot_c, Save);
static dScBoot_c *sInstance;
private:
/* 0x??? */ STATE_MGR_DECLARE(dScBoot_c);
class strap_c {
public:
strap_c();
bool create();
bool execute();
bool remove();
void draw();
void init();
private:
/* 0x000 */ SizedString<64> mArcName;
/* 0x040 */ SizedString<64> mStr2;
/* 0x080 */ SizedString<64> mStr3;
/* 0x0C0 */ d2d::ResAccIf_c mResAcc;
/* 0x430 */ m2d::Simple_c mLyt;
/* 0x4C8 */ m2d::Anm_c mAnm;
/* 0x4EC */ u8 field_0x4EC;
/* 0x4EE */ u16 field_0x4EE;
/* 0x4F0 */ u8 field_0x4F0;
};
sFPhaseBase::sFPhaseState executeLoadPhase();
virtual int create() override;
virtual int execute() override;
virtual int doDelete() override;
virtual int draw() override;
virtual void deleteReady() override;
bool checkDone();
sFPhaseBase::sFPhaseState cb1();
sFPhaseBase::sFPhaseState cb2();
sFPhaseBase::sFPhaseState cb3();
sFPhaseBase::sFPhaseState cb4();
sFPhaseBase::sFPhaseState cb5();
sFPhaseBase::sFPhaseState cb6();
sFPhaseBase::sFPhaseState cb7();
sFPhaseBase::sFPhaseState cb8();
sFPhaseBase::sFPhaseState cb9();
static u32 dvdCallback(void *data);
static sFPhase<dScBoot_c>::phaseCallback sCallbacks[];
/* 0x068 */ strap_c mStrapScreen;
/* 0x55C */ sFPhase<dScBoot_c> mPhases;
/* 0x570 */ mDvd_callback_c *mpDvdCallback;
/* 0x574 */ STATE_MGR_DECLARE(dScBoot_c);
/* 0x5B4 */ dFader_c mFader;
/* 0x5D4 */ s32 field_0x5D4;
/* 0x5D8 */ u32 field_0x5D8;
/* 0x5DC */ u8 field_0x5DC;
/* 0x5DD */ u8 field_0x5DD;
/* 0x5DE */ u8 field_0x5DE;
/* 0x5DF */ u8 field_0x5DF;
/* 0x5E0 */ u8 field_0x5E0;
/* 0x5E1 */ u8 field_0x5E1;
/* 0x5E2 */ u8 field_0x5E2;
/* 0x5E3 */ u8 field_0x5E3;
/* 0x5E4 */ u8 field_0x5E4;
};
#endif
+26
View File
@@ -0,0 +1,26 @@
#ifndef D_SCENE_H
#define D_SCENE_H
#include "d/d_base.h"
#include "d/d_fader.h"
#include "f/f_profile_name.h"
class dScene_c : public dBase_c {
public:
dScene_c();
virtual ~dScene_c() {}
virtual void postCreate(MAIN_STATE_e state) override;
virtual void postDelete(MAIN_STATE_e state) override;
virtual int preExecute() override;
virtual void postExecute(MAIN_STATE_e status) override;
static void staticCreate();
static dBase_c *staticExecute();
static void setRootActor(fProfile::PROFILE_NAME_e rootActor, u32 params, s32 fadeInType, s32 fadeOutType);
protected:
static dFader_c sFader;
};
#endif
+8
View File
@@ -1,4 +1,12 @@
#ifndef D_SYS_H
#define D_SYS_H
#include "common.h"
namespace dSys {
void setFrameRate(u32);
} // namespace dSys_c
#endif
+4
View File
@@ -108,6 +108,10 @@ public:
Heap *becomeCurrentHeap();
Heap *_becomeCurrentHeapWithoutLock();
void disableAllocation() {
mFlag.set(HEAP_FLAG_LOCKED);
}
public:
template <typename T>
static T *alloc(u32 count, Heap *heap, int align = 4) {
+1 -1
View File
@@ -84,7 +84,7 @@ struct fActorProfile_c /* : fBaseProfile_c */ {
u32 mActorProperties; ///< Some actor-related properties. @todo Document the bitfield.
};
extern const fBaseProfile_c *(*sProfileList)[NUMBER_OF_ACTORS]; ///< A list of all profiles.
extern const fBaseProfile_c *(*sProfileList)[PROFILE_MAX]; ///< A list of all profiles.
} // namespace fProfile
+1 -2
View File
@@ -707,8 +707,7 @@ enum PROFILE_NAME_e {
/* 700 (0x2BC) */ BOOT,
/* 701 (0x2BD) */ ROOM,
/* 702 (0x2BE) */ LAST,
/* 703 */ NUMBER_OF_ACTORS,
INVALID,
/* 703 */ PROFILE_MAX,
};
}
+5 -2
View File
@@ -123,6 +123,7 @@ private:
class Anm_c {
public:
Anm_c() : mpTransform(nullptr), mFlags(0) {}
virtual ~Anm_c();
bool doSomething(const char *path, ResAccIf_c *acc);
@@ -148,8 +149,6 @@ private:
void updateFrame();
nw4r::lyt::AnimTransform *mpTransform;
FrameCtrl_c mFrameCtrl;
public:
u8 mFlags;
};
@@ -190,6 +189,10 @@ public:
return (field_0x94 & 1) ? 1 : 0;
}
void setResAcc(ResAccIf_c *resAcc) {
mpResAcc = resAcc;
}
private:
Layout_c mLayout;
nw4r::lyt::DrawInfo mDrawInfo;
+1
View File
@@ -78,6 +78,7 @@ public:
virtual u32 execute() override;
static mDvd_callback_c *create(dvdReadCallback cb, void *cbData);
// createOrDie__15mDvd_callback_cFPFPv_PvPv ?
static mDvd_callback_c *createOrFail(dvdReadCallback cb, void *cbData);
dvdReadCallback mCallback;
+12
View File
@@ -12,6 +12,18 @@ public:
return mpFader->getStatus() == status;
}
bool isNotStatus(mFaderBase_c::EStatus status) {
return isStatus(status) != true;
}
void setStatus(mFaderBase_c::EStatus status) {
mpFader->setStatus(status);
}
bool calc() {
return mpFader->calc();
}
protected:
mFaderBase_c *mpFader;
};
+4
View File
@@ -26,3 +26,7 @@ this seems the most reasonable.
## s_FStateVirtualID
Implemented by SS based on NSMBW symbols. Probably missing some parts, sync with NSMBW if they get around to it.
## s_FPhase
SS-only. Symbols/names completely made up.
+80
View File
@@ -0,0 +1,80 @@
#ifndef S_FPHASE_H
#define S_FPHASE_H
#include "common.h"
// Not present in NSMBW
// Look these BaseBase names are terrible but I can't find any better states
class sFPhaseBaseBase {
public:
~sFPhaseBaseBase();
};
class sFPhaseBase : public sFPhaseBaseBase {
public:
sFPhaseBase() : mState(PHASE_INITIAL) {}
enum sFPhaseState {
PHASE_INITIAL,
PHASE_RETRY,
PHASE_NEXT,
PHASE_ALL_DONE,
STATE_4, // PHASE_CANCEL? This causes the system to stop running any phase callbacks
};
virtual ~sFPhaseBase();
sFPhaseState getState() const {
return mState;
}
bool isFinalized() const {
return mState == STATE_4 || mState == PHASE_ALL_DONE;
}
virtual void reset();
virtual sFPhaseState step();
protected:
virtual sFPhaseState callPhase() = 0;
virtual void onReset() = 0;
virtual void nextPhase() = 0;
virtual bool hasReachedEnd() const = 0;
private:
/* 0x04 */ sFPhaseState mState;
};
template <class T>
class sFPhase : public sFPhaseBase {
public:
typedef sFPhaseState (T::*phaseCallback)(void);
sFPhase(T *owner, phaseCallback *phases) {
mpOwner = owner;
mpCurrentPhase = nullptr;
mpPhases = phases;
reset();
}
virtual ~sFPhase() {}
protected:
virtual sFPhaseState callPhase() override {
return (mpOwner->*(*mpCurrentPhase))();
}
virtual void onReset() override {
mpCurrentPhase = mpPhases;
}
virtual void nextPhase() override {
mpCurrentPhase++;
}
virtual bool hasReachedEnd() const override {
return *mpCurrentPhase == nullptr;
}
private:
/* 0x08 */ T *mpOwner;
/* 0x0C */ phaseCallback *mpPhases;
/* 0x10 */ phaseCallback *mpCurrentPhase;
};
#endif
@@ -3,28 +3,32 @@
#include "d/d_rawarchive.h"
#include "egg/core/eggHeap.h"
#include "sized_string.h"
class LayoutArcManager {
public:
LayoutArcManager();
virtual ~LayoutArcManager();
dRawArcTable_c mArcTable;
static LayoutArcManager *sInstance;
static bool create(EGG::Heap *heap);
void init(EGG::Heap *heap);
inline int ensureAllEntriesLoaded() {
return mArcTable.ensureAllEntriesLoaded();
}
bool loadLayoutArcFromDisk(const char *object, EGG::Heap *heap);
void ensureLoaded1(const char *object);
int ensureLoaded1(const char *object);
void ensureLoaded2(const char *object);
bool hasEntry(const char *object);
bool decrement(const char *path);
void *getData(const char *oarcName, const char *fileName);
void *getLoadedData(const char *path);
private:
dRawArcTable_c mArcTable;
};
#endif
@@ -3,7 +3,6 @@
#include "d/d_rawarchive.h"
#include "egg/core/eggHeap.h"
#include "sized_string.h"
class OarcManager {
public:
@@ -16,6 +15,10 @@ public:
void init(EGG::Heap *heap);
inline int ensureAllEntriesLoaded() {
return mArcTable.ensureAllEntriesLoaded();
}
bool checkIfObjectArcExistsOnDisk(const char *object);
bool loadObjectArcFromDisk(const char *object, EGG::Heap *heap);
bool addEntryFromSuperArc(const char *object, void *data, EGG::Heap *heap);
+8
View File
@@ -0,0 +1,8 @@
#ifndef HBM_H
#define HBM_H
extern "C" void *getHBM();
extern "C" int fn_801967D0(void *hbm);
extern "C" int fn_80197560(void *hbm, int);
#endif
+7
View File
@@ -0,0 +1,7 @@
#ifndef MUSIC_MGRS_H
#define MUSIC_MGRS_H
extern "C" void *BGM_MGR;
extern "C" void fn_8035E000();
#endif
+16
View File
@@ -0,0 +1,16 @@
#ifndef RELOAD_COLOR_FADER_H
#define RELOAD_COLOR_FADER_H
#include "common.h"
class ReloadColorFader {
public:
static ReloadColorFader *GetInstance();
void fn_80067ED0();
void fn_80067F00();
void fn_80067F50();
u8 field_0x00[0x0C - 0x00];
s32 field_0x0C;
};
#endif