diff --git a/config/SOUE01/config.yml b/config/SOUE01/config.yml index 26af8e3d..073afa3a 100644 --- a/config/SOUE01/config.yml +++ b/config/SOUE01/config.yml @@ -29,6 +29,10 @@ force_active: [ "ModuleConstructorsX", "ModuleDestructorsX", ] +extract: + - symbol: DOL_BACKUP_FONT + header: d/dol_backup_error_font.inc + modules: - object: orig/SOUE01/files/rels.arc:rels/d_a_asura_bulletNP.rel splits: config/SOUE01/rels/d_a_asura_bulletNP/splits.txt diff --git a/config/SOUE01/rels/d_s_bootNP/symbols.txt b/config/SOUE01/rels/d_s_bootNP/symbols.txt index 43befac3..c5a6226f 100644 --- a/config/SOUE01/rels/d_s_bootNP/symbols.txt +++ b/config/SOUE01/rels/d_s_bootNP/symbols.txt @@ -17,7 +17,7 @@ cb7__9dScBoot_cFv = .text:0x00000620; // type:function size:0x160 cb8__9dScBoot_cFv = .text:0x00000780; // type:function size:0x8 cb9__9dScBoot_cFv = .text:0x00000790; // type:function size:0x58 dScBoot_c_classInit__Fv = .text:0x000007F0; // type:function size:0x30 -fn_3_820 = .text:0x00000820; // type:function size:0x38 +drawCallback__9dScBoot_cFv = .text:0x00000820; // type:function size:0x38 __ct__Q29dScBoot_c7strap_cFv = .text:0x00000860; // type:function size:0x2EC __dt__Q34nw4r3lyt11FontRefLinkFv = .text:0x00000B50; // type:function size:0x40 __dt__Q23d2d10ResAccIf_cFv = .text:0x00000B90; // type:function size:0x74 diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index 9141683f..a1900414 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -180,9 +180,17 @@ d/d_dvd.cpp: .data start:0x805033F0 end:0x80503400 .sdata start:0x80571C10 end:0x80571C20 +d/d_dvd_drive_error.cpp: + .text start:0x80052300 end:0x80052760 align:16 + .rodata start:0x804DC6B0 end:0x804DCBF0 + .data start:0x80503400 end:0x80503440 + .sbss start:0x805750D0 end:0x805750D8 + .sdata2 start:0x80576F20 end:0x80576F38 + d/d_dvd_unk.cpp: - .text start:0x80052300 end:0x80052E00 align:16 - .sbss start:0x805750D0 end:0x805750E0 + .text start:0x80052760 end:0x80052E00 align:16 + .data start:0x80503440 end:0x8050A238 + .sbss start:0x805750D8 end:0x805750E0 d/d_dylink.cpp: .text start:0x80052E00 end:0x80053A30 align:16 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 2e99d88e..726257d4 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -525,11 +525,11 @@ execute__17NandRequestDeleteFv = .text:0x80015D00; // type:function size:0x38 doDelete__23NandRequestDeleteHolderFPCc = .text:0x80015D40; // type:function size:0x94 fn_80015DE0 = .text:0x80015DE0; // type:function size:0x8 fn_80015DF0 = .text:0x80015DF0; // type:function size:0x48 -fn_80015E40 = .text:0x80015E40; // type:function size:0x38 -fn_80015E80 = .text:0x80015E80; // type:function size:0x18 +create__11SaveRelatedFv = .text:0x80015E40; // type:function size:0x38 +remove__11SaveRelatedFv = .text:0x80015E80; // type:function size:0x18 fn_80015EA0 = .text:0x80015EA0; // type:function size:0x14 fn_80015EC0 = .text:0x80015EC0; // type:function size:0x74 -fn_80015F40 = .text:0x80015F40; // type:function size:0xC +fn_80015F40__11SaveRelatedFv = .text:0x80015F40; // type:function size:0xC fn_80015F50 = .text:0x80015F50; // type:function size:0x8 fn_80015F60 = .text:0x80015F60; // type:function size:0x14 fn_80015F80 = .text:0x80015F80; // type:function size:0x4C @@ -543,7 +543,7 @@ fn_80016190 = .text:0x80016190; // type:function size:0x18 fn_800161B0 = .text:0x800161B0; // type:function size:0x10 fn_800161C0 = .text:0x800161C0; // type:function size:0x34 defaultSet__3d2dFv = .text:0x80016200; // type:function size:0xF4 -fn_80016300 = .text:0x80016300; // type:function size:0x28 +draw__3d2dFv = .text:0x80016300; // type:function size:0x28 fn_80016330 = .text:0x80016330; // type:function size:0x28 fn_80016360 = .text:0x80016360; // type:function size:0x54 fn_800163C0 = .text:0x800163C0; // type:function size:0x248 @@ -553,7 +553,7 @@ fn_80016690 = .text:0x80016690; // type:function size:0xC fn_800166A0 = .text:0x800166A0; // type:function size:0x58 fn_80016700 = .text:0x80016700; // type:function size:0x160 fn_80016860 = .text:0x80016860; // type:function size:0x28 -createLightTextures = .text:0x80016890; // type:function size:0x98 +createLightTextures__3d3dFv = .text:0x80016890; // type:function size:0x98 fn_80016930 = .text:0x80016930; // type:function size:0x2C fn_80016960__3d3dFR7mVec3_cRC7mVec3_c = .text:0x80016960; // type:function size:0x130 fn_80016A90__3d3dFRC7mVec3_c = .text:0x80016A90; // type:function size:0xCC @@ -2145,22 +2145,22 @@ __ct__Q24dDvd8loader_cFv = .text:0x80052100; // type:function size:0x28 __dt__Q24dDvd8loader_cFv = .text:0x80052130; // type:function size:0x40 request__Q24dDvd8loader_cFPCcUcPQ23EGG4Heap = .text:0x80052170; // type:function size:0x128 remove__Q24dDvd8loader_cFv = .text:0x800522A0; // type:function size:0x5C -createFont__Q27dDvdUnk11unkstruct_cFPQ23EGG4Heap = .text:0x80052300; // type:function size:0x34 -getUnk__Q24dDvd11unkstruct_cFv = .text:0x80052340; // type:function size:0x8 -draw__Q27dDvdUnk11unkstruct_cFv = .text:0x80052350; // type:function size:0x35C -fn_800526B0 = .text:0x800526B0; // type:function size:0x98 -init__Q24dDvd11unkstruct_cFv = .text:0x80052750; // type:function size:0x10 -fn_80052760 = .text:0x80052760; // type:function size:0x88 +create__16dDvdDriveError_cFPQ23EGG4Heap = .text:0x80052300; // type:function size:0x34 +isError__16dDvdDriveError_cCFv = .text:0x80052340; // type:function size:0x8 +draw__16dDvdDriveError_cFv = .text:0x80052350; // type:function size:0x35C +execute__16dDvdDriveError_cFv = .text:0x800526B0; // type:function size:0x98 +init__16dDvdDriveError_cFv = .text:0x80052750; // type:function size:0x10 +create__Q27dDvdUnk7FontUnkFPQ23EGG4Heap = .text:0x80052760; // type:function size:0x88 fn_800527F0 = .text:0x800527F0; // type:function size:0x11C fn_80052910 = .text:0x80052910; // type:function size:0x48 fn_80052960 = .text:0x80052960; // type:function size:0x18 -fn_80052980 = .text:0x80052980; // type:function size:0x30 +init__Q27dDvdUnk7FontUnkFv = .text:0x80052980; // type:function size:0x30 fn_800529B0 = .text:0x800529B0; // type:function size:0x30 fn_800529E0 = .text:0x800529E0; // type:function size:0x38 fn_80052A20 = .text:0x80052A20; // type:function size:0xB8 fn_80052AE0 = .text:0x80052AE0; // type:function size:0x148 fn_80052C30 = .text:0x80052C30; // type:function size:0x24 -fn_80052C60 = .text:0x80052C60; // type:function size:0x24 +fn_80052C60__Q27dDvdUnk7FontUnkFv = .text:0x80052C60; // type:function size:0x24 fn_80052C90__Q27dDvdUnk7FontUnkFv = .text:0x80052C90; // type:function size:0x28 fn_80052CC0 = .text:0x80052CC0; // type:function size:0x38 fn_80052D00__Q27dDvdUnk7FontUnkFb = .text:0x80052D00; // type:function size:0x14 @@ -2933,7 +2933,7 @@ fn_80067C10 = .text:0x80067C10; // type:function size:0xA8 fn_80067CC0 = .text:0x80067CC0; // type:function size:0x7C fn_80067D40 = .text:0x80067D40; // type:function size:0x70 fn_80067DB0 = .text:0x80067DB0; // type:function size:0x14 -fn_80067DD0 = .text:0x80067DD0; // type:function size:0x8 +fn_80067DD0__16ReloadColorFaderFb = .text:0x80067DD0; // type:function size:0x8 fn_80067DE0 = .text:0x80067DE0; // type:function size:0xD4 getStatus__Q23EGG10ColorFaderCFv = .text:0x80067EC0; // type:function size:0x8 fn_80067ED0__16ReloadColorFaderFv = .text:0x80067ED0; // type:function size:0x24 @@ -4059,7 +4059,7 @@ write__22NandRequestWriteHolderFPCcPvUl = .text:0x800BD580; // type:function siz failedWrite__22NandRequestWriteHolderFv = .text:0x800BD5E0; // type:function size:0xC onExit__Q23EGG6ThreadFv = .text:0x800BD5F0; // type:function size:0x4 onEnter__Q23EGG6ThreadFv = .text:0x800BD600; // type:function size:0x4 -fn_800BD610 = .text:0x800BD610; // type:function size:0x34 +create__17NandResultTrackerFPQ23EGG4Heap = .text:0x800BD610; // type:function size:0x34 GetInstance__17NandResultTrackerFv = .text:0x800BD650; // type:function size:0x8 isFailure__17NandResultTrackerF10NANDResult = .text:0x800BD660; // type:function size:0x5C fn_800BD6C0 = .text:0x800BD6C0; // type:function size:0x34 @@ -8509,7 +8509,7 @@ fn_80152BC0 = .text:0x80152BC0; // type:function size:0x64 fn_80152C30 = .text:0x80152C30; // type:function size:0xE8 fn_80152D20 = .text:0x80152D20; // type:function size:0x54 fn_80152D80 = .text:0x80152D80; // type:function size:0x5C -fn_80152DE0 = .text:0x80152DE0; // type:function size:0x3C +create__18dLytSystemWindow_cFv = .text:0x80152DE0; // type:function size:0x3C fn_80152E20 = .text:0x80152E20; // type:function size:0xC8 fn_80152EF0 = .text:0x80152EF0; // type:function size:0x8 fn_80152F00 = .text:0x80152F00; // type:function size:0x8 @@ -10489,9 +10489,9 @@ TgInsectCaptureMinigame__getBugIndex = .text:0x80196550; // type:function size:0 TgStream__initList = .text:0x801965A0; // type:function size:0x50 TgStream__dtorList = .text:0x801965F0; // type:function size:0x58 fn_80196650 = .text:0x80196650; // type:function size:0x4C -getHBM = .text:0x801966A0; // type:function size:0x8 +GetInstance__6dHbm_cFv = .text:0x801966A0; // type:function size:0x8 fn_801966B0 = .text:0x801966B0; // type:function size:0x120 -fn_801967D0 = .text:0x801967D0; // type:function size:0x1D4 +fn_801967D0__6dHbm_cFv = .text:0x801967D0; // type:function size:0x1D4 fn_801969B0 = .text:0x801969B0; // type:function size:0xB4 fn_80196A70 = .text:0x80196A70; // type:function size:0x60 fn_80196AD0 = .text:0x80196AD0; // type:function size:0x64 @@ -10514,7 +10514,7 @@ fn_80197340 = .text:0x80197340; // type:function size:0x14 fn_80197360 = .text:0x80197360; // type:function size:0x5C fn_801973C0 = .text:0x801973C0; // type:function size:0x58 fn_80197420 = .text:0x80197420; // type:function size:0x140 -fn_80197560 = .text:0x80197560; // type:function size:0x28 +fn_80197560__6dHbm_cFl = .text:0x80197560; // type:function size:0x28 fn_80197590 = .text:0x80197590; // type:function size:0x28 dStageMgr_c_classInit__Fv = .text:0x801975C0; // type:function size:0x34 fn_80197600 = .text:0x80197600; // type:function size:0xA0 @@ -30069,7 +30069,7 @@ __vt__16ActorCarryStruct = .data:0x805033D0; // type:object size:0xC __vt__19dColliderLinkedList = .data:0x805033E0; // type:object size:0xC __vt__Q24dDvd8loader_c = .data:0x805033F0; // type:object size:0x10 lbl_80503400 = .data:0x80503400; // type:object size:0x40 -lbl_80503440 = .data:0x80503440; // type:object size:0x6DF8 +DOL_BACKUP_FONT = .data:0x80503440; // type:object size:0x6DF8 align:32 lbl_8050A238 = .data:0x8050A238; // type:object size:0x14 lbl_8050A24C = .data:0x8050A24C; // type:object size:0xC lbl_8050A258 = .data:0x8050A258; // type:object size:0x14 data:string @@ -39870,7 +39870,7 @@ lbl_80574FEC = .sbss:0x80574FEC; // type:object size:0xC sInstance__8UnkClass = .sbss:0x80574FF8; // type:object size:0x4 sInstance__11FileManager = .sbss:0x80574FFC; // type:object size:0x4 data:4byte sInstance__7SaveMgr = .sbss:0x80575000; // type:object size:0x8 data:4byte -lbl_80575008 = .sbss:0x80575008; // type:object size:0x8 data:4byte +sInstance__11SaveRelated = .sbss:0x80575008; // type:object size:0x8 data:4byte lbl_80575010 = .sbss:0x80575010; // type:object size:0x8 data:4byte lbl_80575018 = .sbss:0x80575018; // type:object size:0x8 data:4byte lbl_80575020 = .sbss:0x80575020; // type:object size:0x1 data:byte @@ -39911,7 +39911,7 @@ lbl_805750B8 = .sbss:0x805750B8; // type:object size:0x8 data:byte s_ExecuteControlFlags__7dBase_c = .sbss:0x805750C0; // type:object size:0x4 data:4byte s_DrawControlFlags__7dBase_c = .sbss:0x805750C4; // type:object size:0x4 data:4byte s_NextExecuteControlFlags__7dBase_c = .sbss:0x805750C8; // type:object size:0x4 data:4byte -lbl_805750D0 = .sbss:0x805750D0; // type:object size:0x8 data:4byte +sInstance__16dDvdDriveError_c = .sbss:0x805750D0; // type:object size:0x8 data:4byte sInstance__Q27dDvdUnk7FontUnk = .sbss:0x805750D8; // type:object size:0x8 data:4byte pDynamicNameTable = .sbss:0x805750E0; // type:object size:0x4 data:4byte nDynamicNameTable = .sbss:0x805750E4; // type:object size:0x4 data:4byte @@ -39922,7 +39922,7 @@ Initialized__4dDyl = .sbss:0x805750F4; // type:object size:0x1 data:byte DVD__4dDyl = .sbss:0x805750F8; // type:object size:0x4 data:4byte mFaderColor = .sbss:0x80575100; // type:object size:0x4 scope:local data:byte @GUARD@getFontPath__10dFontMng_cFUc@TEMP_FONT_NAME = .sbss:0x80575108; // type:object size:0x1 scope:local data:byte -SOME_GFX_THING = .sbss:0x80575110; // type:object size:0x8 data:4byte +sInstance__6dGfx_c = .sbss:0x80575110; // type:object size:0x8 data:4byte lbl_80575118 = .sbss:0x80575118; // type:object size:0x4 data:4byte lbl_8057511C = .sbss:0x8057511C; // type:object size:0x4 data:4byte lbl_80575120 = .sbss:0x80575120; // type:object size:0x4 data:4byte diff --git a/configure.py b/configure.py index d1e5210f..8a823cf8 100644 --- a/configure.py +++ b/configure.py @@ -403,6 +403,7 @@ config.libs = [ Object(NonMatching, "d/d_carry.cpp"), Object(Matching, "d/d_cc.cpp"), Object(Matching, "d/d_dvd.cpp"), + Object(Matching, "d/d_dvd_drive_error.cpp"), Object(NonMatching, "d/d_dvd_unk.cpp"), Object(NonMatching, "d/d_dylink.cpp"), Object(Matching, "d/d_fader.cpp"), diff --git a/include/d/d_d2d.h b/include/d/d_d2d.h index 105d2852..801f79e1 100644 --- a/include/d/d_d2d.h +++ b/include/d/d_d2d.h @@ -4,6 +4,7 @@ namespace d2d { void defaultSet(); +void draw(); } // namespace d2d diff --git a/include/d/d_dvd_drive_error.h b/include/d/d_dvd_drive_error.h new file mode 100644 index 00000000..9c950315 --- /dev/null +++ b/include/d/d_dvd_drive_error.h @@ -0,0 +1,26 @@ +#ifndef D_DVD_DRIVE_ERROR_H +#define D_DVD_DRIVE_ERROR_H + +#include "common.h" +#include "egg/core/eggHeap.h" + +class dDvdDriveError_c { +public: + static void create(EGG::Heap *heap); + void draw(); + void execute(); + void init(); + bool isError() const; + + static dDvdDriveError_c *GetInstance() { + return sInstance; + } + +private: + static dDvdDriveError_c *sInstance; + + /* 0x00 */ s32 mDvdDriveStatus; + /* 0x04 */ bool mIsError; +}; + +#endif diff --git a/include/d/d_dvd_unk.h b/include/d/d_dvd_unk.h index 71291116..419dc63b 100644 --- a/include/d/d_dvd_unk.h +++ b/include/d/d_dvd_unk.h @@ -10,32 +10,21 @@ namespace dDvdUnk { -class unkstruct_c { -public: - static unkstruct_c *create(EGG::Heap *heap); - void draw(); - void execute(); - void init(); - char getUnk(); - - static void createFont(EGG::Heap *heap); - -private: - UNKWORD field_0x0; - char field_0x4; -}; - class FontUnk { public: - FontUnk() {} + FontUnk() : field_0x2D(0) {} static FontUnk *GetInstance() { return sInstance; } + static void create(EGG::Heap *heap); + void init(); + void fn_80052D00(bool); void fn_80052D50(); void fn_80052C90(); + void fn_80052C60(); s32 getField_0x24() const { return field_0x24; @@ -53,6 +42,10 @@ public: field_0x2C = val; } + const nw4r::ut::ResFont &getFont() const { + return mFont; + } + private: static FontUnk *sInstance; diff --git a/include/d/d_gfx.h b/include/d/d_gfx.h index fe5d2d90..18e63957 100644 --- a/include/d/d_gfx.h +++ b/include/d/d_gfx.h @@ -6,10 +6,10 @@ // Made up name class dGfx_c { public: - typedef void (*PreDrawCallback)(void); + typedef void (*DrawCallback)(void); - void setDrawCallback(PreDrawCallback cb) { - mPreDrawCb = cb; + void setDrawCallback(DrawCallback cb) { + mDrawCallback = cb; } void setField0x09(u8 val) { @@ -24,7 +24,7 @@ private: static dGfx_c *sInstance; /* 0x00 */ u8 _0x00[0x04 - 0x00]; - /* 0x04 */ PreDrawCallback mPreDrawCb; + /* 0x04 */ DrawCallback mDrawCallback; /* 0x08 */ u8 field_0x08; /* 0x09 */ u8 field_0x09; }; diff --git a/include/d/d_s_boot.h b/include/d/d_s_boot.h index 5c365380..a7e9fe9a 100644 --- a/include/d/d_s_boot.h +++ b/include/d/d_s_boot.h @@ -38,8 +38,8 @@ private: private: /* 0x000 */ SizedString<64> mArcName; - /* 0x040 */ SizedString<64> mStr2; - /* 0x080 */ SizedString<64> mStr3; + /* 0x040 */ SizedString<64> mLytFileName; + /* 0x080 */ SizedString<64> mAnimFileName; /* 0x0C0 */ d2d::ResAccIf_c mResAcc; /* 0x430 */ m2d::Simple_c mLyt; /* 0x4C8 */ m2d::Anm_c mAnm; @@ -58,6 +58,8 @@ private: bool checkDone(); + static void drawCallback(); + sFPhaseBase::sFPhaseState cb1(); sFPhaseBase::sFPhaseState cb2(); sFPhaseBase::sFPhaseState cb3(); @@ -77,7 +79,7 @@ private: /* 0x570 */ mDvd_callback_c *mpDvdCallback; /* 0x574 */ STATE_MGR_DECLARE(dScBoot_c); /* 0x5B4 */ dFader_c mFader; - /* 0x5D4 */ s32 field_0x5D4; + /* 0x5D4 */ s32 mProgressStage; /* 0x5D8 */ u32 field_0x5D8; /* 0x5DC */ u8 field_0x5DC; /* 0x5DD */ u8 field_0x5DD; diff --git a/include/d/lyt/d_lyt_system_window.h b/include/d/lyt/d_lyt_system_window.h index 10f81063..b0a3a6b6 100644 --- a/include/d/lyt/d_lyt_system_window.h +++ b/include/d/lyt/d_lyt_system_window.h @@ -11,6 +11,8 @@ public: return sInstance; } + static bool create(); + bool setProperties(const char *label, bool, const wchar_t *); void showMaybe(); void showMaybe(s32 arg); diff --git a/include/toBeSorted/d_d3d.h b/include/toBeSorted/d_d3d.h index 1b5b43b1..4d650b79 100644 --- a/include/toBeSorted/d_d3d.h +++ b/include/toBeSorted/d_d3d.h @@ -21,6 +21,7 @@ namespace d3d { f32 fn_80016960(mVec3_c&, const mVec3_c& pos); bool fn_80016A90(const mVec3_c& pos); void fn_80016B60(mVec3_c&, const mVec3_c& pos); +void createLightTextures(); class AnmMdlWrapper : protected m3d::mdlAnmChr { public: diff --git a/include/toBeSorted/d_hbm.h b/include/toBeSorted/d_hbm.h new file mode 100644 index 00000000..f8eb390b --- /dev/null +++ b/include/toBeSorted/d_hbm.h @@ -0,0 +1,21 @@ +#ifndef D_HBM_H +#define D_HBM_H + +#include "common.h" +class dHbm_c { +public: + static dHbm_c *GetInstance(); + + s32 fn_801967D0(); + s32 fn_80197560(s32); + + void offFlags(u32 flags) { + mFlags &= ~flags; + } + +private: + u8 _0x00[0x218 - 0x000]; + u32 mFlags; +}; + +#endif diff --git a/include/toBeSorted/hbm.h b/include/toBeSorted/hbm.h deleted file mode 100644 index 20857729..00000000 --- a/include/toBeSorted/hbm.h +++ /dev/null @@ -1,8 +0,0 @@ -#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/lyt_related_floats.h b/include/toBeSorted/lyt_related_floats.h index 092b8ea7..8496f90d 100644 --- a/include/toBeSorted/lyt_related_floats.h +++ b/include/toBeSorted/lyt_related_floats.h @@ -3,6 +3,16 @@ #include "common.h" +extern "C" f32 lbl_80575144; +inline f32 get_80575144() { + return lbl_80575144; +} + +extern "C" f32 lbl_80575148; +inline f32 get_80575148() { + return lbl_80575148; +} + extern "C" f32 lbl_805751A4; inline f32 get_805751A4() { return lbl_805751A4; @@ -13,11 +23,21 @@ inline s32 get_80575134() { return lbl_80575134; } +extern "C" s32 lbl_80575118; +inline s32 get_80575118() { + return lbl_80575118; +} + extern "C" s32 lbl_8057511C; inline s32 get_8057511C() { return lbl_8057511C; } +extern "C" f32 lbl_8057514C; +inline f32 get_8057514C() { + return lbl_8057514C; +} + extern "C" f32 lbl_80575150; inline f32 get_80575150() { return lbl_80575150; @@ -28,11 +48,6 @@ inline f32 get_8057515C() { return lbl_8057515C; } -extern "C" f32 lbl_80575148; -inline f32 get_80575148() { - return lbl_80575148; -} - extern "C" f32 lbl_8057519C; inline f32 get_8057519C() { return lbl_8057519C; diff --git a/include/toBeSorted/nand_result_tracker.h b/include/toBeSorted/nand_result_tracker.h index 690f0aaa..6177d858 100644 --- a/include/toBeSorted/nand_result_tracker.h +++ b/include/toBeSorted/nand_result_tracker.h @@ -1,15 +1,17 @@ #ifndef NAND_RESULT_TRACKER_H #define NAND_RESULT_TRACKER_H +#include "egg/core/eggHeap.h" #include "rvl/NAND.h" class NandResultTracker { - public: - static NandResultTracker *GetInstance(); - bool isFailure(NANDResult status); - - private: - NandResultTracker *sInstance; - }; +public: + static void create(EGG::Heap *heap); + static NandResultTracker *GetInstance(); + bool isFailure(NANDResult status); + +private: + NandResultTracker *sInstance; +}; #endif diff --git a/include/toBeSorted/reload_color_fader.h b/include/toBeSorted/reload_color_fader.h index e92b8ea6..55cb7c5a 100644 --- a/include/toBeSorted/reload_color_fader.h +++ b/include/toBeSorted/reload_color_fader.h @@ -12,6 +12,11 @@ public: void fn_80067FE0(); bool fn_80068E80(); bool fn_80067F60(); + void fn_80067DD0(bool); + + bool is1Or5() const { + return field_0x0C == 1 || field_0x0C == 5; + } u8 field_0x00[0x0C - 0x00]; s32 field_0x0C; diff --git a/include/toBeSorted/save_manager.h b/include/toBeSorted/save_manager.h index 746b1486..6f261dcf 100644 --- a/include/toBeSorted/save_manager.h +++ b/include/toBeSorted/save_manager.h @@ -117,6 +117,7 @@ public: }; class SaveMgr { +public: static void create(EGG::Heap *heap); static SaveMgr *GetInstance() { diff --git a/include/toBeSorted/save_related.h b/include/toBeSorted/save_related.h new file mode 100644 index 00000000..f6c85a1c --- /dev/null +++ b/include/toBeSorted/save_related.h @@ -0,0 +1,19 @@ +#ifndef SAVE_RELATED_H +#define SAVE_RELATED_H + +class SaveRelated { +public: + static void create(); + static void remove(); + + static SaveRelated *GetInstance() { + return sInstance; + } + + void fn_80015F40(); + +private: + static SaveRelated *sInstance; +}; + +#endif diff --git a/src/REL/d/d_s_boot.cpp b/src/REL/d/d_s_boot.cpp index 973fb92d..75b1ed25 100644 --- a/src/REL/d/d_s_boot.cpp +++ b/src/REL/d/d_s_boot.cpp @@ -2,6 +2,7 @@ #include "common.h" #include "d/d_base.h" +#include "d/d_d2d.h" #include "d/d_dvd_unk.h" #include "d/d_dylink.h" #include "d/d_font_manager.h" @@ -11,6 +12,7 @@ #include "d/d_scene.h" #include "d/d_sys.h" #include "d/lyt/d_lyt_battery.h" +#include "d/lyt/d_lyt_system_window.h" #include "f/f_base.h" #include "f/f_profile.h" #include "f/f_profile_name.h" @@ -19,14 +21,17 @@ #include "m/m_fader_base.h" #include "m/m_heap.h" #include "m/m_pad.h" -#include "nw4r/ut/ut_ResFont.h" #include "rvl/TPL/TPL.h" #include "s/s_FPhase.h" #include "sized_string.h" #include "toBeSorted/arc_managers/layout_arc_manager.h" #include "toBeSorted/arc_managers/oarc_manager.h" -#include "toBeSorted/hbm.h" +#include "toBeSorted/d_d3d.h" +#include "toBeSorted/d_hbm.h" #include "toBeSorted/reload_color_fader.h" +#include "toBeSorted/save_manager.h" +#include "toBeSorted/save_related.h" +#include "toBeSorted/special_item_drop_mgr.h" sFPhase::phaseCallback dScBoot_c::sCallbacks[] = {&dScBoot_c::cb1, &dScBoot_c::cb2, &dScBoot_c::cb3, &dScBoot_c::cb4, &dScBoot_c::cb5, &dScBoot_c::cb9, @@ -80,7 +85,7 @@ sFPhaseBase::sFPhaseState dScBoot_c::cb3() { } sFPhaseBase::sFPhaseState dScBoot_c::cb4() { - if (!fn_801967D0(getHBM())) { + if (!dHbm_c::GetInstance()->fn_801967D0()) { return sFPhaseBase::PHASE_RETRY; } dHeap::HBMHeap.heap->disableAllocation(); @@ -245,11 +250,11 @@ sFPhaseBase::sFPhaseState dScBoot_c::cb7() { } static u16 profilesToLoad[] = { - // ??? not sure what these correspond to - 0x278, - 0x279, - 0x1B0, - 0x1A9, + // TODO: Why these in particular? + fProfile::PL_RESTART, + fProfile::SW_AREA_TAG, + fProfile::OBJ_SWHIT, + fProfile::BOMBF, }; bool allOk = true; @@ -282,11 +287,13 @@ sFPhaseBase::sFPhaseState dScBoot_c::cb7() { sFPhaseBase::sFPhaseState dScBoot_c::cb8() { return sFPhaseBase::PHASE_NEXT; } - +extern "C" void fn_80059E90(); sFPhaseBase::sFPhaseState dScBoot_c::cb9() { dBase_c::createRoot(fProfile::MESSAGE, 0, dBase_c::OTHER); dBase_c::createRoot(fProfile::C_BASE, 0, dBase_c::OTHER); - + dLytSystemWindow_c::create(); + SaveMgr::GetInstance()->createSaveMsgWindow(); + fn_80059E90(); dLytBattery_c::create(); return sFPhaseBase::PHASE_NEXT; } @@ -298,12 +305,19 @@ STATE_DEFINE(dScBoot_c, Strap); STATE_DEFINE(dScBoot_c, Connect); STATE_DEFINE(dScBoot_c, Save); +void dScBoot_c::drawCallback() { + d2d::draw(); + if (sInstance != nullptr) { + sInstance->mFader.draw(); + } +} + dScBoot_c::strap_c::strap_c() { SizedString<8> str; u8 langNum = getUsedLanguageNTSCNum(); mArcName.mChars[0] = '\0'; - mStr2.mChars[0] = '\0'; - mStr3.mChars[0] = '\0'; + mLytFileName.mChars[0] = '\0'; + mAnimFileName.mChars[0] = '\0'; if (langNum == 3) { str = "F"; } else if (langNum == 4) { @@ -313,8 +327,8 @@ dScBoot_c::strap_c::strap_c() { } // UB: Cannot pass object of non-POD type 'SizedString<8>' through variadic method mArcName.sprintf("strap%s", str); - mStr2.sprintf("strap_00_%s.brlyt", str); - mStr3.sprintf("strap_00_%s_loop.brlan", str); + mLytFileName.sprintf("strap_00_%s.brlyt", str); + mAnimFileName.sprintf("strap_00_%s_loop.brlan", str); LayoutArcManager::GetInstance()->loadLayoutArcFromDisk(mArcName, dHeap::work2Heap.heap); field_0x4EC = 0; } @@ -330,8 +344,8 @@ bool dScBoot_c::strap_c::create() { // want to undo shadowing... ((m2d::ResAccIf_c *)&mResAcc)->attach(data, ""); mLyt.setResAcc(&mResAcc); - mLyt.build(mStr2, nullptr); - mAnm.doSomething(mStr3, &mResAcc); + mLyt.build(mLytFileName, nullptr); + mAnm.doSomething(mAnimFileName, &mResAcc); mLyt.bind(&mAnm); field_0x4EC = 1; field_0x4EE = 0; @@ -389,7 +403,7 @@ dScBoot_c::dScBoot_c() : mStateMgr(*this, sStateID::null), mPhases(this, sCallba } dScBoot_c::~dScBoot_c() { - fn_80197560(getHBM(), 0); + dHbm_c::GetInstance()->fn_80197560(0); sInstance = nullptr; } @@ -400,10 +414,10 @@ int dScBoot_c::create() { mFader.create(); mFader.setFadeInFrame(1); - // TODO + dGfx_c::GetInstance()->setDrawCallback(&drawCallback); dSys::setFrameRate(1); mStateMgr.changeState(StateID_Init); - + SaveRelated::create(); return SUCCEEDED; } @@ -413,7 +427,14 @@ int dScBoot_c::doDelete() { if (!removed || phaseState != sFPhaseBase::PHASE_ALL_DONE) { return NOT_READY; } - // TODO + SaveRelated::remove(); + dBase_c::createRoot(fProfile::LAST, 0, 0); + d3d::createLightTextures(); + SpecialItemDropMgr::create(); + dHbm_c::GetInstance()->offFlags(8); + dGfx_c::GetInstance()->setDrawCallback(nullptr); + ReloadColorFader::GetInstance()->fn_80067DD0(true); + return SUCCEEDED; } int dScBoot_c::execute() { @@ -440,7 +461,7 @@ void dScBoot_c::deleteReady() { } void dScBoot_c::initializeState_Init() { - field_0x5D4 = 0; + mProgressStage = 0; field_0x5D8 = 0; field_0x5DC = 0; field_0x5DD = 0; @@ -455,7 +476,7 @@ void dScBoot_c::executeState_Init() { void dScBoot_c::finalizeState_Init() {} void dScBoot_c::initializeState_Strap() { - field_0x5D4 = 0; + mProgressStage = 0; field_0x5E1 = 1; mFader.fadeIn(); mFader.resetFrames(); @@ -463,10 +484,10 @@ void dScBoot_c::initializeState_Strap() { void dScBoot_c::executeState_Strap() { if (dScene_c::sFader.isStatus(mFaderBase_c::FADED_IN)) { - switch (field_0x5D4) { + switch (mProgressStage) { case 0: if (!checkDone() && mFader.isNotStatus(mFaderBase_c::FADING_IN)) { - field_0x5D4 = 1; + mProgressStage = 1; } break; case 1: @@ -479,7 +500,7 @@ void dScBoot_c::executeState_Strap() { if (ok) { field_0x5DC = 1; if (mFader.fadeOut() == true) { - field_0x5D4 = 2; + mProgressStage = 2; } } } @@ -487,7 +508,7 @@ void dScBoot_c::executeState_Strap() { case 2: if (!checkDone() && mFader.isNotStatus(mFaderBase_c::FADING_OUT)) { if (mFader.fadeIn() == true) { - field_0x5D4 = 3; + mProgressStage = 3; field_0x5E1 = 0; } } @@ -505,10 +526,10 @@ void dScBoot_c::executeState_Strap() { field_0x5E1 = 0; mStateMgr.changeState(StateID_Connect); } else { - field_0x5D4 = 0; + mProgressStage = 0; mStrapScreen.init(); } - fn_80197560(getHBM(), 0); + dHbm_c::GetInstance()->fn_80197560(0); } break; } @@ -521,7 +542,7 @@ void dScBoot_c::finalizeState_Strap() { } void dScBoot_c::initializeState_Connect() { - field_0x5D4 = 0; + mProgressStage = 0; dSys::setFrameRate(2); } @@ -532,9 +553,9 @@ void dScBoot_c::executeState_Connect() { void dScBoot_c::finalizeState_Connect() {} void dScBoot_c::initializeState_Save() { - field_0x5D4 = 0; + mProgressStage = 0; field_0x5D8 = 0; - // TODO + SaveRelated::GetInstance()->fn_80015F40(); } void dScBoot_c::executeState_Save() { @@ -546,7 +567,7 @@ void dScBoot_c::finalizeState_Save() {} bool dScBoot_c::checkDone() { if (field_0x5E3 == 1) { field_0x5E3 = 0; - field_0x5D4 = 4; + mProgressStage = 4; return 1; } return 0; diff --git a/src/d/d_dvd_drive_error.cpp b/src/d/d_dvd_drive_error.cpp new file mode 100644 index 00000000..2f7329b5 --- /dev/null +++ b/src/d/d_dvd_drive_error.cpp @@ -0,0 +1,154 @@ +#include "d/d_dvd_drive_error.h" + +#include "d/d_dvd_unk.h" +#include "d/d_textunk.h" +#include "egg/gfx/eggDrawGX.h" +#include "egg/gfx/eggScreen.h" +#include "m/m_mtx.h" +#include "m/m_vec.h" +#include "toBeSorted/lyt_related_floats.h" +#include "toBeSorted/reload_color_fader.h" + + +/** 805750d0 */ +dDvdDriveError_c *dDvdDriveError_c::sInstance; + +/** 80052300 */ +void dDvdDriveError_c::create(EGG::Heap *heap) { + sInstance = new (heap, 0x04) dDvdDriveError_c(); + sInstance->init(); +} + +/** 80052340 */ +bool dDvdDriveError_c::isError() const { + return mIsError; +} + +// The alternative would be "-str readonly,noreuse" + +static const wchar_t sErrEnGeneral[] = L"Please insert The Legend of Zelda:\nSkyward Sword Game Disc."; +static const wchar_t sErrEnDiskId[] = L"Please insert The Legend of Zelda:\nSkyward Sword Game Disc."; +static const wchar_t sErrEnDiskError[] = L"The disc could not be read.\nRefer to the Wii Operations\nManual for details."; + +static const wchar_t *sErrorsEn[] = { + sErrEnGeneral, + sErrEnDiskId, + sErrEnDiskError, +}; + +static const wchar_t sErrEsGeneral[] = L"Por favor, inserta el disco\nde The Legend of Zelda:\nSkyward Sword."; +static const wchar_t sErrEsDiskId[] = L"Por favor, inserta el disco\nde The Legend of Zelda:\nSkyward Sword."; +static const wchar_t sErrEsDiskError[] = L"No se puede leer el disco.\nConsulta el manual de operaciones\nde la consola Wii para obtener m\xe1" + "s\ninformaci\xf3" + "n."; + +static const wchar_t *sErrorsEs[] = { + sErrEsGeneral, + sErrEsDiskId, + sErrEsDiskError, +}; + +static const wchar_t sErrFrGeneral[] = L"Veuillez ins\xe9" + "rer le disque\nThe Legend of Zelda:\nSkyward Sword."; +static const wchar_t sErrFrDiskId[] = L"Veuillez ins\xe9" + "rer le disque\nThe Legend of Zelda:\nSkyward Sword."; +static const wchar_t sErrFrDiskError[] = L"Impossible de lire le disque.\nVeuillez vous r\xe9" + "f\xe9" + "rer au mode\nd'emploi de la Wii pour plus\nde d\xe9" + "tails."; + +static const wchar_t *sErrorsFr[] = { + sErrFrGeneral, + sErrFrDiskId, + sErrFrDiskError, +}; + +extern "C" u8 fn_80054F30(); + +/** 80052350 */ +void dDvdDriveError_c::draw() { + EGG::Screen screen; + screen.SetCanvasMode(EGG::Screen::CANVASMODE_0); + screen.SetProjectionType(EGG::Frustum::PROJ_ORTHO); + screen.SetNearFar(0.0f, 500.0f); + screen.SetScale(mVec3_c(get_80575190() / get_80575144(), 1.0f, 1.0f)); + screen.SetProjectionGX(); + f32 x = get_80575144() * 0.5f; + f32 mx = -x; + f32 y = get_80575148() * 0.5f; + f32 my = -y; + + EGG::DrawGX::BeginDrawScreen(screen.GetCanvasMode() == EGG::Screen::CANVASMODE_1, false, false); + GXSetTevSwapModeTable(GX_TEV_SWAP0, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_ALPHA); + mMtx_c mtx; + f32 dy, dx; + dx = x - mx; + dy = my - y; + screen.CalcMatrixForDrawQuad(mtx, mx, y, nw4r::math::FAbs(dx), nw4r::math::FAbs(dy)); + + EGG::DrawGX::DrawDL(EGG::DrawGX::DL_17, mtx, EGG::DrawGX::BLACK); + + nw4r::math::MTX44 mtx2; + f32 a = get_8057511C(); + f32 b = get_80575118(); + C_MTXOrtho(mtx2, 0.0f, a, 0.0f, b, 0.0f, 1.0f); + GXSetProjection(mtx2, GX_ORTHOGRAPHIC); + GXSetScissor(0, 0, b, a); + mMtx_c mtx3; + MTXIdentity(mtx3); + GXLoadPosMtxImm(mtx3, 0); + GXSetCurrentMtx(0); + u32 idx = 0; + if (mDvdDriveStatus == DVD_STATE_WRONG_DISK_ID) { + idx = 1; + } else if (mDvdDriveStatus == DVD_STATE_DISK_ERROR) { + idx = 2; + } + + u8 lang = fn_80054F30(); + const wchar_t *str; + if (lang == 3) { + str = sErrorsFr[idx]; + } else if (lang == 4) { + str = sErrorsEs[idx]; + } else { + str = sErrorsEn[idx]; + } + + nw4r::ut::TextWriterBase textWriter; + + textWriter.SetFont(dDvdUnk::FontUnk::GetInstance()->getFont()); + + textWriter.SetScale( + UnkTextThing::getFn800B1F70() * UnkTextThing::getFn800B1FD0(), + UnkTextThing::getFn800B1F70() * UnkTextThing::getFn800B1FD0() + ); + + textWriter.SetupGX(); + textWriter.SetDrawFlag(0x110); + textWriter.SetCursorX(get_8057514C()); + textWriter.SetCursorY(get_80575150()); + + textWriter.Print(str, wcslen(str)); +} + +/** 800526b0 */ +void dDvdDriveError_c::execute() { + mDvdDriveStatus = DVDGetDriveStatus(); + if (!mIsError) { + if (mDvdDriveStatus != DVD_STATE_IDLE && mDvdDriveStatus != DVD_STATE_BUSY) { + mIsError = true; + dDvdUnk::FontUnk::GetInstance()->fn_80052C60(); + } + } else if (mDvdDriveStatus == DVD_STATE_IDLE) { + if (!ReloadColorFader::GetInstance()->is1Or5()) { + mIsError = false; + } + } +} + +/** 80052750 */ +void dDvdDriveError_c::init() { + mDvdDriveStatus = DVD_STATE_IDLE; + mIsError = false; +} diff --git a/src/d/d_dvd_unk.cpp b/src/d/d_dvd_unk.cpp index eb34b79a..5732bdc8 100644 --- a/src/d/d_dvd_unk.cpp +++ b/src/d/d_dvd_unk.cpp @@ -1,43 +1,23 @@ #include "d/d_dvd_unk.h" +#include "d/d_dvd_drive_error.h" #include "egg/core/eggHeap.h" -#include "nw4r/ut/ut_ResFont.h" +#include "toBeSorted/nand_result_tracker.h" +#include "d/dol_backup_error_font.inc" + namespace dDvdUnk { -/** 805750d0 */ -static unkstruct_c *singleton; - -static nw4r::ut::ResFont *fontPtr; - -/** 80052300 */ -unkstruct_c *unkstruct_c::create(EGG::Heap *heap) { - singleton = new (heap, 0x04) unkstruct_c(); - singleton->init(); -} - -/** 80052340 */ -char unkstruct_c::getUnk() { - return field_0x4; -} - -/** 80052350 */ -void unkstruct_c::draw() { - // EGG:: -} - -/** 800526b0 */ -void unkstruct_c::execute() {} - -/** 80052750 */ -void unkstruct_c::init() { - field_0x0 = 0; - field_0x4 = 0; -} - -void unkstruct_c::createFont(EGG::Heap *heap) { - fontPtr = new (heap, 0x04) nw4r::ut::ResFont(); +FontUnk *FontUnk::sInstance; +extern "C" void fn_80059D10(EGG::Heap *heap); +void FontUnk::create(EGG::Heap *heap) { + sInstance = new (heap, 0x04) FontUnk(); + sInstance->init(); + dDvdDriveError_c::create(heap); + NandResultTracker::create(heap); + fn_80059D10(heap); + sInstance->field_0x2C = 0; } } // namespace dDvdUnk diff --git a/src/d/d_sc_title.cpp b/src/d/d_sc_title.cpp index 3f46894d..7402456a 100644 --- a/src/d/d_sc_title.cpp +++ b/src/d/d_sc_title.cpp @@ -16,6 +16,7 @@ #include "toBeSorted/file_manager.h" #include "toBeSorted/music_mgrs.h" #include "toBeSorted/reload_color_fader.h" +#include "toBeSorted/save_related.h" #include "toBeSorted/unk_save_time.h" SPECIAL_BASE_PROFILE(TITLE, dScTitle_c, fProfile::TITLE, 0, 0); @@ -67,7 +68,6 @@ dScTitle_c::~dScTitle_c() { extern "C" u32 TITLE_SCREEN_CHANGE; extern "C" void fn_80059450(); extern "C" void fn_80058C90(s32); -extern "C" void fn_80015E40(); static const char *const sFileSelect = "FileSelect"; static const char *const sSkb = "SoftwareKeyboard"; @@ -92,7 +92,7 @@ int dScTitle_c::create() { dSys::setClearColor(mColor(0x00000000)); fn_80059450(); fn_80058C90(0); - fn_80015E40(); + SaveRelated::create(); field_0x2AD = 0; LayoutArcManager::GetInstance()->loadLayoutArcFromDisk(sFileSelect, nullptr); LayoutArcManager::GetInstance()->loadLayoutArcFromDisk(sSkb, nullptr); @@ -112,8 +112,6 @@ int dScTitle_c::execute() { return SUCCEEDED; } -extern "C" void fn_80015E80(); - int dScTitle_c::doDelete() { // TODO return codes int result; @@ -147,7 +145,7 @@ int dScTitle_c::doDelete() { } dScGame_c::doDelete(); - fn_80015E80(); + SaveRelated::remove(); return SUCCEEDED; } diff --git a/src/d/lyt/meter/d_lyt_meter.cpp b/src/d/lyt/meter/d_lyt_meter.cpp index 7b4928bf..c52fe168 100644 --- a/src/d/lyt/meter/d_lyt_meter.cpp +++ b/src/d/lyt/meter/d_lyt_meter.cpp @@ -592,9 +592,7 @@ u8 dLytMeterMain_c::getUiMode() { return StoryflagManager::sInstance->getFlag(840); } -#pragma dont_inline on dLytMeterMain_c::dLytMeterMain_c() {} -#pragma dont_inline reset static const d2d::LytBrlanMapping meterBrlanMap[] = { { "basicPosition_00_in.brlan", "G_remoConBtn_00"}, diff --git a/src/d/lyt/msg_window/d_lyt_msg_window.cpp b/src/d/lyt/msg_window/d_lyt_msg_window.cpp index af85c022..53431f92 100644 --- a/src/d/lyt/msg_window/d_lyt_msg_window.cpp +++ b/src/d/lyt/msg_window/d_lyt_msg_window.cpp @@ -743,7 +743,6 @@ void dLytMsgWindow_c::setCurrentFlowFilename(const char *name) { mCurrentFlowFileName = name; } -#pragma dont_inline on void dLytMsgWindow_c::createSubMsgManager(u8 type) { switch (type) { case 6: @@ -792,8 +791,6 @@ void dLytMsgWindow_c::createSubMsgManager(u8 type) { } } -#pragma dont_inline off - void dLytMsgWindow_c::removeSubMsgManagers() { if (mpWindowTalk != nullptr) { mpWindowTalk->remove(); diff --git a/src/toBeSorted/blur_and_palette_manager.cpp b/src/toBeSorted/blur_and_palette_manager.cpp index f86d9e43..54a233b4 100644 --- a/src/toBeSorted/blur_and_palette_manager.cpp +++ b/src/toBeSorted/blur_and_palette_manager.cpp @@ -21,7 +21,6 @@ Spf::Spf() {} Sff::Sff() {} -#pragma dont_inline on BlurAndPaletteManager::BlurAndPaletteManager() { mColor grey_aaaaaa = mColor(0xaa, 0xaa, 0xaa, 0xff); mColor white_ffffff = mColor(0xff, 0xff, 0xff, 0xff); @@ -188,4 +187,3 @@ BlurAndPaletteManager::BlurAndPaletteManager() { field_0x5D04.field_0x00 = field_0x5CE4; field_0x5D04.field_0x20 = field_0x5CE4; } -#pragma dont_inline reset