diff options
| author | robojumper <robojumper@gmail.com> | 2025-02-27 02:54:21 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-26 20:54:21 -0500 |
| commit | c2b2d9700c47c1eb4c6026fee14d1d9b247f8fe8 (patch) | |
| tree | 025738406df46197b4ba782b6637b5ca5c5145cf /include | |
| parent | 6269e826598371fd7683dca5089df17536161f14 (diff) | |
d_scene OK (#114)
* d_scene OK
* d_s_boot
* Rename -> PROFILE_MAX
* Some more
---------
Diffstat (limited to 'include')
| -rw-r--r-- | include/d/d_dylink.h | 9 | ||||
| -rw-r--r-- | include/d/d_fader.h | 36 | ||||
| -rw-r--r-- | include/d/d_s_boot.h | 76 | ||||
| -rw-r--r-- | include/d/d_scene.h | 26 | ||||
| -rw-r--r-- | include/d/d_sys.h | 8 | ||||
| -rw-r--r-- | include/egg/core/eggHeap.h | 4 | ||||
| -rw-r--r-- | include/f/f_profile.h | 2 | ||||
| -rw-r--r-- | include/f/f_profile_name.h | 3 | ||||
| -rw-r--r-- | include/m/m2d.h | 7 | ||||
| -rw-r--r-- | include/m/m_dvd.h | 1 | ||||
| -rw-r--r-- | include/m/m_fader.h | 12 | ||||
| -rw-r--r-- | include/s/README.txt | 4 | ||||
| -rw-r--r-- | include/s/s_FPhase.h | 80 | ||||
| -rw-r--r-- | include/toBeSorted/arc_managers/layout_arc_manager.h | 12 | ||||
| -rw-r--r-- | include/toBeSorted/arc_managers/oarc_manager.h | 5 | ||||
| -rw-r--r-- | include/toBeSorted/hbm.h | 8 | ||||
| -rw-r--r-- | include/toBeSorted/music_mgrs.h | 7 | ||||
| -rw-r--r-- | include/toBeSorted/reload_color_fader.h | 16 |
18 files changed, 297 insertions, 19 deletions
diff --git a/include/d/d_dylink.h b/include/d/d_dylink.h index 1b456e4c..66122f8b 100644 --- a/include/d/d_dylink.h +++ b/include/d/d_dylink.h @@ -17,4 +17,13 @@ private: int mCount; }; +namespace dDyl { + +void initRelsArc(); +bool destroy(); +bool isLinked(u16 relId); +int tryLink(u16 relId); + +} // namespace dDyl + #endif diff --git a/include/d/d_fader.h b/include/d/d_fader.h index aa032b93..300ea576 100644 --- a/include/d/d_fader.h +++ b/include/d/d_fader.h @@ -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 diff --git a/include/d/d_s_boot.h b/include/d/d_s_boot.h index 7977ad22..ba0c9f31 100644 --- a/include/d/d_s_boot.h +++ b/include/d/d_s_boot.h @@ -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 diff --git a/include/d/d_scene.h b/include/d/d_scene.h new file mode 100644 index 00000000..8c2334a0 --- /dev/null +++ b/include/d/d_scene.h @@ -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 diff --git a/include/d/d_sys.h b/include/d/d_sys.h index 12ff7e2f..f3993b8c 100644 --- a/include/d/d_sys.h +++ b/include/d/d_sys.h @@ -1,4 +1,12 @@ #ifndef D_SYS_H #define D_SYS_H +#include "common.h" + +namespace dSys { + +void setFrameRate(u32); + +} // namespace dSys_c + #endif diff --git a/include/egg/core/eggHeap.h b/include/egg/core/eggHeap.h index 87f3b1d8..986248aa 100644 --- a/include/egg/core/eggHeap.h +++ b/include/egg/core/eggHeap.h @@ -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) { diff --git a/include/f/f_profile.h b/include/f/f_profile.h index b887d216..15b73080 100644 --- a/include/f/f_profile.h +++ b/include/f/f_profile.h @@ -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 diff --git a/include/f/f_profile_name.h b/include/f/f_profile_name.h index 8ca2e818..1601c805 100644 --- a/include/f/f_profile_name.h +++ b/include/f/f_profile_name.h @@ -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, }; } diff --git a/include/m/m2d.h b/include/m/m2d.h index 0ecd3f4c..12d7ba31 100644 --- a/include/m/m2d.h +++ b/include/m/m2d.h @@ -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; diff --git a/include/m/m_dvd.h b/include/m/m_dvd.h index e89f94f0..c54b5e2c 100644 --- a/include/m/m_dvd.h +++ b/include/m/m_dvd.h @@ -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; diff --git a/include/m/m_fader.h b/include/m/m_fader.h index 132594a0..68509fef 100644 --- a/include/m/m_fader.h +++ b/include/m/m_fader.h @@ -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; }; diff --git a/include/s/README.txt b/include/s/README.txt index 22881597..dc469bfe 100644 --- a/include/s/README.txt +++ b/include/s/README.txt @@ -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. diff --git a/include/s/s_FPhase.h b/include/s/s_FPhase.h new file mode 100644 index 00000000..2351de47 --- /dev/null +++ b/include/s/s_FPhase.h @@ -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 diff --git a/include/toBeSorted/arc_managers/layout_arc_manager.h b/include/toBeSorted/arc_managers/layout_arc_manager.h index 65f7091c..8555c732 100644 --- a/include/toBeSorted/arc_managers/layout_arc_manager.h +++ b/include/toBeSorted/arc_managers/layout_arc_manager.h @@ -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 diff --git a/include/toBeSorted/arc_managers/oarc_manager.h b/include/toBeSorted/arc_managers/oarc_manager.h index 7bbe22d5..319f44e9 100644 --- a/include/toBeSorted/arc_managers/oarc_manager.h +++ b/include/toBeSorted/arc_managers/oarc_manager.h @@ -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); diff --git a/include/toBeSorted/hbm.h b/include/toBeSorted/hbm.h new file mode 100644 index 00000000..20857729 --- /dev/null +++ b/include/toBeSorted/hbm.h @@ -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 diff --git a/include/toBeSorted/music_mgrs.h b/include/toBeSorted/music_mgrs.h new file mode 100644 index 00000000..a3fceb86 --- /dev/null +++ b/include/toBeSorted/music_mgrs.h @@ -0,0 +1,7 @@ +#ifndef MUSIC_MGRS_H +#define MUSIC_MGRS_H + +extern "C" void *BGM_MGR; +extern "C" void fn_8035E000(); + +#endif diff --git a/include/toBeSorted/reload_color_fader.h b/include/toBeSorted/reload_color_fader.h new file mode 100644 index 00000000..e8284b90 --- /dev/null +++ b/include/toBeSorted/reload_color_fader.h @@ -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 |
