diff --git a/.clangd b/.clangd new file mode 100644 index 00000000..31d8a800 --- /dev/null +++ b/.clangd @@ -0,0 +1,9 @@ +CompileFlags: + Add: -ferror-limit=100 + +Diagnostics: + Suppress: + - bad_cxx_cast_unrelated_class + - init_conversion_failed + - member_function_call_bad_type + - ovl_no_viable_member_function_in_call diff --git a/config/RSPE01_01/symbols.txt b/config/RSPE01_01/symbols.txt index c452a375..a743b23b 100644 --- a/config/RSPE01_01/symbols.txt +++ b/config/RSPE01_01/symbols.txt @@ -6846,10 +6846,10 @@ fn_80183178 = .text:0x80183178; // type:function size:0x40 getTimeStampString__11RPSysSystemFv = .text:0x801831B8; // type:function size:0x8 getDvdEndMessage__11RPSysSystemCFv = .text:0x801831C0; // type:function size:0x8 getNandEndMessage__11RPSysSystemCFv = .text:0x801831C8; // type:function size:0x8 -fn_801831D0 = .text:0x801831D0; // type:function size:0x8 +getWc24Thread__11RPSysSystemFv = .text:0x801831D0; // type:function size:0x8 getDvdThread__11RPSysSystemFv = .text:0x801831D8; // type:function size:0x8 getNandThread__11RPSysSystemFv = .text:0x801831E0; // type:function size:0x8 -fn_801831E8 = .text:0x801831E8; // type:function size:0x8 +setDimming__11RPSysSystemFi = .text:0x801831E8; // type:function size:0x8 systemShutDown__11RPSysSystemFv = .text:0x801831F0; // type:function size:0xD8 fn_801832C8 = .text:0x801832C8; // type:function size:0x28 fn_801832F0 = .text:0x801832F0; // type:function size:0x18 @@ -6858,17 +6858,17 @@ fn_80183314 = .text:0x80183314; // type:function size:0xA0 fn_801833B4 = .text:0x801833B4; // type:function size:0xBC getCalendarTime16__11RPSysSystemFv = .text:0x80183470; // type:function size:0x4C getCalendarTime32__11RPSysSystemFv = .text:0x801834BC; // type:function size:0x5C -fn_80183518 = .text:0x80183518; // type:function size:0x14 +destroyHeap__11RPSysSystemFPQ23EGG4Heap = .text:0x80183518; // type:function size:0x14 getBootScene__11RPSysSystemFv = .text:0x8018352C; // type:function size:0x8 fn_80183534 = .text:0x80183534; // type:function size:0x50 fn_80183584 = .text:0x80183584; // type:function size:0x24 -fn_801835A8 = .text:0x801835A8; // type:function size:0xC -fn_801835B4 = .text:0x801835B4; // type:function size:0xC +getFBHeight__11RPSysSystemCFv = .text:0x801835A8; // type:function size:0xC +getFBWidth__11RPSysSystemCFv = .text:0x801835B4; // type:function size:0xC fn_801835C0 = .text:0x801835C0; // type:function size:0x14 fn_801835D4 = .text:0x801835D4; // type:function size:0x8 setupRenderMode__11RPSysSystemFv = .text:0x801835DC; // type:function size:0x130 setupTVMode__11RPSysSystemFv = .text:0x8018370C; // type:function size:0x6C -fn_80183778 = .text:0x80183778; // type:function size:0x180 +loadFrameWork__11RPSysSystemFb = .text:0x80183778; // type:function size:0x180 mainLoop__11RPSysSystemFv = .text:0x801838F8; // type:function size:0x16C setup__11RPSysSystemFv = .text:0x80183A64; // type:function size:0x13C create__11RPSysSystemFv = .text:0x80183BA0; // type:function size:0x44 @@ -6883,91 +6883,92 @@ fn_80183ED4 = .text:0x80183ED4; // type:function size:0x8 fn_80183EDC = .text:0x80183EDC; // type:function size:0x8 main = .text:0x80183EE4; // type:function size:0x34 scope:global OSReport = .text:0x80183F18; // type:function size:0x50 scope:global -fn_80183F68 = .text:0x80183F68; // type:function size:0x40 -fn_80183FA8 = .text:0x80183FA8; // type:function size:0x58 -fn_80184000 = .text:0x80184000; // type:function size:0x460 -fn_80184460 = .text:0x80184460; // type:function size:0x5C -fn_801844BC = .text:0x801844BC; // type:function size:0x9C -fn_80184558 = .text:0x80184558; // type:function size:0x9C -fn_801845F4 = .text:0x801845F4; // type:function size:0x9C -fn_80184690 = .text:0x80184690; // type:function size:0x5C -fn_801846EC = .text:0x801846EC; // type:function size:0x6C -fn_80184758 = .text:0x80184758; // type:function size:0xAC -fn_80184804 = .text:0x80184804; // type:function size:0x34 -fn_80184838 = .text:0x80184838; // type:function size:0x360 -fn_80184B98 = .text:0x80184B98; // type:function size:0xC -fn_80184BA4 = .text:0x80184BA4; // type:function size:0x26C -fn_80184E10 = .text:0x80184E10; // type:function size:0x70 -fn_80184E80 = .text:0x80184E80; // type:function size:0x10 -fn_80184E90 = .text:0x80184E90; // type:function size:0x8 -fn_80184E98 = .text:0x80184E98; // type:function size:0x8 -fn_80184EA0 = .text:0x80184EA0; // type:function size:0xF0 -fn_80184F90 = .text:0x80184F90; // type:function size:0x74 -fn_80185004 = .text:0x80185004; // type:function size:0x4 -fn_80185008 = .text:0x80185008; // type:function size:0x40 -fn_80185048 = .text:0x80185048; // type:function size:0x4C -fn_80185094 = .text:0x80185094; // type:function size:0xD0 -fn_80185164 = .text:0x80185164; // type:function size:0x4 -fn_80185168 = .text:0x80185168; // type:function size:0xC0 -fn_80185228 = .text:0x80185228; // type:function size:0x4 -fn_8018522C = .text:0x8018522C; // type:function size:0xD8 -fn_80185304 = .text:0x80185304; // type:function size:0xFC -fn_80185400 = .text:0x80185400; // type:function size:0x4 -fn_80185404 = .text:0x80185404; // type:function size:0x68 -fn_8018546C = .text:0x8018546C; // type:function size:0x8 -fn_80185474 = .text:0x80185474; // type:function size:0x8 -fn_8018547C = .text:0x8018547C; // type:function size:0x8 -fn_80185484 = .text:0x80185484; // type:function size:0x48 -fn_801854CC = .text:0x801854CC; // type:function size:0x48 -fn_80185514 = .text:0x80185514; // type:function size:0x8 -fn_8018551C = .text:0x8018551C; // type:function size:0x8 -fn_80185524 = .text:0x80185524; // type:function size:0x50 -fn_80185574 = .text:0x80185574; // type:function size:0x8 -fn_8018557C = .text:0x8018557C; // type:function size:0x8 -fn_80185584 = .text:0x80185584; // type:function size:0x8 -fn_8018558C = .text:0x8018558C; // type:function size:0x8 -fn_80185594 = .text:0x80185594; // type:function size:0x4 -fn_80185598 = .text:0x80185598; // type:function size:0x4 -fn_8018559C = .text:0x8018559C; // type:function size:0x4 -fn_801855A0 = .text:0x801855A0; // type:function size:0x4 -fn_801855A4 = .text:0x801855A4; // type:function size:0x4 -fn_801855A8 = .text:0x801855A8; // type:function size:0xC -fn_801855B4 = .text:0x801855B4; // type:function size:0x8 +__dt__17RPSysSceneCreatorFv = .text:0x80183F68; // type:function size:0x40 +__dt__10RPSysSceneFv = .text:0x80183FA8; // type:function size:0x58 +createSportsScene__17RPSysSceneCreatorFl = .text:0x80184000; // type:function size:0x460 +__dt__17RPSportsBaseSceneFv = .text:0x80184460; // type:function size:0x5C +getAudioType__17RPSysSceneCreatorFl = .text:0x801844BC; // type:function size:0x9C +getExitType__17RPSysSceneCreatorFl = .text:0x80184558; // type:function size:0x9C +getCreateType__17RPSysSceneCreatorFl = .text:0x801845F4; // type:function size:0x9C +getSceneID__17RPSysSceneCreatorFQ217RPSysSceneCreator8ESportID = .text:0x80184690; // type:function size:0x5C +getSportID__17RPSysSceneCreatorFl = .text:0x801846EC; // type:function size:0x6C +getResDirName__17RPSysSceneCreatorFl = .text:0x80184758; // type:function size:0xAC +destroy__17RPSysSceneCreatorFl = .text:0x80184804; // type:function size:0x34 +create__17RPSysSceneCreatorFl = .text:0x80184838; // type:function size:0x360 +changeSoftReset__17RPSysSceneCreatorFv = .text:0x80184B98; // type:function size:0xC +changeSceneAfterFade__17RPSysSceneCreatorFlb = .text:0x80184BA4; // type:function size:0x26C +CreateInstance__17RPSysSceneCreatorFPQ23EGG4Heap = .text:0x80184E10; // type:function size:0x70 +setChildScene__10RPSysSceneFv = .text:0x80184E80; // type:function size:0x10 +getCreatorSceneID__10RPSysSceneCFv = .text:0x80184E90; // type:function size:0x8 +setCreatorSceneID__10RPSysSceneFl = .text:0x80184E98; // type:function size:0x8 +init__10RPSysSceneFv = .text:0x80184EA0; // type:function size:0xF0 +exit__10RPSysSceneFv = .text:0x80184F90; // type:function size:0x74 +Exit__10RPSysSceneFv = .text:0x80185004; // type:function size:0x4 scope:weak +outgoing_childCreate__10RPSysSceneFv = .text:0x80185008; // type:function size:0x40 +draw__10RPSysSceneFv = .text:0x80185048; // type:function size:0x4C +calc__10RPSysSceneFv = .text:0x80185094; // type:function size:0xD0 +Calculate__10RPSysSceneFv = .text:0x80185164; // type:function size:0x4 scope:weak +incoming_childDestroy__10RPSysSceneFv = .text:0x80185168; // type:function size:0xC0 +Reset__10RPSysSceneFv = .text:0x80185228; // type:function size:0x4 scope:weak +reinit__10RPSysSceneFv = .text:0x8018522C; // type:function size:0xD8 +enter__10RPSysSceneFv = .text:0x80185304; // type:function size:0xFC +Configure__10RPSysSceneFv = .text:0x80185400; // type:function size:0x4 scope:weak +__ct__10RPSysSceneFv = .text:0x80185404; // type:function size:0x68 +setDimming__10RPSysSceneFb = .text:0x8018546C; // type:function size:0x8 +startFadeOut__10RPSysSceneFv = .text:0x80185474; // type:function size:0x8 +startFadeIn__10RPSysSceneFv = .text:0x8018547C; // type:function size:0x8 +setSceneFadeColor__10RPSysSceneFQ34nw4r2ut5Color = .text:0x80185484; // type:function size:0x48 +setFadeColor__10RPSysSceneFQ34nw4r2ut5Color = .text:0x801854CC; // type:function size:0x48 +getFadeColor__10RPSysSceneCFv = .text:0x80185514; // type:function size:0x8 +setFadeFrame__10RPSysSceneFUs = .text:0x8018551C; // type:function size:0x8 +isNandAccessEnable__10RPSysSceneCFv = .text:0x80185524; // type:function size:0x50 +isSceneChangeEnable__10RPSysSceneCFv = .text:0x80185574; // type:function size:0x8 +isSceneBlank__10RPSysSceneCFv = .text:0x8018557C; // type:function size:0x8 +isSceneDisplay__10RPSysSceneCFv = .text:0x80185584; // type:function size:0x8 +VF_0x3C__10RPSysSceneFv = .text:0x8018558C; // type:function size:0x8 scope:weak +pauseCallBack__10RPSysSceneFb = .text:0x80185594; // type:function size:0x4 scope:weak +LoadResource__10RPSysSceneFv = .text:0x80185598; // type:function size:0x4 scope:weak +taskAsync__10RPSysSceneFv = .text:0x8018559C; // type:function size:0x4 scope:weak +UserDraw__16IRPGrpDrawObjectFv = .text:0x801855A0; // type:function size:0x4 scope:weak +DebugDraw__16IRPGrpDrawObjectFv = .text:0x801855A4; // type:function size:0x4 scope:weak +__sinit_\RPSysScene_cpp = .text:0x801855A8; // type:function size:0xC scope:local +@36@__dt__10RPSysSceneFv = .text:0x801855B4; // type:function size:0x8 scope:weak adjust__19RPSysRenderModeFPUsPUsii = .text:0x801855BC; // type:function size:0xBC -fn_80185678 = .text:0x80185678; // type:function size:0x58 -fn_801856D0 = .text:0x801856D0; // type:function size:0x198 -fn_80185868 = .text:0x80185868; // type:function size:0x34 -fn_8018589C = .text:0x8018589C; // type:function size:0x14 -fn_801858B0 = .text:0x801858B0; // type:function size:0x14 -fn_801858C4 = .text:0x801858C4; // type:function size:0x14 -fn_801858D8 = .text:0x801858D8; // type:function size:0x90 -fn_80185968 = .text:0x80185968; // type:function size:0x74 -fn_801859DC = .text:0x801859DC; // type:function size:0x74 -fn_80185A50 = .text:0x80185A50; // type:function size:0x74 -fn_80185AC4 = .text:0x80185AC4; // type:function size:0x74 -fn_80185B38 = .text:0x80185B38; // type:function size:0x14 -fn_80185B4C = .text:0x80185B4C; // type:function size:0x14 -fn_80185B60 = .text:0x80185B60; // type:function size:0x4 -fn_80185B64 = .text:0x80185B64; // type:function size:0x14 -fn_80185B78 = .text:0x80185B78; // type:function size:0x14 -fn_80185B8C = .text:0x80185B8C; // type:function size:0x48 -fn_80185BD4 = .text:0x80185BD4; // type:function size:0x8C -fn_80185C60 = .text:0x80185C60; // type:function size:0x2C -fn_80185C8C = .text:0x80185C8C; // type:function size:0x54 -fn_80185CE0 = .text:0x80185CE0; // type:function size:0x48 -fn_80185D28 = .text:0x80185D28; // type:function size:0xC -fn_80185D34 = .text:0x80185D34; // type:function size:0x40 -fn_80185D74 = .text:0x80185D74; // type:function size:0x190 -isDvdErrorApplicationEnd__13RPSysSceneMgrCFv = .text:0x80185F04; // type:function size:0x14 -fn_80185F18 = .text:0x80185F18; // type:function size:0x20 -fn_80185F38 = .text:0x80185F38; // type:function size:0x18 -fn_80185F50 = .text:0x80185F50; // type:function size:0x14 -isNormalState__13RPSysSceneMgrFv = .text:0x80185F64; // type:function size:0x10 -shutdownSystem__13RPSysSceneMgrFi = .text:0x80185F74; // type:function size:0x70 -returnToMenu__13RPSysSceneMgrFi = .text:0x80185FE4; // type:function size:0x70 -softReset__13RPSysSceneMgrFi = .text:0x80186054; // type:function size:0xAC -fn_80186100 = .text:0x80186100; // type:function size:0x8 -fn_80186108 = .text:0x80186108; // type:function size:0x12C +__dt__13RPSysSceneMgrFv = .text:0x80185678; // type:function size:0x58 +updateState__13RPSysSceneMgrFv = .text:0x801856D0; // type:function size:0x198 +calcCurrentScene__13RPSysSceneMgrFv = .text:0x80185868; // type:function size:0x34 +drawMgrFader__13RPSysSceneMgrFv = .text:0x8018589C; // type:function size:0x14 +drawSceneFader__13RPSysSceneMgrFv = .text:0x801858B0; // type:function size:0x14 +calcSceneFader__13RPSysSceneMgrFv = .text:0x801858C4; // type:function size:0x14 +isSceneChangeEnable__13RPSysSceneMgrFv = .text:0x801858D8; // type:function size:0x90 +isTaskFinished__13RPSysSceneMgrFv = .text:0x80185968; // type:function size:0x74 +isFadeOut__13RPSysSceneMgrFv = .text:0x801859DC; // type:function size:0x74 +isBlank__13RPSysSceneMgrFv = .text:0x80185A50; // type:function size:0x74 +isDisplay__13RPSysSceneMgrFv = .text:0x80185AC4; // type:function size:0x74 +startSceneFadeOut__13RPSysSceneMgrFv = .text:0x80185B38; // type:function size:0x14 +startSceneFadeIn__13RPSysSceneMgrFv = .text:0x80185B4C; // type:function size:0x14 +startMgrFadeIn__13RPSysSceneMgrFv = .text:0x80185B60; // type:function size:0x4 +setSceneStatus__13RPSysSceneMgrFQ33EGG5Fader7EStatus = .text:0x80185B64; // type:function size:0x14 +getSceneStatus__13RPSysSceneMgrFv = .text:0x80185B78; // type:function size:0x14 +setSceneFadeColor__13RPSysSceneMgrFQ34nw4r2ut5Color = .text:0x80185B8C; // type:function size:0x48 +setFadeColor__13RPSysSceneMgrFQ34nw4r2ut5Color = .text:0x80185BD4; // type:function size:0x8C +getFadeColor__13RPSysSceneMgrFv = .text:0x80185C60; // type:function size:0x8 +getColor__Q23EGG10ColorFaderCFv = .text:0x80185C68; // type:function size:0x24 +resetFadeColor__13RPSysSceneMgrFv = .text:0x80185C8C; // type:function size:0x54 +setFadeFrame__13RPSysSceneMgrFUs = .text:0x80185CE0; // type:function size:0x48 +getFadeFrame__13RPSysSceneMgrFv = .text:0x80185D28; // type:function size:0xC +resetFadeFrame__13RPSysSceneMgrFv = .text:0x80185D34; // type:function size:0x40 +changeNextSceneAfterFade__13RPSysSceneMgrFlb = .text:0x80185D74; // type:function size:0x190 +isDvdErrorApplicationEnd__13RPSysSceneMgrFv = .text:0x80185F04; // type:function size:0x14 +isApplicationEndReserved__13RPSysSceneMgrFv = .text:0x80185F18; // type:function size:0x20 +resetGuard__13RPSysSceneMgrFv = .text:0x80185F38; // type:function size:0x18 +isShutDownReserved__13RPSysSceneMgrCFv = .text:0x80185F50; // type:function size:0x14 +isNormalState__13RPSysSceneMgrCFv = .text:0x80185F64; // type:function size:0x10 +shutdownSystem__13RPSysSceneMgrFb = .text:0x80185F74; // type:function size:0x70 +returnToMenu__13RPSysSceneMgrFb = .text:0x80185FE4; // type:function size:0x70 +softReset__13RPSysSceneMgrFb = .text:0x80186054; // type:function size:0xAC +getCurrentSceneRP__13RPSysSceneMgrCFv = .text:0x80186100; // type:function size:0x8 +CreateInstance__13RPSysSceneMgrFPQ23EGG4Heap = .text:0x80186108; // type:function size:0x12C setLanguage__17RPSysProjectLocalFQ217RPSysProjectLocal5EArea = .text:0x80186234; // type:function size:0x8 setLocale__17RPSysProjectLocalFQ217RPSysProjectLocal5EArea = .text:0x8018623C; // type:function size:0x8 appendLocalDirectory__17RPSysProjectLocalFPcPCc = .text:0x80186244; // type:function size:0x120 @@ -6988,18 +6989,18 @@ dump__19RPSysPrimTagParmFv = .text:0x801867F8; // type:function size:0x4 write__19RPSysPrimTagParmFRQ23EGG6Stream = .text:0x801867FC; // type:function size:0x10 read__19RPSysPrimTagParmFRQ23EGG6Stream = .text:0x8018680C; // type:function size:0x34 __ct__12RPSysTagParmFP18RPSysTagParametersPc = .text:0x80186840; // type:function size:0x38 -fn_80186878 = .text:0x80186878; // type:function size:0x10 -fn_80186888 = .text:0x80186888; // type:function size:0xD8 -fn_80186960 = .text:0x80186960; // type:function size:0xBC -fn_80186A1C = .text:0x80186A1C; // type:function size:0x8C -fn_80186AA8 = .text:0x80186AA8; // type:function size:0x78 -fn_80186B20 = .text:0x80186B20; // type:function size:0x114 -fn_80186C34 = .text:0x80186C34; // type:function size:0xB8 -fn_80186CEC = .text:0x80186CEC; // type:function size:0x10 -fn_80186CFC = .text:0x80186CFC; // type:function size:0x20 -fn_80186D1C = .text:0x80186D1C; // type:function size:0x10 -fn_80186D2C = .text:0x80186D2C; // type:function size:0x4 -fn_80186D30 = .text:0x80186D30; // type:function size:0x110 +taskAsyncFunc__10RPSysSceneFPv = .text:0x80186878; // type:function size:0x10 +loadResourceFunc__10RPSysSceneFPv = .text:0x80186888; // type:function size:0xD8 +updateNandEndMessage__10RPSysSceneFv = .text:0x80186960; // type:function size:0xBC +updateDvdEndMessage__10RPSysSceneFv = .text:0x80186A1C; // type:function size:0x8C +initTaskAsync__10RPSysSceneFv = .text:0x80186AA8; // type:function size:0x78 +loadMessage__10RPSysSceneFv = .text:0x80186B20; // type:function size:0x114 +load__10RPSysSceneFv = .text:0x80186C34; // type:function size:0xB8 +enableLoadMessage__10RPSysSceneFv = .text:0x80186CEC; // type:function size:0x10 +isTaskAsyncFinish__10RPSysSceneCFv = .text:0x80186CFC; // type:function size:0x20 +setTaskAsync__10RPSysSceneFv = .text:0x80186D1C; // type:function size:0x10 +loadUpdate__10RPSysSceneFv = .text:0x80186D2C; // type:function size:0x4 +drawTimeStamp__10RPSysSceneFQ34nw4r2ut5Color = .text:0x80186D30; // type:function size:0x110 fn_80186E40 = .text:0x80186E40; // type:function size:0x58 fn_80186E98 = .text:0x80186E98; // type:function size:0x1C LoadFromDVD__20RPSysResourceManagerFPCcPQ23EGG4HeapQ33EGG9DvdRipper15EAllocDirectionPl = .text:0x80186EB4; // type:function size:0xEC @@ -7025,10 +7026,10 @@ fn_80187B54 = .text:0x80187B54; // type:function size:0x40 fn_80187B94 = .text:0x80187B94; // type:function size:0xC fn_80187BA0 = .text:0x80187BA0; // type:function size:0x70 fn_80187C10 = .text:0x80187C10; // type:function size:0x7C -fn_80187C8C = .text:0x80187C8C; // type:function size:0x88 -fn_80187D14 = .text:0x80187D14; // type:function size:0x64 -fn_80187D78 = .text:0x80187D78; // type:function size:0x44 -fn_80187DBC = .text:0x80187DBC; // type:function size:0x128 +postUpdate__17RPSysCommonObjectFv = .text:0x80187C8C; // type:function size:0x88 +preUpdate__17RPSysCommonObjectFv = .text:0x80187D14; // type:function size:0x64 +init__17RPSysCommonObjectFv = .text:0x80187D78; // type:function size:0x44 +__ct__17RPSysCommonObjectFv = .text:0x80187DBC; // type:function size:0x128 __dt__11RPGrpScreenFv = .text:0x80187EE4; // type:function size:0x40 scope:weak fn_80187F24 = .text:0x80187F24; // type:function size:0x40 __dt__14RPSysDvdStatusFv = .text:0x80187F64; // type:function size:0x40 @@ -7312,9 +7313,9 @@ fn_80193278 = .text:0x80193278; // type:function size:0x10 fn_80193288 = .text:0x80193288; // type:function size:0x22C fn_801934B4 = .text:0x801934B4; // type:function size:0xD0 fn_80193584 = .text:0x80193584; // type:function size:0x7C -fn_80193600 = .text:0x80193600; // type:function size:0x9C -fn_8019369C = .text:0x8019369C; // type:function size:0x48 -fn_801936E4 = .text:0x801936E4; // type:function size:0x18 +stopAllEffect__14RPSysEffectMgrFv = .text:0x80193600; // type:function size:0x9C +resetCreator__14RPSysEffectMgrFP18RPSysEffectCreator = .text:0x8019369C; // type:function size:0x48 +setCreator__14RPSysEffectMgrFP18RPSysEffectCreatorUl = .text:0x801936E4; // type:function size:0x18 fn_801936FC = .text:0x801936FC; // type:function size:0x9C fn_80193798 = .text:0x80193798; // type:function size:0x10 fn_801937A8 = .text:0x801937A8; // type:function size:0x10 @@ -7459,7 +7460,7 @@ fn_80198770 = .text:0x80198770; // type:function size:0x4 fn_80198774 = .text:0x80198774; // type:function size:0x4 fn_80198778 = .text:0x80198778; // type:function size:0x8C fn_80198804 = .text:0x80198804; // type:function size:0xD4 -fn_801988D8 = .text:0x801988D8; // type:function size:0x90 +__ct__18RPSysEffectCreatorFUl = .text:0x801988D8; // type:function size:0x90 Initialize__19RPSysWideTextWriterFv = .text:0x80198968; // type:function size:0x28 getFrameMax__14RPSysLytAnmObjFv = .text:0x80198990; // type:function size:0x40 init__14RPSysLytAnmObjFssQ214RPSysFrameCtrl9EPlayMode = .text:0x801989D0; // type:function size:0x7C @@ -7943,22 +7944,22 @@ fn_801AF1D4 = .text:0x801AF1D4; // type:function size:0x4 fn_801AF1D8 = .text:0x801AF1D8; // type:function size:0x230 fn_801AF408 = .text:0x801AF408; // type:function size:0x4 fn_801AF40C = .text:0x801AF40C; // type:function size:0x24 -fn_801AF430 = .text:0x801AF430; // type:function size:0x24 +AppendDrawObject__13RPGrpRendererFP16IRPGrpDrawObject = .text:0x801AF430; // type:function size:0x24 fn_801AF454 = .text:0x801AF454; // type:function size:0x138 fn_801AF58C = .text:0x801AF58C; // type:function size:0x9C fn_801AF628 = .text:0x801AF628; // type:function size:0x98 fn_801AF6C0 = .text:0x801AF6C0; // type:function size:0x54 -fn_801AF714 = .text:0x801AF714; // type:function size:0x58 -fn_801AF76C = .text:0x801AF76C; // type:function size:0x84 -fn_801AF7F0 = .text:0x801AF7F0; // type:function size:0x8 -fn_801AF7F8 = .text:0x801AF7F8; // type:function size:0x4F0 +CalculateInPause__13RPGrpRendererFv = .text:0x801AF714; // type:function size:0x58 +PostCalculate__13RPGrpRendererFv = .text:0x801AF76C; // type:function size:0x84 +PreCalculate__13RPGrpRendererFv = .text:0x801AF7F0; // type:function size:0x8 +Rendering__13RPGrpRendererFv = .text:0x801AF7F8; // type:function size:0x4F0 fn_801AFCE8 = .text:0x801AFCE8; // type:function size:0x60 -fn_801AFD48 = .text:0x801AFD48; // type:function size:0x30 -fn_801AFD78 = .text:0x801AFD78; // type:function size:0x8 -fn_801AFD80 = .text:0x801AFD80; // type:function size:0x160 -fn_801AFEE0 = .text:0x801AFEE0; // type:function size:0xC -fn_801AFEEC = .text:0x801AFEEC; // type:function size:0x80 -fn_801AFF6C = .text:0x801AFF6C; // type:function size:0x98 +BecomeCurrent__13RPGrpRendererFv = .text:0x801AFD48; // type:function size:0x30 +Destruct__13RPGrpRendererFv = .text:0x801AFD78; // type:function size:0x8 +Construct__13RPGrpRendererFPQ23EGG9AllocatorUs = .text:0x801AFD80; // type:function size:0x160 +End__13RPGrpRendererFv = .text:0x801AFEE0; // type:function size:0xC +StartDebugDraw__13RPGrpRendererFv = .text:0x801AFEEC; // type:function size:0x80 +Begin__13RPGrpRendererFv = .text:0x801AFF6C; // type:function size:0x98 fn_801B0004 = .text:0x801B0004; // type:function size:0x48 fn_801B004C = .text:0x801B004C; // type:function size:0x16C fn_801B01B8 = .text:0x801B01B8; // type:function size:0x40 @@ -15028,7 +15029,7 @@ cubeScale$10537 = .rodata:0x803820A4; // type:object size:0x4 scope:local @10977 = .rodata:0x803820B0; // type:object size:0x4 scope:local align:4 data:float lbl_803820B8 = .rodata:0x803820B8; // type:object size:0x10 lbl_803820C8 = .rodata:0x803820C8; // type:object size:0x30 -lbl_803820F8 = .rodata:0x803820F8; // type:object size:0x1E0 data:4byte +SCENE_ATTR_TABLE__17RPSysSceneCreator = .rodata:0x803820F8; // type:object size:0x1E0 data:4byte lbl_803822D8 = .rodata:0x803822D8; // type:object size:0xA data:string lbl_803822E2 = .rodata:0x803822E2; // type:object size:0x5 lbl_803822E7 = .rodata:0x803822E7; // type:object size:0x13 @@ -18553,7 +18554,7 @@ __vt__11RPSysSystem = .data:0x803B9578; // type:object size:0xC scope:global lbl_803B9584 = .data:0x803B9584; // type:object size:0x34 scope:global jumptable_803B95B8 = .data:0x803B95B8; // type:object size:0x30 scope:local __vt__17RPSysSceneCreator = .data:0x803B95E8; // type:object size:0x18 scope:global -__vt__10RPSysScene = .data:0x803B9600; // type:object size:0x60 scope:global +__vt__10RPSysScene = .data:0x803B9600; // type:object size:0x5C scope:global NtscInt__11RPSysSystem = .data:0x803B9660; // type:object size:0x3C NtscProg__11RPSysSystem = .data:0x803B969C; // type:object size:0x3C PalInt__11RPSysSystem = .data:0x803B96D8; // type:object size:0x3C @@ -18772,8 +18773,8 @@ lbl_803C1D68 = .data:0x803C1D68; // type:object size:0x10 lbl_803C1D78 = .data:0x803C1D78; // type:object size:0x180 lbl_803C1EF8 = .data:0x803C1EF8; // type:object size:0x50 lbl_803C1F48 = .data:0x803C1F48; // type:object size:0x30 -lbl_803C1F78 = .data:0x803C1F78; // type:object size:0x60 -lbl_803C1FD8 = .data:0x803C1FD8; // type:object size:0x60 +__vt__14RPSysBootScene = .data:0x803C1F78; // type:object size:0x60 +__vt__22RPSysPlayerSelectScene = .data:0x803C1FD8; // type:object size:0x60 lbl_803C2038 = .data:0x803C2038; // type:object size:0xC lbl_803C2044 = .data:0x803C2044; // type:object size:0x22 data:string lbl_803C2068 = .data:0x803C2068; // type:object size:0x12 data:string @@ -18790,7 +18791,7 @@ jumptable_803C2278 = .data:0x803C2278; // type:object size:0x30 scope:local jumptable_803C22A8 = .data:0x803C22A8; // type:object size:0x30 scope:local jumptable_803C22D8 = .data:0x803C22D8; // type:object size:0x30 scope:local jumptable_803C2308 = .data:0x803C2308; // type:object size:0x30 scope:local -lbl_803C2338 = .data:0x803C2338; // type:object size:0xE0 +__vt__22RPSysNunchukCheckScene = .data:0x803C2338; // type:object size:0xE0 lbl_803C2418 = .data:0x803C2418; // type:object size:0x78 lbl_803C2490 = .data:0x803C2490; // type:object size:0xB8 data:4byte lbl_803C2548 = .data:0x803C2548; // type:object size:0x20 data:4byte @@ -18803,14 +18804,14 @@ lbl_803C2618 = .data:0x803C2618; // type:object size:0x20 lbl_803C2638 = .data:0x803C2638; // type:object size:0x18 lbl_803C2650 = .data:0x803C2650; // type:object size:0x10 lbl_803C2660 = .data:0x803C2660; // type:object size:0x20 -lbl_803C2680 = .data:0x803C2680; // type:object size:0xE8 +__vt__22RPSportsPackTitleScene = .data:0x803C2680; // type:object size:0xE8 jumptable_803C2768 = .data:0x803C2768; // type:object size:0x24 scope:local gap_08_803C278C_data = .data:0x803C278C; // type:object size:0x4 scope:global -lbl_803C2790 = .data:0x803C2790; // type:object size:0x60 -lbl_803C27F0 = .data:0x803C27F0; // type:object size:0x60 -lbl_803C2850 = .data:0x803C2850; // type:object size:0x60 -lbl_803C28B0 = .data:0x803C28B0; // type:object size:0x60 -lbl_803C2910 = .data:0x803C2910; // type:object size:0x80 +__vt__25RPSportsTrainingMenuScene = .data:0x803C2790; // type:object size:0x60 +__vt__25RPSportsPhysicalMenuScene = .data:0x803C27F0; // type:object size:0x60 +__vt__27RPSportsPhysicalResultScene = .data:0x803C2850; // type:object size:0x60 +__vt__28RPSportsPhysicalPreviewScene = .data:0x803C28B0; // type:object size:0x60 +__vt__17RPSportsBaseScene = .data:0x803C2910; // type:object size:0x80 lbl_803C2990 = .data:0x803C2990; // type:object size:0x10 lbl_803C29A0 = .data:0x803C29A0; // type:object size:0x10 lbl_803C29B0 = .data:0x803C29B0; // type:object size:0x24 data:4byte @@ -18833,7 +18834,7 @@ lbl_803C2C68 = .data:0x803C2C68; // type:object size:0x2C lbl_803C2C94 = .data:0x803C2C94; // type:object size:0x5C lbl_803C2CF0 = .data:0x803C2CF0; // type:object size:0x18 lbl_803C2D08 = .data:0x803C2D08; // type:object size:0xC0 -lbl_803C2DC8 = .data:0x803C2DC8; // type:object size:0x60 +__vt__17RPSportsMainScene = .data:0x803C2DC8; // type:object size:0x60 lbl_803C2E28 = .data:0x803C2E28; // type:object size:0x18 lbl_803C2E40 = .data:0x803C2E40; // type:object size:0x18 lbl_803C2E58 = .data:0x803C2E58; // type:object size:0x10 @@ -18880,7 +18881,7 @@ lbl_803C35E8 = .data:0x803C35E8; // type:object size:0x10 data:4byte lbl_803C35F8 = .data:0x803C35F8; // type:object size:0xD0 data:4byte lbl_803C36C8 = .data:0x803C36C8; // type:object size:0x50 lbl_803C3718 = .data:0x803C3718; // type:object size:0x18 -lbl_803C3730 = .data:0x803C3730; // type:object size:0x80 +__vt__10RPTnsScene = .data:0x803C3730; // type:object size:0x80 lbl_803C37B0 = .data:0x803C37B0; // type:object size:0x68 lbl_803C3818 = .data:0x803C3818; // type:object size:0x10 __vt__19RPSndAudioActorBase = .data:0x803C3828; // type:object size:0x28 @@ -19043,7 +19044,7 @@ lbl_803C4F48 = .data:0x803C4F48; // type:object size:0x10 lbl_803C4F58 = .data:0x803C4F58; // type:object size:0x28 lbl_803C4F80 = .data:0x803C4F80; // type:object size:0x48 lbl_803C4FC8 = .data:0x803C4FC8; // type:object size:0x10 -lbl_803C4FD8 = .data:0x803C4FD8; // type:object size:0x80 +__vt__10RPBsbScene = .data:0x803C4FD8; // type:object size:0x80 jumptable_803C5058 = .data:0x803C5058; // type:object size:0x7C scope:local jumptable_803C50D4 = .data:0x803C50D4; // type:object size:0x20 scope:local gap_08_803C50F4_data = .data:0x803C50F4; // type:object size:0xA8 scope:global @@ -19154,7 +19155,7 @@ lbl_803C7658 = .data:0x803C7658; // type:object size:0x50 jumptable_803C76A8 = .data:0x803C76A8; // type:object size:0x20 scope:local lbl_803C76C8 = .data:0x803C76C8; // type:object size:0x28 lbl_803C76F0 = .data:0x803C76F0; // type:object size:0x28 -lbl_803C7718 = .data:0x803C7718; // type:object size:0x80 +__vt__10RPGolScene = .data:0x803C7718; // type:object size:0x80 lbl_803C7798 = .data:0x803C7798; // type:object size:0x10 lbl_803C77A8 = .data:0x803C77A8; // type:object size:0xC lbl_803C77B4 = .data:0x803C77B4; // type:object size:0xC @@ -19213,7 +19214,7 @@ lbl_803C7F38 = .data:0x803C7F38; // type:object size:0xC lbl_803C7F44 = .data:0x803C7F44; // type:object size:0xC lbl_803C7F50 = .data:0x803C7F50; // type:object size:0xC lbl_803C7F5C = .data:0x803C7F5C; // type:object size:0x2C -lbl_803C7F88 = .data:0x803C7F88; // type:object size:0x60 +__vt__22RPGolCourseSelectScene = .data:0x803C7F88; // type:object size:0x60 lbl_803C7FE8 = .data:0x803C7FE8; // type:object size:0x40 lbl_803C8028 = .data:0x803C8028; // type:object size:0x40 lbl_803C8068 = .data:0x803C8068; // type:object size:0x30 @@ -19298,7 +19299,7 @@ lbl_803C8988 = .data:0x803C8988; // type:object size:0xC lbl_803C8994 = .data:0x803C8994; // type:object size:0xC jumptable_803C89A0 = .data:0x803C89A0; // type:object size:0x28 scope:local lbl_803C89C8 = .data:0x803C89C8; // type:object size:0x38 -lbl_803C8A00 = .data:0x803C8A00; // type:object size:0x80 +__vt__10RPBoxScene = .data:0x803C8A00; // type:object size:0x80 jumptable_803C8A80 = .data:0x803C8A80; // type:object size:0x28 scope:local jumptable_803C8AA8 = .data:0x803C8AA8; // type:object size:0x24 scope:local jumptable_803C8ACC = .data:0x803C8ACC; // type:object size:0x28 scope:local @@ -19473,7 +19474,7 @@ lbl_803CA274 = .data:0x803CA274; // type:object size:0x34 lbl_803CA2A8 = .data:0x803CA2A8; // type:object size:0x18 lbl_803CA2C0 = .data:0x803CA2C0; // type:object size:0x10 lbl_803CA2D0 = .data:0x803CA2D0; // type:object size:0x14 -lbl_803CA2E4 = .data:0x803CA2E4; // type:object size:0x94 +__vt__10RPBowScene = .data:0x803CA2E4; // type:object size:0x94 lbl_803CA378 = .data:0x803CA378; // type:object size:0x20 lbl_803CA398 = .data:0x803CA398; // type:object size:0x18 lbl_803CA3B0 = .data:0x803CA3B0; // type:object size:0x14 @@ -21858,8 +21859,8 @@ spInstance__11RPSysSystem = .sbss:0x804BF4B8; // type:object size:0x4 data:4byte lbl_804BF4BC = .sbss:0x804BF4BC; // type:object size:0x4 data:4byte lbl_804BF4C0 = .sbss:0x804BF4C0; // type:object size:0x4 data:4byte sRenderModeFormat__11RPSysSystem = .sbss:0x804BF4C4; // type:object size:0x4 data:4byte -lbl_804BF4C8 = .sbss:0x804BF4C8; // type:object size:0x8 data:4byte -lbl_804BF4D0 = .sbss:0x804BF4D0; // type:object size:0x8 data:4byte +spInstance__17RPSysSceneCreator = .sbss:0x804BF4C8; // type:object size:0x8 data:4byte +sUnkStruct__10RPSysScene = .sbss:0x804BF4D0; // type:object size:0x4 data:4byte spInstance__13RPSysSceneMgr = .sbss:0x804BF4D8; // type:object size:0x8 data:4byte spInstance__17RPSysProjectLocal = .sbss:0x804BF4E0; // type:object size:0x4 data:4byte spInstance__15RPSysGameConfig = .sbss:0x804BF4E8; // type:object size:0x4 data:4byte @@ -21868,13 +21869,13 @@ lbl_804BF4F8 = .sbss:0x804BF4F8; // type:object size:0x8 data:4byte spInstance__14RPSysDvdStatus = .sbss:0x804BF500; // type:object size:0x4 data:4byte spInstance__16RPSysSaveDataMgr = .sbss:0x804BF508; // type:object size:0x8 data:4byte spInstance__16RPSysFontManager = .sbss:0x804BF510; // type:object size:0x8 data:4byte -lbl_804BF518 = .sbss:0x804BF518; // type:object size:0x8 data:4byte -lbl_804BF520 = .sbss:0x804BF520; // type:object size:0x8 data:4byte +spInstance__13RPSysPauseMgr = .sbss:0x804BF518; // type:object size:0x8 data:4byte +spInstance__14RPSysPlayerMgr = .sbss:0x804BF520; // type:object size:0x8 data:4byte spInstance__24RPSysHostIOSocketManager = .sbss:0x804BF528; // type:object size:0x4 data:4byte spInstance__15RP_DEBUG_STUB_0 = .sbss:0x804BF530; // type:object size:0x4 data:4byte spInstance__15RPSysTextWriter = .sbss:0x804BF538; // type:object size:0x4 data:4byte spInstance__19RPSysKokeshiManager = .sbss:0x804BF540; // type:object size:0x8 data:4byte -lbl_804BF548 = .sbss:0x804BF548; // type:object size:0x8 data:4byte +spInstance__14RPSysEffectMgr = .sbss:0x804BF548; // type:object size:0x8 data:4byte lbl_804BF550 = .sbss:0x804BF550; // type:object size:0x8 spTextBuffer__19RPSysWideTextWriter = .sbss:0x804BF558; // type:object size:0x4 data:4byte lbl_804BF560 = .sbss:0x804BF560; // type:object size:0x8 data:4byte @@ -21908,7 +21909,7 @@ lbl_804BF5F0 = .sbss:0x804BF5F0; // type:object size:0x8 data:byte lbl_804BF5F8 = .sbss:0x804BF5F8; // type:object size:0x8 data:4byte spCurrent__20RPGrpModelResManager = .sbss:0x804BF600; // type:object size:0x8 data:4byte lbl_804BF608 = .sbss:0x804BF608; // type:object size:0x8 data:4byte -lbl_804BF610 = .sbss:0x804BF610; // type:object size:0x4 data:4byte +spCurrent__13RPGrpRenderer = .sbss:0x804BF610; // type:object size:0x4 data:4byte lbl_804BF614 = .sbss:0x804BF614; // type:object size:0x1 data:byte lbl_804BF615 = .sbss:0x804BF615; // type:object size:0x1 data:byte gap_11_804BF616_sbss = .sbss:0x804BF616; // type:object size:0x2 scope:global diff --git a/configure.py b/configure.py index 6a143faf..d102444c 100755 --- a/configure.py +++ b/configure.py @@ -1206,7 +1206,7 @@ def MatchingFor(*versions): "progress_category": "system", # str | List[str] "objects": [ Object(NonMatching, "Pack/RPSystem/RPSysSceneCreator.cpp"), - Object(NonMatching, "Pack/RPSystem/RPSysScene.cpp"), + Object(Matching, "Pack/RPSystem/RPSysScene.cpp"), Object(NonMatching, "Pack/RPSystem/RPSysRenderMode.cpp"), Object(NonMatching, "Pack/RPSystem/RPSysSceneMgr.cpp"), Object(Matching, "Pack/RPSystem/RPSysProjectLocal.cpp"), diff --git a/include/Pack/RPGraphics.h b/include/Pack/RPGraphics.h index 3dc6abaa..3b6b9d18 100644 --- a/include/Pack/RPGraphics.h +++ b/include/Pack/RPGraphics.h @@ -1,6 +1,7 @@ #ifndef RP_PUBLIC_GRAPHICS_H #define RP_PUBLIC_GRAPHICS_H +#include #include #include #include diff --git a/include/Pack/RPGraphics/IRPGrpDrawObject.h b/include/Pack/RPGraphics/IRPGrpDrawObject.h new file mode 100644 index 00000000..a20e87ae --- /dev/null +++ b/include/Pack/RPGraphics/IRPGrpDrawObject.h @@ -0,0 +1,40 @@ +#ifndef RP_GRAPHICS_I_DRAW_OBJECT_H +#define RP_GRAPHICS_I_DRAW_OBJECT_H +#include + +//! @addtogroup rp_graphics +//! @{ + +/** + * @brief Interface for renderable objects + */ +class IRPGrpDrawObject { +private: + //! Next renderable in the linked list + IRPGrpDrawObject* mpNext; // at 0x0 + +public: + /** + * @brief Constructor + */ + IRPGrpDrawObject() : mpNext(NULL) {} + + /** + * @brief Destructor + */ + virtual ~IRPGrpDrawObject() {} // at 0x8 + + /** + * @brief Standard draw pass + */ + virtual void UserDraw() {} // at 0xC + + /** + * @brief Additional draw pass for debugging + */ + virtual void DebugDraw() {} // at 0x10 +}; + +//! @} + +#endif diff --git a/include/Pack/RPGraphics/RPGrpRenderer.h b/include/Pack/RPGraphics/RPGrpRenderer.h index 984a707f..c10526cc 100644 --- a/include/Pack/RPGraphics/RPGrpRenderer.h +++ b/include/Pack/RPGraphics/RPGrpRenderer.h @@ -2,10 +2,13 @@ #define RP_GRAPHICS_RENDERER_H #include +#include + //! @addtogroup rp_graphics //! @{ // Forward declarations +class IRPGrpDrawObject; class RPGrpScreen; /** @@ -31,6 +34,26 @@ class RPGrpRenderer { return spCurrentScreen; } + static void Begin(); + static void End(); + + static void StartDebugDraw(); + + static RPGrpRenderer* Construct(EGG::Allocator* pAllocator, u16 id); + + void Rendering(); + void Destruct(); + void BecomeCurrent(); + + void AppendDrawObject(IRPGrpDrawObject* pObject); + void AppendDrawObject(IRPGrpDrawObject& rObject) { + AppendDrawObject(&rObject); + } + + void PreCalculate(); + void PostCalculate(); + void CalculateInPause(); + private: //! Allocator used for model-related allocations static RPGrpRenderer* spCurrent; diff --git a/include/Pack/RPKernel.h b/include/Pack/RPKernel.h index 9912de53..29c0be6c 100644 --- a/include/Pack/RPKernel.h +++ b/include/Pack/RPKernel.h @@ -8,6 +8,8 @@ #include #include #include +#include +#include #include #include #include @@ -39,6 +41,7 @@ #include #include #include +#include #include #include #include diff --git a/include/Pack/RPKernel/RPSysController.h b/include/Pack/RPKernel/RPSysController.h index 83af9c93..708500ac 100644 --- a/include/Pack/RPKernel/RPSysController.h +++ b/include/Pack/RPKernel/RPSysController.h @@ -307,9 +307,9 @@ class RPSysCoreController : public EGG::CoreController, /** * @brief Constructor * - * @param id Unique ID + * @param playerNo Player ID */ - RPSysCoreController(u32 id); + RPSysCoreController(u32 playerNo); /** * @brief Destructor diff --git a/include/Pack/RPKernel/RPSysEffectCreator.h b/include/Pack/RPKernel/RPSysEffectCreator.h new file mode 100644 index 00000000..bfd43719 --- /dev/null +++ b/include/Pack/RPKernel/RPSysEffectCreator.h @@ -0,0 +1,31 @@ +#ifndef RP_KERNEL_EFFECT_CREATOR_H +#define RP_KERNEL_EFFECT_CREATOR_H +#include + +//! @addtogroup rp_kernel +//! @{ + +/** + * @brief Effect creator + */ +class RPSysEffectCreator { +public: + /** + * @brief Constructor + * + * @param effectScene Effect scene index + */ + RPSysEffectCreator(u32 effectScene); + + /** + * @brief Destructor + */ + virtual ~RPSysEffectCreator(); // at 0x8 + +private: + char unk4[0x44 - 0x4]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPKernel/RPSysEffectMgr.h b/include/Pack/RPKernel/RPSysEffectMgr.h new file mode 100644 index 00000000..36159494 --- /dev/null +++ b/include/Pack/RPKernel/RPSysEffectMgr.h @@ -0,0 +1,40 @@ +#ifndef RP_KERNEL_EFFECT_MGR_H +#define RP_KERNEL_EFFECT_MGR_H +#include + +#include + +//! @addtogroup rp_kernel +//! @{ + +// Forward declarations +class RPSysEffectCreator; + +/** + * @brief Effect manager + */ +class RPSysEffectMgr { + RP_SINGLETON_DECL_EX(RPSysEffectMgr); + +public: + /** + * @brief Effect scene index + */ + enum EEffectScene { + EEffectScene_Scene, //!< Scene effects + EEffectScene_Cursor, //!< Cursor effects + EEffectScene_Work, //!< Miscellaneous effects + + EEffectScene_Max + }; + +public: + void stopAllEffect(); + + void setCreator(RPSysEffectCreator* pCreator, u32 effectScene); + void resetCreator(RPSysEffectCreator* pCreator); +}; + +//! @} + +#endif diff --git a/include/Pack/RPKernel/RPSysHomeMenuMgr.h b/include/Pack/RPKernel/RPSysHomeMenuMgr.h index ce4b9527..5c61d8b3 100644 --- a/include/Pack/RPKernel/RPSysHomeMenuMgr.h +++ b/include/Pack/RPKernel/RPSysHomeMenuMgr.h @@ -1,9 +1,10 @@ -#ifndef RP_KERNEL_HOME_MENU_MANAGER_H -#define RP_KERNEL_HOME_MENU_MANAGER_H +#ifndef RP_KERNEL_HOME_MENU_MGR_H +#define RP_KERNEL_HOME_MENU_MGR_H #include -#include #include +#include + #include //! @addtogroup rp_kernel @@ -18,32 +19,36 @@ class RPSysHomeMenuMgr { public: void update(); + bool isOpen() const { + return mIsOpen; + } + /** * @brief Check if program is exiting/resetting and black out if true - * - * @return BOOL + * + * @return BOOL */ BOOL startBlackOut(); private: struct unknownArcStruct { - void *mArcFile; + void* mArcFile; u32 UNK_0x04; // set to 1 if DVD error occurs in function 801A4E8C u16 UNK_0x08; u16 UNK_0x0A; }; - u8 mUNK_0x08; // set to 1 at the end of LoadResource. bool? + u8 mUNK_0x08; // set to 1 at the end of LoadResource. bool? bool mUNK_0x09; // checked in 801A4E8C to make sure error has not occurred bool mUNK_0x0A; // set to true if no DVD error and scene change disabled - bool mBlackOutOk; + bool mIsOpen; u8 mUNK_0x0C; u8 mUNK_0x0D; u32 mUNK_0x10; u16 mUNK_0x14; RPSysProjectLocal* mProjectLocal; unknownArcStruct* mARC_0x1C; - HBMDataInfo *mMenuDataInfo; + HBMDataInfo* mMenuDataInfo; u32 mUNK_0x24; u32 mUNK_0x28; u32 mUNK_0x2C; @@ -55,11 +60,12 @@ class RPSysHomeMenuMgr { u32 mUNK_0x44; // Seemingly skipped in constructor? u32 mUNK_0x48; u32 mUNK_0x4C; - f32 mUNK_0x50; // Set to 1.2 if the console is in PAL 50 Hz mode, otherwise 1.0 + f32 mUNK_0x50; // Set to 1.2 if the console is in PAL 50 Hz mode, + // otherwise 1.0 f32 mUNK_0x54; f32 mUNK_0x58; u32 mUNK_0x5C; - const HBMControllerData *mHbmControllerData; + const HBMControllerData* mHbmControllerData; u8 mUNK_0x64[60]; KPADStatus mKpadStatus; }; diff --git a/include/Pack/RPKernel/RPSysKokeshiCtrlDataLoader.h b/include/Pack/RPKernel/RPSysKokeshiCtrlDataLoader.h index ff6f3ddd..b4d94c53 100644 --- a/include/Pack/RPKernel/RPSysKokeshiCtrlDataLoader.h +++ b/include/Pack/RPKernel/RPSysKokeshiCtrlDataLoader.h @@ -29,7 +29,7 @@ class RPSysKokeshiCtrlDataLoader { /** * @brief Constructor * - * @param chan WPAD channel to use + * @param chan Remote channel */ explicit RPSysKokeshiCtrlDataLoader(s32 chan); diff --git a/include/Pack/RPKernel/RPSysKokeshiCtrlDataMgr.h b/include/Pack/RPKernel/RPSysKokeshiCtrlDataMgr.h index d6eb816c..94c072fd 100644 --- a/include/Pack/RPKernel/RPSysKokeshiCtrlDataMgr.h +++ b/include/Pack/RPKernel/RPSysKokeshiCtrlDataMgr.h @@ -79,12 +79,12 @@ class RPSysKokeshiCtrlDataMgr { public: /** - * @brief Construct + * @brief Constructor * * @param pCallback Controller data callback * @param pParentHeap Heap to use as the parent of the controller data heap * @param heapSize Size of the controller data heap - * @param index WPAD channel to use + * @param chan Remote channel */ RPSysKokeshiCtrlDataMgr(IRPSysKokeshiCtrlDataCallback* pCallback, EGG::Heap* pParentHeap, u32 heapSize, s32 chan); diff --git a/include/Pack/RPSystem/RPSysSystem.h b/include/Pack/RPKernel/RPSysSystem.h similarity index 96% rename from include/Pack/RPSystem/RPSysSystem.h rename to include/Pack/RPKernel/RPSysSystem.h index 6276a805..b8cc1b2d 100644 --- a/include/Pack/RPSystem/RPSysSystem.h +++ b/include/Pack/RPKernel/RPSysSystem.h @@ -1,9 +1,9 @@ -#ifndef RP_SYSTEM_SYSTEM_H -#define RP_SYSTEM_SYSTEM_H +#ifndef RP_KERNEL_SYSTEM_H +#define RP_KERNEL_SYSTEM_H #include -#include #include +#include #include @@ -26,7 +26,7 @@ class RPSysConfigData { virtual EGG::Video* GetVideo() { return mVideo; - } + } virtual EGG::Heap* GetSystemHeap() { return mSystemHeap; } @@ -47,27 +47,29 @@ class RPSysConfigData { } virtual void StubA() {} virtual void StubB() {} + private: void* mMem1Start; void* mMem1End; void* mMem2Start; void* mMem2End; u32 mMemSize; - EGG::Heap *mRootHeapMem1; - EGG::Heap *mRootHeapMem2; - EGG::Heap *mRootHeapDebug; + EGG::Heap* mRootHeapMem1; + EGG::Heap* mRootHeapMem2; + EGG::Heap* mRootHeapDebug; + protected: EGG::Heap* mSystemHeap; EGG::Thread* mCreatorThread; void* mCodeStart; void* mCodeEnd; u32 mSystemHeapSize; - EGG::Video *mVideo; - EGG::XfbManager *mXfbMgr; - EGG::Display *mDisplay; - EGG::PerformanceView *mPerfView; - EGG::SceneManager *mSceneMgr; - EGG::IAudioMgr *mAudioMgr; + EGG::Video* mVideo; + EGG::XfbManager* mXfbMgr; + EGG::Display* mDisplay; + EGG::PerformanceView* mPerfView; + EGG::SceneManager* mSceneMgr; + EGG::IAudioMgr* mAudioMgr; }; /** diff --git a/include/Pack/RPParty.h b/include/Pack/RPParty.h deleted file mode 100644 index 0147f07b..00000000 --- a/include/Pack/RPParty.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef RP_PUBLIC_PARTY_H -#define RP_PUBLIC_PARTY_H - -#include - -#endif diff --git a/include/Pack/RPParty/RPBilScene.h b/include/Pack/RPParty/RPBilScene.h new file mode 100644 index 00000000..5a022c07 --- /dev/null +++ b/include/Pack/RPParty/RPBilScene.h @@ -0,0 +1,6 @@ +#ifndef RP_PUBLIC_PARTY_BIL_H +#define RP_PUBLIC_PARTY_BIL_H + +#include + +#endif diff --git a/include/Pack/RPParty/RPBilScene/RPBilScene.h b/include/Pack/RPParty/RPBilScene/RPBilScene.h new file mode 100644 index 00000000..e5cfd578 --- /dev/null +++ b/include/Pack/RPParty/RPBilScene/RPBilScene.h @@ -0,0 +1,19 @@ +#ifndef RP_PARTY_BIL_SCENE_H +#define RP_PARTY_BIL_SCENE_H +#include + +#include + +//! @addtogroup rp_bil +//! @{ + +/** + * @brief Party Pack Billiards scene + */ +class RPBilScene : public RPSysScene { + char unk44[0x58 - 0x44]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPParty/RPBomScene.h b/include/Pack/RPParty/RPBomScene.h new file mode 100644 index 00000000..c5aba73b --- /dev/null +++ b/include/Pack/RPParty/RPBomScene.h @@ -0,0 +1,6 @@ +#ifndef RP_PUBLIC_PARTY_BOM_H +#define RP_PUBLIC_PARTY_BOM_H + +#include + +#endif diff --git a/include/Pack/RPParty/RPBomScene/RPBomScene.h b/include/Pack/RPParty/RPBomScene/RPBomScene.h new file mode 100644 index 00000000..527c6e88 --- /dev/null +++ b/include/Pack/RPParty/RPBomScene/RPBomScene.h @@ -0,0 +1,19 @@ +#ifndef RP_PARTY_BOM_SCENE_H +#define RP_PARTY_BOM_SCENE_H +#include + +#include + +//! @addtogroup rp_bom +//! @{ + +/** + * @brief Party Pack Pose Mii scene + */ +class RPBomScene : public RPSysScene { + char unk44[0x8C - 0x44]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPParty/RPCowScene.h b/include/Pack/RPParty/RPCowScene.h new file mode 100644 index 00000000..34dd1b9e --- /dev/null +++ b/include/Pack/RPParty/RPCowScene.h @@ -0,0 +1,6 @@ +#ifndef RP_PUBLIC_PARTY_COW_H +#define RP_PUBLIC_PARTY_COW_H + +#include + +#endif diff --git a/include/Pack/RPParty/RPCowScene/RPCowScene.h b/include/Pack/RPParty/RPCowScene/RPCowScene.h new file mode 100644 index 00000000..29dda4f6 --- /dev/null +++ b/include/Pack/RPParty/RPCowScene/RPCowScene.h @@ -0,0 +1,17 @@ +#ifndef RP_PARTY_COW_SCENE_H +#define RP_PARTY_COW_SCENE_H +#include + +#include + +//! @addtogroup rp_cow +//! @{ + +/** + * @brief Party Pack Charge! scene + */ +class RPCowScene : public RPPartySeqScene {}; + +//! @} + +#endif diff --git a/include/Pack/RPParty/RPDucScene.h b/include/Pack/RPParty/RPDucScene.h new file mode 100644 index 00000000..43774685 --- /dev/null +++ b/include/Pack/RPParty/RPDucScene.h @@ -0,0 +1,6 @@ +#ifndef RP_PUBLIC_PARTY_DUC_H +#define RP_PUBLIC_PARTY_DUC_H + +#include + +#endif diff --git a/include/Pack/RPParty/RPDucScene/RPDucScene.h b/include/Pack/RPParty/RPDucScene/RPDucScene.h new file mode 100644 index 00000000..7ca5e233 --- /dev/null +++ b/include/Pack/RPParty/RPDucScene/RPDucScene.h @@ -0,0 +1,19 @@ +#ifndef RP_PARTY_DUC_SCENE_H +#define RP_PARTY_DUC_SCENE_H +#include + +#include + +//! @addtogroup rp_duc +//! @{ + +/** + * @brief Party Pack Shooting Range scene + */ +class RPDucScene : public RPSysScene { + char unk44[0x80 - 0x44]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPParty/RPFshScene.h b/include/Pack/RPParty/RPFshScene.h new file mode 100644 index 00000000..e3854eec --- /dev/null +++ b/include/Pack/RPParty/RPFshScene.h @@ -0,0 +1,6 @@ +#ifndef RP_PUBLIC_PARTY_FSH_H +#define RP_PUBLIC_PARTY_FSH_H + +#include + +#endif diff --git a/include/Pack/RPParty/RPFshScene/RPFshScene.h b/include/Pack/RPParty/RPFshScene/RPFshScene.h new file mode 100644 index 00000000..92c5fa69 --- /dev/null +++ b/include/Pack/RPParty/RPFshScene/RPFshScene.h @@ -0,0 +1,19 @@ +#ifndef RP_PARTY_FSH_SCENE_H +#define RP_PARTY_FSH_SCENE_H +#include + +#include + +//! @addtogroup rp_fsh +//! @{ + +/** + * @brief Party Pack Fishing scene + */ +class RPFshScene : public RPSysScene { + char unk44[0x48 - 0x44]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPParty/RPHkyScene.h b/include/Pack/RPParty/RPHkyScene.h new file mode 100644 index 00000000..48f1a7e0 --- /dev/null +++ b/include/Pack/RPParty/RPHkyScene.h @@ -0,0 +1,6 @@ +#ifndef RP_PUBLIC_PARTY_HKY_H +#define RP_PUBLIC_PARTY_HKY_H + +#include + +#endif diff --git a/include/Pack/RPParty/RPHkyScene/RPHkyScene.h b/include/Pack/RPParty/RPHkyScene/RPHkyScene.h new file mode 100644 index 00000000..f8349df6 --- /dev/null +++ b/include/Pack/RPParty/RPHkyScene/RPHkyScene.h @@ -0,0 +1,19 @@ +#ifndef RP_PARTY_HKY_SCENE_H +#define RP_PARTY_HKY_SCENE_H +#include + +#include + +//! @addtogroup rp_hky +//! @{ + +/** + * @brief Party Pack Laser Hockey scene + */ +class RPHkyScene : public RPSysScene { + char unk44[0x4C - 0x44]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPParty/RPPartyCommon.h b/include/Pack/RPParty/RPPartyCommon.h new file mode 100644 index 00000000..0eaf86d3 --- /dev/null +++ b/include/Pack/RPParty/RPPartyCommon.h @@ -0,0 +1,10 @@ +#ifndef RP_PUBLIC_PARTY_COMMON_H +#define RP_PUBLIC_PARTY_COMMON_H + +#include +#include +#include +#include +#include + +#endif diff --git a/include/Pack/RPParty/RPPartyBodyManager.h b/include/Pack/RPParty/RPPartyCommon/RPPartyBodyManager.h similarity index 94% rename from include/Pack/RPParty/RPPartyBodyManager.h rename to include/Pack/RPParty/RPPartyCommon/RPPartyBodyManager.h index 83a7d48a..45fdaa66 100644 --- a/include/Pack/RPParty/RPPartyBodyManager.h +++ b/include/Pack/RPParty/RPPartyCommon/RPPartyBodyManager.h @@ -1,5 +1,5 @@ -#ifndef RP_PARTY_BODY_MANAGER_H -#define RP_PARTY_BODY_MANAGER_H +#ifndef RP_PARTY_COMMON_BODY_MANAGER_H +#define RP_PARTY_COMMON_BODY_MANAGER_H #include #include diff --git a/include/Pack/RPParty/RPPartyCommon/RPPartyMainScene/RPPartyMainScene.h b/include/Pack/RPParty/RPPartyCommon/RPPartyMainScene/RPPartyMainScene.h new file mode 100644 index 00000000..6279affe --- /dev/null +++ b/include/Pack/RPParty/RPPartyCommon/RPPartyMainScene/RPPartyMainScene.h @@ -0,0 +1,17 @@ +#ifndef RP_PARTY_COMMON_MAIN_SCENE_H +#define RP_PARTY_COMMON_MAIN_SCENE_H +#include + +#include + +//! @addtogroup rp_party +//! @{ + +/** + * @brief Party Pack main menu scene + */ +class RPPartyMainScene : public RPSysScene {}; + +//! @} + +#endif diff --git a/include/Pack/RPParty/RPPartyCommon/RPPartyPackTitleScene/RPPartyPackTitleScene.h b/include/Pack/RPParty/RPPartyCommon/RPPartyPackTitleScene/RPPartyPackTitleScene.h new file mode 100644 index 00000000..ed6c2e74 --- /dev/null +++ b/include/Pack/RPParty/RPPartyCommon/RPPartyPackTitleScene/RPPartyPackTitleScene.h @@ -0,0 +1,19 @@ +#ifndef RP_PARTY_COMMON_PACK_TITLE_SCENE_H +#define RP_PARTY_COMMON_PACK_TITLE_SCENE_H +#include + +#include + +//! @addtogroup rp_party +//! @{ + +/** + * @brief Party Pack title screen scene + */ +class RPPartyPackTitleScene : public RPUtlLoadSaveDataScene { + char unk44[0x68 - 0x44]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPParty/RPPartyCommon/RPPartyRootScene/RPPartyRootScene.h b/include/Pack/RPParty/RPPartyCommon/RPPartyRootScene/RPPartyRootScene.h new file mode 100644 index 00000000..6a16b1ec --- /dev/null +++ b/include/Pack/RPParty/RPPartyCommon/RPPartyRootScene/RPPartyRootScene.h @@ -0,0 +1,17 @@ +#ifndef RP_PARTY_COMMON_ROOT_SCENE_H +#define RP_PARTY_COMMON_ROOT_SCENE_H +#include + +#include + +//! @addtogroup rp_party +//! @{ + +/** + * @brief Party Pack root scene + */ +class RPPartyRootScene : public RPSysScene {}; + +//! @} + +#endif diff --git a/include/Pack/RPParty/RPPartyCommon/RPPartySeqScene.h b/include/Pack/RPParty/RPPartyCommon/RPPartySeqScene.h new file mode 100644 index 00000000..b4a7fe67 --- /dev/null +++ b/include/Pack/RPParty/RPPartyCommon/RPPartySeqScene.h @@ -0,0 +1,19 @@ +#ifndef RP_PARTY_COMMON_SEQ_SCENE_H +#define RP_PARTY_COMMON_SEQ_SCENE_H +#include + +#include + +//! @addtogroup rp_party +//! @{ + +/** + * @brief Base class for Party Pack scenes using sequence logic + */ +class RPPartySeqScene : public RPSysScene { +private: +}; + +//! @} + +#endif diff --git a/include/Pack/RPParty/RPPnpScene.h b/include/Pack/RPParty/RPPnpScene.h new file mode 100644 index 00000000..2534ca31 --- /dev/null +++ b/include/Pack/RPParty/RPPnpScene.h @@ -0,0 +1,6 @@ +#ifndef RP_PUBLIC_PARTY_PNP_H +#define RP_PUBLIC_PARTY_PNP_H + +#include + +#endif diff --git a/include/Pack/RPParty/RPPnpScene/RPPnpScene.h b/include/Pack/RPParty/RPPnpScene/RPPnpScene.h new file mode 100644 index 00000000..01402d44 --- /dev/null +++ b/include/Pack/RPParty/RPPnpScene/RPPnpScene.h @@ -0,0 +1,19 @@ +#ifndef RP_PARTY_PNP_SCENE_H +#define RP_PARTY_PNP_SCENE_H +#include + +#include + +//! @addtogroup rp_pnp +//! @{ + +/** + * @brief Party Pack Table Tennis scene + */ +class RPPnpScene : public RPSysScene { + char unk44[0x4C - 0x44]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPParty/RPTnkScene.h b/include/Pack/RPParty/RPTnkScene.h new file mode 100644 index 00000000..9989682e --- /dev/null +++ b/include/Pack/RPParty/RPTnkScene.h @@ -0,0 +1,6 @@ +#ifndef RP_PUBLIC_PARTY_TNK_H +#define RP_PUBLIC_PARTY_TNK_H + +#include + +#endif diff --git a/include/Pack/RPParty/RPTnkScene/RPTnkScene.h b/include/Pack/RPParty/RPTnkScene/RPTnkScene.h new file mode 100644 index 00000000..e67f8e22 --- /dev/null +++ b/include/Pack/RPParty/RPTnkScene/RPTnkScene.h @@ -0,0 +1,19 @@ +#ifndef RP_PARTY_TNK_SCENE_H +#define RP_PARTY_TNK_SCENE_H +#include + +#include + +//! @addtogroup rp_tnk +//! @{ + +/** + * @brief Party Pack Tanks! scene + */ +class RPTnkScene : public RPSysScene { + char unk44[0x8C - 0x44]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPParty/RPWlyScene.h b/include/Pack/RPParty/RPWlyScene.h new file mode 100644 index 00000000..9984101b --- /dev/null +++ b/include/Pack/RPParty/RPWlyScene.h @@ -0,0 +1,6 @@ +#ifndef RP_PUBLIC_PARTY_WLY_H +#define RP_PUBLIC_PARTY_WLY_H + +#include + +#endif diff --git a/include/Pack/RPParty/RPWlyScene/RPWlyScene.h b/include/Pack/RPParty/RPWlyScene/RPWlyScene.h new file mode 100644 index 00000000..e9cbd50f --- /dev/null +++ b/include/Pack/RPParty/RPWlyScene/RPWlyScene.h @@ -0,0 +1,19 @@ +#ifndef RP_PARTY_WLY_SCENE_H +#define RP_PARTY_WLY_SCENE_H +#include + +#include + +//! @addtogroup rp_wly +//! @{ + +/** + * @brief Party Pack Find Mii scene + */ +class RPWlyScene : public RPSysScene { + char unk44[0x4C - 0x44]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPSports.h b/include/Pack/RPSports.h deleted file mode 100644 index 9568e059..00000000 --- a/include/Pack/RPSports.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef RP_PUBLIC_SPORTS_H -#define RP_PUBLIC_SPORTS_H - -#include -#include - -#endif diff --git a/include/Pack/RPSports/RPBowScene.h b/include/Pack/RPSports/RPBowScene.h new file mode 100644 index 00000000..e734eea7 --- /dev/null +++ b/include/Pack/RPSports/RPBowScene.h @@ -0,0 +1,6 @@ +#ifndef RP_PUBLIC_SPORTS_BOW_H +#define RP_PUBLIC_SPORTS_BOW_H + +#include + +#endif diff --git a/include/Pack/RPSports/RPBowScene/RPBowScene.h b/include/Pack/RPSports/RPBowScene/RPBowScene.h new file mode 100644 index 00000000..e0675908 --- /dev/null +++ b/include/Pack/RPSports/RPBowScene/RPBowScene.h @@ -0,0 +1,21 @@ +#ifndef RP_SPORTS_BOW_SCENE_H +#define RP_SPORTS_BOW_SCENE_H +#include + +#include +#include + +//! @addtogroup rp_bow +//! @{ + +/** + * @brief Sports Pack Bowling scene + */ +class RPBowScene : public RPSportsBaseScene, public IRPSysHostIOSocket { +private: + char unkA0[0x13C - 0xA0]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPSports/RPBoxScene.h b/include/Pack/RPSports/RPBoxScene.h new file mode 100644 index 00000000..313ddb18 --- /dev/null +++ b/include/Pack/RPSports/RPBoxScene.h @@ -0,0 +1,6 @@ +#ifndef RP_PUBLIC_SPORTS_BOX_H +#define RP_PUBLIC_SPORTS_BOX_H + +#include + +#endif diff --git a/include/Pack/RPSports/RPBoxScene/RPBoxScene.h b/include/Pack/RPSports/RPBoxScene/RPBoxScene.h new file mode 100644 index 00000000..8c6a4879 --- /dev/null +++ b/include/Pack/RPSports/RPBoxScene/RPBoxScene.h @@ -0,0 +1,20 @@ +#ifndef RP_SPORTS_BOX_SCENE_H +#define RP_SPORTS_BOX_SCENE_H +#include + +#include + +//! @addtogroup rp_box +//! @{ + +/** + * @brief Sports Pack Boxing scene + */ +class RPBoxScene : public RPSportsBaseScene { +private: + char unk9C[0x10C - 0x9C]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPSports/RPBsbScene.h b/include/Pack/RPSports/RPBsbScene.h new file mode 100644 index 00000000..cb6cdfbc --- /dev/null +++ b/include/Pack/RPSports/RPBsbScene.h @@ -0,0 +1,6 @@ +#ifndef RP_PUBLIC_SPORTS_BSB_H +#define RP_PUBLIC_SPORTS_BSB_H + +#include + +#endif diff --git a/include/Pack/RPSports/RPBsbScene/RPBsbScene.h b/include/Pack/RPSports/RPBsbScene/RPBsbScene.h new file mode 100644 index 00000000..007a97e4 --- /dev/null +++ b/include/Pack/RPSports/RPBsbScene/RPBsbScene.h @@ -0,0 +1,20 @@ +#ifndef RP_SPORTS_BSB_SCENE_H +#define RP_SPORTS_BSB_SCENE_H +#include + +#include + +//! @addtogroup rp_bsb +//! @{ + +/** + * @brief Sports Pack Baseball scene + */ +class RPBsbScene : public RPSportsBaseScene { +private: + char unk9C[0xA8 - 0x9C]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPSports/RPGolScene.h b/include/Pack/RPSports/RPGolScene.h new file mode 100644 index 00000000..fbcb80f8 --- /dev/null +++ b/include/Pack/RPSports/RPGolScene.h @@ -0,0 +1,7 @@ +#ifndef RP_PUBLIC_SPORTS_GOL_H +#define RP_PUBLIC_SPORTS_GOL_H + +#include +#include + +#endif diff --git a/include/Pack/RPSports/RPGolScene/RPGolScene.h b/include/Pack/RPSports/RPGolScene/RPGolScene.h new file mode 100644 index 00000000..9c48919c --- /dev/null +++ b/include/Pack/RPSports/RPGolScene/RPGolScene.h @@ -0,0 +1,20 @@ +#ifndef RP_SPORTS_GOL_SCENE_H +#define RP_SPORTS_GOL_SCENE_H +#include + +#include + +//! @addtogroup rp_gol +//! @{ + +/** + * @brief Sports Pack Golf scene + */ +class RPGolScene : public RPSportsBaseScene { +private: + char unk9C[0xA0 - 0x9C]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPSports/RPGolScene/RPGolSelectScene.h b/include/Pack/RPSports/RPGolScene/RPGolSelectScene.h new file mode 100644 index 00000000..ee792ee8 --- /dev/null +++ b/include/Pack/RPSports/RPGolScene/RPGolSelectScene.h @@ -0,0 +1,19 @@ +#ifndef RP_SPORTS_GOL_COURSE_SELECT_SCENE_H +#define RP_SPORTS_GOL_COURSE_SELECT_SCENE_H +#include + +#include + +//! @addtogroup rp_gol +//! @{ + +/** + * @brief Sports Pack golf course select scene + */ +class RPGolCourseSelectScene : public RPSysScene { + char unk44[0xE4 - 0x44]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPSports/RPSportsCommon.h b/include/Pack/RPSports/RPSportsCommon.h new file mode 100644 index 00000000..f762160e --- /dev/null +++ b/include/Pack/RPSports/RPSportsCommon.h @@ -0,0 +1,14 @@ +#ifndef RP_PUBLIC_SPORTS_COMMON_H +#define RP_PUBLIC_SPORTS_COMMON_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/Pack/RPSports/RPSportsAppMiiManager.h b/include/Pack/RPSports/RPSportsCommon/RPSportsAppMiiManager.h similarity index 85% rename from include/Pack/RPSports/RPSportsAppMiiManager.h rename to include/Pack/RPSports/RPSportsCommon/RPSportsAppMiiManager.h index 8102dada..89e2084a 100644 --- a/include/Pack/RPSports/RPSportsAppMiiManager.h +++ b/include/Pack/RPSports/RPSportsCommon/RPSportsAppMiiManager.h @@ -1,5 +1,5 @@ -#ifndef RP_SPORTS_APP_MII_MANAGER_H -#define RP_SPORTS_APP_MII_MANAGER_H +#ifndef RP_SPORTS_COMMON_APP_MII_MANAGER_H +#define RP_SPORTS_COMMON_APP_MII_MANAGER_H #include #include diff --git a/include/Pack/RPSports/RPSportsCommon/RPSportsBaseScene.h b/include/Pack/RPSports/RPSportsCommon/RPSportsBaseScene.h new file mode 100644 index 00000000..a85b9a0d --- /dev/null +++ b/include/Pack/RPSports/RPSportsCommon/RPSportsBaseScene.h @@ -0,0 +1,38 @@ +#ifndef RP_SPORTS_COMMON_BASE_SCENE_H +#define RP_SPORTS_COMMON_BASE_SCENE_H +#include + +#include + +//! @addtogroup rp_sports +//! @{ + +/** + * @brief Base class for Sports Pack scenes + */ +class RPSportsBaseScene : public RPSysScene { +public: + virtual void Configure() override; + virtual void LoadResource() override; + virtual void Reset() override; + virtual void Calculate() override; + virtual void Exit() override; + + virtual void OnConfigure(); + virtual void OnLoadResource(); + virtual void OnReset(); + virtual void OnCalculate(); + virtual void OnUserDraw(); + virtual void OnDebugDraw(); + virtual void OnExit(); + + virtual void UserDraw() override; + virtual void DebugDraw() override; + +private: + char unk44[0x9C - 0x44]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPSports/RPSportsBodyManager.h b/include/Pack/RPSports/RPSportsCommon/RPSportsBodyManager.h similarity index 94% rename from include/Pack/RPSports/RPSportsBodyManager.h rename to include/Pack/RPSports/RPSportsCommon/RPSportsBodyManager.h index 6e3f7e14..f2919ebe 100644 --- a/include/Pack/RPSports/RPSportsBodyManager.h +++ b/include/Pack/RPSports/RPSportsCommon/RPSportsBodyManager.h @@ -1,5 +1,5 @@ -#ifndef RP_SPORTS_BODY_MANAGER_H -#define RP_SPORTS_BODY_MANAGER_H +#ifndef RP_SPORTS_COMMON_BODY_MANAGER_H +#define RP_SPORTS_COMMON_BODY_MANAGER_H #include #include diff --git a/include/Pack/RPSports/RPSportsCommon/RPSportsMainScene/RPSportsMainScene.h b/include/Pack/RPSports/RPSportsCommon/RPSportsMainScene/RPSportsMainScene.h new file mode 100644 index 00000000..97c60185 --- /dev/null +++ b/include/Pack/RPSports/RPSportsCommon/RPSportsMainScene/RPSportsMainScene.h @@ -0,0 +1,19 @@ +#ifndef RP_SPORTS_COMMON_MAIN_SCENE_H +#define RP_SPORTS_COMMON_MAIN_SCENE_H +#include + +#include + +//! @addtogroup rp_sports +//! @{ + +/** + * @brief Sports Pack main menu scene + */ +class RPSportsMainScene : public RPSysScene { + char unk44[0x58 - 0x44]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPSports/RPSportsCommon/RPSportsPackTitleScene/RPSportsPackTitleScene.h b/include/Pack/RPSports/RPSportsCommon/RPSportsPackTitleScene/RPSportsPackTitleScene.h new file mode 100644 index 00000000..84a44893 --- /dev/null +++ b/include/Pack/RPSports/RPSportsCommon/RPSportsPackTitleScene/RPSportsPackTitleScene.h @@ -0,0 +1,31 @@ +#ifndef RP_SPORTS_COMMON_PACK_TITLE_SCENE_H +#define RP_SPORTS_COMMON_PACK_TITLE_SCENE_H +#include + +#include + +//! @addtogroup rp_sports +//! @{ + +/** + * @brief Sports Pack title screen scene + */ +class RPSportsPackTitleScene : public RPUtlLoadSaveDataScene { +private: + struct UnkStruct { + u32 unk0; + u32 unk4; + u32 unk8; + + UnkStruct() : unk0(0), unk4(0), unk8(0) {} + }; + +private: + char unk44[0x54 - 0x44]; + UnkStruct unk60[(0x84 - 0x54) / sizeof(UnkStruct)]; + char unk84[0xA0 - 0x84]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPSports/RPSportsCommon/RPSportsPhysicalMenuScene/RPSportsPhysicalMenuScene.h b/include/Pack/RPSports/RPSportsCommon/RPSportsPhysicalMenuScene/RPSportsPhysicalMenuScene.h new file mode 100644 index 00000000..3f7f323d --- /dev/null +++ b/include/Pack/RPSports/RPSportsCommon/RPSportsPhysicalMenuScene/RPSportsPhysicalMenuScene.h @@ -0,0 +1,19 @@ +#ifndef RP_SPORTS_COMMON_PHYSICAL_MENU_SCENE_H +#define RP_SPORTS_COMMON_PHYSICAL_MENU_SCENE_H +#include + +#include + +//! @addtogroup rp_sports +//! @{ + +/** + * @brief Sports Pack Wii Fitness menu scene + */ +class RPSportsPhysicalMenuScene : public RPSysScene { + char unk44[0x5C - 0x44]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPSports/RPSportsCommon/RPSportsPhysicalPreviewScene/RPSportsPhysicalPreviewScene.h b/include/Pack/RPSports/RPSportsCommon/RPSportsPhysicalPreviewScene/RPSportsPhysicalPreviewScene.h new file mode 100644 index 00000000..db58d256 --- /dev/null +++ b/include/Pack/RPSports/RPSportsCommon/RPSportsPhysicalPreviewScene/RPSportsPhysicalPreviewScene.h @@ -0,0 +1,19 @@ +#ifndef RP_SPORTS_COMMON_PHYSICAL_PREVIEW_SCENE_H +#define RP_SPORTS_COMMON_PHYSICAL_PREVIEW_SCENE_H +#include + +#include + +//! @addtogroup rp_sports +//! @{ + +/** + * @brief Sports Pack Wii Fitness game preview scene + */ +class RPSportsPhysicalPreviewScene : public RPSysScene { + char unk44[0x60 - 0x44]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPSports/RPSportsCommon/RPSportsPhysicalResultScene/RPSportsPhysicalResultScene.h b/include/Pack/RPSports/RPSportsCommon/RPSportsPhysicalResultScene/RPSportsPhysicalResultScene.h new file mode 100644 index 00000000..a01bf689 --- /dev/null +++ b/include/Pack/RPSports/RPSportsCommon/RPSportsPhysicalResultScene/RPSportsPhysicalResultScene.h @@ -0,0 +1,19 @@ +#ifndef RP_SPORTS_COMMON_PHYSICAL_RESULT_SCENE_H +#define RP_SPORTS_COMMON_PHYSICAL_RESULT_SCENE_H +#include + +#include + +//! @addtogroup rp_sports +//! @{ + +/** + * @brief Sports Pack Wii Fitness results scene + */ +class RPSportsPhysicalResultScene : public RPSysScene { + char unk44[0x58 - 0x44]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPSports/RPSportsCommon/RPSportsTrainingMenuScene/RPSportsTrainingMenuScene.h b/include/Pack/RPSports/RPSportsCommon/RPSportsTrainingMenuScene/RPSportsTrainingMenuScene.h new file mode 100644 index 00000000..417170f5 --- /dev/null +++ b/include/Pack/RPSports/RPSportsCommon/RPSportsTrainingMenuScene/RPSportsTrainingMenuScene.h @@ -0,0 +1,19 @@ +#ifndef RP_SPORTS_COMMON_TRAINING_MENU_SCENE_H +#define RP_SPORTS_COMMON_TRAINING_MENU_SCENE_H +#include + +#include + +//! @addtogroup rp_sports +//! @{ + +/** + * @brief Sports Pack training menu scene + */ +class RPSportsTrainingMenuScene : public RPSysScene { + char unk44[0x78 - 0x44]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPSports/RPTnsScene.h b/include/Pack/RPSports/RPTnsScene.h new file mode 100644 index 00000000..e162e122 --- /dev/null +++ b/include/Pack/RPSports/RPTnsScene.h @@ -0,0 +1,6 @@ +#ifndef RP_PUBLIC_SPORTS_TNS_H +#define RP_PUBLIC_SPORTS_TNS_H + +#include + +#endif diff --git a/include/Pack/RPSports/RPTnsScene/RPTnsScene.h b/include/Pack/RPSports/RPTnsScene/RPTnsScene.h new file mode 100644 index 00000000..6c3e37fe --- /dev/null +++ b/include/Pack/RPSports/RPTnsScene/RPTnsScene.h @@ -0,0 +1,20 @@ +#ifndef RP_SPORTS_TNS_SCENE_H +#define RP_SPORTS_TNS_SCENE_H +#include + +#include + +//! @addtogroup rp_tns +//! @{ + +/** + * @brief Sports Pack Tennis scene + */ +class RPTnsScene : public RPSportsBaseScene { +private: + char unk9C[0xA0 - 0x9C]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPSystem.h b/include/Pack/RPSystem.h index 9536c76a..200ef229 100644 --- a/include/Pack/RPSystem.h +++ b/include/Pack/RPSystem.h @@ -5,12 +5,16 @@ #include #include #include +#include +#include #include #include #include +#include #include #include #include +#include #include #include #include @@ -18,7 +22,6 @@ #include #include #include -#include #include #endif diff --git a/include/Pack/RPSystem/RPSysBootScene.h b/include/Pack/RPSystem/RPSysBootScene.h new file mode 100644 index 00000000..56d05123 --- /dev/null +++ b/include/Pack/RPSystem/RPSysBootScene.h @@ -0,0 +1,20 @@ +#ifndef RP_SYSTEM_BOOT_SCENE_H +#define RP_SYSTEM_BOOT_SCENE_H +#include + +#include + +//! @addtogroup rp_system +//! @{ + +/** + * @brief Pack Project bootup scene + */ +class RPSysBootScene : public RPSysScene { +private: + char unk44[0x58 - 0x44]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPSystem/RPSysCommonObject.h b/include/Pack/RPSystem/RPSysCommonObject.h new file mode 100644 index 00000000..c81dc624 --- /dev/null +++ b/include/Pack/RPSystem/RPSysCommonObject.h @@ -0,0 +1,43 @@ +#ifndef RP_SYSTEM_COMMON_OBJECT_H +#define RP_SYSTEM_COMMON_OBJECT_H +#include + +#include + +//! @addtogroup rp_system +//! @{ + +/** + * @brief Encapsulates common object behavior/rendering + */ +class RPSysCommonObject : public IRPGrpDrawObject { +public: + /** + * @brief Constructor + */ + RPSysCommonObject(); + + /** + * @brief Renders common objects' state + */ + virtual void UserDraw() override; // at 0xC + + /** + * @brief Initializes common objects' state + */ + void init(); + + /** + * @brief Updates common objects' state before the scene gets to update + */ + void preUpdate(); + + /** + * @brief Updates common objects' state after the scene gets to update + */ + void postUpdate(); +}; + +//! @} + +#endif diff --git a/include/Pack/RPSystem/RPSysNunchukCheckScene.h b/include/Pack/RPSystem/RPSysNunchukCheckScene.h new file mode 100644 index 00000000..9f948e1d --- /dev/null +++ b/include/Pack/RPSystem/RPSysNunchukCheckScene.h @@ -0,0 +1,21 @@ +#ifndef RP_SYSTEM_NUNCHUK_CHECK_SCENE_H +#define RP_SYSTEM_NUNCHUK_CHECK_SCENE_H +#include + +#include +#include + +//! @addtogroup rp_system +//! @{ + +/** + * @brief Pack Project Nunchuk check scene + */ +class RPSysNunchukCheckScene : public RPSysScene, public IRPSysHostIOSocket { +private: + char unk48[0x98 - 0x48]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPSystem/RPSysPauseMgr.h b/include/Pack/RPSystem/RPSysPauseMgr.h index 4d8cbab5..afcd258f 100644 --- a/include/Pack/RPSystem/RPSysPauseMgr.h +++ b/include/Pack/RPSystem/RPSysPauseMgr.h @@ -1,5 +1,6 @@ #ifndef RP_SYSTEM_PAUSE_MGR_H #define RP_SYSTEM_PAUSE_MGR_H +#include #include @@ -7,25 +8,18 @@ //! @{ /** - * @brief - * Pause manager + * @brief Pause menu manager */ - class RPSysPauseMgr { RP_SINGLETON_DECL_EX(RPSysPauseMgr); public: - /** - * @brief - * Draws pause screen. Passes to RPSysPauseMenu - */ - void draw(void); + bool isPause() const { + return unk8 & 1; + } private: - u32 mUNK_0x08; - u32 mUNK_0x0C; - f32 mFloats_0x10[0x78]; // TODO(Texline666) What are all these floats for? - void* mLytPause; // placeholder for RPSysLytPause + u32 unk8; }; //! @} diff --git a/include/Pack/RPSystem/RPSysPlayerSelectScene.h b/include/Pack/RPSystem/RPSysPlayerSelectScene.h new file mode 100644 index 00000000..6d6f1dc1 --- /dev/null +++ b/include/Pack/RPSystem/RPSysPlayerSelectScene.h @@ -0,0 +1,20 @@ +#ifndef RP_SYSTEM_PLAYER_SELECT_SCENE_H +#define RP_SYSTEM_PLAYER_SELECT_SCENE_H +#include + +#include + +//! @addtogroup rp_system +//! @{ + +/** + * @brief Pack Project player select scene + */ +class RPSysPlayerSelectScene : public RPSysScene { +private: + char unk44[0x8C - 0x44]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPSystem/RPSysResourceManager.h b/include/Pack/RPSystem/RPSysResourceManager.h index 430fc1cf..484b73ba 100644 --- a/include/Pack/RPSystem/RPSysResourceManager.h +++ b/include/Pack/RPSystem/RPSysResourceManager.h @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include diff --git a/include/Pack/RPSystem/RPSysScene.h b/include/Pack/RPSystem/RPSysScene.h index c2e47ce6..cc557365 100644 --- a/include/Pack/RPSystem/RPSysScene.h +++ b/include/Pack/RPSystem/RPSysScene.h @@ -2,17 +2,320 @@ #define RP_SYSTEM_SCENE_H #include +#include +#include + #include //! @addtogroup rp_system //! @{ +// Forward declarations +class RPSysCommonObject; + /** * @brief Pack Project scene */ -class RPSysScene : public EGG::Scene { +class RPSysScene : public EGG::Scene, public IRPGrpDrawObject { + friend class RPSysSceneCreator; + public: + struct UnkStruct { + u32 unk0; + UnkStruct() : unk0(0) {} + }; + +public: + /** + * @brief Constructor + */ + RPSysScene(); + + /** + * @name Internal events + * @brief These functions are internal, and should not be overriden. + */ + /**@{*/ + /** + * @brief Updates the scene state + */ + virtual void calc() override; // at 0xC + + /** + * @brief Renders the scene state + */ + virtual void draw() override; // at 0x10 + + /** + * @brief Enters the scene + */ + virtual void enter() override; // at 0x14 + + /** + * @brief Exits the scene + */ + virtual void exit() override; // at 0x18 + + /** + * @brief Re-initializes the scene + */ + virtual void reinit() override; // at 0x1C + + /** + * @brief Prepares for destruction of (and transition from) a child scene + */ + virtual void incoming_childDestroy() override; // at 0x20 + + /** + * @brief Prepares for creation of (and transition to) a child scene + */ + virtual void outgoing_childCreate() override; // at 0x24 + /**@}*/ + + /** + * @name Lifecycle hooks + * @brief These functions are mostly empty stubs, and should be overridden + * to provide scene functionality. + */ + /**@{*/ + virtual UnkStruct& VF_0x3C() { + return sUnkStruct; + } // at 0x3C + + /** + * @brief Pause callback + * + * @param enter Whether the pause menu is being entered + */ + virtual void pauseCallBack(bool /* enter */) {} // at 0x40 + + /** + * @brief Initializes the scene's state for the first time + */ + virtual void Configure() {} // at 0x44 + + /** + * @brief Loads the scene's required assets + */ + virtual void LoadResource() {} // at 0x48 + + /** + * @brief Re-initializes the scene's state + */ + virtual void Reset() {} // at 0x4C + + /** + * @brief Updates the scene's state + */ + virtual void Calculate() {} // at 0x50 + + /** + * @brief Exits the scene + */ + virtual void Exit() {} // at 0x54 + + /** + * @brief Runs an asynchronous task on the DVD thread + */ + virtual void taskAsync() {} // at 0x58 + /**@}*/ + + /** + * @brief Tests whether the scene is fully visible + */ + bool isSceneDisplay() const; + + /** + * @brief Tests whether the scene is visibly obscured + */ + bool isSceneBlank() const; + + /** + * @brief Tests whether a scene change would be allowed + */ + bool isSceneChangeEnable() const; + + /** + * @brief Tests whether NAND access would be safe + */ bool isNandAccessEnable() const; + + /** + * @brief Sets the duration of all faders + * + * @param frame Fade duration, in frames + */ + void setFadeFrame(u16 frame); + + /** + * @brief Gets the color of the manager fader + */ + nw4r::ut::Color getFadeColor() const; + + /** + * @brief Sets the color of all faders + * + * @param color Fade color + */ + void setFadeColor(nw4r::ut::Color color); + + /** + * @brief Sets the color of the scene fader + * + * @param color Fade color + */ + void setSceneFadeColor(nw4r::ut::Color color); + + /** + * @brief Begins fading in the scene fader + * + * @return Success + */ + bool startFadeIn(); + + /** + * @brief Begins fading out the scene fader + * + * @return Success + */ + bool startFadeOut(); + + /** + * @brief Toggles screen dimming + * @note If "Screen Saver Mode" is disabled, dimming is always OFF. + * + * @param enable Whether to dim the screen + */ + void setDimming(bool enable); + + /** + * @brief Sets this scene's parent/creator ID + * + * @param id ID of this scene's parent/creator + */ + void setCreatorSceneID(s32 id); + + /** + * @brief Gets this scene's parent/creator ID + */ + s32 getCreatorSceneID() const; + + /** + * @brief Marks this scene as a child of the previous scene + */ + void setChildScene(); + + /** + * @brief Displays the game's build date timestamp + * + * @param color Text color + */ + void drawTimeStamp(nw4r::ut::Color color); + + /** + * @brief Marks that this scene requires an asynchronous task + */ + void setTaskAsync(); + + /** + * @brief Tests whether this scene's asynchronous task has finished + */ + bool isTaskAsyncFinish() const; + +private: + /** + * @brief Prepares this scene to be entered + */ + DECOMP_INLINE void incomingScene(); + + /** + * @brief Prepares this scene to be exited + */ + void outgoingScene(); + + /** + * @brief Finalizes this scene after being exited + */ + void exitScenePost(); + + /** + * @brief Initializes this scene's members + */ + void init(); + + void loadUpdate(); + + /** + * @brief Creates the asynchronous task thread if requested by the scene + */ + void initTaskAsync(); + + /** + * @brief Enables the "Now Loading" message display + */ + void enableLoadMessage(); + + /** + * @brief Loads this scene's resources asynchronously + */ + void load(); + + /** + * @brief Loads this scene's resources asynchronously, displaying a "Now + * Loading" message if the feature is enabled + */ + void loadMessage(); + + /** + * @brief Polls the status of the DVD task thread + */ + void updateDvdEndMessage(); + + /** + * @brief Polls the status of the NAND task thread + */ + void updateNandEndMessage(); + + /** + * @brief Thread function for the LoadResource phase + * + * @param pArg Thread function argument + */ + static void loadResourceFunc(void* pArg); + + /** + * @brief Thread function for the scene's task + * + * @param pArg Thread function argument + */ + static void taskAsyncFunc(void* pArg); + +private: + /** + * @brief Scene flags + */ + enum { + EFlag_LoadMessage, //!< Display "Now Loading" message + EFlag_TaskAsyncSet, //!< The scene requested an asynchronous task + EFlag_TaskAsyncRunning, //!< The asynchronous task is running + EFlag_IsChild, //!< This scene was created as a child + }; + +private: + static UnkStruct sUnkStruct; + + //! Scene renderer + RPGrpRenderer* mpRenderer; // at 0x2C + //! Common draw functionality + RPSysCommonObject* mpCommonObject; // at 0x30 + //! Scene effect creator + RPSysEffectCreator* mpEffectCreator; // at 0x34 + //! Scene heap + EGG::Heap* mpSceneHeap; // at 0x38 + //! Scene flags + EGG::TBitFlag mFlags; // at 0x3C + //! ID of the previous scene + s32 mCreatorSceneID; // at 0x40 }; //! @} diff --git a/include/Pack/RPSystem/RPSysSceneCreator.h b/include/Pack/RPSystem/RPSysSceneCreator.h index be7028d2..d2444a52 100644 --- a/include/Pack/RPSystem/RPSysSceneCreator.h +++ b/include/Pack/RPSystem/RPSysSceneCreator.h @@ -9,21 +9,24 @@ //! @addtogroup rp_system //! @{ +// Forward declarations +class RPSysScene; + /** - * @brief Scene factory + * @brief Pack Project scene factory */ class RPSysSceneCreator : public EGG::SceneCreator { RP_SINGLETON_DECL_EX(RPSysSceneCreator); public: /** - * @brief Game scene ID + * @brief Pack Project scene ID */ enum ESceneID { // RPSystem ESceneID_RPSysBootScene, //!< Logo ESceneID_RPSysPlayerSelectScene, //!< Player Select - ESceneID_RPSysNunchukScene, //!< Nunchuk Check + ESceneID_RPSysNunchukCheckScene, //!< Nunchuk Check // RPSports ESceneID_RPBsbScene, //!< Baseball @@ -31,13 +34,13 @@ class RPSysSceneCreator : public EGG::SceneCreator { ESceneID_RPGolScene, //!< Golf ESceneID_RPTnsScene, //!< Tennis ESceneID_RPBoxScene, //!< Boxing - ESceneID_RPSportsTitleScene, //!< Sports Pack - ESceneID_RPSportsMenuScene, //!< Main Menu + ESceneID_RPSportsPackTitleScene, //!< Sports Pack + ESceneID_RPSportsMainScene, //!< Main Menu ESceneID_RPSportsTrainingMenuScene, //!< Training Menu ESceneID_RPSportsPhysicalMenuScene, //!< Physical Test (Menu) ESceneID_RPSportsPhysicalPreviewScene, //!< Physical Test (Description) ESceneID_RPSportsPhysicalResultScene, //!< Physical Test (Result) - ESceneID_RPGolSelectScene, //!< Golf (Course Select) + ESceneID_RPGolCourseSelectScene, //!< Golf (Course Select) #if defined(PACK_SPORTS) ESceneID_Max, @@ -45,23 +48,26 @@ class RPSysSceneCreator : public EGG::SceneCreator { // RPParty ESceneID_Unknown09h, - ESceneID_RPFshScene, //!< Fishing - ESceneID_RPHkyScene, //!< Laser Hockey - ESceneID_RPDucScene, //!< Shooting Range - ESceneID_RPPnpScene, //!< Table Tennis - ESceneID_RPBilScene, //!< Billiards - ESceneID_RPCowScene, //!< Charge! - ESceneID_RPWlyScene, //!< Find Mii - ESceneID_RPTnkScene, //!< Tanks! - ESceneID_RPBomScene, //!< Pose Mii - ESceneID_RPPartyTitleScene, //!< Party Pack - ESceneID_RPPartyMiiLoadScene, //!< Mii/GameMgr Setup - ESceneID_RPPartyMenuScene, //!< Main Menu + ESceneID_RPFshScene, //!< Fishing + ESceneID_RPHkyScene, //!< Laser Hockey + ESceneID_RPDucScene, //!< Shooting Range + ESceneID_RPPnpScene, //!< Table Tennis + ESceneID_RPBilScene, //!< Billiards + ESceneID_RPCowScene, //!< Charge! + ESceneID_RPWlyScene, //!< Find Mii + ESceneID_RPTnkScene, //!< Tanks! + ESceneID_RPBomScene, //!< Pose Mii + ESceneID_RPPartyPackTitleScene, //!< Party Pack + ESceneID_RPPartyRootScene, //!< Mii/GameMgr Setup + ESceneID_RPPartyMainScene, //!< Main Menu #if defined(PACK_PARTY) ESceneID_Max, #endif + // During the development of Wii Sports and Wii Play, + // Wii Fit and Wii Music were very early in development. +#if defined(PACK_SPORTS) || defined(PACK_PARTY) // RPHealth ESceneID_RPHealthTitleScene, //!< Health Pack ESceneID_RPHealthCounselScene, //!< Counseling @@ -100,19 +106,7 @@ class RPSysSceneCreator : public EGG::SceneCreator { ESceneID_RPDrmDebugScene, //!< Drum Debug ESceneID_RPOchDebugScene, //!< Orchestra Debug ESceneID_RPOchSelectScene, //!< Orchestra Music Select - }; - - /** - * @brief Sport ID - */ - enum ESportID { - ESportID_Bsb, //!< Baseball - ESportID_Tns, //!< Tennis - ESportID_Gol, //!< Golf - ESportID_Box, //!< Boxing - ESportID_Bow, //!< Bowling - - ESportID_Max +#endif }; /** @@ -137,6 +131,14 @@ class RPSysSceneCreator : public EGG::SceneCreator { ECreateType_Child, //!< Become child of outgoing scene }; + /** + * @brief Scene load type + */ + enum ELoadType { + ELoadType_Blank, //!< No additional display + ELoadType_Message, //!< Display "Now Loading" message + }; + /** * @brief Scene exit type */ @@ -149,126 +151,194 @@ class RPSysSceneCreator : public EGG::SceneCreator { }; /** - * @brief Scene information + * @brief Scene audio type + */ + enum EAudioType { + EAudioType_Scene, //!< Use the scene's sound archive + EAudioType_Common, //!< Use the common sound archive + }; + + /** + * @brief Sport ID + */ + enum ESportID { + ESportID_Bsb, //!< Baseball + ESportID_Tns, //!< Tennis + ESportID_Gol, //!< Golf + ESportID_Box, //!< Boxing + ESportID_Bow, //!< Bowling + + ESportID_Max, + }; + + /** + * @brief Scene attributes */ - struct SceneEntry { + struct SceneAttr { //! Scene ID ESceneID scene; // at 0x0 //! Pack ID EPackID pack; // at 0x4 + //! How to create the scene ECreateType createType; // at 0x8 - //! Toggle "Now Loading" text (unused) - BOOL loadingText; // at 0xC + //! How to load the scene + ELoadType loadType; // at 0xC //! How to exit the scene EExitType exitType; // at 0x10 - //! Whether to use the RP common sound archive - BOOL commonSound; // at 0x14 - //! Scene resource directory + //! How to configure the scene audio + EAudioType audioType; // at 0x14 + + //! Root resource directory const char* pResDirName; // at 0x18 - //! Proper name + //! Readable name const char* pSceneName; // at 0x1C }; public: /** - * @brief Creates a scene by ID + * @brief Creates the specified scene * * @param id Scene ID */ virtual EGG::Scene* create(s32 id); // at 0x8 + /** - * @brief Destroys a scene - * @remark If the scene manager has requested a shutdown, this function will - * tell the system to shutdown. + * @brief Destroys the specified scene * - * @param id ID of the scene being destroyed + * @param id Scene ID */ virtual void destroy(s32 id); // at 0xC -#if defined(PACK_SPORTS) /** - * @brief Creates a Sports Pack scene by ID + * @brief Requests a scene change after fading out + * @details A scene id of -1 will select the current scene. + * + * @param id New scene ID + * @param reconfigure Whether to fully reconfigure the scene + * @return Success + */ + bool changeSceneAfterFade(s32 id, bool reconfigure = false) + DECOMP_DONT_INLINE; + + /** + * @brief Changes to the title scene + * + * @return Success + */ + bool changeSoftReset(); + + /** + * @brief Gets the specified scene's resource directory + * @details A scene id of -1 will select the current scene. * * @param id Scene ID */ - EGG::Scene* createSportsScene(s32 id); -#elif defined(PACK_PARTY) + const char* getResDirName(s32 id = -1); + /** - * @brief Creates a Party Pack scene by ID + * @brief Gets the specified scene's sport ID + * @details A scene id of -1 will select the current scene. + * @note If no sport corresponds to the scene, this function returns -1. * * @param id Scene ID */ - EGG::Scene* createPartyScene(s32 id); -#endif + s32 getSportID(s32 id = -1); /** - * @brief Fades out the current scene and changes to a new scene - * @note Supply an ID of -1 to use the ID of the current scene + * @brief Gets the specified sport's scene ID + * @note If no scene corresponds to the sport, this function returns -1. * - * @param id New scene ID (-1 for current scene) - * @param reload Whether to reload the current scene - * @return Success + * @param sport Sport ID */ - bool changeSceneAfterFade(s32 id, bool reload = false); + s32 getSceneID(ESportID sport); + /** - * @brief Changes to the boot scene (performs a soft reset) + * @brief Gets the specified scene's pack ID + * + * @param id Scene ID */ - void changeSoftReset(); + EPackID getPackID(s32 id); /** - * @brief Gets the scene's resource directory + * @brief Gets the specified scene's creation type * - * @param id Scene ID (-1 to use the current scene) + * @param id Scene ID */ - const char* getResDirName(s32 id = -1); + ECreateType getCreateType(s32 id); -#if defined(PACK_SPORTS) /** - * @brief Gets the sport corresponding to the scene ID - * @note If the specified scene has no entry, this function returns -1. + * @brief Gets the specified scene's load type * - * @param id Scene ID (-1 to use the current scene) + * @param id Scene ID */ - s32 getSportID(s32 id = -1); -#endif + ELoadType getLoadType(s32 id); /** - * @brief Gets the scene ID corresponding to the sport - * @note If the specified sport has no entry, this function returns -1. + * @brief Gets the specified scene's exit type * - * @param sport Sport ID + * @param id Scene ID */ - s32 getSceneID(ESportID sport); + EExitType getExitType(s32 id); /** - * @brief Gets the scene's create logic type + * @brief Gets the specified scene's audio type * - * @param id Scene ID (-1 to use the current scene) + * @param id Scene ID */ - s32 getCreateType(s32 id = -1); + EAudioType getAudioType(s32 id); +private: /** - * @brief Gets the scene's exit logic type + * @brief Gets the index of the specified scene's entry in the table * - * @param id Scene ID (-1 to use the current scene) + * @param id Scene ID + * @return Entry index, or -1 if not found */ - s32 getExitType(s32 id = -1); + s32 getEntryIndex(ESceneID id); +#if defined(PACK_SPORTS) /** - * @brief Tests whether the scene should use the pack's common sound - * archive. + * @brief Creates the specified Sports Pack scene * - * @param id Scene ID (-1 to use the current scene) + * @param id Scene ID + */ + RPSysScene* createSportsScene(s32 id) DECOMP_DONT_INLINE; +#endif + +#if defined(PACK_PARTY) + /** + * @brief Creates the specified Party Pack scene + * + * @param id Scene ID */ - bool isCommonSound(s32 id = -1); + RPSysScene* createPartyScene(s32 id) DECOMP_DONT_INLINE; +#endif + +#if defined(PACK_HEALTH) + /** + * @brief Creates the specified Health Pack scene + * + * @param id Scene ID + */ + RPSysScene* createHealthScene(s32 id) DECOMP_DONT_INLINE; +#endif + +#if defined(PACK_MUSIC) + /** + * @brief Creates the specified Music Pack scene + * + * @param id Scene ID + */ + RPSysScene* createMusicScene(s32 id) DECOMP_DONT_INLINE; +#endif private: - //! ID of the previous scene - s32 mLastSceneID; // at 0x8 + //! Information about every Pack Project scene + static const SceneAttr SCENE_ATTR_TABLE[]; - //! Entries for all Pack Project scenes - static SceneEntry sSceneEntryTable[]; + //! ID of the previous scene + s32 mPrevSceneID; // at 0x8 }; //! @} diff --git a/include/Pack/RPSystem/RPSysSceneMgr.h b/include/Pack/RPSystem/RPSysSceneMgr.h index c6bfe379..ce4c9f75 100644 --- a/include/Pack/RPSystem/RPSysSceneMgr.h +++ b/include/Pack/RPSystem/RPSysSceneMgr.h @@ -7,41 +7,237 @@ #include +#include + //! @addtogroup rp_system //! @{ /** - * @brief Scene manager + * @brief Pack Project scene manager */ class RPSysSceneMgr : public EGG::SceneManager { - RP_SINGLETON_DECL(RPSysSceneMgr); + RP_SINGLETON_DECL_EX(RPSysSceneMgr); public: /** - * @brief - * Gives system status. Indicates if an error has occurred + * @brief Updates the state of the current scene */ - enum ApplicationStatus { - NORMAL_STATUS, - RESET_STATUS, - UNK2_STATUS, - MENU_RETURN_STATUS, - SHUTTING_DOWN_STATUS - }; - bool isShutDownReserved() const; - bool isDvdErrorApplicationEnd() const; - bool isNormalState(); + virtual void calcCurrentScene() override; // at 0x10 + /** + * @brief Gets the currently active scene as the Pack Project type + */ RPSysScene* getCurrentSceneRP() const; - void shutdownSystem(BOOL pBlack); - BOOL returnToMenu(BOOL pBlack); - void softReset(BOOL pFade); + /** + * @brief Performs a soft reset + * + * @param fromHBM Whether the request came from HBM + * @return Success + */ + bool softReset(bool fromHBM); + + /** + * @brief Returns to the IPL + * + * @param fromHBM Whether the request came from HBM + * @return Success + */ + bool returnToMenu(bool fromHBM); + + /** + * @brief Powers off the console + * + * @param fromHBM Whether the request came from HBM + * @return Success + */ + bool shutdownSystem(bool fromHBM); + + /** + * @brief Tests whether this manager is operating normally + */ + bool isNormalState() const; + + /** + * @brief Tests whether this manager is currently shutting down the system + */ + bool isShutDownReserved() const; + + /** + * @brief Tests whether this manager is currently returning to the IPL + */ + bool getReturnToMenu() const; + + /** + * @brief Disables the guard state and returns to normal operation + */ + void resetGuard(); + + /** + * @brief Tests whether this manager is currently exiting the program + */ + bool isApplicationEndReserved(); + + /** + * @brief Tests whether a DVD error should exit the program + */ + bool isDvdErrorApplicationEnd(); + + /** + * @brief Requests a scene change after fading out + * @details A scene id of -1 will select the current scene. + * + * @param id New scene ID + * @param reconfigure Whether to fully reconfigure the scene + * @return Success + */ + bool changeNextSceneAfterFade(s32 id, bool reconfigure = false); + + /** + * @brief Resets the duration of all faders + */ + void resetFadeFrame(); + + /** + * @brief Gets the duration of the scene fader + */ + u16 getFadeFrame(); + + /** + * @brief Sets the duration of all faders + * + * @param frame Fade duration, in frames + */ + void setFadeFrame(u16 frame); + + /** + * @brief Resets the color of all faders + * @details The default fader color is black. + */ + void resetFadeColor(); + + /** + * @brief Gets the color of the manager fader + */ + nw4r::ut::Color getFadeColor(); + + /** + * @brief Sets the color of all faders + * + * @param color Fade color + */ + void setFadeColor(nw4r::ut::Color color); + + /** + * @brief Sets the color of the scene fader + * + * @param color Fade color + */ + void setSceneFadeColor(nw4r::ut::Color color); + + /** + * @brief Gets the status of the scene fader + */ + EGG::Fader::EStatus getSceneStatus(); + + /** + * @brief Sets the status of the scene fader + * + * @param status Fade status + */ + void setSceneStatus(EGG::Fader::EStatus status); + + /** + * @brief Begins fading in the manager fader + * + * @return Success + */ + bool startMgrFadeIn(); + + /** + * @brief Begins fading in the scene fader + * + * @return Success + */ + bool startSceneFadeIn(); + + /** + * @brief Begins fading out the scene fader + * + * @return Success + */ + bool startSceneFadeOut(); + + /** + * @brief Tests whether the scene is fully visible + */ + bool isDisplay(); + + /** + * @brief Tests whether the scene is visibly obscured + */ + bool isBlank(); + + /** + * @brief Tests whether the scene is fading out + */ + bool isFadeOut(); + + /** + * @brief Tests whether all asynchronous tasks have finished + */ + bool isTaskFinished(); + + /** + * @brief Tests whether a scene change would be allowed + */ + bool isSceneChangeEnable(); + + /** + * @brief Updates the state of the scene fader + * + * @return Whether the fade has finished + */ + bool calcSceneFader(); + + /** + * @brief Displays the state of the scene fader + */ + void drawSceneFader(); + + /** + * @brief Displays the state of the manager fader + */ + void drawMgrFader(); + + /** + * @brief Updates the state of this manager + */ + void updateState(); + +private: + /** + * @brief Scene manager state + */ + enum EState { + EState_Normal, //!< Normal operation + EState_Guard, //!< Prevents operations during soft reset + EState_SoftReset, //!< Perform soft reset + EState_ReturnToMenu, //!< Return to system menu + EState_Shutdown //!< Shutdown the system + }; + + //! The default fade duration, in frames + static const int DEFAULT_FADE_FRAME = 20; + + //! The default fade color + static const u32 DEFAULT_FADE_COLOR = nw4r::ut::Color::BLACK; private: - char mPlaceholder[4]; - ApplicationStatus mApplicationStatus; - EGG::ColorFader* mColorFader; + //! Manager state + EState mState; // at 0x30 + //! Fader usable by the current scene + EGG::ColorFader* mpSceneFader; // at 0x34 }; //! @} diff --git a/include/Pack/RPUtility.h b/include/Pack/RPUtility.h index 2044045d..bdd2d9fb 100644 --- a/include/Pack/RPUtility.h +++ b/include/Pack/RPUtility.h @@ -1,6 +1,7 @@ #ifndef RP_PUBLIC_UTILITY_H #define RP_PUBLIC_UTILITY_H +#include #include #endif diff --git a/include/Pack/RPUtility/RPUtlLoadSaveDataScene.h b/include/Pack/RPUtility/RPUtlLoadSaveDataScene.h new file mode 100644 index 00000000..10e1032b --- /dev/null +++ b/include/Pack/RPUtility/RPUtlLoadSaveDataScene.h @@ -0,0 +1,14 @@ +#ifndef RP_UTILITY_LOAD_SAVE_DATA_SCENE_H +#define RP_UTILITY_LOAD_SAVE_DATA_SCENE_H +#include + +#include + +/** + * @brief Base class for scenes which need to load the save file + */ +class RPUtlLoadSaveDataScene : public RPSysScene { +public: +}; + +#endif diff --git a/include/egg/core/eggColorFader.h b/include/egg/core/eggColorFader.h index 2cb917d5..fc30d8ee 100644 --- a/include/egg/core/eggColorFader.h +++ b/include/egg/core/eggColorFader.h @@ -28,7 +28,14 @@ class ColorFader : public Fader { virtual bool calc(); // at 0x18 virtual void draw(); // at 0x1C + u16 getFrame() const { + return mFadeFrame; + } void setFrame(u16 frame); + + nw4r::ut::Color getColor() const { + return mColor; + } void setColor(nw4r::ut::Color color); private: diff --git a/include/egg/core/eggSceneManager.h b/include/egg/core/eggSceneManager.h index 888c372e..4ff05835 100644 --- a/include/egg/core/eggSceneManager.h +++ b/include/egg/core/eggSceneManager.h @@ -5,7 +5,7 @@ namespace EGG { // Forward declarations -class Fader; +class ColorFader; class Heap; class SceneCreator; @@ -106,7 +106,7 @@ class SceneManager { mAfterFadeType = AFTER_FADE_TYPE_NONE; } -private: +protected: SceneCreator* mSceneCreator; // at 0x4 char UNK_0x8[0xC - 0x8]; // at 0x8 Scene* mCurrentScene; // at 0xC @@ -115,7 +115,7 @@ class SceneManager { s32 mCurrentSceneID; // at 0x18 s32 mPreviousSceneID; // at 0x1C eAfterFadeType mAfterFadeType; // at 0x20 - Fader* mCurrentFader; // at 0x24 + ColorFader* mCurrentFader; // at 0x24 eRootHeapType mRootHeapType; // at 0x28 static u16 sHeapOptionFlg; diff --git a/include/egg/core/eggTaskThread.h b/include/egg/core/eggTaskThread.h index d64c8e7d..2134dc5f 100644 --- a/include/egg/core/eggTaskThread.h +++ b/include/egg/core/eggTaskThread.h @@ -54,9 +54,13 @@ class TaskThread : public Thread { return mCurrentJob != NULL; } + OSMessageQueue* getEndMessageQueue() const { + return mEndMesgQueue; + } void setEndMessageQueue(OSMessageQueue* pQueue) { mEndMesgQueue = pQueue; } + OSMessage waitTaskEndMessage(BOOL* pSuccess) { OSMessage msg; *pSuccess = OSReceiveMessage(mEndMesgQueue, &msg, 0); diff --git a/src/Pack/RPKernel/RPSysKokeshiCtrlDataLoader.cpp b/src/Pack/RPKernel/RPSysKokeshiCtrlDataLoader.cpp index aa22ea78..f1fd8a51 100644 --- a/src/Pack/RPKernel/RPSysKokeshiCtrlDataLoader.cpp +++ b/src/Pack/RPKernel/RPSysKokeshiCtrlDataLoader.cpp @@ -5,7 +5,7 @@ /** * @brief Constructor * - * @param chan WPAD channel to use + * @param chan Remote channel */ RPSysKokeshiCtrlDataLoader::RPSysKokeshiCtrlDataLoader(s32 chan) : mChannel(chan), mLoadState(ELoadState_Start) {} diff --git a/src/Pack/RPKernel/RPSysKokeshiCtrlDataMgr.cpp b/src/Pack/RPKernel/RPSysKokeshiCtrlDataMgr.cpp index 26012574..2e746095 100644 --- a/src/Pack/RPKernel/RPSysKokeshiCtrlDataMgr.cpp +++ b/src/Pack/RPKernel/RPSysKokeshiCtrlDataMgr.cpp @@ -13,7 +13,7 @@ * @param pCallback Controller data callback * @param pParentHeap Heap to use as the parent of the controller data heap * @param heapSize Size of the controller data heap - * @param chan WPAD channel to use + * @param chan Remote channel */ RPSysKokeshiCtrlDataMgr::RPSysKokeshiCtrlDataMgr( IRPSysKokeshiCtrlDataCallback* pCallback, EGG::Heap* pParentHeap, diff --git a/src/Pack/RPKernel/RPSysSystem.cpp b/src/Pack/RPKernel/RPSysSystem.cpp index 10b8e9ce..9751545f 100644 --- a/src/Pack/RPKernel/RPSysSystem.cpp +++ b/src/Pack/RPKernel/RPSysSystem.cpp @@ -1,10 +1,12 @@ -#include #include +#include + #include #include + +#include #include #include -#include void RPSysSystem::setupTVMode() { int i; @@ -18,15 +20,14 @@ void RPSysSystem::setupTVMode() { } if (SCGetAspectRatio() == SC_ASPECT_WIDE) { EGG::Screen::SetTVMode(EGG::Screen::TV_MODE_WIDE); - } - else { + } else { EGG::Screen::SetTVMode(EGG::Screen::TV_MODE_STD); } } RPSysSceneCreator::ESceneID RPSysSystem::getBootScene() { // this function is hardcoded (symbol name is official, weirdly enough) - return RPSysSceneCreator::ESceneID_RPSportsTitleScene; + return RPSysSceneCreator::ESceneID_RPSportsPackTitleScene; } void RPSysSystem::startLoadCount() { @@ -41,21 +42,27 @@ void RPSysSystem::setupLocalSettings() { u8 sysLanguage = SCGetLanguage(); if (sysLanguage == SC_LANG_EN) { - RP_GET_INSTANCE(RPSysProjectLocal)->setLocale(RPSysProjectLocal::EArea_USA); - RP_GET_INSTANCE(RPSysProjectLocal)->setLanguage(RPSysProjectLocal::EArea_USA); - } - else if (sysLanguage == SC_LANG_FR) { - RP_GET_INSTANCE(RPSysProjectLocal)->setLocale(RPSysProjectLocal::EArea_USA); - RP_GET_INSTANCE(RPSysProjectLocal)->setLanguage(RPSysProjectLocal::EArea_France); - } - else if (sysLanguage == SC_LANG_SP) { - RP_GET_INSTANCE(RPSysProjectLocal)->setLocale(RPSysProjectLocal::EArea_USA); - RP_GET_INSTANCE(RPSysProjectLocal)->setLanguage(RPSysProjectLocal::EArea_Spain); + RP_GET_INSTANCE(RPSysProjectLocal) + ->setLocale(RPSysProjectLocal::EArea_USA); + RP_GET_INSTANCE(RPSysProjectLocal) + ->setLanguage(RPSysProjectLocal::EArea_USA); + } else if (sysLanguage == SC_LANG_FR) { + RP_GET_INSTANCE(RPSysProjectLocal) + ->setLocale(RPSysProjectLocal::EArea_USA); + RP_GET_INSTANCE(RPSysProjectLocal) + ->setLanguage(RPSysProjectLocal::EArea_France); + } else if (sysLanguage == SC_LANG_SP) { + RP_GET_INSTANCE(RPSysProjectLocal) + ->setLocale(RPSysProjectLocal::EArea_USA); + RP_GET_INSTANCE(RPSysProjectLocal) + ->setLanguage(RPSysProjectLocal::EArea_Spain); } //! Requires ifdef for non Americas versions else { - RP_GET_INSTANCE(RPSysProjectLocal)->setLocale(RPSysProjectLocal::EArea_USA); - RP_GET_INSTANCE(RPSysProjectLocal)->setLanguage(RPSysProjectLocal::EArea_USA); + RP_GET_INSTANCE(RPSysProjectLocal) + ->setLocale(RPSysProjectLocal::EArea_USA); + RP_GET_INSTANCE(RPSysProjectLocal) + ->setLanguage(RPSysProjectLocal::EArea_USA); } } @@ -63,7 +70,6 @@ void RPSysSystem::setupLocalSettings() { * @brief Controls whether the game restarts or returns to the Wii Menu upon a * soft reset. */ - void RPSysSystem::softResetCallBack() { if (RP_GET_INSTANCE(RPSysDvdStatus)->isErrorOccured()) { RP_GET_INSTANCE(RPSysSceneMgr)->returnToMenu(FALSE); diff --git a/src/Pack/RPSystem/RPSysLoadScene.cpp b/src/Pack/RPSystem/RPSysLoadScene.cpp new file mode 100644 index 00000000..81f1a70e --- /dev/null +++ b/src/Pack/RPSystem/RPSysLoadScene.cpp @@ -0,0 +1,283 @@ +#include +#include + +#include + +#include + +#if defined(PACK_SPORTS) +#define RP_COMMON_SOUND_PATH "Sound/RPSportsCommon/rp_Common_Sports.brsar" +#elif defined(PACK_PARTY) +#define RP_COMMON_SOUND_PATH "Sound/RPPartyCommon/rp_Common_Party.brsar" +#endif + +/** + * @brief Displays the game's build date timestamp + * + * @param color Text color + */ +void RPSysScene::drawTimeStamp(nw4r::ut::Color color) { + enum { + YEARSIZE = sizeof("yyyy") - 1, + MONTHSIZE = sizeof("mm") - 1, + DAYSIZE = sizeof("dd") - 1, + TIMESIZE = sizeof("hh:mm") - 1, + BUFSIZE = 8 + }; + + RP_GET_INSTANCE(RPSysTextWriter)->Begin(); + { + RP_GET_INSTANCE(RPSysTextWriter)->SetDrawFlag(0); + RP_GET_INSTANCE(RPSysTextWriter)->SetScale(0.65f, 0.65f); + RP_GET_INSTANCE(RPSysTextWriter)->SetTextColor(color); + + const char* pTimeStamp = + RP_GET_INSTANCE(RPSysSystem)->getTimeStampString(); + + char year[BUFSIZE]; + std::strncpy( // + year, // + pTimeStamp, // + YEARSIZE); + + char month[BUFSIZE]; + std::strncpy( // + month, // + pTimeStamp + YEARSIZE + sizeof('/'), // + MONTHSIZE); + + char day[BUFSIZE]; + std::strncpy( // + day, // + pTimeStamp + YEARSIZE + sizeof('/') + MONTHSIZE + sizeof('/'), // + DAYSIZE); + + char time[BUFSIZE]; + std::strncpy( // + time, // + pTimeStamp + YEARSIZE + sizeof('/') + MONTHSIZE + sizeof('/') + + DAYSIZE + sizeof(" \r\n") - 1, + TIMESIZE); + + year[YEARSIZE] = 0; + month[MONTHSIZE] = 0; + day[DAYSIZE] = 0; + time[TIMESIZE] = 0; + + RP_GET_INSTANCE(RPSysTextWriter) + ->PrintfZeroCenter(-0.95f, -0.90f, "%s %s %s %s", // + month, day, year, time); + } + RP_GET_INSTANCE(RPSysTextWriter)->End(); +} + +void RPSysScene::loadUpdate() {} + +/** + * @brief Marks that this scene requires an asynchronous task + */ +void RPSysScene::setTaskAsync() { + mFlags.setBit(EFlag_TaskAsyncSet); + mFlags.setBit(EFlag_TaskAsyncRunning); +} + +/** + * @brief Tests whether this scene's asynchronous task has finished + */ +bool RPSysScene::isTaskAsyncFinish() const { + return mFlags.onBit(EFlag_TaskAsyncSet) && + mFlags.offBit(EFlag_TaskAsyncRunning); +} + +/** + * @brief Enables the "Now Loading" message display + */ +void RPSysScene::enableLoadMessage() { + mFlags.setBit(EFlag_LoadMessage); +} + +/** + * @brief Loads this scene's resources asynchronously + */ +void RPSysScene::load() { + if (mFlags.onBit(EFlag_LoadMessage)) { + // Need to use loadMessage() + return; + } + + BOOL success = FALSE; + OSMessage msg; + + RP_GET_INSTANCE(RPSysSystem) + ->getDvdThread() + ->request(loadResourceFunc, // + this, // + RP_GET_INSTANCE(RPSysSystem)->getDvdEndMessage()); + + do { + do { + RP_GET_INSTANCE(RPSysSystem)->loadFrameWork(true); + + EGG::TaskThread* pDvdThread = + RP_GET_INSTANCE(RPSysSystem)->getDvdThread(); + + msg = pDvdThread->waitQueueMessage( // + pDvdThread->getEndMessageQueue(), &success); + + } while (!success); + } while (msg != RP_GET_INSTANCE(RPSysSystem)->getDvdEndMessage()); +} + +/** + * @brief Loads this scene's resources asynchronously, displaying a "Now + * Loading" message if the feature is enabled + */ +void RPSysScene::loadMessage() { + if (mFlags.offBit(EFlag_LoadMessage)) { + // Need to use load() + return; + } + + bool finished = false; + + RP_GET_INSTANCE(RPSysSceneMgr) + ->setSceneStatus(EGG::Fader::STATUS_PREPARE_IN); + + RP_GET_INSTANCE(RPSysSceneMgr)->startSceneFadeIn(); + + RP_GET_INSTANCE(RPSysSystem) + ->getDvdThread() + ->request(loadResourceFunc, // + this, // + RP_GET_INSTANCE(RPSysSystem)->getDvdEndMessage()); + + while (true) { + BOOL success = FALSE; + + RP_GET_INSTANCE(RPSysSystem)->loadFrameWork(false); + + if (RP_GET_INSTANCE(RPSysSceneMgr)->calcSceneFader()) { + break; + } + + if (!finished) { + EGG::TaskThread* pDvdThread = + RP_GET_INSTANCE(RPSysSystem)->getDvdThread(); + + OSMessage msg = pDvdThread->waitQueueMessage( // + pDvdThread->getEndMessageQueue(), &success); + + if (success && + msg == RP_GET_INSTANCE(RPSysSystem)->getDvdEndMessage()) { + + finished = true; + } + + } else if (RP_GET_INSTANCE(RPSysSceneMgr)->getSceneStatus() == + EGG::Fader::STATUS_PREPARE_OUT) { + + RP_GET_INSTANCE(RPSysSceneMgr)->startSceneFadeOut(); + } + } +} + +/** + * @brief Creates the asynchronous task thread if requested by the scene + */ +void RPSysScene::initTaskAsync() { + if (mFlags.onBit(EFlag_TaskAsyncSet) && + mFlags.onBit(EFlag_TaskAsyncRunning)) { + + RP_GET_INSTANCE(RPSysSystem) + ->getDvdThread() + ->request(taskAsyncFunc, // + this, // + RP_GET_INSTANCE(RPSysSystem)->getDvdEndMessage()); + } +} + +/** + * @brief Polls the status of the DVD task thread + */ +void RPSysScene::updateDvdEndMessage() { + if (mFlags.onBit(EFlag_TaskAsyncSet) && + mFlags.onBit(EFlag_TaskAsyncRunning)) { + + BOOL success = FALSE; + + EGG::TaskThread* pDvdThread = + RP_GET_INSTANCE(RPSysSystem)->getDvdThread(); + + OSMessage msg = pDvdThread->waitQueueMessage( + pDvdThread->getEndMessageQueue(), &success); + + if (success && + msg == RP_GET_INSTANCE(RPSysSystem)->getDvdEndMessage()) { + + mFlags.resetBit(EFlag_TaskAsyncRunning); + } + } +} + +/** + * @brief Polls the status of the NAND task thread + */ +void RPSysScene::updateNandEndMessage() { + if (!RP_GET_INSTANCE(RPSysSaveDataMgr)->isNandAccessFinish()) { + BOOL success = FALSE; + + EGG::TaskThread* pNandThread = + RP_GET_INSTANCE(RPSysSystem)->getNandThread(); + + OSMessage msg = pNandThread->waitQueueMessage( + pNandThread->getEndMessageQueue(), &success); + + if (success && + msg == RP_GET_INSTANCE(RPSysSystem)->getNandEndMessage()) { + + RP_GET_INSTANCE(RPSysSaveDataMgr)->finishNandAccess(); + } + } + + if (!RP_GET_INSTANCE(RPSysHomeMenuMgr)->isOpen() && + !RP_GET_INSTANCE(RPSysPauseMgr)->isPause()) { + + RP_GET_INSTANCE(RPSysSaveDataMgr)->update(isSceneDisplay()); + } +} + +/** + * @brief Thread function for the LoadResource phase + * + * @param pArg Thread function argument + */ +void RPSysScene::loadResourceFunc(void* pArg) { + RPSysScene* p = static_cast(pArg); + + if (RP_GET_INSTANCE(RPSysSceneCreator)->getAudioType(p->getSceneID()) == + RPSysSceneCreator::EAudioType_Common) { + + RP_GET_INSTANCE(RPSndAudioMgr) + ->openArchive(RP_COMMON_SOUND_PATH, NULL, + EGG::ArcPlayer::SARC_STORAGE_DVD, NULL); + + if (p->getSceneID() == RPSysSceneCreator::ESceneID_RPSysBootScene) { + RP_GET_INSTANCE(RPSndAudioMgr)->loadGroup("GROUP_LOGO"); + } else { + RP_GET_INSTANCE(RPSndAudioMgr)->loadGroup("GROUP_COMMON_01"); + } + } + + p->LoadResource(); +} + +/** + * @brief Thread function for the scene's task + * + * @param pArg Thread function argument + */ +void RPSysScene::taskAsyncFunc(void* pArg) { + RPSysScene* p = static_cast(pArg); + + p->taskAsync(); +} diff --git a/src/Pack/RPSystem/RPSysResourceManager.cpp b/src/Pack/RPSystem/RPSysResourceManager.cpp index 66819b29..ce7069a4 100644 --- a/src/Pack/RPSystem/RPSysResourceManager.cpp +++ b/src/Pack/RPSystem/RPSysResourceManager.cpp @@ -1,6 +1,6 @@ #include -#include -#include +#include +#include #include #include @@ -14,7 +14,7 @@ RP_SINGLETON_IMPL(RPSysResourceManager); */ const RPSysSceneCreator::ESceneID RPSysResourceManager::CACHED_SCENES[] = { RPSysSceneCreator::ESceneID_RPSysPlayerSelectScene, - RPSysSceneCreator::ESceneID_RPSysNunchukScene, + RPSysSceneCreator::ESceneID_RPSysNunchukCheckScene, #if defined(PACK_SPORTS) RPSysSceneCreator::ESceneID_RPBsbScene, @@ -22,13 +22,13 @@ const RPSysSceneCreator::ESceneID RPSysResourceManager::CACHED_SCENES[] = { RPSysSceneCreator::ESceneID_RPGolScene, RPSysSceneCreator::ESceneID_RPTnsScene, RPSysSceneCreator::ESceneID_RPBoxScene, - RPSysSceneCreator::ESceneID_RPSportsTitleScene, - RPSysSceneCreator::ESceneID_RPSportsMenuScene, + RPSysSceneCreator::ESceneID_RPSportsPackTitleScene, + RPSysSceneCreator::ESceneID_RPSportsMainScene, RPSysSceneCreator::ESceneID_RPSportsTrainingMenuScene, RPSysSceneCreator::ESceneID_RPSportsPhysicalMenuScene, RPSysSceneCreator::ESceneID_RPSportsPhysicalPreviewScene, RPSysSceneCreator::ESceneID_RPSportsPhysicalResultScene, - RPSysSceneCreator::ESceneID_RPGolSelectScene, + RPSysSceneCreator::ESceneID_RPGolCourseSelectScene, #elif defined(PACK_PARTY) RPSysSceneCreator::ESceneID_RPFshScene, RPSysSceneCreator::ESceneID_RPHkyScene, @@ -39,9 +39,9 @@ const RPSysSceneCreator::ESceneID RPSysResourceManager::CACHED_SCENES[] = { RPSysSceneCreator::ESceneID_RPWlyScene, RPSysSceneCreator::ESceneID_RPTnkScene, RPSysSceneCreator::ESceneID_RPBomScene, - RPSysSceneCreator::ESceneID_RPPartyTitleScene, - RPSysSceneCreator::ESceneID_RPPartyMiiLoadScene, - RPSysSceneCreator::ESceneID_RPPartyMenuScene, + RPSysSceneCreator::ESceneID_RPPartyPackTitleScene, + RPSysSceneCreator::ESceneID_RPPartyRootScene, + RPSysSceneCreator::ESceneID_RPPartyMainScene, #endif }; diff --git a/src/Pack/RPSystem/RPSysSaveDataMgr.cpp b/src/Pack/RPSystem/RPSysSaveDataMgr.cpp index 1a0f6f2b..d48c04c9 100644 --- a/src/Pack/RPSystem/RPSysSaveDataMgr.cpp +++ b/src/Pack/RPSystem/RPSysSaveDataMgr.cpp @@ -810,10 +810,8 @@ void RPSysSaveDataMgr::loadSync() { // No early return? } - { - EGG::RamStream strm(mpSaveFile, mSaveFileSize); - mpSaveData->read(strm, mpSaveFile); - } + EGG::RamStream strm(mpSaveFile, mSaveFileSize); + mpSaveData->read(strm, mpSaveFile); } } diff --git a/src/Pack/RPSystem/RPSysScene.cpp b/src/Pack/RPSystem/RPSysScene.cpp new file mode 100644 index 00000000..9b52dd9d --- /dev/null +++ b/src/Pack/RPSystem/RPSysScene.cpp @@ -0,0 +1,320 @@ +#include +#include +#include +#include + +#include + +#include + +RPSysScene::UnkStruct RPSysScene::sUnkStruct; + +/** + * @brief Tests whether the scene is fully visible + */ +bool RPSysScene::isSceneDisplay() const { + return RP_GET_INSTANCE(RPSysSceneMgr)->isDisplay(); +} + +/** + * @brief Tests whether the scene is visibly obscured + */ +bool RPSysScene::isSceneBlank() const { + return RP_GET_INSTANCE(RPSysSceneMgr)->isBlank(); +} + +/** + * @brief Tests whether a scene change would be allowed + */ +bool RPSysScene::isSceneChangeEnable() const { + return RP_GET_INSTANCE(RPSysSceneMgr)->isSceneChangeEnable(); +} + +/** + * @brief Tests whether NAND access would be safe + */ +bool RPSysScene::isNandAccessEnable() const { + return !RP_GET_INSTANCE(RPSysSceneMgr)->isFadeOut() && + RP_GET_INSTANCE(RPSysSceneMgr)->isTaskFinished(); +} + +/** + * @brief Sets the duration of all faders + * + * @param frame Fade duration, in frames + */ +void RPSysScene::setFadeFrame(u16 frame) { + RP_GET_INSTANCE(RPSysSceneMgr)->setFadeFrame(frame); +} + +/** + * @brief Gets the color of the manager fader + */ +nw4r::ut::Color RPSysScene::getFadeColor() const { + return RP_GET_INSTANCE(RPSysSceneMgr)->getFadeColor(); +} + +/** + * @brief Sets the color of all faders + * + * @param color Fade color + */ +void RPSysScene::setFadeColor(nw4r::ut::Color color) { + RP_GET_INSTANCE(RPSysSceneMgr)->setFadeColor(color); +} + +/** + * @brief Sets the color of the scene fader + * + * @param color Fade color + */ +void RPSysScene::setSceneFadeColor(nw4r::ut::Color color) { + RP_GET_INSTANCE(RPSysSceneMgr)->setSceneFadeColor(color); +} + +/** + * @brief Begins fading in the scene fader + * + * @return Success + */ +bool RPSysScene::startFadeIn() { + return RP_GET_INSTANCE(RPSysSceneMgr)->startSceneFadeIn(); +} + +/** + * @brief Begins fading out the scene fader + * + * @return Success + */ +bool RPSysScene::startFadeOut() { + return RP_GET_INSTANCE(RPSysSceneMgr)->startSceneFadeOut(); +} + +/** + * @brief Toggles screen dimming + * @note If "Screen Saver Mode" is disabled, dimming is always OFF. + * + * @param enable Whether to dim the screen + */ +void RPSysScene::setDimming(bool enable) { + RP_GET_INSTANCE(RPSysSystem)->setDimming(enable); +} + +/** + * @brief Constructor + */ +RPSysScene::RPSysScene() + : mpRenderer(NULL), + mpCommonObject(NULL), + mpEffectCreator(NULL), + mpSceneHeap(NULL), + mCreatorSceneID(-1) {} + +/** + * @brief Prepares this scene to be entered + */ +void RPSysScene::incomingScene() { + RPSysCoreController::initScene(); + + RP_GET_INSTANCE(RPSysTextWriter)->Reset(); + + if (!mFlags.onBit(EFlag_IsChild)) { + initTaskAsync(); + } + + mpRenderer->BecomeCurrent(); + mpCommonObject->init(); + + RP_GET_INSTANCE(RPSysSceneMgr)->resetFadeColor(); + RP_GET_INSTANCE(RPSysSceneMgr)->resetFadeFrame(); + RP_GET_INSTANCE(RPSysSceneMgr) + ->setSceneStatus(EGG::Fader::STATUS_PREPARE_OUT); + + RP_GET_INSTANCE(RPSysSceneMgr)->resetGuard(); + setDimming(true); + + RP_GET_INSTANCE(RPSysEffectMgr) + ->setCreator(mpEffectCreator, RPSysEffectMgr::EEffectScene_Scene); + + Reset(); + + if (!mFlags.onBit(EFlag_IsChild)) { + RP_GET_INSTANCE(RPSysSceneMgr)->startMgrFadeIn(); + } +} + +/** + * @brief Enters the scene + */ +void RPSysScene::enter() { + init(); + Configure(); + + if (!mFlags.onBit(EFlag_IsChild)) { + RP_GET_INSTANCE(RPSysSceneMgr)->drawMgrFader(); + + load(); + loadMessage(); + } + + incomingScene(); +} + +/** + * @brief Prepares this scene to be exited + */ +void RPSysScene::outgoingScene() { + RPSysCoreController::stopMotorAll(); + + RP_GET_INSTANCE(RPSysEffectMgr)->stopAllEffect(); + RP_GET_INSTANCE(RPSysEffectMgr)->resetCreator(mpEffectCreator); +} + +/** + * @brief Re-initializes the scene + */ +void RPSysScene::reinit() { + outgoingScene(); + incomingScene(); +} + +/** + * @brief Prepares for destruction of (and transition from) a child scene + */ +void RPSysScene::incoming_childDestroy() { + incomingScene(); +} + +/** + * @brief Updates the scene state + */ +void RPSysScene::calc() { + if (!RP_GET_INSTANCE(RPSysDvdStatus)->isErrorOccured()) { + mpCommonObject->preUpdate(); + + loadUpdate(); + + if (RP_GET_INSTANCE(RPSysSceneMgr)->isNormalState() && + !RP_GET_INSTANCE(RPSysHomeMenuMgr)->isOpen() && + !RP_GET_INSTANCE(RPSysPauseMgr)->isPause()) { + + mpRenderer->PreCalculate(); + Calculate(); + mpRenderer->PostCalculate(); + } else { + mpRenderer->CalculateInPause(); + } + + RP_GET_INSTANCE(RP_DEBUG_STUB_0)->Calculate(); + RP_GET_INSTANCE(RPSysHostIOSocketManager)->Update(); + + mpCommonObject->postUpdate(); + } + + updateDvdEndMessage(); + updateNandEndMessage(); +} + +/** + * @brief Renders the scene state + */ +void RPSysScene::draw() { + RP_GET_INSTANCE(RPSysKokeshiManager)->UpdateCtrlMgr(); + + RPGrpRenderer::Begin(); + { + mpRenderer->Rendering(); + + RPGrpRenderer::StartDebugDraw(); + RP_GET_INSTANCE(RP_DEBUG_STUB_0)->DebugDraw(); + } + RPGrpRenderer::End(); +} + +/** + * @brief Prepares for creation of (and transition to) a child scene + */ +void RPSysScene::outgoing_childCreate() { + outgoingScene(); +} + +/** + * @brief Finalizes this scene after being exited + */ +void RPSysScene::exitScenePost() { + GXDrawDone(); + mpRenderer->Destruct(); + + if (mpSceneHeap != NULL) { + RP_GET_INSTANCE(RPSysSystem)->destroyHeap(mpSceneHeap); + } +} + +/** + * @brief Exits the scene + */ +void RPSysScene::exit() { + outgoingScene(); + Exit(); + exitScenePost(); +} + +/** + * @brief Initializes this scene's members + */ +void RPSysScene::init() { + EGG::Allocator* pAllocator = new EGG::Allocator(getHeap()); + mpRenderer = RPGrpRenderer::Construct(pAllocator, getSceneID()); + + mpRenderer->BecomeCurrent(); + RPGrpRenderer::GetCurrent()->AppendDrawObject(*this); + + mpCommonObject = new RPSysCommonObject(); + + mpEffectCreator = + new RPSysEffectCreator(RPSysEffectMgr::EEffectScene_Scene); + + RP_GET_INSTANCE(RPSysKokeshiManager)->Reset(); + + RPSysSceneCreator::EAudioType audioType = + RP_GET_INSTANCE(RPSysSceneCreator)->getAudioType(getSceneID()); + + if (audioType == RPSysSceneCreator::EAudioType_Common) { + RP_GET_INSTANCE(RPSndAudioMgr)->configureTitle(); + } + + RPSysSceneCreator::EExitType exitType = + RP_GET_INSTANCE(RPSysSceneCreator)->getExitType(getSceneID()); + + if (exitType == RPSysSceneCreator::EExitType_Standard) { + RP_GET_INSTANCE(RPSysPlayerMgr)->loadAllData(); + + } else if (exitType == RPSysSceneCreator::EExitType_Sibling || + exitType == RPSysSceneCreator::EExitType_2) { + + RP_GET_INSTANCE(RPSysPlayerMgr)->reset(); + } +} + +/** + * @brief Sets this scene's parent/creator ID + * + * @param id ID of this scene's parent/creator + */ +void RPSysScene::setCreatorSceneID(s32 id) { + mCreatorSceneID = id; +} + +/** + * @brief Gets this scene's parent/creator ID + */ +s32 RPSysScene::getCreatorSceneID() const { + return mCreatorSceneID; +} + +/** + * @brief Marks this scene as a child of the previous scene + */ +void RPSysScene::setChildScene() { + mFlags.setBit(EFlag_IsChild); +} diff --git a/src/Pack/RPSystem/RPSysSceneCreator.cpp b/src/Pack/RPSystem/RPSysSceneCreator.cpp new file mode 100644 index 00000000..9f9585a9 --- /dev/null +++ b/src/Pack/RPSystem/RPSysSceneCreator.cpp @@ -0,0 +1,564 @@ +#include +#include + +#if defined(PACK_SPORTS) +#include +#include +#include +#include +#include +#include +#elif defined(PACK_PARTY) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +RP_SINGLETON_IMPL_EX(RPSysSceneCreator); + +#if defined(PACK_SPORTS) +#define RP_COMMON_DIR "RPCommon/" +#elif defined(PACK_PARTY) +#define RP_COMMON_DIR "RPPartyCommon/" +#endif + +/** + * @brief Information about every Pack Project scene + */ +const RPSysSceneCreator::SceneAttr RPSysSceneCreator::SCENE_ATTR_TABLE[] = { + // clang-format off + {ESceneID_RPSysBootScene, EPackID_AllPack, ECreateType_Standard, ELoadType_Blank, EExitType_Sibling, EAudioType_Common, RP_COMMON_DIR, /* Logo */ "ロゴ"}, + {ESceneID_RPSysPlayerSelectScene, EPackID_AllPack, ECreateType_Standard, ELoadType_Blank, EExitType_2, EAudioType_Common, RP_COMMON_DIR, /* Player Select */ "プレイヤーセレクト"}, + {ESceneID_RPSysNunchukCheckScene, EPackID_AllPack, ECreateType_Sibling, ELoadType_Blank, EExitType_3, EAudioType_Scene, RP_COMMON_DIR, /* Nunchuk Check */ "ヌンチャクチェック"}, + +#if defined(PACK_SPORTS) + {ESceneID_RPBsbScene, EPackID_SportsPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPBsbScene/", /* Baseball */ "野球"}, + {ESceneID_RPBowScene, EPackID_SportsPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPBowScene/", /* Bowling */ "ボウリング"}, + {ESceneID_RPGolScene, EPackID_SportsPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPGolScene/", /* Golf */ "ゴルフ"}, + {ESceneID_RPTnsScene, EPackID_SportsPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPTnsScene/", /* Tennis */ "テニス"}, + {ESceneID_RPBoxScene, EPackID_SportsPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPBoxScene/", /* Boxing */ "ボクシング"}, + {ESceneID_RPSportsPackTitleScene, EPackID_SportsPack, ECreateType_Standard, ELoadType_Blank, EExitType_Sibling, EAudioType_Common, "RPSportsTitle/", /* Sports Pack */ "スポーツパック"}, + {ESceneID_RPSportsMainScene, EPackID_SportsPack, ECreateType_Standard, ELoadType_Blank, EExitType_2, EAudioType_Common, "RPSportsCommon/", /* Sports Menu Select */ "スポーツメニューセレクト"}, + {ESceneID_RPSportsTrainingMenuScene, EPackID_SportsPack, ECreateType_Sibling, ELoadType_Blank, EExitType_3, EAudioType_Common, "RPSportsTrainingMenu/", /* Training Menu */ "トレーニングメニュー"}, + {ESceneID_RPSportsPhysicalMenuScene, EPackID_SportsPack, ECreateType_Sibling, ELoadType_Blank, EExitType_3, EAudioType_Common, "RPSportsPhysical/", /* Physical Measure Menu */ "体力測定メニュー"}, + {ESceneID_RPSportsPhysicalPreviewScene, EPackID_SportsPack, ECreateType_Sibling, ELoadType_Blank, EExitType_3, EAudioType_Common, "RPSportsPhysical/", /* Physical Measure Explanation */ "体力測定説明"}, + {ESceneID_RPSportsPhysicalResultScene, EPackID_SportsPack, ECreateType_Sibling, ELoadType_Blank, EExitType_3, EAudioType_Common, "RPSportsPhysical/", /* Physical Measure Results */ "体力測定結果"}, + {ESceneID_RPGolCourseSelectScene, EPackID_SportsPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPGolScene/", /* Golf Course Select */ "ゴルフコースセレクト"}, +#endif + +#if defined(PACK_PARTY) + {ESceneID_RPFshScene, EPackID_PartyPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPFshScene/", /* Fishing */ "釣り"}, + {ESceneID_RPHkyScene, EPackID_PartyPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPHkyScene/", /* Hockey */ "ホッケー"}, + {ESceneID_RPDucScene, EPackID_PartyPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPDucScene/", /* Shooting */ "射撃"}, + {ESceneID_RPPnpScene, EPackID_PartyPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPPnpScene/", /* Table Tennis */ "卓球"}, + {ESceneID_RPBilScene, EPackID_PartyPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPBilScene/", /* Billiards */ "ビリヤード"}, + {ESceneID_RPCowScene, EPackID_PartyPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPCowScene/", /* Charge! */ "牛レース"}, + {ESceneID_RPWlyScene, EPackID_PartyPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPWlyScene/", /* Find Mii */ "ウォーリー "}, + {ESceneID_RPTnkScene, EPackID_PartyPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPTnkScene/", /* Tanks! */ "タンク"}, + {ESceneID_RPBomScene, EPackID_PartyPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPBomScene/", /* Pose Mii */ "爆弾"}, + {ESceneID_RPPartyPackTitleScene, EPackID_PartyPack, ECreateType_Standard, ELoadType_Blank, EExitType_Sibling, EAudioType_Common, "RPPartyTitle/", /* Party Pack */ "パーティパック"}, + {ESceneID_RPPartyRootScene, EPackID_PartyPack, ECreateType_Standard, ELoadType_Blank, EExitType_Child, EAudioType_Common, "RPPartyCommon/", /* Tour Menu */ "ツアーメニュー"}, + {ESceneID_RPPartyMainScene, EPackID_PartyPack, ECreateType_Sibling, ELoadType_Blank, EExitType_3, EAudioType_Common, "RPPartyCommon/", /* Tour Menu */ "ツアーメニュー"}, +#endif + // clang-format on +}; + +/** + * @brief Constructor + * + * @param pHeap Heap to use for allocations + */ +RPSysSceneCreator::RPSysSceneCreator(EGG::Heap* pHeap) + : mpParentHeap(pHeap), mPrevSceneID(-1) {} + +/** + * @brief Gets the index of the specified scene's entry in the table + * + * @param id Scene ID + * @return Entry index, or -1 if not found + */ +s32 RPSysSceneCreator::getEntryIndex(ESceneID id) { + for (s32 i = 0; i < LENGTHOF(SCENE_ATTR_TABLE); i++) { + if (SCENE_ATTR_TABLE[i].scene == id) { + return i; + } + } + + return -1; +} + +/** + * @brief Requests a scene change after fading out + * @details A scene id of -1 will select the current scene. + * + * @param id New scene ID + * @param reconfigure Whether to fully reconfigure the scene + * @return Success + */ +bool RPSysSceneCreator::changeSceneAfterFade(s32 id, bool reconfigure) { + bool success = false; + + if (RP_GET_INSTANCE(RPSysSceneMgr)->isTaskFinished()) { + s32 current = RP_GET_INSTANCE(RPSysSceneMgr)->getCurrentSceneID(); + + if (reconfigure) { + id = current; + } + + success = RP_GET_INSTANCE(RPSysSceneMgr) + ->changeNextSceneAfterFade(id, reconfigure); + + if (success && current >= 0) { + // Fade out audio before switching sound archives + if (getAudioType(current) != getAudioType(id)) { + u16 frames = RP_GET_INSTANCE(RPSysSceneMgr)->getFadeFrame(); + RP_GET_INSTANCE(RPSndAudioMgr)->fadeOutAllSound(frames); + } + + if (getExitType(id) != EExitType_Child) { + mPrevSceneID = current; + } + } + } + + return success; +} + +/** + * @brief Changes to the title scene + * + * @return Success + */ +bool RPSysSceneCreator::changeSoftReset() { +#if defined(PACK_SPORTS) + return changeSceneAfterFade(ESceneID_RPSportsPackTitleScene); +#elif defined(PACK_PARTY) + return changeSceneAfterFade(ESceneID_RPPartyPackTitleScene); +#endif +} + +/** + * @brief Creates the specified scene + * + * @param id Scene ID + */ +EGG::Scene* RPSysSceneCreator::create(s32 id) { + RPSysScene* pScene = NULL; + + switch (getPackID(id)) { + case EPackID_SportsPack: { +#if defined(PACK_SPORTS) + pScene = createSportsScene(id); +#else + pScene = NULL; +#endif + break; + } + + case EPackID_PartyPack: { +#if defined(PACK_PARTY) + pScene = createPartyScene(id); +#else + pScene = NULL; +#endif + break; + } + + case EPackID_HealthPack: { +#if defined(PACK_HEALTH) + pScene = createHealthScene(id); +#else + pScene = NULL; +#endif + break; + } + + case EPackID_MusicPack: { +#if defined(PACK_MUSIC) + pScene = createMusicScene(id); +#else + pScene = NULL; +#endif + break; + } + + case EPackID_AllPack: { + switch (id) { + case ESceneID_RPSysBootScene: { + pScene = new RPSysBootScene(); + break; + } + + case ESceneID_RPSysPlayerSelectScene: { + pScene = new RPSysPlayerSelectScene(); + break; + } + + case ESceneID_RPSysNunchukCheckScene: { + pScene = new RPSysNunchukCheckScene(); + break; + } + + default: { + pScene = NULL; + break; + } + } + + break; + } + + default: { + break; + } + } + + if (pScene != NULL) { + if (getLoadType(id) == ELoadType_Message) { + pScene->enableLoadMessage(); + } + + if (getExitType(id) == EExitType_Child) { + pScene->setChildScene(); + } + + pScene->setCreatorSceneID(mPrevSceneID); + } + + return pScene; +} + +/** + * @brief Destroys the specified scene + * + * @param id Scene ID + */ +void RPSysSceneCreator::destroy(s32 /* id */) { + if (RP_GET_INSTANCE(RPSysSceneMgr)->isApplicationEndReserved()) { + RP_GET_INSTANCE(RPSysSystem)->systemShutDown(); + } +} + +/** + * @brief Gets the specified scene's resource directory + * @details A scene id of -1 will select the current scene. + * + * @param id Scene ID + */ +const char* RPSysSceneCreator::getResDirName(s32 id) { + if (id < 0) { + id = RP_GET_INSTANCE(RPSysSceneMgr)->getCurrentSceneID(); + } + + s32 index = getEntryIndex(static_cast(id)); + +// @bug Table index is not validated +#if defined(BUG_FIX) + if (index < 0) { + return RP_COMMON_DIR; + } +#endif + + return SCENE_ATTR_TABLE[index].pResDirName; +} + +/** + * @brief Gets the specified scene's sport ID + * @details A scene id of -1 will select the current scene. + * @note If no sport corresponds to the scene, this function returns -1. + * + * @param id Scene ID + */ +s32 RPSysSceneCreator::getSportID(s32 id) { + if (id < 0) { + id = RP_GET_INSTANCE(RPSysSceneMgr)->getCurrentSceneID(); + } + + switch (id) { + case ESceneID_RPBsbScene: { + return ESportID_Bsb; + } + + case ESceneID_RPTnsScene: { + return ESportID_Tns; + } + + case ESceneID_RPGolScene: { + return ESportID_Gol; + } + + case ESceneID_RPBoxScene: { + return ESportID_Box; + } + + case ESceneID_RPBowScene: { + return ESportID_Bow; + } + + default: { + return -1; + } + } +} + +/** + * @brief Gets the specified sport's scene ID + * @note If no scene corresponds to the sport, this function returns -1. + * + * @param sport Sport ID + */ +s32 RPSysSceneCreator::getSceneID(ESportID sport) { + switch (sport) { + case ESportID_Bsb: { + return ESceneID_RPBsbScene; + } + + case ESportID_Tns: { + return ESceneID_RPTnsScene; + } + + case ESportID_Gol: { + return ESceneID_RPGolScene; + } + + case ESportID_Box: { + return ESceneID_RPBoxScene; + } + + case ESportID_Bow: { + return ESceneID_RPBowScene; + } + + default: { + return -1; + } + } +} + +/** + * @brief Gets the specified scene's pack ID + * + * @param id Scene ID + */ +RPSysSceneCreator::EPackID RPSysSceneCreator::getPackID(s32 id) { + s32 index = getEntryIndex(static_cast(id)); + +// @bug Table index is not validated +#if defined(BUG_FIX) + if (index < 0) { + return EPackID_AllPack; + } +#endif + + return SCENE_ATTR_TABLE[index].pack; +} + +/** + * @brief Gets the specified scene's creation type + * + * @param id Scene ID + */ +RPSysSceneCreator::ECreateType RPSysSceneCreator::getCreateType(s32 id) { + s32 index = getEntryIndex(static_cast(id)); + +// @bug Table index is not validated +#if defined(BUG_FIX) + if (index < 0) { + return ECreateType_Standard; + } +#endif + + return SCENE_ATTR_TABLE[index].createType; +} + +/** + * @brief Gets the specified scene's load type + * + * @param id Scene ID + */ +RPSysSceneCreator::ELoadType RPSysSceneCreator::getLoadType(s32 id) { + s32 index = getEntryIndex(static_cast(id)); + +// @bug Table index is not validated +#if defined(BUG_FIX) + if (index < 0) { + return ELoadType_Blank; + } +#endif + + return SCENE_ATTR_TABLE[index].loadType; +} + +/** + * @brief Gets the specified scene's exit type + * + * @param id Scene ID + */ +RPSysSceneCreator::EExitType RPSysSceneCreator::getExitType(s32 id) { + s32 index = getEntryIndex(static_cast(id)); + +// @bug Table index is not validated +#if defined(BUG_FIX) + if (index < 0) { + return EExitType_Standard; + } +#endif + + return SCENE_ATTR_TABLE[index].exitType; +} + +/** + * @brief Gets the specified scene's audio type + * + * @param id Scene ID + */ +RPSysSceneCreator::EAudioType RPSysSceneCreator::getAudioType(s32 id) { + s32 index = getEntryIndex(static_cast(id)); + +// @bug Table index is not validated +#if defined(BUG_FIX) + if (index < 0) { + return EAudioType_Scene; + } +#endif + + return SCENE_ATTR_TABLE[index].audioType; +} + +#if defined(PACK_SPORTS) +/** + * @brief Creates the specified Sports Pack scene + * + * @param id Scene ID + */ +RPSysScene* RPSysSceneCreator::createSportsScene(s32 id) { + switch (id) { + case ESceneID_RPBsbScene: { + return new RPBsbScene(); + } + + case ESceneID_RPBowScene: { + return new RPBowScene(); + } + + case ESceneID_RPGolScene: { + return new RPGolScene(); + } + + case ESceneID_RPTnsScene: { + return new RPTnsScene(); + } + + case ESceneID_RPBoxScene: { + return new RPBoxScene(); + } + + case ESceneID_RPSportsPackTitleScene: { + return new RPSportsPackTitleScene(); + } + + case ESceneID_RPSportsMainScene: { + return new RPSportsMainScene(); + } + + case ESceneID_RPSportsTrainingMenuScene: { + return new RPSportsTrainingMenuScene(); + } + + case ESceneID_RPSportsPhysicalMenuScene: { + return new RPSportsPhysicalMenuScene(); + } + + case ESceneID_RPSportsPhysicalPreviewScene: { + return new RPSportsPhysicalPreviewScene(); + } + + case ESceneID_RPSportsPhysicalResultScene: { + return new RPSportsPhysicalResultScene(); + } + + case ESceneID_RPGolCourseSelectScene: { + return new RPGolCourseSelectScene(); + } + + default: { + return NULL; + } + } +} +#endif + +#if defined(PACK_PARTY) +/** + * @brief Creates the specified Party Pack scene + * + * @param id Scene ID + */ +RPSysScene* RPSysSceneCreator::createPartyScene(s32 id) { + switch (id) { + case ESceneID_RPFshScene: { + return new RPFshScene(); + } + + case ESceneID_RPHkyScene: { + return new RPHkyScene(); + } + + case ESceneID_RPDucScene: { + return new RPDucScene(); + } + + case ESceneID_RPPnpScene: { + return new RPPnpScene(); + } + + case ESceneID_RPBilScene: { + return new RPBilScene(); + } + + case ESceneID_RPCowScene: { + return new RPCowScene(); + } + + case ESceneID_RPWlyScene: { + return new RPWlyScene(); + } + + case ESceneID_RPTnkScene: { + return new RPTnkScene(); + } + + case ESceneID_RPBomScene: { + return new RPBomScene(); + } + + case ESceneID_RPPartyPackTitleScene: { + return new RPPartyPackTitleScene(); + } + + case ESceneID_RPPartyRootScene: { + return new RPPartyRootScene(); + } + + case ESceneID_RPPartyMainScene: { + return new RPPartyMainScene(); + } + + default: { + return NULL; + } + } +} +#endif + +/** + * @brief Destructor + */ +RPSysSceneCreator::~RPSysSceneCreator() {} diff --git a/src/Pack/RPSystem/RPSysSceneMgr.cpp b/src/Pack/RPSystem/RPSysSceneMgr.cpp new file mode 100644 index 00000000..13e9cb7d --- /dev/null +++ b/src/Pack/RPSystem/RPSysSceneMgr.cpp @@ -0,0 +1,501 @@ +#include +#include + +#include + +#include + +RP_SINGLETON_IMPL_EX(RPSysSceneMgr); + +/** + * @brief Constructor + * + * @param pHeap Heap to use for allocations + */ +RPSysSceneMgr::RPSysSceneMgr(EGG::Heap* pHeap) + : mpParentHeap(pHeap), mState(EState_Normal) { + + mpSceneFader = new EGG::ColorFader( // + 0.0f, 0.0f, // + RP_GET_INSTANCE(RPSysSystem)->getFBWidth(), // + RP_GET_INSTANCE(RPSysSystem)->getFBHeight() // + ); +} + +/** + * @brief Gets the currently active scene as the Pack Project type + */ +RPSysScene* RPSysSceneMgr::getCurrentSceneRP() const { + return static_cast(getCurrentScene()); +} + +/** + * @brief Performs a soft reset + * + * @param fromHBM Whether the request came from HBM + * @return Success + */ +bool RPSysSceneMgr::softReset(bool fromHBM) { + if (mState == EState_Normal) { + mState = EState_SoftReset; + + // HBM does its own fadeout + if (fromHBM) { + resetFadeFrame(); + resetFadeColor(); + setSceneStatus(EGG::Fader::STATUS_PREPARE_IN); + } + + return true; + } + + return false; +} + +/** + * @brief Returns to the IPL + * + * @param fromHBM Whether the request came from HBM + * @return Success + */ +bool RPSysSceneMgr::returnToMenu(bool fromHBM) { + if (mState == EState_Normal) { + RP_GET_INSTANCE(RPSysSaveDataMgr)->setSaveDisable(true); + mState = EState_ReturnToMenu; + + // HBM does its own fadeout + if (fromHBM) { + VISetBlack(TRUE); + } + + return true; + } + + return false; +} + +/** + * @brief Powers off the console + * + * @param fromHBM Whether the request came from HBM + * @return Success + */ +bool RPSysSceneMgr::shutdownSystem(bool fromHBM) { + if (mState == EState_Normal) { + RP_GET_INSTANCE(RPSysSaveDataMgr)->setSaveDisable(true); + mState = EState_Shutdown; + + // HBM does its own fadeout + if (fromHBM) { + VISetBlack(TRUE); + } + + return true; + } + + return false; +} + +/** + * @brief Tests whether this manager is operating normally + */ +bool RPSysSceneMgr::isNormalState() const { + return mState == EState_Normal; +} + +/** + * @brief Tests whether this manager is currently shutting down the system + */ +bool RPSysSceneMgr::isShutDownReserved() const { + return mState == EState_Shutdown; +} + +/** + * @brief Tests whether this manager is currently returning to the IPL + */ +bool RPSysSceneMgr::getReturnToMenu() const { + return mState == EState_ReturnToMenu; +} + +/** + * @brief Disables the guard state and returns to normal operation + */ +void RPSysSceneMgr::resetGuard() { + if (mState == EState_Guard) { + mState = EState_Normal; + } +} + +/** + * @brief Tests whether this manager is currently exiting the program + */ +bool RPSysSceneMgr::isApplicationEndReserved() { + return getReturnToMenu() || isShutDownReserved(); +} + +/** + * @brief Tests whether a DVD error should exit the program + */ +bool RPSysSceneMgr::isDvdErrorApplicationEnd() { + return mState != EState_Normal; +} + +/** + * @brief Requests a scene change after fading out + * @details A scene id of -1 will select the current scene. + * + * @param id New scene ID + * @param reconfigure Whether to fully reconfigure the scene + * @return Success + */ +bool RPSysSceneMgr::changeNextSceneAfterFade(s32 id, bool reconfigure) { + //! Scene change method + enum EMethod { + Default, + ChangeSiblingSceneAfterFadeOut, + CreateChildSceneAfterFadeOut, + ReInitCurrentSceneAfterFadeOut, + DestroyToSelectSceneIDAfterFadeOut, + ChangeSceneAfterFadeOut, + ChangeScene, // no fadeout + CreateChildScene, // no fadeout + }; + + EMethod method = Default; + + if (getCurrentSceneRP() != NULL) { + s32 current = getCurrentSceneRP()->getSceneID(); + + // Parent scene's exit type takes priority over the new create type + RPSysSceneCreator::EExitType exitType = + RP_GET_INSTANCE(RPSysSceneCreator)->getExitType(current); + + // Current scene requests that new scenes are children + if (exitType == RPSysSceneCreator::EExitType_Child) { + method = CreateChildScene; + + goto _do_change; + } + + // Current scene is being reloaded + if (current == id) { + // Usual behavior is re-init, which skips the Configure phase. + // The reconfigure parameter forces a full destroy -> create. + if (reconfigure || + exitType == RPSysSceneCreator::EExitType_Sibling) { + method = ChangeSiblingSceneAfterFadeOut; + } else { + method = ReInitCurrentSceneAfterFadeOut; + } + + goto _do_change; + } + + // Orphan scenes can be freely destroyed + if (findParentScene(id) != NULL) { + method = DestroyToSelectSceneIDAfterFadeOut; + + goto _do_change; + } + + // New scene's create type takes the lowest priority + switch (RP_GET_INSTANCE(RPSysSceneCreator)->getCreateType(id)) { + case RPSysSceneCreator::ECreateType_Standard: { + method = ChangeSceneAfterFadeOut; + break; + } + + case RPSysSceneCreator::ECreateType_Sibling: { + method = ChangeSiblingSceneAfterFadeOut; + break; + } + + case RPSysSceneCreator::ECreateType_Child: { + method = CreateChildSceneAfterFadeOut; + break; + } + } + + } else { + // No scene exists yet, nothing else needs to be done + method = ChangeScene; + } + +_do_change: + switch (method) { + case Default: + case ChangeSiblingSceneAfterFadeOut: { + return changeSiblingSceneAfterFadeOut(id); + } + + case CreateChildSceneAfterFadeOut: { + return createChildSceneAfterFadeOut(id, getCurrentSceneRP()); + } + + case CreateChildScene: { + createChildScene(id, getCurrentSceneRP()); + return true; + } + + case ReInitCurrentSceneAfterFadeOut: { + return reinitCurrentSceneAfterFadeOut(); + } + + case DestroyToSelectSceneIDAfterFadeOut: { + return destroyToSelectSceneIDAfterFadeOut(id); + } + + case ChangeSceneAfterFadeOut: { + return changeSceneAfterFadeOut(id); + } + + case ChangeScene: { + changeScene(id); + return true; + } + + default: { + return false; + } + } +} + +/** + * @brief Resets the duration of all faders + */ +void RPSysSceneMgr::resetFadeFrame() { + mpSceneFader->setFrame(DEFAULT_FADE_FRAME); + mCurrentFader->setFrame(DEFAULT_FADE_FRAME); +} + +/** + * @brief Gets the duration of the scene fader + */ +u16 RPSysSceneMgr::getFadeFrame() { + return mpSceneFader->getFrame(); +} + +/** + * @brief Sets the duration of all faders + * + * @param frame Fade duration, in frames + */ +void RPSysSceneMgr::setFadeFrame(u16 frame) { + mpSceneFader->setFrame(frame); + mCurrentFader->setFrame(frame); +} + +/** + * @brief Resets the color of all faders + * @details The default fader color is white. + */ +void RPSysSceneMgr::resetFadeColor() { + mpSceneFader->setColor(DEFAULT_FADE_COLOR); + mCurrentFader->setColor(DEFAULT_FADE_COLOR); +} + +/** + * @brief Gets the color of the manager fader + */ +nw4r::ut::Color RPSysSceneMgr::getFadeColor() { + return mCurrentFader->getColor(); +} + +/** + * @brief Sets the color of all faders + * + * @param color Fade color + */ +void RPSysSceneMgr::setFadeColor(nw4r::ut::Color color) { + mpSceneFader->setColor(color); + mCurrentFader->setColor(color); +} + +/** + * @brief Sets the color of the scene fader + * + * @param color Fade color + */ +void RPSysSceneMgr::setSceneFadeColor(nw4r::ut::Color color) { + mpSceneFader->setColor(color); +} + +/** + * @brief Gets the status of the scene fader + */ +EGG::Fader::EStatus RPSysSceneMgr::getSceneStatus() { + return mpSceneFader->getStatus(); +} + +/** + * @brief Sets the status of the scene fader + * + * @param status Fade status + */ +void RPSysSceneMgr::setSceneStatus(EGG::Fader::EStatus status) { + mpSceneFader->setStatus(status); +} + +/** + * @brief Begins fading in the manager fader + * + * @return Success + */ +bool RPSysSceneMgr::startMgrFadeIn() { + return fadeIn(); +} + +/** + * @brief Begins fading in the scene fader + * + * @return Success + */ +bool RPSysSceneMgr::startSceneFadeIn() { + return mpSceneFader->fadeIn(); +} + +/** + * @brief Begins fading out the scene fader + * + * @return Success + */ +bool RPSysSceneMgr::startSceneFadeOut() { + return mpSceneFader->fadeOut(); +} + +/** + * @brief Tests whether the scene is fully visible + */ +bool RPSysSceneMgr::isDisplay() { + return mCurrentFader->getStatus() == EGG::Fader::STATUS_PREPARE_OUT && + mpSceneFader->getStatus() == EGG::Fader::STATUS_PREPARE_OUT; +} + +/** + * @brief Tests whether the scene is visibly obscured + */ +bool RPSysSceneMgr::isBlank() { + return mCurrentFader->getStatus() == EGG::Fader::STATUS_PREPARE_IN || + mpSceneFader->getStatus() == EGG::Fader::STATUS_PREPARE_IN; +} + +/** + * @brief Tests whether the scene is fading out + */ +bool RPSysSceneMgr::isFadeOut() { + return mCurrentFader->getStatus() == EGG::Fader::STATUS_FADE_OUT || + mpSceneFader->getStatus() == EGG::Fader::STATUS_FADE_OUT; +} + +/** + * @brief Tests whether all asynchronous tasks have finished + */ +bool RPSysSceneMgr::isTaskFinished() { + if (RP_GET_INSTANCE(RPSysSaveDataMgr)->isNandAccessFinish() && + !RP_GET_INSTANCE(RPSysSystem)->getNandThread()->isTaskExist() && + !RP_GET_INSTANCE(RPSysSystem)->getDvdThread()->isTaskExist() && + !RP_GET_INSTANCE(RPSysSystem)->getWc24Thread()->isTaskExist()) { + + return true; + } + + return false; +} + +/** + * @brief Tests whether a scene change would be allowed + */ +bool RPSysSceneMgr::isSceneChangeEnable() { + if (mCurrentFader->getStatus() == EGG::Fader::STATUS_PREPARE_OUT && + RP_GET_INSTANCE(RPSysSaveDataMgr)->isNandAccessFinish() && + !RP_GET_INSTANCE(RPSysSystem)->getNandThread()->isTaskExist() && + !RP_GET_INSTANCE(RPSysSystem)->getDvdThread()->isTaskExist() && + !RP_GET_INSTANCE(RPSysSystem)->getWc24Thread()->isTaskExist()) { + + return true; + } + + return false; +} + +/** + * @brief Updates the state of the scene fader + * + * @return Whether the fade has finished + */ +bool RPSysSceneMgr::calcSceneFader() { + return mpSceneFader->calc(); +} + +/** + * @brief Displays the state of the scene fader + */ +void RPSysSceneMgr::drawSceneFader() { + mpSceneFader->draw(); +} + +/** + * @brief Displays the state of the manager fader + */ +void RPSysSceneMgr::drawMgrFader() { + mCurrentFader->draw(); +} + +/** + * @brief Updates the state of the current scene + */ +void RPSysSceneMgr::calcCurrentScene() { + updateState(); + EGG::SceneManager::calcCurrentScene(); +} + +/** + * @brief Updates the state of this manager + */ +void RPSysSceneMgr::updateState() { + if (mState == EState_Normal) { + RP_GET_INSTANCE(RPSysSystem)->setCallBack(); + return; + } + + if (isSceneChangeEnable()) { + bool success = false; + + if (mState == EState_SoftReset) { + success = RP_GET_INSTANCE(RPSysSceneCreator)->changeSoftReset(); + + } else if (mState == EState_ReturnToMenu || mState == EState_Shutdown) { + // Dummy scene change to allow RPSysSceneCreator::destroy() to exit + success = changeSceneAfterFadeOut( + RPSysSceneCreator::ESceneID_RPSysBootScene); + } + + if (success) { + resetFadeFrame(); + + if (mState == EState_SoftReset) { + if (getCurrentSceneID() != + RPSysSceneCreator::ESceneID_RPSysBootScene) { + + resetFadeColor(); + } + + RP_GET_INSTANCE(RPSndAudioMgr)->resetSystem(DEFAULT_FADE_FRAME); + mState = EState_Guard; + + } else if (mState == EState_ReturnToMenu || + mState == EState_Shutdown) { + + setSceneFadeColor(DEFAULT_FADE_COLOR); + + RP_GET_INSTANCE(RPSndAudioMgr) + ->shutdownSystem(DEFAULT_FADE_FRAME); + } + } + } +} + +/** + * @brief Destructor + */ +RPSysSceneMgr::~RPSysSceneMgr() {}