diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index ad9ae6e7..92ad6b69 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -233,11 +233,18 @@ d/d_main.cpp: .sbss start:0x805751D0 end:0x805751E0 d/d_pad.cpp: - .text start:0x80055170 end:0x80059CE0 align:16 + .text start:0x80055170 end:0x8005961C align:16 .ctors start:0x804DB684 end:0x804DB688 + .sdata start:0x80571C60 end:0x80571C68 + .sbss start:0x805751E0 end:0x805751E8 + .sdata2 start:0x80576F60 end:0x80577008 + .bss start:0x80597A70 end:0x805A06B0 -d/d_pad_player.cpp: - .text start:0x80059CE0 end:0x8005B6E0 align:16 +d/d_pad_ex.cpp: + .text start:0x80059620 end:0x80059CE0 align:16 + +d/d_pause_manager.cpp: + .text start:0x80059CE0 end:0x8005B6D4 align:16 d/d_player_act.cpp: .text start:0x8005B6E0 end:0x8005CE8C align:16 @@ -330,10 +337,14 @@ toBeSorted/area_math.cpp: toBeSorted/deg_angle_util.cpp: .text start:0x80067280 end:0x80067B14 align:16 -toBeSorted/reload_color_fader.cpp: +d/d_reset.cpp: .text start:0x80067B20 end:0x80068FD0 align:16 .ctors start:0x804DB6A4 end:0x804DB6A8 + .rodata start:0x804E0F18 end:0x804E0FA8 + .data start:0x8050DFB0 end:0x8050DFE0 + .sdata start:0x80571D20 end:0x80571D30 .sbss start:0x80575270 end:0x80575278 + .sdata2 start:0x805779E8 end:0x805779F8 toBeSorted/arc_managers/current_stage_arc_manager.cpp: .text start:0x80068FD0 end:0x80069910 align:16 @@ -1264,7 +1275,7 @@ toBeSorted/misc_actor.cpp: .sbss start:0x805756B0 end:0x805756F0 .bss start:0x805B2438 end:0x805B24C0 -toBeSorted/d_hbm: +d/d_hbm.cpp: .text start:0x80196650 end:0x801975B8 align:16 .rodata start:0x804EA810 end:0x804EA868 .data start:0x8052B678 end:0x8052B708 @@ -1406,7 +1417,10 @@ d/a/obj/d_a_obj_boomerang.cpp: .ctors start:0x804DB834 end:0x804DB838 .rodata start:0x804ED380 end:0x804ED3B0 .data start:0x80534AD0 end:0x80534E78 + .sdata start:0x805739D8 end:0x80573A30 .sbss start:0x80575900 end:0x80575908 + .sdata2 start:0x8057C0F8 end:0x8057C180 + .bss start:0x805B4BF0 end:0x805B4DD8 d/a/obj/d_a_obj_fairy.cpp: .text start:0x80265620 end:0x80268598 align:16 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index d7202436..d2d9f88e 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -2155,9 +2155,9 @@ fn_800527F0 = .text:0x800527F0; // type:function size:0x11C fn_80052910 = .text:0x80052910; // type:function size:0x48 fn_80052960 = .text:0x80052960; // type:function size:0x18 init__Q27dDvdUnk7FontUnkFv = .text:0x80052980; // type:function size:0x30 -fn_800529B0 = .text:0x800529B0; // type:function size:0x30 -fn_800529E0 = .text:0x800529E0; // type:function size:0x38 -fn_80052A20 = .text:0x80052A20; // type:function size:0xB8 +fn_800529B0__Q27dDvdUnk7FontUnkFv = .text:0x800529B0; // type:function size:0x30 +fn_800529E0__Q27dDvdUnk7FontUnkFv = .text:0x800529E0; // type:function size:0x38 +fn_80052A20__Q27dDvdUnk7FontUnkFv = .text:0x80052A20; // type:function size:0xB8 fn_80052AE0 = .text:0x80052AE0; // type:function size:0x148 fn_80052C30 = .text:0x80052C30; // type:function size:0x24 fn_80052C60__Q27dDvdUnk7FontUnkFv = .text:0x80052C60; // type:function size:0x24 @@ -2243,170 +2243,170 @@ dMain__Create = .text:0x80055000; // type:function size:0x28 dMain__Execute = .text:0x80055030; // type:function size:0x14 dMain__main01 = .text:0x80055050; // type:function size:0x28 main = .text:0x80055080; // type:function size:0xE4 scope:global -fn_80055170 = .text:0x80055170; // type:function size:0x38 -fn_800551B0 = .text:0x800551B0; // type:function size:0x24 -fn_800551E0 = .text:0x800551E0; // type:function size:0x8C -dPad__create = .text:0x80055270; // type:function size:0xBC -fn_80055330 = .text:0x80055330; // type:function size:0x98 -fn_800553D0 = .text:0x800553D0; // type:function size:0x50 -fn_80055420 = .text:0x80055420; // type:function size:0x73C -fn_80055B60 = .text:0x80055B60; // type:function size:0x10 -errRangeOver__Q23EGG29TBufferFv = .text:0x80055B70; // type:function size:0x4 -mPad__endPad = .text:0x80055B80; // type:function size:0x4 -fn_80055B90 = .text:0x80055B90; // type:function size:0x94 -fn_80055C30 = .text:0x80055C30; // type:function size:0x10 -fn_80055C40 = .text:0x80055C40; // type:function size:0x4 -fn_80055C50 = .text:0x80055C50; // type:function size:0x4 -fn_80055C60 = .text:0x80055C60; // type:function size:0x284 -fn_80055EF0 = .text:0x80055EF0; // type:function size:0x3B4 -fn_800562B0 = .text:0x800562B0; // type:function size:0x74 -fn_80056330 = .text:0x80056330; // type:function size:0x24C -fn_80056580 = .text:0x80056580; // type:function size:0xEC -centerCursor = .text:0x80056670; // type:function size:0x114 -fn_80056790 = .text:0x80056790; // type:function size:0x334 -fn_80056AD0 = .text:0x80056AD0; // type:function size:0xC -fn_80056AE0 = .text:0x80056AE0; // type:function size:0xC -fn_80056AF0 = .text:0x80056AF0; // type:function size:0x90 -fn_80056B80 = .text:0x80056B80; // type:function size:0x10 -fn_80056B90 = .text:0x80056B90; // type:function size:0x14C -fn_80056CE0 = .text:0x80056CE0; // type:function size:0xBC -fn_80056DA0 = .text:0x80056DA0; // type:function size:0x48 -fn_80056DF0 = .text:0x80056DF0; // type:function size:0x60 -fn_80056E50 = .text:0x80056E50; // type:function size:0x8 -fn_80056E60 = .text:0x80056E60; // type:function size:0x4C -fn_80056EB0 = .text:0x80056EB0; // type:function size:0x38 -fn_80056EF0 = .text:0x80056EF0; // type:function size:0xC -fn_80056F00 = .text:0x80056F00; // type:function size:0x24 -fn_80056F30 = .text:0x80056F30; // type:function size:0xC -fn_80056F40 = .text:0x80056F40; // type:function size:0xC8 -fn_80057010 = .text:0x80057010; // type:function size:0x10 -fn_80057020 = .text:0x80057020; // type:function size:0x80 -fn_800570A0 = .text:0x800570A0; // type:function size:0x10 -fn_800570B0 = .text:0x800570B0; // type:function size:0x4 -fn_800570C0 = .text:0x800570C0; // type:function size:0x40 -fn_80057100 = .text:0x80057100; // type:function size:0xA8 -fn_800571B0 = .text:0x800571B0; // type:function size:0xC -fn_800571C0 = .text:0x800571C0; // type:function size:0xD4 -fn_800572A0 = .text:0x800572A0; // type:function size:0xC8 -fn_80057370 = .text:0x80057370; // type:function size:0x30C -fn_80057680 = .text:0x80057680; // type:function size:0x4C -fn_800576D0 = .text:0x800576D0; // type:function size:0x210 -fn_800578E0 = .text:0x800578E0; // type:function size:0x1E0 -fn_80057AC0 = .text:0x80057AC0; // type:function size:0x440 -fn_80057F00 = .text:0x80057F00; // type:function size:0x24 -fn_80057F30 = .text:0x80057F30; // type:function size:0x24 -fn_80057F60 = .text:0x80057F60; // type:function size:0x24 -fn_80057F90 = .text:0x80057F90; // type:function size:0x12C -fn_800580C0 = .text:0x800580C0; // type:function size:0x12C -fn_800581F0 = .text:0x800581F0; // type:function size:0x12C -fn_80058320 = .text:0x80058320; // type:function size:0x12C -fn_80058450 = .text:0x80058450; // type:function size:0xEC -fn_80058540 = .text:0x80058540; // type:function size:0x450 -fn_80058990 = .text:0x80058990; // type:function size:0x60 -fn_800589F0 = .text:0x800589F0; // type:function size:0x8 -fn_80058A00 = .text:0x80058A00; // type:function size:0xD8 -fn_80058AE0 = .text:0x80058AE0; // type:function size:0x70 -fn_80058B50 = .text:0x80058B50; // type:function size:0x6C -fn_80058BC0 = .text:0x80058BC0; // type:function size:0x58 -fn_80058C20 = .text:0x80058C20; // type:function size:0x68 -fn_80058C90 = .text:0x80058C90; // type:function size:0x20 -isLowBattery2 = .text:0x80058CB0; // type:function size:0x2C -isLowBattery1 = .text:0x80058CE0; // type:function size:0x28 -fn_80058D10 = .text:0x80058D10; // type:function size:0x3C -fn_80058D50 = .text:0x80058D50; // type:function size:0x44 -fn_80058DA0 = .text:0x80058DA0; // type:function size:0x84 -fn_80058E30 = .text:0x80058E30; // type:function size:0x64 -getBatteryStatus = .text:0x80058EA0; // type:function size:0x8 -fn_80058EB0 = .text:0x80058EB0; // type:function size:0x30 -fn_80058EE0 = .text:0x80058EE0; // type:function size:0x68 -fn_80058F50 = .text:0x80058F50; // type:function size:0xC -fn_80058F60 = .text:0x80058F60; // type:function size:0x78 -fn_80058FE0 = .text:0x80058FE0; // type:function size:0x8 -fn_80058FF0 = .text:0x80058FF0; // type:function size:0xC -fn_80059000 = .text:0x80059000; // type:function size:0xC -fn_80059010 = .text:0x80059010; // type:function size:0x90 -fn_800590A0 = .text:0x800590A0; // type:function size:0x10 -fn_800590B0 = .text:0x800590B0; // type:function size:0x30 -fn_800590E0 = .text:0x800590E0; // type:function size:0xC -fn_800590F0 = .text:0x800590F0; // type:function size:0x10 -fn_80059100 = .text:0x80059100; // type:function size:0x8 -fn_80059110 = .text:0x80059110; // type:function size:0x100 -fn_80059210 = .text:0x80059210; // type:function size:0x10 -fn_80059220 = .text:0x80059220; // type:function size:0x10 -fn_80059230 = .text:0x80059230; // type:function size:0x10 -fn_80059240 = .text:0x80059240; // type:function size:0x10 -fn_80059250 = .text:0x80059250; // type:function size:0x1C -fn_80059270 = .text:0x80059270; // type:function size:0x1C -fn_80059290 = .text:0x80059290; // type:function size:0x1C -fn_800592B0 = .text:0x800592B0; // type:function size:0x1C -fn_800592D0 = .text:0x800592D0; // type:function size:0x28 -fn_80059300 = .text:0x80059300; // type:function size:0x2C -fn_80059330 = .text:0x80059330; // type:function size:0x18 -fn_80059350 = .text:0x80059350; // type:function size:0x18 -fn_80059370 = .text:0x80059370; // type:function size:0x18 -fn_80059390 = .text:0x80059390; // type:function size:0x18 -fn_800593B0 = .text:0x800593B0; // type:function size:0x14 -fn_800593D0 = .text:0x800593D0; // type:function size:0x6C -fn_80059440 = .text:0x80059440; // type:function size:0x8 -fn_80059450 = .text:0x80059450; // type:function size:0x2C -dPad__sinit = .text:0x80059480; // type:function size:0x58 -fn_800594E0 = .text:0x800594E0; // type:function size:0x118 -fn_80059600 = .text:0x80059600; // type:function size:0x1C -fn_80059620 = .text:0x80059620; // type:function size:0x4 -fn_80059630 = .text:0x80059630; // type:function size:0x4 -fn_80059640 = .text:0x80059640; // type:function size:0x4 -fn_80059650 = .text:0x80059650; // type:function size:0x4 -checkInputManagerPressedMask = .text:0x80059660; // type:function size:0x18 -checkButtonAPressed__4dPadFv = .text:0x80059680; // type:function size:0x18 -checkButtonBPressed__4dPadFv = .text:0x800596A0; // type:function size:0x18 -checkButtonCPressed__4dPadFv = .text:0x800596C0; // type:function size:0x18 -checkButtonZPressed__4dPadFv = .text:0x800596E0; // type:function size:0x18 -checkButtonDpadUpPressed__4dPadFv = .text:0x80059700; // type:function size:0x18 -checkButtonDpadDownPressed__4dPadFv = .text:0x80059720; // type:function size:0x18 -checkButtonDpadLeftPressed__4dPadFv = .text:0x80059740; // type:function size:0x18 -checkButtonDpadRightPressed__4dPadFv = .text:0x80059760; // type:function size:0x18 -checkButton1Pressed__4dPadFv = .text:0x80059780; // type:function size:0x18 -checkButton2Pressed__4dPadFv = .text:0x800597A0; // type:function size:0x18 -checkButtonMinusPressed__4dPadFv = .text:0x800597C0; // type:function size:0x18 -checkButtonPlusPressed__4dPadFv = .text:0x800597E0; // type:function size:0x18 -checkInputManagerHeldMask = .text:0x80059800; // type:function size:0x18 +control_mpls_callback__4dPadFll = .text:0x80055170; // type:function size:0x38 +isDeviceTypeMpls__4dPadFUl = .text:0x800551B0; // type:function size:0x24 +initMpls__4dPadFl = .text:0x800551E0; // type:function size:0x8C +create__4dPadFv = .text:0x80055270; // type:function size:0xBC +setMpls__4dPadFbl = .text:0x80055330; // type:function size:0x98 +convertDpdPosToScreenPos__4dPadFR7mVec2_cR7mVec2_c = .text:0x800553D0; // type:function size:0x50 +beginPad_BR__4dPadFv = .text:0x80055420; // type:function size:0x73C +getStateID__86sStateMgr_c<17dLytControlGame_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x80055B60; // type:function size:0x10 +errRangeOver__Q23EGG29TBufferCFv = .text:0x80055B70; // type:function size:0x4 +endPad_BR__4dPadFv = .text:0x80055B80; // type:function size:0x4 +connectCallback__4dPadFRCQ23EGG24CoreControllerConnectArg = .text:0x80055B90; // type:function size:0x94 +setConnectCallback__4dPadFv = .text:0x80055C30; // type:function size:0x10 +enableMplsDirRevise__4dPadFl = .text:0x80055C40; // type:function size:0x4 +disableMplsDirRevise__4dPadFl = .text:0x80055C50; // type:function size:0x4 +__ct__Q24dPad4ex_cFv = .text:0x80055C60; // type:function size:0x284 +fn_80055EF0__Q24dPad4ex_cFl = .text:0x80055EF0; // type:function size:0x3B4 +fn_800562B0__Q24dPad4ex_cFlR7mVec3_c = .text:0x800562B0; // type:function size:0x74 +fn_80056330__Q24dPad4ex_cFl = .text:0x80056330; // type:function size:0x24C +fn_80056580__Q24dPad4ex_cFlRC7mVec2_c = .text:0x80056580; // type:function size:0xEC +centerCursor__Q24dPad4ex_cFlb = .text:0x80056670; // type:function size:0x114 +fn_80056790__Q24dPad4ex_cFl = .text:0x80056790; // type:function size:0x334 +setField_0x70__Q24dPad4ex_cF4mAng = .text:0x80056AD0; // type:function size:0xC +setField_0x70__Q24dPad4ex_cFv = .text:0x80056AE0; // type:function size:0xC +fn_80056AF0__Q24dPad4ex_cFl = .text:0x80056AF0; // type:function size:0x90 +checkWPADProbeStable__Q24dPad4ex_cFv = .text:0x80056B80; // type:function size:0x10 +fn_80056B90__Q24dPad4ex_cFl = .text:0x80056B90; // type:function size:0x14C +fn_80056CE0__Q24dPad4ex_cFl = .text:0x80056CE0; // type:function size:0xBC +startMplsCalibration__Q24dPad4ex_cFl = .text:0x80056DA0; // type:function size:0x48 +workMplsCalibration__Q24dPad4ex_cFl = .text:0x80056DF0; // type:function size:0x60 +getCalibrationWork__Q24dPad4ex_cFv = .text:0x80056E50; // type:function size:0x8 +stopMplsCalibration__Q24dPad4ex_cFl = .text:0x80056E60; // type:function size:0x4C +centerCursor__Q24dPad4ex_cFl = .text:0x80056EB0; // type:function size:0x38 +gotoStateWaitForConnect__Q24dPad4ex_cFl = .text:0x80056EF0; // type:function size:0xC +executeStateWaitForConnect__Q24dPad4ex_cFl = .text:0x80056F00; // type:function size:0x24 +gotoStatePostConnect__Q24dPad4ex_cFl = .text:0x80056F30; // type:function size:0xC +executeStatePostConnect__Q24dPad4ex_cFl = .text:0x80056F40; // type:function size:0xC8 +gotoStateEnableMpls__Q24dPad4ex_cFl = .text:0x80057010; // type:function size:0x10 +executeStateEnableMpls__Q24dPad4ex_cFl = .text:0x80057020; // type:function size:0x80 +gotoStateDisconnectWpad__Q24dPad4ex_cFl = .text:0x800570A0; // type:function size:0x10 +executeStateDisconnectWpad__Q24dPad4ex_cFl = .text:0x800570B0; // type:function size:0x4 +gotoStateMplsConfigError__Q24dPad4ex_cFl = .text:0x800570C0; // type:function size:0x40 +executeStateMplsConfigError__Q24dPad4ex_cFl = .text:0x80057100; // type:function size:0xA8 +gotoStateMplsConfigured__Q24dPad4ex_cFl = .text:0x800571B0; // type:function size:0xC +executeStateMplsConfigured__Q24dPad4ex_cFl = .text:0x800571C0; // type:function size:0xD4 +fn_800572A0__Q24dPad4ex_cFl = .text:0x800572A0; // type:function size:0xC8 +init__Q34dPad4ex_c5acc_cFv = .text:0x80057370; // type:function size:0x30C +getMaxAccValue__Q34dPad4ex_c5acc_cFl = .text:0x80057680; // type:function size:0x4C +fn_800576D0__Q34dPad4ex_c5acc_cFl = .text:0x800576D0; // type:function size:0x210 +fn_800578E0__Q34dPad4ex_c5acc_cFl = .text:0x800578E0; // type:function size:0x1E0 +fn_80057AC0__Q34dPad4ex_c5acc_cFlb = .text:0x80057AC0; // type:function size:0x440 +fn_80057F00__Q34dPad4ex_c5acc_cFl = .text:0x80057F00; // type:function size:0x24 +fn_80057F30__Q34dPad4ex_c5acc_cFl = .text:0x80057F30; // type:function size:0x24 +fn_80057F60__Q34dPad4ex_c5acc_cFl = .text:0x80057F60; // type:function size:0x24 +fn_80057F90__Q34dPad4ex_c5acc_cFlb = .text:0x80057F90; // type:function size:0x12C +fn_800580C0__Q34dPad4ex_c5acc_cFlb = .text:0x800580C0; // type:function size:0x12C +fn_800581F0__Q34dPad4ex_c5acc_cFlb = .text:0x800581F0; // type:function size:0x12C +fn_80058320__Q34dPad4ex_c5acc_cFlb = .text:0x80058320; // type:function size:0x12C +fn_80058450__Q34dPad4ex_c5acc_cFlb = .text:0x80058450; // type:function size:0xEC +fn_80058540__Q34dPad4ex_c5acc_cFlb = .text:0x80058540; // type:function size:0x450 +fn_80058990__Q34dPad4ex_c5acc_cFUlb = .text:0x80058990; // type:function size:0x60 +fn_800589F0__Q34dPad4ex_c5acc_cFv = .text:0x800589F0; // type:function size:0x8 +fn_80058A00__Q34dPad4ex_c5acc_cFv = .text:0x80058A00; // type:function size:0xD8 +fn_80058AE0__Q34dPad4ex_c5acc_cFlb = .text:0x80058AE0; // type:function size:0x70 +getMtx__Q34dPad4ex_c6mpls_cCFv = .text:0x80058B50; // type:function size:0x6C +isMissingMpls__Q24dPad4ex_cFv = .text:0x80058BC0; // type:function size:0x58 +isMissingNunchuk__Q24dPad4ex_cFv = .text:0x80058C20; // type:function size:0x68 +fn_80058C90__Q24dPad4ex_cFl = .text:0x80058C90; // type:function size:0x20 +isLowBattery__Q24dPad4ex_cFv = .text:0x80058CB0; // type:function size:0x2C +isOutOfBattery__Q24dPad4ex_cFv = .text:0x80058CE0; // type:function size:0x28 +resetInfo__Q24dPad4ex_cFv = .text:0x80058D10; // type:function size:0x3C +clearInfo__Q24dPad4ex_cFl = .text:0x80058D50; // type:function size:0x44 +async_info_callback = .text:0x80058DA0; // type:function size:0x84 +getInfo__Q24dPad4ex_cFl = .text:0x80058E30; // type:function size:0x64 +getBatteryLevel__Q24dPad4ex_cFv = .text:0x80058EA0; // type:function size:0x8 +getBatteryLevel__Q24dPad4ex_cFl = .text:0x80058EB0; // type:function size:0x30 +setInfo__Q24dPad4ex_cFlPC8WPADInfo = .text:0x80058EE0; // type:function size:0x68 +fn_80058F50__Q24dPad4ex_cFv = .text:0x80058F50; // type:function size:0xC +fn_80058F60__Q24dPad4ex_cFv = .text:0x80058F60; // type:function size:0x78 +getCurrentCalibrationWork__Q24dPad4ex_cFv = .text:0x80058FE0; // type:function size:0x8 +fn_80058FF0__Q24dPad4ex_cFv = .text:0x80058FF0; // type:function size:0xC +fn_80059000__Q24dPad4ex_cFv = .text:0x80059000; // type:function size:0xC +needMplsCalibration__Q24dPad4ex_cFv = .text:0x80059010; // type:function size:0x90 +setCalibrateMpls__Q24dPad4ex_cFv = .text:0x800590A0; // type:function size:0x10 +fn_800590B0__Q24dPad4ex_cFv = .text:0x800590B0; // type:function size:0x30 +fn_800590E0__Q24dPad4ex_cFv = .text:0x800590E0; // type:function size:0xC +fn_800590F0__Q24dPad4ex_cFv = .text:0x800590F0; // type:function size:0x10 +fn_80059100__Q24dPad4ex_cFv = .text:0x80059100; // type:function size:0x8 +fn_80059110__Q24dPad4ex_cFl = .text:0x80059110; // type:function size:0x100 +fn_80059210__Q24dPad4ex_cFv = .text:0x80059210; // type:function size:0x10 +fn_80059220__Q24dPad4ex_cFv = .text:0x80059220; // type:function size:0x10 +fn_80059230__Q24dPad4ex_cFv = .text:0x80059230; // type:function size:0x10 +fn_80059240__Q24dPad4ex_cFv = .text:0x80059240; // type:function size:0x10 +on_0x54__Q24dPad4ex_cFl = .text:0x80059250; // type:function size:0x1C +on_0x55__Q24dPad4ex_cFl = .text:0x80059270; // type:function size:0x1C +on_0x56__Q24dPad4ex_cFl = .text:0x80059290; // type:function size:0x1C +on_0x57__Q24dPad4ex_cFl = .text:0x800592B0; // type:function size:0x1C +fn_800592D0__Q24dPad4ex_cFl = .text:0x800592D0; // type:function size:0x28 +fn_80059300__Q24dPad4ex_cFl = .text:0x80059300; // type:function size:0x2C +fn_80059330__Q24dPad4ex_cFl = .text:0x80059330; // type:function size:0x18 +fn_80059350__Q24dPad4ex_cFl = .text:0x80059350; // type:function size:0x18 +fn_80059370__Q24dPad4ex_cFl = .text:0x80059370; // type:function size:0x18 +fn_80059390__Q24dPad4ex_cFl = .text:0x80059390; // type:function size:0x18 +getUnifiedWpadStatus__Q24dPad4ex_cFl = .text:0x800593B0; // type:function size:0x14 +calcFSStickDirMask__Q24dPad4ex_cFv = .text:0x800593D0; // type:function size:0x6C +setNoSleep__Q24dPad4ex_cFv = .text:0x80059440; // type:function size:0x8 +setAutoSleepTime__Q24dPad4ex_cFv = .text:0x80059450; // type:function size:0x2C +__sinit_\d_pad_cpp = .text:0x80059480; // type:function size:0x58 scope:local +__dt__Q24dPad4ex_cFv = .text:0x800594E0; // type:function size:0x118 +__arraydtor$5368 = .text:0x80059600; // type:function size:0x1C +fn_80059620__4dPadFv = .text:0x80059620; // type:function size:0x4 +fn_80059630__4dPadFv = .text:0x80059630; // type:function size:0x4 +fn_80059640__4dPadFv = .text:0x80059640; // type:function size:0x4 +fn_80059650__4dPadFv = .text:0x80059650; // type:function size:0x4 +getDownTrig__4dPadFUl = .text:0x80059660; // type:function size:0x18 +getDownTrigA__4dPadFv = .text:0x80059680; // type:function size:0x18 +getDownTrigB__4dPadFv = .text:0x800596A0; // type:function size:0x18 +getDownTrigC__4dPadFv = .text:0x800596C0; // type:function size:0x18 +getDownTrigZ__4dPadFv = .text:0x800596E0; // type:function size:0x18 +getDownTrigUp__4dPadFv = .text:0x80059700; // type:function size:0x18 +getDownTrigDown__4dPadFv = .text:0x80059720; // type:function size:0x18 +getDownTrigLeft__4dPadFv = .text:0x80059740; // type:function size:0x18 +getDownTrigRight__4dPadFv = .text:0x80059760; // type:function size:0x18 +getDownTrig1__4dPadFv = .text:0x80059780; // type:function size:0x18 +getDownTrig2__4dPadFv = .text:0x800597A0; // type:function size:0x18 +getDownTrigMinus__4dPadFv = .text:0x800597C0; // type:function size:0x18 +getDownTrigPlus__4dPadFv = .text:0x800597E0; // type:function size:0x18 +getDown__4dPadFUl = .text:0x80059800; // type:function size:0x18 down__Q23EGG14CoreControllerCFUl = .text:0x80059820; // type:function size:0x18 downAll__Q23EGG14CoreControllerCFUl = .text:0x80059840; // type:function size:0x18 -checkButtonAHeld__4dPadFv = .text:0x80059860; // type:function size:0x18 -checkButtonBHeld = .text:0x80059880; // type:function size:0x18 -checkButtonCHeld = .text:0x800598A0; // type:function size:0x18 -checkButtonZHeld__4dPadFv = .text:0x800598C0; // type:function size:0x18 -checkButtonDpadUpHeld = .text:0x800598E0; // type:function size:0x18 -checkButtonDpadDownHeld = .text:0x80059900; // type:function size:0x18 -checkButtonDpadLeftHeld = .text:0x80059920; // type:function size:0x18 -checkButtonDpadRightHeld = .text:0x80059940; // type:function size:0x18 -checkButton1Held = .text:0x80059960; // type:function size:0x18 -checkButton2Held = .text:0x80059980; // type:function size:0x18 -checkButtonMinusHeld = .text:0x800599A0; // type:function size:0x18 -checkButtonPlusHeld = .text:0x800599C0; // type:function size:0x18 +getDownA__4dPadFv = .text:0x80059860; // type:function size:0x18 +getDownB__4dPadFv = .text:0x80059880; // type:function size:0x18 +getDownC__4dPadFv = .text:0x800598A0; // type:function size:0x18 +getDownZ__4dPadFv = .text:0x800598C0; // type:function size:0x18 +getDownUp__4dPadFv = .text:0x800598E0; // type:function size:0x18 +getDownDown__4dPadFv = .text:0x80059900; // type:function size:0x18 +getDownLeft__4dPadFv = .text:0x80059920; // type:function size:0x18 +getDownRight__4dPadFv = .text:0x80059940; // type:function size:0x18 +getDown1__4dPadFv = .text:0x80059960; // type:function size:0x18 +getDown2__4dPadFv = .text:0x80059980; // type:function size:0x18 +getDownMinus__4dPadFv = .text:0x800599A0; // type:function size:0x18 +getDownPlus__4dPadFv = .text:0x800599C0; // type:function size:0x18 upTrigger__Q23EGG14CoreControllerCFUl = .text:0x800599E0; // type:function size:0x18 -checkButtonAReleased = .text:0x80059A00; // type:function size:0x18 -buttonBReleased = .text:0x80059A20; // type:function size:0x18 -checkButtonZReleased = .text:0x80059A40; // type:function size:0x18 +getUpTrigA__4dPadFv = .text:0x80059A00; // type:function size:0x18 +getUpTrigB__4dPadFv = .text:0x80059A20; // type:function size:0x18 +getUpTrigZ__4dPadFv = .text:0x80059A40; // type:function size:0x18 up__Q23EGG14CoreControllerCFUl = .text:0x80059A60; // type:function size:0x1C upAll__Q23EGG14CoreControllerCFUl = .text:0x80059A80; // type:function size:0x14 -checkButtonAHeldReleased = .text:0x80059AA0; // type:function size:0x18 -fn_80059AC0 = .text:0x80059AC0; // type:function size:0x8 -fn_80059AD0 = .text:0x80059AD0; // type:function size:0xC -fn_80059AE0 = .text:0x80059AE0; // type:function size:0xC -fn_80059AF0 = .text:0x80059AF0; // type:function size:0xC -fn_80059B00 = .text:0x80059B00; // type:function size:0xC -fn_80059B10 = .text:0x80059B10; // type:function size:0xC -fn_80059B20 = .text:0x80059B20; // type:function size:0x10 -fn_80059B30 = .text:0x80059B30; // type:function size:0x20 -fn_80059B50 = .text:0x80059B50; // type:function size:0x10 -fn_80059B60 = .text:0x80059B60; // type:function size:0x10 -fn_80059B70 = .text:0x80059B70; // type:function size:0x10 -fn_80059B80 = .text:0x80059B80; // type:function size:0x10 -fn_80059B90 = .text:0x80059B90; // type:function size:0x10 -fn_80059BA0 = .text:0x80059BA0; // type:function size:0x120 -fn_80059CC0 = .text:0x80059CC0; // type:function size:0x10 -fn_80059CD0 = .text:0x80059CD0; // type:function size:0x10 +getUpA__4dPadFv = .text:0x80059AA0; // type:function size:0x18 +getDpdPos__4dPadFv = .text:0x80059AC0; // type:function size:0x8 +getDpdPosScreen__4dPadFv = .text:0x80059AD0; // type:function size:0xC +getFSStick__4dPadFv = .text:0x80059AE0; // type:function size:0xC +getFSStickX__4dPadFv = .text:0x80059AF0; // type:function size:0xC +getFSStickY__4dPadFv = .text:0x80059B00; // type:function size:0xC +getFSStickDistance__4dPadFv = .text:0x80059B10; // type:function size:0xC +getFSStickAngle__4dPadFv = .text:0x80059B20; // type:function size:0x10 +getAcc__4dPadFv = .text:0x80059B30; // type:function size:0x20 +fn_80059B750__4dPadFv = .text:0x80059B50; // type:function size:0x10 +fn_80059B760__4dPadFv = .text:0x80059B60; // type:function size:0x10 +fn_80059B70__4dPadFv = .text:0x80059B70; // type:function size:0x10 +fn_80059B80__4dPadFv = .text:0x80059B80; // type:function size:0x10 +fn_80059B90__4dPadFv = .text:0x80059B90; // type:function size:0x10 +getFSAcc__4dPadFv = .text:0x80059BA0; // type:function size:0x120 +fn_80059CC0__4dPadFv = .text:0x80059CC0; // type:function size:0x10 +fn_80059CD0__4dPadFv = .text:0x80059CD0; // type:function size:0x10 fn_80059CE0 = .text:0x80059CE0; // type:function size:0x2C fn_80059D10 = .text:0x80059D10; // type:function size:0x44 fn_80059D60 = .text:0x80059D60; // type:function size:0x40 @@ -2926,62 +2926,62 @@ fn_800679B0 = .text:0x800679B0; // type:function size:0xB0 fn_80067A60 = .text:0x80067A60; // type:function size:0x34 fn_80067AA0 = .text:0x80067AA0; // type:function size:0x3C fn_80067AE0 = .text:0x80067AE0; // type:function size:0x34 -fn_80067B20 = .text:0x80067B20; // type:function size:0x4C -GetInstance__16ReloadColorFaderFv = .text:0x80067B70; // type:function size:0x8 -fn_80067B80 = .text:0x80067B80; // type:function size:0x84 -fn_80067C10 = .text:0x80067C10; // type:function size:0xA8 -fn_80067CC0 = .text:0x80067CC0; // type:function size:0x7C -fn_80067D40 = .text:0x80067D40; // type:function size:0x70 -fn_80067DB0 = .text:0x80067DB0; // type:function size:0x14 -fn_80067DD0__16ReloadColorFaderFb = .text:0x80067DD0; // type:function size:0x8 -fn_80067DE0 = .text:0x80067DE0; // type:function size:0xD4 +CreateInstance__Q26dReset8Manage_cFPQ23EGG4Heap = .text:0x80067B20; // type:function size:0x4C +GetInstance__Q26dReset8Manage_cFv = .text:0x80067B70; // type:function size:0x8 +__ct__Q26dReset8Manage_cFPQ23EGG4Heap = .text:0x80067B80; // type:function size:0x84 +Configure__Q26dReset8Manage_cFv = .text:0x80067C10; // type:function size:0xA8 +Reset__Q26dReset8Manage_cFv = .text:0x80067CC0; // type:function size:0x7C +Calculate__Q26dReset8Manage_cFv = .text:0x80067D40; // type:function size:0x70 +Draw__Q26dReset8Manage_cFv = .text:0x80067DB0; // type:function size:0x14 +BootComplete__Q26dReset8Manage_cFb = .text:0x80067DD0; // type:function size:0x8 +CanExecSoftReset__Q26dReset8Manage_cCFv = .text:0x80067DE0; // type:function size:0xD4 getStatus__Q23EGG10ColorFaderCFv = .text:0x80067EC0; // type:function size:0x8 -fn_80067ED0__16ReloadColorFaderFv = .text:0x80067ED0; // type:function size:0x24 -fn_80067F00__16ReloadColorFaderFv = .text:0x80067F00; // type:function size:0x50 -fn_80067F50__16ReloadColorFaderFv = .text:0x80067F50; // type:function size:0x4 -fn_80067F60__16ReloadColorFaderFv = .text:0x80067F60; // type:function size:0x38 -fn_80067FA0 = .text:0x80067FA0; // type:function size:0xC -fn_80067FB0 = .text:0x80067FB0; // type:function size:0xC -fn_80067FC0 = .text:0x80067FC0; // type:function size:0xC -fn_80067FD0 = .text:0x80067FD0; // type:function size:0xC -fn_80067FE0__16ReloadColorFaderFv = .text:0x80067FE0; // type:function size:0xC -fn_80067FF0 = .text:0x80067FF0; // type:function size:0x3C -fn_80068030 = .text:0x80068030; // type:function size:0x34 -fn_80068070 = .text:0x80068070; // type:function size:0x4 -fn_80068080 = .text:0x80068080; // type:function size:0x48 -fn_800680D0 = .text:0x800680D0; // type:function size:0xC8 -fn_800681A0 = .text:0x800681A0; // type:function size:0x4 -fn_800681B0 = .text:0x800681B0; // type:function size:0x114 -fn_800682D0 = .text:0x800682D0; // type:function size:0x40 -fn_80068310 = .text:0x80068310; // type:function size:0x48 -doSoftResetMaybe = .text:0x80068360; // type:function size:0x40 -fn_800683A0 = .text:0x800683A0; // type:function size:0x38 -fn_800683E0 = .text:0x800683E0; // type:function size:0x40 -fn_80068420 = .text:0x80068420; // type:function size:0x100 -fn_80068520 = .text:0x80068520; // type:function size:0x22C -fn_80068750 = .text:0x80068750; // type:function size:0x8 -calledWhileHomeMenuIsVisible = .text:0x80068760; // type:function size:0x198 -fn_80068900 = .text:0x80068900; // type:function size:0x9C -fn_800689A0 = .text:0x800689A0; // type:function size:0x134 -fn_80068AE0 = .text:0x80068AE0; // type:function size:0xC -fn_80068AF0 = .text:0x80068AF0; // type:function size:0x4 -fn_80068B00 = .text:0x80068B00; // type:function size:0x60 -fn_80068B60 = .text:0x80068B60; // type:function size:0xE8 -fn_80068C50 = .text:0x80068C50; // type:function size:0xC -fn_80068C60 = .text:0x80068C60; // type:function size:0xC -fn_80068C70 = .text:0x80068C70; // type:function size:0x18 -fn_80068C90 = .text:0x80068C90; // type:function size:0x48 -fn_80068CE0 = .text:0x80068CE0; // type:function size:0x30 -fn_80068D10 = .text:0x80068D10; // type:function size:0x30 -fn_80068D40 = .text:0x80068D40; // type:function size:0x88 -LCDisableThunk = .text:0x80068DD0; // type:function size:0x4 -fn_80068DE0 = .text:0x80068DE0; // type:function size:0x64 -fn_80068E50 = .text:0x80068E50; // type:function size:0x4 -fn_80068E60 = .text:0x80068E60; // type:function size:0x8 -fn_80068E70 = .text:0x80068E70; // type:function size:0xC -fn_80068E80__16ReloadColorFaderFv = .text:0x80068E80; // type:function size:0x6C -fn_80067EF0__16ReloadColorFaderFl = .text:0x80068EF0; // type:function size:0xC0 -fn_80068FB0 = .text:0x80068FB0; // type:function size:0x20 +SetSoftResetFinish__Q26dReset8Manage_cFv = .text:0x80067ED0; // type:function size:0x24 +SetSoftResetScene__Q26dReset8Manage_cFv = .text:0x80067F00; // type:function size:0x50 +PostDeleteScene__Q26dReset8Manage_cFv = .text:0x80067F50; // type:function size:0x4 +IsFaderBlank__Q26dReset8Manage_cCFv = .text:0x80067F60; // type:function size:0x38 +SetHbmReturnMenu__Q26dReset8Manage_cFv = .text:0x80067FA0; // type:function size:0xC +SetHbmReset__Q26dReset8Manage_cFv = .text:0x80067FB0; // type:function size:0xC +SetDelayReset__Q26dReset8Manage_cFv = .text:0x80067FC0; // type:function size:0xC +SetDelayPowerOff__Q26dReset8Manage_cFv = .text:0x80067FD0; // type:function size:0xC +SetInteriorReturnDataManager__Q26dReset8Manage_cFv = .text:0x80067FE0; // type:function size:0xC +fn_80067FF0__Q26dReset8Manage_cFv = .text:0x80067FF0; // type:function size:0x3C +ExecProcPre__Q26dReset8Manage_cFv = .text:0x80068030; // type:function size:0x34 +fn_80068070__Q26dReset8Manage_cFv = .text:0x80068070; // type:function size:0x4 +ExecProcMain__Q26dReset8Manage_cFv = .text:0x80068080; // type:function size:0x48 +DiskCheckModeRequest__Q26dReset8Manage_cFb = .text:0x800680D0; // type:function size:0xC8 +DebugPrintMode__Q26dReset8Manage_cFPCc = .text:0x800681A0; // type:function size:0x4 +ModeProc__Q26dReset8Manage_cFv = .text:0x800681B0; // type:function size:0x114 +ModeRequest__Q26dReset8Manage_cFQ36dReset8Manage_c6Mode_e = .text:0x800682D0; // type:function size:0x40 +ModeRequestSafetyWait__Q26dReset8Manage_cFQ36dReset8Manage_c6Exec_e = .text:0x80068310; // type:function size:0x48 +ModeRequestSoftReset__Q26dReset8Manage_cFv = .text:0x80068360; // type:function size:0x40 +ModeInit_Normal__Q26dReset8Manage_cFv = .text:0x800683A0; // type:function size:0x38 +ModeProc_Normal__Q26dReset8Manage_cFv = .text:0x800683E0; // type:function size:0x40 +ModeInit_SoftReset__Q26dReset8Manage_cFv = .text:0x80068420; // type:function size:0x100 +ModeProc_SoftReset__Q26dReset8Manage_cFv = .text:0x80068520; // type:function size:0x22C +ModeInit_HbmWait__Q26dReset8Manage_cFv = .text:0x80068750; // type:function size:0x8 +ModeProc_HbmWait__Q26dReset8Manage_cFv = .text:0x80068760; // type:function size:0x198 +ModeInit_DiskWait__Q26dReset8Manage_cFv = .text:0x80068900; // type:function size:0x9C +ModeProc_DiskWait__Q26dReset8Manage_cFv = .text:0x800689A0; // type:function size:0x134 +ModeInit_FatalError__Q26dReset8Manage_cFv = .text:0x80068AE0; // type:function size:0xC +ModeProc_FatalError__Q26dReset8Manage_cFv = .text:0x80068AF0; // type:function size:0x4 +ModeInit_SafetyWait__Q26dReset8Manage_cFv = .text:0x80068B00; // type:function size:0x60 +ModeProc_SafetyWait__Q26dReset8Manage_cFv = .text:0x80068B60; // type:function size:0xE8 +SetResetCallback__Q26dReset8Manage_cFv = .text:0x80068C50; // type:function size:0xC +SetPowerCallback__Q26dReset8Manage_cFv = .text:0x80068C60; // type:function size:0xC +SetDiskCheckCallback__Q26dReset8Manage_cFv = .text:0x80068C70; // type:function size:0x18 +DiskCheckCallback__Q26dReset8Manage_cFlP11DVDFileInfo = .text:0x80068C90; // type:function size:0x48 +ResetCallback__Q26dReset8Manage_cFv = .text:0x80068CE0; // type:function size:0x30 +PowerCallback__Q26dReset8Manage_cFv = .text:0x80068D10; // type:function size:0x30 +CleanUpGX__Q26dReset8Manage_cFv = .text:0x80068D40; // type:function size:0x88 +CleanUpLC__Q26dReset8Manage_cFv = .text:0x80068DD0; // type:function size:0x4 +MotorCancelOn__Q26dReset8Manage_cFv = .text:0x80068DE0; // type:function size:0x64 +MotorCancelOff__Q26dReset8Manage_cFv = .text:0x80068E50; // type:function size:0x4 +IsFatalError__Q26dReset8Manage_cFv = .text:0x80068E60; // type:function size:0x8 +IsDiskError__Q26dReset8Manage_cFv = .text:0x80068E70; // type:function size:0xC +FadeOutCalc__Q26dReset8Manage_cFv = .text:0x80068E80; // type:function size:0x6C +FadeOutRequest__Q26dReset8Manage_cFb = .text:0x80068EF0; // type:function size:0xC0 +__sinit_\d_reset_cpp = .text:0x80068FB0; // type:function size:0x20 scope:local __ct__22CurrentStageArcManagerFv = .text:0x80068FD0; // type:function size:0x54 __dt__22CurrentStageArcManagerFv = .text:0x80069030; // type:function size:0x64 init__22CurrentStageArcManagerFPQ23EGG4Heap = .text:0x800690A0; // type:function size:0x14 @@ -7834,7 +7834,7 @@ fn_80139060 = .text:0x80139060; // type:function size:0x28 isOpenMaybe__13dLytMapMain_cCFv = .text:0x80139090; // type:function size:0x478 fn_80139510 = .text:0x80139510; // type:function size:0xA8 fn_801395C0 = .text:0x801395C0; // type:function size:0x64 -fn_80139630 = .text:0x80139630; // type:function size:0x4C +isNotInvisible__13dLytMapMain_cCFv = .text:0x80139630; // type:function size:0x4C lightPillarRelated__13dLytMapMain_cFlll = .text:0x80139680; // type:function size:0x14 fn_801396A0 = .text:0x801396A0; // type:function size:0xA4 fn_80139750 = .text:0x80139750; // type:function size:0x5E8 @@ -8513,13 +8513,13 @@ create__18dLytSystemWindow_cFv = .text:0x80152DE0; // type:function size:0x3C fn_80152E20 = .text:0x80152E20; // type:function size:0xC8 fn_80152EF0 = .text:0x80152EF0; // type:function size:0x8 fn_80152F00 = .text:0x80152F00; // type:function size:0x8 -fn_80152F10 = .text:0x80152F10; // type:function size:0x10 +fn_80152F10__18dLytSystemWindow_cFv = .text:0x80152F10; // type:function size:0x10 fn_80152F20 = .text:0x80152F20; // type:function size:0x18 setProperties__18dLytSystemWindow_cFPCcbPCw = .text:0x80152F40; // type:function size:0x8 fn_80152F50__18dLytSystemWindow_cCFv = .text:0x80152F50; // type:function size:0x8 fn_80152F60__18dLytSystemWindow_cCFv = .text:0x80152F60; // type:function size:0x8 fn_80152F70__18dLytSystemWindow_cCFv = .text:0x80152F70; // type:function size:0x8 -fn_80152F80 = .text:0x80152F80; // type:function size:0x8 +fn_80152F80__18dLytSystemWindow_cCFv = .text:0x80152F80; // type:function size:0x8 getField_0xDE0__18dLytSystemWindow_cCFv = .text:0x80152F90; // type:function size:0x8 showMaybe__18dLytSystemWindow_cFl = .text:0x80152FA0; // type:function size:0x8 showMaybe__18dLytSystemWindow_cFv = .text:0x80152FB0; // type:function size:0x8 @@ -10488,33 +10488,33 @@ TgInsectCaptureMinigame__addToCollectedBugs = .text:0x801964E0; // type:function TgInsectCaptureMinigame__getBugIndex = .text:0x80196550; // type:function size:0x44 TgStream__initList = .text:0x801965A0; // type:function size:0x50 TgStream__dtorList = .text:0x801965F0; // type:function size:0x58 -fn_80196650 = .text:0x80196650; // type:function size:0x4C -GetInstance__6dHbm_cFv = .text:0x801966A0; // type:function size:0x8 -fn_801966B0 = .text:0x801966B0; // type:function size:0x120 -fn_801967D0__6dHbm_cFv = .text:0x801967D0; // type:function size:0x1D4 -fn_801969B0 = .text:0x801969B0; // type:function size:0xB4 -fn_80196A70 = .text:0x80196A70; // type:function size:0x60 -fn_80196AD0 = .text:0x80196AD0; // type:function size:0x64 -fn_80196B40 = .text:0x80196B40; // type:function size:0x164 -fn_80196CB0 = .text:0x80196CB0; // type:function size:0xE8 -fn_80196DA0 = .text:0x80196DA0; // type:function size:0x10 -fn_80196DB0 = .text:0x80196DB0; // type:function size:0x78 -fn_80196E30 = .text:0x80196E30; // type:function size:0x10 -fn_80196E40 = .text:0x80196E40; // type:function size:0x10 -fn_80196E50 = .text:0x80196E50; // type:function size:0x10 -fn_80196E60 = .text:0x80196E60; // type:function size:0x10 -fn_80196E70 = .text:0x80196E70; // type:function size:0x10 -fn_80196E80 = .text:0x80196E80; // type:function size:0xE8 -fn_80196F70 = .text:0x80196F70; // type:function size:0x80 -fn_80196FF0 = .text:0x80196FF0; // type:function size:0x94 -fn_80197090 = .text:0x80197090; // type:function size:0x110 -fn_801971A0 = .text:0x801971A0; // type:function size:0x44 -fn_801971F0 = .text:0x801971F0; // type:function size:0x148 -fn_80197340 = .text:0x80197340; // type:function size:0x14 -fn_80197360 = .text:0x80197360; // type:function size:0x5C -fn_801973C0 = .text:0x801973C0; // type:function size:0x58 -fn_80197420 = .text:0x80197420; // type:function size:0x140 -fn_80197560__6dHbm_cFl = .text:0x80197560; // type:function size:0x28 +CreateInstance__Q24dHbm8Manage_cFPQ23EGG4Heap = .text:0x80196650; // type:function size:0x4C +GetInstance__Q24dHbm8Manage_cFv = .text:0x801966A0; // type:function size:0x8 +__ct__Q24dHbm8Manage_cFPQ23EGG4Heap = .text:0x801966B0; // type:function size:0x120 +Load__Q24dHbm8Manage_cFv = .text:0x801967D0; // type:function size:0x1D4 +Calculate__Q24dHbm8Manage_cFv = .text:0x801969B0; // type:function size:0xB4 +DrawMenu__Q24dHbm8Manage_cFl = .text:0x80196A70; // type:function size:0x60 +DrawMenuSetting__Q24dHbm8Manage_cFv = .text:0x80196AD0; // type:function size:0x64 +DrawIcon__Q24dHbm8Manage_cFv = .text:0x80196B40; // type:function size:0x164 +InitDataInfo__Q24dHbm8Manage_cFv = .text:0x80196CB0; // type:function size:0xE8 +InitControllerData__Q24dHbm8Manage_cFv = .text:0x80196DA0; // type:function size:0x10 +SetRegionLayoutName__Q24dHbm8Manage_cFv = .text:0x80196DB0; // type:function size:0x78 +SetSpkNameName__Q24dHbm8Manage_cFv = .text:0x80196E30; // type:function size:0x10 +SetMsgName__Q24dHbm8Manage_cFv = .text:0x80196E40; // type:function size:0x10 +SetConfigName__Q24dHbm8Manage_cFv = .text:0x80196E50; // type:function size:0x10 +SetIconName__Q24dHbm8Manage_cFv = .text:0x80196E60; // type:function size:0x10 +SetSoundName__Q24dHbm8Manage_cFv = .text:0x80196E70; // type:function size:0x10 +SetContData__Q24dHbm8Manage_cFv = .text:0x80196E80; // type:function size:0xE8 +CheckBegin__Q24dHbm8Manage_cCFv = .text:0x80196F70; // type:function size:0x80 +MenuInit__Q24dHbm8Manage_cFv = .text:0x80196FF0; // type:function size:0x94 +MenuCalc__Q24dHbm8Manage_cFv = .text:0x80197090; // type:function size:0x110 +IconInit__Q24dHbm8Manage_cFv = .text:0x801971A0; // type:function size:0x44 +IconCalc__Q24dHbm8Manage_cFv = .text:0x801971F0; // type:function size:0x148 +IconClear__Q24dHbm8Manage_cFv = .text:0x80197340; // type:function size:0x14 +StopMotor__Q24dHbm8Manage_cFv = .text:0x80197360; // type:function size:0x5C +fn_801973C0__Q24dHbm8Manage_cFl = .text:0x801973C0; // type:function size:0x58 +ForbidCalc__Q24dHbm8Manage_cFv = .text:0x80197420; // type:function size:0x140 +fn_80197560__Q24dHbm8Manage_cFl = .text:0x80197560; // type:function size:0x28 fn_80197590 = .text:0x80197590; // type:function size:0x28 dStageMgr_c_classInit__Fv = .text:0x801975C0; // type:function size:0x34 fn_80197600 = .text:0x80197600; // type:function size:0xA0 @@ -11209,7 +11209,7 @@ fn_801BBC40 = .text:0x801BBC40; // type:function size:0xE4 fn_801BBD30 = .text:0x801BBD30; // type:function size:0x14 fn_801BBD50 = .text:0x801BBD50; // type:function size:0x15C fn_801BBEB0 = .text:0x801BBEB0; // type:function size:0x8 -fn_801BBEC0 = .text:0x801BBEC0; // type:function size:0x18 +fn_801BBEC0__21ScGameScreenTargetingCFv = .text:0x801BBEC0; // type:function size:0x18 getStateID__77sStateMgr_c<9dScGame_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x801BBEE0; // type:function size:0x10 build__24sFStateFct_c<9dScGame_c>FRC12sStateIDIf_c = .text:0x801BBEF0; // type:function size:0x60 dispose__24sFStateFct_c<9dScGame_c>FRP10sStateIf_c = .text:0x801BBF50; // type:function size:0xC @@ -11308,7 +11308,7 @@ doDelete__9dCsGame_cFv = .text:0x801BF210; // type:function size:0x84 CsGame__baseUpdate = .text:0x801BF2A0; // type:function size:0x25C fn_801BF500 = .text:0x801BF500; // type:function size:0x14 CsGame__draw = .text:0x801BF520; // type:function size:0xBC -fn_801BF5E0 = .text:0x801BF5E0; // type:function size:0x44 +fn_801BF5E0__9dCsGame_cCFv = .text:0x801BF5E0; // type:function size:0x44 fn_801BF630 = .text:0x801BF630; // type:function size:0x288 setNextCursorType__9dCsGame_cFQ39dCsGame_c15lytItemCursor_c12CursorType_e = .text:0x801BF8C0; // type:function size:0x10 fn_801BF8D0 = .text:0x801BF8D0; // type:function size:0x8 @@ -11885,7 +11885,7 @@ ActorLink__lookTowardsItem = .text:0x801D73A0; // type:function size:0x230 fn_801D75D0 = .text:0x801D75D0; // type:function size:0x8 fn_801D75E0 = .text:0x801D75E0; // type:function size:0xB8 fn_801D76A0 = .text:0x801D76A0; // type:function size:0x7F8 -fn_801D7EA0 = .text:0x801D7EA0; // type:function size:0x10 +getStateID__83sStateMgr_c<14dAcBoomerang_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x801D7EA0; // type:function size:0x10 fn_801D7EB0 = .text:0x801D7EB0; // type:function size:0x3E0 fn_801D8290 = .text:0x801D8290; // type:function size:0x46C fn_801D8700 = .text:0x801D8700; // type:function size:0x134 @@ -12739,46 +12739,46 @@ ActorLink__equipBeetle = .text:0x8021AA70; // type:function size:0x270 fn_8021ACE0 = .text:0x8021ACE0; // type:function size:0x2D8 ActorLink__equipSpawnBeetle = .text:0x8021AFC0; // type:function size:0x80 fn_8021B040 = .text:0x8021B040; // type:function size:0x20 -fn_8021B060 = .text:0x8021B060; // type:function size:0x1C -fn_8021B080 = .text:0x8021B080; // type:function size:0x8 +getBeetleHeldActor = .text:0x8021B060; // type:function size:0x1C +getBeetleActor = .text:0x8021B080; // type:function size:0x8 getBeetleFlightTime = .text:0x8021B090; // type:function size:0x50 -fn_8021B0E0 = .text:0x8021B0E0; // type:function size:0x28 -fn_8021B110 = .text:0x8021B110; // type:function size:0x28 -fn_8021B140 = .text:0x8021B140; // type:function size:0x8 -fn_8021B150 = .text:0x8021B150; // type:function size:0x8 -getNormalBeetleSpeed = .text:0x8021B160; // type:function size:0x8 -getSpeedBeetleSpeed = .text:0x8021B170; // type:function size:0x8 -fn_8021B180 = .text:0x8021B180; // type:function size:0x8 -fn_8021B190 = .text:0x8021B190; // type:function size:0x8 -getVal35.0 = .text:0x8021B1A0; // type:function size:0x8 -fn_8021B1B0 = .text:0x8021B1B0; // type:function size:0x8 -fn_8021B1C0 = .text:0x8021B1C0; // type:function size:0x28 -fn_8021B1F0 = .text:0x8021B1F0; // type:function size:0x28 -fn_8021B220 = .text:0x8021B220; // type:function size:0x28 -fn_8021B250 = .text:0x8021B250; // type:function size:0x28 +getBettleAngle0 = .text:0x8021B0E0; // type:function size:0x28 +getBettleAngle1 = .text:0x8021B110; // type:function size:0x28 +getBeetleWingAngleActive = .text:0x8021B140; // type:function size:0x8 +getBeetleWingAngleInactive = .text:0x8021B150; // type:function size:0x8 +getBeetleNormalSpeed = .text:0x8021B160; // type:function size:0x8 +getBeetleQuickSpeed = .text:0x8021B170; // type:function size:0x8 +getBeetleMaxRange = .text:0x8021B180; // type:function size:0x8 +getBeetleLargeRadius = .text:0x8021B190; // type:function size:0x8 +getBeetleSmallRadius = .text:0x8021B1A0; // type:function size:0x8 +getBeetleMaxHeightOffset = .text:0x8021B1B0; // type:function size:0x8 +getBeetleSmallAngle0 = .text:0x8021B1C0; // type:function size:0x28 +getBeetleSmallAngle1 = .text:0x8021B1F0; // type:function size:0x28 +getBeetleBonkRecoilAngle = .text:0x8021B220; // type:function size:0x28 +getBeetleSmallAngle2 = .text:0x8021B250; // type:function size:0x28 fn_8021B280 = .text:0x8021B280; // type:function size:0x8 fn_8021B290 = .text:0x8021B290; // type:function size:0x8 fn_8021B2A0 = .text:0x8021B2A0; // type:function size:0x8 -fn_8021B2B0 = .text:0x8021B2B0; // type:function size:0x8 +getBeetleWarningTimeLeft__7dAcPy_cFv = .text:0x8021B2B0; // type:function size:0x8 fn_8021B2C0 = .text:0x8021B2C0; // type:function size:0x8 -fn_8021B2D0 = .text:0x8021B2D0; // type:function size:0xAC -fn_8021B380 = .text:0x8021B380; // type:function size:0x48 -fn_8021B3D0 = .text:0x8021B3D0; // type:function size:0x48 -fn_8021B420 = .text:0x8021B420; // type:function size:0x38 -fn_8021B460 = .text:0x8021B460; // type:function size:0x7C -fn_8021B4E0 = .text:0x8021B4E0; // type:function size:0x4 -ActorLink__isUsingBeetle = .text:0x8021B4F0; // type:function size:0x50 -fn_8021B540 = .text:0x8021B540; // type:function size:0x10 -fn_8021B550 = .text:0x8021B550; // type:function size:0xA0 -fn_8021B5F0 = .text:0x8021B5F0; // type:function size:0x90 -ActorLink__shootBeetleMaybe = .text:0x8021B680; // type:function size:0x2B8 -ActorLink__useBeetleMaybe = .text:0x8021B940; // type:function size:0x44 -ActorLink__usingRocketBeetleRelated = .text:0x8021B990; // type:function size:0x114 -fn_8021BAB0 = .text:0x8021BAB0; // type:function size:0x68 +checkBeetleItemRetrieve = .text:0x8021B2D0; // type:function size:0xAC +setBeetleFlashClr__7dAcPy_cFRC6mColor = .text:0x8021B380; // type:function size:0x48 +setBeetleBackAnim__7dAcPy_cFv = .text:0x8021B3D0; // type:function size:0x48 +setBeetleReleasedObject = .text:0x8021B420; // type:function size:0x38 +getBeetleActorPtr = .text:0x8021B460; // type:function size:0x7C +strippedBeetleFunction = .text:0x8021B4E0; // type:function size:0x4 +checkUsingBeetleAnim = .text:0x8021B4F0; // type:function size:0x50 +startUseBeetle = .text:0x8021B540; // type:function size:0x10 +setBeetleMove = .text:0x8021B550; // type:function size:0xA0 +retrieveBeetle = .text:0x8021B5F0; // type:function size:0x90 +shootBeetle = .text:0x8021B680; // type:function size:0x2B8 +useBeetle = .text:0x8021B940; // type:function size:0x44 +updateBeetle = .text:0x8021B990; // type:function size:0x114 +lookAtBeetle = .text:0x8021BAB0; // type:function size:0x68 fn_8021BB20 = .text:0x8021BB20; // type:function size:0x80 fn_8021BBA0 = .text:0x8021BBA0; // type:function size:0x38 -ActorLink__doUseBeetle = .text:0x8021BBE0; // type:function size:0x74 -ActorLink__HoldBeetle = .text:0x8021BC60; // type:function size:0x1C0 +setUseBeetleAction = .text:0x8021BBE0; // type:function size:0x74 +performBeeltleAction = .text:0x8021BC60; // type:function size:0x1C0 fn_8021BE20 = .text:0x8021BE20; // type:function size:0x100 fn_8021BF20 = .text:0x8021BF20; // type:function size:0x9C fn_8021BFC0 = .text:0x8021BFC0; // type:function size:0x8 @@ -14105,19 +14105,20 @@ __dt__27sFState_c<14dAcBoomerang_c>Fv = .text:0x80260F70; // type:function size: __dt__30sFStateFct_c<14dAcBoomerang_c>Fv = .text:0x80260FD0; // type:function size:0x6C __dt__83sStateMgr_c<14dAcBoomerang_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x80261040; // type:function size:0xA0 __dt__53sFStateMgr_c<14dAcBoomerang_c,20sStateMethodUsr_FI_c>Fv = .text:0x802610E0; // type:function size:0xA4 -areaCallback__FP12dAcObjBase_cP7mVec3_cUl = .text:0x80261190; // type:function size:0x18 +dAcBoomerang_areaCallback__FP12dAcObjBase_cP7mVec3_cUl = .text:0x80261190; // type:function size:0x10 +areaCallback__14dAcBoomerang_cFP7mVec3_cUl = .text:0x802611A0; // type:function size:0x8 atHitCallback__14dAcBoomerang_cFP8cCcD_ObjP12dAcObjBase_cP8cCcD_Obj = .text:0x802611B0; // type:function size:0x290 -fn_80261440 = .text:0x80261440; // type:function size:0x10 +changeState__83sStateMgr_c<14dAcBoomerang_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x80261440; // type:function size:0x10 dAcBoomerang_atHitCallback__FP12dAcObjBase_cP8cCcD_ObjP12dAcObjBase_cP8cCcD_Obj = .text:0x80261450; // type:function size:0x24 -AcBoomerang__assignBeetleModel = .text:0x80261480; // type:function size:0x5C -AcBoomerang__initModels = .text:0x802614E0; // type:function size:0x310 -AcBoomerang__init = .text:0x802617F0; // type:function size:0x208 -AcBoomerang__dtor = .text:0x80261A00; // type:function size:0x1AC -fn_80261BB0 = .text:0x80261BB0; // type:function size:0x70 -fn_80261C20 = .text:0x80261C20; // type:function size:0x88 -fn_80261CB0 = .text:0x80261CB0; // type:function size:0x8 -fn_80261CC0 = .text:0x80261CC0; // type:function size:0x68 -fn_80261D30 = .text:0x80261D30; // type:function size:0xDC +hideModel__14dAcBoomerang_cFQ214dAcBoomerang_c11ModelType_e = .text:0x80261480; // type:function size:0x5C +createHeap__14dAcBoomerang_cFv = .text:0x802614E0; // type:function size:0x310 +create__14dAcBoomerang_cFv = .text:0x802617F0; // type:function size:0x208 +__dt__14dAcBoomerang_cFv = .text:0x80261A00; // type:function size:0x1AC +deleteReady__14dAcBoomerang_cFv = .text:0x80261BB0; // type:function size:0x70 +retrieve__14dAcBoomerang_cFv = .text:0x80261C20; // type:function size:0x88 +doDelete__14dAcBoomerang_cFv = .text:0x80261CB0; // type:function size:0x8 +setRoomId__14dAcBoomerang_cFv = .text:0x80261CC0; // type:function size:0x68 +placeOnArm__14dAcBoomerang_cFv = .text:0x80261D30; // type:function size:0xDC fn_80261E10 = .text:0x80261E10; // type:function size:0x338 fn_80262150 = .text:0x80262150; // type:function size:0x54 calcBeetleVelocity_y = .text:0x802621B0; // type:function size:0x12C @@ -14128,49 +14129,49 @@ fn_80262890 = .text:0x80262890; // type:function size:0x22C fn_80262AC0 = .text:0x80262AC0; // type:function size:0x120 fn_80262BE0 = .text:0x80262BE0; // type:function size:0x1E0 fn_80262DC0 = .text:0x80262DC0; // type:function size:0x13C -fn_80262F00 = .text:0x80262F00; // type:function size:0x2C +bonk__14dAcBoomerang_cFv = .text:0x80262F00; // type:function size:0x2C setChrAnimation__14dAcBoomerang_cFQ214dAcBoomerang_c14ChrAnimation_e = .text:0x80262F30; // type:function size:0x154 -fn_80263090 = .text:0x80263090; // type:function size:0xE4 -fn_80263180 = .text:0x80263180; // type:function size:0x50 -fn_802631D0 = .text:0x802631D0; // type:function size:0x8C -fn_80263260 = .text:0x80263260; // type:function size:0x5C -fn_802632C0 = .text:0x802632C0; // type:function size:0x4 -fn_802632D0 = .text:0x802632D0; // type:function size:0x70 -fn_80263340 = .text:0x80263340; // type:function size:0x7C -fn_802633C0 = .text:0x802633C0; // type:function size:0x18 -fn_802633E0 = .text:0x802633E0; // type:function size:0x210 -AcBoomerang__stateWaitUpdate = .text:0x802635F0; // type:function size:0xA84 -fn_80264080 = .text:0x80264080; // type:function size:0x4 -fn_80264090 = .text:0x80264090; // type:function size:0x198 -fn_80264230 = .text:0x80264230; // type:function size:0x3E4 -fn_80264620 = .text:0x80264620; // type:function size:0x4 -fn_80264630 = .text:0x80264630; // type:function size:0x5C -fn_80264690 = .text:0x80264690; // type:function size:0x30 -fn_802646C0 = .text:0x802646C0; // type:function size:0x4 -fn_802646D0 = .text:0x802646D0; // type:function size:0x188 -fn_80264860 = .text:0x80264860; // type:function size:0x4 -AcBoomerang__update = .text:0x80264870; // type:function size:0x45C -fn_80264CD0 = .text:0x80264CD0; // type:function size:0x10 -AcBoomerang__draw = .text:0x80264CE0; // type:function size:0x160 -fn_80264E40 = .text:0x80264E40; // type:function size:0x88 +setFlyChrAnimation__14dAcBoomerang_cFQ214dAcBoomerang_c14FlyAnimation_e = .text:0x80263090; // type:function size:0xE4 +setRemainingFlightTime__14dAcBoomerang_cFs = .text:0x80263180; // type:function size:0x50 +initializeState_Wait__14dAcBoomerang_cFv = .text:0x802631D0; // type:function size:0x8C +executeState_Wait__14dAcBoomerang_cFv = .text:0x80263260; // type:function size:0x5C +finalizeState_Wait__14dAcBoomerang_cFv = .text:0x802632C0; // type:function size:0x4 +initializeState_ReturnWait__14dAcBoomerang_cFv = .text:0x802632D0; // type:function size:0x70 +executeState_ReturnWait__14dAcBoomerang_cFv = .text:0x80263340; // type:function size:0x7C +finalizeState_ReturnWait__14dAcBoomerang_cFv = .text:0x802633C0; // type:function size:0x18 +initializeState_Move__14dAcBoomerang_cFv = .text:0x802633E0; // type:function size:0x210 +executeState_Move__14dAcBoomerang_cFv = .text:0x802635F0; // type:function size:0xA84 +finalizeState_Move__14dAcBoomerang_cFv = .text:0x80264080; // type:function size:0x4 +initializeState_MoveCancelWait__14dAcBoomerang_cFv = .text:0x80264090; // type:function size:0x198 +executeState_MoveCancelWait__14dAcBoomerang_cFv = .text:0x80264230; // type:function size:0x3E4 +finalizeState_MoveCancelWait__14dAcBoomerang_cFv = .text:0x80264620; // type:function size:0x4 +initializeState_EventReturnWait__14dAcBoomerang_cFv = .text:0x80264630; // type:function size:0x5C +executeState_EventReturnWait__14dAcBoomerang_cFv = .text:0x80264690; // type:function size:0x30 +finalizeState_EventReturnWait__14dAcBoomerang_cFv = .text:0x802646C0; // type:function size:0x4 +executeTimeWarning__14dAcBoomerang_cFv = .text:0x802646D0; // type:function size:0x188 +registerInEvent__14dAcBoomerang_cFv = .text:0x80264860; // type:function size:0x4 +actorExecute__14dAcBoomerang_cFv = .text:0x80264870; // type:function size:0x45C +executeState__83sStateMgr_c<14dAcBoomerang_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x80264CD0; // type:function size:0x10 +draw__14dAcBoomerang_cFv = .text:0x80264CE0; // type:function size:0x160 +create__18dAcBoomerangProc_cFPQ23m3d5mdl_c6mColoriP12mAllocator_c = .text:0x80264E40; // type:function size:0x88 fn_80264ED0 = .text:0x80264ED0; // type:function size:0x80 -fn_80264F50 = .text:0x80264F50; // type:function size:0x60 -fn_80264FB0 = .text:0x80264FB0; // type:function size:0xC -fn_80264FC0 = .text:0x80264FC0; // type:function size:0x1C -fn_80264FE0 = .text:0x80264FE0; // type:function size:0x1C -fn_80265000 = .text:0x80265000; // type:function size:0x1C -fn_80265020 = .text:0x80265020; // type:function size:0x10 -fn_80265030 = .text:0x80265030; // type:function size:0x10 -fn_80265040 = .text:0x80265040; // type:function size:0x10 -fn_80265050 = .text:0x80265050; // type:function size:0x10 -fn_80265060 = .text:0x80265060; // type:function size:0x10 -fn_80265070 = .text:0x80265070; // type:function size:0x10 -fn_80265080 = .text:0x80265080; // type:function size:0x30 -fn_802650B0 = .text:0x802650B0; // type:function size:0x30 -fn_802650E0 = .text:0x802650E0; // type:function size:0x30 +build__30sFStateFct_c<14dAcBoomerang_c>FRC12sStateIDIf_c = .text:0x80264F50; // type:function size:0x60 +dispose__30sFStateFct_c<14dAcBoomerang_c>FRP10sStateIf_c = .text:0x80264FB0; // type:function size:0xC +initialize__27sFState_c<14dAcBoomerang_c>Fv = .text:0x80264FC0; // type:function size:0x1C +execute__27sFState_c<14dAcBoomerang_c>Fv = .text:0x80264FE0; // type:function size:0x1C +finalize__27sFState_c<14dAcBoomerang_c>Fv = .text:0x80265000; // type:function size:0x1C +initializeState__83sStateMgr_c<14dAcBoomerang_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x80265020; // type:function size:0x10 +finalizeState__83sStateMgr_c<14dAcBoomerang_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x80265030; // type:function size:0x10 +refreshState__83sStateMgr_c<14dAcBoomerang_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x80265040; // type:function size:0x10 +getState__83sStateMgr_c<14dAcBoomerang_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x80265050; // type:function size:0x10 +getNewStateID__83sStateMgr_c<14dAcBoomerang_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x80265060; // type:function size:0x10 +getOldStateID__83sStateMgr_c<14dAcBoomerang_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x80265070; // type:function size:0x10 +finalizeState__29sFStateID_c<14dAcBoomerang_c>CFR14dAcBoomerang_c = .text:0x80265080; // type:function size:0x30 +executeState__29sFStateID_c<14dAcBoomerang_c>CFR14dAcBoomerang_c = .text:0x802650B0; // type:function size:0x30 +initializeState__29sFStateID_c<14dAcBoomerang_c>CFR14dAcBoomerang_c = .text:0x802650E0; // type:function size:0x30 __sinit_\d_a_obj_boomerang_cpp = .text:0x80265110; // type:function size:0x41C -AcBoomerang__dtor2 = .text:0x80265530; // type:function size:0x58 -fn_80265590 = .text:0x80265590; // type:function size:0x88 +__dt__29sFStateID_c<14dAcBoomerang_c>Fv = .text:0x80265530; // type:function size:0x58 +isSameName__29sFStateID_c<14dAcBoomerang_c>CFPCc = .text:0x80265590; // type:function size:0x88 dAcObjFairy_c_classInit__Fv = .text:0x80265620; // type:function size:0x144 __dt__26sFState_c<13dAcObjFairy_c>Fv = .text:0x80265770; // type:function size:0x58 __dt__29sFStateFct_c<13dAcObjFairy_c>Fv = .text:0x802657D0; // type:function size:0x6C @@ -18941,7 +18942,7 @@ AdjustHitPos__10cCcD_ObjTgFff = .text:0x8032BB00; // type:function size:0x34 __ct__10cCcD_ObjCoFv = .text:0x8032BB40; // type:function size:0x48 __dt__10cCcD_ObjCoFv = .text:0x8032BB90; // type:function size:0x58 Set__10cCcD_ObjCoFRC14cCcD_SrcGObjCo = .text:0x8032BBF0; // type:function size:0x18 -SetCoFlag__10cCcD_ObjCoFUl = .text:0x8032BC10; // type:function size:0x1C +SetGrp__10cCcD_ObjCoFUl = .text:0x8032BC10; // type:function size:0x1C AdjustHitPos__10cCcD_ObjCoFff = .text:0x8032BC30; // type:function size:0x4 __sinit_\c_cc_d_cpp = .text:0x8032BC40; // type:function size:0x2C scope:local @44@__dt__12cCcD_UnkAttrFv = .text:0x8032BC70; // type:function size:0x8 @@ -19937,11 +19938,11 @@ getFreeSize__15dSndPlayerMgr_cFv = .text:0x8035DF60; // type:function size:0x54 fn_8035DFC0 = .text:0x8035DFC0; // type:function size:0x3C fn_8035E000 = .text:0x8035E000; // type:function size:0xD4 fn_8035E0E0 = .text:0x8035E0E0; // type:function size:0xCC -fn_8035E1B0 = .text:0x8035E1B0; // type:function size:0x68 -fn_8035E220 = .text:0x8035E220; // type:function size:0x2C -fn_8035E250 = .text:0x8035E250; // type:function size:0x8C -fn_8035E2E0 = .text:0x8035E2E0; // type:function size:0x2C -fn_8035E310 = .text:0x8035E310; // type:function size:0x50 +fn_8035E1B0__15dSndPlayerMgr_cFUs = .text:0x8035E1B0; // type:function size:0x68 +fn_8035E220__15dSndPlayerMgr_cFv = .text:0x8035E220; // type:function size:0x2C +fn_8035E250__15dSndPlayerMgr_cFUs = .text:0x8035E250; // type:function size:0x8C +fn_8035E2E0__15dSndPlayerMgr_cFv = .text:0x8035E2E0; // type:function size:0x2C +fn_8035E310__15dSndPlayerMgr_cFv = .text:0x8035E310; // type:function size:0x50 enterPauseState__15dSndPlayerMgr_cFv = .text:0x8035E360; // type:function size:0x70 leavePauseState__15dSndPlayerMgr_cFv = .text:0x8035E3D0; // type:function size:0x70 enterMenu__15dSndPlayerMgr_cFv = .text:0x8035E440; // type:function size:0x2C @@ -19953,13 +19954,13 @@ fn_8035E560 = .text:0x8035E560; // type:function size:0x18 fn_8035E580 = .text:0x8035E580; // type:function size:0x50 fn_8035E5D0 = .text:0x8035E5D0; // type:function size:0x44 fn_8035E620 = .text:0x8035E620; // type:function size:0xB4 -fn_8035E6E0 = .text:0x8035E6E0; // type:function size:0xA4 +fn_8035E6E0__15dSndPlayerMgr_cFv = .text:0x8035E6E0; // type:function size:0xA4 fn_8035E790 = .text:0x8035E790; // type:function size:0x84 fn_8035E820 = .text:0x8035E820; // type:function size:0x38 fn_8035E860 = .text:0x8035E860; // type:function size:0x14 fn_8035E880 = .text:0x8035E880; // type:function size:0x14 -fn_8035E8A0 = .text:0x8035E8A0; // type:function size:0xC -fn_8035E8B0 = .text:0x8035E8B0; // type:function size:0xC +setup__15dSndPlayerMgr_cFl = .text:0x8035E8A0; // type:function size:0xC +shutdown__15dSndPlayerMgr_cFl = .text:0x8035E8B0; // type:function size:0xC startSound__15dSndPlayerMgr_cFPQ34nw4r3snd11SoundHandleUlPCQ44nw4r3snd14SoundStartable9StartInfo = .text:0x8035E8C0; // type:function size:0x90 startSound__15dSndPlayerMgr_cFPQ34nw4r3snd11SoundHandlePCcPCQ44nw4r3snd14SoundStartable9StartInfo = .text:0x8035E950; // type:function size:0x6C fn_8035E9C0 = .text:0x8035E9C0; // type:function size:0x80 @@ -26310,7 +26311,7 @@ create__Q23EGG12GraphicsFifoFUlPQ23EGG4Heap = .text:0x80498E20; // type:function __dt__Q23EGG12GraphicsFifoFv = .text:0x80498E90; // type:function size:0x98 __ct__Q23EGG12GraphicsFifoFUlPQ23EGG4Heap = .text:0x80498F30; // type:function size:0x60 init__Q23EGG10CoreStatusFv = .text:0x80498F90; // type:function size:0xC -getFSStickButton__Q23EGG10CoreStatusCFv = .text:0x80498FA0; // type:function size:0xAC +getFSStickButton__Q23EGG10CoreStatusFv = .text:0x80498FA0; // type:function size:0xAC __ct__Q23EGG14CoreControllerFv = .text:0x80499050; // type:function size:0x60 sceneReset__Q23EGG14CoreControllerFv = .text:0x804990B0; // type:function size:0xB4 getDpdRawPos__Q23EGG14CoreControllerFv = .text:0x80499170; // type:function size:0x14 @@ -26330,7 +26331,7 @@ __dt__Q33EGG17CoreControllerMgr11T__DisposerFv = .text:0x80499B00; // type:funct createInstance__Q23EGG17CoreControllerMgrFv = .text:0x80499B80; // type:function size:0x48 deleteInstance__Q23EGG17CoreControllerMgrFv = .text:0x80499BD0; // type:function size:0x10 getNthController__Q23EGG17CoreControllerMgrFi = .text:0x80499BE0; // type:function size:0x74 -errRangeOver__Q23EGG32TBufferFv = .text:0x80499C60; // type:function size:0x4 scope:weak +errRangeOver__Q23EGG32TBufferCFv = .text:0x80499C60; // type:function size:0x4 scope:weak alloc__Q23EGG27@unnamed@eggController_cpp@FUl = .text:0x80499C70; // type:function size:0x18 scope:local free__Q23EGG27@unnamed@eggController_cpp@FPv = .text:0x80499C90; // type:function size:0x38 scope:local connectCallback__Q23EGG17CoreControllerMgrFll = .text:0x80499CD0; // type:function size:0x3C @@ -26843,8 +26844,8 @@ doShutdown__Q23EGG18AudioRmtSpeakerMgrFlPFll_v = .text:0x804B6C00; // type:funct calc__Q23EGG18AudioRmtSpeakerMgrFv = .text:0x804B6C50; // type:function size:0xC4 setupCallbackDirect__Q23EGG18AudioRmtSpeakerMgrFll = .text:0x804B6D20; // type:function size:0x3C shutdownCallbackDirect__Q23EGG18AudioRmtSpeakerMgrFll = .text:0x804B6D60; // type:function size:0x20 -fn_804B6D80__Q23EGG18AudioRmtSpeakerMgrFlPFll_v = .text:0x804B6D80; // type:function size:0x60 -fn_804B6DE0__Q23EGG18AudioRmtSpeakerMgrFlPFll_v = .text:0x804B6DE0; // type:function size:0x78 +setup__Q23EGG18AudioRmtSpeakerMgrFlPFll_v = .text:0x804B6D80; // type:function size:0x60 +shutdown__Q23EGG18AudioRmtSpeakerMgrFlPFll_v = .text:0x804B6DE0; // type:function size:0x78 connectAllByForce__Q23EGG18AudioRmtSpeakerMgrFv = .text:0x804B6E60; // type:function size:0x68 disconnectAllByForce__Q23EGG18AudioRmtSpeakerMgrFv = .text:0x804B6ED0; // type:function size:0x78 getWpadVolume__Q23EGG18AudioRmtSpeakerMgrFv = .text:0x804B6F50; // type:function size:0x8 @@ -28213,8 +28214,8 @@ lbl_804E0E3C = .rodata:0x804E0E3C; // type:object size:0x3C lbl_804E0E78 = .rodata:0x804E0E78; // type:object size:0x3C lbl_804E0EB4 = .rodata:0x804E0EB4; // type:object size:0x3C lbl_804E0EF0 = .rodata:0x804E0EF0; // type:object size:0x28 -lbl_804E0F18 = .rodata:0x804E0F18; // type:object size:0x48 -lbl_804E0F60 = .rodata:0x804E0F60; // type:object size:0x48 +@LOCAL@ModeProc__Q26dReset8Manage_cFv@procs = .rodata:0x804E0F18; // type:object size:0x48 +@LOCAL@ModeRequest__Q26dReset8Manage_cFQ36dReset8Manage_c6Mode_e@procs = .rodata:0x804E0F60; // type:object size:0x48 sInfos = .rodata:0x804E0FA8; // type:object size:0x246C scope:local data:4byte lbl_804E3418 = .rodata:0x804E3418; // type:object size:0x40 data:4byte lbl_804E3458 = .rodata:0x804E3458; // type:object size:0x38 data:4byte @@ -39222,7 +39223,7 @@ status_2__4dDyl = .sdata:0x80571C44; // type:object size:0x4 data:4byte lbl_80571C48 = .sdata:0x80571C48; // type:object size:0x8 lbl_80571C50 = .sdata:0x80571C50; // type:object size:0x4 align:4 data:float lbl_80571C58 = .sdata:0x80571C58; // type:object size:0x8 data:byte -lbl_80571C60 = .sdata:0x80571C60; // type:object size:0x8 data:4byte +m_current_ex__Q24dPad4ex_c = .sdata:0x80571C60; // type:object size:0x4 data:4byte lbl_80571C68 = .sdata:0x80571C68; // type:object size:0x8 OBTAINED_ITEM_ID = .sdata:0x80571C70; // type:object size:0x4 data:4byte sCurrentSword__17daPlayerActBase_c = .sdata:0x80571C74; // type:object size:0x1 data:byte @@ -41341,42 +41342,42 @@ DVD__4dDyl = .sbss:0x805750F8; // type:object size:0x4 data:4byte mFaderColor = .sbss:0x80575100; // type:object size:0x4 scope:local data:byte @GUARD@getFontPath__10dFontMng_cFUc@TEMP_FONT_NAME = .sbss:0x80575108; // type:object size:0x1 scope:local data:byte sInstance__6dGfx_c = .sbss:0x80575110; // type:object size:0x8 data:4byte -lbl_80575118 = .sbss:0x80575118; // type:object size:0x4 data:4byte -lbl_8057511C = .sbss:0x8057511C; // type:object size:0x4 data:4byte -lbl_80575120 = .sbss:0x80575120; // type:object size:0x4 data:4byte -lbl_80575124 = .sbss:0x80575124; // type:object size:0x4 data:4byte -lbl_80575128 = .sbss:0x80575128; // type:object size:0x4 data:4byte -lbl_8057512C = .sbss:0x8057512C; // type:object size:0x4 data:4byte -lbl_80575130 = .sbss:0x80575130; // type:object size:0x4 data:4byte -lbl_80575134 = .sbss:0x80575134; // type:object size:0x4 data:4byte -lbl_80575138 = .sbss:0x80575138; // type:object size:0x4 data:4byte -lbl_8057513C = .sbss:0x8057513C; // type:object size:0x4 data:4byte -lbl_80575140 = .sbss:0x80575140; // type:object size:0x4 data:4byte -lbl_80575144 = .sbss:0x80575144; // type:object size:0x4 align:4 data:float -lbl_80575148 = .sbss:0x80575148; // type:object size:0x4 align:4 data:float -lbl_8057514C = .sbss:0x8057514C; // type:object size:0x4 align:4 data:float -lbl_80575150 = .sbss:0x80575150; // type:object size:0x4 align:4 data:float -lbl_80575154 = .sbss:0x80575154; // type:object size:0x4 align:4 data:float -lbl_80575158 = .sbss:0x80575158; // type:object size:0x4 align:4 data:float -lbl_8057515C = .sbss:0x8057515C; // type:object size:0x4 align:4 data:float -lbl_80575160 = .sbss:0x80575160; // type:object size:0x4 align:4 data:float -lbl_80575164 = .sbss:0x80575164; // type:object size:0x4 align:4 data:float -lbl_80575168 = .sbss:0x80575168; // type:object size:0x4 align:4 data:float -lbl_8057516C = .sbss:0x8057516C; // type:object size:0x4 align:4 data:float -lbl_80575170 = .sbss:0x80575170; // type:object size:0x4 align:4 data:float -lbl_80575174 = .sbss:0x80575174; // type:object size:0x4 align:4 data:float -lbl_80575178 = .sbss:0x80575178; // type:object size:0x4 align:4 data:float -lbl_8057517C = .sbss:0x8057517C; // type:object size:0x4 data:4byte -lbl_80575180 = .sbss:0x80575180; // type:object size:0x4 data:4byte -lbl_80575184 = .sbss:0x80575184; // type:object size:0x4 data:4byte -lbl_80575188 = .sbss:0x80575188; // type:object size:0x4 data:4byte -lbl_8057518C = .sbss:0x8057518C; // type:object size:0x4 data:4byte -lbl_80575190 = .sbss:0x80575190; // type:object size:0x4 align:4 data:float -lbl_80575194 = .sbss:0x80575194; // type:object size:0x4 align:4 data:float -lbl_80575198 = .sbss:0x80575198; // type:object size:0x4 align:4 data:float -lbl_8057519C = .sbss:0x8057519C; // type:object size:0x4 align:4 data:float -lbl_805751A0 = .sbss:0x805751A0; // type:object size:0x4 align:4 data:float -lbl_805751A4 = .sbss:0x805751A4; // type:object size:0x4 align:4 data:float +g_CurrentScreenWidth_s32__6dGfx_c = .sbss:0x80575118; // type:object size:0x4 data:4byte +g_CurrentScreenHeight_s32__6dGfx_c = .sbss:0x8057511C; // type:object size:0x4 data:4byte +g_CurrentScreenWidthLimit_s32__6dGfx_c = .sbss:0x80575120; // type:object size:0x4 data:4byte +g_CurrentScreenHeightLimit_s32__6dGfx_c = .sbss:0x80575124; // type:object size:0x4 data:4byte +g_CurrentScreenLeft_s32__6dGfx_c = .sbss:0x80575128; // type:object size:0x4 data:4byte +g_CurrentScreenRight_s32__6dGfx_c = .sbss:0x8057512C; // type:object size:0x4 data:4byte +g_CurrentScreenTop_s32__6dGfx_c = .sbss:0x80575130; // type:object size:0x4 data:4byte +g_CurrentScreenBottom_s32__6dGfx_c = .sbss:0x80575134; // type:object size:0x4 data:4byte +g_CurrentEFBHeight_s32__6dGfx_c = .sbss:0x80575138; // type:object size:0x4 data:4byte +g_CurrentEFBHeightLimit_s32__6dGfx_c = .sbss:0x8057513C; // type:object size:0x4 data:4byte +g_CurrentLetterBoxAmount_s32__6dGfx_c = .sbss:0x80575140; // type:object size:0x4 data:4byte +g_CurrentScreenWidth_f32__6dGfx_c = .sbss:0x80575144; // type:object size:0x4 align:4 data:float +g_CurrentScreenHeight_f32__6dGfx_c = .sbss:0x80575148; // type:object size:0x4 align:4 data:float +g_CurrentScreenWidthLimit_f32__6dGfx_c = .sbss:0x8057514C; // type:object size:0x4 align:4 data:float +g_CurrentScreenHeightLimit_f32__6dGfx_c = .sbss:0x80575150; // type:object size:0x4 align:4 data:float +g_CurrentScreenLeft_f32__6dGfx_c = .sbss:0x80575154; // type:object size:0x4 align:4 data:float +g_CurrentScreenRight_f32__6dGfx_c = .sbss:0x80575158; // type:object size:0x4 align:4 data:float +g_CurrentScreenTop_f32__6dGfx_c = .sbss:0x8057515C; // type:object size:0x4 align:4 data:float +g_CurrentScreenBottom_f32__6dGfx_c = .sbss:0x80575160; // type:object size:0x4 align:4 data:float +g_CurrentScreenAspect__6dGfx_c = .sbss:0x80575164; // type:object size:0x4 align:4 data:float +g_CurrentEFBHeight_f32__6dGfx_c = .sbss:0x80575168; // type:object size:0x4 align:4 data:float +g_CurrentEFBHeightLimit_f32__6dGfx_c = .sbss:0x8057516C; // type:object size:0x4 align:4 data:float +g_CurrentEFBHeightDifference_f32__6dGfx_c = .sbss:0x80575170; // type:object size:0x4 align:4 data:float +g_CurrentHeightScaled_f32__6dGfx_c = .sbss:0x80575174; // type:object size:0x4 align:4 data:float +g_CurrentEFBHeightDifference2_f32__6dGfx_c = .sbss:0x80575178; // type:object size:0x4 align:4 data:float +g_Width4x3_s32__6dGfx_c = .sbss:0x8057517C; // type:object size:0x4 data:4byte +g_Width4x3Limit_s32__6dGfx_c = .sbss:0x80575180; // type:object size:0x4 data:4byte +g_Width16x9_s32__6dGfx_c = .sbss:0x80575184; // type:object size:0x4 data:4byte +g_Width4x3Left_s32__6dGfx_c = .sbss:0x80575188; // type:object size:0x4 data:4byte +g_Width4x3Right_s32__6dGfx_c = .sbss:0x8057518C; // type:object size:0x4 data:4byte +g_Width4x3_f32__6dGfx_c = .sbss:0x80575190; // type:object size:0x4 align:4 data:float +g_Width4x3Limit_f32__6dGfx_c = .sbss:0x80575194; // type:object size:0x4 align:4 data:float +g_Width16x9_f32__6dGfx_c = .sbss:0x80575198; // type:object size:0x4 align:4 data:float +g_Width4x3Left_f32__6dGfx_c = .sbss:0x8057519C; // type:object size:0x4 align:4 data:float +g_Width4x3Right_f32__6dGfx_c = .sbss:0x805751A0; // type:object size:0x4 align:4 data:float +g_16x9to4x3WidthScale__6dGfx_c = .sbss:0x805751A4; // type:object size:0x4 align:4 data:float work1Heap__5dHeap = .sbss:0x805751A8; // type:object size:0x4 data:4byte work2Heap__5dHeap = .sbss:0x805751AC; // type:object size:0x4 data:4byte workExHeap__5dHeap = .sbss:0x805751B0; // type:object size:0x4 data:4byte @@ -41387,10 +41388,9 @@ layoutResHeap__5dHeap = .sbss:0x805751C0; // type:object size:0x4 data:4byte fontHeap__5dHeap = .sbss:0x805751C4; // type:object size:0x4 data:4byte HBMHeap__5dHeap = .sbss:0x805751C8; // type:object size:0x4 data:4byte lbl_805751D0 = .sbss:0x805751D0; // type:object size:0x8 data:4byte -dMain__g_InitialTime = .sbss:0x805751D8; // type:object size:0x4 data:4byte -g_InitialTime+4 = .sbss:0x805751DC; // type:object size:0x4 data:4byte -dPad__connectedStatus = .sbss:0x805751E0; // type:object size:0x8 -lbl_805751E8 = .sbss:0x805751E8; // type:object size:0x8 data:4byte +dMain__g_InitialTime = .sbss:0x805751D8; // type:object size:0x8 data:4byte +m_connected__Q24dPad4ex_c = .sbss:0x805751E0; // type:object size:0x4 +sInstance__15dPauseManager_c = .sbss:0x805751E8; // type:object size:0x8 data:4byte LINK_ROT = .sbss:0x805751F0; // type:object size:0x2 data:2byte LINK_ROT_2 = .sbss:0x805751F4; // type:object size:0x2 data:2byte lbl_805751F6 = .sbss:0x805751F6; // type:object size:0x1 data:byte @@ -41416,8 +41416,8 @@ sInstance__18ArcCallbackHandler = .sbss:0x80575250; // type:object size:0x8 data aspectRatio = .sbss:0x80575258; // type:object size:0x4 align:4 data:float sInstance__8dCsMgr_c = .sbss:0x80575260; // type:object size:0x4 data:4byte spInstance__9dRumble_c = .sbss:0x80575268; // type:object size:0x4 data:4byte -someColor = .sbss:0x80575270; // type:object size:0x1 data:byte -reloadColorFaderPtr = .sbss:0x80575274; // type:object size:0x4 data:4byte +c_faderColor__Q26dReset8Manage_c = .sbss:0x80575270; // type:object size:0x4 data:byte +s_pInstance__Q26dReset8Manage_c = .sbss:0x80575274; // type:object size:0x4 data:4byte sInstance__22CurrentStageArcManager = .sbss:0x80575278; // type:object size:0x4 data:4byte @GUARD@getCurrentStageDirectory__22CurrentStageArcManagerFv@sStageDirTmp = .sbss:0x8057527C; // type:object size:0x1 scope:local data:byte sInstance__11OarcManager = .sbss:0x80575280; // type:object size:0x4 data:4byte @@ -41602,7 +41602,7 @@ lbl_805756A0 = .sbss:0x805756A0; // type:object size:0x4 data:4byte lbl_805756A4 = .sbss:0x805756A4; // type:object size:0x4 data:4byte sInstance__19GoddessChestCounter = .sbss:0x805756A8; // type:object size:0x8 data:4byte sInstance__9dScBoot_c = .sbss:0x805756B0; // type:object size:0x4 data:4byte -lbl_805756B4 = .sbss:0x805756B4; // type:object size:0x4 data:4byte +sInstance__11dTitleMgr_c = .sbss:0x805756B4; // type:object size:0x4 data:4byte TITLE_SCREEN_CHANGE = .sbss:0x805756B8; // type:object size:0x4 data:4byte sInstance__10dTgSiren_c = .sbss:0x805756BC; // type:object size:0x4 data:4byte WEATHER_TAG = .sbss:0x805756C0; // type:object size:0x8 data:4byte @@ -41614,7 +41614,7 @@ TADTONE_GAME = .sbss:0x805756E4; // type:object size:0x4 data:4byte IS_IN_SKYKEEP_PUZZLE = .sbss:0x805756E8; // type:object size:0x1 data:byte lbl_805756E9 = .sbss:0x805756E9; // type:object size:0x1 data:byte sInstance__10dTgSndMg_c = .sbss:0x805756EC; // type:object size:0x4 data:4byte -HBM_stuff = .sbss:0x805756F0; // type:object size:0x8 data:4byte +s_pInstance__Q24dHbm8Manage_c = .sbss:0x805756F0; // type:object size:0x8 data:4byte sInstance__11dStageMgr_c = .sbss:0x805756F8; // type:object size:0x4 data:4byte lbl_805756FC = .sbss:0x805756FC; // type:object size:0x1 data:byte lbl_805756FD = .sbss:0x805756FD; // type:object size:0x1 data:byte @@ -41676,7 +41676,7 @@ sCopyFileBToCurrentAfterRespawn__9dScGame_c = .sbss:0x8057579E; // type:object s sDoSomethingWithFileAOnTransition__9dScGame_c = .sbss:0x8057579F; // type:object size:0x1 data:byte sPreventClearingSomeFlag__9dScGame_c = .sbss:0x805757A0; // type:object size:0x1 data:byte sInstance__9dCsBase_c = .sbss:0x805757A8; // type:object size:0x8 data:4byte -C_GAME = .sbss:0x805757B0; // type:object size:0x8 data:4byte +sInstance__9dCsGame_c = .sbss:0x805757B0; // type:object size:0x8 data:4byte LINK2__7dAcPy_c = .sbss:0x805757B8; // type:object size:0x4 data:4byte lbl_805757BC = .sbss:0x805757BC; // type:object size:0x1 data:byte lbl_805757C0 = .sbss:0x805757C0; // type:object size:0x4 align:4 data:float @@ -50439,9 +50439,8 @@ l_dFontMng_obj = .bss:0x80597618; // type:object size:0xA8 scope:local sAllocator__14dHeapAllocator = .bss:0x80597740; // type:object size:0x18 data:4byte MAIN_THREAD = .bss:0x80597758; // type:object size:0x318 lbl_80597A70 = .bss:0x80597A70; // type:object size:0x10 -sControllers = .bss:0x80597A80; // type:object size:0x8B70 align:4 data:float -lbl_805A05F0 = .bss:0x805A05F0; // type:object size:0x60 -PadExtendedStuff_ARRAY_805a0604_3_.field4_0x4 = .bss:0x805A0650; // type:object size:0x60 +m_ex__Q24dPad4ex_c = .bss:0x80597A80; // type:object size:0x8B70 align:4 data:float +m_info__Q24dPad4ex_c = .bss:0x805A05F0; // type:object size:0xC0 LINK_POS = .bss:0x805A06B0; // type:object size:0xC align:4 data:float LINK_POS_2 = .bss:0x805A06BC; // type:object size:0xC align:4 data:float sHandMats = .bss:0x805A06C8; // type:object size:0xE scope:local data:byte @@ -50451,7 +50450,6 @@ sHandMats = .bss:0x805A06C8; // type:object size:0xE scope:local data:byte sFader__8dScene_c = .bss:0x805A06FC; // type:object size:0x24 data:4byte SysConfig = .bss:0x805A0720; // type:object size:0x58 data:4byte sRumblePreset0__9dRumble_c = .bss:0x805A0778; // type:object size:0xC data:4byte -...bss.0 = .bss:0x805A0778; // type:label scope:local sRumblePreset1__9dRumble_c = .bss:0x805A0784; // type:object size:0xC data:4byte sRumblePreset2__9dRumble_c = .bss:0x805A0790; // type:object size:0xC data:4byte sRumblePreset3__9dRumble_c = .bss:0x805A079C; // type:object size:0xC data:4byte @@ -51474,9 +51472,11 @@ AcArrow__STATE_BOUND = .bss:0x805B4BA0; // type:object size:0x30 data:4byte lbl_805B4BD0 = .bss:0x805B4BD0; // type:object size:0x10 align:4 data:float lbl_805B4BE0 = .bss:0x805B4BE0; // type:object size:0x10 lbl_805B4BF0 = .bss:0x805B4BF0; // type:object size:0xA8 -AcBoomerang__STATE_WAIT = .bss:0x805B4C98; // type:object size:0x40 data:4byte -AcBoomerang__STATE_MOVE = .bss:0x805B4CD8; // type:object size:0x40 data:4byte -AcBoomerang__STATE_CANCEL_WAIT = .bss:0x805B4D18; // type:object size:0xC0 data:4byte +StateID_Wait__14dAcBoomerang_c = .bss:0x805B4C98; // type:object size:0x40 data:4byte +StateID_Move__14dAcBoomerang_c = .bss:0x805B4CD8; // type:object size:0x40 data:4byte +StateID_MoveCancelWait__14dAcBoomerang_c = .bss:0x805B4D18; // type:object size:0x40 data:4byte +StateID_ReturnWait__14dAcBoomerang_c = .bss:0x805B4D58; // type:object size:0x40 data:4byte +StateID_EventReturnWait__14dAcBoomerang_c = .bss:0x805B4D98; // type:object size:0x40 data:4byte lbl_805B4DD8 = .bss:0x805B4DD8; // type:object size:0x10 AcFairy__STATE_WAIT = .bss:0x805B4DE8; // type:object size:0x40 data:4byte AcFairy__STATE_AVOID = .bss:0x805B4E28; // type:object size:0x40 data:4byte diff --git a/configure.py b/configure.py index 8ced8115..ff3610bd 100644 --- a/configure.py +++ b/configure.py @@ -411,7 +411,8 @@ config.libs = [ Object(Matching, "d/d_heap.cpp"), Object(NonMatching, "d/d_main.cpp"), Object(NonMatching, "d/d_pad.cpp"), - Object(NonMatching, "d/d_pad_player.cpp"), + Object(Matching, "d/d_pad_ex.cpp"), + Object(NonMatching, "d/d_pause_manager.cpp"), Object(NonMatching, "d/d_player_act.cpp"), Object(Matching, "d/d_player_mdl.cpp"), Object(Matching, "d/d_player_guide_colors.cpp"), @@ -429,7 +430,7 @@ config.libs = [ Object(NonMatching, "toBeSorted/cx_util.cpp"), Object(NonMatching, "toBeSorted/area_math.cpp"), Object(NonMatching, "toBeSorted/deg_angle_util.cpp"), - Object(NonMatching, "toBeSorted/reload_color_fader.cpp"), + Object(Matching, "d/d_reset.cpp"), Object(Matching, "toBeSorted/arc_managers/current_stage_arc_manager.cpp"), Object(Matching, "toBeSorted/arc_managers/oarc_manager.cpp"), Object(NonMatching, "toBeSorted/arc_managers/oarc_control.cpp"), @@ -566,7 +567,7 @@ config.libs = [ Object(NonMatching, "toBeSorted/d_unk_pad.cpp"), Object(NonMatching, "toBeSorted/goddess_chest_counter.cpp"), Object(NonMatching, "toBeSorted/misc_actor.cpp"), - Object(NonMatching, "toBeSorted/d_hbm"), + Object(NonMatching, "d/d_hbm.cpp"), Object(NonMatching, "d/d_stage_mgr.cpp"), Object(NonMatching, "d/d_last.cpp"), Object(NonMatching, "d/d_camera.cpp"), diff --git a/include/d/a/d_a_player.h b/include/d/a/d_a_player.h index 324e27bf..9050140b 100644 --- a/include/d/a/d_a_player.h +++ b/include/d/a/d_a_player.h @@ -5,6 +5,9 @@ #include "d/a/d_a_item.h" #include "d/col/c/c_bg_s_poly_info.h" #include "d/d_player_mdl.h" +#include "m/m_angle.h" +#include "m/m_color.h" +#include "nw4r/g3d/res/g3d_resfile.h" #include "toBeSorted/file_manager.h" #include "toBeSorted/minigame_mgr.h" @@ -29,9 +32,32 @@ public: /* vt 0x318 */ virtual void vt_0x318(); protected: - /* 0x137C */ u8 _0x137C[0x4564 - 0x137C]; + /* 0x137C */ u8 _0x137C[0x16F0 - 0x137C]; + /* 0x16F0 */ nw4r::g3d::ResFile mHeldResFile; + /* 0x16F4 */ u8 _0x16F4[0x4564 - 0x16F4]; /* 0x4564 */ f32 field_0x4564; +public: + // Beetle Functions [0x8021AA70 - 0x8021BE20] + s16 getBeetleFlightTime(); + mAng getBeetleAngle0(); + mAng getBeetleAngle1(); + f32 getBeetleWingAngleActive(); + f32 getBeetleWingAngleInactive(); + f32 getBeetleNormalSpeed(); + f32 getBeetleQuickSpeed(); + f32 getBeetleMaxRange(); + f32 getBeetleLargeRadius(); + f32 getBeetleSmallRadius(); + f32 getBeetleMaxHeightOffset(); + mAng getBeetleSmallAngle0(); + mAng getBeetleSmallAngle1(); + mAng getBeetleBonkRecoilAngle(); + mAng getBeetleSmallAngle2(); + void setBeetleFlashClr(const mColor &); + void setBeetleBackAnim(); + s32 getBeetleWarningTimeLeft(); + public: f32 getField_0x4564() const { return field_0x4564; @@ -44,6 +70,9 @@ public: nw4r::g3d::ResFile getSwordResFile() const { return mSwordRes; } + nw4r::g3d::ResFile getHeldResFile() const { + return mHeldResFile; + } inline bool hasvt_0x1C0() const { return vt_0x1C0() != nullptr; @@ -73,6 +102,9 @@ public: static s32 getCurrentBowType(); static s32 getCurrentSlingshotType(); static s32 getCurrentBeetleType(); + static bool hasBeetleVariantOrBetter(s32 variant) { + return getCurrentBeetleType() >= variant; + } static s32 getCurrentBugNetType(); static bool isInBambooCuttingMinigame() { diff --git a/include/d/a/obj/d_a_obj_boomerang.h b/include/d/a/obj/d_a_obj_boomerang.h index 3b2a6261..d172ff42 100644 --- a/include/d/a/obj/d_a_obj_boomerang.h +++ b/include/d/a/obj/d_a_obj_boomerang.h @@ -5,32 +5,36 @@ #include "d/a/d_a_base.h" #include "d/a/obj/d_a_obj_base.h" #include "d/col/bg/d_bg_s_acch.h" +#include "d/col/bg/d_bg_s_lin_chk.h" #include "d/col/cc/d_cc_d.h" #include "d/d_shadow.h" #include "d/lyt/d_lyt_fader.h" #include "m/m3d/m_anmchr.h" #include "m/m3d/m_anmchrblend.h" #include "m/m3d/m_mdl.h" -#include "m/m3d/m_proc.h" #include "m/m_color.h" +#include "m/m_fader.h" +#include "m/m_vec.h" #include "nw4r/g3d/res/g3d_resfile.h" #include "s/s_State.hpp" #include "toBeSorted/actor_event.h" #include "toBeSorted/d_emitter.h" -class dAcBoomerangProcBase_c : public m3d::proc_c { +class dAcBoomerangProc_c : public d3d::UnkProc { public: - ~dAcBoomerangProcBase_c() {} -}; -class dAcBoomerangProc_c : public dAcBoomerangProcBase_c { -public: - dAcBoomerangProc_c() : mColor0(0), mColor1(0xFFFFFFFF) {} + dAcBoomerangProc_c() : mpMdl(nullptr), mClr(0xFFFFFFFF) {} ~dAcBoomerangProc_c() {} + bool create(m3d::mdl_c *mdl, mColor clr, int prioOpa, mAllocator_c *alloc); + bool create2(m3d::mdl_c *mdl, mColor clr, int prioOpa, mAllocator_c *alloc) { + return create(mdl, clr, prioOpa, alloc); + } + virtual void drawOpa() override; - mColor mColor0; - mColor mColor1; +private: + m3d::mdl_c *mpMdl; + mColor mClr; }; class dAcBoomerang_c : public dAcObjBase_c { @@ -60,6 +64,14 @@ public: STATE_FUNC_DECLARE(dAcBoomerang_c, EventReturnWait); public: // TYPES + enum Variant_e { + NONE, + BEETLE, + HOOK_BEETLE, + QUICK_BEETLE, + TOUGH_BEETLE, + }; + struct ChrAnimation_t { const char *mName; f32 mRate; @@ -75,22 +87,112 @@ public: // TYPES }; static const ChrAnimation_t sChrAnims[RB_MAX]; + enum ModelType_e { + MDL_WINGS_BASIC = 0, + MDL_BODY_BASIC = 1, + MDL_MOUTH_BASIC = 2, + MDL_MOUTH_HOOK = 3, + MDL_MOTTH_ADV = MDL_MOUTH_HOOK, // Just for naming :P + MDL_BODY_ADV = 4, + MDL_WINGS_ADV = 5, + }; + + struct FlyChrAnimation_t { + const char *mName; + }; + enum FlyAnimation_e { + RB_FLY = 0, + RB_FLY_FAST = 1, + RB_FLY_MAX = 2, + }; + static const char *sFlyChrAnims[RB_FLY_MAX]; + + enum Flags_e { + /* 0x00000001 */ FLAG_CANCEL_1 = 1 << 0, + /* 0x00000002 */ FLAG_CANCEL_2 = 1 << 1, + /* 0x00000003 */ FLAG_CANCEL = FLAG_CANCEL_1 | FLAG_CANCEL_2, + + /* 0x00000004 */ FLAG_RELEASE_ITEM = 1 << 2, + /* 0x00000008 */ FLAG_0x8 = (0x8), + /* 0x00000010 */ FLAG_0x10 = (0x10), + /* 0x00000020 */ FLAG_0x20 = (0x20), + /* 0x00000040 */ FLAG_0x40 = (0x40), + /* 0x00000080 */ FLAG_0x80 = (0x80), + /* 0x00000100 */ FLAG_STOP_TIMER_ACTIVE = (0x100), + /* 0x00000200 */ FLAG_DROP_ITEM = (0x200), // related to 0x400 + /* 0x00000400 */ FLAG_REQUEST_0x400 = (0x400), // related to 0x200 + /* 0x00000800 */ FLAG_REQUEST_MOVE = (0x800), + /* 0x00001000 */ FLAG_CONTROLLABLE = (0x1000), + /* 0x00002000 */ FLAG_0x2000 = (0x2000), + /* 0x00004000 */ FLAG_RUMBLE_ACTIVE = (0x4000), + /* 0x00008000 */ FLAG_WING_EFFECT_ACTIVE = (0x8000), + /* 0x00010000 */ FLAG_0x10000 = (0x10000), + /* 0x00020000 */ FLAG_0x20000 = (0x40000), + /* 0x00040000 */ FLAG_0x40000 = (0x40000), + /* 0x00080000 */ FLAG_0x80000 = (0x80000), + + /* 0x0001A117 */ FLAG_COMMON_INIT = FLAG_0x10000 | FLAG_WING_EFFECT_ACTIVE | FLAG_0x2000 | + FLAG_STOP_TIMER_ACTIVE | FLAG_0x10 | FLAG_RELEASE_ITEM | FLAG_CANCEL, + }; + public: // INLINES - bool checkField_0x8CC(u32 mask) { + bool checkField_0x8CC(u32 mask) const { return field_0x8CC & mask; } + void setField_0x8CC(u32 mask) { + field_0x8CC |= mask; + } + void unsetField_0x8CC(u32 mask) { + field_0x8CC &= ~mask; + } + bool isMoving() { + return mStateMgr.isState(StateID_Move); + } public: // FUNCTIONS + void areaCallback(mVec3_c *param1, u32 param2); void atHitCallback(cCcD_Obj *i_objInfA, dAcObjBase_c *i_actorB, cCcD_Obj *i_objInfB); + /** hides the given shape within the resfile. Ref Brawlcrate's 'polygon#' in the mdl0/Object folder */ + void hideModel(ModelType_e type); + + /** ?? */ + void deleteCheck(); + + /** ?? Retrieve Beetle */ + void retrieve(); + + /** Attempts to grab ahold of the object upon collision. Called from atHitCallback if type > Hook beetle */ bool tryGrabObject(dAcObjBase_c *pObject); + + /** Sets the room id of the beetle. Sets to links room id or the room id of the collision its around */ + void setRoomId(); + + /** Updates the position based on where links wrist is */ + void placeOnArm(); + + /** Sets the assuming bonk flag and plays the rumble feedback */ + void bonk(); + + /** Applies the selected animation to the beetle */ void setChrAnimation(ChrAnimation_e requestedAnimation); + /** Applies the selected animation to the beetle */ + void setFlyChrAnimation(FlyAnimation_e requestedAnimation); + + /** Sets the amount of time the beetle can fly. Setting a number less than 0 gives it 5s of time */ + void setRemainingFlightTime(s16 time); + + /** Attempts to flash the beetle red at end of flight */ + void executeTimeWarning(); + private: /* 0x0330 */ nw4r::g3d::ResFile mResFile; /* 0x0334 */ m3d::mdl_c mMdl; /* 0x0358 */ m3d::anmChrBlend_c mAnmChrBlend; - /* 0x0380 */ m3d::anmChr_c mAnmChr[2]; +#define BOOMERANG_ANIM_PINCERS (0) +#define BOOMERANG_ANIM_WINGS (1) + /* 0x0380 */ m3d::anmChr_c mAnmChr[2]; /* 0 - Pincers, 1 - Wings*/ /* 0x03F0 */ dAcBoomerangProc_c mProc; /* 0x0410 */ dShadowCircle_c mShadow; /* 0x0418 */ dAcRef_c mGrabbedActor; @@ -99,13 +201,26 @@ private: /* 0x0804 */ dBgS_AcchCir mAcchCir; /* 0x0860 */ ActorEventRelated mEventRelated; /* 0x08B0 */ u8 mCurrentAnimation; - /* 0x08B1 */ u8 _0x8B1[0x8B5 - 0x8B1]; + /* 0x08B1 */ u8 field_0x8B1; + /* 0x08B2 */ u8 field_0x8B2; + /* 0x08B3 */ u8 mFlashTimer; + /* 0x08B4 */ u8 field_0x8B4; /* 0x08B5 */ u8 mWindNodeID; /* 0x08B6 */ u8 mLeftWingNodeID; /* 0x08B7 */ u8 mRightWingNodeID; - /* 0x08B8 */ u8 _0x8B8[0x8CC - 0x8B8]; - /* 0x08B8 */ u32 field_0x8CC; - /* 0x08D0 */ u8 _0x8D0[0x8FC - 0x8D0]; + /* 0x08B8 */ mAng field_0x8B8; + /* 0x08BA */ mAng field_0x8BA; + /* 0x08BC */ mAng field_0x8BC; + /* 0x08BE */ mAng field_0x8BE; + /* 0x08C0 */ u8 _0x8C0[0x8C8 - 0x8C0]; + /* 0x08CA */ mAng field_0x8C8; + /* 0x08CA */ u16 mRemainingFlightTime; + /* 0x08CC */ u32 field_0x8CC; + /* 0x08D0 */ f32 field_0x8D0; + /* 0x08D4 */ f32 field_0x8D4; + /* 0x08D8 */ mVec3_c field_0x8D8; + /* 0x08E4 */ mVec3_c field_0x8E4; + /* 0x08F0 */ mVec3_c field_0x8F0; /* 0x08FC */ dCcD_Sph mSph0; /* 0x0A4C */ dCcD_Sph mSph1; /* 0x0B9C */ EffectsStruct mEff0; @@ -113,8 +228,14 @@ private: /* 0x0C04 */ EffectsStruct mEff2; /* 0x0C38 */ EffectsStruct mEff3; /* 0x0C6C */ dLytFader_c mLytFader; - /* 0x114C */ u8 _0x114C[0x115C - 0x114C]; + /* 0x114C */ mFader_c mFader; + /* 0x1150 */ u8 _0x1150[0x115C - 0x1150]; /* 0x115C */ STATE_MGR_DECLARE(dAcBoomerang_c); + + static const u32 BoomerangAtFlags; + static dCcD_SrcSph sSphSrc; + static dBgS_BeetleLinChk sLinChk; + static const u32 sSrcAtType; }; #endif diff --git a/include/d/col/bg/d_bg_s_acch.h b/include/d/col/bg/d_bg_s_acch.h index 6682fac3..ef546f23 100644 --- a/include/d/col/bg/d_bg_s_acch.h +++ b/include/d/col/bg/d_bg_s_acch.h @@ -146,6 +146,7 @@ public: /* 0x 0800 0000 */ ACCH_FLAG_0x8000000 = (1 << 27), /* 0x 1000 0000 */ ACCH_FLAG_0x10000000 = (1 << 28), /* 0x 2000 0000 */ ACCH_FLAG_0x20000000 = (1 << 29), + /* 0x 4000 0000 */ ACCH_FLAG_0x40000000 = (1 << 30), /* 0x 8000 0000 */ ACCH_FLAG_0x80000000 = (1 << 31), }; @@ -314,6 +315,12 @@ public: return mFlags & ACCH_FLAG_0x10000000; } + void ClrLineDown() { + mFlags &= ~LINE_DOWN; + } + void SetLineDown() { + mFlags |= LINE_DOWN; + } void Clr_0x20000() { mFlags &= ~ACCH_FLAG_0x20000; } @@ -323,6 +330,15 @@ public: bool Chk_0x20000() { return mFlags & ACCH_FLAG_0x20000; } + void Clr_0x40000000() { + mFlags &= ~ACCH_FLAG_0x40000000; + } + void Set_0x40000000() { + mFlags |= ACCH_FLAG_0x40000000; + } + bool Chk_0x40000000() { + return mFlags & ACCH_FLAG_0x40000000; + } void Clr_0x80000000() { mFlags &= ~ACCH_FLAG_0x80000000; } @@ -506,6 +522,14 @@ public: return mGnd; } + dBgS_RoofChk &GetRoof() { + return mRoof; + } + + void SetField_0xD4(f32 v) { + mField_0x0D4 = v; + } + public: /* 0x040 */ u32 mFlags; /* 0x044 */ mVec3_c *mpPos; diff --git a/include/d/col/bg/d_bg_s_roof_chk.h b/include/d/col/bg/d_bg_s_roof_chk.h index 214cef0b..0e012dd1 100644 --- a/include/d/col/bg/d_bg_s_roof_chk.h +++ b/include/d/col/bg/d_bg_s_roof_chk.h @@ -23,6 +23,10 @@ public: void SetPos(mVec3_c const *); + void SetField_0x7C(u8 param0) { + mField_0x7C = param0; + } + void SetNowY(f32 y) { mNowY = y; } diff --git a/include/d/col/c/c_bg_s_lin_chk.h b/include/d/col/c/c_bg_s_lin_chk.h index 4d5e8141..e3cafb41 100644 --- a/include/d/col/c/c_bg_s_lin_chk.h +++ b/include/d/col/c/c_bg_s_lin_chk.h @@ -50,6 +50,9 @@ public: bool GetPreGroundChk() const { return mPreGroundChk; } + void SetPreRoofChk(bool b) { + mPreRoofChk = b; + } bool GetPreRoofChk() const { return mPreRoofChk; } diff --git a/include/d/col/c/c_cc_d.h b/include/d/col/c/c_cc_d.h index d3a0cf5a..975c2b36 100644 --- a/include/d/col/c/c_cc_d.h +++ b/include/d/col/c/c_cc_d.h @@ -338,7 +338,7 @@ enum dCcD_ObjAtType { /* 0x 0000 0008 */ AT_TYPE_PHYSICS = (1 << 3), /* 0x 0000 0010 */ AT_TYPE_0x10 = (1 << 4), /* 0x 0000 0020 */ AT_TYPE_BOMB = (1 << 5), - /* 0x 0000 0040 */ AT_TYPE_0x40 = (1 << 6), + /* 0x 0000 0040 */ AT_TYPE_0x40 = (1 << 6), // Used in Beetle /* 0x 0000 0080 */ AT_TYPE_SLINGSHOT = (1 << 7), /* 0x 0000 0100 */ AT_TYPE_0x100 = (1 << 8), /* 0x 0000 0200 */ AT_TYPE_WIND = (1 << 9), @@ -686,7 +686,7 @@ public: cCcD_ObjCo(); virtual ~cCcD_ObjCo(); void Set(const cCcD_SrcGObjCo &); - void SetCoFlag(u32); + void SetGrp(u32); void AdjustHitPos(f32, f32); void ClrSet() { @@ -815,6 +815,9 @@ public: mCo.OnSPrm(f); } + void SetAtType(u32 type) { + mAt.SetType(type); + } void SetTgType(u32 type) { mTg.SetType(type); } @@ -932,6 +935,11 @@ public: void OnAt_0x40() { mAt.OnSPrm(0x40); } + // Related to Beetle (no hook) + void OnAt_0x4000() { + mAt.OnSPrm(0x4000); + } + void SetAtDamage(u8 amount) { @@ -967,6 +975,9 @@ public: void ClrTgElectric() { return mTg.OffSPrm(0x40000); } + u32 ChkTgBonk() const { + return mTg.MskSPrm(0x200000); + } void OnTg_0x200000() { mTg.OnSPrm(0x200000); @@ -990,6 +1001,9 @@ public: // Co + void SetCoGrp(u32 grp) { + mCo.SetGrp(grp << 4); + } void OnCoSet() { mCo.OnSPrm(1); } diff --git a/include/d/d_cs_base.h b/include/d/d_cs_base.h index fce72800..5f39ad67 100644 --- a/include/d/d_cs_base.h +++ b/include/d/d_cs_base.h @@ -28,6 +28,9 @@ public: void setField704(bool val) { field_0x704 = val; } + void setField705(bool val) { + field_0x705 = val; + } dCursorHitCheck_c *getHitCheck() { return mCursorIf.getHit(); diff --git a/include/d/d_cs_game.h b/include/d/d_cs_game.h index ed765ae4..fddae87d 100644 --- a/include/d/d_cs_game.h +++ b/include/d/d_cs_game.h @@ -126,9 +126,14 @@ public: virtual int create() override; virtual int doDelete() override; + static dCsGame_c *GetInstance() { + return sInstance; + } + void setSomething(int); - static dCsGame_c *sInstance; + bool fn_801BF5E0() const; + bool fn_801BF630() const; /// @brief Item cursor. class lytItemCursor_c { @@ -168,6 +173,7 @@ public: /* 0x4C */ d2d::LytBase_c *mpLyt; /* 0x50 */ f32 field_0x50; /* 0x54 */ f32 field_0x54; + /* 0x58 */ u8 field_0x58[0x68 - 0x58]; // idk }; /// @brief Dowsing cursor. @@ -197,6 +203,7 @@ public: /* 0xB8 */ f32 field_0xB8; /* 0xBC */ f32 field_0xBC; /* 0xC0 */ f32 field_0xC0; + /* 0xC4 */ u8 field_0xC4[0xD8 - 0xC4]; }; /// @brief Slingshot cursor. @@ -254,6 +261,7 @@ public: /* 0x04 */ UI_STATE_MGR_DECLARE(lytCrawShotCsr_c); /* 0x40 */ d2d::AnmGroups mAnm; /* 0x4C */ d2d::LytBase_c *mpLyt; + /* 0x50 */ u8 field_0x50[0x6C - 0x50]; }; /// @brief Gust Bellows cursor. @@ -277,6 +285,7 @@ public: /* 0x04 */ UI_STATE_MGR_DECLARE(lytVacuumCsr_c); /* 0x40 */ d2d::AnmGroups mAnm; /* 0x4C */ d2d::LytBase_c *mpLyt; + /* 0x50 */ u8 field_0x50[0x5C - 0x50]; /* 0x5C */ u8 field_0x5C; }; @@ -301,12 +310,15 @@ public: mpResAcc = resAcc; } + bool isCursorActive() const { + return mCursorActive; + } void setField0x9A0(u8 val) { - field_0x9A0 = val; + mCursorActive = val; } void setNextCursorType(CursorType_e cs) { - field_0x9A8 = 1; + mNextCursor = 1; mNextCursorType = cs; } @@ -327,6 +339,7 @@ public: /* 0x048 */ EffectsStruct mEffects; /* 0x07C */ EffectRelated mEffectRelated; + /* 0x080 */ u8 field_0x80[0xC8 - 0x80]; /* 0x0C8 */ m2d::ResAccIf_c *mpResAcc; /* 0x0CC */ d2d::LytBase_c mLyt; /* 0x15C */ dCsGameAnmGroups_c mAnmGroups; @@ -334,17 +347,23 @@ public: /* 0x72C */ lytBowCsr_c mBow; /* 0x794 */ lytDowsingCsr_c mDowsing; /* 0x86C */ lytPachinkoCsr_c mPachinko; - /* 0x8C0 */ lytCrawShotCsr_c mCrawShot; + /* 0x8C8 */ lytCrawShotCsr_c mCrawShot; /* 0x934 */ lytVacuumCsr_c mVacuum; - /* 0x990 */ u8 field_0x990; - /* 0x99C */ u8 field_0x99C; - /* 0x9A0 */ u8 field_0x9A0; - /* 0x9A8 */ u8 field_0x9A8; + /* 0x994 */ u8 field_0x994[0x99C - 0x994]; // seemingly not used + /* 0x99C */ bool mCursorTrail; + /* 0x99D */ u8 field_0x99D[0x9A0 - 0x99D]; // Havent seen this range be set + /* 0x9A0 */ bool mCursorActive; + /* 0x9A1 */ bool field_0x9A1; // Compares to mCursorActive to change state + /* 0x9A2 */ bool field_0x9A2; // A way of signalling Lyt non-normal state. + /* 0x9A4 */ CursorType_e mActiveCursorType; + /* 0x9A8 */ bool mNextCursor; /* 0x9AC */ CursorType_e mNextCursorType; }; void setNextCursorType(lytItemCursor_c::CursorType_e); + static dCsGame_c *sInstance; + /* 0x068 */ m2d::ResAccIf_c mCursorResAcc; /* 0x11C */ m2d::ResAccIf_c mMain2DResAcc; /* 0x1D0 */ dCursorInterfaceGame_c mCursorIf; diff --git a/include/d/d_dvd_unk.h b/include/d/d_dvd_unk.h index 419dc63b..2b93fd22 100644 --- a/include/d/d_dvd_unk.h +++ b/include/d/d_dvd_unk.h @@ -21,6 +21,9 @@ public: static void create(EGG::Heap *heap); void init(); + void fn_800529B0(); + void fn_800529E0(); + void fn_80052A20(); void fn_80052D00(bool); void fn_80052D50(); void fn_80052C90(); @@ -30,7 +33,7 @@ public: return field_0x24; } - u8 getField_0x28() const { + bool getField_0x28() const { return field_0x28; } @@ -53,7 +56,7 @@ private: /* 0x1C */ s32 field_0x1C; /* 0x20 */ s32 field_0x20; /* 0x24 */ s32 field_0x24; - /* 0x28 */ u8 field_0x28; + /* 0x28 */ bool field_0x28; /* 0x29 */ u8 field_0x29; /* 0x2A */ u8 field_0x2A; /* 0x2B */ u8 field_0x2B; diff --git a/include/d/d_gfx.h b/include/d/d_gfx.h index 18e63957..4a80203c 100644 --- a/include/d/d_gfx.h +++ b/include/d/d_gfx.h @@ -20,9 +20,100 @@ public: return sInstance; } -private: +public: + // clang-format off + static s32 getCurrentScreenWidth() { return g_CurrentScreenWidth_s32; } + static s32 getCurrentScreenHeight() { return g_CurrentScreenHeight_s32; } + static s32 getCurrentScreenWidthLimit() { return g_CurrentScreenWidthLimit_s32; } + static s32 getCurrentScreenHeightLimit() { return g_CurrentScreenHeightLimit_s32; } + static s32 getCurrentScreenLeft() { return g_CurrentScreenLeft_s32; } + static s32 getCurrentScreenRight() { return g_CurrentScreenRight_s32; } + static s32 getCurrentScreenTop() { return g_CurrentScreenTop_s32; } + static s32 getCurrentScreenBottom() { return g_CurrentScreenBottom_s32; } + + static s32 getEFBHeight() { return g_CurrentEFBHeight_s32; } + static s32 getEFBHeightLimit() { return g_CurrentEFBHeightLimit_s32; } + static s32 getLetterboxAmount() { return g_CurrentLetterBoxAmount_s32; } + + static f32 getCurrentScreenWidthF() { return g_CurrentScreenWidth_f32; } + static f32 getCurrentScreenHeightF() { return g_CurrentScreenHeight_f32; } + static f32 getCurrentScreenWidthLimitF() { return g_CurrentScreenWidthLimit_f32; } + static f32 getCurrentScreenHeightLimitF() { return g_CurrentScreenHeightLimit_f32; } + static f32 getCurrentScreenLeftF() { return g_CurrentScreenLeft_f32; } + static f32 getCurrentScreenRightF() { return g_CurrentScreenRight_f32; } + static f32 getCurrentScreenTopF() { return g_CurrentScreenTop_f32; } + static f32 getCurrentScreenBottomF() { return g_CurrentScreenBottom_f32; } + + static f32 getScreenAspectF() { return g_CurrentScreenAspect; } + + static f32 getEFBHeightF() { return g_CurrentEFBHeight_f32; } + static f32 getEFBHeightLimitF() { return g_CurrentEFBHeightLimit_f32; } + static f32 getLetterboxAmountF() { return g_CurrentEFBHeightDifference_f32; } + static f32 getHeightScaledF() { return g_CurrentHeightScaled_f32; } + static f32 getEFBHeightDifferenceF() { return g_CurrentEFBHeightDifference2_f32; } + + static s32 getWidth4x3() { return g_Width4x3_s32; } + static s32 getWidth4x3Limit() { return g_Width4x3Limit_s32; } + static s32 getWidth16x9() { return g_Width16x9_s32; } + static s32 getWidth4x3Left() { return g_Width4x3Left_s32; } + static s32 getWidth4x3Right() { return g_Width4x3Right_s32; } + + static f32 getWidth4x3F() { return g_Width4x3_f32; } + static f32 getWidth4x3LimitF() { return g_Width4x3Limit_f32; } + static f32 getWidth16x9F() { return g_Width16x9_f32; } + static f32 getWidth4x3LeftF() { return g_Width4x3Left_f32; } + static f32 getWidth4x3RightF() { return g_Width4x3Right_f32; } + + static f32 get16x9to4x3WidthScaleF() { return g_16x9to4x3WidthScale; } + // clang-format on + +public: static dGfx_c *sInstance; + static s32 g_CurrentScreenWidth_s32; + static s32 g_CurrentScreenHeight_s32; + static s32 g_CurrentScreenWidthLimit_s32; + static s32 g_CurrentScreenHeightLimit_s32; + static s32 g_CurrentScreenLeft_s32; + static s32 g_CurrentScreenRight_s32; + static s32 g_CurrentScreenTop_s32; + static s32 g_CurrentScreenBottom_s32; + + static s32 g_CurrentEFBHeight_s32; + static s32 g_CurrentEFBHeightLimit_s32; + static s32 g_CurrentLetterBoxAmount_s32; + + static f32 g_CurrentScreenWidth_f32; + static f32 g_CurrentScreenHeight_f32; + static f32 g_CurrentScreenWidthLimit_f32; + static f32 g_CurrentScreenHeightLimit_f32; + static f32 g_CurrentScreenLeft_f32; + static f32 g_CurrentScreenRight_f32; + static f32 g_CurrentScreenTop_f32; + static f32 g_CurrentScreenBottom_f32; + + static f32 g_CurrentScreenAspect; + + static f32 g_CurrentEFBHeight_f32; + static f32 g_CurrentEFBHeightLimit_f32; + static f32 g_CurrentEFBHeightDifference_f32; + static f32 g_CurrentHeightScaled_f32; + static f32 g_CurrentEFBHeightDifference2_f32; + + static s32 g_Width4x3_s32; + static s32 g_Width4x3Limit_s32; + static s32 g_Width16x9_s32; + static s32 g_Width4x3Left_s32; + static s32 g_Width4x3Right_s32; + + static f32 g_Width4x3_f32; + static f32 g_Width4x3Limit_f32; + static f32 g_Width16x9_f32; + static f32 g_Width4x3Left_f32; + static f32 g_Width4x3Right_f32; + + static f32 g_16x9to4x3WidthScale; + /* 0x00 */ u8 _0x00[0x04 - 0x00]; /* 0x04 */ DrawCallback mDrawCallback; /* 0x08 */ u8 field_0x08; diff --git a/include/d/d_hbm.h b/include/d/d_hbm.h new file mode 100644 index 00000000..aa0a42a6 --- /dev/null +++ b/include/d/d_hbm.h @@ -0,0 +1,58 @@ + +#include "common.h" +#include "egg/core/eggHeap.h" +namespace dHbm { +class Manage_c { +public: + enum ManageState_e { + HBM_MANAGE_NOT_LOADED = 0, + HBM_MANAGE_INACTIVE = 1, + HBM_MANAGE_ACTIVE = 2, + }; + + static void CreateInstance(); + static Manage_c *GetInstance(); + + Manage_c(EGG::Heap *); + + bool Load(); + void Calculate(); + void DrawMenu(s32); + void DrawMenuSetting(); + void DrawIcon(); + void InitDataInfo(); + void InitControllerData(); + void SetRegionLayoutName(); + void SetSpkNameName(); + void SetMsgName(); + void SetConfigName(); + void SetIconName(); + void SetSoundName(); + void SetContData(); + bool CheckBegin() const; + + void MenuInit(); + void IconCalc(); + void IconClear(); + void StopMotor(); + bool fn_801973C0(s32); + void ForbidCalc(); + + s32 fn_80197560(s32); + void offFlags(u32 flags) { + mFlags &= ~flags; + } + + ManageState_e getState() const { + return mState; + } + +private: + static Manage_c *s_pInstance; + + /* 0x000 */ u8 _0x00[0x210 - 0x000]; + /* 0x210 */ ManageState_e mState; + /* 0x218 */ UNKWORD field_0x214; + /* 0x218 */ u32 mFlags; +}; +} // namespace dHbm diff --git a/include/d/d_pad.h b/include/d/d_pad.h index 53a9955a..fbfca801 100644 --- a/include/d/d_pad.h +++ b/include/d/d_pad.h @@ -1,24 +1,361 @@ #ifndef D_PAD_H #define D_PAD_H -class dPad { +#include "common.h" +#include "m/m_angle.h" +#include "m/m_mtx.h" +#include "m/m_vec.h" +#include "rvl/KPAD/KPAD.h" +#include "rvl/WPAD/WPAD.h" + +namespace dPad { +class ex_c { + // Complete Made up name + struct acc_c { + void init(); + f32 getMaxAccValue(s32 chan); + void fn_800576D0(s32 chan); + void fn_800578E0(s32 chan); + void fn_80057AC0(s32 chan, bool); + + f32 fn_80057F00(s32 chan); + f32 fn_80057F30(s32 chan); + f32 fn_80057F60(s32 chan); + + bool fn_80057F90(s32 idx, bool); + bool fn_800580C0(s32 idx, bool); + + bool fn_800581F0(s32 idx, bool); + bool fn_80058320(s32 idx, bool); + + bool fn_80058450(s32 idx, bool); + + void fn_80058540(s32 chan, bool); + + void fn_80058990(u32 mask, bool); + + bool fn_800589F0(); + f32 fn_80058A00(); + void fn_80058AE0(s32 chan, bool); + + /* 0x0000 */ mVec3_c mAccVecs[120]; + /* 0x05A0 */ mVec3_c field_0x5A0[120]; + /* 0x0B40 */ f32 mAccValues[120]; + /* 0x0D20 */ mVec3_c field_0xD20[39]; + /* 0x0EF4 */ mVec3_c field_0xEF4[33]; + /* 0x1080 */ mVec3_c field_0x1080; + /* 0x108C */ mVec3_c field_0x108C; + /* 0x1098 */ mMtx_c field_0x1098; + /* 0x10C8 */ u32 field_0x10C8; + /* 0x10CC */ u32 field_0x10CC; + /* 0x10D0 */ s32 field_0x10D0; + /* 0x10D4 */ f32 field_0x10D4; + /* 0x10D8 */ s32 field_0x10D8; + }; + + // Orthonormal Basis vectors of the Mpls attachment in 3D space. + // Z+ is forward, Y+ is up, and X+ is left. So a Wiimote pointing at + // the Screen will have vectors (1, 0, 0), (0, 1, 0), (0, 0, 1). + // Of particular interest here is mZ, which tells you in which direction + // the Wiimote points. + struct mpls_c { + mpls_c() : mX(mVec3_c::Ex), mY(mVec3_c::Ey), mZ(mVec3_c::Ez) {} + mMtx_c getMtx() const; + /* 0x00 */ mVec3_c mX; + /* 0x0C */ mVec3_c mY; + /* 0x18 */ mVec3_c mZ; + + // vertical angle. 0 is forward, positive is pointing upwards, + // negative is pointing downwards + mAng getVerticalAngle() const { + return cM::atan2s(mZ.y, mZ.absXZ()); + } + + // horizontal angle. 0 is forward, positive is pointing to the left, + // negative is pointing to the right + mAng getHorizontalAngle() const { + return cM::atan2s(mZ.x, mZ.z); + } + }; + public: - static bool checkButtonAPressed(); - static bool checkButtonBPressed(); - static bool checkButtonZPressed(); - static bool checkButtonCPressed(); - static bool checkButtonMinusPressed(); - static bool checkButtonPlusPressed(); - static bool checkButton1Pressed(); - static bool checkButton2Pressed(); + ex_c(); + void fn_80055EF0(s32 chan); + void fn_800562B0(s32 chan, mVec3_c &mpls); + void fn_80056330(s32 chan); + void fn_80056580(s32 chan, const mVec2_c &); + void centerCursor(s32 chan, bool); + void fn_80056790(s32 chan); + void setField_0x70(mAng ang); + void setField_0x70(); + void fn_80056AF0(s32 chan); - static bool checkButtonDpadUpPressed(); - static bool checkButtonDpadDownPressed(); - static bool checkButtonDpadLeftPressed(); - static bool checkButtonDpadRightPressed(); + bool checkWPADProbeStable(); + void fn_80056B90(s32 chan); + void fn_80056CE0(s32 chan); - static bool checkButtonAHeld(); - static bool checkButtonZHeld(); + void startMplsCalibration(s32 chan); + void workMplsCalibration(s32 chan); + f32 getCalibrationWork(); + void stopMplsCalibration(s32 chan); + + void centerCursor(s32 chan); + + void gotoStateWaitForConnect(s32 chan); + void executeStateWaitForConnect(s32 chan); + void gotoStatePostConnect(s32 chan); + void executeStatePostConnect(s32 chan); + void gotoStateEnableMpls(s32 chan); // (EnableMPLS) + void executeStateEnableMpls(s32 chan); + void gotoStateDisconnectWpad(s32 chan); // (Disconnect) + void executeStateDisconnectWpad(s32 chan); + void gotoStateMplsConfigError(s32 chan); + void executeStateMplsConfigError(s32 chan); + void gotoStateMplsConfigured(s32 chan); + void executeStateMplsConfigured(s32 chan); + void fn_800572A0(s32 chan); // State Handling + + /** + * Is the Wiimote missing MotionPlus? This means the Wiimote neither has + * a builtin Mpls nor a passthrough Mpls attached. + */ + static bool isMissingMpls(); + /** + * Is the Wiimote known to not have an attached Nunchuk? + */ + static bool isMissingNunchuk(); + static void fn_80058C90(s32 chan); + + static bool isLowBattery(); + static bool isOutOfBattery(); + + static void resetInfo(); + static void clearInfo(s32 chan); + static s32 getInfo(s32 chan); + static s32 getBatteryLevel(); + static s32 getBatteryLevel(s32 chan); + static void setInfo(s32 chan, const WPADInfo *pInfo); + + static f32 fn_80058F50(); + static bool fn_80058F60(); + static f32 getCurrentCalibrationWork(); + static void fn_80058FF0(); + static void fn_80059000(); + static bool needMplsCalibration(); + static void setCalibrateMpls(); + static bool fn_800590B0(); + static bool fn_800590E0(); + static void fn_800590F0(); + static bool fn_80059100(); + static bool fn_80059110(s32 chan); + static void fn_80059210(); + static void fn_80059220(); + static void fn_80059230(); + static void fn_80059240(); + + static void on_0x54(s32 chan); + static void on_0x55(s32 chan); + static void on_0x56(s32 chan); + static void on_0x57(s32 chan); + + static void fn_800592D0(s32 chan); + + void fn_80059300(s32 chan); + static bool fn_80059330(s32 chan); + static bool fn_80059350(s32 chan); + static bool fn_80059370(s32 chan); + static bool fn_80059390(s32 chan); + void getUnifiedWpadStatus(s32 chan); + void calcFSStickDirMask(); + + static void setNoSleep(); + static void setAutoSleepTime(); + + void updateStatus(s32 chan); + + static ex_c *getInstance() { + return m_current_ex; + } + + enum ExState_e { + EX_STATE_WAITING_FOR_CONNECT = 0, + EX_STATE_POST_CONNECT = 1, + EX_STATE_ENABLE_MPLS = 2, + EX_STATE_DISCONECT_WPAD = 3, + EX_STATE_MPLS_CONFIG_ERROR = 4, + EX_STATE_MPLS_CONFIGURED = 5, + }; + +public: + /* 0x0000 */ mVec2_c mDpdPos; + /* 0x0008 */ mVec2_c mDpdPosScreen; + /* 0x0010 */ mVec2_c mFSStick; + /* 0x0018 */ f32 mFSStickDistance; + /* 0x001C */ mAng mFSStickAngle; + /* 0x0020 */ WPADResult mWPADProbeResult; + /* 0x0024 */ WPADResult mWPADProbeResultStable; + /* 0x0028 */ s32 mWPADProbeStableTimer; + /* 0x002C */ WPADDeviceType mWPADDeviceType; + /* 0x0030 */ u32 mWPADDeviceTypeStable; + /* 0x0034 */ s32 mWPADDeviceTypeStableTimer; + /* 0x0038 */ s32 mConnectedStableTimer; + /* 0x003C */ s32 field_0x3C; + /* 0x0040 */ f32 mCalibrationWork; + /* 0x0044 */ bool field_0x44; + /* 0x0045 */ bool field_0x45; + /* 0x0046 */ bool field_0x46; + /* 0x0047 */ bool mIsCalibrating; + /* 0x0048 */ s32 field_0x48; + /* 0x004C */ bool mDidConnect; + /* 0x004D */ bool mDidDisconnect; + /* 0x004E */ bool mNeedMplsCalibration; + /* 0x004F */ bool field_0x4F; + /* 0x0050 */ bool field_0x50; + /* 0x0051 */ u8 field_0x51; + /* 0x0052 */ bool mMplsEnabled; + /* 0x0053 */ bool field_0x53; + /* 0x0054 */ bool field_0x54; + /* 0x0055 */ bool field_0x55; + /* 0x0056 */ bool field_0x56; + /* 0x0057 */ bool field_0x57; + /* 0x0058 */ bool field_0x58; + /* 0x0059 */ bool field_0x59; + /* 0x005A */ bool field_0x5A; + /* 0x005B */ bool field_0x5B; + /* 0x005C */ mVec2_c field_0x5C; + /* 0x0064 */ mVec2_c field_0x64; + /* 0x006C */ s32 mIsWPADDeviceTypeMplsStableTimer; + /* 0x0070 */ mAng field_0x70; + /* 0x0074 */ mVec3_c field_0x74; + /* 0x0080 */ mVec3_c field_0x80; + /* 0x008C */ mVec3_c field_0x8C; + /* 0x0098 */ acc_c mMotion; + /* 0x1174 */ acc_c mFSMotion; + /* 0x2250 */ mVec3_c mMPLSVelocity; + /* 0x225C */ mpls_c mMPLS; + /* 0x2280 */ s32 mState; + /* 0x2284 */ s32 mOutOfHbmStableTimer; + /* 0x2288 */ s32 field_0x2288; + /* 0x228C */ KPADUnifiedWpadStatus mStatus; + /* 0x22CE */ bool field_0x22CE; + /* 0x22CF */ bool field_0x22CF; + /* 0x22D0 */ u8 field_0x22D0; + /* 0x22D1 */ bool mFSStickMaskChanged; + /* 0x22D4 */ u32 mFSStickMask; + /* 0x22D8 */ u8 field_0x22D8; + + static WPADInfo m_info[2][4]; + static bool m_connected[4]; + static ex_c m_ex[4]; + static ex_c *m_current_ex; }; +void initMpls(s32 chan); +void create(); +void setMpls(bool enable, s32 chan); +void beginPad_BR(); +void endPad_BR(); + +void setConnectCallback(); +void enableMplsDirRevise(s32 chan); +void disableMplsDirRevise(s32 chan); + +// the next 4 funcs do nothing +void fn_80059620(); +void fn_80059630(); +void fn_80059640(); +void fn_80059650(); + +bool getDownTrig(u32 btns); +bool getDownTrigA(); +bool getDownTrigB(); +bool getDownTrigC(); +bool getDownTrigZ(); +bool getDownTrigUp(); +bool getDownTrigDown(); +bool getDownTrigLeft(); +bool getDownTrigRight(); +bool getDownTrig1(); +bool getDownTrig2(); +bool getDownTrigMinus(); +bool getDownTrigPlus(); + +bool getDown(u32 btns); +bool getDownAll(u32 btns); +bool getDownA(); +bool getDownB(); +bool getDownC(); +bool getDownZ(); +bool getDownUp(); +bool getDownDown(); +bool getDownLeft(); +bool getDownRight(); +bool getDown1(); +bool getDown2(); +bool getDownMinus(); +bool getDownPlus(); + +bool getUpTrig(u32 btns); +bool getUpTrigA(); +bool getUpTrigB(); +bool getUpTrigC(); +bool getUpTrigZ(); +bool getUpTrigUp(); +bool getUpTrigDown(); +bool getUpTrigLeft(); +bool getUpTrigRight(); +bool getUpTrig1(); +bool getUpTrig2(); +bool getUpTrigMinus(); +bool getUpTrigPlus(); + +bool getUp(u32 btns); +bool getUpAll(u32 btns); +bool getUpA(); +bool getUpB(); +bool getUpC(); +bool getUpZ(); +bool getUpUp(); +bool getUpDown(); +bool getUpLeft(); +bool getUpRight(); +bool getUp1(); +bool getUp2(); +bool getUpMinus(); +bool getUpPlus(); + +mVec2_c &getDpdPos(); +mVec2_c &getDpdPosScreen(); +mVec2_c &getFSStick(); +f32 getFSStickX(); +f32 getFSStickY(); +f32 getFSStickDistance(); +mAng getFSStickAngle(); +mVec3_c getAcc(); + +/** returns m_current_ex->field_0x1160 >> 0 & 1 */ +u32 fn_80059B750(); + +/** returns m_current_ex->field_0x1160 >> 1 & 1 */ +u32 fn_80059B760(); + +/** returns m_current_ex->field_0x1160 >> 2 & 1 */ +u32 fn_80059B70(); + +/** returns m_current_ex->field_0x1160 >> 3 & 1 */ +u32 fn_80059B80(); + +/** returns m_current_ex->field_0x1160 >> 5 & 1 */ +u32 fn_80059B90(); + +mVec3_c getFSAcc(); + +/** returns m_current_ex->field_0x223C >> 4 & 1 */ +u32 fn_80059CC0(); + +/** returns m_current_ex->field_0x223C >> 5 & 1 */ +u32 fn_80059CD0(); + +}; // namespace dPad + #endif diff --git a/include/d/d_pause.h b/include/d/d_pause.h new file mode 100644 index 00000000..a42c5a87 --- /dev/null +++ b/include/d/d_pause.h @@ -0,0 +1,23 @@ +#ifndef D_PAUSE_H +#define D_PAUSE_H + +#include "common.h" + +// reference to NSMBW PauseManage_c (im adding back the d) +class dPauseManager_c { +public: + static dPauseManager_c *GetInstance() { + return sInstance; + } + bool getField_0x25() const { + return field_0x25; + } + +private: + /* 0x00 */ u8 _00[0x25 - 0x00]; + /* 0x25 */ bool field_0x25; + + static dPauseManager_c *sInstance; +}; + +#endif diff --git a/include/d/d_player_act.h b/include/d/d_player_act.h index a490da69..7c272127 100644 --- a/include/d/d_player_act.h +++ b/include/d/d_player_act.h @@ -464,6 +464,8 @@ public: enum ModelUpdateFlags_e { UPDATE_MODEL_SWORD = 0x20, UPDATE_MODEL_SHIELD = 0x40, + + UPDATE_MODEL_BEETLE = 0x10000000, }; enum SwordAndMoreStates_e { @@ -584,6 +586,16 @@ public: return mCurrentAction == 0xAD || mCurrentAction == 0xAE; } + void onModelUpdateFlag(u32 mask) { + mModelUpdateFlags |= mask; + } + void offModelUpdateFlag(u32 mask) { + mModelUpdateFlags &= ~mask; + } + bool checkModelUpdateFlag(u32 mask) const { + return mModelUpdateFlags & mask; + } + inline bool checkActionFlags(u32 mask) const { return (mActionFlags & mask) != 0; } @@ -595,6 +607,10 @@ public: return mRidingActorType; } + bool isAttacking() const { + return mAttackDirection != ATTACK_NONE; + } + static bool isInEvent(); bool isAttackingLeft() const; bool isAttackingRight() const; diff --git a/include/d/d_reset.h b/include/d/d_reset.h new file mode 100644 index 00000000..7cc29663 --- /dev/null +++ b/include/d/d_reset.h @@ -0,0 +1,145 @@ +#ifndef RELOAD_COLOR_FADER_H +#define RELOAD_COLOR_FADER_H + +#include "common.h" +#include "egg/core/eggColorFader.h" +#include "egg/core/eggFader.h" +#include "egg/core/eggHeap.h" +#include "m/m_color.h" +namespace dReset { + +class Manage_c { +public: + enum Mode_e { + Normal = 0, + SoftReset = 1, + HbmWait = 2, + DiskWait = 3, + FatalError = 4, + SafetyWait = 5, + }; + enum Exec_e { + Restart = 0, + Reboot = 1, + ReturnToMenu = 2, + ReturnToDataManager = 3, + Shutdown = 4, + ExecNone = 5, + }; + + static void CreateInstance(EGG::Heap *); + static Manage_c *GetInstance(); + Manage_c(EGG::Heap *); + + void Configure(); + void Reset(); + void Calculate(); + void Draw(); + void BootComplete(bool complete); + bool CanExecSoftReset() const; + void SetSoftResetFinish(); + void SetSoftResetScene(); + void PostDeleteScene(); + bool IsFaderBlank() const; + void SetHbmReturnMenu(); + void SetHbmReset(); + void SetDelayReset(); + void SetDelayPowerOff(); + void SetInteriorReturnDataManager(); + void fn_80067FF0(); + void ExecProcPre(); + void fn_80068070(); + void ExecProcMain(); + void DiskCheckModeRequest(bool); + void DebugPrintMode(const char *); + void ModeProc(); + void ModeRequest(Mode_e); + void ModeRequestSafetyWait(Exec_e); + void ModeRequestSoftReset(); + + void ModeInit_Normal(); + void ModeProc_Normal(); + + void ModeInit_SoftReset(); + void ModeProc_SoftReset(); + + void ModeInit_HbmWait(); + void ModeProc_HbmWait(); + + void ModeInit_DiskWait(); + void ModeProc_DiskWait(); + + void ModeInit_FatalError(); + void ModeProc_FatalError(); + + void ModeInit_SafetyWait(); + void ModeProc_SafetyWait(); + + void SetResetCallback(); + void SetPowerCallback(); + void SetDiskCheckCallback(); + static void DiskCheckCallback(s32 b, struct DVDFileInfo *info); + static void ResetCallback(); + static void PowerCallback(); + void CleanUpGX(); + void CleanUpLC(); + void MotorCancelOn(); + void MotorCancelOff(); + static bool IsFatalError(); + static bool IsDiskError(); + bool FadeOutCalc(); + void FadeOutRequest(bool fadeout); + + bool isSoftResetOrSafetyWait() const { + return mMode == SoftReset || mMode == SafetyWait; + } + + bool isNormal() const { + return mMode == Normal; + } + bool isSoftReset() const { + return mMode == SoftReset; + } + bool isHbmWait() const { + return mMode == HbmWait; + } + bool isDiskWait() const { + return mMode == DiskWait; + } + bool isFatalError() const { + return mMode == FatalError; + } + bool isSafetyWait() const { + return mMode == SafetyWait; + } + +private: + /* 0x00 */ EGG::Heap *mpHeap; + /* 0x04 */ EGG::ColorFader *mpFader; + /* 0x08 */ EGG::ColorFader::EStatus mFaderStatusPrev; + /* 0x0C */ Mode_e mMode; + /* 0x10 */ UNKWORD field_0x10; + /* 0x14 */ Mode_e mModePrev; + /* 0x18 */ Exec_e mExec; + /* 0x1C */ UNKWORD field_0x1C; + /* 0x20 */ DVDCommandBlock mDvdCmd; + /* 0x50 */ bool mHbmReset; + /* 0x51 */ bool mHbmReturnMenu; + /* 0x52 */ bool mRestart; + /* 0x53 */ bool mShutdown; + /* 0x54 */ bool mInteriorReturnDataManager; + /* 0x58 */ UNKWORD field_0x58; + /* 0x5C */ UNKWORD field_0x5C; + /* 0x60 */ UNKWORD field_0x60; + /* 0x64 */ u8 mBootComplete; + /* 0x65 */ u8 mSoftReset; + /* 0x66 */ u8 field_0x66; + /* 0x67 */ u8 field_0x67; + + static Manage_c *s_pInstance; + static mColor c_faderColor; +}; + +} // namespace dReset + +#endif diff --git a/include/d/d_s_boot.h b/include/d/d_s_boot.h index a7e9fe9a..e87c371c 100644 --- a/include/d/d_s_boot.h +++ b/include/d/d_s_boot.h @@ -24,6 +24,25 @@ public: return sInstance; } + u8 getField_0x5E2() const { + return field_0x5E2; + } + void setField_0x5E2(u8 val) { + field_0x5E2 = val; + } + u8 getField_0x5E3() const { + return field_0x5E3; + } + void setField_0x5E3(u8 val) { + field_0x5E3 = val; + } + u8 getField_0x5E4() const { + return field_0x5E4; + } + void setField_0x5E4(u8 val) { + field_0x5E4 = val; + } + private: static dScBoot_c *sInstance; class strap_c { diff --git a/include/d/d_sc_game.h b/include/d/d_sc_game.h index 6c86c0db..69054716 100644 --- a/include/d/d_sc_game.h +++ b/include/d/d_sc_game.h @@ -31,8 +31,10 @@ class ScGameScreenTargeting : public ScGameScreen { public: ScGameScreenTargeting(u8 priority) : ScGameScreen(priority), mLetterboxAmount(0.0f) {} + f32 fn_801BBEC0() const; + private: - f32 mLetterboxAmount; + /* 0x98 */ f32 mLetterboxAmount; }; struct SpawnInfo { @@ -200,6 +202,10 @@ public: return mFader.isSettled(); } + f32 targetingScreenFn_801BBEC0() const { + return mScreen1.fn_801BBEC0(); + } + protected: static u32 sUpdateFrameCount; static u8 sCurrentLayer; @@ -252,7 +258,7 @@ protected: /* 0x0C4 */ LayoutArcControl mLayoutCtrl; /* 0x0D0 */ dFader_c mFader; - /* 0x0F8 */ ScGameScreenTargeting mScreen1; + /* 0x0F4 */ ScGameScreenTargeting mScreen1; /* 0x194 */ ScGameScreen mScreen2; /* 0x228 */ UNKWORD field_0x228; /* 0x22C */ u8 _0x22C[0x230 - 0x22C]; diff --git a/include/d/d_title_manager.h b/include/d/d_title_manager.h index 4d157e95..77c3d000 100644 --- a/include/d/d_title_manager.h +++ b/include/d/d_title_manager.h @@ -17,7 +17,18 @@ public: STATE_FUNC_DECLARE(dTitleMgr_c, FileSelect); STATE_FUNC_DECLARE(dTitleMgr_c, Input); + static dTitleMgr_c *GetInstance() { + return sInstance; + } + + u8 getField_0xBC() const { + return field_0xBC; + } + private: + static dTitleMgr_c *sInstance; + /* 0x68 */ u8 _0x68[0xBC - 0x68]; + /* 0xBC */ u8 field_0xBC; /* 0x??? */ STATE_MGR_DECLARE(dTitleMgr_c); }; diff --git a/include/d/lyt/d_lyt_map.h b/include/d/lyt/d_lyt_map.h index 652fcf4f..7a040021 100644 --- a/include/d/lyt/d_lyt_map.h +++ b/include/d/lyt/d_lyt_map.h @@ -276,6 +276,7 @@ public: void build(); + bool isNotInvisible() const; bool isOpenMaybe() const; bool fn_80139EA0() const; void lightPillarRelated(s32, s32, s32); @@ -392,10 +393,14 @@ public: return &sInstance->mResAcc; } - static dLytMap_c *getInstance() { + static dLytMap_c *GetInstance() { return sInstance; } + bool isNotInvisible() const { + return mMapMain.isNotInvisible(); + } + bool isOpenMaybe() const { return mMapMain.isOpenMaybe(); } diff --git a/include/d/lyt/d_lyt_system_window.h b/include/d/lyt/d_lyt_system_window.h index b0a3a6b6..ff1959a0 100644 --- a/include/d/lyt/d_lyt_system_window.h +++ b/include/d/lyt/d_lyt_system_window.h @@ -23,9 +23,11 @@ public: s32 getField_0xDE0() const; bool getField_0xDFC() const; + void fn_80152F10(); bool fn_80152F50() const; bool fn_80152F60() const; bool fn_80152F70() const; + bool fn_80152F80() const; private: static dLytSystemWindow_c *sInstance; diff --git a/include/d/snd/d_snd_player_mgr.h b/include/d/snd/d_snd_player_mgr.h index 7808092d..6bbf7fb0 100644 --- a/include/d/snd/d_snd_player_mgr.h +++ b/include/d/snd/d_snd_player_mgr.h @@ -23,6 +23,9 @@ public: public: dSndPlayerMgr_c(); + void setup(s32 channel); + void shutdown(s32 channel); + void shutdown(); void calc(); @@ -36,6 +39,13 @@ public: void enterHbm(); void leaveHbm(); + void fn_8035E1B0(u16); + bool fn_8035E220(); + void fn_8035E250(u16); + bool fn_8035E2E0(); + void fn_8035E310(); + void fn_8035E6E0(); + u32 getFreeSize(); bool loadDemoArchive(const char *demoArchiveName); const char *getSoundArchivePath(); diff --git a/include/d/snd/d_snd_source_if.h b/include/d/snd/d_snd_source_if.h index fa65be05..89486a81 100644 --- a/include/d/snd/d_snd_source_if.h +++ b/include/d/snd/d_snd_source_if.h @@ -25,7 +25,7 @@ public: SOUNDSOURCE_VIRTUAL(0x34); SOUNDSOURCE_VIRTUAL(0x38); SOUNDSOURCE_VIRTUAL(0x3C); - SOUNDSOURCE_VIRTUAL(0x40); + virtual void vt_0x40(s32) = 0; SOUNDSOURCE_VIRTUAL(0x44); virtual bool hasPlayingSounds() const = 0; // 0x48 virtual bool isPlayingSound(u32 soundId) = 0; // 0x4C diff --git a/include/egg/audio/eggAudioRmtSpeakerMgr.h b/include/egg/audio/eggAudioRmtSpeakerMgr.h index c9699e61..072fdc39 100644 --- a/include/egg/audio/eggAudioRmtSpeakerMgr.h +++ b/include/egg/audio/eggAudioRmtSpeakerMgr.h @@ -2,8 +2,8 @@ #define EGG_AUDIO_REMOTE_SPEAKER_MANAGER_H #include "common.h" -#include "rvl/WPAD.h" // IWYU pragma: export +#include "rvl/WPAD.h" // IWYU pragma: export namespace EGG { @@ -19,8 +19,8 @@ class AudioRmtSpeakerMgr { public: static void calc(); - static void fn_804B6D80(s32 i, WPADCallback *pCallback); - static void fn_804B6DE0(s32 i, WPADCallback *pCallback); + static void setup(s32 i, WPADCallback *pCallback); + static void shutdown(s32 i, WPADCallback *pCallback); static void connectAllByForce(); static void disconnectAllByForce(); diff --git a/include/egg/core/eggColorFader.h b/include/egg/core/eggColorFader.h index 2b8f609c..3b72c347 100644 --- a/include/egg/core/eggColorFader.h +++ b/include/egg/core/eggColorFader.h @@ -4,8 +4,8 @@ #include "common.h" #include "egg/core/eggFader.h" #include "egg/prim/eggBitFlag.h" -#include "nw4r/ut.h" +#include "nw4r/ut.h" namespace EGG { @@ -20,7 +20,7 @@ public: /* vt 0x14 */ virtual bool fadeOut(); /* vt 0x18 */ virtual bool calc(); /* vt 0x1C */ virtual void draw(); - /* vt 0x1C */ virtual ~ColorFader() {} + /* vt 0x20 */ virtual ~ColorFader() {} public: /* 0x04 */ EStatus mStatus; diff --git a/include/egg/core/eggController.h b/include/egg/core/eggController.h index e7d21300..e8414b13 100644 --- a/include/egg/core/eggController.h +++ b/include/egg/core/eggController.h @@ -2,107 +2,172 @@ #define EGG_CONTROLLER_H #include "common.h" +#include "egg/core/eggSingleton.h" #include "egg/math/eggMatrix.h" #include "egg/math/eggVector.h" #include "egg/prim/eggBitFlag.h" #include "egg/prim/eggBuffer.h" +#include "rvl/KPAD/KPAD.h" + #include "rvl/KPAD.h" // IWYU pragma: exports #include "rvl/PAD.h" // IWYU pragma: exports #include "rvl/WPAD.h" // IWYU pragma: exports - namespace EGG { class ControllerRumbleMgr; class CoreController; -// To Be Filled out enum eCoreDevType { + cDEV_CORE = WPAD_DEV_CORE, + cDEV_FREESTYLE = WPAD_DEV_FREESTYLE, + cDEV_CLASSIC = WPAD_DEV_CLASSIC, + + cDEV_MPLS = WPAD_DEV_MOTION_PLUS, + cDEV_MPLS_PT_FS = WPAD_DEV_MPLS_PT_FS, + + cDEV_FUTURE = WPAD_DEV_FUTURE, + cDEV_NOT_SUPPORTED = WPAD_DEV_NOT_SUPPORTED, + cDEV_NOT_FOUND = WPAD_DEV_NOT_FOUND, + cDEV_NULL = WPAD_DEV_NULL, + cDEV_UNKNOWN = WPAD_DEV_UNKNOWN, }; -typedef void (*ConnectCallback)(int args[]); -typedef class CoreController *(*ControllerFactory)(); +enum eCoreButton { + cCORE_BUTTON_UP = 1 << 3, + cCORE_BUTTON_DOWN = 1 << 2, + cCORE_BUTTON_LEFT = 1 << 0, + cCORE_BUTTON_RIGHT = 1 << 1, -class CoreStatus { + cCORE_BUTTON_PLUS = 1 << 4, + cCORE_BUTTON_MINUS = 1 << 12, + + cCORE_BUTTON_1 = 1 << 9, + cCORE_BUTTON_2 = 1 << 8, + + cCORE_BUTTON_A = 1 << 11, + cCORE_BUTTON_B = 1 << 10, + + cCORE_BUTTON_HOME = 1 << 15, + + cCORE_FSSTICK_UP = 1 << 16, + cCORE_FSSTICK_DOWN = 1 << 17, + cCORE_FSSTICK_LEFT = 1 << 18, + cCORE_FSSTICK_RIGHT = 1 << 19, + + cCORE_FSSTICK_BUTTONS = cCORE_FSSTICK_UP | cCORE_FSSTICK_DOWN | cCORE_FSSTICK_LEFT | cCORE_FSSTICK_RIGHT +}; + +typedef CoreController *(*CoreControllerFactory)(); + +struct CoreControllerConnectArg { + s32 chan; // at 0x0 + s32 result; // at 0x4 +}; + +typedef void (*CoreControllerConnectCallback)(const CoreControllerConnectArg &rArg); + +struct CoreControllerExtensionArg { + eCoreDevType newDevType; // at 0x0 + eCoreDevType oldDevType; // at 0x4 + s32 chan; // at 0x8 +}; + +class CoreControllerExtensionCallback { public: - /* 0x00 */ u32 mHold; - /* 0x04 */ u32 mTrig; - /* 0x08 */ u32 mRelease; - /* 0x0C */ Vector3f mAccel; - /* 0x18 */ u8 field_0x01[0x20 - 0x18]; - /* 0x20 */ f32 mDpdRawX; - /* 0x24 */ f32 mDpdRawY; - /* 0x28 */ u8 field_0x02[0x48 - 0x28]; - /* 0x48 */ f32 mDpdDistance; - /* 0x4C */ f32 float_0x4C; - /* 0x50 */ f32 float_0x50; - /* 0x54 */ f32 float_0x54; - /* 0x58 */ f32 float_0x58; - /* 0x5C */ u8 mDevType; - /* 0x5D */ u8 field_0x5D; - /* 0x5E */ s8 mDpdValid; - /* 0x5F */ s8 unknown; - /* 0x60 */ f32 mFSStickX; - /* 0x64 */ f32 mFSStickY; - /* 0x68 */ u8 field_0x03[0x88]; + virtual void onConnect(const CoreControllerExtensionArg &rArg); // at 0x8 +}; + +/****************************************************************************** + * + * CoreStatus + * + ******************************************************************************/ +class CoreStatus : public KPADStatus { + friend class CoreController; + +public: + CoreStatus() {} public: void init(); - u32 getFSStickButton() const; - f32 getFSStickX() const { - return mFSStickX; - } - f32 getFSStickY() const { - return mFSStickY; - } - bool down(u32 mask) const { - return (mask & mHold); - } - bool up(u32 mask) const { - return (mask & mHold) != mask; - } - bool downTrigger(u32 mask) const { - return (mask & mTrig); - } - bool upTrigger(u32 mask) const { - return (mask & mRelease); - } - bool downAll(u32 mask) const { - return (mask & mHold) == mask; - } - bool upAll(u32 mask) const { - return (mask & mHold) == 0; - } - - s32 getDevType() const { - return mDevType; - } - bool isCore() const { - return getDevType() == WPAD_DEV_CORE; - } - bool isFreestyle() const { - return getDevType() == WPAD_DEV_FS; - } u32 getHold() const { - return mHold; + return hold; + } + u32 getRelease() const { + return release; + } + u32 getTrigger() const { + return trig; } - s8 getDpdValidFlag() const { - return mDpdValid; - }; + bool down(u32 buttons) const { + return buttons & hold; + } + bool up(u32 buttons) const { + return (buttons & hold) != buttons; + } - Vector2f getUnk() { - return Vector2f(float_0x54, float_0x58); + bool downAll(u32 buttons) const { + return (buttons & hold) == buttons; + } + bool upAll(u32 buttons) const { + return (buttons & hold) == 0; + } + + bool downTrigger(u32 buttons) const { + return buttons & trig; + } + bool upTrigger(u32 buttons) const { + return buttons & release; } const Vector3f &getAccel() const { - return mAccel; + return *reinterpret_cast(&acc); } -}; + Vector3f getAccelBad() const { + return Vector3f(acc.x, acc.y, acc.z); + } + Vector2f getAccelVertical() { + return Vector2f(acc_vertical.x, acc_vertical.y); + } + + eCoreDevType getDevType() const { + return static_cast(dev_type); + } + + bool isCore() const { + return getDevType() == cDEV_CORE || isFreestyle(); + } + bool isFreestyle() const { + return getDevType() == cDEV_FREESTYLE; + } + + s8 getDPDValidFlag() const { + return dpd_valid_fg; + } + + f32 getFSStickX() const { + return ex_status.fs.stick.x; + } + f32 getFSStickY() const { + return ex_status.fs.stick.y; + } + + u32 getFSStickButton(); +}; +/****************************************************************************** + * + * CoreController + * + ******************************************************************************/ class CoreController { + friend class CoreControllerMgr; + public: + CoreController(); // vtable 0x0000 /* vt 0x08 */ virtual void setPosParam(f32 f1, f32 f2) { KPADSetPosParam(mChannelID, f1, f2); @@ -116,86 +181,151 @@ public: /* vt 0x14 */ virtual void setAccParam(f32 f1, f32 f2) { KPADSetAccParam(mChannelID, f1, f2); } - /* vt 0x18 */ virtual bool down(u32 mask) const { - return mCoreStatus[0].down(mask); + /* vt 0x18 */ virtual bool down(u32 buttons) const { + return mCoreStatus[0].down(buttons); } - /* vt 0x1C */ virtual bool up(u32 mask) const { - return mCoreStatus[0].up(mask); + /* vt 0x1C */ virtual bool up(u32 buttons) const { + return mCoreStatus[0].up(buttons); } - /* vt 0x20 */ virtual bool downTrigger(u32 mask) const { - return mCoreStatus[0].downTrigger(mask); + /* vt 0x20 */ virtual bool downTrigger(u32 buttons) const { + return mCoreStatus[0].downTrigger(buttons); } - /* vt 0x24 */ virtual bool upTrigger(u32 mask) const { - return mCoreStatus[0].upTrigger(mask); + /* vt 0x24 */ virtual bool upTrigger(u32 buttons) const { + return mCoreStatus[0].upTrigger(buttons); } - /* vt 0x28 */ virtual bool downAll(u32 mask) const { - return mCoreStatus[0].downAll(mask); + /* vt 0x28 */ virtual bool downAll(u32 buttons) const { + return mCoreStatus[0].downAll(buttons); } - /* vt 0x2C */ virtual bool upAll(u32 mask) const { - return mCoreStatus[0].upAll(mask); + /* vt 0x2C */ virtual bool upAll(u32 buttons) const { + return mCoreStatus[0].upAll(buttons); } /* vt 0x30 */ virtual void beginFrame(PADStatus *padStatus); /* vt 0x34 */ virtual void endFrame(); -public: - /* 0x004 */ s32 mChannelID; - /* 0x008 */ u32 mButtonHeld; - /* 0x00C */ u32 mButtonTriggered; - /* 0x010 */ u32 mButtonReleased; - /* 0x014 */ u32 field_0x14; - /* 0x018 */ CoreStatus mCoreStatus[16]; - /* 0xf18 */ int mReadStatusIdx; - /* 0xf1c */ TBitFlag mFlag; - /* 0xf20 */ Vector3f mAccel; - /* 0xf2c */ Vector2f mDpdPos; - /* 0xf34 */ u32 mIdleTime; - /* 0xf38 */ u32 mMotorPattern; - /* 0xf3c */ bool mEnableMotor; - /* 0xf40 */ s32 mMotorFrameDuration; - /* 0xf44 */ u8 mMotorPatternLength; - /* 0xf45 */ u8 mMotorPatternPos; - /* 0xf48 */ ControllerRumbleMgr *mRumbleMgr; - /* 0xf4c */ Matrix34f mPostureMatrix; - /* 0xf7c */ Matrix34f mPostureMatrixPrev; - /* 0xfac */ TBitFlag mAccelFlags; // May not be TBitFlag? - /* 0xfb0 */ s32 mMaxAccelFrameTime; - /* 0xfb4 */ s32 mAccelFrameTime[3]; - /* 0xfc0 */ f32 mMaxAccelDiff; - /* 0xfc4 */ Vector3f mPrevAccel; - -public: - CoreController(); - void sceneReset(); Vector2f getDpdRawPos(); f32 getDpdDistance(); - s32 getDpdValidFlag(); // Name Assumed. BBA hints at variable - void startMotor(); - void stopMotor(); - void createRumbleMgr(u8); - void startPatternRumble(const char *, int, bool); - void stopRumbleMgr(); - CoreStatus *getCoreStatus(int idx); - void calc_posture_matrix(Matrix34f &mat, bool); + s32 getDpdValidFlag(); f32 getFreeStickX() const; f32 getFreeStickY() const; + s32 getChannelID() const { + return mChannelID; + } + const Vector3f &getAccel() const { return mCoreStatus[0].getAccel(); } - - // Guess ? - bool isStable(u8 p1) const { - return (mAccelFlags.getDirect() & p1) == p1; + Vector3f getAccelBad() const { + return mCoreStatus[0].getAccelBad(); } + + eCoreDevType getDevType() const { + return mCoreStatus[0].getDevType(); + } + + bool isCore() const { + return mCoreStatus[0].isCore(); + } + bool isFreestyle() const { + return mCoreStatus[0].isFreestyle(); + } + u32 getHold() const { + return mCoreStatus[0].hold; + } + + s32 getReadLength() const { + return mKPADReadLength; + } + + bool isStable(u8 bits) const { + return (mStableFlags & bits) == bits; + } + + void setStableFrame(int frame) { + mStableFrame = frame; + } + void setStableMag(f32 mag) { + mStableMag = mag; + } + void sceneReset(); + + void startMotor(); + void stopMotor(); + + void createRumbleMgr(u8 overlap_num); + void startPatternRumble(const char *pPattern, int frame, bool force); + void startPowerFrameRumble(f32 power, int frame, bool force); + void stopRumbleMgr(); + + bool isConnected() const { + return mFlag.onBit(0); + } + + CoreStatus *getCoreStatus(int idx); + CoreStatus *getCoreStatus() { + return mCoreStatus; + } + +private: + enum StableAxis { + STABLE_AXIS_X, + STABLE_AXIS_Y, + STABLE_AXIS_Z, + + STABLE_AXIS_MAX + }; + + enum StableFlag { + STABLE_FLAG_X = 1 << STABLE_AXIS_X, + STABLE_FLAG_Y = 1 << STABLE_AXIS_Y, + STABLE_FLAG_Z = 1 << STABLE_AXIS_Z, + + STABLE_FLAG_XYZ = STABLE_FLAG_X | STABLE_FLAG_Y | STABLE_FLAG_Z + }; + +private: + void calc_posture_matrix(Matrix34f &rPostureMtx, bool checkStable); + +private: + /* 0x004 */ s32 mChannelID; + + /* 0x008 */ u32 mFSStickHold; + /* 0x00C */ u32 mFSStickTrig; + /* 0x010 */ u32 mFSStickRelease; + /* 0x014 */ u32 field_0x14; + + /* 0x018 */ CoreStatus mCoreStatus[16]; + /* 0xf18 */ int mKPADReadLength; + + /* 0xf1c */ TBitFlag mFlag; + /* 0xf20 */ Vector3f mAccelPrev; + /* 0xf2c */ Vector2f mDpdPosPrev; + /* 0xf34 */ u32 mIdleTime; + + /* 0xf38 */ u32 mSimpleRumblePattern; + /* 0xf3c */ bool mEnableSimpleRumble; + /* 0xf40 */ s32 mSimpleRumbleFrame; + /* 0xf44 */ u8 mSimpleRumbleSize; + /* 0xf45 */ u8 mSimpleRumbleIndex; + /* 0xf48 */ ControllerRumbleMgr *mRumbleMgr; + + /* 0xf4c */ Matrix34f mPostureMatrix; + /* 0xf7c */ Matrix34f mPostureMatrixPrev; + + /* 0xfac */ u8 mStableFlags; // May not be TBitFlag? + /* 0xfb0 */ s32 mStableFrame; + /* 0xfb4 */ s32 mStableTimer[3]; + /* 0xfc0 */ f32 mStableMag; + /* 0xfc4 */ Vector3f mStableAccel; }; +/****************************************************************************** + * + * CoreControllerMgr + * + ******************************************************************************/ class CoreControllerMgr { -public: - struct T__Disposer : Disposer { - /* vt 0x08 */ virtual ~T__Disposer(); - static T__Disposer *sStaticDisposer; - }; - /* 0x0000 */ T__Disposer mDisposer; + EGG_SINGLETON_DECL(CoreControllerMgr); struct UnkField0x10A0 { virtual void v_08(UNKTYPE *); @@ -206,81 +336,130 @@ public: /* vt 0x08 */ virtual void beginFrame(); /* vt 0x0C */ virtual void endFrame(); -public: + CoreController *getNthController(int index); + + eCoreDevType getDevType(const int i) const { + return mDevTypes(i); + } + + static void setConnectCallback(CoreControllerConnectCallback cb) { + sConnectCallback = cb; + } + +private: + CoreControllerMgr(); + + static void *allocThunk(size_t size); + static int deleteThunk(void *ptr); + static void connectCallback(s32, s32); + +private: /* 0x0014 */ TBuffer mControllers; /* 0x0020 */ u8 field_0x20[0x10a0 - 0x0020]; /* 0x10A0 */ UnkField0x10A0 *field_0x10A0; /* 0x10A4 */ TBuffer mDevTypes; /* 0x10b0 */ u8 field_0x10B0[0x10e0 - 0x10b0]; -public: - static CoreControllerMgr *createInstance(); - static void deleteInstance(); - CoreController *getNthController(int); - - static void *allocThunk(size_t size); - static int deleteThunk(void *ptr); - - static void connectCallback(s32, s32); - CoreControllerMgr(); - -public: - static CoreControllerMgr *sInstance; - static CoreController *(*sCoreControllerFactory)(); - static ConnectCallback sConnectCallback; + static CoreControllerFactory sCoreControllerFactory; + static CoreControllerConnectCallback sConnectCallback; static bool sUseBuiltinWpadAllocator; static s32 sWPADWorkSize; }; +/****************************************************************************** + * + * NullController + * + ******************************************************************************/ class NullController : public CoreController { public: NullController() { unk[92] = 0xfe; } + +private: // idk this has NO effect on anything u8 unk[0x80674c00 - 0x80674b10]; }; +/****************************************************************************** + * + * ControllerRumbleUnit + * + ******************************************************************************/ class ControllerRumbleUnit { + friend class ControllerRumbleMgr; + public: // 0x00 vtable - inline ControllerRumbleUnit() : mFlag(0) { + ControllerRumbleUnit() : mFlags(0) { init(); } /* vt 0x08 */ virtual ~ControllerRumbleUnit() {} -public: - /* 0x04 */ const char *mPattern; - /* 0x08 */ const char *mPatternPos; - /* 0x0C */ s32 mTimer; // guess - /* 0x10 */ f32 mRampUp; // guess - /* 0x14 */ f32 mIntensity; // guess - /* 0x18 */ TBitFlag mFlag; - /* 0x1C */ nw4r::ut::Node mNode; - /* 0x24 */ u32 field_0x24; // could just be part of the node (List) -public: - void init(); - void startPattern(const char *patter, int); + void startPattern(const char *pPattern, int frame); + f32 calc(); + +private: + enum { + BIT_USE_PATTERN, + BIT_USE_POWER, + + BIT_POWER_LOOP, + BIT_ENABLED, + BIT_PATTERN_LOOP, + BIT_PATTERN_TIMER, + }; + +private: + void init(); + + void setFlags(u8 bit) { + mFlags.setBit(bit); + } + void clrFlags(u8 bit) { + mFlags.resetBit(bit); + } + bool tstFlags(u8 bit) { + return mFlags.onBit(bit); + } + +private: + /* 0x04 */ const char *mRumblePattern; + /* 0x08 */ const char *mRumblePatternPtr; + /* 0x0C */ s32 mRumbleFrame; + /* 0x10 */ f32 mRumblePower; + /* 0x14 */ f32 mRumbleValue; + /* 0x18 */ TBitFlag mFlags; + /* 0x1C */ nw4r::ut::Node mNode; + /* 0x24 */ u32 field_0x24; }; +/****************************************************************************** + * + * ControllerRumbleMgr + * + ******************************************************************************/ class ControllerRumbleMgr { -public: - // 0x00 vtable - /* vt 0x08 */ virtual ~ControllerRumbleMgr() {} - -public: - /* 0x04 */ nw4r::ut::List mActiveUnitList; - /* 0x10 */ nw4r::ut::List mInactiveUnitList; - /* 0x1C */ CoreController *mController; - public: ControllerRumbleMgr(); - void createUnit(u8 numUnits, CoreController *controller); + virtual ~ControllerRumbleMgr() {} // at 0x8 + + void createUnit(u8 overlap_num, CoreController *pController); + void stop(); void calc(); + void startPattern(const char *pattern, int, bool); + +private: ControllerRumbleUnit *getUnitFromList(bool bGrabActive); + +private: + /* 0x04 */ nw4r::ut::List mActiveUnitList; + /* 0x10 */ nw4r::ut::List mStoppedUnitList; + /* 0x1C */ CoreController *mController; }; } // namespace EGG diff --git a/include/egg/core/eggSingleton.h b/include/egg/core/eggSingleton.h new file mode 100644 index 00000000..a9b4817f --- /dev/null +++ b/include/egg/core/eggSingleton.h @@ -0,0 +1,55 @@ +#ifndef EGG_CORE_SINGLETON_H +#define EGG_CORE_SINGLETON_H + +#include "egg/core/eggDisposer.h" +#include "egg/prim/eggAssert.h" + +/** + * @brief Declares functions and data for a disposable singleton class + */ +#define EGG_SINGLETON_DECL(T) \ +protected: \ + class T__Disposer : public EGG::Disposer { \ + public: \ + virtual ~T__Disposer(); /* at 0x8 */ \ + static T__Disposer *sStaticDisposer; \ + }; \ + \ + T__Disposer mDisposer; \ + \ +public: \ + static T *createInstance(); \ + static void deleteInstance(); \ + \ + static T *instance() { \ + return sInstance; \ + } \ + \ +protected: \ + static T *sInstance; + +/** + * @brief Defines functions and data for a disposable singleton class + */ +#define EGG_SINGLETON_IMPL(T) \ + T::T__Disposer::~T__Disposer() { \ + T::deleteInstance(); \ + } \ + \ + T *T::createInstance() { \ + if (sInstance == NULL) { \ + sInstance = new T(); \ + } else { \ + EGG_ASSERT_MSG(false, "Create Singleton Twice (%s) : addr %x\n", #T, sInstance); \ + } \ + \ + return sInstance; \ + } \ + \ + void T::deleteInstance() { \ + sInstance = NULL; \ + } \ + \ + T *T::sInstance = NULL; + +#endif diff --git a/include/egg/math/eggVector.h b/include/egg/math/eggVector.h index 34ccb324..d6ce59aa 100644 --- a/include/egg/math/eggVector.h +++ b/include/egg/math/eggVector.h @@ -122,7 +122,7 @@ struct Vector3f : public nw4r::math::VEC3 { return Vector3f(-x, -y, -z); } - void set(const EGG::Vector3f& other) { + void set(const EGG::Vector3f &other) { x = other.x; y = other.y; z = other.z; @@ -132,7 +132,9 @@ struct Vector3f : public nw4r::math::VEC3 { return squaredLength() <= Math::epsilon(); } - void setZero() { x = y = z = 0.0f; }; + void setZero() { + x = y = z = 0.0f; + }; f32 normalise(); @@ -169,6 +171,9 @@ public: Vector2f operator-(const Vector2f &v) { return Vector2f(x - v.x, y - v.y); } + f32 length() const { + return Math::sqrt(squaredLength()); + } f32 squaredLength() const { return (x * x + y * y); } diff --git a/include/egg/prim/eggAssert.h b/include/egg/prim/eggAssert.h index 590919df..61afd754 100644 --- a/include/egg/prim/eggAssert.h +++ b/include/egg/prim/eggAssert.h @@ -9,8 +9,23 @@ namespace EGG { // TODO: Fixup funtions namespace Assert { -typedef void (*AssertCallback)(); +#if 1 +#define EGG_ASSERT(EXP) +#define EGG_ASSERT_MSG(EXP, ...) +#define EGG_PRINT(...) +#else +#define EGG_ASSERT(EXP) \ + if (!(EXP)) \ + system_halt(__FILE__, __LINE__, #EXP) +#define EGG_ASSERT_MSG(EXP, ...) \ + if (!(EXP)) \ + system_halt(__FILE__, __LINE__, __VA_ARGS__) + +#define EGG_PRINT(...) system_print(true, __FILE__, __VA_ARGS__) +#endif + +typedef void (*AssertCallback)(); void wait(u32 time); void system_vreport(const char *str, va_list list); void system_report(const char *str, ...); diff --git a/include/egg/prim/eggBuffer.h b/include/egg/prim/eggBuffer.h index b9bfa01b..49be7862 100644 --- a/include/egg/prim/eggBuffer.h +++ b/include/egg/prim/eggBuffer.h @@ -3,68 +3,131 @@ #include "common.h" #include "egg/core/eggHeap.h" - +#include "egg/prim/eggAssert.h" namespace EGG { template class TBuffer { public: - // vtable 0x00 - /* vt 0x08 */ virtual ~TBuffer() { - if (mBuffer != nullptr) { - delete[] mBuffer; - mBuffer = nullptr; + class iterator { + public: + iterator(TBuffer *pBuffer, int index) : mBuffer(pBuffer), mIndex(index) {} + + int get_index() const { + return mIndex; } - } - /* vt 0x0C */ virtual void allocate(int n, int); - /* vt 0x10 */ virtual void allocate(int n, Heap *heap, int); - /* vt 0x14 */ virtual void onAllocate(Heap *) { - return; - } - /* vt 0x18 */ virtual void errRangeOver() { - return; - } + + iterator &operator++() { + mIndex++; + return *this; + } + + T &operator*() { + return (*mBuffer)(mIndex); + } + + friend bool operator==(const iterator &rLhs, const iterator &rRhs) { + return rLhs.mBuffer == rRhs.mBuffer && rLhs.mIndex == rRhs.mIndex; + } + friend bool operator!=(const iterator &rLhs, const iterator &rRhs) { + return !(rLhs == rRhs); + } + + private: + TBuffer *mBuffer; // at 0x0 + int mIndex; // at 0x4 + }; public: - /* 0x08 */ s32 mSize; - /* 0x0C */ T *mBuffer; + TBuffer() : mSize(0), mBuffer(NULL) {} -public: - inline TBuffer() : mSize(0), mBuffer(nullptr) {} - - inline bool isRangeValid(int i) { - return (i >= 0 && i < mSize); - } - inline void checkRange(int i) { - if (!isRangeValid(i)) { - errRangeOver(); + virtual ~TBuffer() { + if (mBuffer == NULL) { + return; } - } - inline T &operator()(int i) { + + delete[] mBuffer; + mBuffer = NULL; + } // at 0x8 + + virtual void allocate(int size, int align = 0); // at 0xC + + virtual void allocate(int size, Heap *pHeap, int align = 0); // at 0x10 + + virtual void onAllocate(Heap * /* pHeap */) {} // at 0x14 + virtual void errRangeOver() const {} // at 0x18 + + T &operator()(int i) { checkRange(i); return mBuffer[i]; } - inline s32 getSize() { + const T &operator()(int i) const { + checkRange(i); + return mBuffer[i]; + } + + T &get(int i) { + checkRange(i); + return mBuffer[i]; + } + const T &get(int i) const { + checkRange(i); + return mBuffer[i]; + } + + int getSize() const { return mSize; } + int size() const { + return mSize; + } + + iterator begin() { + return iterator(this, 0); + } + iterator end() { + return iterator(this, getSize()); + } + +private: + void flush() {} + + void checkRange(int i) const { + if (!isRangeValid(i)) { + errRangeOver(); +#line 174 + EGG_ASSERT_MSG(false, "TBuffer::checkRange %d (0<=x<%d)\n", i, mSize); + } + } + + bool isRangeValid(int i) const { + return 0 <= i && i < mSize; + } + +private: + int mSize; // at 0x4 + T *mBuffer; // at 0x8 }; template -void TBuffer::allocate(int n, int) { - mSize = n; - mBuffer = new T[n]; +void TBuffer::allocate(int size, int) { + mSize = size; + mBuffer = new T[size]; onAllocate(nullptr); } - template -void TBuffer::allocate(int n, Heap *heap, int) { - mSize = n; - if (heap == nullptr) { - heap = Heap::sCurrentHeap; +void TBuffer::allocate(int size, Heap *pHeap, int) { + mSize = size; + + if (pHeap == NULL) { + pHeap = Heap::getCurrentHeap(); } - mBuffer = new (heap, 4) T[mSize]; - onAllocate(heap); + + mBuffer = new (pHeap) T[mSize]; + + flush(); + onAllocate(pHeap); } } // namespace EGG diff --git a/include/m/m3d/m_anmchr.h b/include/m/m3d/m_anmchr.h index 2ff01dd7..02bef1ca 100644 --- a/include/m/m3d/m_anmchr.h +++ b/include/m/m3d/m_anmchr.h @@ -4,6 +4,7 @@ #include "common.h" #include "m/m3d/m_bmdl.h" #include "m/m3d/m_fanm.h" +#include "nw4r/g3d/g3d_anmchr.h" #include "nw4r/g3d/res/g3d_resanmchr.h" namespace m3d { diff --git a/include/m/m3d/m_mdl.h b/include/m/m3d/m_mdl.h index a0833038..90ec1ea2 100644 --- a/include/m/m3d/m_mdl.h +++ b/include/m/m3d/m_mdl.h @@ -1,6 +1,7 @@ #ifndef M3D_M_MDL_H #define M3D_M_MDL_H +#include "common.h" #include "m/m3d/m_banm.h" #include "m/m3d/m_calc_ratio.h" #include "m/m3d/m_smdl.h" @@ -59,6 +60,9 @@ public: virtual ~mdl_c(); bool create(nw4r::g3d::ResMdl, mAllocator_c *, u32, int, u32 *); + bool create(nw4r::g3d::ResMdl mdl, mAllocator_c *alloc, u32 flag, int num) { + return create(mdl, alloc, flag, num, nullptr); + } bool create(nw4r::g3d::ResMdl, mdlCallback_c *cb, mAllocator_c *, u32, int, u32 *); virtual void remove() override; diff --git a/include/m/m_angle.h b/include/m/m_angle.h index 0bf080f4..d850b1f3 100644 --- a/include/m/m_angle.h +++ b/include/m/m_angle.h @@ -82,11 +82,6 @@ struct mAng { return mVal * sAngToDeg; } - static s16 angle(const mVec3_c &a, const mVec3_c &b) { - f32 rads = a.angle(b); - return fromRad(rads); - } - f32 radian() const { return ((2.f * M_PI) / 65536.0f) * mVal; } diff --git a/include/m/m_fader.h b/include/m/m_fader.h index 2d8c1189..afa508d7 100644 --- a/include/m/m_fader.h +++ b/include/m/m_fader.h @@ -28,9 +28,16 @@ public: mpFader->setStatus(status); } + void fadeIn() { + mpFader->fadeIn(); + } bool calc() { return mpFader->calc(); } + void setFrame(u16 frame) { + mpFader->setFrame(frame); + } + protected: mFaderBase_c *mpFader; }; diff --git a/include/m/m_pad.h b/include/m/m_pad.h index a6dae38e..07f172cb 100644 --- a/include/m/m_pad.h +++ b/include/m/m_pad.h @@ -10,10 +10,51 @@ extern int g_currentCoreId; extern EGG::CoreController *g_currentCore; extern EGG::CoreController *g_core[4]; +enum Button { + BUTTON_LEFT = 0x1, + BUTTON_RIGHT = 0x2, + BUTTON_DOWN = 0x4, + BUTTON_UP = 0x8, + BUTTON_PLUS = 0x10, + BUTTON_2 = 0x100, + BUTTON_1 = 0x200, + BUTTON_B = 0x400, + BUTTON_A = 0x800, + BUTTON_MINUS = 0x1000, + BUTTON_Z = 0x2000, + BUTTON_C = 0x4000, +}; + +inline EGG::CoreController *getCore(const int i) { + return g_core[i]; +} +inline void stopRumbleMgr(int i) { + g_core[i]->stopRumbleMgr(); +} +inline EGG::CoreController *getCore() { + return g_currentCore; +} +inline EGG::CoreControllerMgr *getMgr() { + return g_padMg; +} +inline int getCurrentCoreID() { + return g_currentCoreId; +} + +inline bool isMpls(const int i) { + return g_padMg->getDevType(i) == EGG::cDEV_MPLS; +} +inline bool isMplsPtFS(const int i) { + return g_padMg->getDevType(i) == EGG::cDEV_MPLS_PT_FS; +} + +// Defined in dPad, referenced in both mPad and dPad +extern "C" void async_info_callback(s32 chan, s32 result); + void create(); void beginPad(); void endPad(); -} // namespace mPad +}; // namespace mPad #endif diff --git a/include/m/m_vec.h b/include/m/m_vec.h index 1aafe812..c540f470 100644 --- a/include/m/m_vec.h +++ b/include/m/m_vec.h @@ -216,7 +216,7 @@ public: return x != v.x || y != v.y || z != v.z; } - void normalize(); + f32 normalize(); bool normalizeRS(); static mVec3_c createProjectionXZ(const mAng3_c &ang, f32 scalar); @@ -243,7 +243,9 @@ public: void rotY(const mAng &angle); void rotZ(const mAng &angle); - void CopyTo(nw4r::math::VEC3 *p) const { + void fromXY(const mAng &angleX, const mAng &angleY, f32); + + void CopyTo(Vec *p) const { p->x = x; p->y = y; p->z = z; @@ -269,6 +271,10 @@ public: return cM::atan2s(-y, absXZ()); } + f32 angle(const mVec3_c &other) const { + return EGG::Vector3f::angle(other); + } + static mVec3_c Zero; static mVec3_c Ex; static mVec3_c Ey; @@ -280,13 +286,32 @@ public: mVec2_c() {} ~mVec2_c() {} + /// @brief Assignment operator + mVec2_c &operator=(const mVec2_c &r) { + set(r.x, r.y); + return *this; + } + mVec2_c(const mVec2_c &other) { set(other.x, other.y); } - + mVec2_c(const EGG::Vector2f &other) { + set(other.x, other.y); + } mVec2_c(f32 fx, f32 fy) { set(fx, fy); } + s16 ang() const { + return cM::atan2s(x, y); + } + + mVec2_c operator*(f32 f) const { + return mVec2_c(x * f, y * f); + } + + mVec2_c operator+(const mVec2_c &v) const { + return mVec2_c(x + v.x, y + v.y); + } }; #endif diff --git a/include/rvl/DVD/dvd.h b/include/rvl/DVD/dvd.h index 9c7a27b2..fbed2577 100644 --- a/include/rvl/DVD/dvd.h +++ b/include/rvl/DVD/dvd.h @@ -22,30 +22,29 @@ typedef enum { DVD_RESULT_OK, } DVDResult; -#define DVD_ESUCCESS DVD_RESULT_OK -#define DVD_EFATAL DVD_RESULT_FATAL -#define DVD_ECANCELED DVD_RESULT_CANCELED -#define DVD_ECOVER DVD_RESULT_COVER_CLOSED +#define DVD_ESUCCESS DVD_RESULT_OK +#define DVD_EFATAL DVD_RESULT_FATAL +#define DVD_ECANCELED DVD_RESULT_CANCELED +#define DVD_ECOVER DVD_RESULT_COVER_CLOSED typedef long DVDState; -enum DVDState_et -{ - DVD_STATE_IDLE = 0, +enum DVDState_et { + DVD_STATE_IDLE = 0, - DVD_STATE_BUSY = 1, - DVD_STATE_WAITING = 2, - DVD_STATE_COVER_CLOSED = 3, - DVD_STATE_NO_DISK = 4, - DVD_STATE_COVER_OPENED = 5, - DVD_STATE_WRONG_DISK_ID = 6, - DVD_STATE_7 = 7, - DVD_STATE_PAUSED = 8, - DVD_STATE_9 = 9, - DVD_STATE_CANCELED = 10, - DVD_STATE_DISK_ERROR = 11, - DVD_STATE_MOTOR_STOPPED = 12, + DVD_STATE_BUSY = 1, + DVD_STATE_WAITING = 2, + DVD_STATE_COVER_CLOSED = 3, + DVD_STATE_NO_DISK = 4, + DVD_STATE_COVER_OPENED = 5, + DVD_STATE_WRONG_DISK_ID = 6, + DVD_STATE_7 = 7, + DVD_STATE_PAUSED = 8, + DVD_STATE_9 = 9, + DVD_STATE_CANCELED = 10, + DVD_STATE_DISK_ERROR = 11, + DVD_STATE_MOTOR_STOPPED = 12, - DVD_STATE_FATAL = -1, + DVD_STATE_FATAL = -1, }; typedef enum { @@ -110,6 +109,7 @@ s32 DVDGetDriveStatus(void); void DVDPause(void); void DVDResume(void); BOOL DVDCancelAsync(DVDCommandBlock *block, DVDCommandCallback callback); +BOOL DVDCheckDiskAsync(DVDCommandBlock *block, DVDAsyncCallback callback); s32 DVDCancel(DVDCommandBlock *block); BOOL DVDCancelAllAsync(DVDCommandCallback callback); const DVDDiskID *DVDGetCurrentDiskID(void); diff --git a/include/rvl/GX/GXFifo.h b/include/rvl/GX/GXFifo.h index 6dd6af76..46b47372 100644 --- a/include/rvl/GX/GXFifo.h +++ b/include/rvl/GX/GXFifo.h @@ -2,6 +2,7 @@ #define RVL_SDK_GX_FIFO_H #include "common.h" #include "rvl/GX/GXInternal.h" +#include "rvl/OS/OSThread.h" #ifdef __cplusplus extern "C" { @@ -15,6 +16,10 @@ BOOL GXGetCPUFifo(GXFifoObj *); u32 GXGetFifoCount(GXFifoObj *); u8 GXGetFifoWrap(GXFifoObj *); +// IDK where this goes +OSThread *GXSetCurrentGXThread(); +OSThread *GXGetCurrentGXThread(); +void GXSetDrawDoneCallback(void *); #ifdef __cplusplus } #endif diff --git a/include/rvl/KPAD/KPAD.h b/include/rvl/KPAD/KPAD.h index 1efeeb3e..79b733d9 100644 --- a/include/rvl/KPAD/KPAD.h +++ b/include/rvl/KPAD/KPAD.h @@ -1,27 +1,141 @@ #ifndef REVOSDK_KPAD_H #define REVOSDK_KPAD_H -#ifdef __cplusplus + #include "common.h" +#include "rvl/WPAD/WPAD.h" + +#include "rvl/MTX.h" + +#ifdef __cplusplus extern "C" { #endif -typedef struct { - // TODO +#define KPAD_MAX_SAMPLES 16 + +typedef union KPADEXStatus { + struct { + Vec2 stick; // at 0x0 + Vec acc; // at 0x8 + f32 acc_value; // at 0x14 + f32 acc_speed; // at 0x18 + } fs; // at 0x0 + + struct { + u32 hold; // at 0x0 + u32 trig; // at 0x4 + u32 release; // at 0x8 + Vec2 lstick; // at 0xC + Vec2 rstick; // at 0x14 + f32 ltrigger; // at 0x1C + f32 rtrigger; // at 0x20 + } cl; // at 0x0 + + struct { + f64 tgc_weight; // at 0x0 + f64 weight[4]; // at 0x8 + f64 weight_ave[4]; // at 0x28 + s32 weight_err; // at 0x48 + s32 tgc_weight_err; // at 0x4C + } bl; // at 0x0 +} KPADEXStatus; + +typedef struct KPADStatus { + u32 hold; // at 0x0 + u32 trig; // at 0x4 + u32 release; // at 0x8 + Vec acc; // at 0xC + f32 acc_value; // at 0x18 + f32 acc_speed; // at 0x1C + Vec2 pos; // at 0x20 + Vec2 vec; // at 0x28 + f32 speed; // at 0x30 + Vec2 horizon; // at 0x34 + Vec2 hori_vec; // at 0x3C + f32 hori_speed; // at 0x44 + f32 dist; // at 0x48 + f32 dist_vec; // at 0x4C + f32 dist_speed; // at 0x50 + Vec2 acc_vertical; // at 0x54 + u8 dev_type; // at 0x5C + s8 wpad_err; // at 0x5D + s8 dpd_valid_fg; // at 0x5E + u8 data_format; // at 0x5F + KPADEXStatus ex_status; // at 0x60 + Vec mpls_rot; // at 0xB0 // made up + Vec field_0xBC; // at 0xBC // made up + Vec mpls_basis_x; // at 0xC8 // made up + Vec mpls_basis_y; // at 0xD4 // made up + Vec mpls_basis_z; // at 0xE0 // made up + UNKWORD field_0xEC; } KPADStatus; -typedef void (*KPADConnectCallback)(s32, s32); -// TODO: Create Proper Headers -void KPADInitEx(void * /* UNKTYPE */, u32); +typedef struct KPADUnifiedWpadStatus { + union { + WPADStatus core; + WPADFSStatus fs; + WPADCLStatus cl; + WPADTRStatus tr; + WPADBLStatus bl; + struct { + u8 _[0x40]; + } unk; + } u; // at 0x0 + u8 fmt; // 0x36; + u8 padding; // 0x37; -s32 KPADRead(s32 chan, UNKTYPE *status, s32); -s32 KPADReadEx(s32 chan, UNKTYPE *status, s32, s32 *); +} KPADUnifiedWpadStatus; + +typedef void (*KPADConnectCallback)(s32, s32); void KPADSetConnectCallback(u32, KPADConnectCallback); -void KPADSetPosParam(u32, f32, f32); -void KPADSetHoriParam(u32, f32, f32); -void KPADSetDistParam(u32, f32, f32); -void KPADSetAccParam(u32, f32, f32); +void KPADSetPosParam(s32 chan, f32 playRadius, f32 sensitivity); +void KPADSetHoriParam(s32 chan, f32 playRadius, f32 sensitivity); +void KPADSetDistParam(s32 chan, f32 playRadius, f32 sensitivity); +void KPADSetAccParam(s32 chan, f32 playRadius, f32 sensitivity); + +s32 KPADRead(s32 chan, KPADStatus *pSamples, s32 numSamples); +s32 KPADReadEx(s32 chan, UNKTYPE *status, s32, s32 *); + +void KPADGetUnifiedWpadStatus(s32 chan, KPADUnifiedWpadStatus *pStatus, int); + +void KPADInit(void); +void KPADInitEx(void * /* UNKTYPE */, u32); + +void KPADSetBtnRepeat(s32 chan, f32, f32); +void KPADSetReviseMode(s32 chan, s32); + +void KPADEnableMpls(s32 chan, s32); +void KPADDisableMpls(s32 chan); + +void KPADStartMplsCalibration(s32 chan); +f32 KPADWorkMplsCalibration(s32 chan); +void KPADStopMplsCalibration(s32 chan); + +s32 KPADGetMplsWorkSize(); +void KPADSetMplsWorkarea(void *); +void KPADSetControlMplsCallback(s32 chan, KPADConnectCallback cb); +void KPADResetMpls(s32 chan); +void KPADDisableMplsZeroPlay(s32 chan); +void KPADSetMplsZeroPlayParam(s32 chan, f32); +void KPADSetMplsZeroDriftMode(s32 chan, s32); +void KPADEnableMplsDirRevise(s32 chan); +void KPADDisableMplsDirRevise(s32 chan); +void KPADSetMplsDirReviseParam(s32 chan, f32); + +void KPADEnableMplsAccRevise(s32 chan); +void KPADDisableMplsAccRevise(s32 chan); +void KPADSetMplsAccReviseParam(s32 chan, f32, f32); + +void KPADEnableMplsDpdRevise(s32 chan); +f32 KPADIsEnableMplsDpdRevise(s32 chan); +void KPADDisableMplsDpdRevise(s32 chan); +void KPADSetMplsDpdReviseParam(s32 chan, f32); + +s32 KPADGetMplsStatus(s32 chan); + +typedef Vec KPADVec[3]; +void KPADSetMplsDirReviseBase(s32 chan, Vec *); #ifdef __cplusplus } diff --git a/include/rvl/MTX/mtx.h b/include/rvl/MTX/mtx.h index 2581d7a3..de5a32f4 100644 --- a/include/rvl/MTX/mtx.h +++ b/include/rvl/MTX/mtx.h @@ -20,26 +20,30 @@ typedef struct Vec { f32 x, y, z; } Vec; +typedef struct Vec2 { + f32 x, y; +} Vec2; + typedef struct Quaternion { f32 x, y, z, w; } Quaternion; -#define MTXIdentity PSMTXIdentity -#define MTXCopy PSMTXCopy -#define MTXConcat PSMTXConcat -#define MTXInverse PSMTXInverse -#define MTXTranspose PSMTXTranspose -#define MTXInverse PSMTXInverse -#define MTXInvXpose PSMTXInvXpose -#define MTXRotRad PSMTXRotRad -#define MTXRotTrig PSMTXRotTrig +#define MTXIdentity PSMTXIdentity +#define MTXCopy PSMTXCopy +#define MTXConcat PSMTXConcat +#define MTXInverse PSMTXInverse +#define MTXTranspose PSMTXTranspose +#define MTXInverse PSMTXInverse +#define MTXInvXpose PSMTXInvXpose +#define MTXRotRad PSMTXRotRad +#define MTXRotTrig PSMTXRotTrig #define MTXRotAxisRad PSMTXRotAxisRad -#define MTXTrans PSMTXTrans +#define MTXTrans PSMTXTrans #define MTXTransApply PSMTXTransApply -#define MTXScale PSMTXScale +#define MTXScale PSMTXScale #define MTXScaleApply PSMTXScaleApply -#define MTXQuat PSMTXQuat -#define MTXReflect PSMTXReflect +#define MTXQuat PSMTXQuat +#define MTXReflect PSMTXReflect void PSMTXIdentity(Mtx); void PSMTXCopy(const Mtx, Mtx); diff --git a/include/rvl/OS/OSReset.h b/include/rvl/OS/OSReset.h index 06d5a344..971ac6ee 100644 --- a/include/rvl/OS/OSReset.h +++ b/include/rvl/OS/OSReset.h @@ -40,6 +40,10 @@ void OSReturnToMenu(void); u32 OSGetResetCode(void); void OSResetSystem(u32 arg0, u32 arg1, u32 arg2); +void OSRestart(u32); +void OSRebootSystem(void); +void OSReturnToDataManager(void); + #ifdef __cplusplus } #endif diff --git a/include/rvl/WPAD/WPAD.h b/include/rvl/WPAD/WPAD.h index d62c7d45..669874ee 100644 --- a/include/rvl/WPAD/WPAD.h +++ b/include/rvl/WPAD/WPAD.h @@ -8,7 +8,6 @@ #include "rvl/SC/scsystem.h" #include "rvl/WPAD/WUD.h" - /******************************************************************************* * macros */ @@ -31,13 +30,13 @@ typedef s32 WPADResult; enum WPADResult_et { WPAD_ERR_OK = 0, - WPAD_ERR_NO_CONTROLLER = -1, /* name known from asserts */ - WPAD_ERR_BUSY = -2, // [RT3P54] has this as WPAD_ERR_BUSY - WPAD_ERR_TRANSFER = -3, // [RT3P54] has this as WPAD_ERR_TRANSFER - WPAD_ERR_INVALID = -4, /* name comes from [R89JEL] */ - // WPAD_ERR_5 = -5, /* unknown */ - // WPAD_ERR_6 = -6, /* unknown */ - WPAD_ERR_CORRUPTED = -7, /* name comes from [R89JEL] */ + WPAD_ERR_NO_CONTROLLER = -1, /* name known from asserts */ + WPAD_ERR_BUSY = -2, // [RT3P54] has this as WPAD_ERR_BUSY + WPAD_ERR_TRANSFER = -3, // [RT3P54] has this as WPAD_ERR_TRANSFER + WPAD_ERR_INVALID = -4, /* name comes from [R89JEL] */ + // WPAD_ERR_5 = -5, /* unknown */ + // WPAD_ERR_6 = -6, /* unknown */ + WPAD_ERR_CORRUPTED = -7, /* name comes from [R89JEL] */ #define WPAD_ESUCCESS WPAD_ERR_OK #define WPAD_ENODEV WPAD_ERR_NO_CONTROLLER @@ -86,7 +85,7 @@ enum WPADChannel_et { typedef s32 WPADDeviceType; enum WPADDeviceType_et { WPAD_DEV_CORE = 0, - WPAD_DEV_FS = 1, + WPAD_DEV_FREESTYLE = 1, WPAD_DEV_CLASSIC = 2, /* name known from asserts, but not value */ WPAD_DEV_BALANCE_CHECKER = 3, WPAD_DEV_VSM = 4, @@ -114,12 +113,11 @@ enum WPADDeviceType_et { WPAD_DEV_MPLS_PT_UNKNOWN = 250, - WPAD_DEV_251 = 251, - WPAD_DEV_252 = 252, // invalid device mode? - WPAD_DEV_NONE = - 253, // sort of like WPAD_ENODEV (see __wpadAbortInitExtension in WPADHIDParser.c) - // WPAD_DEV_254 = 254, /* unknown, doesn't seem to be used anywhere */ - WPAD_DEV_INITIALIZING = 255, // see __a1_20_status_report + WPAD_DEV_FUTURE = 251, + WPAD_DEV_NOT_SUPPORTED = 252, + WPAD_DEV_NOT_FOUND = 253, // sort of like WPAD_ENODEV (see __wpadAbortInitExtension in WPADHIDParser.c) + WPAD_DEV_NULL = 254, /* unknown, doesn't seem to be used anywhere */ + WPAD_DEV_UNKNOWN = 255, // see __a1_20_status_report }; typedef u32 WPADDataFormat; @@ -621,6 +619,12 @@ void WPADRecalibrate(WPADChannel chan); BOOL WPADIsUsedCallbackByKPAD(void); void WPADSetCallbackByKPAD(BOOL isKPAD); +void WPADSetAutoSleepTime(int min); +void WPADSetControllerLastDataUpdateTime(int min); +void WPADResetAutoSleepTimeCount(WPADChannel chan); + +void WPADSetAcceptConnection(int); + #ifdef __cplusplus } #endif diff --git a/include/toBeSorted/actor_event.h b/include/toBeSorted/actor_event.h index afbc9ba1..03fd30d6 100644 --- a/include/toBeSorted/actor_event.h +++ b/include/toBeSorted/actor_event.h @@ -16,6 +16,7 @@ public: u32 getCurrentEventCommand() const; void advanceNext(); bool isAdvance(); + int getSomeEventRelatedNumber(); int getSingleIntData(int *result, u32 code, u32); int getSingleFloatData(f32 *result, u32 code, u32); diff --git a/include/toBeSorted/d_hbm.h b/include/toBeSorted/d_hbm.h deleted file mode 100644 index f8eb390b..00000000 --- a/include/toBeSorted/d_hbm.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef D_HBM_H -#define D_HBM_H - -#include "common.h" -class dHbm_c { -public: - static dHbm_c *GetInstance(); - - s32 fn_801967D0(); - s32 fn_80197560(s32); - - void offFlags(u32 flags) { - mFlags &= ~flags; - } - -private: - u8 _0x00[0x218 - 0x000]; - u32 mFlags; -}; - -#endif diff --git a/include/toBeSorted/file_manager.h b/include/toBeSorted/file_manager.h index 5011684c..e80e0f1a 100644 --- a/include/toBeSorted/file_manager.h +++ b/include/toBeSorted/file_manager.h @@ -342,7 +342,9 @@ public: u8 getField_0xA843() const { return mIsFileInvalid[1]; } - + u8 getField_0xA84D() const { + return m_0xA84D; + } void setField0xA84C(u8 val) { m_0xA84C = val; diff --git a/include/toBeSorted/lyt_related_floats.h b/include/toBeSorted/lyt_related_floats.h deleted file mode 100644 index 8496f90d..00000000 --- a/include/toBeSorted/lyt_related_floats.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef LYT_RELATED_FLOATS_H -#define LYT_RELATED_FLOATS_H - -#include "common.h" - -extern "C" f32 lbl_80575144; -inline f32 get_80575144() { - return lbl_80575144; -} - -extern "C" f32 lbl_80575148; -inline f32 get_80575148() { - return lbl_80575148; -} - -extern "C" f32 lbl_805751A4; -inline f32 get_805751A4() { - return lbl_805751A4; -} - -extern "C" s32 lbl_80575134; -inline s32 get_80575134() { - return lbl_80575134; -} - -extern "C" s32 lbl_80575118; -inline s32 get_80575118() { - return lbl_80575118; -} - -extern "C" s32 lbl_8057511C; -inline s32 get_8057511C() { - return lbl_8057511C; -} - -extern "C" f32 lbl_8057514C; -inline f32 get_8057514C() { - return lbl_8057514C; -} - -extern "C" f32 lbl_80575150; -inline f32 get_80575150() { - return lbl_80575150; -} - -extern "C" f32 lbl_8057515C; -inline f32 get_8057515C() { - return lbl_8057515C; -} - -extern "C" f32 lbl_8057519C; -inline f32 get_8057519C() { - return lbl_8057519C; -} - -extern "C" f32 lbl_80575190; -inline f32 get_80575190() { - return lbl_80575190; -} - -extern "C" s32 lbl_80575184; -inline s32 get_80575184() { - return lbl_80575184; -} - -#endif diff --git a/include/toBeSorted/music_mgrs.h b/include/toBeSorted/music_mgrs.h index b7b4d884..518ef793 100644 --- a/include/toBeSorted/music_mgrs.h +++ b/include/toBeSorted/music_mgrs.h @@ -13,7 +13,6 @@ class dSndSound_c; #define BGM_MGR (dSndPlayerMgr_c::GetInstance()) extern "C" void fn_8035E000(); extern "C" void fn_8035E860(dSndPlayerMgr_c *); -extern "C" void fn_8035E310(dSndPlayerMgr_c *); extern "C" void fn_8035E820(dSndPlayerMgr_c *); extern "C" void fn_8035E880(dSndPlayerMgr_c *); extern "C" void fn_8035E790(dSndPlayerMgr_c *, UNKWORD, void *); @@ -45,6 +44,6 @@ extern "C" bool fn_80373550(void *, u32); extern "C" void fn_80372920(void *); extern "C" void fn_803738B0(void *, dSndSound_c *sound); extern "C" void fn_80373900(void *, dSndSound_c *sound); -extern "C" bool fn_803733B0(void*, u32); +extern "C" bool fn_803733B0(void *, u32); #endif diff --git a/include/toBeSorted/reload_color_fader.h b/include/toBeSorted/reload_color_fader.h deleted file mode 100644 index 55cb7c5a..00000000 --- a/include/toBeSorted/reload_color_fader.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef RELOAD_COLOR_FADER_H -#define RELOAD_COLOR_FADER_H - -#include "common.h" -class ReloadColorFader { -public: - static ReloadColorFader *GetInstance(); - void fn_80067ED0(); - void fn_80067EF0(s32); - void fn_80067F00(); - void fn_80067F50(); - void fn_80067FE0(); - bool fn_80068E80(); - bool fn_80067F60(); - void fn_80067DD0(bool); - - bool is1Or5() const { - return field_0x0C == 1 || field_0x0C == 5; - } - - u8 field_0x00[0x0C - 0x00]; - s32 field_0x0C; -}; - -#endif diff --git a/include/toBeSorted/save_manager.h b/include/toBeSorted/save_manager.h index 6f261dcf..d1e74677 100644 --- a/include/toBeSorted/save_manager.h +++ b/include/toBeSorted/save_manager.h @@ -124,6 +124,20 @@ public: return sInstance; } + bool getField_0x83D() const { + return field_0x83D; + } + bool getField_0x83F() const { + return field_0x83F; + } + s32 getCheckForFreeSpaceResult() const { + return mCheckForFreeSpaceResult; + } + bool isInState() { + return mCurrentState != STATE_MAX; + } + + void init(); void createSaveMsgWindow(); void execute(); void draw(); @@ -191,7 +205,6 @@ private: SaveMgr(); ~SaveMgr(); - void init(); void beginState(SaveMgrState_e state); void endState(); @@ -226,5 +239,4 @@ private: static SaveMgr *sInstance; }; - #endif diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/cmath b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/cmath index d0f5d5d3..ee8cd129 100644 --- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/cmath +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/cmath @@ -8,7 +8,7 @@ namespace std { using ::acos; -using ::acosf; +// using ::acosf; using ::asin; // using ::asinf; using ::atan; @@ -59,6 +59,10 @@ inline float sqrtf(float x) { return ::sqrtf(x); } +inline float acosf(float x) { + return ::acos(x); +} + // TODO: Very fake! // inline double fabs_wrapper(double x) { // return __fabs(x); diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h index 58b6b4e7..31411d2c 100644 --- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h @@ -19,7 +19,7 @@ extern "C" { int abs(int); int labs(int); double acos(double); -float acosf(float); +// float acosf(float); double asin(double); double atan(double); double atan2(double, double); diff --git a/src/REL/d/a/obj/d_a_obj_tubo.cpp b/src/REL/d/a/obj/d_a_obj_tubo.cpp index b931adc9..7ae8a189 100644 --- a/src/REL/d/a/obj/d_a_obj_tubo.cpp +++ b/src/REL/d/a/obj/d_a_obj_tubo.cpp @@ -37,7 +37,6 @@ #include "toBeSorted/event_manager.h" #include "toBeSorted/special_item_drop_mgr.h" - void float_ordering() { f32 f[] = {15.f, .4f, .4f, 5.f}; } @@ -759,7 +758,7 @@ void dAcOtubo_c::adjustSpeed() { cM3dGPla pla; dBgS::GetInstance()->GetTriPla(mObjAcch.mGnd, &pla); f32 step = 0.4f; - mAng gndAngle = mAng::angle(mVec3_c::Ey, pla.GetN()); + mAng gndAngle = mAng::fromRad(mVec3_c::Ey.angle(pla.GetN())); step *= gndAngle.cos(); if (gndAngle < mAng::deg2short(5) || @@ -779,7 +778,7 @@ void dAcOtubo_c::adjustSpeed() { bool dAcOtubo_c::checkSlope() { cM3dGPla pla; dBgS::GetInstance()->GetTriPla(mObjAcch.mGnd, &pla); - mAng gndAngle = mAng::angle(mVec3_c::Ey, pla.GetN()); + mAng gndAngle = mAng::fromRad(mVec3_c::Ey.angle(pla.GetN())); return sLib::absDiff(gndAngle, 0) > mAng::deg2short(5); } diff --git a/src/REL/d/a/obj/d_a_obj_tumble_weed.cpp b/src/REL/d/a/obj/d_a_obj_tumble_weed.cpp index 12e6215a..ed1049f6 100644 --- a/src/REL/d/a/obj/d_a_obj_tumble_weed.cpp +++ b/src/REL/d/a/obj/d_a_obj_tumble_weed.cpp @@ -246,7 +246,7 @@ bool dAcOTumbleWeed_c::checkSlope() { cM3dGPla pla; dBgS::GetInstance()->GetTriPla(mObjAcch.mGnd, &pla); - mAng ang = mAng::angle(mVec3_c::Ey, pla.GetN()); + mAng ang = mAng::fromRad(mVec3_c::Ey.angle(pla.GetN())); return sLib::absDiff(ang, 0) > mAng::deg2short(1); } @@ -304,13 +304,13 @@ void dAcOTumbleWeed_c::adjustAngle() { void dAcOTumbleWeed_c::adjustSpeed() { cM3dGPla pla; - // BUG + // @bug // the ground angle calculation happens before retrieving the grounds normal // this is probably hard to notice due to the little effect it has. // Effect: // Tumbleweed slows to the target much quicker than intended // Tumbleweed speeds to the target + 5.0f much quicker than intended - mAng gndAngle = mAng::angle(mVec3_c::Ey, pla.GetN()); + mAng gndAngle = mAng::fromRad(mVec3_c::Ey.angle(pla.GetN())); dBgS::GetInstance()->GetTriPla(mObjAcch.mGnd, &pla); diff --git a/src/REL/d/d_s_boot.cpp b/src/REL/d/d_s_boot.cpp index 7cec6c7b..b459a1ef 100644 --- a/src/REL/d/d_s_boot.cpp +++ b/src/REL/d/d_s_boot.cpp @@ -7,8 +7,10 @@ #include "d/d_dylink.h" #include "d/d_font_manager.h" #include "d/d_gfx.h" +#include "d/d_hbm.h" #include "d/d_heap.h" #include "d/d_message.h" +#include "d/d_reset.h" #include "d/d_scene.h" #include "d/d_sys.h" #include "d/lyt/d_lyt_battery.h" @@ -27,11 +29,9 @@ #include "toBeSorted/arc_managers/layout_arc_manager.h" #include "toBeSorted/arc_managers/oarc_manager.h" #include "toBeSorted/d_d3d.h" -#include "toBeSorted/d_hbm.h" #include "toBeSorted/d_emitter.h" #include "toBeSorted/d_particle.h" #include "toBeSorted/fi_context.h" -#include "toBeSorted/reload_color_fader.h" #include "toBeSorted/save_manager.h" #include "toBeSorted/save_related.h" #include "toBeSorted/special_item_drop_mgr.h" @@ -88,7 +88,7 @@ sFPhaseBase::sFPhaseState dScBoot_c::cb3() { } sFPhaseBase::sFPhaseState dScBoot_c::cb4() { - if (!dHbm_c::GetInstance()->fn_801967D0()) { + if (!dHbm::Manage_c::GetInstance()->Load()) { return sFPhaseBase::PHASE_RETRY; } dHeap::HBMHeap.heap->disableAllocation(); @@ -409,7 +409,7 @@ dScBoot_c::dScBoot_c() : mStateMgr(*this, sStateID::null), mPhases(this, sCallba } dScBoot_c::~dScBoot_c() { - dHbm_c::GetInstance()->fn_80197560(0); + dHbm::Manage_c::GetInstance()->fn_80197560(0); sInstance = nullptr; } @@ -437,9 +437,9 @@ int dScBoot_c::doDelete() { dBase_c::createRoot(fProfile::LAST, 0, 0); d3d::createLightTextures(); SpecialItemDropMgr::create(); - dHbm_c::GetInstance()->offFlags(8); + dHbm::Manage_c::GetInstance()->offFlags(8); dGfx_c::GetInstance()->setDrawCallback(nullptr); - ReloadColorFader::GetInstance()->fn_80067DD0(true); + dReset::Manage_c::GetInstance()->BootComplete(true); return SUCCEEDED; } @@ -499,7 +499,7 @@ void dScBoot_c::executeState_Strap() { case 1: if (!checkDone()) { bool ok = mStrapScreen.execute(); - if (ReloadColorFader::GetInstance()->field_0x0C == 1) { + if (dReset::Manage_c::GetInstance()->isSoftReset()) { ok = false; } @@ -535,7 +535,7 @@ void dScBoot_c::executeState_Strap() { mProgressStage = 0; mStrapScreen.init(); } - dHbm_c::GetInstance()->fn_80197560(0); + dHbm::Manage_c::GetInstance()->fn_80197560(0); } break; } diff --git a/src/d/a/obj/d_a_obj_boomerang.cpp b/src/d/a/obj/d_a_obj_boomerang.cpp index 23d8e695..7cbde76a 100644 --- a/src/d/a/obj/d_a_obj_boomerang.cpp +++ b/src/d/a/obj/d_a_obj_boomerang.cpp @@ -1,13 +1,44 @@ #include "d/a/obj/d_a_obj_boomerang.h" +#include "c/c_math.h" #include "common.h" #include "d/a/d_a_player.h" #include "d/a/obj/d_a_obj_base.h" +#include "d/col/bg/d_bg_s.h" +#include "d/col/bg/d_bg_s_lin_chk.h" +#include "d/col/c/c_cc_d.h" +#include "d/d_pad.h" +#include "d/d_player_act.h" +#include "d/d_rumble.h" +#include "d/snd/d_snd_wzsound.h" +#include "f/f_base.h" #include "f/f_profile_name.h" +#include "m/m3d/m_anmchr.h" #include "m/m3d/m_fanm.h" +#include "m/m_color.h" +#include "m/m_fader_base.h" +#include "m/m_mtx.h" +#include "m/m_quat.h" +#include "m/m_vec.h" #include "nw4r/g3d/g3d_anmchr.h" +#include "nw4r/g3d/res/g3d_resanmchr.h" #include "nw4r/g3d/res/g3d_resmdl.h" +#include "nw4r/g3d/res/g3d_resshp.h" +#include "rvl/GX/GXTypes.h" +#include "s/s_Math.h" #include "s/s_State.hpp" +#include "toBeSorted/d_emitter.h" +#include "toBeSorted/event_manager.h" + +dBgS_BeetleLinChk dAcBoomerang_c::sLinChk; +dCcD_SrcSph dAcBoomerang_c::sSphSrc = { + {{AT_TYPE_BEETLE, BoomerangAtFlags, {4, 0, 0}, 0, 1, 0, 0, 0}, + {~AT_TYPE_COMMON0, 0x291, {0, 0, 0x407}, 0, 0}, + {0x28}}, + {15.f} +}; +const u32 dAcBoomerang_c::BoomerangAtFlags = 0x209B; +; SPECIAL_ACTOR_PROFILE(BOOMERANG, dAcBoomerang_c, fProfile::BOOMERANG, 0x125, 0, 0x4); @@ -17,36 +48,30 @@ STATE_DEFINE(dAcBoomerang_c, MoveCancelWait); STATE_DEFINE(dAcBoomerang_c, ReturnWait); STATE_DEFINE(dAcBoomerang_c, EventReturnWait); -const dAcBoomerang_c::ChrAnimation_t dAcBoomerang_c::sChrAnims[dAcBoomerang_c::RB_MAX] = { - { "RB_Set", 0.f}, - {"RB_Default", 3.f}, - { "RB_Cut", 3.f}, - { "RB_Hold", 3.f}, - {"RB_Hold_ed", 3.f}, - { "RB_Back", 3.f}, -}; - -void areaCallback(dAcObjBase_c *param0, mVec3_c *param1, u32 param2) { - if (param2 != 0) { - return; +void dAcBoomerang_areaCallback(dAcObjBase_c *param0, mVec3_c *param1, u32 param2) { + if (param2 == 0) { + static_cast(param0)->areaCallback(param1, param2); } + return; +} +// This function is odd. only called by the areaCallback +void dAcBoomerang_c::areaCallback(mVec3_c *param1, u32 param2) { + setChrAnimation(dAcBoomerang_c::RB_CUT); } - void dAcBoomerang_c::atHitCallback(cCcD_Obj *i_objInfA, dAcObjBase_c *i_actorB, cCcD_Obj *i_objInfB) { - if (i_actorB != nullptr && GetLinkage().checkFlag(0x80)) { - if (dAcPy_c::getCurrentBeetleType() > 2) { - if (i_actorB == mGrabbedActor.get()) { - return; - } - - if (!mStateMgr.isState(StateID_Move)) { + if (i_actorB != nullptr && i_actorB->GetLinkage().checkFlag(0x80)) { + // Check if beetle can grab things + if (dAcPy_c::hasBeetleVariantOrBetter(HOOK_BEETLE)) { + // If beetle is already holding the object or is stationary + if (i_actorB == mGrabbedActor.get() || !mStateMgr.isState(StateID_Move)) { return; } + // Try grabbing the object if (tryGrabObject(i_actorB)) { setChrAnimation(RB_HOLD); - mAnmChr[0].setRate(0.f); - mAnmChr[0].setFrameOnly(i_actorB->GetLinkage().field_0x24); + mAnmChr[BOOMERANG_ANIM_PINCERS].setRate(0.f); + mAnmChr[BOOMERANG_ANIM_PINCERS].setFrameOnly(i_actorB->GetLinkage().field_0x24); return; } } @@ -56,8 +81,26 @@ void dAcBoomerang_c::atHitCallback(cCcD_Obj *i_objInfA, dAcObjBase_c *i_actorB, return; } - if (i_objInfB->ChkTgBit23()) { + if (!i_objInfB->ChkTgBonk()) { + field_0x8D8 = position - i_actorB->position; + field_0x8D8.y = 0.f; + + if (cM::isZero(field_0x8D8.normalize())) { + field_0x8D8.set(-angle.y.sin(), 0.f, -angle.y.cos()); + } + field_0x8D8 *= velocity.absXZ(); + field_0x8D8.y = -velocity.y; + + field_0x8D8.normalize(); + + setField_0x8CC(FLAG_CANCEL); + mStateMgr.changeState(StateID_MoveCancelWait); + } else { + // Play the animation to move the pincers setChrAnimation(RB_CUT); + + // I think this plays the vibration and drops the object + bonk(); } } @@ -68,28 +111,215 @@ bool dAcBoomerang_atHitCallback( return true; } +void dAcBoomerang_c::hideModel(dAcBoomerang_c::ModelType_e type) { + // Implicity ModelType_e -> int conversion + nw4r::g3d::ResShp obj(mMdl.getResMdl().GetResShp(type)); + obj.SetVisibility(false); + obj.DCStore(false); +} + +bool dAcBoomerang_c::createHeap() { + mResFile = dAcPy_c::GetLink2()->getHeldResFile(); + nw4r::g3d::ResMdl mdl = mResFile.GetResMdl("EquipBeetle"); + + TRY_CREATE(mMdl.create(mdl, &heap_allocator, 0x120, 1)); + + // Decide the Pincers + if (dAcPy_c::hasBeetleVariantOrBetter(HOOK_BEETLE)) { + hideModel(MDL_MOUTH_BASIC); + } else { + hideModel(MDL_MOUTH_HOOK); + } + + // Decide the Body + if (dAcPy_c::hasBeetleVariantOrBetter(TOUGH_BEETLE)) { + hideModel(MDL_BODY_BASIC); + } else { + hideModel(MDL_BODY_ADV); + } + + // Decide the Wings + if (dAcPy_c::hasBeetleVariantOrBetter(QUICK_BEETLE)) { + hideModel(MDL_WINGS_BASIC); + } else { + hideModel(MDL_WINGS_ADV); + } + + mLeftWingNodeID = mdl.GetResNode("wing_L").GetID(); + mRightWingNodeID = mdl.GetResNode("wing_R").GetID(); + + if (mLeftWingNodeID > mRightWingNodeID) { + mWindNodeID = mRightWingNodeID; + } else { + mWindNodeID = mLeftWingNodeID; + } + + TRY_CREATE(mAnmChrBlend.create(mdl, 2, &heap_allocator)); + + m3d::anmChr_c *pAnmChr = mAnmChr; + nw4r::g3d::AnmObjChr *pAnimChr; + nw4r::g3d::ResAnmChr resAnmChr = mResFile.GetResAnmChr("RB_Set"); + for (s32 i = 0; i < 2; ++i, ++pAnmChr) { + TRY_CREATE(pAnmChr->create2(mdl, resAnmChr, &heap_allocator)); + + pAnmChr->setAnm(mMdl, resAnmChr, m3d::PLAY_MODE_0); + if (i == BOOMERANG_ANIM_WINGS) { + pAnimChr = static_cast(pAnmChr->getAnimObj()); + pAnimChr->Release(); + pAnimChr->Bind(mdl, mLeftWingNodeID, nw4r::g3d::AnmObjChr::BIND_PARTIAL); + pAnimChr->Bind(mdl, mRightWingNodeID, nw4r::g3d::AnmObjChr::BIND_PARTIAL); + } + mAnmChrBlend.attach(i, pAnmChr, 1.f); + } + mMdl.setAnm(mAnmChrBlend); + TRY_CREATE(mProc.create2(&mMdl, mColor(0x00, 0x10, 0x14, 0xFF), 0x27, &heap_allocator)); + if (mLytFader.init()) { + return true; + } + return false; +} + +int dAcBoomerang_c::create() { + CREATE_ALLOCATOR(dAcBoomerang_c); + + mAcch.Set(this, 1, &mAcchCir); + mAcch.SetGroundUpY(20.f); + mAcch.SetField_0xD4(30.f); + mAcch.ClrRoofNone(); + mAcch.SetBeetle(); + mAcch.OnWaterGrp(); + mAcch.OnLineCheck(); + mAcch.GetRoof().SetField_0x7C(1); + mAcch.Set_0x2000000(); + mAcch.Set_0x40000000(); + mAcch.SetLineDown(); + + mAcchCir.SetWall(0.f, dAcPy_c::GetLink2()->getBeetleSmallRadius()); + + mCurrentAnimation = RB_MAX; + mStateMgr.changeState(StateID_Wait); + + placeOnArm(); + + mStts.SetRank(3); + + mSph0.Set(sSphSrc); + mSph0.SetStts(mStts); + mSph0.SetAtCallback(dAcBoomerang_atHitCallback); + mSph0.ClrTgSet(); + + mSph1.Set(sSphSrc); + mSph1.SetStts(mStts); + mSph1.SetAtCallback(dAcBoomerang_atHitCallback); + mSph1.SetR(dAcPy_c::GetLink2()->getBeetleSmallRadius()); + mSph1.ClrCoSet(); + mSph1.SetAtType(AT_TYPE_0x40); + + mSph1.SetCoGrp(0xE); + + if (!dAcPy_c::hasBeetleVariantOrBetter(HOOK_BEETLE)) { + mSph0.OnAt_0x4000(); + mSph1.OnAt_0x4000(); + } + + sLinChk.SetPreRoofChk(false); + mAcch.CrrPos(*dBgS::GetInstance()); + setRoomId(); + mLytFader.setStatus(mFaderBase_c::FADED_IN); + mFader.setFader(&mLytFader); + + return SUCCEEDED; +} + +dAcBoomerang_c::~dAcBoomerang_c() { + deleteCheck(); +} + +void dAcBoomerang_c::deleteReady() { + deleteCheck(); + + if (getSoundSource()) { + getSoundSource()->vt_0x40(5); + } + + if (dAcPy_c::GetLink2()) { + dAcPy_c::GetLink2()->onModelUpdateFlag(0x10000000); + } +} + +void dAcBoomerang_c::retrieve() { + if (mFader.isStatus(mFaderBase_c::FADED_OUT)) { + mFader.setFrame(5); + mFader.fadeIn(); + playSound(SE_BE_COME_BACK); + } + mFader.calc(); +} + +int dAcBoomerang_c::doDelete() { + return SUCCEEDED; +} + +void dAcBoomerang_c::setRoomId() { + if (mAcch.GetGroundH() != 1e-9f) { + roomid = dBgS::GetInstance()->GetRoomId(mAcch.GetGnd()); + } else if (roomid == -1) { + roomid = dAcPy_c::GetLink2()->roomid; + } +} + +void dAcBoomerang_c::placeOnArm() { + dAcPy_c::GetLink2()->getBodyMtx(&mWorldMtx, dAcPy_c::PLAYER_MAIN_NODE_ARM_R2); + mMtx_c m; + m.transS(18.5f, 0.f, 14.5f); + mWorldMtx += m; + mWorldMtx.ZYXrotM(mAng::fromDeg(90.f), 0, mAng::fromDeg(90.f)); + mMdl.setLocalMtx(mWorldMtx); + mWorldMtx.getTranslation(position); + mWorldMtx.getTranslation(mOldPosition); +} + +const dAcBoomerang_c::ChrAnimation_t dAcBoomerang_c::sChrAnims[dAcBoomerang_c::RB_MAX] = { + { "RB_Set", 0.f}, + {"RB_Default", 3.f}, + { "RB_Cut", 3.f}, + { "RB_Hold", 3.f}, + {"RB_Hold_ed", 3.f}, + { "RB_Back", 3.f}, +}; + // ... bool dAcBoomerang_c::tryGrabObject(dAcObjBase_c *pObj) { dAcPy_c *player = dAcPy_c::GetLink2(); - if (checkField_0x8CC(0x1000) && GetLinkage().checkFlag(0x80)) {} + if (checkField_0x8CC(FLAG_CONTROLLABLE) && GetLinkage().checkFlag(0x80)) {} } // ... +void dAcBoomerang_c::bonk() { + if (checkField_0x8CC(FLAG_RUMBLE_ACTIVE)) { + return; + } + setField_0x8CC(FLAG_RUMBLE_ACTIVE); + dRumble_c::start(dRumble_c::sRumblePreset1, 1); +} + void dAcBoomerang_c::setChrAnimation(dAcBoomerang_c::ChrAnimation_e requestedAnimation) { // Do not set anim if there is no change, or the request is to cut from hold if (requestedAnimation == mCurrentAnimation || (mCurrentAnimation == RB_HOLD && requestedAnimation == RB_CUT)) { return; } - mAnmChr[0].setAnm(mMdl, mResFile.GetResAnmChr(sChrAnims[requestedAnimation].mName), m3d::PLAY_MODE_4); - nw4r::g3d::AnmObjChr *pAnmObj = static_cast(mAnmChr[0].getAnimObj()); + mAnmChr[BOOMERANG_ANIM_PINCERS].setAnm( + mMdl, mResFile.GetResAnmChr(sChrAnims[requestedAnimation].mName), m3d::PLAY_MODE_4 + ); + nw4r::g3d::AnmObjChr *pAnmObj = static_cast(mAnmChr[BOOMERANG_ANIM_PINCERS].getAnimObj()); pAnmObj->Release(); nw4r::g3d::ResMdl mdl = mMdl.getResMdl(); - for (int i = 0; i < mWindNodeID; ++i) { + for (s32 i = 0; i < mWindNodeID; ++i) { pAnmObj->Bind(mdl, i, nw4r::g3d::AnmObjChr::BIND_ONE); } @@ -102,3 +332,255 @@ void dAcBoomerang_c::setChrAnimation(dAcBoomerang_c::ChrAnimation_e requestedAni mMdl.setAnm(mAnmChrBlend, sChrAnims[requestedAnimation].mRate); } + +// HELP: I need this to be const to fix the load, but I cant do that without ruining sdata +const char *dAcBoomerang_c::sFlyChrAnims[RB_FLY_MAX] = {"RB_Fly", "RB_FlyFast"}; +void dAcBoomerang_c::setFlyChrAnimation(FlyAnimation_e requestedAnimation) { + nw4r::g3d::ResAnmChr resAnmChr = mResFile.GetResAnmChr(sFlyChrAnims[requestedAnimation]); + mAnmChr[BOOMERANG_ANIM_WINGS].setAnm(mMdl, resAnmChr, m3d::PLAY_MODE_4); + nw4r::g3d::AnmObjChr *pAnmObj = static_cast(mAnmChr[BOOMERANG_ANIM_WINGS].getAnimObj()); + pAnmObj->Release(); + pAnmObj->Bind(mMdl.getResMdl(), mLeftWingNodeID, nw4r::g3d::AnmObjChr::BIND_PARTIAL); + pAnmObj->Bind(mMdl.getResMdl(), mRightWingNodeID, nw4r::g3d::AnmObjChr::BIND_PARTIAL); + + mMdl.setAnm(mAnmChrBlend); +} + +void dAcBoomerang_c::setRemainingFlightTime(s16 time) { + if (time < 0) { + time = dAcPy_c::GetLink2()->getBeetleWarningTimeLeft(); + } + if (mRemainingFlightTime > time) { + mRemainingFlightTime = time; + mFlashTimer = time; + } +} + +void dAcBoomerang_c::initializeState_Wait() { + setChrAnimation(RB_SET); + mAnmChrBlend.setWeight(1, 0.f); + mSph0.ClrAtHit(); + mSph1.ClrTgHit(); + mSph1.ClrAtHit(); + unsetField_0x8CC(FLAG_COMMON_INIT); + + placeOnArm(); + field_0x8D0 = 0.f; + + dAcPy_c::GetLink2()->onModelUpdateFlag(dAcPy_c::UPDATE_MODEL_BEETLE); +} +void dAcBoomerang_c::executeState_Wait() { + forwardSpeed = 0.f; + placeOnArm(); + if (checkField_0x8CC(FLAG_REQUEST_MOVE)) { + mStateMgr.changeState(StateID_Move); + } +} +void dAcBoomerang_c::finalizeState_Wait() {} + +void dAcBoomerang_c::initializeState_ReturnWait() { + setChrAnimation(RB_BACK); + setFlyChrAnimation(RB_FLY_FAST); + mSph0.ClrAtHit(); + mSph1.ClrTgHit(); + mSph1.ClrAtHit(); + unsetField_0x8CC(FLAG_COMMON_INIT); + placeOnArm(); +} +void dAcBoomerang_c::executeState_ReturnWait() { + forwardSpeed = 0.f; + placeOnArm(); + if (mAnmChr[BOOMERANG_ANIM_PINCERS].isStop() || !dAcPy_c::GetLink2()->checkActionFlagsCont(0x10)) { + playSound(SE_BE_CATCH); + mStateMgr.changeState(StateID_Wait); + } +} +void dAcBoomerang_c::finalizeState_ReturnWait() { + if (dAcPy_c::GetLink2()->checkActionFlagsCont(0x10)) { + dAcPy_c::GetLink2()->setBeetleBackAnim(); + } +} + +void dAcBoomerang_c::initializeState_Move() { + setChrAnimation(RB_DEFAULT); + mAnmChrBlend.setWeight(1, 1.f); + setFlyChrAnimation(RB_FLY); + field_0x8B1 = 45; // 1.5 seconds if that means anything + field_0x8C8 = 0; + + dAcPy_c *player = dAcPy_c::GetLink2(); + forwardSpeed = player->getBeetleNormalSpeed(); + + mSph0.ClrAtHit(); + mSph1.ClrTgHit(); + mSph1.ClrAtHit(); + + mRemainingFlightTime = player->getBeetleFlightTime(); + mFlashTimer = player->getBeetleWarningTimeLeft(); + unsetField_0x8CC(FLAG_REQUEST_MOVE | FLAG_WING_EFFECT_ACTIVE | FLAG_0x10000); + setField_0x8CC(FLAG_CONTROLLABLE | FLAG_0x80000); + + angle.x = 2000 - player->vt_0x198(); + + rotation.x.set(-angle.x); + rotation.y.set(angle.y); + rotation.z.set(0); + field_0x8B2 = 0; + + mOldPosition = position; + mOldPosition.y += 60.f; + + field_0x8BC = dPad::ex_c::m_current_ex->mMPLS.getVerticalAngle(); + field_0x8BA = dPad::ex_c::m_current_ex->mMPLS.getHorizontalAngle(); + field_0x8B8 = daPlayerActBase_c::fn_8005BAA0(); + + // TODO regswap + field_0x8BE = angle.x - dPad::ex_c::m_current_ex->mMPLS.getVerticalAngle(); + + field_0x8E4.fromXY(angle.x, angle.y, forwardSpeed); + + playSound(SE_BE_THROW); + dJEffManager_c::spawnUIEffect(PARTICLE_RESOURCE_ID_MAPPING_3_, mVec3_c::Zero, nullptr, nullptr, nullptr, nullptr); + field_0x8F0 = mVec3_c::Zero; + field_0x8D4 = 0.0f; +} +void dAcBoomerang_c::executeState_Move() {} +void dAcBoomerang_c::finalizeState_Move() {} + +void dAcBoomerang_c::initializeState_MoveCancelWait() {} +void dAcBoomerang_c::executeState_MoveCancelWait() {} +void dAcBoomerang_c::finalizeState_MoveCancelWait() {} + +void dAcBoomerang_c::initializeState_EventReturnWait() { + mSph0.ClrCoHit(); + mSph0.ClrAtHit(); + mSph1.ClrTgHit(); + mSph1.ClrAtHit(); + + unsetField_0x8CC(FLAG_COMMON_INIT); +} +void dAcBoomerang_c::executeState_EventReturnWait() {} +void dAcBoomerang_c::finalizeState_EventReturnWait() {} + +void dAcBoomerang_c::executeTimeWarning() { + s16 timeLimit = dAcPy_c::GetLink2()->getBeetleWarningTimeLeft(); + mColor flashClr(0, 0, 0, 0xFF); + + if (mRemainingFlightTime <= timeLimit) { + setField_0x8CC(FLAG_STOP_TIMER_ACTIVE); + + if (mFlashTimer != 0) { + mFlashTimer--; + } + + s32 r; + if (mFlashTimer > 75) { + r = 37; + } else if (mFlashTimer > 37) { + r = 18; + } else { + r = 9; + } + + flashClr.r = (1.f / (r - 6)) * MAX(0, (mFlashTimer % r) - 5) * 255.f; + if (flashClr.r == 0xFF && !mStateMgr.isState(StateID_MoveCancelWait)) { + playSound(SE_BE_WARNING); + } + } + + mMdl.setTevKColorAll(GX_KCOLOR3, flashClr, false); + dAcPy_c::GetLink2()->setBeetleFlashClr(flashClr); +} + +void dAcBoomerang_c::registerInEvent() { + return; +} + +int dAcBoomerang_c::actorExecute() { + dAcPy_c *player = dAcPy_c::GetLink2(); + + if (checkField_0x8CC(FLAG_REQUEST_0x400)) { + unsetField_0x8CC(FLAG_REQUEST_0x400); + } + + if (player->checkModelUpdateFlag(0x10000 | 0x80)) { + deleteRequest(); + unsetField_0x8CC(FLAG_REQUEST_0x400); + return SUCCEEDED; + } + + if (EventManager::isInEvent() && mEventRelated.getSomeEventRelatedNumber() != -1) { + setField_0x8CC(FLAG_0x40); + mEventRelated.advanceNext(); + } + + unsetField_0x8CC(FLAG_0x40000 | FLAG_RUMBLE_ACTIVE); + + for (int i = 0; i < 2; ++i) { + mAnmChr[i].play(); + } + mMdl.play(); + mStateMgr.executeState(); + + sLib::chase(&field_0x8D4, 0.f, 0.05f); + mAcch.CrrPos(*dBgS::GetInstance()); + + setRoomId(); + + mMdl.calc(false); + mMdl.getNodeWorldMtxMultVecZero(0, poscopy2); + poscopy3 = poscopy2; + + if (checkField_0x8CC(FLAG_WING_EFFECT_ACTIVE)) { + mEff0.createContinuousEffect(PARTICLE_RESOURCE_ID_MAPPING_6_, mWorldMtx, nullptr, nullptr); + mEff1.setTransform(mWorldMtx); + + f32 ang = field_0x8E4.angle(velocity); + ang = 10.f - mAng::fromRad(ang) * (7.f / 256.f); + ang = nw4r::ut::Max(ang, 3.f); + mEff1.setAwayFromCenterSpeed(ang); + } else { + mEff0.remove(true); + } + + if (field_0x8B1 == 0 && (mStateMgr.isState(StateID_Move) || mStateMgr.isState(StateID_MoveCancelWait))) { + mEff2.createContinuousEffect( + PARTICLE_RESOURCE_ID_MAPPING_5_, player->GetPosition(), nullptr, nullptr, nullptr, nullptr + ); + } else { + mEff2.remove(true); + } + + if (checkField_0x8CC(FLAG_0x20) && !checkField_0x8CC(FLAG_CANCEL)) { + if (mStateMgr.isState(StateID_Move) || mStateMgr.isState(StateID_MoveCancelWait)) { + mEff3.createContinuousEffect(PARTICLE_RESOURCE_ID_MAPPING_7_, mWorldMtx, nullptr, nullptr); + playSoundEffect1(SE_BE_HIT_LEAVES_LV); + } + } + + unsetField_0x8CC(FLAG_0x20 | FLAG_0x40 | FLAG_0x80 | FLAG_DROP_ITEM); + retrieve(); + return SUCCEEDED; +} + +int dAcBoomerang_c::draw() { + if (mStateMgr.isState(StateID_EventReturnWait) || dAcPy_c::GetLink2()->checkModelUpdateFlag(0x10000 | 0x80)) { + return SUCCEEDED; + } + drawModelType1(&mMdl); + if (!mStateMgr.isState(StateID_Wait)) { + mProc.entry(); + static mQuat_c shadow(mVec3_c::Zero, 50.f); + drawShadow(mShadow, nullptr, mWorldMtx, &shadow, -1, -1, -1, -1, -1, position.y - mAcch.GetGroundH()); + } + return SUCCEEDED; +} + +bool dAcBoomerangProc_c::create(m3d::mdl_c *mdl, mColor clr, int prioOpa, mAllocator_c *alloc) { + if (!d3d::UnkProc::create(prioOpa, -1, alloc)) { + return false; + } + mpMdl = mdl; + mClr = clr; + return true; +} diff --git a/src/d/col/bg/d_bg_s.cpp b/src/d/col/bg/d_bg_s.cpp index 04e4450c..d6fd0242 100644 --- a/src/d/col/bg/d_bg_s.cpp +++ b/src/d/col/bg/d_bg_s.cpp @@ -1024,7 +1024,7 @@ void dBgS::SetupMapMaterial(int matIdx, bool, s32 roomId) { } UNKTYPE *dBgS::GetMapAccessor() { - return dLytMap_c::getInstance(); + return dLytMap_c::GetInstance(); } void dBgS::DrawMap(int roomId, mMtx_c *, bool bColor, int) { diff --git a/src/d/col/c/c_cc_d.cpp b/src/d/col/c/c_cc_d.cpp index f8669ee6..e6f58d49 100644 --- a/src/d/col/c/c_cc_d.cpp +++ b/src/d/col/c/c_cc_d.cpp @@ -14,9 +14,10 @@ #include "m/m_mtx.h" #include "m/m_vec.h" #include "nw4r/types_nw4r.h" -#include "rvl/MTX.h" // IWYU pragma: export #include "s/s_Math.h" +#include "rvl/MTX.h" // IWYU pragma: export + static inline void MtxTransMinusXYZ(mMtx_c &mtx, f32 x, f32 y, f32 z) { PSMTXTrans(mtx, -x, -y, -z); } @@ -1448,8 +1449,14 @@ void cCcD_ObjAt::AdjustHitPos(f32 x, f32 z) { } cCcD_ObjTg::cCcD_ObjTg() - : mShieldFrontRangeYAngle(nullptr), mField_0x4A(0), mField_0x4B(0), mField_0x4C(0), mField_0x50(0), mField_0x54(0), - mField_0x6C(0.f, 0.f, 0.f), mField_0x78(0) {} + : mShieldFrontRangeYAngle(nullptr), + mField_0x4A(0), + mField_0x4B(0), + mField_0x4C(0), + mField_0x50(0), + mField_0x54(0), + mField_0x6C(0.f, 0.f, 0.f), + mField_0x78(0) {} cCcD_ObjTg::~cCcD_ObjTg() {} @@ -1480,10 +1487,10 @@ cCcD_ObjCo::~cCcD_ObjCo() {} void cCcD_ObjCo::Set(const cCcD_SrcGObjCo &src) { mEffCounter = 0; mSrc = src; - SetCoFlag(mSrc.mSPrm & 0x1e0); + SetGrp(mSrc.mSPrm & 0x1e0); } -void cCcD_ObjCo::SetCoFlag(u32 flag) { +void cCcD_ObjCo::SetGrp(u32 flag) { mSrc.mSPrm = mSrc.mSPrm & ~0x1E0 | flag; mGrp = (mSrc.mSPrm & 0x1E0) >> 4; } diff --git a/src/d/d_cs_game.cpp b/src/d/d_cs_game.cpp index 4480e541..8d2b2a91 100644 --- a/src/d/d_cs_game.cpp +++ b/src/d/d_cs_game.cpp @@ -163,6 +163,10 @@ int dCsGame_c::doDelete() { return SUCCEEDED; } +bool dCsGame_c::fn_801BF5E0() const { + return mCursor.isCursorActive() & !fn_801BF630(); +} + void dCsGame_c::setNextCursorType(lytItemCursor_c::CursorType_e cs) { mCursor.setNextCursorType(cs); } @@ -176,7 +180,7 @@ void dCsGame_c::lytItemCursor_c::initializeState_Bow() { mBow.select(); } void dCsGame_c::lytItemCursor_c::executeState_Bow() { - field_0x990 = 1; + mCursorTrail = 1; mBow.execute(); } void dCsGame_c::lytItemCursor_c::finalizeState_Bow() {} @@ -193,14 +197,14 @@ void dCsGame_c::lytItemCursor_c::initializeState_Vacuum() { mVacuum.enter(); } void dCsGame_c::lytItemCursor_c::executeState_Vacuum() { - field_0x99C = 1; + mCursorTrail = 1; mVacuum.execute(); } void dCsGame_c::lytItemCursor_c::finalizeState_Vacuum() {} void dCsGame_c::lytItemCursor_c::initializeState_Pachinko() {} void dCsGame_c::lytItemCursor_c::executeState_Pachinko() { - field_0x99C = 1; + mCursorTrail = 1; mPachinko.execute(); } void dCsGame_c::lytItemCursor_c::finalizeState_Pachinko() {} @@ -209,7 +213,7 @@ void dCsGame_c::lytItemCursor_c::initializeState_HookShot() { mCrawShot.enter(); } void dCsGame_c::lytItemCursor_c::executeState_HookShot() { - field_0x99C = 1; + mCursorTrail = 1; mCrawShot.execute(); } void dCsGame_c::lytItemCursor_c::finalizeState_HookShot() {} diff --git a/src/d/d_cursor_hit_check.cpp b/src/d/d_cursor_hit_check.cpp index 160c6c28..47535182 100644 --- a/src/d/d_cursor_hit_check.cpp +++ b/src/d/d_cursor_hit_check.cpp @@ -4,6 +4,8 @@ #include "d/col/bg/d_bg_s.h" #include "d/col/bg/d_bg_s_lin_chk.h" #include "d/col/cc/d_cc_s.h" +#include "d/d_gfx.h" +#include "d/d_pad.h" #include "d/d_stage_mgr.h" #include "m/m_mtx.h" #include "m/m_vec.h" @@ -11,9 +13,7 @@ #include "nw4r/lyt/lyt_bounding.h" #include "nw4r/lyt/lyt_pane.h" #include "nw4r/ut/ut_RuntimeTypeInfo.h" -#include "rvl/MTX/mtx.h" #include "toBeSorted/d_d3d.h" -#include "toBeSorted/lyt_related_floats.h" dCsMgr_c::dCsMgr_c() { // NONMATCHING - TList ctor issues @@ -117,19 +117,24 @@ bool dCursorHitCheck_c::checkOverrideCallback(bool b) { bool dCursorHitCheckCC_c::checkHit(s32 x, s32 y) { // NONMATCHING - TODO - mVec3_c pos(x, y, 10000.0f); - pos.x = (pos.x - get_8057515C()) / get_80575148() * -2.0f - 1.0f; - pos.y = (pos.y - get_8057519C()) / get_80575190() * 2.0f - 1.0f; + + mVec3_c pos( + (x - dGfx_c::getWidth4x3LeftF()) / dGfx_c::getWidth4x3F() * 2.f - 1.f, + (y - dGfx_c::getCurrentScreenTopF()) / dGfx_c::getCurrentScreenHeightF() * -2.f - 1.f, 10000.f + ); + mVec3_c v; d3d::fn_80016B60(v, pos); + nw4r::g3d::Camera cam = dStageMgr_c::GetInstance()->getCamera(0); + mMtx_c mtx; - cam.GetCameraMtx(mtx); - PSMTXInverse(mtx, mtx); mVec3_c a; - a.x = mtx.m[0][3]; - a.y = mtx.m[1][3]; - a.z = mtx.m[2][3]; + + cam.GetCameraMtx(mtx); + mtx.inverse(); + mtx.getTranslation(a); + dBgS_LinChk ck; ck.Set(&a, &v, nullptr); dBgS::GetInstance()->LineCross(&ck); @@ -254,6 +259,5 @@ void dCursorHitCheckLyt_c::gatherBoundings(dCsCheckLyt_BoundingData **pEnd, nw4r } mVec2_c &dCursorInterface_c::getCursorPos() { - // NONMATCHING - Controller stuff - return *(mVec2_c *)nullptr; + return dPad::ex_c::getInstance()->mDpdPosScreen; } diff --git a/src/d/d_dvd_drive_error.cpp b/src/d/d_dvd_drive_error.cpp index c80909e8..3cf15bb2 100644 --- a/src/d/d_dvd_drive_error.cpp +++ b/src/d/d_dvd_drive_error.cpp @@ -1,14 +1,13 @@ #include "d/d_dvd_drive_error.h" #include "d/d_dvd_unk.h" +#include "d/d_gfx.h" +#include "d/d_reset.h" #include "d/d_lyt_hio.h" #include "egg/gfx/eggDrawGX.h" #include "egg/gfx/eggScreen.h" #include "m/m_mtx.h" #include "m/m_vec.h" -#include "toBeSorted/lyt_related_floats.h" -#include "toBeSorted/reload_color_fader.h" - /** 805750d0 */ dDvdDriveError_c *dDvdDriveError_c::sInstance; @@ -28,7 +27,8 @@ bool dDvdDriveError_c::isError() const { static const wchar_t sErrEnGeneral[] = L"Please insert The Legend of Zelda:\nSkyward Sword Game Disc."; static const wchar_t sErrEnDiskId[] = L"Please insert The Legend of Zelda:\nSkyward Sword Game Disc."; -static const wchar_t sErrEnDiskError[] = L"The disc could not be read.\nRefer to the Wii Operations\nManual for details."; +static const wchar_t sErrEnDiskError[] = + L"The disc could not be read.\nRefer to the Wii Operations\nManual for details."; static const wchar_t *sErrorsEn[] = { sErrEnGeneral, @@ -38,7 +38,8 @@ static const wchar_t *sErrorsEn[] = { static const wchar_t sErrEsGeneral[] = L"Por favor, inserta el disco\nde The Legend of Zelda:\nSkyward Sword."; static const wchar_t sErrEsDiskId[] = L"Por favor, inserta el disco\nde The Legend of Zelda:\nSkyward Sword."; -static const wchar_t sErrEsDiskError[] = L"No se puede leer el disco.\nConsulta el manual de operaciones\nde la consola Wii para obtener m\xe1" +static const wchar_t sErrEsDiskError[] = + L"No se puede leer el disco.\nConsulta el manual de operaciones\nde la consola Wii para obtener m\xe1" "s\ninformaci\xf3" "n."; @@ -48,11 +49,14 @@ static const wchar_t *sErrorsEs[] = { sErrEsDiskError, }; -static const wchar_t sErrFrGeneral[] = L"Veuillez ins\xe9" +static const wchar_t sErrFrGeneral[] = + L"Veuillez ins\xe9" "rer le disque\nThe Legend of Zelda:\nSkyward Sword."; -static const wchar_t sErrFrDiskId[] = L"Veuillez ins\xe9" +static const wchar_t sErrFrDiskId[] = + L"Veuillez ins\xe9" "rer le disque\nThe Legend of Zelda:\nSkyward Sword."; -static const wchar_t sErrFrDiskError[] = L"Impossible de lire le disque.\nVeuillez vous r\xe9" +static const wchar_t sErrFrDiskError[] = + L"Impossible de lire le disque.\nVeuillez vous r\xe9" "f\xe9" "rer au mode\nd'emploi de la Wii pour plus\nde d\xe9" "tails."; @@ -71,11 +75,11 @@ void dDvdDriveError_c::draw() { screen.SetCanvasMode(EGG::Screen::CANVASMODE_0); screen.SetProjectionType(EGG::Frustum::PROJ_ORTHO); screen.SetNearFar(0.0f, 500.0f); - screen.SetScale(mVec3_c(get_80575190() / get_80575144(), 1.0f, 1.0f)); + screen.SetScale(mVec3_c(dGfx_c::getWidth4x3F() / dGfx_c::getCurrentScreenWidthF(), 1.0f, 1.0f)); screen.SetProjectionGX(); - f32 x = get_80575144() * 0.5f; + f32 x = dGfx_c::getCurrentScreenWidthF() * 0.5f; f32 mx = -x; - f32 y = get_80575148() * 0.5f; + f32 y = dGfx_c::getCurrentScreenHeightF() * 0.5f; f32 my = -y; EGG::DrawGX::BeginDrawScreen(screen.GetCanvasMode() == EGG::Screen::CANVASMODE_1, false, false); @@ -89,8 +93,8 @@ void dDvdDriveError_c::draw() { EGG::DrawGX::DrawDL(EGG::DrawGX::DL_17, mtx, EGG::DrawGX::BLACK); nw4r::math::MTX44 mtx2; - f32 a = get_8057511C(); - f32 b = get_80575118(); + f32 a = dGfx_c::getCurrentScreenHeight(); + f32 b = dGfx_c::getCurrentScreenWidth(); C_MTXOrtho(mtx2, 0.0f, a, 0.0f, b, 0.0f, 1.0f); GXSetProjection(mtx2, GX_ORTHOGRAPHIC); GXSetScissor(0, 0, b, a); @@ -126,8 +130,8 @@ void dDvdDriveError_c::draw() { textWriter.SetupGX(); textWriter.SetDrawFlag(0x110); - textWriter.SetCursorX(get_8057514C()); - textWriter.SetCursorY(get_80575150()); + textWriter.SetCursorX(dGfx_c::getCurrentScreenWidthLimitF()); + textWriter.SetCursorY(dGfx_c::getCurrentScreenHeightLimitF()); textWriter.Print(str, wcslen(str)); } @@ -141,7 +145,7 @@ void dDvdDriveError_c::execute() { dDvdUnk::FontUnk::GetInstance()->fn_80052C60(); } } else if (mDvdDriveStatus == DVD_STATE_IDLE) { - if (!ReloadColorFader::GetInstance()->is1Or5()) { + if (!dReset::Manage_c::GetInstance()->isSoftResetOrSafetyWait()) { mIsError = false; } } diff --git a/src/d/d_message.cpp b/src/d/d_message.cpp index 6916a3e9..0d56a9f8 100644 --- a/src/d/d_message.cpp +++ b/src/d/d_message.cpp @@ -439,7 +439,7 @@ bool dFlow_c::handleEventInternal(const MsbFlowInfo *element) { dLytControlGame_c::getInstance()->somehowRelatedToEnteringLightPillars(val, p3, p2); } } else { - dLytMap_c::getInstance()->lightPillarRelated(val, p3, p2); + dLytMap_c::GetInstance()->lightPillarRelated(val, p3, p2); } dMessage_c::getInstance()->storeLightPillarRelatedArg(p4); break; diff --git a/src/d/d_pad.cpp b/src/d/d_pad.cpp new file mode 100644 index 00000000..f90c09d3 --- /dev/null +++ b/src/d/d_pad.cpp @@ -0,0 +1,1454 @@ +#include "d/d_pad.h" + +#include "c/c_math.h" +#include "common.h" +#include "d/a/d_a_player.h" +#include "d/col/c/c_m3d_g_aab.h" +#include "d/d_cs_game.h" +#include "d/d_gfx.h" +#include "d/d_hbm.h" +#include "d/d_pause.h" +#include "d/d_reset.h" +#include "d/d_sc_game.h" +#include "d/lyt/d_lyt_control_game.h" +#include "d/lyt/d_lyt_map.h" +#include "d/lyt/meter/d_lyt_meter.h" +#include "d/snd/d_snd_player_mgr.h" +#include "d/snd/d_snd_small_effect_mgr.h" +#include "d/snd/d_snd_wzsound.h" +#include "egg/core/eggController.h" +#include "egg/core/eggHeap.h" +#include "egg/math/eggMath.h" +#include "egg/math/eggVector.h" +#include "m/m_angle.h" +#include "m/m_mtx.h" +#include "m/m_pad.h" +#include "m/m_vec.h" +#include "nw4r/math/math_types.h" +#include "rvl/KPAD/KPAD.h" +#include "rvl/MTX/mtx.h" +#include "rvl/MTX/mtxvec.h" +#include "rvl/MTX/vec.h" +#include "rvl/WPAD/WPAD.h" + +#include + +namespace dPad { + +ex_c ex_c::m_ex[4]; +ex_c *ex_c::m_current_ex = ex_c::m_ex; + +WPADInfo ex_c::m_info[2][4]; + +bool ex_c::m_connected[4]; + +// TODO - the SDK decomp uses WPAD error codes for this +// callback, but I think they have different semantics. +// Refer to https://github.com/doldecomp/sdk_2009-12-11/blob/main/source/kpad/KPAD.c#L3607-L3639 +// for logic. +void control_mpls_callback(s32 idx, s32 code) { + switch (code) { + // Called first + case 0: { + ex_c::on_0x54(idx); + break; + } + // Called when Mpls configuration failed - not actually reached? + case -1: { + ex_c::on_0x55(idx); + break; + } + // Called when Mpls + Nunchuk configuration failed -- called a bunch of times + case -2: { + ex_c::on_0x56(idx); + break; + } + // not sure - called last + case 1: { + ex_c::on_0x57(idx); + break; + } + } +} + +bool isDeviceTypeMpls(u32 type) { + switch (type) { + case WPAD_DEV_MOTION_PLUS: + case WPAD_DEV_MPLS_PT_FS: + case WPAD_DEV_MPLS_PT_CLASSIC: + case WPAD_DEV_MPLS_PT_UNKNOWN: return true; + default: return false; + } +} + +void initMpls(s32 chan) { + KPADResetMpls(chan); + KPADDisableMplsZeroPlay(chan); + KPADSetMplsZeroPlayParam(chan, 0.005f); + KPADSetMplsZeroDriftMode(chan, 2); + disableMplsDirRevise(chan); + KPADSetMplsDirReviseParam(chan, 0.35f); + KPADEnableMplsAccRevise(chan); + KPADSetMplsAccReviseParam(chan, 0.03f, 0.4f); + KPADEnableMplsDpdRevise(chan); + KPADSetMplsDpdReviseParam(chan, 0.5f); +} + +extern "C" void fn_80194080(); +void create() { + mPad::create(); + + KPADSetBtnRepeat(mPad::getCore(0)->getChannelID(), 0.5f, 0.1f); + ex_c::resetInfo(); + + KPADSetMplsWorkarea(new (0x20) u8[KPADGetMplsWorkSize()]); + + for (int i = 0; i < 4; ++i) { + ex_c::m_ex[i].mMotion.init(); + KPADSetReviseMode(i, 1); + KPADSetControlMplsCallback(i, control_mpls_callback); + ex_c::m_ex[i].gotoStateWaitForConnect(i); + } + fn_80194080(); +} + +void setMpls(bool enable, s32 chan) { + if (enable) { + if (ex_c::m_ex[chan].mMplsEnabled == false) { + ex_c::m_ex[chan].mMplsEnabled = true; + // WPAD_DEV_MODE_MPLS_PT_FS + // i.e. Skyward Sword wants both MotionPlus and Nunchuk + KPADEnableMpls(chan, 5); + initMpls(chan); + } + } else { + if (ex_c::m_ex[chan].mMplsEnabled) { + ex_c::m_ex[chan].mMplsEnabled = false; + KPADDisableMpls(chan); + } + } +} + +void convertDpdPosToScreenPos(mVec2_c &in, mVec2_c &out) { + out.x = dGfx_c::getWidth4x3F() * 0.5f * (1.f + in.x) + dGfx_c::getWidth4x3LeftF(); + out.y = dGfx_c::getCurrentScreenHeightF() * -0.5f * (1.f + in.y) + dGfx_c::getCurrentScreenTopF(); +} + +extern "C" void fn_801940C0(); +void beginPad_BR() { + mPad::beginPad(); + + if (mPad::getCore(0)->isConnected()) { + WPADSetAcceptConnection(0); + } else { + WPADSetAcceptConnection(1); + } + + // Forces only first controller to be active + for (int i = 1; i < 4; ++i) { + if (mPad::getCore(i)->isConnected()) { + WPADDisconnect(i); + } + } + + dPad::ex_c &ex = ex_c::m_ex[0]; + ex.fn_800572A0(0); + if (mPad::getCore(0)->isConnected()) { + ex.getUnifiedWpadStatus(0); + ex.fn_80059300(0); + ex.fn_80056AF0(0); + ex.fn_80056B90(0); + ex.fn_80056CE0(0); + ex.workMplsCalibration(0); + bool isDpdReviseEnabled = KPADIsEnableMplsDpdRevise(0) >= 0.f; + if (ex.field_0x22CE) { + if (isDpdReviseEnabled) { + KPADDisableMplsDpdRevise(0); + } + } else { + if (!isDpdReviseEnabled) { + KPADEnableMplsDpdRevise(0); + } + } + ex.field_0x22CE = false; + + const dAcPy_c *player = dAcPy_c::GetLink(); + if (player && player->isAttacking()) { + mMtx_c m; + mVec3_c baseX; + mVec3_c baseY; + mVec3_c baseZ; + KPADVec kpadvec; + m.XrotS(mAng::deg2short(-30.f)); + baseZ.z = m.m[2][2]; + baseZ.y = m.m[1][2]; + baseZ.x = m.m[0][2]; + kpadvec[2].x = baseZ.x; + kpadvec[2].y = baseZ.y; + kpadvec[2].z = baseZ.z; + + VECCrossProduct(ex_c::m_ex[0].mMPLS.mY, baseZ, baseX); + if (VECMag(baseX) > 0.05f) { + baseX.normalize(); + kpadvec[0].z = baseX.z; + kpadvec[0].y = baseX.y; + kpadvec[0].x = baseX.x; + } else { + baseX = baseZ; + kpadvec[0].z = baseX.z; + kpadvec[0].y = baseX.y; + kpadvec[0].x = baseX.x; + } + + VECCrossProduct(baseZ, baseX, baseY); + if (VECMag(baseY) > 0.05f) { + baseY.normalize(); + kpadvec[1].z = baseY.z; + kpadvec[1].y = baseY.y; + kpadvec[1].x = baseY.x; + } else { + baseY = baseZ; + kpadvec[1].z = baseY.z; + kpadvec[1].y = baseY.y; + kpadvec[1].x = baseY.x; + } + + KPADSetMplsDirReviseBase(0, kpadvec); + enableMplsDirRevise(0); + } else { + disableMplsDirRevise(0); + } + + KPADEnableMplsAccRevise(0); + KPADSetMplsAccReviseParam(0, 0.03f, 0.4f); + + if ((dCsGame_c::GetInstance() && dCsGame_c::GetInstance()->fn_801BF5E0() && !ex.field_0x22D0) || + (dAcPy_c::GetLink() && + dAcPy_c::GetLink()->checkActionFlagsCont(0x400 | 0x100 | 0x80 | 0x40 | 0x10 | 0x4 | 0x2 | 0x1) && + !dAcPy_c::GetLink()->vt_0x1C0() && !dLytMeter_c::GetMain()->getField_0x1377F()) || + ex.field_0x22CF) { + if (dLytControlGame_c::getInstance() && dLytControlGame_c::getInstance()->isStateNormal()) { + if (!(dPauseManager_c::GetInstance() && dPauseManager_c::GetInstance()->getField_0x25())) { + KPADDisableMplsDpdRevise(0); + KPADDisableMplsAccRevise(0); + } + } + KPADDisableMplsDirRevise(0); + } + if (ex.mIsCalibrating || ex.field_0x48 != 0) { + KPADEnableMplsAccRevise(0); + KPADSetMplsAccReviseParam(0, 1.f, 0.6f); + if (--ex.field_0x48 < 0) { + ex.field_0x48 = 0; + } + } + + ex.field_0x22CF = false; + ex.mFSStick.x = mPad::getCore(0)->getFreeStickX(); + ex.mFSStick.y = mPad::getCore(0)->getFreeStickY(); + ex.mFSStickDistance = ex.mFSStick.length(); + ex.mFSStickAngle = -ex.mFSStick.ang(); + + ex.calcFSStickDirMask(); + + bool isMpls = mPad::isMpls(0) || mPad::isMplsPtFS(0); + if (isMpls) { + ex.mMPLSVelocity.copyFrom(&mPad::getCore(0)->getCoreStatus()->mpls_rot); + ex.mMPLS.mX.copyFrom(&mPad::getCore(0)->getCoreStatus()->mpls_basis_x); + ex.mMPLS.mY.copyFrom(&mPad::getCore(0)->getCoreStatus()->mpls_basis_y); + ex.mMPLS.mZ.copyFrom(&mPad::getCore(0)->getCoreStatus()->mpls_basis_z); + } else { + ex.mMPLSVelocity.set(0.f, 0.f, 0.f); + ex.mMPLS.mX = mVec3_c::Ex; + ex.mMPLS.mY = mVec3_c::Ey; + ex.mMPLS.mZ = mVec3_c::Ez; + } + + ex.fn_80056790(0); + + if (ex.field_0x50) { + ex.mDpdPos = ex.field_0x5C; + } else { + if (mPad::getCore(0)->getDpdValidFlag() > 0) { + // TODO - ctor regswap + ex.mDpdPos = mPad::getCore(0)->getDpdRawPos(); + // ex.mDpdPos.set(v.x, v.y); + } else { + ex.mDpdPos.set(-2.f, -2.f); + } + } + convertDpdPosToScreenPos(ex.mDpdPos, ex.mDpdPosScreen); + ex.updateStatus(0); + } + + ex_c::m_current_ex = &ex_c::m_ex[mPad::getCurrentCoreID()]; + + if (dReset::Manage_c::GetInstance()->isSoftResetOrSafetyWait()) { + for (int i = 0; i < 4; ++i) { + EGG::CoreController *core = mPad::g_core[i]; + core->getCoreStatus()->hold &= EGG::cCORE_BUTTON_HOME; + core->getCoreStatus()->trig &= EGG::cCORE_BUTTON_HOME; + core->getCoreStatus()->release &= EGG::cCORE_BUTTON_HOME; + } + } + fn_801940C0(); +} + +void endPad_BR() { + mPad::endPad(); +} + +void connectCallback(const EGG::CoreControllerConnectArg &rArg) { + switch (rArg.result) { + case WPAD_ERR_OK: { + dSndPlayerMgr_c::GetInstance()->setup(rArg.chan); + ex_c::m_ex[rArg.chan].mDidConnect = true; + break; + } + case WPAD_ERR_NO_CONTROLLER: { + dSndPlayerMgr_c::GetInstance()->shutdown(rArg.chan); + ex_c::m_ex[rArg.chan].mDidDisconnect = true; + break; + } + } +} + +void setConnectCallback() { + EGG::CoreControllerMgr::setConnectCallback(connectCallback); +} + +void enableMplsDirRevise(s32 chan) { + KPADEnableMplsDirRevise(chan); +} + +void disableMplsDirRevise(s32 chan) { + KPADDisableMplsDirRevise(chan); +} + +ex_c::ex_c() + : mDpdPos(0.f, 0.f), + mDpdPosScreen(0.f, 0.f), + mFSStick(0.f, 0.f), + mFSStickDistance(0.f), + mFSStickAngle(0), + mWPADProbeResult(0), + mWPADProbeResultStable(0), + mWPADProbeStableTimer(0), + mWPADDeviceType(0), + mWPADDeviceTypeStable(0xFF), + mWPADDeviceTypeStableTimer(0), + mConnectedStableTimer(0), + field_0x3C(0), + mCalibrationWork(0.f), + field_0x44(false), + field_0x45(false), + field_0x46(false), + mIsCalibrating(false), + field_0x48(0), + mDidConnect(false), + mDidDisconnect(false), + mNeedMplsCalibration(true), + field_0x4F(false), + field_0x50(true), + field_0x51(0), + mMplsEnabled(false), + field_0x53(false), + field_0x54(false), + field_0x55(false), + field_0x56(false), + field_0x57(false), + field_0x58(false), + field_0x59(false), + field_0x5A(false), + field_0x5B(false), + field_0x5C(0.f, 0.f), + field_0x64(0.f, 0.f), + mIsWPADDeviceTypeMplsStableTimer(0), + field_0x70(0x1200), + field_0x74(1.f, 0.f, 0.f), + field_0x80(0.f, 1.f, 0.f), + field_0x8C(0.f, 0.f, 1.f), + mState(0), + mOutOfHbmStableTimer(0), + field_0x2288(0), + field_0x22CE(0), + field_0x22CF(0), + field_0x22D0(0), + mFSStickMaskChanged(false), + mFSStickMask(0), + field_0x22D8(0) { + memset(&mStatus, 0, sizeof(mStatus)); +} + +void ex_c::fn_80055EF0(s32 chan) { + const s32 readLen = mPad::getCore(chan)->getReadLength(); + + // Shift all old acceleration values back + for (int i = 120 - 1; i >= readLen; i--) { + mMotion.mAccVecs[i] = mMotion.mAccVecs[i - readLen]; + mMotion.mAccValues[i] = mMotion.mAccValues[i - readLen]; + mFSMotion.mAccVecs[i] = mFSMotion.mAccVecs[i - readLen]; + mFSMotion.mAccValues[i] = mFSMotion.mAccValues[i - readLen]; + } + + // Write newly read Wiimote acceleration values + // TODO - Missing an implicit != 0 check before the loop + for (int i = 0; i < readLen; i++) { + EGG::CoreStatus status = *mPad::getCore(chan)->getCoreStatus(i); + mMotion.mAccVecs[i].copyFrom(&status.acc); + mMotion.mAccValues[i] = status.acc_value; + } + + mMotion.fn_80058AE0(chan, true); + + // Write newly read Nunchuk acceleration values + for (int i = 0; i < readLen; ++i) { + if (mPad::getCore(chan)->getDevType() == EGG::cDEV_FREESTYLE || + (mPad::isMplsPtFS(chan) && (u8)KPADGetMplsStatus(chan) == 5)) { + EGG::CoreStatus status = *mPad::getCore(chan)->getCoreStatus(i); + mFSMotion.mAccVecs[i].copyFrom(&status.acc); + mFSMotion.mAccValues[i] = status.acc_value; + } else { + mFSMotion.mAccVecs[i].set(0.f, 0.f, 0.f); + mFSMotion.mAccValues[i] = 0.f; + } + } + if (mPad::getCore(chan)->getDevType() == EGG::cDEV_FREESTYLE || + (mPad::isMplsPtFS(chan) && (u8)KPADGetMplsStatus(chan) == 5)) { + mFSMotion.fn_80058AE0(chan, false); + } +} + +void float_order_d_pad() { + EGG::Math::epsilon(); +} + +void ex_c::fn_800562B0(s32 chan, mVec3_c &mpls) { + if (field_0x53) { + mpls = m_ex[chan].mMPLS.mY; + mpls *= -1.f; + } else { + mpls = m_ex[chan].mMPLS.mZ; + } +} + +// this looks like nw4r::ut::Clamp but the ternaries are swapped +template +inline T WeirdClamp(T value, T min, T max) { + return value < min ? min : (value > max ? max : value); +} + +void ex_c::fn_80056330(s32 chan) { + f32 mult = WeirdClamp(1.f - field_0x8C.y * field_0x8C.y, 0.f, 1.f); + + mVec3_c basis; + if (field_0x53) { + basis = m_ex[chan].mMPLS.mZ; + } else { + basis = m_ex[chan].mMPLS.mY; + } + // ?? + field_0x74 = (mult * (mVec3_c::Ey - basis) + basis).cross(field_0x8C); + + f32 mag = field_0x74.mag(); + bool b = std::abs(mag) <= EGG::Math::epsilon(); + if (b) { + field_0x74 = mVec3_c::Ex; + } else { + field_0x74 *= 1.f / mag; + } + + field_0x80 = field_0x8C.cross(field_0x74); + field_0x80.normalize(); +} + +void ex_c::fn_80056580(s32 chan, const mVec2_c &vec) { + field_0x5C = vec; + field_0x53 = false; + + mMtx_c m; + m.ZXYrotS(-field_0x5C.y * field_0x70, field_0x5C.x * field_0x70, 0); + MTXMultVecSR(m, m_ex[chan].mMPLS.mZ, field_0x8C); + + fn_80056330(chan); +} + +void ex_c::centerCursor(s32 chan, bool b) { + if (field_0x51 != 0 && b) { + return; + } + field_0x64 = field_0x5C; + + // NON-MATCHING + bool tmp = false; + const EGG::Vector3f acc = mPad::getCore()->getAccelBad(); + if (dAcPy_c::GetLink() && dAcPy_c::GetLink()->checkActionFlagsCont(0x2) && acc.z < -0.9f) { + tmp = true; + } + field_0x53 = tmp; + + fn_800562B0(chan, field_0x8C); + fn_80056330(chan); + + if (b) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_POINTER_RESET); + field_0x51 = 3; + } else { + field_0x51 = 0; + field_0x5C.set(0.f, 0.f); + mDpdPos.set(0.f, 0.f); + convertDpdPosToScreenPos(mDpdPos, mDpdPosScreen); + } +} + +void ex_c::fn_80056790(s32 chan) { + // unused - TODO ctor regswap + mVec2_c dpdRawPos = mPad::getCore(chan)->getDpdRawPos(); + + f32 f; + if (dScGame_c::GetInstance() != nullptr && dLytMap_c::GetInstance() != nullptr && + !dLytMap_c::GetInstance()->isNotInvisible()) { + f = dScGame_c::GetInstance()->targetingScreenFn_801BBEC0(); + } else { + f = 1.0f; + } + field_0x22D8 = 0; + EGG::CoreStatus coreStatus = *mPad::getCore(chan)->getCoreStatus(0); + if (coreStatus.dpd_valid_fg == 2) { + field_0x22D8 = 1; + } + mVec3_c v; + fn_800562B0(chan, v); + mVec3_c v2(v.dot(field_0x74), v.dot(field_0x80), v.dot(field_0x8C)); + v2.z = nw4r::ut::Max(v2.z, field_0x70.cos()); + + s16 b1 = cM::atan2s(-v2.x, v2.z); + field_0x5C.x = WeirdClamp(b1 * (1.0f / field_0x70), -1.0f, 1.0f); + s16 b2 = cM::atan2s(-v2.y, v2.z); + field_0x5C.y = WeirdClamp(b2 * (1.0f / field_0x70), -f, f); + + if (field_0x51 != 0) { + field_0x51--; + } + f32 f4 = field_0x51 * (1 / 3.0f); + // lerp + field_0x5C = field_0x5C * (1.0f - f4) + field_0x64 * f4; +} + +void ex_c::setField_0x70(mAng ang) { + field_0x70 = ang; +} + +void ex_c::setField_0x70() { + field_0x70.set(0x1200); +} + +void ex_c::fn_80056AF0(s32 chan) { + if (mDidConnect) { + mDidConnect = false; + mConnectedStableTimer = 90; + field_0x44 = true; + + m_ex[chan].field_0x46 = true; + m_ex[chan].field_0x3C = 120; + } else { + field_0x44 = false; + } + if (mDidDisconnect) { + mDidDisconnect = false; + field_0x45 = true; + m_ex[chan].mWPADDeviceTypeStable = WPAD_DEV_UNKNOWN; + } else { + field_0x45 = false; + } +} + +bool ex_c::checkWPADProbeStable() { + return mWPADProbeResultStable == WPAD_ERR_OK; +} + +void ex_c::fn_80056B90(s32 chan) { + u32 prevType = mWPADDeviceType; + WPADResult prevResult = mWPADProbeResult; + + mWPADProbeResult = WPADProbe(chan, &mWPADDeviceType); + + if (prevResult == mWPADProbeResult) { + mWPADProbeStableTimer++; + if (mWPADProbeStableTimer >= 5) { + mWPADProbeStableTimer = 5; + } + } else { + mWPADProbeStableTimer = 0; + } + if (mWPADProbeStableTimer >= 5) { + mWPADProbeResultStable = mWPADProbeResult; + } + if (mConnectedStableTimer > 0) { + mConnectedStableTimer--; + if (mConnectedStableTimer < 0) { + mConnectedStableTimer = 0; + } + } + + if (prevType != mWPADDeviceType) { + mWPADDeviceTypeStableTimer = 0; + } else { + mWPADDeviceTypeStableTimer++; + if (mWPADDeviceTypeStableTimer > 20) { + mWPADDeviceTypeStableTimer = 20; + } + } + + if (mWPADDeviceType != mWPADDeviceTypeStable && mWPADDeviceTypeStableTimer >= 20) { + mWPADDeviceTypeStable = mWPADDeviceType; + } + + if (!isDeviceTypeMpls(mWPADDeviceTypeStable)) { + mNeedMplsCalibration = true; + mIsWPADDeviceTypeMplsStableTimer = 0; + } + if (isDeviceTypeMpls(mWPADDeviceTypeStable) && mIsWPADDeviceTypeMplsStableTimer < 8) { + mIsWPADDeviceTypeMplsStableTimer++; + } +} + +void ex_c::fn_80056CE0(s32 chan) { + if (field_0x46 == false) { + return; + } + + if (field_0x3C == 1) { + if (WPADCanSendStreamData(chan) && WPADGetRadioSensitivity(chan) > 50) { + WPADResult res = getInfo(chan); + if (res == WPAD_ERR_OK || res == WPAD_ERR_NO_CONTROLLER) { + field_0x46 = false; + } else { + field_0x3C = 120; + } + } else { + field_0x3C = 120; + } + } + field_0x3C--; + if (field_0x3C < 0) { + field_0x3C = 0; + } +} + +void ex_c::startMplsCalibration(s32 chan) { + KPADStartMplsCalibration(chan); + mIsCalibrating = true; + mCalibrationWork = 1.0f; + field_0x48 = 0; +} + +void ex_c::workMplsCalibration(s32 chan) { + if (!mIsCalibrating) { + return; + } + + mCalibrationWork = KPADWorkMplsCalibration(chan); + if (mCalibrationWork == 0.0f) { + mIsCalibrating = false; + field_0x48 = 60; + } +} + +f32 ex_c::getCalibrationWork() { + return mCalibrationWork; +} + +void ex_c::stopMplsCalibration(s32 chan) { + mIsCalibrating = false; + mCalibrationWork = 0.0f; + KPADStopMplsCalibration(chan); + field_0x48 = 0; +} + +void ex_c::centerCursor(s32 chan) { + centerCursor(chan, false); + field_0x48 = 0; +} + +void ex_c::gotoStateWaitForConnect(s32 chan) { + mState = EX_STATE_WAITING_FOR_CONNECT; +} + +void ex_c::executeStateWaitForConnect(s32 chan) { + if (mPad::getCore(chan)->isConnected()) { + gotoStatePostConnect(chan); + } +} + +void ex_c::gotoStatePostConnect(s32 chan) { + mState = EX_STATE_POST_CONNECT; +} + +void ex_c::executeStatePostConnect(s32 chan) { + if (dHbm::Manage_c::GetInstance()->getState() == dHbm::Manage_c::HBM_MANAGE_ACTIVE) { + // If we are in HBM, set some sort of cooldown + mOutOfHbmStableTimer = 110; + field_0x4F = true; + } + + if (mPad::getCore(chan)->isConnected()) { + if (ex_c::checkWPADProbeStable() && + dHbm::Manage_c::GetInstance()->getState() != dHbm::Manage_c::HBM_MANAGE_ACTIVE) { + // Enable Mpls after we leave HBM + gotoStateEnableMpls(chan); + } + } + + if (!mPad::getCore(chan)->isConnected()) { + gotoStateWaitForConnect(chan); + } +} + +void ex_c::gotoStateEnableMpls(s32 chan) { + mState = EX_STATE_ENABLE_MPLS; + setMpls(true, chan); +} + +void ex_c::executeStateEnableMpls(s32 chan) { + if (fn_80059350(chan) || fn_80059370(chan)) { + gotoStateMplsConfigError(chan); + } else if (fn_80059390(chan)) { + gotoStateMplsConfigured(chan); + } +} + +void ex_c::gotoStateDisconnectWpad(s32 chan) { + mState = EX_STATE_DISCONECT_WPAD; + WPADDisconnect(chan); +} + +void ex_c::executeStateDisconnectWpad(s32 chan) { + gotoStatePostConnect(chan); +} + +void ex_c::gotoStateMplsConfigError(s32 chan) { + mState = EX_STATE_MPLS_CONFIG_ERROR; + setMpls(false, chan); + field_0x2288 = 0; +} + +void ex_c::executeStateMplsConfigError(s32 chan) { + if (fn_80059390(chan)) { + if (dHbm::Manage_c::GetInstance()->getState() == dHbm::Manage_c::HBM_MANAGE_ACTIVE) { + gotoStatePostConnect(chan); + } else { + gotoStateEnableMpls(chan); + } + } else { + if (dHbm::Manage_c::GetInstance()->getState() != dHbm::Manage_c::HBM_MANAGE_ACTIVE) { + if (field_0x2288 > 120) { + gotoStateDisconnectWpad(chan); + } else { + field_0x2288++; + } + } + } +} + +void ex_c::gotoStateMplsConfigured(s32 chan) { + mState = EX_STATE_MPLS_CONFIGURED; +} + +void ex_c::executeStateMplsConfigured(s32 chan) { + if (!mPad::getCore(chan)->isConnected()) { + setMpls(false, chan); + gotoStateWaitForConnect(chan); + } else { + if (fn_80059330(chan) || fn_80059350(chan) || fn_80059370(chan)) { + setMpls(false, chan); + } + } + if (!mMplsEnabled) { + gotoStatePostConnect(chan); + } + + if (dHbm::Manage_c::GetInstance()->getState() == dHbm::Manage_c::HBM_MANAGE_ACTIVE) { + field_0x4F = false; + } +} + +void ex_c::fn_800572A0(s32 chan) { + switch (mState) { + case EX_STATE_WAITING_FOR_CONNECT: executeStateWaitForConnect(chan); break; + case EX_STATE_POST_CONNECT: executeStatePostConnect(chan); break; + case EX_STATE_ENABLE_MPLS: executeStateEnableMpls(chan); break; + case EX_STATE_DISCONECT_WPAD: executeStateDisconnectWpad(chan); break; + case EX_STATE_MPLS_CONFIG_ERROR: executeStateMplsConfigError(chan); break; + case EX_STATE_MPLS_CONFIGURED: executeStateMplsConfigured(chan); break; + } + + if (mState != EX_STATE_POST_CONNECT && + dHbm::Manage_c::GetInstance()->getState() != dHbm::Manage_c::HBM_MANAGE_ACTIVE) { + if (mOutOfHbmStableTimer > 0) { + mOutOfHbmStableTimer--; + } else { + mOutOfHbmStableTimer = 0; + } + } +} + +void ex_c::acc_c::init() { + for (int i = 0; i < 120; ++i) { + mAccVecs[i].set(0.f, 0.f, 0.f); + field_0x5A0[i].set(0.f, 0.f, 0.f); + mAccValues[i] = 0.f; + } + for (int i = 0; i < 39; ++i) { + field_0xD20[i].set(0.f, 0.f, 0.f); + } + for (int i = 0; i < 33; ++i) { + field_0xEF4[i].set(0.f, 0.f, 0.f); + } + field_0x1080.set(0.f, 0.f, 0.f); + field_0x108C.set(0.f, 0.f, 0.f); + + MTXIdentity(field_0x1098); + field_0x10C8 = 0; + field_0x10CC = 0; + field_0x10D0 = 0; + field_0x10D4 = 0; + field_0x10D8 = 31; +} + +f32 ex_c::acc_c::getMaxAccValue(s32 chan) { + s32 readLen = mPad::getCore(chan)->getReadLength(); + if (readLen == 0) { + return 0.0f; + } + + f32 max = 0.0f; + for (int i = 0; i < readLen; i++) { + if (max < mAccValues[i]) { + max = mAccValues[i]; + } + } + return max; +} + +void ex_c::acc_c::fn_800576D0(s32 chan) { + // unused + (void)nw4r::math::FSqrt(mAccVecs[0].squaredLength()); + + f32 maxAccValue = getMaxAccValue(chan); + if (maxAccValue <= 1.1f && mAccVecs[0].y < 0.35f) { + field_0x10D0++; + if (field_0x10D0 >= 6) { + field_0x10D0 = 6; + field_0x108C = mAccVecs[0]; + mVec3_c dir(0.0f, -1.0f, 0.0f); + f32 len = mAccVecs[0].squaredLength(); + if (!cM3d_IsZero(len)) { + // TODO - bad part start + mVec3_c acc = mAccVecs[0]; + acc.normalize(); + mVec3_c cross = acc.cross(dir); + f32 f = acc.dot(dir); + if (!cM3d_IsZero(cross.squaredLength())) { + cross.normalize(); + f32 acos = std::acosf(f); + MTXRotAxisRad(field_0x1098, cross, acos); + // TODO - bad part end + } else { + MTXIdentity(field_0x1098); + } + } else { + MTXIdentity(field_0x1098); + } + } + } else { + field_0x10D0 = 0; + } +} + +void ex_c::acc_c::fn_800578E0(s32 chan) { + const s32 readLen = mPad::getCore(chan)->getReadLength(); + + // Shift old values back + for (int i = readLen; i < 120; i++) { + field_0x5A0[i] = field_0x5A0[i - readLen]; + } + + // TODO - loop strength reduction too strong + f32 max = -8.0f; + bool b = false; + for (int i = 0; i < readLen; i++) { + if (max < mAccVecs[i].y) { + max = mAccVecs[i].y; + b = true; + } + MTXMultVec(field_0x1098, mAccVecs[i], field_0x5A0[i]); + field_0x5A0[i].y += 1.0f; + } + + if (b) { + field_0x10D4 = max; + } +} + +void ex_c::acc_c::fn_80057AC0(s32 chan, bool b) { + const s32 readLen = mPad::getCore(chan)->getReadLength(); + + // Shift field_0xD20 back by one + for (int i = 38; i > 0; i--) { + field_0xD20[i] = field_0xD20[i - 1]; + } + + for (int i = 0; i < readLen; i++) { + field_0x1080.x += mAccVecs[i].x; + field_0x1080.y += mAccVecs[i].y; + field_0x1080.z += mAccVecs[i].z; + } + + if (b) { + field_0x1080 *= 0.96f; + } else { + field_0x1080 *= 0.98f; + } + + // TODO - problematic part start + + field_0xD20[0] = field_0x1080; + + for (int i = 3; i < 36;) { + int k = i++ - 3; + f32 x = 0.0f; + f32 y = 0.0f; + f32 z = 0.0f; + for (int j = 0; j < 7; j++) { + x += field_0xD20[k + j].x / 7.0f; + y += field_0xD20[k + j].y / 7.0f; + z += field_0xD20[k + j].z / 7.0f; + } + field_0xEF4[k].set(x, y, z); + } + + // TODO - problematic part end +} + +f32 ex_c::acc_c::fn_80057F00(s32 chan) { + s32 offs = chan + 3; + return field_0xD20[offs].x - field_0xEF4[chan].x; +} + +f32 ex_c::acc_c::fn_80057F30(s32 chan) { + s32 offs = chan + 3; + return field_0xD20[offs].y - field_0xEF4[chan].y; +} + +f32 ex_c::acc_c::fn_80057F60(s32 chan) { + s32 offs = chan + 3; + return field_0xD20[offs].z - field_0xEF4[chan].z; +} + +bool ex_c::acc_c::fn_80057F90(s32 idx, bool b) { + if ((b && ((fn_80057F00(idx) < -13.5f) || fn_80057F00(idx + 1) < -13.5f) && + std::fabsf(fn_80057F00(idx + 1) - fn_80057F00(idx)) > 3.75f) || + (!b && ((fn_80057F00(idx) < -5.0f) || fn_80057F00(idx + 1) < -5.0f) && + std::fabsf(fn_80057F00(idx + 1) - fn_80057F00(idx)) > 2.75f)) { + return true; + } + return false; +} +bool ex_c::acc_c::fn_800580C0(s32 idx, bool b) { + if ((b && ((fn_80057F00(idx) > 13.5f) || fn_80057F00(idx + 1) > 13.5f) && + std::fabsf(fn_80057F00(idx + 1) - fn_80057F00(idx)) > 3.75f) || + (!b && ((fn_80057F00(idx) > 5.0f) || fn_80057F00(idx + 1) > 5.0f) && + std::fabsf(fn_80057F00(idx + 1) - fn_80057F00(idx)) > 2.75f)) { + return true; + } + return false; +} + +bool ex_c::acc_c::fn_800581F0(s32 idx, bool b) { + if ((b && ((fn_80057F30(idx) < -13.5f) || fn_80057F30(idx + 1) < -13.5f) && + std::fabsf(fn_80057F30(idx + 1) - fn_80057F30(idx)) > 3.75f) || + (!b && ((fn_80057F30(idx) < -5.0f) || fn_80057F30(idx + 1) < -5.0f) && + std::fabsf(fn_80057F30(idx + 1) - fn_80057F30(idx)) > 2.75f)) { + return true; + } + return false; +} +bool ex_c::acc_c::fn_80058320(s32 idx, bool b) { + if ((b && ((fn_80057F30(idx) > 13.5f) || fn_80057F30(idx + 1) > 13.5f) && + std::fabsf(fn_80057F30(idx + 1) - fn_80057F30(idx)) > 3.75f) || + (!b && ((fn_80057F30(idx) > 5.0f) || fn_80057F30(idx + 1) > 5.0f) && + std::fabsf(fn_80057F30(idx + 1) - fn_80057F30(idx)) > 2.75f)) { + return true; + } + return false; +} + +bool ex_c::acc_c::fn_80058450(s32 idx, bool b) { + // Note - same behavior, whether b is set or not + if ((b && (fn_80057F60(idx) > 2.0f) && (fn_80057F60(idx + 1) - fn_80057F60(idx)) < -2.0f) || + (!b && (fn_80057F60(idx) > 2.0f) && (fn_80057F60(idx + 1) - fn_80057F60(idx)) < -2.0f)) { + return true; + } + return false; +} + +void ex_c::acc_c::fn_80058540(s32 chan, bool b) { + bool b1 = false; + bool b2 = false; + bool b3 = false; + bool b4 = false; + // TODO condition + if (b && (mPad::isMpls(chan) || mPad::isMplsPtFS(chan))) { + if (m_ex[chan].mMPLSVelocity.x > 2.0f) { + b4 = true; + } else if (m_ex[chan].mMPLSVelocity.x < -2.0f) { + b3 = true; + } else if (m_ex[chan].mMPLSVelocity.y > 2.0f) { + b1 = true; + } else if (m_ex[chan].mMPLSVelocity.y < -2.0f) { + b2 = true; + } + } else { + int i1 = 0; + int i2 = 0; + int i3 = 0; + field_0x10D8++; + if (field_0x10D8 > 31) { + field_0x10D8 = 31; + } + + bool b1_ = false; + bool b2_ = false; + bool b3_ = false; + bool b4_ = false; + + int start = field_0x10D8; + for (int i = field_0x10D8; i >= 0; i--) { + if (fn_80057F90(i, b)) { + b1_ = true; + b2_ = false; + } + + if (fn_800580C0(i, b)) { + b2_ = true; + b1_ = false; + } + + if (fn_80057F90(i, b) || fn_800580C0(i, b)) { + i1 = 2; + } else { + i1--; + if (i1 < 0) { + i1 = 0; + b1_ = false; + b2_ = false; + } + } + + if (fn_800581F0(i, b)) { + b3_ = true; + b4_ = false; + } + + if (fn_80058320(i, b)) { + b4_ = true; + b3_ = false; + } + + if (fn_800581F0(i, b) || fn_80058320(i, b)) { + i2 = 2; + } else { + i2--; + if (i2 < 0) { + i2 = 0; + b3_ = false; + b4_ = false; + } + } + + if (fn_80058450(i, b)) { + i3 = 2; + } else { + i3--; + if (i3 < 0) { + i3 = 0; + } + } + } + + if (start != 0 && i3 > 0) { + if (b1_) { + field_0x10D8 = 0; + b1 = true; + } + if (b2_) { + field_0x10D8 = 0; + b2 = true; + } + if (b3_) { + field_0x10D8 = 0; + b3 = true; + } + if (b4_) { + field_0x10D8 = 0; + b4 = true; + } + } + } + + fn_80058990(0x1, b1); + fn_80058990(0x2, b2); + fn_80058990(0x4, b3); + fn_80058990(0x8, b4); + fn_80058990(0x10, b1 || b2 || b3 || b4); + + bool b6; + if (b) { + b6 = getMaxAccValue(chan) > (field_0x10CC ? 2.0f : 3.0f); + } else { + b6 = getMaxAccValue(chan) > (field_0x10CC ? 1.5f : 2.0f); + } + fn_80058990(0x20, b6); +} + +void ex_c::acc_c::fn_80058990(u32 mask, bool b) { + if (b) { + if ((field_0x10CC & mask) != 0) { + field_0x10C8 &= ~mask; + } else { + field_0x10C8 |= mask; + } + field_0x10CC |= mask; + } else { + field_0x10CC &= ~mask; + field_0x10C8 &= ~mask; + } +} + +bool ex_c::acc_c::fn_800589F0() { + return true; +} + +f32 ex_c::acc_c::fn_80058A00() { + cM3dGAab aab; + aab.ClearForMinMax(); + for (int i = 0; i < 120; i++) { + aab.SetMinMax(mAccVecs[i]); + } + + f32 lenSq = nw4r::math::VEC3LenSq(aab.GetMax() - aab.GetMin()) - 0.017f; + if (lenSq < 0.0f) { + lenSq = 0.0f; + } + return lenSq; +} + +void ex_c::acc_c::fn_80058AE0(s32 chan, bool b) { + fn_800576D0(chan); + fn_800578E0(chan); + fn_80057AC0(chan, b); + fn_80058540(chan, b); +} + +mMtx_c ex_c::mpls_c::getMtx() const { + mMtx_c m; + m.setBase(0, mX); + m.setBase(1, mY); + m.setBase(2, mZ); + m.setBase(3, mVec3_c::Zero); + return m; +} + +bool ex_c::isMissingMpls() { + if (m_current_ex->mConnectedStableTimer != 0) { + return false; + } + + if (m_current_ex->mOutOfHbmStableTimer != 0) { + return false; + } + + return !isDeviceTypeMpls(m_current_ex->mWPADDeviceTypeStable); +} + +bool ex_c::isMissingNunchuk() { + if (m_current_ex->mConnectedStableTimer != 0) { + return false; + } + + if (m_current_ex->mOutOfHbmStableTimer != 0) { + return false; + } + + if (m_current_ex->mState != EX_STATE_MPLS_CONFIGURED) { + return false; + } + + if (m_current_ex->mWPADDeviceTypeStable == WPAD_DEV_FREESTYLE) { + return false; + } + + if (m_current_ex->mWPADDeviceTypeStable == WPAD_DEV_MPLS_PT_FS) { + return false; + } + + return true; +} + +void ex_c::fn_80058C90(s32 chan) { + m_ex[chan].field_0x46 = true; + m_ex[chan].field_0x3C = 1; +} + +bool ex_c::isLowBattery() { + return getBatteryLevel() == 1; +} +bool ex_c::isOutOfBattery() { + return getBatteryLevel() == 0; +} + +void ex_c::resetInfo() { + for (int i = 0; i < 4; ++i) { + clearInfo(i); + } +} +void ex_c::clearInfo(s32 chan) { + m_connected[chan] = false; + m_info[0][chan].dpd = FALSE; + m_info[0][chan].speaker = FALSE; + m_info[0][chan].attach = FALSE; + m_info[0][chan].lowBat = FALSE; + m_info[0][chan].nearempty = FALSE; + m_info[0][chan].battery = 0; + m_info[0][chan].led = 0; + m_info[0][chan].protocol = 0; + m_info[0][chan].firmware = 0; +} +extern "C" void async_info_callback(WPADChannel chan, WPADResult result) { + switch (result) { + case WPAD_ERR_OK: { + ex_c::setInfo(chan, &ex_c::m_info[0][chan]); + break; + } + case WPAD_ERR_NO_CONTROLLER: { + ex_c::clearInfo(chan); + break; + } + case WPAD_ERR_BUSY: { + ex_c::m_ex[chan].field_0x46 = true; + ex_c::m_ex[chan].field_0x3C = 120; + break; + } + case WPAD_ERR_TRANSFER: { + ex_c::m_ex[chan].field_0x46 = true; + ex_c::m_ex[chan].field_0x3C = 120; + break; + } + } +} +s32 ex_c::getInfo(s32 chan) { + WPADResult res = WPADGetInfoAsync(chan, &ex_c::m_info[0][chan], async_info_callback); + if (res == WPAD_ERR_NO_CONTROLLER) { + clearInfo(chan); + } + return res; +} + +s32 ex_c::getBatteryLevel() { + return getBatteryLevel(mPad::g_currentCoreId); +} +s32 ex_c::getBatteryLevel(s32 chan) { + if (m_connected[chan]) { + return m_info[0][chan].battery; + } + return -1; +} + +void ex_c::setInfo(s32 chan, const WPADInfo *pInfo) { + m_info[0][chan] = *pInfo; + m_connected[chan] = true; +} + +f32 ex_c::fn_80058F50() { + return m_current_ex->mMotion.fn_80058A00(); +} + +bool ex_c::fn_80058F60() { + if (m_current_ex->mIsWPADDeviceTypeMplsStableTimer < 8) { + return true; + } + + if (!m_current_ex->mMotion.fn_800589F0()) { + return true; + } + + m_current_ex->mNeedMplsCalibration = false; + m_current_ex->startMplsCalibration(mPad::getCurrentCoreID()); + m_current_ex->fn_80058C90(mPad::getCurrentCoreID()); + initMpls(mPad::getCurrentCoreID()); + + return false; +} + +f32 ex_c::getCurrentCalibrationWork() { + return m_current_ex->getCalibrationWork(); +} + +void ex_c::fn_80058FF0() { + m_current_ex->stopMplsCalibration(mPad::getCurrentCoreID()); +} + +void ex_c::fn_80059000() { + m_current_ex->centerCursor(mPad::getCurrentCoreID()); +} + +bool ex_c::needMplsCalibration() { + if (!mPad::getCore()->isConnected()) { + return false; + } + + if (isMissingMpls()) { + return false; + } + + if (m_current_ex->mOutOfHbmStableTimer != 0) { + return false; + } + + if (isMissingNunchuk()) { + return false; + } + + if (m_current_ex->mIsWPADDeviceTypeMplsStableTimer >= 8) { + return m_current_ex->mNeedMplsCalibration; + } + + return false; +} + +void ex_c::setCalibrateMpls() { + m_current_ex->mNeedMplsCalibration = true; +} + +bool ex_c::fn_800590B0() { + bool ret = false; + switch (m_current_ex->mState) { + case EX_STATE_POST_CONNECT: + case EX_STATE_ENABLE_MPLS: + case EX_STATE_DISCONECT_WPAD: + case EX_STATE_MPLS_CONFIG_ERROR: + // TODO - one uneliminated dead branch in here + ret = m_current_ex->mState == EX_STATE_MPLS_CONFIG_ERROR || m_current_ex->mState == EX_STATE_ENABLE_MPLS || + m_current_ex->mState == EX_STATE_POST_CONNECT; + } + return ret; +} + +bool ex_c::fn_800590E0() { + return m_current_ex->field_0x4F; +} + +void ex_c::fn_800590F0() { + m_current_ex->field_0x4F = false; +} + +bool ex_c::fn_80059100() { + return fn_80059110(mPad::g_currentCoreId); +} + +bool ex_c::fn_80059110(s32 chan) { + return nw4r::math::VEC3LenSq(m_ex[chan].mMPLSVelocity) >= 0.01f || m_ex[chan].mFSStickDistance >= 0.0001f || + mPad::g_core[chan]->getCoreStatus()->getHold() || mPad::g_core[chan]->getCoreStatus()->getTrigger() || + m_ex[chan].mMotion.field_0x10C8 != 0; +} + +void ex_c::fn_80059210() { + m_current_ex->field_0x22CE = 1; +} + +void ex_c::fn_80059220() { + m_current_ex->field_0x22CF = 1; +} + +void ex_c::fn_80059230() { + m_current_ex->field_0x22D0 = 1; +} + +void ex_c::fn_80059240() { + m_current_ex->field_0x22D0 = 0; +} + +void ex_c::on_0x54(s32 idx) { + m_ex[idx].field_0x54 = true; +} +void ex_c::on_0x55(s32 idx) { + m_ex[idx].field_0x55 = true; +} +void ex_c::on_0x56(s32 idx) { + m_ex[idx].field_0x56 = true; +} +void ex_c::on_0x57(s32 idx) { + m_ex[idx].field_0x57 = true; +} + +void ex_c::fn_800592D0(s32 chan) { + m_ex[chan].field_0x54 = false; + m_ex[chan].field_0x55 = false; + m_ex[chan].field_0x56 = false; + m_ex[chan].field_0x57 = false; +} + +void ex_c::fn_80059300(s32 chan) { + field_0x58 = field_0x54; + field_0x59 = field_0x55; + field_0x5A = field_0x56; + field_0x5B = field_0x57; + fn_800592D0(chan); +} + +bool ex_c::fn_80059330(s32 chan) { + return m_ex[chan].field_0x58; +} + +bool ex_c::fn_80059350(s32 chan) { + return m_ex[chan].field_0x59; +} + +bool ex_c::fn_80059370(s32 chan) { + return m_ex[chan].field_0x5A; +} + +bool ex_c::fn_80059390(s32 chan) { + return m_ex[chan].field_0x5B; +} + +void ex_c::getUnifiedWpadStatus(s32 chan) { + KPADGetUnifiedWpadStatus(chan, &mStatus, 1); +} + +void ex_c::calcFSStickDirMask() { + mFSStickMaskChanged = false; + if (mFSStickDistance < 0.8f) { + mFSStickMask = 0; + return; + } + u32 prevFSStickMask = mFSStickMask; + s32 ang = mFSStickAngle; + ang = ((ang + 0x11000) / 0x2000) % 8; + mFSStickMask = 1 << ang; + if (mFSStickMask != 0 && mFSStickMask != prevFSStickMask) { + mFSStickMaskChanged = true; + } +} + +void ex_c::setNoSleep() { + WPADSetAutoSleepTime(0); +} + +void ex_c::setAutoSleepTime() { + WPADSetAutoSleepTime(5); + WPADResetAutoSleepTimeCount(0); +} + +} // namespace dPad diff --git a/src/d/d_pad_ex.cpp b/src/d/d_pad_ex.cpp new file mode 100644 index 00000000..8fd5d711 --- /dev/null +++ b/src/d/d_pad_ex.cpp @@ -0,0 +1,270 @@ +#include "common.h" +#include "d/d_pad.h" +#include "egg/core/eggController.h" +#include "m/m_angle.h" +#include "m/m_pad.h" +#include "m/m_vec.h" + +namespace dPad { + +void fn_80059620() { + return; +} + +void fn_80059630() { + return; +} + +void fn_80059640() { + return; +} + +void fn_80059650() { + return; +} + +// GET DOWN TRIG + +bool getDownTrig(u32 btns) { + return mPad::g_currentCore->downTrigger(btns); +} + +bool getDownTrigA() { + return mPad::g_currentCore->downTrigger(mPad::BUTTON_A); +} + +bool getDownTrigB() { + return mPad::g_currentCore->downTrigger(mPad::BUTTON_B); +} + +bool getDownTrigC() { + return mPad::g_currentCore->downTrigger(mPad::BUTTON_C); +} + +bool getDownTrigZ() { + return mPad::g_currentCore->downTrigger(mPad::BUTTON_Z); +} + +bool getDownTrigUp() { + return mPad::g_currentCore->downTrigger(mPad::BUTTON_UP); +} + +bool getDownTrigDown() { + return mPad::g_currentCore->downTrigger(mPad::BUTTON_DOWN); +} + +bool getDownTrigLeft() { + return mPad::g_currentCore->downTrigger(mPad::BUTTON_LEFT); +} + +bool getDownTrigRight() { + return mPad::g_currentCore->downTrigger(mPad::BUTTON_RIGHT); +} + +bool getDownTrig1() { + return mPad::g_currentCore->downTrigger(mPad::BUTTON_1); +} + +bool getDownTrig2() { + return mPad::g_currentCore->downTrigger(mPad::BUTTON_2); +} + +bool getDownTrigMinus() { + return mPad::g_currentCore->downTrigger(mPad::BUTTON_MINUS); +} + +bool getDownTrigPlus() { + return mPad::g_currentCore->downTrigger(mPad::BUTTON_PLUS); +} + +// GET DOWN + +bool getDown(u32 btns) { + return mPad::g_currentCore->down(btns); +} +bool getDownAll(u32 btns) { + return mPad::g_currentCore->downAll(btns); +} +bool getDownA() { + return mPad::g_currentCore->down(mPad::BUTTON_A); +} +bool getDownB() { + return mPad::g_currentCore->down(mPad::BUTTON_B); +} +bool getDownC() { + return mPad::g_currentCore->down(mPad::BUTTON_C); +} +bool getDownZ() { + return mPad::g_currentCore->down(mPad::BUTTON_Z); +} +bool getDownUp() { + return mPad::g_currentCore->down(mPad::BUTTON_UP); +} +bool getDownDown() { + return mPad::g_currentCore->down(mPad::BUTTON_DOWN); +} +bool getDownLeft() { + return mPad::g_currentCore->down(mPad::BUTTON_LEFT); +} +bool getDownRight() { + return mPad::g_currentCore->down(mPad::BUTTON_RIGHT); +} +bool getDown1() { + return mPad::g_currentCore->down(mPad::BUTTON_1); +} +bool getDown2() { + return mPad::g_currentCore->down(mPad::BUTTON_2); +} +bool getDownMinus() { + return mPad::g_currentCore->down(mPad::BUTTON_MINUS); +} +bool getDownPlus() { + return mPad::g_currentCore->down(mPad::BUTTON_PLUS); +} + +// GET UP TRIG + +bool getUpTrig(u32 btns) { + return mPad::g_currentCore->upTrigger(btns); +} +bool getUpTrigA() { + return mPad::g_currentCore->upTrigger(mPad::BUTTON_A); +} +bool getUpTrigB() { + return mPad::g_currentCore->upTrigger(mPad::BUTTON_B); +} +bool getUpTrigC() { + return mPad::g_currentCore->upTrigger(mPad::BUTTON_C); +} +bool getUpTrigZ() { + return mPad::g_currentCore->upTrigger(mPad::BUTTON_Z); +} +bool getUpTrigUp() { + return mPad::g_currentCore->upTrigger(mPad::BUTTON_UP); +} +bool getUpTrigDown() { + return mPad::g_currentCore->upTrigger(mPad::BUTTON_DOWN); +} +bool getUpTrigLeft() { + return mPad::g_currentCore->upTrigger(mPad::BUTTON_LEFT); +} +bool getUpTrigRight() { + return mPad::g_currentCore->upTrigger(mPad::BUTTON_RIGHT); +} +bool getUpTrig1() { + return mPad::g_currentCore->upTrigger(mPad::BUTTON_1); +} +bool getUpTrig2() { + return mPad::g_currentCore->upTrigger(mPad::BUTTON_2); +} +bool getUpTrigMinus() { + return mPad::g_currentCore->upTrigger(mPad::BUTTON_MINUS); +} +bool getUpTrigPlus() { + return mPad::g_currentCore->upTrigger(mPad::BUTTON_PLUS); +} + +// GET UP + +bool getUp(u32 btns) { + return mPad::g_currentCore->up(btns); +} +bool getUpAll(u32 btns) { + return mPad::g_currentCore->upAll(btns); +} +bool getUpA() { + return mPad::g_currentCore->up(mPad::BUTTON_A); +} +bool getUpB() { + return mPad::g_currentCore->up(mPad::BUTTON_B); +} +bool getUpC() { + return mPad::g_currentCore->up(mPad::BUTTON_C); +} +bool getUpZ() { + return mPad::g_currentCore->up(mPad::BUTTON_Z); +} +bool getUpUp() { + return mPad::g_currentCore->up(mPad::BUTTON_UP); +} +bool getUpDown() { + return mPad::g_currentCore->up(mPad::BUTTON_DOWN); +} +bool getUpLeft() { + return mPad::g_currentCore->up(mPad::BUTTON_LEFT); +} +bool getUpRight() { + return mPad::g_currentCore->up(mPad::BUTTON_RIGHT); +} +bool getUp1() { + return mPad::g_currentCore->up(mPad::BUTTON_1); +} +bool getUp2() { + return mPad::g_currentCore->up(mPad::BUTTON_2); +} +bool getUpMinus() { + return mPad::g_currentCore->up(mPad::BUTTON_MINUS); +} +bool getUpPlus() { + return mPad::g_currentCore->up(mPad::BUTTON_PLUS); +} + +mVec2_c &getDpdPos() { + return ex_c::m_current_ex->mDpdPos; +} +mVec2_c &getDpdPosScreen() { + return ex_c::m_current_ex->mDpdPosScreen; +} +mVec2_c &getFSStick() { + return ex_c::m_current_ex->mFSStick; +} +f32 getFSStickX() { + return ex_c::m_current_ex->mFSStick.x; +} +f32 getFSStickY() { + return ex_c::m_current_ex->mFSStick.y; +} +f32 getFSStickDistance() { + return ex_c::m_current_ex->mFSStickDistance; +} +mAng getFSStickAngle() { + return ex_c::m_current_ex->mFSStickAngle; +} +mVec3_c getAcc() { + const EGG::CoreStatus *status = mPad::g_currentCore->getCoreStatus(); + return mVec3_c(status->acc.x, status->acc.y, status->acc.z); +} + +u32 fn_80059B750() { + return ex_c::getInstance()->mMotion.field_0x10C8 >> 0 & 1; +} +u32 fn_80059B760() { + return ex_c::getInstance()->mMotion.field_0x10C8 >> 1 & 1; +} +u32 fn_80059B70() { + return ex_c::getInstance()->mMotion.field_0x10C8 >> 2 & 1; +} +u32 fn_80059B80() { + return ex_c::getInstance()->mMotion.field_0x10C8 >> 3 & 1; +} +u32 fn_80059B90() { + return ex_c::getInstance()->mMotion.field_0x10C8 >> 5 & 1; +} + +mVec3_c getFSAcc() { + if (mPad::g_padMg->getDevType(mPad::g_currentCoreId) == EGG::cDEV_FREESTYLE || + mPad::g_padMg->getDevType(mPad::g_currentCoreId) == EGG::cDEV_MPLS_PT_FS) { + const EGG::CoreStatus *status = mPad::g_currentCore->getCoreStatus(); + return mVec3_c(status->ex_status.fs.acc.x, status->ex_status.fs.acc.y, status->ex_status.fs.acc.z); + } else { + return mVec3_c(mVec3_c::Zero.x, mVec3_c::Zero.y, mVec3_c::Zero.z); + } +} +u32 fn_80059CC0() { + return ex_c::getInstance()->mFSMotion.field_0x10C8 >> 4 & 1; +} +u32 fn_80059CD0() { + return ex_c::getInstance()->mFSMotion.field_0x10C8 >> 5 & 1; +} + +} // namespace dPad diff --git a/src/d/d_reset.cpp b/src/d/d_reset.cpp new file mode 100644 index 00000000..4f2910f2 --- /dev/null +++ b/src/d/d_reset.cpp @@ -0,0 +1,605 @@ +#include "d/d_reset.h" + +#include "common.h" +#include "d/d_cs_base.h" +#include "d/d_dvd_unk.h" +#include "d/d_hbm.h" +#include "d/d_rumble.h" +#include "d/d_s_boot.h" +#include "d/d_sc_title.h" +#include "d/d_title_manager.h" +#include "d/lyt/d_lyt_system_window.h" +#include "d/snd/d_snd_player_mgr.h" +#include "egg/core/eggColorFader.h" +#include "egg/core/eggController.h" +#include "egg/core/eggFader.h" +#include "egg/core/eggHeap.h" +#include "m/m_color.h" +#include "m/m_pad.h" +#include "m/m_video.h" +#include "rvl/GX/GXDraw.h" +#include "rvl/GX/GXMisc.h" +#include "rvl/OS/OSCache.h" +#include "rvl/OS/OSInterrupt.h" +#include "rvl/OS/OSReset.h" +#include "rvl/OS/OSStateTM.h" +#include "rvl/OS/OSThread.h" +#include "rvl/VI/vi.h" +#include "toBeSorted/file_manager.h" +#include "toBeSorted/save_manager.h" + +#include "rvl/OS.h" + +namespace dReset { + +mColor Manage_c::c_faderColor(0, 0, 0, 0xFF); +Manage_c *Manage_c::s_pInstance; + +void Manage_c::CreateInstance(EGG::Heap *pHeap) { + s_pInstance = new (pHeap) Manage_c(pHeap); +} + +Manage_c *Manage_c::GetInstance() { + return s_pInstance; +} + +Manage_c::Manage_c(EGG::Heap *pHeap) { + mpHeap = pHeap; + mpFader = nullptr; + mMode = Normal; + field_0x10 = 0; + mModePrev = Normal; + mExec = ExecNone; + field_0x1C = 0; + mHbmReset = false; + mHbmReturnMenu = false; + mRestart = false; + mShutdown = false; + mInteriorReturnDataManager = false; + field_0x58 = 0; + field_0x5C = 0; + field_0x60 = 0; + mBootComplete = 0; + mSoftReset = 0; + field_0x66 = 0; + field_0x67 = 0; + Configure(); +} + +void Manage_c::Configure() { + mpFader = new (mpHeap) EGG::ColorFader( + 0.f, 0.f, mVideo::m_video->pRenderMode->fbWidth, mVideo::m_video->pRenderMode->efbHeight, c_faderColor, + EGG::ColorFader::STATUS_PREPARE_OUT + ); + SetResetCallback(); + SetPowerCallback(); +} + +void Manage_c::Reset() { + mMode = Normal; + field_0x10 = 0; + mExec = ExecNone; + field_0x1C = 0; + SetResetCallback(); + SetPowerCallback(); + mHbmReset = false; + mHbmReturnMenu = false; + mRestart = false; + mShutdown = false; + mInteriorReturnDataManager = false; + field_0x58 = 0; + field_0x5C = 0; + field_0x60 = 0; + mSoftReset = 0; + field_0x67 = 0; +} + +void Manage_c::Calculate() { + ModeProc(); + if (!SaveMgr::GetInstance()->getField_0x83D() && !SaveMgr::GetInstance()->getField_0x83F()) { + if (FileManager::GetInstance()->getField_0xA84D() != 1) { + mpFader->calc(); + } + } +} + +void Manage_c::Draw() { + mpFader->draw(); +} + +void Manage_c::BootComplete(bool complete) { + mBootComplete = complete; +} + +bool Manage_c::CanExecSoftReset() const { + return mMode == SoftReset && mpFader->getStatus() == EGG::Fader::STATUS_PREPARE_IN && field_0x60 == 0 && + dHbm::Manage_c::GetInstance()->getState() != dHbm::Manage_c::HBM_MANAGE_ACTIVE && + dSndPlayerMgr_c::GetInstance()->fn_8035E2E0() && FileManager::GetInstance()->getField_0xA84D() != 1; +} + +void Manage_c::SetSoftResetFinish() { + if (mMode == SoftReset) { + if (field_0x60 == 1) { + field_0x60 = 2; + } + } +} + +void Manage_c::SetSoftResetScene() { + if (CanExecSoftReset() && dScBoot_c::GetInstance() == nullptr) { + dScTitle_c::loadTitleScreen(0); + field_0x60 = 1; + } +} + +void Manage_c::PostDeleteScene() {} + +bool Manage_c::IsFaderBlank() const { + return mpFader->getStatus() == EGG::Fader::STATUS_PREPARE_IN; +} + +void Manage_c::SetHbmReturnMenu() { + mHbmReturnMenu = true; +} + +void Manage_c::SetHbmReset() { + mHbmReset = true; +} + +void Manage_c::SetDelayReset() { + field_0x58 = 2; +} + +void Manage_c::SetDelayPowerOff() { + field_0x5C = 2; +} + +void Manage_c::SetInteriorReturnDataManager() { + mInteriorReturnDataManager = true; +} + +void Manage_c::fn_80067FF0() { + MotorCancelOn(); + CleanUpGX(); + CleanUpLC(); +} + +void Manage_c::ExecProcPre() { + CleanUpGX(); + CleanUpLC(); +} + +void Manage_c::fn_80068070() { + ExecProcMain(); +} + +void Manage_c::ExecProcMain() { + if (mExec == Restart) { + OSRestart(0); + } else if (mExec == Reboot) { + OSRebootSystem(); + } else if (mExec == ReturnToMenu) { + OSReturnToMenu(); + } else if (mExec == ReturnToDataManager) { + OSReturnToDataManager(); + } else if (mExec == Shutdown) { + OSShutdownSystem(); + } +} + +void Manage_c::DiskCheckModeRequest(bool) { + if (mBootComplete) { + SetDiskCheckCallback(); + while (true) { + if (field_0x1C == 2) { + ModeRequestSafetyWait(ReturnToMenu); + return; + } else if (field_0x1C == 1) { + ModeRequestSoftReset(); + return; + } else { + VIWaitForRetrace(); + } + } + } else { + SetDiskCheckCallback(); + while (true) { + if (field_0x1C == 2) { + ModeRequestSafetyWait(ReturnToMenu); + return; + } else if (field_0x1C != 1) { + VIWaitForRetrace(); + } else { + if (dScBoot_c::GetInstance()) { + ModeRequestSoftReset(); + dHbm::Manage_c::GetInstance()->fn_80197560(1); + field_0x1C = 0; + } + return; + } + } + } +} + +void Manage_c::DebugPrintMode(const char *) {} + +void Manage_c::ModeProc() { + bool fatalErr = IsFatalError(); + bool diskErr = IsDiskError(); + if (fatalErr) { + if (mMode != FatalError) { + ModeRequest(FatalError); + } + } else if (diskErr) { + if (mMode != DiskWait && mMode != SafetyWait) { + ModeRequest(DiskWait); + } + } else if (mMode == Normal && + dHbm::Manage_c::GetInstance()->getState() == dHbm::Manage_c::HBM_MANAGE_ACTIVE) { + ModeRequest(HbmWait); + } + static void (Manage_c::*const procs[6])() = { + &Manage_c::ModeProc_Normal, &Manage_c::ModeProc_SoftReset, &Manage_c::ModeProc_HbmWait, + &Manage_c::ModeProc_DiskWait, &Manage_c::ModeProc_FatalError, &Manage_c::ModeProc_SafetyWait, + }; + + (this->*procs[mMode])(); + + if (mRestart) { + SetResetCallback(); + } + if (mShutdown) { + SetPowerCallback(); + } + mHbmReset = false; + mHbmReturnMenu = false; + mRestart = false; + mShutdown = false; + mInteriorReturnDataManager = false; +} + +void Manage_c::ModeRequest(Manage_c::Mode_e mode) { + mModePrev = mMode; + mMode = mode; + static void (Manage_c::*const procs[6])() = { + &Manage_c::ModeInit_Normal, &Manage_c::ModeInit_SoftReset, &Manage_c::ModeInit_HbmWait, + &Manage_c::ModeInit_DiskWait, &Manage_c::ModeInit_FatalError, &Manage_c::ModeInit_SafetyWait, + }; + (this->*procs[mMode])(); +} + +void Manage_c::ModeRequestSafetyWait(Manage_c::Exec_e exec) { + ModeRequest(SafetyWait); + mExec = exec; + MotorCancelOn(); +} + +void Manage_c::ModeRequestSoftReset() { + mSoftReset = 1; + ModeRequest(SoftReset); + MotorCancelOn(); +} + +void Manage_c::ModeInit_Normal() { + DebugPrintMode("Normal"); + mExec = ExecNone; +} + +void Manage_c::ModeProc_Normal() { + Exec_e exec; + if (mShutdown) { + ModeRequestSafetyWait(Shutdown); + } else if (mInteriorReturnDataManager) { + ModeRequestSafetyWait(ReturnToDataManager); + } else if (mRestart) { + DiskCheckModeRequest(false); + } +} + +extern "C" void fn_803267B0(s32, s32); +void Manage_c::ModeInit_SoftReset() { + DebugPrintMode("SoftReset"); + if (mSoftReset) { + mSoftReset = false; + if (dScBoot_c::GetInstance()) { + mpFader->setFrame(30); + mpFader->fadeOut(); + field_0x66 = true; + dSndPlayerMgr_c::GetInstance()->fn_8035E250(30); + } else { + field_0x60 = 0; + if (dTitleMgr_c::GetInstance()) { + if (dTitleMgr_c::GetInstance()->getField_0xBC() == 0) { + dSndPlayerMgr_c::GetInstance()->fn_8035E250(30); + } + } else { + dSndPlayerMgr_c::GetInstance()->fn_8035E250(30); + } + fn_803267B0(0, 60); + mpFader->setFrame(30); + mpFader->fadeOut(); + field_0x66 = true; + field_0x67 = false; + } + } +} + +void Manage_c::ModeProc_SoftReset() { + if (dScBoot_c::GetInstance()) { + if (mpFader->getStatus() == EGG::ColorFader::STATUS_PREPARE_IN) { + if (dScBoot_c::GetInstance()->getField_0x5E4()) { + dScBoot_c::GetInstance()->setField_0x5E4(0); + mpFader->setStatus(EGG::ColorFader::STATUS_PREPARE_OUT); + ModeRequest(Normal); + dSndPlayerMgr_c::GetInstance()->fn_8035E310(); + } else { + if (field_0x66) { + dScBoot_c::GetInstance()->setField_0x5E3(1); + + dDvdUnk::FontUnk::GetInstance()->fn_800529B0(); + dSndPlayerMgr_c::GetInstance()->fn_8035E6E0(); + + if (dDvdUnk::FontUnk::GetInstance()->getField_0x29() || + dDvdUnk::FontUnk::GetInstance()->getField_0x24() || + SaveMgr::GetInstance()->getCheckForFreeSpaceResult()) { + dScBoot_c::GetInstance()->setField_0x5E3(0); + dScBoot_c::GetInstance()->setField_0x5E2(1); + dDvdUnk::FontUnk::GetInstance()->fn_800529E0(); + } + dDvdUnk::FontUnk::GetInstance()->fn_80052A20(); + } + field_0x66 = false; + } + } + } else if (dTitleMgr_c::GetInstance() == nullptr || dTitleMgr_c::GetInstance()->getField_0xBC() == 0) { + if (field_0x66 && mpFader->getStatus() == EGG::ColorFader::STATUS_PREPARE_IN) { + dDvdUnk::FontUnk::GetInstance()->fn_800529B0(); + dDvdUnk::FontUnk::GetInstance()->fn_80052A20(); + + dCsBase_c::GetInstance()->setField703(false); + dCsBase_c::GetInstance()->setField704(false); + dCsBase_c::GetInstance()->setField705(false); + + field_0x66 = false; + } + if (mpFader->getStatus() == EGG::Fader::STATUS_PREPARE_IN && field_0x60 == 2) { + if (field_0x67 == 0) { + if (SaveMgr::GetInstance()->isInState()) { + SaveMgr::GetInstance()->init(); + } + if (dLytSystemWindow_c::GetInstance()->fn_80152F80()) { + dLytSystemWindow_c::GetInstance()->fn_80152F10(); + } + field_0x67++; + } else { + mpFader->setStatus(EGG::Fader::STATUS_PREPARE_OUT); + VISetBlack(FALSE); + MotorCancelOff(); + Reset(); + } + } + } +} + +void Manage_c::ModeInit_HbmWait() { + DebugPrintMode("HbmWait"); +} + +void Manage_c::ModeProc_HbmWait() { + bool doFade = false; + if (field_0x5C == 0 && field_0x58 == 0) { + if (mHbmReturnMenu) { + ModeRequestSafetyWait(ReturnToMenu); + } else if (mHbmReset) { + DiskCheckModeRequest(true); + doFade = true; + } else { + if (dHbm::Manage_c::GetInstance()->getState() != dHbm::Manage_c::HBM_MANAGE_ACTIVE) { + if (mShutdown) { + ModeRequestSafetyWait(Shutdown); + } else if (mRestart) { + DiskCheckModeRequest(false); + } else { + ModeRequest(Normal); + } + } else { + if (mShutdown) { + if (dHbm::Manage_c::GetInstance()->fn_801973C0(2)) { + field_0x5C = 1; + } + } else if (mRestart) { + if (dHbm::Manage_c::GetInstance()->fn_801973C0(1)) { + field_0x58 = 1; + } + } + } + } + } else if (field_0x5C == 2) { + field_0x5C = 0; + ModeRequestSafetyWait(Shutdown); + doFade = true; + } else if (field_0x58 == 2) { + field_0x58 = 0; + DiskCheckModeRequest(false); + doFade = true; + } + if (doFade) { + mpFader->setStatus(EGG::Fader::STATUS_PREPARE_IN); + } +} + +void Manage_c::ModeInit_DiskWait() { + if (dScBoot_c::GetInstance()) { + mFaderStatusPrev = mpFader->getStatus(); + mpFader->setStatus(EGG::Fader::STATUS_PREPARE_OUT); + } else { + if (mModePrev == SoftReset) { + mpFader->setStatus(EGG::Fader::STATUS_PREPARE_OUT); + } + } + DebugPrintMode("DiskWait"); +} + +void Manage_c::ModeProc_DiskWait() { + if (IsDiskError()) { + if (mShutdown) { + ModeRequestSafetyWait(Shutdown); + } else if (mRestart) { + ModeRequestSafetyWait(ReturnToMenu); + } + } else { + if (dScBoot_c::GetInstance()) { + if (mFaderStatusPrev == EGG::Fader::STATUS_PREPARE_IN) { + mpFader->setStatus(EGG::Fader::STATUS_PREPARE_IN); + } else if (mFaderStatusPrev == EGG::Fader::STATUS_PREPARE_OUT) { + mpFader->setStatus(EGG::Fader::STATUS_PREPARE_OUT); + } else if (mFaderStatusPrev == EGG::Fader::STATUS_FADE_IN) { + mpFader->setStatus(EGG::Fader::STATUS_PREPARE_OUT); + } else { + mpFader->setStatus(EGG::Fader::STATUS_PREPARE_IN); + } + } else { + if (mModePrev == SoftReset) { + mpFader->setStatus(EGG::Fader::STATUS_PREPARE_IN); + } + } + ModeRequest(mModePrev); + } +} + +void Manage_c::ModeInit_FatalError() { + DebugPrintMode("FatalError"); +} + +void Manage_c::ModeProc_FatalError() {} + +void Manage_c::ModeInit_SafetyWait() { + DebugPrintMode("SafetyWait"); + dSndPlayerMgr_c::GetInstance()->fn_8035E1B0(30); + mpFader->setFrame(30); + mpFader->fadeOut(); +} + +void Manage_c::ModeProc_SafetyWait() { + if (mpFader->getStatus() == EGG::Fader::STATUS_PREPARE_IN) { + bool b = dSndPlayerMgr_c::GetInstance()->fn_8035E220() && !FileManager::GetInstance()->getField_0xA84D(); + if (b) { + ExecProcPre(); + fn_80068070(); + } + } + if (SaveMgr::GetInstance()->getField_0x83D() || SaveMgr::GetInstance()->getField_0x83F() || + FileManager::GetInstance()->getField_0xA84D() == 1) { + if (FileManager::GetInstance()->getField_0xA84D() != 1) { + mpFader->calc(); + } + } +} + +void Manage_c::SetResetCallback() { + OSSetResetCallback(ResetCallback); +} + +void Manage_c::SetPowerCallback() { + OSSetPowerCallback(PowerCallback); +} + +void Manage_c::SetDiskCheckCallback() { + field_0x1C = 0; + DVDCheckDiskAsync(&mDvdCmd, DiskCheckCallback); +} + +void Manage_c::DiskCheckCallback(s32 result, struct DVDFileInfo *info) { + if (result == 0) { + GetInstance()->field_0x1C = 2; + } else { + GetInstance()->field_0x1C = 1; + } +}; + +void Manage_c::ResetCallback() { + GetInstance()->mRestart = true; +}; + +void Manage_c::PowerCallback() { + GetInstance()->mShutdown = true; +}; + +void Manage_c::CleanUpGX() { + VISetBlack(TRUE); + VIFlush(); + VIWaitForRetrace(); + VIWaitForRetrace(); + OSThread *thread = GXGetCurrentGXThread(); + BOOL status = OSDisableInterrupts(); + + if (thread != OSGetCurrentThread()) { + OSCancelThread(thread); + GXSetCurrentGXThread(); + } + GXFlush(); + GXAbortFrame(); + GXDrawDone(); + OSRestoreInterrupts(status); + + GXSetDrawDoneCallback(0); + VIWaitForRetrace(); +} + +void Manage_c::CleanUpLC() { + LCDisable(); +} + +void Manage_c::MotorCancelOn() { + for (int i = 0; i < 4; i++) { + mPad::g_core[--++i]->stopRumbleMgr(); + } + dRumble_c::stop(-1); +} + +void Manage_c::MotorCancelOff() {} + +bool Manage_c::IsFatalError() { + return false; +} + +bool Manage_c::IsDiskError() { + return dDvdUnk::FontUnk::GetInstance()->getField_0x28(); +} + +bool Manage_c::FadeOutCalc() { + if (mpFader->getStatus() == EGG::Fader::STATUS_PREPARE_IN || + mpFader->getStatus() == EGG::Fader::STATUS_PREPARE_OUT) { + return false; + } else { + return true; + } +} + +void Manage_c::FadeOutRequest(bool fade) { + if (!fade) { + dDvdUnk::FontUnk::GetInstance()->fn_800529B0(); + dDvdUnk::FontUnk::GetInstance()->fn_80052A20(); + + dCsBase_c::GetInstance()->setField703(false); + dCsBase_c::GetInstance()->setField704(false); + dCsBase_c::GetInstance()->setField705(false); + + field_0x66 = 0; + + if (SaveMgr::GetInstance()->isInState()) { + SaveMgr::GetInstance()->init(); + } + + if (dLytSystemWindow_c::GetInstance()->fn_80152F80()) { + dLytSystemWindow_c::GetInstance()->fn_80152F10(); + } + } else { + mpFader->setStatus(EGG::Fader::STATUS_PREPARE_OUT); + VISetBlack(FALSE); + MotorCancelOff(); + Reset(); + } +} + +} // namespace dReset diff --git a/src/d/d_rumble.cpp b/src/d/d_rumble.cpp index bc5dcd12..15bde884 100644 --- a/src/d/d_rumble.cpp +++ b/src/d/d_rumble.cpp @@ -1,10 +1,10 @@ #include "d/d_rumble.h" #include "common.h" +#include "d/d_reset.h" #include "d/d_sc_game.h" #include "d/lyt/d_lyt_control_game.h" #include "m/m_pad.h" -#include "toBeSorted/reload_color_fader.h" dRumbleEntry_c dRumble_c::sRumblePreset0(8, 0b11000000000000000000000000000000, 2.f); dRumbleEntry_c dRumble_c::sRumblePreset1(9, 0b11010000000000000000000000000000, 4.f); @@ -44,7 +44,7 @@ void dRumble_c::execute() { } // I am guessing on any reload screen or homebutton menu? - if (ReloadColorFader::GetInstance()->is1Or5()) { + if (dReset::Manage_c::GetInstance()->isSoftResetOrSafetyWait()) { mPad::g_core[0]->stopRumbleMgr(); mPad::g_core[1]->stopRumbleMgr(); return; diff --git a/src/d/d_sc_title.cpp b/src/d/d_sc_title.cpp index 7402456a..8aaa9a1a 100644 --- a/src/d/d_sc_title.cpp +++ b/src/d/d_sc_title.cpp @@ -4,6 +4,8 @@ #include "d/d_dvd_unk.h" #include "d/d_heap.h" #include "d/d_message.h" +#include "d/d_pad.h" +#include "d/d_reset.h" #include "d/d_sc_game.h" #include "d/d_sys.h" #include "f/f_base.h" @@ -15,7 +17,6 @@ #include "toBeSorted/arc_managers/layout_arc_manager.h" #include "toBeSorted/file_manager.h" #include "toBeSorted/music_mgrs.h" -#include "toBeSorted/reload_color_fader.h" #include "toBeSorted/save_related.h" #include "toBeSorted/unk_save_time.h" @@ -66,32 +67,30 @@ dScTitle_c::~dScTitle_c() { } extern "C" u32 TITLE_SCREEN_CHANGE; -extern "C" void fn_80059450(); -extern "C" void fn_80058C90(s32); static const char *const sFileSelect = "FileSelect"; static const char *const sSkb = "SoftwareKeyboard"; int dScTitle_c::create() { int ret = dScGame_c::create(); - if (ret == SUCCEEDED && ReloadColorFader::GetInstance()->field_0x0C == 1) { + if (ret == SUCCEEDED && dReset::Manage_c::GetInstance()->isSoftReset()) { if (field_0x2AC == 0) { - ReloadColorFader::GetInstance()->fn_80067EF0(0); + dReset::Manage_c::GetInstance()->FadeOutRequest(false); if (checkAllSaveFilesEmpty() != true) { TITLE_SCREEN_CHANGE = 0; } field_0x2AC = 1; ret = NOT_READY; } else { - ReloadColorFader::GetInstance()->fn_80067EF0(1); + dReset::Manage_c::GetInstance()->FadeOutRequest(true); } } if (ret == SUCCEEDED) { dSys::setFrameRate(2); dSys::setClearColor(mColor(0x00000000)); - fn_80059450(); - fn_80058C90(0); + dPad::ex_c::setAutoSleepTime(); + dPad::ex_c::fn_80058C90(0); SaveRelated::create(); field_0x2AD = 0; LayoutArcManager::GetInstance()->loadLayoutArcFromDisk(sFileSelect, nullptr); @@ -100,7 +99,7 @@ int dScTitle_c::create() { SizedString<128> fntPath; fntPath.sprintf("/US/Font/%s/%s", dMessage_c::getLanguageIdentifier(), "normal_02.brfnt"); mDvd_toMainRam_normal_c::create2(&mpSkbFont, fntPath, 0, dHeap::work2Heap.heap); - fn_8035E310(BGM_MGR); + BGM_MGR->fn_8035E310(); } return ret; diff --git a/src/d/d_scene.cpp b/src/d/d_scene.cpp index 3a5bb4a0..0a8fa4a4 100644 --- a/src/d/d_scene.cpp +++ b/src/d/d_scene.cpp @@ -2,11 +2,11 @@ #include "common.h" #include "d/d_base.h" +#include "d/d_reset.h" #include "d/d_rumble.h" #include "f/f_base.h" #include "f/f_profile_name.h" #include "m/m_fader_base.h" -#include "toBeSorted/reload_color_fader.h" static u16 RootActorID = fProfile::PROFILE_MAX; static u32 RootActorParams = 0; @@ -27,7 +27,7 @@ dScene_c::dScene_c() { void dScene_c::postCreate(MAIN_STATE_e state) { if (state == SUCCESS) { - ReloadColorFader::GetInstance()->fn_80067ED0(); + dReset::Manage_c::GetInstance()->SetSoftResetFinish(); } dBase_c::postCreate(state); } @@ -35,7 +35,7 @@ void dScene_c::postCreate(MAIN_STATE_e state) { void dScene_c::postDelete(MAIN_STATE_e state) { if (state == SUCCESS) { gameStateIsActive = false; - ReloadColorFader::GetInstance()->fn_80067F50(); + dReset::Manage_c::GetInstance()->PostDeleteScene(); } dBase_c::postDelete(state); } @@ -69,7 +69,7 @@ int dScene_c::preExecute() { void dScene_c::postExecute(MAIN_STATE_e status) { if (status != CANCELED) { - ReloadColorFader::GetInstance()->fn_80067F00(); + dReset::Manage_c::GetInstance()->SetSoftResetScene(); } dBase_c::postExecute(status); if (proc_control & ROOT_DISABLE_EXECUTE) { diff --git a/src/d/d_textwindow_unk.cpp b/src/d/d_textwindow_unk.cpp index 36ca6700..2eaf8be7 100644 --- a/src/d/d_textwindow_unk.cpp +++ b/src/d/d_textwindow_unk.cpp @@ -3,13 +3,13 @@ #include "d/d_textwindow_unk.h" #include "common.h" +#include "d/d_gfx.h" #include "d/d_message.h" #include "d/d_tag_processor.h" #include "d/d_lyt_hio.h" #include "d/lyt/d_textbox.h" #include "d/lyt/msg_window/d_lyt_msg_window.h" #include "m/m_vec.h" -#include "toBeSorted/lyt_related_floats.h" #include "toBeSorted/other_sound_stuff.h" TextWindowUnk::TextWindowUnk(dTagProcessor_c *c) { @@ -89,7 +89,7 @@ void MsgWindowBlurRelated::drawTextBlur(dLytTextLight *thing, mVec2_c size, u8 a } else { mData[i].displayTimerMaybe = t; } - mVec3_c v((size.x + mData[i].posX) / get_805751A4(), size.y + mData[i].posY, 0.0f); + mVec3_c v((size.x + mData[i].posX) / dGfx_c::get16x9to4x3WidthScaleF(), size.y + mData[i].posY, 0.0f); thing->draw(mData[i].displayTimerMaybe, v, alpha, mData[i].field_0x08); } } diff --git a/src/d/lyt/d_lyt_area_caption.cpp b/src/d/lyt/d_lyt_area_caption.cpp index d15b9e1d..db56ea34 100644 --- a/src/d/lyt/d_lyt_area_caption.cpp +++ b/src/d/lyt/d_lyt_area_caption.cpp @@ -232,43 +232,43 @@ bool dLytAreaCaptionParts_c::shouldImmediatelyDismiss() const { return true; } - if (dPad::checkButtonBPressed()) { + if (dPad::getDownTrigB()) { return true; } - if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_C) && dPad::checkButtonCPressed()) { + if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_C) && dPad::getDownTrigC()) { return true; } - if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_PLUS) && dPad::checkButtonPlusPressed()) { + if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_PLUS) && dPad::getDownTrigPlus()) { return true; } - if (dPad::checkButtonMinusPressed()) { + if (dPad::getDownTrigMinus()) { return true; } - if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_1) && dPad::checkButton1Pressed()) { + if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_1) && dPad::getDownTrig1()) { return true; } - if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_2) && dPad::checkButton2Pressed()) { + if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_2) && dPad::getDownTrig2()) { return true; } - if (dPad::checkButtonDpadUpPressed()) { + if (dPad::getDownTrigUp()) { return true; } - if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_CROSS_DOWN) && dPad::checkButtonDpadDownPressed()) { + if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_CROSS_DOWN) && dPad::getDownTrigDown()) { return true; } - if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_CROSS_LEFT) && dPad::checkButtonDpadLeftPressed()) { + if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_CROSS_LEFT) && dPad::getDownTrigLeft()) { return true; } - if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_CROSS_RIGHT) && dPad::checkButtonDpadRightPressed()) { + if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_CROSS_RIGHT) && dPad::getDownTrigRight()) { return true; } diff --git a/src/d/lyt/d_lyt_battery.cpp b/src/d/lyt/d_lyt_battery.cpp index 5a522545..5884928d 100644 --- a/src/d/lyt/d_lyt_battery.cpp +++ b/src/d/lyt/d_lyt_battery.cpp @@ -1,6 +1,7 @@ #include "d/lyt/d_lyt_battery.h" #include "d/d_d2d.h" +#include "d/d_pad.h" #include "egg/core/eggController.h" #include "m/m_pad.h" #include "toBeSorted/arc_managers/layout_arc_manager.h" @@ -85,11 +86,8 @@ bool dLytBattery_c::dismissManually() { return true; } -extern "C" bool isLowBattery1(); -extern "C" bool isLowBattery2(); - bool dLytBattery_c::hasEnoughBatteryCharge() { - if (!mPad::g_currentCore->mFlag.offBit(0) && (isLowBattery2() || isLowBattery1())) { + if (mPad::getCore()->isConnected() && (dPad::ex_c::isLowBattery() || dPad::ex_c::isOutOfBattery())) { return false; } return true; diff --git a/src/d/lyt/d_textbox.cpp b/src/d/lyt/d_textbox.cpp index cb5e5130..1f14ab02 100644 --- a/src/d/lyt/d_textbox.cpp +++ b/src/d/lyt/d_textbox.cpp @@ -2,6 +2,7 @@ #include "common.h" #include "d/d_font_manager.h" +#include "d/d_gfx.h" #include "d/d_message.h" #include "d/d_tag_processor.h" #include "d/d_lyt_hio.h" @@ -20,7 +21,6 @@ #include "rvl/GX/GXPixel.h" #include "rvl/GX/GXTev.h" #include "rvl/GX/GXTypes.h" -#include "toBeSorted/lyt_related_floats.h" #include @@ -442,7 +442,7 @@ f32 dTextBox_c::GetLinesHeight() const { } f32 dTextBox_c::GetUnkWidthRatio() const { - return GetLineWidth(nullptr) / get_805751A4(); + return GetLineWidth(nullptr) / dGfx_c::get16x9to4x3WidthScaleF(); } f32 dTextBox_c::resizeTextToFit(f32 maxWidth) { diff --git a/src/d/lyt/meter/d_lyt_meter.cpp b/src/d/lyt/meter/d_lyt_meter.cpp index 39e9da22..50a874b3 100644 --- a/src/d/lyt/meter/d_lyt_meter.cpp +++ b/src/d/lyt/meter/d_lyt_meter.cpp @@ -993,7 +993,7 @@ bool dLytMeterMain_c::remove() { void dLytMeterMain_c::fn_800D5290() { dLytMeter_c *meter = dLytMeter_c::GetInstance(); - if (dLytMap_c::getInstance() != nullptr && !dLytMap_c::getInstance()->unkMeterCheck()) { + if (dLytMap_c::GetInstance() != nullptr && !dLytMap_c::GetInstance()->unkMeterCheck()) { meter->setFlags(METER_BTN_PLUS); } @@ -1090,7 +1090,7 @@ bool dLytMeterMain_c::fn_800D56B0() { return true; } - if (dLytMap_c::getInstance() != nullptr && !dLytMap_c::getInstance()->getFn_80139EA0()) { + if (dLytMap_c::GetInstance() != nullptr && !dLytMap_c::GetInstance()->getFn_80139EA0()) { return true; } diff --git a/src/d/lyt/meter/d_lyt_meter_item_select.cpp b/src/d/lyt/meter/d_lyt_meter_item_select.cpp index a8f6452b..30e858cb 100644 --- a/src/d/lyt/meter/d_lyt_meter_item_select.cpp +++ b/src/d/lyt/meter/d_lyt_meter_item_select.cpp @@ -791,7 +791,7 @@ void dLytMeterItemSelect_c::finalizeState_SelectIn() { void dLytMeterItemSelect_c::initializeState_Select() {} void dLytMeterItemSelect_c::executeState_Select() { - if (dLytMeter_c::getCrossIconDown() == 0 && dPad::checkButtonDpadDownPressed()) { + if (dLytMeter_c::getCrossIconDown() == 0 && dPad::getDownTrigDown()) { if (field_0x5794 != I_INVALID) { field_0x5780 = 0.0f; mStateMgr.changeState(StateID_SetIn); diff --git a/src/d/lyt/meter/d_lyt_meter_z_btn.cpp b/src/d/lyt/meter/d_lyt_meter_z_btn.cpp index 935f78fe..81437458 100644 --- a/src/d/lyt/meter/d_lyt_meter_z_btn.cpp +++ b/src/d/lyt/meter/d_lyt_meter_z_btn.cpp @@ -186,14 +186,15 @@ bool dLytMeterZBtn_c::execute() { return true; } field_0x1C4 = true; - if ((!fn_80081FE0(dScGame_c::getCamera(0)->getField_0xD98(), "mogu") || AttentionManager::GetInstance()->checkLink2()) && + if ((!fn_80081FE0(dScGame_c::getCamera(0)->getField_0xD98(), "mogu") || + AttentionManager::GetInstance()->checkLink2()) && LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_Z) == 0x67) { field_0x1C4 = false; LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_Z, LytDoButtonRelated::ACT_IE_NONE); } field_0x1B4 = LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_Z); - field_0x1B8 = LytDoButtonRelated::getHas(LytDoButtonRelated::DO_BUTTON_Z) && - dLytMeter_c::GetInstance()->checkAllFlags(0x800); + field_0x1B8 = + LytDoButtonRelated::getHas(LytDoButtonRelated::DO_BUTTON_Z) && dLytMeter_c::GetInstance()->checkAllFlags(0x800); mStateMgr.executeState(); for (int i = 0; i < Z_BTN_NUM_ANIMS; i++) { @@ -204,7 +205,7 @@ bool dLytMeterZBtn_c::execute() { if (dLytControlGame_c::getInstance()->isStateNormal()) { if (StoryflagManager::sInstance->getCounterOrFlag(565)) { - if (dPad::checkButtonZPressed()) { + if (dPad::getDownTrigZ()) { field_0x1C5 = 0; StoryflagManager::sInstance->unsetFlag(565); } else { diff --git a/src/d/lyt/msg_window/d_lyt_msg_window.cpp b/src/d/lyt/msg_window/d_lyt_msg_window.cpp index 39c09208..89e027a5 100644 --- a/src/d/lyt/msg_window/d_lyt_msg_window.cpp +++ b/src/d/lyt/msg_window/d_lyt_msg_window.cpp @@ -27,6 +27,7 @@ #include "d/lyt/d_lyt_auto_caption.h" // clang-format on +#include "d/d_gfx.h" #include "d/snd/d_snd_small_effect_mgr.h" #include "f/f_base.h" #include "m/m_fader_base.h" @@ -36,7 +37,6 @@ #include "toBeSorted/d_d3d.h" #include "toBeSorted/event_manager.h" #include "toBeSorted/fi_context.h" -#include "toBeSorted/lyt_related_floats.h" #include "toBeSorted/music_mgrs.h" #include "toBeSorted/other_sound_stuff.h" @@ -265,9 +265,14 @@ void dLytMsgWindow_c::initializeState_In() { param = 1; } else if (obj != nullptr && d3d::fn_80016A90(obj->poscopy2)) { d3d::fn_80016960(field_0x768, obj->poscopy2); - // TODO - stack and FPR problems - field_0x768 = mVec3_c(field_0x768.x, field_0x768.y, 0.0f); - if (field_0x768.y < get_8057511C() / 3.0f + get_80575134()) { + mVec3_c v = field_0x768; + v.z = 0.f; + field_0x768 = v; + f32 h, b; + h = dGfx_c::getCurrentScreenHeight(); + b = +dGfx_c::getCurrentScreenBottom(); + + if (v.y < b + (h / 3.f)) { param = 2; } } @@ -297,7 +302,7 @@ void dLytMsgWindow_c::executeState_OutputText() { if (field_0x815 == 0 && field_0x816 == 0) { mpMsgWindowUnk->textAdvancingRelated(false, true); - if (field_0x811 == 0 && dPad::checkButtonAHeld() && field_0x815 == 0 && field_0x816 == 0) { + if (field_0x811 == 0 && dPad::getDownA() && field_0x815 == 0 && field_0x816 == 0) { mpMsgWindowUnk->textAdvancingRelated(false, true); } } @@ -354,7 +359,7 @@ void dLytMsgWindow_c::executeState_WaitKeyChangePage0() { field_0x813 = 0; allowChange = true; } - } else if (dPad::checkButtonAPressed() || fn_8011A5D0()) { + } else if (dPad::getDownTrigA() || fn_8011A5D0()) { fn_8035E880(BGM_MGR); allowChange = true; } @@ -414,7 +419,7 @@ void dLytMsgWindow_c::executeState_WaitKeyMsgEnd0() { field_0x813 = 0; allowChange = true; } - } else if (dPad::checkButtonAPressed() || fn_8011A5D0()) { + } else if (dPad::getDownTrigA() || fn_8011A5D0()) { fn_8035E880(BGM_MGR); allowChange = true; } @@ -543,7 +548,7 @@ void dLytMsgWindow_c::finalizeState_WaitKeySelectQuestion() {} void dLytMsgWindow_c::initializeState_MapOpen() {} void dLytMsgWindow_c::executeState_MapOpen() { - if ((dLytMap_c::getInstance() != nullptr && dLytMap_c::getInstance()->isOpenMaybe()) || + if ((dLytMap_c::GetInstance() != nullptr && dLytMap_c::GetInstance()->isOpenMaybe()) || !dLytControlGame_c::getInstance()->isInSomeMapState()) { dMessage_c::getInstance()->setField_0x329(0); mStateMgr.changeState(StateID_Invisible); @@ -553,8 +558,7 @@ void dLytMsgWindow_c::finalizeState_MapOpen() {} void dLytMsgWindow_c::initializeState_WaitKeyMapClose() {} void dLytMsgWindow_c::executeState_WaitKeyMapClose() { - if ((dPad::checkButtonBPressed() || dPad::checkButtonPlusPressed()) && - !dLytControlGame_c::getInstance()->isNotInStateMap()) { + if ((dPad::getDownTrigB() || dPad::getDownTrigPlus()) && !dLytControlGame_c::getInstance()->isNotInStateMap()) { dLytControlGame_c::getInstance()->fn_802CCD40(true); mStateMgr.changeState(StateID_MapClose); } diff --git a/src/d/lyt/msg_window/d_lyt_msg_window_select_btn.cpp b/src/d/lyt/msg_window/d_lyt_msg_window_select_btn.cpp index 6ea90360..5adc3ef8 100644 --- a/src/d/lyt/msg_window/d_lyt_msg_window_select_btn.cpp +++ b/src/d/lyt/msg_window/d_lyt_msg_window_select_btn.cpp @@ -6,7 +6,6 @@ #include "d/snd/d_snd_small_effect_mgr.h" #include "toBeSorted/music_mgrs.h" - STATE_DEFINE(dLytMsgWindowSelectBtnParts_c, Wait); STATE_DEFINE(dLytMsgWindowSelectBtnParts_c, On); STATE_DEFINE(dLytMsgWindowSelectBtnParts_c, Select); @@ -328,7 +327,7 @@ void dLytMsgWindowSelectBtn_c::executeState_WaitSelect() { return; } - if (mBtnHelper.field_0x50 >= 0 && dPad::checkButtonAPressed()) { + if (mBtnHelper.field_0x50 >= 0 && dPad::getDownTrigA()) { field_0x9D0 = 0; field_0x9B0 = mBtnHelper.field_0x50; mStateMgr.changeState(StateID_WaitDecide); @@ -339,7 +338,7 @@ void dLytMsgWindowSelectBtn_c::executeState_WaitSelect() { dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_TALK_CURSOR_OK); } fn_8035E880(BGM_MGR); - } else if (dPad::checkButtonBPressed()) { + } else if (dPad::getDownTrigB()) { f32 f = mBtnHelper.fn_8011D690(field_0x9BC); // TODO field_0x9CC = field_0x9BC; diff --git a/src/d/lyt/msg_window/d_lyt_msg_window_sword.cpp b/src/d/lyt/msg_window/d_lyt_msg_window_sword.cpp index 9397fd2a..c4bd3d31 100644 --- a/src/d/lyt/msg_window/d_lyt_msg_window_sword.cpp +++ b/src/d/lyt/msg_window/d_lyt_msg_window_sword.cpp @@ -1,6 +1,7 @@ #include "d/lyt/msg_window/d_lyt_msg_window_sword.h" #include "common.h" +#include "d/d_gfx.h" #include "d/d_tag_processor.h" #include "d/d_lyt_hio.h" #include "d/lyt/d2d.h" @@ -11,7 +12,6 @@ #include "nw4r/lyt/lyt_types.h" #include "nw4r/math/math_types.h" #include "s/s_State.hpp" -#include "toBeSorted/lyt_related_floats.h" STATE_DEFINE(dLytMsgWindowSword_c, Invisible); STATE_DEFINE(dLytMsgWindowSword_c, In); @@ -271,7 +271,8 @@ void dLytMsgWindowSword_c::draw() { mCharacterData[i].displayTimerMaybe += 1; } mVec3_c v( - (mOffset.x + mCharacterData[i].posX) / get_805751A4(), mOffset.y + mCharacterData[i].posY, 0.0f + (mOffset.x + mCharacterData[i].posX) / dGfx_c::get16x9to4x3WidthScaleF(), + mOffset.y + mCharacterData[i].posY, 0.0f ); wchar_t str[2]; diff --git a/src/d/snd/d_snd_player_mgr.cpp b/src/d/snd/d_snd_player_mgr.cpp index 4851d179..981f2150 100644 --- a/src/d/snd/d_snd_player_mgr.cpp +++ b/src/d/snd/d_snd_player_mgr.cpp @@ -7,6 +7,7 @@ #include "d/snd/d_snd_small_effect_mgr.h" #include "d/snd/d_snd_source_enums.h" #include "d/snd/d_snd_wzsound.h" +#include "egg/audio/eggAudioRmtSpeakerMgr.h" #include "egg/core/eggDvdRipper.h" #include "nw4r/snd/snd_SoundHandle.h" #include "nw4r/snd/snd_SoundStartable.h" @@ -72,6 +73,14 @@ void dSndPlayerMgr_c::leaveHelp() { dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_HELP_OUT); } +void dSndPlayerMgr_c::setup(s32 channel) { + EGG::AudioRmtSpeakerMgr::setup(channel, nullptr); +} + +void dSndPlayerMgr_c::shutdown(s32 channel) { + EGG::AudioRmtSpeakerMgr::shutdown(channel, nullptr); +} + nw4r::snd::SoundStartable::StartResult dSndPlayerMgr_c::startSound( nw4r::snd::SoundHandle *pHandle, u32 soundId, const nw4r::snd::SoundStartable::StartInfo *pStartInfo ) { @@ -118,10 +127,8 @@ bool dSndPlayerMgr_c::canUseThisPlayer(u8 sourceType) const { switch (sourceType) { case SND_SOURCE_PLAYER: case SND_SOURCE_PLAYER_HEAD: - case SND_SOURCE_58: - return true; - default: - return false; + case SND_SOURCE_58: return true; + default: return false; } } diff --git a/src/egg/audio/eggAudioRmtSpeakerMgr.cpp b/src/egg/audio/eggAudioRmtSpeakerMgr.cpp index cf2828a5..d69945ca 100644 --- a/src/egg/audio/eggAudioRmtSpeakerMgr.cpp +++ b/src/egg/audio/eggAudioRmtSpeakerMgr.cpp @@ -1,6 +1,7 @@ #include "egg/audio/eggAudioRmtSpeakerMgr.h" #include "nw4r/snd/snd_SoundSystem.h" + #include "rvl/OS.h" // IWYU pragma: export namespace EGG { @@ -21,7 +22,7 @@ void AudioRmtSpeakerMgr::setupCallback(s32 arg1, s32 arg2) { } sAudioRmtSpeakerWpadVolume = WPADGetSpeakerVolume(); } else { - fn_804B6D80(arg1, sConnectTask[mTaskFinishCount].mpCallback); + setup(arg1, sConnectTask[mTaskFinishCount].mpCallback); } sConnectTask[mTaskFinishCount].field_0x01 = true; } @@ -32,7 +33,7 @@ void AudioRmtSpeakerMgr::shutdownCallback(s32 arg1, s32 arg2) { (sConnectTask[mTaskFinishCount].mpCallback)(arg1, arg2); } } else { - fn_804B6DE0(arg1, sConnectTask[mTaskFinishCount].mpCallback); + shutdown(arg1, sConnectTask[mTaskFinishCount].mpCallback); } sConnectTask[mTaskFinishCount].field_0x01 = true; } @@ -100,14 +101,14 @@ void AudioRmtSpeakerMgr::shutdownCallbackDirect(s32 arg1, s32 arg2) { doShutdown(arg1, shutdownCallbackDirect); } -void AudioRmtSpeakerMgr::fn_804B6D80(s32 i, WPADCallback *pCallback) { +void AudioRmtSpeakerMgr::setup(s32 i, WPADCallback *pCallback) { WPADDeviceType ty; if (!sAudioRmtSpeakerConnectCanncelSw && WPADProbe(i, &ty) != WPAD_ERR_NO_CONTROLLER) { add_task(i, pCallback, true); } } -void AudioRmtSpeakerMgr::fn_804B6DE0(s32 i, WPADCallback *pCallback) { +void AudioRmtSpeakerMgr::shutdown(s32 i, WPADCallback *pCallback) { WPADDeviceType ty; if (!sAudioRmtSpeakerConnectCanncelSw) { if (WPADProbe(i, &ty) == WPAD_ERR_NO_CONTROLLER) { diff --git a/src/egg/core/eggController.cpp b/src/egg/core/eggController.cpp index bcc0c551..0fb022ac 100644 --- a/src/egg/core/eggController.cpp +++ b/src/egg/core/eggController.cpp @@ -5,16 +5,20 @@ #include "egg/core/eggExpHeap.h" #include "egg/core/eggSystem.h" #include "egg/math/eggMath.h" -#include "rvl/VI.h" // IWYU pragma: export +#include "egg/math/eggVector.h" +#include "rvl/WPAD/WPAD.h" #include "string.h" -EGG::NullController null_controller; +#include "rvl/VI.h" // IWYU pragma: export + namespace EGG { +NullController null_controller; + CoreControllerMgr *CoreControllerMgr::sInstance; CoreControllerMgr::T__Disposer *CoreControllerMgr::T__Disposer::sStaticDisposer; -ControllerFactory CoreControllerMgr::sCoreControllerFactory; -ConnectCallback CoreControllerMgr::sConnectCallback; +CoreControllerFactory CoreControllerMgr::sCoreControllerFactory; +CoreControllerConnectCallback CoreControllerMgr::sConnectCallback; // This controls whether EggController registers an allocator within the WPAD driver bool CoreControllerMgr::sUseBuiltinWpadAllocator; s32 CoreControllerMgr::sWPADWorkSize = 0x32000; @@ -23,7 +27,7 @@ void CoreStatus::init() { memset(this, 0, sizeof(CoreStatus)); } -u32 CoreStatus::getFSStickButton() const { +u32 CoreStatus::getFSStickButton() { f32 stick = getFSStickX(); u32 result = 0; @@ -51,47 +55,47 @@ u32 CoreStatus::getFSStickButton() const { return result; } -CoreController::CoreController() : mDpdPos(), mAccel(), mAccelFlags(), mFlag(0) { +CoreController::CoreController() : mDpdPosPrev(), mStableAccel(), mFlag(0) { mRumbleMgr = nullptr; - mButtonHeld = 0; - mButtonTriggered = 0; - mButtonReleased = 0; + mFSStickHold = 0; + mFSStickTrig = 0; + mFSStickRelease = 0; sceneReset(); mFlag.makeAllZero(); } void CoreController::sceneReset() { - mAccel.set(0.0, 0.0, 0.0); - mDpdPos.x = 0.0f; - mDpdPos.y = 0.0f; + mAccelPrev.set(0.0, 0.0, 0.0); + mDpdPosPrev.x = 0.0f; + mDpdPosPrev.y = 0.0f; mIdleTime = 0; mPostureMatrixPrev.makeIdentity(); mPostureMatrix.makeIdentity(); - mMaxAccelFrameTime = 10; - mMaxAccelDiff = 0.13; - mPrevAccel.set(0.0, 0.0, 0.0); - mAccelFlags.makeAllZero(); - mAccelFrameTime[2] = 0; - mAccelFrameTime[1] = 0; - mAccelFrameTime[0] = 0; - mMotorPattern = 0; - mMotorFrameDuration = 0; - mEnableMotor = false; - mMotorPatternLength = 0x20; - mMotorPatternPos = 0x1f; + mStableFrame = 10; + mStableMag = 0.13; + mStableAccel.set(0.0, 0.0, 0.0); + mStableFlags = 0; + mStableTimer[2] = 0; + mStableTimer[1] = 0; + mStableTimer[0] = 0; + mSimpleRumblePattern = 0; + mSimpleRumbleFrame = 0; + mEnableSimpleRumble = false; + mSimpleRumbleSize = 0x20; + mSimpleRumbleIndex = 0x1f; stopRumbleMgr(); } Vector2f CoreController::getDpdRawPos() { - return Vector2f(mCoreStatus[0].mDpdRawX, mCoreStatus[0].mDpdRawY); + return Vector2f(mCoreStatus[0].pos.x, mCoreStatus[0].pos.y); } f32 CoreController::getDpdDistance() { - return mCoreStatus[0].mDpdDistance; + return mCoreStatus[0].dist; } s32 CoreController::getDpdValidFlag() { - return mCoreStatus[0].getDpdValidFlag(); + return mCoreStatus[0].getDPDValidFlag(); } void CoreController::startMotor() { @@ -169,15 +173,15 @@ void CoreController::calc_posture_matrix(Matrix34f &posture, bool checkStable) { void CoreController::beginFrame(PADStatus *padStatus) { s32 kpad_result; - mReadStatusIdx = KPADReadEx(mChannelID, mCoreStatus, 0x10, &kpad_result); - if (mReadStatusIdx == 0 && kpad_result == -1 /* Rvl usually uses negative nums for results */) { - mReadStatusIdx = 1; + mKPADReadLength = KPADReadEx(mChannelID, mCoreStatus, 0x10, &kpad_result); + if (mKPADReadLength == 0 && kpad_result == WPAD_ERR_NO_CONTROLLER) { + mKPADReadLength = 1; } WPADDeviceType dev_type; switch (WPADProbe(mChannelID, &dev_type)) { case WPAD_ERR_OK: { - if ((u32)dev_type == WPAD_DEV_NONE) { + if ((u32)dev_type == WPAD_DEV_NOT_FOUND) { mFlag.resetBit(0); } else { mFlag.setBit(0); @@ -188,59 +192,59 @@ void CoreController::beginFrame(PADStatus *padStatus) { } break; } - if (mReadStatusIdx > 0) { + if (mKPADReadLength > 0) { CoreStatus *pStatus = mCoreStatus; - u32 prev_held = mButtonHeld; + u32 prev_held = mFSStickHold; if (pStatus->isFreestyle()) { - mButtonHeld = pStatus->getFSStickButton(); + mFSStickHold = pStatus->getFSStickButton(); } else { - mButtonHeld = 0; + mFSStickHold = 0; } - mButtonTriggered = mButtonHeld & ~prev_held; - mButtonReleased = prev_held & ~mButtonHeld; - pStatus->mHold &= ~0xF0000; - pStatus->mTrig &= ~0xF0000; - pStatus->mRelease &= ~0xF0000; - pStatus->mHold |= (mButtonHeld & 0xF0000); - pStatus->mTrig |= (mButtonTriggered & 0xF0000); - pStatus->mRelease |= (mButtonReleased & 0xF0000); + mFSStickTrig = mFSStickHold & ~prev_held; + mFSStickRelease = prev_held & ~mFSStickHold; + pStatus->hold &= ~0xF0000; + pStatus->trig &= ~0xF0000; + pStatus->release &= ~0xF0000; + pStatus->hold |= (mFSStickHold & 0xF0000); + pStatus->trig |= (mFSStickTrig & 0xF0000); + pStatus->release |= (mFSStickRelease & 0xF0000); } mPostureMatrixPrev.copyFrom(mPostureMatrix); - mAccelFlags.makeAllZero(); + mStableFlags = 0; Vector3f acc = mCoreStatus->getAccel(); for (int i = 0; i < 3; i++) { - if (acc(i) - mAccel(i) < mMaxAccelDiff) { - if (mMaxAccelFrameTime <= ++mAccelFrameTime[i]) { - mAccelFrameTime[i] = mMaxAccelFrameTime; - mAccelFlags.set(1 << i); - mPrevAccel(i) = acc(i); + if (acc(i) - mAccelPrev(i) < mStableMag) { + if (mStableFrame <= ++mStableTimer[i]) { + mStableTimer[i] = mStableFrame; + mStableFlags |= (1 << i); + mStableAccel(i) = acc(i); } } else { - mAccelFlags.value &= ~(1 << i); // ? - mAccelFrameTime[i] = 0; + mStableFlags &= ~(1 << i); + mStableTimer[i] = 0; } } calc_posture_matrix(mPostureMatrix, true); - if (mEnableMotor) { - if (mMotorPattern & (1 << mMotorPatternPos)) { + if (mEnableSimpleRumble) { + if (mSimpleRumblePattern & (1 << mSimpleRumbleIndex)) { startMotor(); } else { stopMotor(); } - if (mMotorPatternPos == 0) { - mMotorPatternPos = mMotorPatternLength - 1; + if (mSimpleRumbleIndex == 0) { + mSimpleRumbleIndex = mSimpleRumbleSize - 1; } else { - mMotorPatternPos = mMotorPatternPos - 1; + mSimpleRumbleIndex = mSimpleRumbleIndex - 1; } - if (--mMotorFrameDuration == 0) { + if (--mSimpleRumbleFrame == 0) { stopMotor(); - mEnableMotor = false; + mEnableSimpleRumble = false; } } @@ -254,13 +258,13 @@ void CoreController::beginFrame(PADStatus *padStatus) { } if (increment) { - Vector3f diff = (mAccel - mCoreStatus->getAccel()); + Vector3f diff = (mAccelPrev - mCoreStatus->getAccel()); if (diff.squaredLength() > 0.01f) { increment = false; } } if (increment) { - Vector2f diff = (mDpdPos - getDpdRawPos()); + Vector2f diff = (mDpdPosPrev - getDpdRawPos()); if (diff.squaredLength() > 0.05f) { increment = false; } @@ -278,8 +282,8 @@ void CoreController::beginFrame(PADStatus *padStatus) { } void CoreController::endFrame() { - mAccel = getAccel(); - mDpdPos = getDpdRawPos(); + mAccelPrev = *reinterpret_cast(&mCoreStatus[0].acc); + mDpdPosPrev = getDpdRawPos(); } /* 0x80499AC0 */ @@ -343,7 +347,7 @@ int free(void *ptr) { /* 0x80499CD0 */ void CoreControllerMgr::connectCallback(s32 a1, s32 a2) { - int args[] = {a1, a2}; + CoreControllerConnectArg args = {a1, a2}; if (sConnectCallback != nullptr) { (sConnectCallback)(args); } @@ -393,7 +397,7 @@ void CoreControllerMgr::beginFrame() { /* 0x8049A1E0 */ void CoreControllerMgr::endFrame() { - for (int i = 0; i < mControllers.mSize; i++) { + for (int i = 0; i < mControllers.getSize(); i++) { mControllers(i)->endFrame(); WPADDeviceType dev_type; @@ -403,7 +407,7 @@ void CoreControllerMgr::endFrame() { if (result == WPAD_ERR_OK) { res_dev_type = dev_type; } else if (result == WPAD_ERR_NO_CONTROLLER) { - res_dev_type = WPAD_DEV_NONE; + res_dev_type = WPAD_DEV_NOT_FOUND; } else { continue; } @@ -425,77 +429,77 @@ void CoreControllerMgr::endFrame() { /* 0x8049A3B0 */ void ControllerRumbleUnit::init() { - mPattern = nullptr; - mPatternPos = nullptr; - mTimer = 0; - mIntensity = 0.0f; - mRampUp = 0.0f; - mFlag.makeAllZero(); + mRumblePattern = nullptr; + mRumblePatternPtr = nullptr; + mRumbleFrame = 0; + mRumbleValue = 0.0f; + mRumblePower = 0.0f; + mFlags.makeAllZero(); } /* 0x8049A3E0 */ void ControllerRumbleUnit::startPattern(const char *pattern, int duration) { - mPattern = pattern; - mPatternPos = pattern; + mRumblePattern = pattern; + mRumblePatternPtr = pattern; - mFlag.value &= 0xef; - mFlag.value &= 0xdf; + mFlags.value &= 0xef; + mFlags.value &= 0xdf; if (duration < 0) { - mFlag.set(0x10); + mFlags.set(0x10); } else if (duration > 0) { - mFlag.set(0x30); + mFlags.set(0x30); } - mTimer = duration; + mRumbleFrame = duration; - mFlag.setBit(0); - mFlag.resetBit(1); - mFlag.setBit(3); + mFlags.setBit(0); + mFlags.resetBit(1); + mFlags.setBit(3); } /* 0x8049A440 */ f32 ControllerRumbleUnit::calc() { f32 result = 0.0f; - if (mFlag.onBit(3)) { - if (mFlag.onBit(0)) { - char x = *++mPatternPos; + if (mFlags.onBit(3)) { + if (mFlags.onBit(0)) { + char x = *++mRumblePatternPtr; if (x == '\0') { - if (mFlag.onBit(4)) { - mPatternPos = mPattern; + if (mFlags.onBit(4)) { + mRumblePatternPtr = mRumblePattern; } else { - mFlag.resetBit(3); + mFlags.resetBit(3); } } else if (x == '*') { result = 1.0f; } - if (mFlag.offBit(5)) { + if (mFlags.offBit(5)) { return result; } - if (--mTimer > 0) { + if (--mRumbleFrame > 0) { return result; } - mFlag.resetBit(3); + mFlags.resetBit(3); return result; } else { - f32 intensity = mIntensity + mRampUp; - mIntensity = intensity; + f32 intensity = mRumbleValue + mRumblePower; + mRumbleValue = intensity; if (intensity >= 1.0f) { result = 1.0f; - mIntensity = 0.0f; + mRumbleValue = 0.0f; } - if (mFlag.onBit(2)) { + if (mFlags.onBit(2)) { return result; } - if (--mTimer > 0) { + if (--mRumbleFrame > 0) { return result; } } - mFlag.resetBit(3); + mFlags.resetBit(3); return result; } else { return -1.0f; @@ -506,14 +510,14 @@ f32 ControllerRumbleUnit::calc() { ControllerRumbleMgr::ControllerRumbleMgr() { mController = nullptr; List_Init(&mActiveUnitList, offsetof(ControllerRumbleUnit, mNode)); - List_Init(&mInactiveUnitList, offsetof(ControllerRumbleUnit, mNode)); + List_Init(&mStoppedUnitList, offsetof(ControllerRumbleUnit, mNode)); } /* 0x8049A590 */ void ControllerRumbleMgr::createUnit(u8 numUnits, CoreController *ctrl) { for (u8 created = 0; created < numUnits; created++) { ControllerRumbleUnit *unit = new ControllerRumbleUnit(); - List_Append(&mInactiveUnitList, unit); + List_Append(&mStoppedUnitList, unit); } mController = ctrl; } @@ -524,7 +528,7 @@ void ControllerRumbleMgr::stop() { while (List_GetSize(&mActiveUnitList) != 0) { ControllerRumbleUnit *unit = static_cast(List_GetNext(&mActiveUnitList, nullptr)); List_Remove(&mActiveUnitList, unit); - List_Append(&mInactiveUnitList, unit); + List_Append(&mStoppedUnitList, unit); } } @@ -540,7 +544,7 @@ void ControllerRumbleMgr::calc() { void *nextObject = List_GetNext(&mActiveUnitList, object); if (x < 0.0f) { List_Remove(&mActiveUnitList, object); - List_Append(&mInactiveUnitList, object); + List_Append(&mStoppedUnitList, object); } else { acc += x; } @@ -565,9 +569,9 @@ void ControllerRumbleMgr::startPattern(const char *pattern, int duration, bool b /* 0x8049A7F0 */ ControllerRumbleUnit *ControllerRumbleMgr::getUnitFromList(bool bGrabActive) { - void *first = List_GetFirst(&this->mInactiveUnitList); + void *first = List_GetFirst(&this->mStoppedUnitList); if (first) { - List_Remove(&mInactiveUnitList, first); + List_Remove(&mStoppedUnitList, first); List_Append(&mActiveUnitList, first); } else if (bGrabActive && (first = List_GetFirst(&mActiveUnitList), first != nullptr)) { List_Remove(&mActiveUnitList, first); diff --git a/src/egg/util/eggException.cpp b/src/egg/util/eggException.cpp index b02caae4..5d4c97c7 100644 --- a/src/egg/util/eggException.cpp +++ b/src/egg/util/eggException.cpp @@ -7,6 +7,7 @@ #include "nw4r/db/db_directPrint.h" #include "nw4r/db/db_exception.h" #include "nw4r/db/db_mapFile.h" + #include "rvl/KPAD.h" // IWYU pragma: export #include "rvl/OS.h" // IWYU pragma: export @@ -52,9 +53,9 @@ bool Exception::ExceptionCallback_(nw4r::db::ConsoleHandle console, void *data) while (((u16 *)data)[u4] != 0) { KPADRead(0, &status, 1); ExceptionWaitTime(50); - if (status.mTrig) { + if (status.trig) { // Reset the sequence on wrong button press, advance on right button press - u4 = status.mTrig & (((u16 *)data)[u4]) ? u4 + 1 : 0; + u4 = status.trig & (((u16 *)data)[u4]) ? u4 + 1 : 0; } } } @@ -79,7 +80,7 @@ bool Exception::ExceptionCallback_(nw4r::db::ConsoleHandle console, void *data) while (true) { KPADRead(0, &status, 1); ExceptionWaitTime(100); - if (status.mTrig & (/* HOME */ 0x8000)) { + if (status.trig & cCORE_BUTTON_HOME) { sUserCallbackMode = !sUserCallbackMode; } if (sUserCallbackMode && sUserCallbackFunc != nullptr) { @@ -91,22 +92,22 @@ bool Exception::ExceptionCallback_(nw4r::db::ConsoleHandle console, void *data) ; prevY = newY; - if (status.mHold & (/* DPAD_DOWN */ 0x4)) { + if (status.hold & cCORE_BUTTON_DOWN) { newY += 1; if (newY > end) { newY = end; } - } else if (status.mHold & (/* DPAD_UP */ 0x8)) { + } else if (status.hold & cCORE_BUTTON_UP) { newY -= 1; if (newY < start) { newY = start; } - } else if (status.mHold & (/* DPAD_RIGHT */ 0x2)) { + } else if (status.hold & cCORE_BUTTON_RIGHT) { newX -= 5; if (newX < -150) { newX = -150; } - } else if (status.mHold & (/* DPAD_LEFT */ 0x1)) { + } else if (status.hold & cCORE_BUTTON_LEFT) { newX += 5; if (newX > 10) { newX = 10; diff --git a/src/m/m_pad.cpp b/src/m/m_pad.cpp index b277c448..5c1afd84 100644 --- a/src/m/m_pad.cpp +++ b/src/m/m_pad.cpp @@ -1,10 +1,11 @@ #include "m/m_pad.h" #include "common.h" +#include "d/d_pad.h" #include "egg/core/eggController.h" #include "egg/math/eggVector.h" -#include "rvl/WPAD.h" // IWYU pragma: export +#include "rvl/WPAD.h" // IWYU pragma: export namespace mPad { @@ -38,7 +39,7 @@ static void clearWPADInfo(int); static int getWPADInfoCB(int controller); void create() { - g_padMg = EGG::CoreControllerMgr::sInstance; + g_padMg = EGG::CoreControllerMgr::instance(); initWPADInfo(); beginPad(); endPad(); @@ -62,10 +63,10 @@ void beginPad() { for (; i < 4; i++) { ctl = g_padMg->getNthController(i); *p_ctl = ctl; - if (ctl->mFlag.onBit(0)) { + if (ctl->isConnected()) { // These sort of look like value, first order derivative, and second order derivative // So perhaps value, velocity, acceleration? - EGG::Vector2f pos = ctl->mCoreStatus[0].getUnk(); + EGG::Vector2f pos = ctl->getCoreStatus()->getAccelVertical(); EGG::Vector2f v = pos - dat->v1; dat->v1 = pos; dat->v3 = v - dat->v2; @@ -81,7 +82,7 @@ void beginPad() { getWPADInfoCB(i); } } else if (*connected) { - ctl->mCoreStatus->init(); + ctl->getCoreStatus()->init(); ctl->sceneReset(); dat->v1.x = 0.0f; dat->v1.y = 0.0f; @@ -134,10 +135,8 @@ static void initWPADInfo() { } } -extern "C" void fn_80058DA0(s32, s32); - static int getWPADInfoCB(int controller) { - int result = WPADGetInfoAsync(controller, &s_WPADInfoTmp[controller], fn_80058DA0); + int result = WPADGetInfoAsync(controller, &s_WPADInfoTmp[controller], async_info_callback); if (result == -1) { clearWPADInfo(controller); } diff --git a/src/toBeSorted/attention.cpp b/src/toBeSorted/attention.cpp index 86257c93..4b3b4705 100644 --- a/src/toBeSorted/attention.cpp +++ b/src/toBeSorted/attention.cpp @@ -141,11 +141,11 @@ bool AttentionManager::isInNormalGameState() const { } bool AttentionManager::isZButtonPressed() const { - return dPad::checkButtonZPressed(); + return dPad::getDownTrigZ(); } bool AttentionManager::isZButtonHeld() const { - return dPad::checkButtonZHeld(); + return dPad::getDownZ(); } bool AttentionManager::checkUnknown() const { diff --git a/src/toBeSorted/d_emitter.cpp b/src/toBeSorted/d_emitter.cpp index 5fab3069..743173ea 100644 --- a/src/toBeSorted/d_emitter.cpp +++ b/src/toBeSorted/d_emitter.cpp @@ -2,6 +2,7 @@ // vtable order #include "JSystem/JParticle/JPAEmitter.h" #include "JSystem/JParticle/JPAParticle.h" +#include "d/d_gfx.h" #include "m/m_heap.h" #include "rvl/GX/GXTypes.h" #include "toBeSorted/d_d3d.h" @@ -41,12 +42,10 @@ #include "toBeSorted/d_d3d.h" #include "toBeSorted/d_particle.h" #include "toBeSorted/event_manager.h" -#include "toBeSorted/lyt_related_floats.h" #include "rvl/GX.h" #include "rvl/MTX.h" - void float_ordering_1(s32 a) { (f32) a; } @@ -466,15 +465,16 @@ void dEffect2D_c::draw() { f32 proj[GX_PROJECTION_SZ]; GXGetProjectionv(proj); f32 base = proj[1]; - proj[1] = base / get_805751A4(); + proj[1] = base / dGfx_c::get16x9to4x3WidthScaleF(); GXSetProjectionv(proj); - f32 f = get_80575184() / 2; + f32 f = dGfx_c::getWidth16x9() / 2; + f32 h = dGfx_c::getCurrentScreenHeightLimitF(); mMtx_c mtx1, mtx2; JPADrawInfo info; - C_MTXLightOrtho(mtx1, -get_80575150(), get_80575150(), -f, f, 0.5f, 0.5f, 0.5f, 0.5f); + C_MTXLightOrtho(mtx1, -h, h, -f, f, 0.5f, 0.5f, 0.5f, 0.5f); - MTXScale(mtx2, fn_80054AD0() ? get_805751A4() : 1.0f, 1.0f, 1.0f); + MTXScale(mtx2, fn_80054AD0() ? dGfx_c::get16x9to4x3WidthScaleF() : 1.0f, 1.0f, 1.0f); MTXCopy(mtx2, info.mCamMtx); MTXCopy(mtx1, info.mPrjMtx); dJEffManager_c::draw(&info, mGroupId); @@ -1031,7 +1031,6 @@ bool dJEffManager_c::createMassObjEffect( void dEmitterBase_c::loadColors( JPABaseEmitter *emitter, const GXColor *color1, const GXColor *color2, s32 plltIdx1, s32 plltIdx2 ) { - dLightEnv_c &mgr = dLightEnv_c::GetInstance(); u8 r1 = 0xFF; u8 g1 = 0xFF; u8 b1 = 0xFF; @@ -1040,6 +1039,7 @@ void dEmitterBase_c::loadColors( u8 b2 = 0xFF; u8 r, g, b; + dLightEnv_c &mgr = dLightEnv_c::GetInstance(); const mColor c1 = mgr.GetCurrentSpf().mParticleTransparentClr; const mColor c2 = mgr.GetCurrentSpf().mParticleSolidClr; @@ -1074,22 +1074,22 @@ void dEmitterBase_c::loadColors( if (plltIdx1 > 0) { if ((flags & 0x1000) != 0) { - const PaletteEAF_smol_entry &entry = mgr.getSmallEAF(plltIdx1 - 1, plltIdx2); - r1 = entry.field_0x00.r; - g1 = entry.field_0x00.g; - b1 = entry.field_0x00.b; + const mColor &entry = mgr.getSmallEAF(plltIdx1 - 1, plltIdx2).field_0x00; + r1 = entry.r; + g1 = entry.g; + b1 = entry.b; } else if ((flags & 0x2000) != 0) { - const PaletteEAF_smol_entry &entry = mgr.getSmallEAF(plltIdx1 - 1, plltIdx2); - r1 = entry.field_0x08.r; - g1 = entry.field_0x08.g; - b1 = entry.field_0x08.b; + const mColor &entry = mgr.getSmallEAF(plltIdx1 - 1, plltIdx2).field_0x08; + r1 = entry.r; + g1 = entry.g; + b1 = entry.b; } } if (factor != 0) { - r = mgr.getfield_0x2F14() * r1 * scaleR; - g = mgr.getfield_0x2F18() * g1 * scaleG; - b = mgr.getfield_0x2F1C() * b1 * scaleB; + r = r1 * scaleR * mgr.getfield_0x2F14(); + g = g1 * scaleG * mgr.getfield_0x2F18(); + b = b1 * scaleB * mgr.getfield_0x2F1C(); } else { r = r1 * scaleR; g = g1 * scaleG; @@ -1106,15 +1106,15 @@ void dEmitterBase_c::loadColors( if (plltIdx1 > 0) { if ((flags & 0x1000) != 0) { - const PaletteEAF_smol_entry &entry = mgr.getSmallEAF(plltIdx1 - 1, plltIdx2); - r2 = entry.field_0x04.r; - g2 = entry.field_0x04.g; - b2 = entry.field_0x04.b; + const mColor &entry = mgr.getSmallEAF(plltIdx1 - 1, plltIdx2).field_0x04; + r2 = entry.r; + g2 = entry.g; + b2 = entry.b; } else if ((flags & 0x2000) != 0) { - const PaletteEAF_smol_entry &entry = mgr.getSmallEAF(plltIdx1 - 1, plltIdx2); - r2 = entry.field_0x0C.r; - g2 = entry.field_0x0C.g; - b2 = entry.field_0x0C.b; + const mColor &entry = mgr.getSmallEAF(plltIdx1 - 1, plltIdx2).field_0x0C; + r2 = entry.r; + g2 = entry.g; + b2 = entry.b; } } @@ -1233,14 +1233,11 @@ dEmitterBase_c *dJEffManager_c::spawnGroundEffect( mtx.makeRotationFromVecs(mVec3_c::Ey, v1, 1.0f); mAng rot(cM::rndF(65536.0f)); mtx.YrotM(rot); - mtx.m[0][3] = pos.x; - mtx.m[1][3] = pos.y; - mtx.m[2][3] = pos.z; + mtx.setTranslation(pos); mMtx_c scaleMtx; MTXScale(scaleMtx, scale, scale, scale); MTXConcat(mtx, scaleMtx, mtx); - u16 eff = sEffArray[idx][unk]; - return spawnEffect(eff, mtx, nullptr, nullptr, polyAttr0, polyAttr1); + return spawnEffect(sEffArray[idx][unk], mtx, nullptr, nullptr, polyAttr0, polyAttr1); } void dWaterEffect_c::init(dAcObjBase_c *base, f32 height, f32 scale, f32 f3) { diff --git a/src/toBeSorted/fi_context.cpp b/src/toBeSorted/fi_context.cpp index cf4584d8..8f0c7b06 100644 --- a/src/toBeSorted/fi_context.cpp +++ b/src/toBeSorted/fi_context.cpp @@ -3,6 +3,7 @@ #include "common.h" #include "d/a/d_a_item.h" #include "d/d_message.h" +#include "d/d_pad.h" #include "d/d_pouch.h" #include "d/d_sc_game.h" #include "d/d_stage_mgr.h" @@ -13,6 +14,7 @@ #include "toBeSorted/file_manager.h" #include "toBeSorted/unk_save_time.h" + // https://github.com/lepelog/skywardsword-tools/wiki/Navi-Table-(Fi-Advice) // Portability hazard, only works for 32 bit architectures @@ -290,9 +292,6 @@ u8 FiContext::rateBattlePerformance(u8 id) { return ret; } -extern "C" bool isLowBattery1(); -extern "C" bool isLowBattery2(); - u16 FiContext::prepareFiHelpIndex() { u16 ret = 0xFFFF; setHelpIndex(-1); @@ -317,10 +316,10 @@ u16 FiContext::prepareFiHelpIndex() { setHelpIndex(0); } - if (isLowBattery2() || isLowBattery1()) { + if (dPad::ex_c::getInstance()->isLowBattery() || dPad::ex_c::getInstance()->isOutOfBattery()) { if (!getField_0x48()) { ret = 6400; - if (isLowBattery1()) { + if (dPad::ex_c::getInstance()->isOutOfBattery()) { // "Master, the batteries in your Wii Remote will be depleted any moment." setHelpIndex(3); } else { diff --git a/src/toBeSorted/save_manager.cpp b/src/toBeSorted/save_manager.cpp index 4c9b9210..4a36f28a 100644 --- a/src/toBeSorted/save_manager.cpp +++ b/src/toBeSorted/save_manager.cpp @@ -6,6 +6,7 @@ #include "d/d_dvd_unk.h" #include "d/d_heap.h" #include "d/d_message.h" +#include "d/d_reset.h" #include "d/d_s_boot.h" #include "d/d_sc_game.h" #include "d/d_sys.h" @@ -18,7 +19,6 @@ #include "toBeSorted/file_manager.h" #include "toBeSorted/nand_request_thread.h" #include "toBeSorted/nand_result_tracker.h" -#include "toBeSorted/reload_color_fader.h" #include "rvl/NAND.h" #include "rvl/TPL.h" @@ -1437,10 +1437,9 @@ void SaveMgr::executeNandError() { } case 6: { if (systemWindow->getField_0xE10() != 0) { - if (!ReloadColorFader::GetInstance()->fn_80068E80() && - !ReloadColorFader::GetInstance()->fn_80067F60() && - mPad::g_currentCore->downTrigger(/* A */ 0x800) && systemWindow->getField_0xDE0() != 2 && - systemWindow->fn_80152F60() == true) { + if (!dReset::Manage_c::GetInstance()->FadeOutCalc() && + !dReset::Manage_c::GetInstance()->IsFaderBlank() && mPad::getCore()->downTrigger(mPad::BUTTON_A) && + systemWindow->getField_0xDE0() != 2 && systemWindow->fn_80152F60() == true) { mStep = 7; } } @@ -1457,7 +1456,7 @@ void SaveMgr::executeNandError() { mStep = 9; } else { dCsBase_c::GetInstance()->setField704(false); - ReloadColorFader::GetInstance()->fn_80067FE0(); + dReset::Manage_c::GetInstance()->SetInteriorReturnDataManager(); endState(); field_0x836 = 0; }