From 329618c585bb12279a7b92590993a95aedf617b7 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Tue, 13 Sep 2022 00:26:54 -0400 Subject: [PATCH] More main progress; tons of headers & stuff Former-commit-id: a6e365791b35de8a1c056db8a4833150450c84d9 --- asm/Kyoto/Alloc/CMemory.s | 37 +- asm/Kyoto/CARAMManager.s | 6 +- asm/Kyoto/CDvdRequest.s | 5 +- asm/Kyoto/CFrameDelayedKiller.s | 8 +- asm/Kyoto/DolphinCMemoryCardSys.s | 4 +- asm/Kyoto/Graphics/CCubeMaterial.s | 7 - asm/Kyoto/Particles/CElementGen.s | 4 +- asm/MetroidPrime/CActor.s | 11 - asm/MetroidPrime/CCredits.s | 2 +- asm/MetroidPrime/CFrontEndUI.s | 4 +- asm/MetroidPrime/CMFGame.s | 4 +- asm/MetroidPrime/CMapWorldInfo.s | 4 +- asm/MetroidPrime/Player/CSaveWorld.s | 22 +- asm/MetroidPrime/Tweaks/CTweaks.s | 4 +- asm/MetroidPrime/main.s | 46 +-- include/GuiSys/CGuiSys.hpp | 23 ++ include/Kyoto/Alloc/CMemory.hpp | 8 +- include/Kyoto/Animation/CSkinnedModel.hpp | 14 + include/Kyoto/Audio/CAudioSys.hpp | 19 + include/Kyoto/Audio/CDSPStreamManager.hpp | 11 + include/Kyoto/Audio/CStreamAudioManager.hpp | 1 + include/Kyoto/Basics/CCast.hpp | 3 +- include/Kyoto/Basics/COsContext.hpp | 4 + include/Kyoto/Basics/CStopwatch.hpp | 2 +- include/Kyoto/CARAMManager.hpp | 7 + include/Kyoto/CFrameDelayedKiller.hpp | 12 + include/Kyoto/CMemoryCardSys.hpp | 5 +- include/Kyoto/CMemorySys.hpp | 8 + include/Kyoto/CResFactory.hpp | 8 +- include/Kyoto/CSimplePool.hpp | 14 +- include/Kyoto/CTimeProvider.hpp | 15 + include/Kyoto/CToken.hpp | 9 +- include/Kyoto/Graphics/CGraphicsSys.hpp | 1 + include/Kyoto/Graphics/CModelFlags.hpp | 5 + include/Kyoto/Graphics/CTexture.hpp | 13 + include/Kyoto/IObj.hpp | 20 +- include/Kyoto/IObjectStore.hpp | 13 + include/Kyoto/Math/CMath.hpp | 5 +- include/Kyoto/Particles/CElementGen.hpp | 12 + include/Kyoto/Streams/CZipInputStream.hpp | 22 ++ include/Kyoto/TReservedAverage.hpp | 1 + include/Kyoto/TToken.hpp | 31 +- include/Kyoto/Text/CRasterFont.hpp | 40 +- include/MetaRender/CCubeRenderer.hpp | 13 +- include/MetaRender/Renderer.hpp | 25 ++ include/MetroidPrime/CActor.hpp | 7 +- include/MetroidPrime/CActorLights.hpp | 2 +- include/MetroidPrime/CActorModelParticles.hpp | 6 + include/MetroidPrime/CAnimData.hpp | 8 +- include/MetroidPrime/CDecalManager.hpp | 12 + include/MetroidPrime/CEnvFxManager.hpp | 7 +- .../MetroidPrime/CGameArchitectureSupport.hpp | 30 +- include/MetroidPrime/CGameGlobalObjects.hpp | 16 +- include/MetroidPrime/CIOWin.hpp | 30 ++ include/MetroidPrime/CIOWinManager.hpp | 7 + include/MetroidPrime/CInGameTweakManager.hpp | 3 + include/MetroidPrime/CInputGenerator.hpp | 16 + include/MetroidPrime/CMain.hpp | 64 +++- include/MetroidPrime/CMemoryCard.hpp | 12 + include/MetroidPrime/CModelData.hpp | 5 + include/MetroidPrime/CParticleDatabase.hpp | 4 + include/MetroidPrime/CSplashScreen.hpp | 23 ++ include/MetroidPrime/CStateManager.hpp | 9 + include/MetroidPrime/Enemies/CAiFuncMap.hpp | 1 + .../Factories/CCharacterFactoryBuilder.hpp | 1 + .../ScriptObjects/CScriptMazeNode.hpp | 13 + include/MetroidPrime/Tweaks/CTweakGame.hpp | 45 ++- include/MetroidPrime/Tweaks/CTweakPlayer.hpp | 318 ++++++++++++++++ include/MetroidPrime/Tweaks/CTweaks.hpp | 11 +- include/MetroidPrime/Tweaks/ITweakObject.hpp | 11 + include/dolphin/__start.h | 2 +- include/dolphin/ar.h | 17 + include/dolphin/arq.h | 18 + include/dolphin/dvd.h | 2 + include/dolphin/os.h | 1 + include/dolphin/os/OSCache.h | 2 + include/dolphin/os/OSMemory.h | 26 ++ include/dolphin/os/OSMutex.h | 23 ++ include/dolphin/os/OSThread.h | 2 + include/rstl/construct.hpp | 1 + include/rstl/hash_map.hpp | 28 ++ include/rstl/list.hpp | 3 + include/rstl/math.hpp | 17 + include/rstl/optional_object.hpp | 17 + include/rstl/rc_ptr.hpp | 17 +- include/rstl/reserved_vector.hpp | 1 + include/rstl/single_ptr.hpp | 3 +- include/rstl/vector.hpp | 17 + include/static_assert.hpp | 14 +- libc/stdio.h | 2 + src/Dolphin/dsp/dsp.c | 6 +- src/Dolphin/os/__start.c | 2 +- src/Kyoto/Basics/CSWDataDolphin.cpp | 2 +- src/MetroidPrime/CActor.cpp | 105 +++++- src/MetroidPrime/main.cpp | 354 +++++++++++++++++- 95 files changed, 1673 insertions(+), 202 deletions(-) create mode 100644 include/GuiSys/CGuiSys.hpp create mode 100644 include/Kyoto/Animation/CSkinnedModel.hpp create mode 100644 include/Kyoto/Audio/CDSPStreamManager.hpp create mode 100644 include/Kyoto/CFrameDelayedKiller.hpp create mode 100644 include/Kyoto/CTimeProvider.hpp create mode 100644 include/Kyoto/Particles/CElementGen.hpp create mode 100644 include/Kyoto/Streams/CZipInputStream.hpp create mode 100644 include/MetaRender/Renderer.hpp create mode 100644 include/MetroidPrime/CDecalManager.hpp create mode 100644 include/MetroidPrime/CIOWin.hpp create mode 100644 include/MetroidPrime/CInputGenerator.hpp create mode 100644 include/MetroidPrime/CMemoryCard.hpp create mode 100644 include/MetroidPrime/CSplashScreen.hpp create mode 100644 include/MetroidPrime/ScriptObjects/CScriptMazeNode.hpp create mode 100644 include/MetroidPrime/Tweaks/CTweakPlayer.hpp create mode 100644 include/MetroidPrime/Tweaks/ITweakObject.hpp create mode 100644 include/dolphin/ar.h create mode 100644 include/dolphin/arq.h create mode 100644 include/dolphin/os/OSMemory.h create mode 100644 include/dolphin/os/OSMutex.h create mode 100644 include/rstl/hash_map.hpp create mode 100644 include/rstl/math.hpp diff --git a/asm/Kyoto/Alloc/CMemory.s b/asm/Kyoto/Alloc/CMemory.s index 5629e67a..aececa2f 100644 --- a/asm/Kyoto/Alloc/CMemory.s +++ b/asm/Kyoto/Alloc/CMemory.s @@ -8,16 +8,15 @@ lbl_ctor: .balign 8 .lcomm lbl_804BFD58, 0xC, 4 -.lcomm lbl_804BFD64, 0xC4, 4 +.lcomm gGameAllocator, 0xC0, 4 .section .sdata .balign 8 -.global lbl_805A8868 -lbl_805A8868: +.global mpAllocator__7CMemory +mpAllocator__7CMemory: # ROM: 0x3F6208 - .4byte lbl_804BFD64 - .4byte 0 + .4byte gGameAllocator .section .sbss, "wa" .balign 8 @@ -88,7 +87,7 @@ OffsetFakeStatics__7CMemoryFi: /* 803158C4 00312824 7C 08 02 A6 */ mflr r0 /* 803158C8 00312828 7C 64 1B 78 */ mr r4, r3 /* 803158CC 0031282C 90 01 00 14 */ stw r0, 0x14(r1) -/* 803158D0 00312830 80 6D 9C A8 */ lwz r3, lbl_805A8868@sda21(r13) +/* 803158D0 00312830 80 6D 9C A8 */ lwz r3, mpAllocator__7CMemory@sda21(r13) /* 803158D4 00312834 81 83 00 00 */ lwz r12, 0(r3) /* 803158D8 00312838 81 8C 00 38 */ lwz r12, 0x38(r12) /* 803158DC 0031283C 7D 89 03 A6 */ mtctr r12 @@ -106,7 +105,7 @@ SetOutOfMemoryCallback__7CMemoryFPFPCvUi_CbPCv: /* 80315900 00312860 90 01 00 14 */ stw r0, 0x14(r1) /* 80315904 00312864 7C 60 1B 78 */ mr r0, r3 /* 80315908 00312868 7C 04 03 78 */ mr r4, r0 -/* 8031590C 0031286C 80 6D 9C A8 */ lwz r3, lbl_805A8868@sda21(r13) +/* 8031590C 0031286C 80 6D 9C A8 */ lwz r3, mpAllocator__7CMemory@sda21(r13) /* 80315910 00312870 81 83 00 00 */ lwz r12, 0(r3) /* 80315914 00312874 81 8C 00 2C */ lwz r12, 0x2c(r12) /* 80315918 00312878 7D 89 03 A6 */ mtctr r12 @@ -130,7 +129,7 @@ Free__7CMemoryFPCv: /* 80315954 003128B4 54 00 0F FE */ srwi r0, r0, 0x1f /* 80315958 003128B8 98 01 00 08 */ stb r0, 8(r1) /* 8031595C 003128BC 41 82 00 1C */ beq lbl_80315978 -/* 80315960 003128C0 80 6D 9C A8 */ lwz r3, lbl_805A8868@sda21(r13) +/* 80315960 003128C0 80 6D 9C A8 */ lwz r3, mpAllocator__7CMemory@sda21(r13) /* 80315964 003128C4 7F E4 FB 78 */ mr r4, r31 /* 80315968 003128C8 81 83 00 00 */ lwz r12, 0(r3) /* 8031596C 003128CC 81 8C 00 18 */ lwz r12, 0x18(r12) @@ -160,7 +159,7 @@ Alloc__7CMemoryFUlQ210IAllocator5EHintQ210IAllocator6EScopeQ210IAllocator5ETypeR /* 803159BC 0031291C 7C 03 00 D0 */ neg r0, r3 /* 803159C0 00312920 7F 64 DB 78 */ mr r4, r27 /* 803159C4 00312924 7C 00 1B 78 */ or r0, r0, r3 -/* 803159C8 00312928 80 6D 9C A8 */ lwz r3, lbl_805A8868@sda21(r13) +/* 803159C8 00312928 80 6D 9C A8 */ lwz r3, mpAllocator__7CMemory@sda21(r13) /* 803159CC 0031292C 54 00 0F FE */ srwi r0, r0, 0x1f /* 803159D0 00312930 7F 85 E3 78 */ mr r5, r28 /* 803159D4 00312934 81 83 00 00 */ lwz r12, 0(r3) @@ -195,7 +194,7 @@ Shutdown__7CMemoryFv: /* 80315A38 00312998 90 01 00 64 */ stw r0, 0x64(r1) /* 80315A3C 0031299C 38 00 00 00 */ li r0, 0 /* 80315A40 003129A0 38 61 00 08 */ addi r3, r1, 8 -/* 80315A44 003129A4 80 8D 9C A8 */ lwz r4, lbl_805A8868@sda21(r13) +/* 80315A44 003129A4 80 8D 9C A8 */ lwz r4, mpAllocator__7CMemory@sda21(r13) /* 80315A48 003129A8 98 0D A8 A0 */ stb r0, lbl_805A9460@sda21(r13) /* 80315A4C 003129AC 81 84 00 00 */ lwz r12, 0(r4) /* 80315A50 003129B0 81 8C 00 3C */ lwz r12, 0x3c(r12) @@ -208,7 +207,7 @@ Shutdown__7CMemoryFv: /* 80315A6C 003129CC 3C 60 80 31 */ lis r3, cmemory_enum_alloc_cb__FRCQ210IAllocator10SAllocInfoPCv@ha /* 80315A70 003129D0 38 83 5A BC */ addi r4, r3, cmemory_enum_alloc_cb__FRCQ210IAllocator10SAllocInfoPCv@l /* 80315A74 003129D4 90 0D A8 A4 */ stw r0, lbl_805A9464@sda21(r13) -/* 80315A78 003129D8 80 6D 9C A8 */ lwz r3, lbl_805A8868@sda21(r13) +/* 80315A78 003129D8 80 6D 9C A8 */ lwz r3, mpAllocator__7CMemory@sda21(r13) /* 80315A7C 003129DC 38 A0 00 00 */ li r5, 0 /* 80315A80 003129E0 90 0D A8 A8 */ stw r0, lbl_805A9468@sda21(r13) /* 80315A84 003129E4 38 C0 00 00 */ li r6, 0 @@ -217,7 +216,7 @@ Shutdown__7CMemoryFv: /* 80315A90 003129F0 7D 89 03 A6 */ mtctr r12 /* 80315A94 003129F4 4E 80 04 21 */ bctrl lbl_80315A98: -/* 80315A98 003129F8 80 6D 9C A8 */ lwz r3, lbl_805A8868@sda21(r13) +/* 80315A98 003129F8 80 6D 9C A8 */ lwz r3, mpAllocator__7CMemory@sda21(r13) /* 80315A9C 003129FC 81 83 00 00 */ lwz r12, 0(r3) /* 80315AA0 00312A00 81 8C 00 10 */ lwz r12, 0x10(r12) /* 80315AA4 00312A04 7D 89 03 A6 */ mtctr r12 @@ -255,7 +254,7 @@ SetAllocator__7CMemoryFR10COsContextR10IAllocator: /* 80315B08 00312A68 7C 9F 23 78 */ mr r31, r4 /* 80315B0C 00312A6C 93 C1 00 08 */ stw r30, 8(r1) /* 80315B10 00312A70 7C 7E 1B 78 */ mr r30, r3 -/* 80315B14 00312A74 80 0D 9C A8 */ lwz r0, lbl_805A8868@sda21(r13) +/* 80315B14 00312A74 80 0D 9C A8 */ lwz r0, mpAllocator__7CMemory@sda21(r13) /* 80315B18 00312A78 7C 00 F8 40 */ cmplw r0, r31 /* 80315B1C 00312A7C 41 82 00 3C */ beq lbl_80315B58 /* 80315B20 00312A80 28 00 00 00 */ cmplwi r0, 0 @@ -266,7 +265,7 @@ SetAllocator__7CMemoryFR10COsContextR10IAllocator: /* 80315B34 00312A94 7D 89 03 A6 */ mtctr r12 /* 80315B38 00312A98 4E 80 04 21 */ bctrl lbl_80315B3C: -/* 80315B3C 00312A9C 93 ED 9C A8 */ stw r31, lbl_805A8868@sda21(r13) +/* 80315B3C 00312A9C 93 ED 9C A8 */ stw r31, mpAllocator__7CMemory@sda21(r13) /* 80315B40 00312AA0 7F E3 FB 78 */ mr r3, r31 /* 80315B44 00312AA4 7F C4 F3 78 */ mr r4, r30 /* 80315B48 00312AA8 81 9F 00 00 */ lwz r12, 0(r31) @@ -287,7 +286,7 @@ Startup__7CMemoryFR10COsContext: /* 80315B74 00312AD4 7C 08 02 A6 */ mflr r0 /* 80315B78 00312AD8 7C 64 1B 78 */ mr r4, r3 /* 80315B7C 00312ADC 90 01 00 14 */ stw r0, 0x14(r1) -/* 80315B80 00312AE0 80 6D 9C A8 */ lwz r3, lbl_805A8868@sda21(r13) +/* 80315B80 00312AE0 80 6D 9C A8 */ lwz r3, mpAllocator__7CMemory@sda21(r13) /* 80315B84 00312AE4 81 83 00 00 */ lwz r12, 0(r3) /* 80315B88 00312AE8 81 8C 00 0C */ lwz r12, 0xc(r12) /* 80315B8C 00312AEC 7D 89 03 A6 */ mtctr r12 @@ -300,8 +299,8 @@ Startup__7CMemoryFR10COsContext: .global GetGameAllocator__10CMemorySysFv GetGameAllocator__10CMemorySysFv: -/* 80315BA8 00312B08 3C 60 80 4C */ lis r3, lbl_804BFD64@ha -/* 80315BAC 00312B0C 38 63 FD 64 */ addi r3, r3, lbl_804BFD64@l +/* 80315BA8 00312B08 3C 60 80 4C */ lis r3, gGameAllocator@ha +/* 80315BAC 00312B0C 38 63 FD 64 */ addi r3, r3, gGameAllocator@l /* 80315BB0 00312B10 4E 80 00 20 */ blr .global __dt__10CMemorySysFv @@ -357,9 +356,9 @@ __ct__10CMemorySysFR10COsContextR10IAllocator: __sinit_CMemory_cpp: /* 80315C5C 00312BBC 94 21 FF F0 */ stwu r1, -0x10(r1) /* 80315C60 00312BC0 7C 08 02 A6 */ mflr r0 -/* 80315C64 00312BC4 3C 60 80 4C */ lis r3, lbl_804BFD64@ha +/* 80315C64 00312BC4 3C 60 80 4C */ lis r3, gGameAllocator@ha /* 80315C68 00312BC8 90 01 00 14 */ stw r0, 0x14(r1) -/* 80315C6C 00312BCC 38 63 FD 64 */ addi r3, r3, lbl_804BFD64@l +/* 80315C6C 00312BCC 38 63 FD 64 */ addi r3, r3, gGameAllocator@l /* 80315C70 00312BD0 48 03 C9 5D */ bl __ct__14CGameAllocatorFv /* 80315C74 00312BD4 3C 80 80 35 */ lis r4, __dt__14CGameAllocatorFv@ha /* 80315C78 00312BD8 3C A0 80 4C */ lis r5, lbl_804BFD58@ha diff --git a/asm/Kyoto/CARAMManager.s b/asm/Kyoto/CARAMManager.s index bce18804..17a360bf 100644 --- a/asm/Kyoto/CARAMManager.s +++ b/asm/Kyoto/CARAMManager.s @@ -7,8 +7,8 @@ lbl_ctor: .section .sdata .balign 8 -.global lbl_805A8920 -lbl_805A8920: +.global mPreInitializeAlloc__12CARAMManager +mPreInitializeAlloc__12CARAMManager: # ROM: 0x3F62C0 .4byte 0x00004000 .4byte 0 @@ -595,7 +595,7 @@ Initialize__12CARAMManagerFUi: /* 80344D24 00341C84 93 C1 00 18 */ stw r30, 0x18(r1) /* 80344D28 00341C88 7C 7E 1B 78 */ mr r30, r3 /* 80344D2C 00341C8C 48 02 8E 91 */ bl ARGetSize -/* 80344D30 00341C90 80 0D 9D 60 */ lwz r0, lbl_805A8920@sda21(r13) +/* 80344D30 00341C90 80 0D 9D 60 */ lwz r0, mPreInitializeAlloc__12CARAMManager@sda21(r13) /* 80344D34 00341C94 93 CD A9 68 */ stw r30, lbl_805A9528@sda21(r13) /* 80344D38 00341C98 7C 00 18 50 */ subf r0, r0, r3 /* 80344D3C 00341C9C 7F E0 F3 96 */ divwu r31, r0, r30 diff --git a/asm/Kyoto/CDvdRequest.s b/asm/Kyoto/CDvdRequest.s index 053a4ed9..155f724a 100644 --- a/asm/Kyoto/CDvdRequest.s +++ b/asm/Kyoto/CDvdRequest.s @@ -28,8 +28,9 @@ lbl_803ED594: .section .sbss, "wa" .balign 8 -.global lbl_805A9330 -lbl_805A9330: +# TODO CDvdRequestManager +.global mManagerInstalled__14CDvdRequestSys +mManagerInstalled__14CDvdRequestSys: .skip 0x8 .section .text, "ax" diff --git a/asm/Kyoto/CFrameDelayedKiller.s b/asm/Kyoto/CFrameDelayedKiller.s index 07e2bf42..effc8dfc 100644 --- a/asm/Kyoto/CFrameDelayedKiller.s +++ b/asm/Kyoto/CFrameDelayedKiller.s @@ -260,8 +260,8 @@ lbl_8036CD34: /* 8036CD50 00369CB0 38 21 00 10 */ addi r1, r1, 0x10 /* 8036CD54 00369CB4 4E 80 00 20 */ blr -.global sub_8036cd58 -sub_8036cd58: +.global ShutDown__19CFrameDelayedKillerFv +ShutDown__19CFrameDelayedKillerFv: /* 8036CD58 00369CB8 94 21 FF F0 */ stwu r1, -0x10(r1) /* 8036CD5C 00369CBC 7C 08 02 A6 */ mflr r0 /* 8036CD60 00369CC0 90 01 00 14 */ stw r0, 0x14(r1) @@ -271,8 +271,8 @@ sub_8036cd58: /* 8036CD70 00369CD0 38 21 00 10 */ addi r1, r1, 0x10 /* 8036CD74 00369CD4 4E 80 00 20 */ blr -.global sub_8036cd78 -sub_8036cd78: +.global Initialize__19CFrameDelayedKillerFv +Initialize__19CFrameDelayedKillerFv: /* 8036CD78 00369CD8 94 21 FF F0 */ stwu r1, -0x10(r1) /* 8036CD7C 00369CDC 7C 08 02 A6 */ mflr r0 /* 8036CD80 00369CE0 90 01 00 14 */ stw r0, 0x14(r1) diff --git a/asm/Kyoto/DolphinCMemoryCardSys.s b/asm/Kyoto/DolphinCMemoryCardSys.s index ff2aeee8..96fa87d0 100644 --- a/asm/Kyoto/DolphinCMemoryCardSys.s +++ b/asm/Kyoto/DolphinCMemoryCardSys.s @@ -1241,8 +1241,8 @@ lbl_8034E4A4: /* 8034E4B8 0034B418 38 21 00 10 */ addi r1, r1, 0x10 /* 8034E4BC 0034B41C 4E 80 00 20 */ blr -.global Initialize__14CMemoryCardSysFv -Initialize__14CMemoryCardSysFv: +.global __ct__14CMemoryCardSysFv +__ct__14CMemoryCardSysFv: /* 8034E4C0 0034B420 94 21 FF F0 */ stwu r1, -0x10(r1) /* 8034E4C4 0034B424 7C 08 02 A6 */ mflr r0 /* 8034E4C8 0034B428 90 01 00 14 */ stw r0, 0x14(r1) diff --git a/asm/Kyoto/Graphics/CCubeMaterial.s b/asm/Kyoto/Graphics/CCubeMaterial.s index 347d2a22..eacf4ea2 100644 --- a/asm/Kyoto/Graphics/CCubeMaterial.s +++ b/asm/Kyoto/Graphics/CCubeMaterial.s @@ -2567,7 +2567,6 @@ HandleAnimatedUV__FPCUi9_GXTexMtx11_GXPTTexMtx: /* 80347A50 003449B0 7C 03 00 2E */ lwzx r0, r3, r0 /* 80347A54 003449B4 7C 09 03 A6 */ mtctr r0 /* 80347A58 003449B8 4E 80 04 20 */ bctr -.global lbl_80347A5C lbl_80347A5C: /* 80347A5C 003449BC 3C 80 80 5A */ lis r4, mViewMatrix__9CGraphics@ha /* 80347A60 003449C0 38 61 00 CC */ addi r3, r1, 0xcc @@ -2599,7 +2598,6 @@ lbl_80347A5C: /* 80347AC8 00344A28 48 03 49 C9 */ bl GXLoadTexMtxImm /* 80347ACC 00344A2C 38 60 00 01 */ li r3, 1 /* 80347AD0 00344A30 48 00 05 14 */ b lbl_80347FE4 -.global lbl_80347AD4 lbl_80347AD4: /* 80347AD4 00344A34 3C 80 80 5A */ lis r4, mViewMatrix__9CGraphics@ha /* 80347AD8 00344A38 38 61 00 6C */ addi r3, r1, 0x6c @@ -2623,7 +2621,6 @@ lbl_80347AD4: /* 80347B20 00344A80 48 03 49 71 */ bl GXLoadTexMtxImm /* 80347B24 00344A84 38 60 00 01 */ li r3, 1 /* 80347B28 00344A88 48 00 04 BC */ b lbl_80347FE4 -.global lbl_80347B2C lbl_80347B2C: /* 80347B2C 00344A8C C3 FC 00 04 */ lfs f31, 4(r28) /* 80347B30 00344A90 C3 DC 00 08 */ lfs f30, 8(r28) @@ -2641,7 +2638,6 @@ lbl_80347B2C: /* 80347B60 00344AC0 48 03 49 31 */ bl GXLoadTexMtxImm /* 80347B64 00344AC4 38 60 00 05 */ li r3, 5 /* 80347B68 00344AC8 48 00 04 7C */ b lbl_80347FE4 -.global lbl_80347B6C lbl_80347B6C: /* 80347B6C 00344ACC C3 9C 00 04 */ lfs f28, 4(r28) /* 80347B70 00344AD0 C3 BC 00 08 */ lfs f29, 8(r28) @@ -2697,7 +2693,6 @@ lbl_80347B6C: /* 80347C38 00344B98 48 03 48 59 */ bl GXLoadTexMtxImm /* 80347C3C 00344B9C 38 60 00 03 */ li r3, 3 /* 80347C40 00344BA0 48 00 03 A4 */ b lbl_80347FE4 -.global lbl_80347C44 lbl_80347C44: /* 80347C44 00344BA4 C3 9C 00 04 */ lfs f28, 4(r28) /* 80347C48 00344BA8 C3 BC 00 08 */ lfs f29, 8(r28) @@ -2751,7 +2746,6 @@ lbl_80347CF0: /* 80347D00 00344C60 48 03 47 91 */ bl GXLoadTexMtxImm /* 80347D04 00344C64 38 60 00 05 */ li r3, 5 /* 80347D08 00344C68 48 00 02 DC */ b lbl_80347FE4 -.global lbl_80347D0C lbl_80347D0C: /* 80347D0C 00344C6C 3C 60 80 5A */ lis r3, mModelMatrix__9CGraphics@ha /* 80347D10 00344C70 83 9F 00 60 */ lwz r28, 0x60(r31) @@ -2837,7 +2831,6 @@ lbl_80347D0C: /* 80347E50 00344DB0 48 03 46 41 */ bl GXLoadTexMtxImm /* 80347E54 00344DB4 38 60 00 01 */ li r3, 1 /* 80347E58 00344DB8 48 00 01 8C */ b lbl_80347FE4 -.global lbl_80347E5C lbl_80347E5C: /* 80347E5C 00344DBC 3C 80 80 5A */ lis r4, mViewMatrix__9CGraphics@ha /* 80347E60 00344DC0 38 61 00 0C */ addi r3, r1, 0xc diff --git a/asm/Kyoto/Particles/CElementGen.s b/asm/Kyoto/Particles/CElementGen.s index b0151f79..f82f9cb9 100644 --- a/asm/Kyoto/Particles/CElementGen.s +++ b/asm/Kyoto/Particles/CElementGen.s @@ -15601,7 +15601,7 @@ lbl_80324EB4: /* 80324EC4 00321E24 7C 64 1B 78 */ mr r4, r3 /* 80324EC8 00321E28 3B 01 00 70 */ addi r24, r1, 0x70 /* 80324ECC 00321E2C 38 61 00 10 */ addi r3, r1, 0x10 -/* 80324ED0 00321E30 4B CE 2B 5D */ bl "GetNewDerivedObject__35TObjOwnerDerivedFromIObj<8CTexture>FP8CTexture" +/* 80324ED0 00321E30 4B CE 2B 5D */ bl "GetIObjObjectFor__17TToken<8CTexture>FP8CTexture" /* 80324ED4 00321E34 38 00 00 00 */ li r0, 0 /* 80324ED8 00321E38 80 81 00 14 */ lwz r4, 0x14(r1) /* 80324EDC 00321E3C 98 01 00 10 */ stb r0, 0x10(r1) @@ -15732,7 +15732,7 @@ lbl_80325044: /* 803250B0 00322010 7C 64 1B 78 */ mr r4, r3 /* 803250B4 00322014 3B 01 00 60 */ addi r24, r1, 0x60 /* 803250B8 00322018 38 61 00 08 */ addi r3, r1, 8 -/* 803250BC 0032201C 4B CE 29 71 */ bl "GetNewDerivedObject__35TObjOwnerDerivedFromIObj<8CTexture>FP8CTexture" +/* 803250BC 0032201C 4B CE 29 71 */ bl "GetIObjObjectFor__17TToken<8CTexture>FP8CTexture" /* 803250C0 00322020 38 00 00 00 */ li r0, 0 /* 803250C4 00322024 80 81 00 0C */ lwz r4, 0xc(r1) /* 803250C8 00322028 98 01 00 08 */ stb r0, 8(r1) diff --git a/asm/MetroidPrime/CActor.s b/asm/MetroidPrime/CActor.s index 81cc4993..1dee53b3 100644 --- a/asm/MetroidPrime/CActor.s +++ b/asm/MetroidPrime/CActor.s @@ -944,7 +944,6 @@ AcceptScriptMsg__6CActorF20EScriptObjectMessage9TUniqueIdR13CStateManager: /* 80053648 000505A8 7C 04 00 2E */ lwzx r0, r4, r0 /* 8005364C 000505AC 7C 09 03 A6 */ mtctr r0 /* 80053650 000505B0 4E 80 04 20 */ bctr -.global lbl_80053654 lbl_80053654: /* 80053654 000505B4 88 1C 00 30 */ lbz r0, 0x30(r28) /* 80053658 000505B8 54 00 CF FF */ rlwinm. r0, r0, 0x19, 0x1f, 0x1f @@ -952,11 +951,9 @@ lbl_80053654: /* 80053660 000505C0 48 2B 68 81 */ bl GetSecondsMod900__9CGraphicsFv /* 80053664 000505C4 D0 3C 00 BC */ stfs f1, 0xbc(r28) /* 80053668 000505C8 48 00 01 B4 */ b lbl_8005381C -.global lbl_8005366C lbl_8005366C: /* 8005366C 000505CC 48 00 1B D9 */ bl RemoveEmitter__6CActorFv /* 80053670 000505D0 48 00 01 AC */ b lbl_8005381C -.global lbl_80053674 lbl_80053674: /* 80053674 000505D4 48 00 1B D1 */ bl RemoveEmitter__6CActorFv /* 80053678 000505D8 80 9C 00 64 */ lwz r4, 0x64(r28) @@ -981,7 +978,6 @@ lbl_800536A4: /* 800536BC 0005061C 38 63 01 20 */ addi r3, r3, 0x120 /* 800536C0 00050620 48 06 46 71 */ bl DeleteAllLights__17CParticleDatabaseCFR13CStateManager /* 800536C4 00050624 48 00 01 58 */ b lbl_8005381C -.global lbl_800536C8 lbl_800536C8: /* 800536C8 00050628 80 1C 00 98 */ lwz r0, 0x98(r28) /* 800536CC 0005062C 28 00 00 00 */ cmplwi r0, 0 @@ -1024,7 +1020,6 @@ lbl_80053710: /* 80053754 000506B4 80 63 00 10 */ lwz r3, 0x10(r3) /* 80053758 000506B8 4B FD 77 15 */ bl InitializeEffects__9CAnimDataFR13CStateManager7TAreaIdRC9CVector3f /* 8005375C 000506BC 48 00 00 C0 */ b lbl_8005381C -.global lbl_80053760 lbl_80053760: /* 80053760 000506C0 A0 1E 00 00 */ lhz r0, 0(r30) /* 80053764 000506C4 38 A1 00 18 */ addi r5, r1, 0x18 @@ -1032,7 +1027,6 @@ lbl_80053760: /* 8005376C 000506CC B0 01 00 18 */ sth r0, 0x18(r1) /* 80053770 000506D0 4B FF FB 51 */ bl SetInFluid__6CActorFb9TUniqueId /* 80053774 000506D4 48 00 00 A8 */ b lbl_8005381C -.global lbl_80053778 lbl_80053778: /* 80053778 000506D8 A0 0D A3 8C */ lhz r0, kInvalidUniqueId@sda21(r13) /* 8005377C 000506DC 38 A1 00 14 */ addi r5, r1, 0x14 @@ -1040,7 +1034,6 @@ lbl_80053778: /* 80053784 000506E4 B0 01 00 14 */ sth r0, 0x14(r1) /* 80053788 000506E8 4B FF FB 39 */ bl SetInFluid__6CActorFb9TUniqueId /* 8005378C 000506EC 48 00 00 90 */ b lbl_8005381C -.global lbl_80053790 lbl_80053790: /* 80053790 000506F0 83 7C 00 2C */ lwz r27, 0x2c(r28) /* 80053794 000506F4 48 00 00 70 */ b lbl_80053804 @@ -1080,7 +1073,6 @@ lbl_80053804: /* 80053810 00050770 7C 03 02 14 */ add r0, r3, r0 /* 80053814 00050774 7C 1B 00 40 */ cmplw r27, r0 /* 80053818 00050778 40 82 FF 80 */ bne lbl_80053798 -.global lbl_8005381C lbl_8005381C: /* 8005381C 0005077C A0 1E 00 00 */ lhz r0, 0(r30) /* 80053820 00050780 7F 83 E3 78 */ mr r3, r28 @@ -2799,9 +2791,6 @@ lbl_80055010: /* 80055020 00051F80 83 81 00 B0 */ lwz r28, 0xb0(r1) /* 80055024 00051F84 7C 08 03 A6 */ mtlr r0 /* 80055028 00051F88 38 21 00 C0 */ addi r1, r1, 0xc0 - -.global sub_8005502c -sub_8005502c: /* 8005502C 00051F8C 4E 80 00 20 */ blr .global SetModelData__6CActorFRC10CModelData diff --git a/asm/MetroidPrime/CCredits.s b/asm/MetroidPrime/CCredits.s index 4b3a89c2..f0d32ba5 100644 --- a/asm/MetroidPrime/CCredits.s +++ b/asm/MetroidPrime/CCredits.s @@ -2967,7 +2967,7 @@ lbl_80027824: /* 80027824 00024784 3B 1F 00 50 */ addi r24, r31, 0x50 /* 80027828 00024788 38 61 00 08 */ addi r3, r1, 8 /* 8002782C 0002478C 38 80 00 00 */ li r4, 0 -/* 80027830 00024790 4B FE 05 A9 */ bl sub_80007dd8 +/* 80027830 00024790 4B FE 05 A9 */ bl "GetIObjObjectFor__21TToken<11CRasterFont>FP11CRasterFont" /* 80027834 00024794 38 00 00 00 */ li r0, 0 /* 80027838 00024798 80 81 00 0C */ lwz r4, 0xc(r1) /* 8002783C 0002479C 98 01 00 08 */ stb r0, 8(r1) diff --git a/asm/MetroidPrime/CFrontEndUI.s b/asm/MetroidPrime/CFrontEndUI.s index 062b3049..766fc246 100644 --- a/asm/MetroidPrime/CFrontEndUI.s +++ b/asm/MetroidPrime/CFrontEndUI.s @@ -5412,12 +5412,12 @@ lbl_8001FE1C: /* 8001FE24 0001CD84 80 6D A0 84 */ lwz r3, gpMemoryCard@sda21(r13) /* 8001FE28 0001CD88 3B 20 00 00 */ li r25, 0 /* 8001FE2C 0001CD8C 80 9A 00 08 */ lwz r4, 8(r26) -/* 8001FE30 0001CD90 48 22 91 89 */ bl HasSaveWorldMemory__15CMemoryCardSysFi +/* 8001FE30 0001CD90 48 22 91 89 */ bl HasSaveWorldMemory__11CMemoryCardFi /* 8001FE34 0001CD94 54 60 06 3F */ clrlwi. r0, r3, 0x18 /* 8001FE38 0001CD98 41 82 00 18 */ beq lbl_8001FE50 /* 8001FE3C 0001CD9C 80 6D A0 84 */ lwz r3, gpMemoryCard@sda21(r13) /* 8001FE40 0001CDA0 80 9A 00 08 */ lwz r4, 8(r26) -/* 8001FE44 0001CDA4 48 22 90 C9 */ bl GetSaveWorldMemory__14CMemoryCardSysCFi +/* 8001FE44 0001CDA4 48 22 90 C9 */ bl GetSaveWorldMemory__11CMemoryCardCFi /* 8001FE48 0001CDA8 48 22 90 81 */ bl GetFrontEndName__16CSaveWorldMemoryCFv /* 8001FE4C 0001CDAC 7C 79 1B 78 */ mr r25, r3 lbl_8001FE50: diff --git a/asm/MetroidPrime/CMFGame.s b/asm/MetroidPrime/CMFGame.s index a4464be2..e41463c8 100644 --- a/asm/MetroidPrime/CMFGame.s +++ b/asm/MetroidPrime/CMFGame.s @@ -717,12 +717,12 @@ lbl_80024258: /* 80024264 000211C4 80 6D A0 84 */ lwz r3, gpMemoryCard@sda21(r13) /* 80024268 000211C8 7C 1E 03 78 */ mr r30, r0 /* 8002426C 000211CC 7F C4 F3 78 */ mr r4, r30 -/* 80024270 000211D0 48 22 4D 49 */ bl HasSaveWorldMemory__15CMemoryCardSysFi +/* 80024270 000211D0 48 22 4D 49 */ bl HasSaveWorldMemory__11CMemoryCardFi /* 80024274 000211D4 54 60 06 3F */ clrlwi. r0, r3, 0x18 /* 80024278 000211D8 41 82 00 58 */ beq lbl_800242D0 /* 8002427C 000211DC 80 6D A0 84 */ lwz r3, gpMemoryCard@sda21(r13) /* 80024280 000211E0 7F C4 F3 78 */ mr r4, r30 -/* 80024284 000211E4 48 22 4C 89 */ bl GetSaveWorldMemory__14CMemoryCardSysCFi +/* 80024284 000211E4 48 22 4C 89 */ bl GetSaveWorldMemory__11CMemoryCardCFi /* 80024288 000211E8 7C 7E 1B 78 */ mr r30, r3 /* 8002428C 000211EC 80 63 00 00 */ lwz r3, 0(r3) /* 80024290 000211F0 3C 03 00 01 */ addis r0, r3, 1 diff --git a/asm/MetroidPrime/CMapWorldInfo.s b/asm/MetroidPrime/CMapWorldInfo.s index 06e41f13..0c592b4c 100644 --- a/asm/MetroidPrime/CMapWorldInfo.s +++ b/asm/MetroidPrime/CMapWorldInfo.s @@ -1125,7 +1125,7 @@ PutTo__13CMapWorldInfoCFR13COutputStreamRC10CSaveWorldi: /* 80168BB4 00165B14 7C BD 2B 78 */ mr r29, r5 /* 80168BB8 00165B18 7C C4 33 78 */ mr r4, r6 /* 80168BBC 00165B1C 80 6D A0 84 */ lwz r3, gpMemoryCard@sda21(r13) -/* 80168BC0 00165B20 48 0E 03 4D */ bl GetSaveWorldMemory__14CMemoryCardSysCFi +/* 80168BC0 00165B20 48 0E 03 4D */ bl GetSaveWorldMemory__11CMemoryCardCFi /* 80168BC4 00165B24 83 E3 00 08 */ lwz r31, 8(r3) /* 80168BC8 00165B28 3B C0 00 00 */ li r30, 0 /* 80168BCC 00165B2C 48 00 00 88 */ b lbl_80168C54 @@ -1394,7 +1394,7 @@ __ct__13CMapWorldInfoFR16CBitStreamReaderRC10CSaveWorldUi: /* 80168F90 00165EF0 90 03 00 34 */ stw r0, 0x34(r3) /* 80168F94 00165EF4 98 03 00 38 */ stb r0, 0x38(r3) /* 80168F98 00165EF8 80 6D A0 84 */ lwz r3, gpMemoryCard@sda21(r13) -/* 80168F9C 00165EFC 48 0D FF 71 */ bl GetSaveWorldMemory__14CMemoryCardSysCFi +/* 80168F9C 00165EFC 48 0D FF 71 */ bl GetSaveWorldMemory__11CMemoryCardCFi /* 80168FA0 00165F00 83 83 00 08 */ lwz r28, 8(r3) /* 80168FA4 00165F04 38 78 00 04 */ addi r3, r24, 4 /* 80168FA8 00165F08 57 80 D8 08 */ slwi r0, r28, 0x1b diff --git a/asm/MetroidPrime/Player/CSaveWorld.s b/asm/MetroidPrime/Player/CSaveWorld.s index 7665ebf1..33b7ed30 100644 --- a/asm/MetroidPrime/Player/CSaveWorld.s +++ b/asm/MetroidPrime/Player/CSaveWorld.s @@ -106,8 +106,8 @@ lbl_80248EFC: /* 80248F04 00245E64 38 21 00 10 */ addi r1, r1, 0x10 /* 80248F08 00245E68 4E 80 00 20 */ blr -.global GetSaveWorldMemory__14CMemoryCardSysCFi -GetSaveWorldMemory__14CMemoryCardSysCFi: +.global GetSaveWorldMemory__11CMemoryCardCFi +GetSaveWorldMemory__11CMemoryCardCFi: /* 80248F0C 00245E6C 94 21 FF C0 */ stwu r1, -0x40(r1) /* 80248F10 00245E70 7C 08 02 A6 */ mflr r0 /* 80248F14 00245E74 90 01 00 44 */ stw r0, 0x44(r1) @@ -154,8 +154,8 @@ lbl_80248FA0: /* 80248FB0 00245F10 38 21 00 40 */ addi r1, r1, 0x40 /* 80248FB4 00245F14 4E 80 00 20 */ blr -.global HasSaveWorldMemory__15CMemoryCardSysFi -HasSaveWorldMemory__15CMemoryCardSysFi: +.global HasSaveWorldMemory__11CMemoryCardFi +HasSaveWorldMemory__11CMemoryCardFi: /* 80248FB8 00245F18 94 21 FF C0 */ stwu r1, -0x40(r1) /* 80248FBC 00245F1C 7C 08 02 A6 */ mflr r0 /* 80248FC0 00245F20 90 01 00 44 */ stw r0, 0x44(r1) @@ -212,8 +212,8 @@ lbl_80249054: /* 80249084 00245FE4 38 21 00 40 */ addi r1, r1, 0x40 /* 80249088 00245FE8 4E 80 00 20 */ blr -.global InitializePump__14CMemoryCardSysFv -InitializePump__14CMemoryCardSysFv: +.global InitializePump__11CMemoryCardFv +InitializePump__11CMemoryCardFv: /* 8024908C 00245FEC 94 21 FF 80 */ stwu r1, -0x80(r1) /* 80249090 00245FF0 7C 08 02 A6 */ mflr r0 /* 80249094 00245FF4 90 01 00 84 */ stw r0, 0x84(r1) @@ -301,7 +301,7 @@ lbl_8024919C: /* 802491B4 00246114 41 82 03 28 */ beq lbl_802494DC /* 802491B8 00246118 80 9D 00 00 */ lwz r4, 0(r29) /* 802491BC 0024611C 7F 03 C3 78 */ mr r3, r24 -/* 802491C0 00246120 4B FF FD 4D */ bl GetSaveWorldMemory__14CMemoryCardSysCFi +/* 802491C0 00246120 4B FF FD 4D */ bl GetSaveWorldMemory__11CMemoryCardCFi /* 802491C4 00246124 7C 7F 1B 78 */ mr r31, r3 /* 802491C8 00246128 80 63 00 04 */ lwz r3, 4(r3) /* 802491CC 0024612C 3C 03 00 01 */ addis r0, r3, 1 @@ -1184,8 +1184,8 @@ lbl_80249DDC: /* 80249DFC 00246D5C 38 21 00 40 */ addi r1, r1, 0x40 /* 80249E00 00246D60 4E 80 00 20 */ blr -.global __dt__14CMemoryCardSysFv -__dt__14CMemoryCardSysFv: +.global __dt__11CMemoryCardFv +__dt__11CMemoryCardFv: /* 80249E04 00246D64 94 21 FF E0 */ stwu r1, -0x20(r1) /* 80249E08 00246D68 7C 08 02 A6 */ mflr r0 /* 80249E0C 00246D6C 90 01 00 24 */ stw r0, 0x24(r1) @@ -1490,8 +1490,8 @@ lbl_8024A1F0: /* 8024A204 00247164 38 21 00 10 */ addi r1, r1, 0x10 /* 8024A208 00247168 4E 80 00 20 */ blr -.global __ct__14CMemoryCardSysFv -__ct__14CMemoryCardSysFv: +.global __ct__11CMemoryCardFv +__ct__11CMemoryCardFv: /* 8024A20C 0024716C 94 21 FE B0 */ stwu r1, -0x150(r1) /* 8024A210 00247170 7C 08 02 A6 */ mflr r0 /* 8024A214 00247174 3C A0 80 3D */ lis r5, lbl_803D4780@ha diff --git a/asm/MetroidPrime/Tweaks/CTweaks.s b/asm/MetroidPrime/Tweaks/CTweaks.s index 9fae70e6..b441e05d 100644 --- a/asm/MetroidPrime/Tweaks/CTweaks.s +++ b/asm/MetroidPrime/Tweaks/CTweaks.s @@ -1395,8 +1395,8 @@ lbl_80036B94: /* 80036BA8 00033B08 38 21 01 50 */ addi r1, r1, 0x150 /* 80036BAC 00033B0C 4E 80 00 20 */ blr -.global sub_80036bb0 -sub_80036bb0: +.global __dt__7CTweaksFv +__dt__7CTweaksFv: /* 80036BB0 00033B10 94 21 FF E0 */ stwu r1, -0x20(r1) /* 80036BB4 00033B14 7C 08 02 A6 */ mflr r0 /* 80036BB8 00033B18 90 01 00 24 */ stw r0, 0x24(r1) diff --git a/asm/MetroidPrime/main.s b/asm/MetroidPrime/main.s index 0ecc7dce..4026cf5b 100644 --- a/asm/MetroidPrime/main.s +++ b/asm/MetroidPrime/main.s @@ -3506,7 +3506,7 @@ lbl_800058F8: /* 800058FC 0000285C 41 82 00 10 */ beq lbl_8000590C /* 80005900 00002860 80 7E 01 38 */ lwz r3, 0x138(r30) /* 80005904 00002864 38 80 00 01 */ li r4, 1 -/* 80005908 00002868 48 24 44 FD */ bl __dt__14CMemoryCardSysFv +/* 80005908 00002868 48 24 44 FD */ bl __dt__11CMemoryCardFv lbl_8000590C: /* 8000590C 0000286C 38 7E 01 34 */ addi r3, r30, 0x134 /* 80005910 00002870 38 80 FF FF */ li r4, -1 @@ -5063,19 +5063,19 @@ MemoryCardInitializePump__5CMainFv: /* 80006688 000035E8 48 30 F1 E5 */ bl __nw__FUlPCcPCc /* 8000668C 000035EC 7C 7E 1B 79 */ or. r30, r3, r3 /* 80006690 000035F0 41 82 00 0C */ beq lbl_8000669C -/* 80006694 000035F4 48 24 3B 79 */ bl __ct__14CMemoryCardSysFv +/* 80006694 000035F4 48 24 3B 79 */ bl __ct__11CMemoryCardFv /* 80006698 000035F8 7C 7E 1B 78 */ mr r30, r3 lbl_8000669C: /* 8000669C 000035FC 83 FD 01 28 */ lwz r31, 0x128(r29) /* 800066A0 00003600 38 80 00 01 */ li r4, 1 /* 800066A4 00003604 80 7F 01 38 */ lwz r3, 0x138(r31) -/* 800066A8 00003608 48 24 37 5D */ bl __dt__14CMemoryCardSysFv +/* 800066A8 00003608 48 24 37 5D */ bl __dt__11CMemoryCardFv /* 800066AC 0000360C 93 DF 01 38 */ stw r30, 0x138(r31) lbl_800066B0: /* 800066B0 00003610 80 7D 01 28 */ lwz r3, 0x128(r29) /* 800066B4 00003614 83 C3 01 38 */ lwz r30, 0x138(r3) /* 800066B8 00003618 7F C3 F3 78 */ mr r3, r30 -/* 800066BC 0000361C 48 24 29 D1 */ bl InitializePump__14CMemoryCardSysFv +/* 800066BC 0000361C 48 24 29 D1 */ bl InitializePump__11CMemoryCardFv /* 800066C0 00003620 54 60 06 3F */ clrlwi. r0, r3, 0x18 /* 800066C4 00003624 41 82 00 10 */ beq lbl_800066D4 /* 800066C8 00003628 93 CD A0 84 */ stw r30, gpMemoryCard@sda21(r13) @@ -6269,8 +6269,8 @@ lbl_8000775C: /* 80007784 000046E4 38 21 00 20 */ addi r1, r1, 0x20 /* 80007788 000046E8 4E 80 00 20 */ blr -.global sub_8000778c -sub_8000778c: +.global LoadDefaultFont__18CGameGlobalObjectsFv +LoadDefaultFont__18CGameGlobalObjectsFv: /* 8000778C 000046EC 94 21 FF 60 */ stwu r1, -0xa0(r1) /* 80007790 000046F0 7C 08 02 A6 */ mflr r0 /* 80007794 000046F4 3C 80 80 3D */ lis r4, lbl_803CBE74@ha @@ -6373,7 +6373,7 @@ lbl_800078D0: lbl_80007904: /* 80007904 00004864 3B C1 00 20 */ addi r30, r1, 0x20 /* 80007908 00004868 38 61 00 08 */ addi r3, r1, 8 -/* 8000790C 0000486C 48 00 01 21 */ bl "GetNewDerivedObject__35TObjOwnerDerivedFromIObj<8CTexture>FP8CTexture" +/* 8000790C 0000486C 48 00 01 21 */ bl "GetIObjObjectFor__17TToken<8CTexture>FP8CTexture" /* 80007910 00004870 38 00 00 00 */ li r0, 0 /* 80007914 00004874 80 81 00 0C */ lwz r4, 0xc(r1) /* 80007918 00004878 98 01 00 08 */ stb r0, 8(r1) @@ -6453,8 +6453,8 @@ lbl_80007A10: /* 80007A24 00004984 38 21 00 10 */ addi r1, r1, 0x10 /* 80007A28 00004988 4E 80 00 20 */ blr -.global "GetNewDerivedObject__35TObjOwnerDerivedFromIObj<8CTexture>FP8CTexture" -"GetNewDerivedObject__35TObjOwnerDerivedFromIObj<8CTexture>FP8CTexture": +.global "GetIObjObjectFor__17TToken<8CTexture>FP8CTexture" +"GetIObjObjectFor__17TToken<8CTexture>FP8CTexture": /* 80007A2C 0000498C 94 21 FF F0 */ stwu r1, -0x10(r1) /* 80007A30 00004990 7C 08 02 A6 */ mflr r0 /* 80007A34 00004994 3C A0 80 3D */ lis r5, lbl_803CBE74@ha @@ -6504,7 +6504,7 @@ __ct__18CGameGlobalObjectsFR10COsContextR10CMemorySys: /* 80007AD4 00004A34 7C BE 2B 78 */ mr r30, r5 /* 80007AD8 00004A38 93 A1 00 14 */ stw r29, 0x14(r1) /* 80007ADC 00004A3C 7C 9D 23 78 */ mr r29, r4 -/* 80007AE0 00004A40 48 34 69 E1 */ bl Initialize__14CMemoryCardSysFv +/* 80007AE0 00004A40 48 34 69 E1 */ bl __ct__14CMemoryCardSysFv /* 80007AE4 00004A44 38 7F 00 04 */ addi r3, r31, 4 /* 80007AE8 00004A48 48 33 2C 09 */ bl __ct__11CResFactoryFv /* 80007AEC 00004A4C 38 7F 00 CC */ addi r3, r31, 0xcc @@ -6549,11 +6549,11 @@ lbl_80007B4C: /* 80007B84 00004AE4 7C 60 1B 78 */ mr r0, r3 lbl_80007B88: /* 80007B88 00004AE8 90 1F 01 50 */ stw r0, 0x150(r31) -/* 80007B8C 00004AEC 4B FF FC 01 */ bl sub_8000778c +/* 80007B8C 00004AEC 4B FF FC 01 */ bl LoadDefaultFont__18CGameGlobalObjectsFv /* 80007B90 00004AF0 7C 64 1B 78 */ mr r4, r3 /* 80007B94 00004AF4 3B BF 01 54 */ addi r29, r31, 0x154 /* 80007B98 00004AF8 38 61 00 08 */ addi r3, r1, 8 -/* 80007B9C 00004AFC 48 00 02 3D */ bl sub_80007dd8 +/* 80007B9C 00004AFC 48 00 02 3D */ bl "GetIObjObjectFor__21TToken<11CRasterFont>FP11CRasterFont" /* 80007BA0 00004B00 38 00 00 00 */ li r0, 0 /* 80007BA4 00004B04 80 81 00 0C */ lwz r4, 0xc(r1) /* 80007BA8 00004B08 98 01 00 08 */ stb r0, 8(r1) @@ -6717,8 +6717,8 @@ lbl_80007DBC: /* 80007DD0 00004D30 38 21 00 30 */ addi r1, r1, 0x30 /* 80007DD4 00004D34 4E 80 00 20 */ blr -.global sub_80007dd8 -sub_80007dd8: +.global "GetIObjObjectFor__21TToken<11CRasterFont>FP11CRasterFont" +"GetIObjObjectFor__21TToken<11CRasterFont>FP11CRasterFont": /* 80007DD8 00004D38 94 21 FF F0 */ stwu r1, -0x10(r1) /* 80007DDC 00004D3C 7C 08 02 A6 */ mflr r0 /* 80007DE0 00004D40 3C A0 80 3D */ lis r5, lbl_803CBE74@ha @@ -6762,7 +6762,7 @@ ShutdownSubsystems__5CMainFv: /* 80007E68 00004DC8 94 21 FF F0 */ stwu r1, -0x10(r1) /* 80007E6C 00004DCC 7C 08 02 A6 */ mflr r0 /* 80007E70 00004DD0 90 01 00 14 */ stw r0, 0x14(r1) -/* 80007E74 00004DD4 48 36 4E E5 */ bl sub_8036cd58 +/* 80007E74 00004DD4 48 36 4E E5 */ bl ShutDown__19CFrameDelayedKillerFv /* 80007E78 00004DD8 48 10 F9 8D */ bl ShutDown__13CDecalManagerFv /* 80007E7C 00004DDC 48 31 72 E1 */ bl ShutDown__11CElementGenFv /* 80007E80 00004DE0 48 02 62 E9 */ bl FreeCache__9CAnimDataFv @@ -6815,10 +6815,10 @@ InitializeSubsystems__5CMainFv: /* 80007F28 00004E88 3C 60 00 60 */ lis r3, 0x005FC000@ha /* 80007F2C 00004E8C 38 63 C0 00 */ addi r3, r3, 0x005FC000@l /* 80007F30 00004E90 48 36 5A E5 */ bl ARAlloc -/* 80007F34 00004E94 80 6D 9D 60 */ lwz r3, lbl_805A8920@sda21(r13) +/* 80007F34 00004E94 80 6D 9D 60 */ lwz r3, mPreInitializeAlloc__12CARAMManager@sda21(r13) /* 80007F38 00004E98 3C 63 00 60 */ addis r3, r3, 0x60 /* 80007F3C 00004E9C 38 03 C0 00 */ addi r0, r3, -16384 -/* 80007F40 00004EA0 90 0D 9D 60 */ stw r0, lbl_805A8920@sda21(r13) +/* 80007F40 00004EA0 90 0D 9D 60 */ stw r0, mPreInitializeAlloc__12CARAMManager@sda21(r13) /* 80007F44 00004EA4 48 36 76 BD */ bl ARQInit /* 80007F48 00004EA8 48 37 C6 8D */ bl OSGetCurrentThread /* 80007F4C 00004EAC 3C 80 80 3D */ lis r4, lbl_803CBE74@ha @@ -6884,7 +6884,7 @@ lbl_80008000: /* 80008028 00004F88 38 60 08 00 */ li r3, 0x800 /* 8000802C 00004F8C 48 33 CC E9 */ bl Initialize__12CARAMManagerFUi /* 80008030 00004F90 48 10 F9 25 */ bl Initialize__13CDecalManagerFv -/* 80008034 00004F94 48 36 4D 45 */ bl sub_8036cd78 +/* 80008034 00004F94 48 36 4D 45 */ bl Initialize__19CFrameDelayedKillerFv /* 80008038 00004F98 80 01 00 24 */ lwz r0, 0x24(r1) /* 8000803C 00004F9C 83 E1 00 1C */ lwz r31, 0x1c(r1) /* 80008040 00004FA0 83 C1 00 18 */ lwz r30, 0x18(r1) @@ -6993,14 +6993,14 @@ lbl_80008190: lbl_80008198: /* 80008198 000050F8 38 7E 00 70 */ addi r3, r30, 0x70 /* 8000819C 000050FC 38 80 FF FF */ li r4, -1 -/* 800081A0 00005100 48 02 EA 11 */ bl sub_80036bb0 +/* 800081A0 00005100 48 02 EA 11 */ bl __dt__7CTweaksFv /* 800081A4 00005104 34 1E 00 6E */ addic. r0, r30, 0x6e /* 800081A8 00005108 41 82 00 18 */ beq lbl_800081C0 -/* 800081AC 0000510C 88 0D A7 70 */ lbz r0, lbl_805A9330@sda21(r13) +/* 800081AC 0000510C 88 0D A7 70 */ lbz r0, mManagerInstalled__14CDvdRequestSys@sda21(r13) /* 800081B0 00005110 28 00 00 01 */ cmplwi r0, 1 /* 800081B4 00005114 40 82 00 0C */ bne lbl_800081C0 /* 800081B8 00005118 38 00 00 00 */ li r0, 0 -/* 800081BC 0000511C 98 0D A7 70 */ stb r0, lbl_805A9330@sda21(r13) +/* 800081BC 0000511C 98 0D A7 70 */ stb r0, mManagerInstalled__14CDvdRequestSys@sda21(r13) lbl_800081C0: /* 800081C0 00005120 38 7E 00 6D */ addi r3, r30, 0x6d /* 800081C4 00005124 38 80 FF FF */ li r4, -1 @@ -7043,11 +7043,11 @@ __ct__5CMainFv: /* 80008248 000051A8 7F C5 F3 78 */ mr r5, r30 /* 8000824C 000051AC 38 7F 00 6D */ addi r3, r31, 0x6d /* 80008250 000051B0 48 30 D9 B5 */ bl __ct__10CMemorySysFR10COsContextR10IAllocator -/* 80008254 000051B4 88 0D A7 70 */ lbz r0, lbl_805A9330@sda21(r13) +/* 80008254 000051B4 88 0D A7 70 */ lbz r0, mManagerInstalled__14CDvdRequestSys@sda21(r13) /* 80008258 000051B8 28 00 00 01 */ cmplwi r0, 1 /* 8000825C 000051BC 41 82 00 0C */ beq lbl_80008268 /* 80008260 000051C0 38 00 00 01 */ li r0, 1 -/* 80008264 000051C4 98 0D A7 70 */ stb r0, lbl_805A9330@sda21(r13) +/* 80008264 000051C4 98 0D A7 70 */ stb r0, mManagerInstalled__14CDvdRequestSys@sda21(r13) lbl_80008268: /* 80008268 000051C8 38 7F 00 70 */ addi r3, r31, 0x70 /* 8000826C 000051CC 48 02 EA 35 */ bl __ct__7CTweaksFv diff --git a/include/GuiSys/CGuiSys.hpp b/include/GuiSys/CGuiSys.hpp new file mode 100644 index 00000000..976a5fc8 --- /dev/null +++ b/include/GuiSys/CGuiSys.hpp @@ -0,0 +1,23 @@ +#ifndef _CGUISYS_HPP +#define _CGUISYS_HPP + +#include "types.h" + +class IFactory; +class CSimplePool; + +class CGuiSys { +public: + enum EUsageMode { + kUM_Zero, + kUM_One, + kUM_Two, + }; + + CGuiSys(IFactory*, CSimplePool*, EUsageMode); + +private: + u8 pad[0x14]; +}; + +#endif \ No newline at end of file diff --git a/include/Kyoto/Alloc/CMemory.hpp b/include/Kyoto/Alloc/CMemory.hpp index 3dfbbbd3..ae9b64a4 100644 --- a/include/Kyoto/Alloc/CMemory.hpp +++ b/include/Kyoto/Alloc/CMemory.hpp @@ -11,14 +11,10 @@ void Free(const void* ptr); void* operator new(unsigned long sz, const char*, const char*); void* operator new[](unsigned long sz, const char*, const char*); inline void* operator new(unsigned long sz) { - const char* fileAndLineNo = "??(??)"; - const char* type = nullptr; - return operator new(sz, fileAndLineNo, type); + return operator new(sz, "??(??)", nullptr); } inline void* operator new[](unsigned long sz) { - const char* fileAndLineNo = "??(??)"; - const char* type = nullptr; - return operator new[](sz, fileAndLineNo, type); + return operator new[](sz, "??(??)", nullptr); } // placement new inline void* operator new(unsigned long n, void* ptr) { return ptr; }; diff --git a/include/Kyoto/Animation/CSkinnedModel.hpp b/include/Kyoto/Animation/CSkinnedModel.hpp new file mode 100644 index 00000000..5c59a15c --- /dev/null +++ b/include/Kyoto/Animation/CSkinnedModel.hpp @@ -0,0 +1,14 @@ +#ifndef _CSKINNEDMODEL_HPP +#define _CSKINNEDMODEL_HPP + +#include "types.h" + +class CSkinnedModel { +public: + static void ClearPointGeneratorFunc(); + +private: + // TODO +}; + +#endif \ No newline at end of file diff --git a/include/Kyoto/Audio/CAudioSys.hpp b/include/Kyoto/Audio/CAudioSys.hpp index ee9c0b91..1bf3e336 100644 --- a/include/Kyoto/Audio/CAudioSys.hpp +++ b/include/Kyoto/Audio/CAudioSys.hpp @@ -3,8 +3,27 @@ #include "types.h" +enum ETRKSampleRate { + kTSR_Zero, + kTSR_One, + // TODO +}; + +enum ETRKRepeatMode { + // TODO +}; + class CAudioSys { public: + CAudioSys(u8, u8, u8, u8, uint); + + static void SysSetVolume(u8, uint, u8); + static void SetDefaultVolumeScale(s16); + static void SetVolumeScale(s16); + static void TrkSetSampleRate(ETRKSampleRate); + + static s16 GetDefaultVolumeScale(); + static const u8 kMaxVolume; }; diff --git a/include/Kyoto/Audio/CDSPStreamManager.hpp b/include/Kyoto/Audio/CDSPStreamManager.hpp new file mode 100644 index 00000000..5241c7c0 --- /dev/null +++ b/include/Kyoto/Audio/CDSPStreamManager.hpp @@ -0,0 +1,11 @@ +#ifndef _CDSPSTREAMMANAGER_HPP +#define _CDSPSTREAMMANAGER_HPP + +#include "types.h" + +class CDSPStreamManager { +public: + static void Initialize(); +}; + +#endif \ No newline at end of file diff --git a/include/Kyoto/Audio/CStreamAudioManager.hpp b/include/Kyoto/Audio/CStreamAudioManager.hpp index 9de4a27e..5d6d2def 100644 --- a/include/Kyoto/Audio/CStreamAudioManager.hpp +++ b/include/Kyoto/Audio/CStreamAudioManager.hpp @@ -7,6 +7,7 @@ class CStreamAudioManager { public: static void Update(f32 dt); static void StopAll(); + static void SetMusicVolume(u8); private: }; diff --git a/include/Kyoto/Basics/CCast.hpp b/include/Kyoto/Basics/CCast.hpp index e602f2d2..fc1e4b31 100644 --- a/include/Kyoto/Basics/CCast.hpp +++ b/include/Kyoto/Basics/CCast.hpp @@ -2,7 +2,8 @@ #define __CCAST_HPP__ #include "types.h" -#include "Dolphin/os/OSFastCast.h" + +#include "dolphin/os/OSFastCast.h" namespace CCast { #ifdef __MWERKS__ diff --git a/include/Kyoto/Basics/COsContext.hpp b/include/Kyoto/Basics/COsContext.hpp index ada9a6ce..b821e482 100644 --- a/include/Kyoto/Basics/COsContext.hpp +++ b/include/Kyoto/Basics/COsContext.hpp @@ -7,6 +7,9 @@ class COsContext { public: + COsContext(bool, bool); + ~COsContext(); + private: int x0_right; int x4_bottom; @@ -22,5 +25,6 @@ private: int x2c_frameBufferSize; GXRenderModeObj x30_renderMode; }; +CHECK_SIZEOF(COsContext, 0x6c) #endif diff --git a/include/Kyoto/Basics/CStopwatch.hpp b/include/Kyoto/Basics/CStopwatch.hpp index 9e1ccdac..4f9580e5 100644 --- a/include/Kyoto/Basics/CStopwatch.hpp +++ b/include/Kyoto/Basics/CStopwatch.hpp @@ -3,7 +3,7 @@ #include "types.h" -#include "Dolphin/os.h" +#include "dolphin/os.h" class CStopwatch { public: diff --git a/include/Kyoto/CARAMManager.hpp b/include/Kyoto/CARAMManager.hpp index 2a06c9d8..c23081c8 100644 --- a/include/Kyoto/CARAMManager.hpp +++ b/include/Kyoto/CARAMManager.hpp @@ -7,6 +7,13 @@ class CARAMManager { public: static void Shutdown(); static void CollectGarbage(); + static void PreInitializeAlloc(uint size) { + mPreInitializeAlloc += size; + } + static void Initialize(uint); + +private: + static u32 mPreInitializeAlloc; }; #endif diff --git a/include/Kyoto/CFrameDelayedKiller.hpp b/include/Kyoto/CFrameDelayedKiller.hpp new file mode 100644 index 00000000..d9f7e0f1 --- /dev/null +++ b/include/Kyoto/CFrameDelayedKiller.hpp @@ -0,0 +1,12 @@ +#ifndef _CFRAMEDELAYEDKILLER_HPP +#define _CFRAMEDELAYEDKILLER_HPP + +#include "types.h" + +class CFrameDelayedKiller { +public: + static void Initialize(); + static void ShutDown(); +}; + +#endif \ No newline at end of file diff --git a/include/Kyoto/CMemoryCardSys.hpp b/include/Kyoto/CMemoryCardSys.hpp index dea91aa6..6c3fdc5d 100644 --- a/include/Kyoto/CMemoryCardSys.hpp +++ b/include/Kyoto/CMemoryCardSys.hpp @@ -5,12 +5,13 @@ class CMemoryCardSys { public: + CMemoryCardSys(); ~CMemoryCardSys(); + void Initialize(); + private: // TODO }; -extern CMemoryCardSys* gpMemoryCard; - #endif diff --git a/include/Kyoto/CMemorySys.hpp b/include/Kyoto/CMemorySys.hpp index 720abe9c..a925a229 100644 --- a/include/Kyoto/CMemorySys.hpp +++ b/include/Kyoto/CMemorySys.hpp @@ -3,8 +3,16 @@ #include "types.h" +#include "Kyoto/Alloc/CMemory.hpp" +#include "Kyoto/Alloc/IAllocator.hpp" + class CMemorySys { public: + CMemorySys(COsContext&, IAllocator&); + ~CMemorySys(); + + static IAllocator& GetGameAllocator(); + private: u8 x0_unk; }; diff --git a/include/Kyoto/CResFactory.hpp b/include/Kyoto/CResFactory.hpp index 4375f23d..1d81509f 100644 --- a/include/Kyoto/CResFactory.hpp +++ b/include/Kyoto/CResFactory.hpp @@ -8,8 +8,13 @@ #include "Kyoto/CFactoryMgr.hpp" #include "Kyoto/CResLoader.hpp" -class CResFactory { +class IFactory { + // TODO +}; + +class CResFactory : public IFactory { public: + CResFactory(); virtual ~CResFactory() {} void AsyncIdle(uint time); @@ -28,6 +33,7 @@ private: uint xac_; rstl::list< void > xb0_; }; +CHECK_SIZEOF(CResFactory, 0xc8); extern CResFactory* gpResourceFactory; diff --git a/include/Kyoto/CSimplePool.hpp b/include/Kyoto/CSimplePool.hpp index c08ad1d9..5212476a 100644 --- a/include/Kyoto/CSimplePool.hpp +++ b/include/Kyoto/CSimplePool.hpp @@ -3,13 +3,18 @@ #include "types.h" -#include "rstl/map.hpp" +#include "rstl/hash_map.hpp" +#include "rstl/rc_ptr.hpp" #include "Kyoto/CToken.hpp" #include "Kyoto/IObjectStore.hpp" -class CSimplePool { +class IFactory; + +class CSimplePool : public IObjectStore { public: + CSimplePool(IFactory& factory); + virtual CToken GetObj(const SObjectTag& tag, CVParamTransfer xfer); virtual CToken GetObj(const SObjectTag& tag); virtual CToken GetObj(const char* name); @@ -23,10 +28,11 @@ public: private: u8 x4_; u8 x5_; - rstl::map< unkptr, unkptr > x8_resources; + rstl::hash_map< unkptr, unkptr, void, void > x8_resources; unkptr x18_factory; - CVParamTransfer x1c_paramXfr; + rstl::rc_ptr< CVParamTransfer > x1c_paramXfr; }; +CHECK_SIZEOF(CSimplePool, 0x20) extern CSimplePool* gpSimplePool; diff --git a/include/Kyoto/CTimeProvider.hpp b/include/Kyoto/CTimeProvider.hpp new file mode 100644 index 00000000..5e247e1e --- /dev/null +++ b/include/Kyoto/CTimeProvider.hpp @@ -0,0 +1,15 @@ +#ifndef _CTIMEPROVIDER_HPP +#define _CTIMEPROVIDER_HPP + +#include "types.h" + +class CTimeProvider { +public: + CTimeProvider(const float& time); + ~CTimeProvider(); + +private: + u8 pad[0xc]; +}; + +#endif \ No newline at end of file diff --git a/include/Kyoto/CToken.hpp b/include/Kyoto/CToken.hpp index b2dfa94b..2119e2dd 100644 --- a/include/Kyoto/CToken.hpp +++ b/include/Kyoto/CToken.hpp @@ -3,15 +3,20 @@ #include "types.h" -#include "Kyoto/IObjectStore.hpp" +#include "Kyoto/IObj.hpp" + +class CObjectReference; class CToken { public: CToken() {} - CToken(IObj* obj) : x0_objRef(new CObjectReference(obj)), x4_lockHeld(false) {} + CToken(IObj* obj); // : x0_objRef(new CObjectReference(obj)), x4_lockHeld(false) {} CToken(const CToken& other); ~CToken(); + CToken& operator=(const CToken&); + + CObjOwnerDerivedFromIObjUntyped* GetObj(); void Lock(); private: diff --git a/include/Kyoto/Graphics/CGraphicsSys.hpp b/include/Kyoto/Graphics/CGraphicsSys.hpp index e484b83e..74cd1b2a 100644 --- a/include/Kyoto/Graphics/CGraphicsSys.hpp +++ b/include/Kyoto/Graphics/CGraphicsSys.hpp @@ -5,6 +5,7 @@ class CGraphicsSys { public: + CGraphicsSys(const COsContext& osContext, const CMemorySys& memorySys, uint, void*); ~CGraphicsSys(); private: diff --git a/include/Kyoto/Graphics/CModelFlags.hpp b/include/Kyoto/Graphics/CModelFlags.hpp index 93a7a8ed..fee02fa8 100644 --- a/include/Kyoto/Graphics/CModelFlags.hpp +++ b/include/Kyoto/Graphics/CModelFlags.hpp @@ -9,6 +9,7 @@ class CModelFlags { public: enum ETrans { kT_Opaque = 0, + kT_Two = 2, // ? kT_Blend = 5, kT_Additive = 7, }; @@ -31,6 +32,10 @@ public: CModelFlags(const CModelFlags& flags, bool b /* TODO what's this? */, int shaderSet) : x0_blendMode(flags.x0_blendMode), x1_matSetIdx(shaderSet), x2_flags(flags.x2_flags), x4_color(flags.x4_color) {} + // ? + CModelFlags(const CModelFlags& flags, ETrans trans, CColor color) + : x0_blendMode(trans), x1_matSetIdx(flags.x1_matSetIdx), x2_flags(flags.x2_flags), x4_color(color) {} + CModelFlags UseShaderSet(int matSet) { return CModelFlags(*this, false, matSet); } CModelFlags DontLoadTextures() { return CModelFlags(*this, GetOtherFlags() | kF_NoTextureLock); } CModelFlags DepthCompareUpdate(bool compare, bool update) { diff --git a/include/Kyoto/Graphics/CTexture.hpp b/include/Kyoto/Graphics/CTexture.hpp index 7b6c289b..6c088a2d 100644 --- a/include/Kyoto/Graphics/CTexture.hpp +++ b/include/Kyoto/Graphics/CTexture.hpp @@ -5,6 +5,8 @@ #include +class CInputStream; + class CTexture { public: enum EClampMode { @@ -12,10 +14,21 @@ public: Repeat, Mirror, }; + enum EAutoMipmap { + kAM_Zero, + }; + enum EBlackKey { + kBK_Zero, + }; + + CTexture(CInputStream& stream, EAutoMipmap mip, EBlackKey bk); void Load(GXTexMapID texMapId, EClampMode clampMode) const; static void InvalidateTexmap(GXTexMapID id); + +private: + u8 pad[0x68]; }; #endif \ No newline at end of file diff --git a/include/Kyoto/IObj.hpp b/include/Kyoto/IObj.hpp index 3905ed48..d49b8164 100644 --- a/include/Kyoto/IObj.hpp +++ b/include/Kyoto/IObj.hpp @@ -17,22 +17,28 @@ public: template < typename T > CObjOwnerDerivedFromIObjUntyped(const rstl::auto_ptr< T >& obj) : m_objPtr(obj.release()) {} + void* GetContents() { return m_objPtr; } + protected: void* m_objPtr; }; template < typename T > class TObjOwnerDerivedFromIObj : public CObjOwnerDerivedFromIObjUntyped { - TObjOwnerDerivedFromIObj(T* obj) : CObjOwnerDerivedFromIObjUntyped(obj) {} - TObjOwnerDerivedFromIObj(const rstl::auto_ptr< T >& obj) : CObjOwnerDerivedFromIObjUntyped(obj) {} - public: - static rstl::auto_ptr< TObjOwnerDerivedFromIObj< T > > GetNewDerivedObject(T* obj) { return new TObjOwnerDerivedFromIObj< T >(obj); } - static rstl::auto_ptr< TObjOwnerDerivedFromIObj< T > > GetNewDerivedObject(const rstl::auto_ptr< T >& obj) { - return new TObjOwnerDerivedFromIObj< T >(obj); - } ~TObjOwnerDerivedFromIObj() override { delete Owned(); } T* Owned() { return static_cast< T* >(m_objPtr); } + + static inline rstl::auto_ptr< TObjOwnerDerivedFromIObj< T > > GetNewDerivedObject(T* obj) { + return new TObjOwnerDerivedFromIObj< T >(obj); + } + static inline rstl::auto_ptr< TObjOwnerDerivedFromIObj< T > > GetNewDerivedObject(const rstl::auto_ptr< T >& obj) { + return new TObjOwnerDerivedFromIObj< T >(obj); + } + +private: + TObjOwnerDerivedFromIObj(T* obj) : CObjOwnerDerivedFromIObjUntyped(obj) {} + TObjOwnerDerivedFromIObj(const rstl::auto_ptr< T >& obj) : CObjOwnerDerivedFromIObjUntyped(obj) {} }; #endif \ No newline at end of file diff --git a/include/Kyoto/IObjectStore.hpp b/include/Kyoto/IObjectStore.hpp index a274f4ce..778efd24 100644 --- a/include/Kyoto/IObjectStore.hpp +++ b/include/Kyoto/IObjectStore.hpp @@ -51,4 +51,17 @@ private: CVParamTransfer x14_params; }; +class IObjectStore { +public: + virtual CToken GetObj(const SObjectTag& tag, CVParamTransfer xfer) = 0; + virtual CToken GetObj(const SObjectTag& tag) = 0; + virtual CToken GetObj(const char* name) = 0; + virtual CToken GetObj(const char* name, CVParamTransfer xfer) = 0; + virtual bool HasObject(const SObjectTag& tag) = 0; + virtual bool ObjectIsLive(const SObjectTag& tag) = 0; + virtual unkptr GetFactory() = 0; + virtual void Flush() = 0; + virtual void ObjectUnreferenced(const SObjectTag& tag) = 0; +}; + #endif diff --git a/include/Kyoto/Math/CMath.hpp b/include/Kyoto/Math/CMath.hpp index 23409a3e..3a53422b 100644 --- a/include/Kyoto/Math/CMath.hpp +++ b/include/Kyoto/Math/CMath.hpp @@ -8,9 +8,12 @@ public: static f32 FastCosR(f32 v); static f32 FastSinR(f32 v); static inline f32 FastFmod(f32 x, f32 y) { - int v = static_cast(x * (1.f / y)); + int v = static_cast< int >(x * (1.f / y)); return x - v * y; } + template < typename T > + static const T& Clamp(const T& min, const T& val, const T& max); + // ClampRadians__5CMathFf }; #endif \ No newline at end of file diff --git a/include/Kyoto/Particles/CElementGen.hpp b/include/Kyoto/Particles/CElementGen.hpp new file mode 100644 index 00000000..96d49571 --- /dev/null +++ b/include/Kyoto/Particles/CElementGen.hpp @@ -0,0 +1,12 @@ +#ifndef _CELEMENTGEN_HPP +#define _CELEMENTGEN_HPP + +#include "types.h" + +class CElementGen { +public: + static void Initialize(); + static void ShutDown(); +}; + +#endif \ No newline at end of file diff --git a/include/Kyoto/Streams/CZipInputStream.hpp b/include/Kyoto/Streams/CZipInputStream.hpp new file mode 100644 index 00000000..65cda12a --- /dev/null +++ b/include/Kyoto/Streams/CZipInputStream.hpp @@ -0,0 +1,22 @@ +#ifndef _CZIPINPUTSTREAM_HPP +#define _CZIPINPUTSTREAM_HPP + +#include "types.h" + +#include "Kyoto/Streams/CInputStream.hpp" + +#include "rstl/auto_ptr.hpp" + +class CZipInputStream : public CInputStream { +public: + CZipInputStream(rstl::auto_ptr< CInputStream > in); + ~CZipInputStream() override; + uint Read(void* dest, uint len) override; + +private: + u8* x24_compBuf; + rstl::auto_ptr< CInputStream > x28_stream; + unkptr x30_zstream; +}; + +#endif \ No newline at end of file diff --git a/include/Kyoto/TReservedAverage.hpp b/include/Kyoto/TReservedAverage.hpp index 9a51bdc4..1053f463 100644 --- a/include/Kyoto/TReservedAverage.hpp +++ b/include/Kyoto/TReservedAverage.hpp @@ -9,6 +9,7 @@ template < typename T, int N > class TReservedAverage : rstl::reserved_vector< T, N > { public: + TReservedAverage() {} TReservedAverage(const T& value) { // resize(value, N); TODO } diff --git a/include/Kyoto/TToken.hpp b/include/Kyoto/TToken.hpp index 67f1d504..2b7d5f90 100644 --- a/include/Kyoto/TToken.hpp +++ b/include/Kyoto/TToken.hpp @@ -17,10 +17,13 @@ public: TToken(T* obj) : CToken(GetIObjObjectFor(obj).release()) {} TToken(const rstl::auto_ptr< T >& obj) : CToken(GetIObjObjectFor(obj).release()) {} - static rstl::auto_ptr< TObjOwnerDerivedFromIObj< T > > GetIObjObjectFor(T* obj) { + T* GetT() { return reinterpret_cast< T* >(CToken::GetObj()->GetContents()); } + T* operator*() { return GetT(); } + + static inline rstl::auto_ptr< TObjOwnerDerivedFromIObj< T > > GetIObjObjectFor(T* obj) { return TObjOwnerDerivedFromIObj< T >::GetNewDerivedObject(obj); } - static rstl::auto_ptr< TObjOwnerDerivedFromIObj< T > > GetIObjObjectFor(const rstl::auto_ptr< T >& obj) { + static inline rstl::auto_ptr< TObjOwnerDerivedFromIObj< T > > GetIObjObjectFor(const rstl::auto_ptr< T >& obj) { return TObjOwnerDerivedFromIObj< T >::GetNewDerivedObject(obj); } }; @@ -29,23 +32,33 @@ template < typename T > class TCachedToken : public TToken< T > { public: TCachedToken() {} - TCachedToken(const CToken& token) : TToken< T >(token), x8_item(nullptr) {} + TCachedToken(const CToken& token) : TToken< T >(token), x8_item(GetT()) {} - // TODO - operator const TToken< T >&() const; + T* operator*() { return x8_item; } private: T* x8_item; }; template < typename T > -class TLockedToken : public TCachedToken< T > { +class TLockedToken { public: TLockedToken() {} - TLockedToken(const CToken& token) : TCachedToken< T >(token) { this->Lock(); } + TLockedToken(const CToken& token) : x0_token(token), x8_item(*x0_token) {} + TLockedToken(const TLockedToken< T >& token) : x0_token(token), x8_item(*token) { x0_token.Lock(); } - // TODO - operator const TToken< T >&() const; + TLockedToken& operator=(const TLockedToken< T >& token) { + x0_token = token; + x8_item = *token; + return *this; + } + + operator const TToken< T >&() const { return x0_token; } + T* operator*() const { return x8_item; } + +private: + TToken< T > x0_token; + T* x8_item; }; #endif \ No newline at end of file diff --git a/include/Kyoto/Text/CRasterFont.hpp b/include/Kyoto/Text/CRasterFont.hpp index 298dfd8d..504a6c82 100644 --- a/include/Kyoto/Text/CRasterFont.hpp +++ b/include/Kyoto/Text/CRasterFont.hpp @@ -3,6 +3,44 @@ #include "types.h" -class CRasterFont; +#include "rstl/pair.hpp" +#include "rstl/vector.hpp" + +class CGlyph; +class CKernPair; +class CTexture; + +class CFontInfo { +private: + bool x0_; + bool x1_; + int x4_; + int x8_fontSize; + char xc_name[64]; +}; + +class CRasterFont { +public: + CRasterFont(CInputStream&, IObjectStore*); + ~CRasterFont(); + + void SetTexture(TToken token) { + x7c_texture = token; + } + +private: + bool x0_initialized; + int x4_monoWidth; + int x8_monoHeight; + rstl::vector< rstl::pair< wchar_t, CGlyph > > xc_glyphs; + rstl::vector< CKernPair > x1c_kerning; + int mode; + CFontInfo x30_fontInfo; + TLockedToken< CTexture > x7c_texture; + int x88_; + int x8c_baseline; + int x90_lineMargin; +}; +CHECK_SIZEOF(CRasterFont, 0x94) #endif diff --git a/include/MetaRender/CCubeRenderer.hpp b/include/MetaRender/CCubeRenderer.hpp index 1d26fd50..382e037b 100644 --- a/include/MetaRender/CCubeRenderer.hpp +++ b/include/MetaRender/CCubeRenderer.hpp @@ -5,21 +5,14 @@ #include +#include "MetaRender/Renderer.hpp" + #include "Kyoto/Graphics/CColor.hpp" +#include "Kyoto/Math/CAABox.hpp" #include "Kyoto/Math/CTransform4f.hpp" #include "Kyoto/Math/CVector2f.hpp" #include "rstl/pair.hpp" -class IRenderer { -public: - enum EDrawableSorting { - kDS_SortedCallback, - kDS_UnsortedCallback, - }; - - // TODO vtable -}; - class CCubeRenderer { public: virtual ~CCubeRenderer(); diff --git a/include/MetaRender/Renderer.hpp b/include/MetaRender/Renderer.hpp new file mode 100644 index 00000000..b24d1b12 --- /dev/null +++ b/include/MetaRender/Renderer.hpp @@ -0,0 +1,25 @@ +#ifndef _RENDERER_HPP +#define _RENDERER_HPP + +#include "types.h" + +class IRenderer { +public: + enum EDrawableSorting { + kDS_SortedCallback, + kDS_UnsortedCallback, + }; + + virtual ~IRenderer(); + // TODO vtable +}; + +class COsContext; +class CMemorySys; +class CResFactory; + +namespace Renderer { +IRenderer* AllocateRenderer(IObjectStore&, COsContext&, CMemorySys&, CResFactory&); +}; + +#endif \ No newline at end of file diff --git a/include/MetroidPrime/CActor.hpp b/include/MetroidPrime/CActor.hpp index 478bf72d..59aa0dbd 100644 --- a/include/MetroidPrime/CActor.hpp +++ b/include/MetroidPrime/CActor.hpp @@ -244,10 +244,15 @@ public: void EnsureRendered(const CStateManager& mgr) const; void EnsureRendered(const CStateManager& mgr, const CVector3f& pos, const CAABox& bounds) const; void DrawTouchBounds() const; + bool IsModelOpaque(const CStateManager& mgr) const; + void RenderInternal(const CStateManager& mgr) const; const CTransform4f& GetTransform() const { return x34_transform; } CVector3f GetTranslation() const { return x34_transform.GetTranslation(); } + /// ???? + bool NullModel() const { return !GetAnimationData() && !GetModelData()->HasNormalModel(); } + bool HasModelData() const { return GetModelData() && (GetModelData()->HasAnimation() || GetModelData()->HasNormalModel()); } CModelData* ModelData() { return x64_modelData.get(); } const CModelData* GetModelData() const { return x64_modelData.get(); } @@ -256,7 +261,7 @@ public: CAnimData* AnimationData() { return ModelData()->AnimationData(); } const CAnimData* GetAnimationData() const { return GetModelData()->GetAnimationData(); } - bool HasShadow() const { return !x94_simpleShadow.null(); } + bool HasShadow() const { return GetShadow() != nullptr; } CSimpleShadow* Shadow() { return x94_simpleShadow.get(); } const CSimpleShadow* GetShadow() const { return x94_simpleShadow.get(); } diff --git a/include/MetroidPrime/CActorLights.hpp b/include/MetroidPrime/CActorLights.hpp index 7be78bc8..a154f04a 100644 --- a/include/MetroidPrime/CActorLights.hpp +++ b/include/MetroidPrime/CActorLights.hpp @@ -50,7 +50,7 @@ public: bool BuildAreaLightList(const CStateManager& mgr, const CGameArea& area, const CAABox& bounds); void BuildDynamicLightList(const CStateManager& mgr, const CAABox& bounds); - bool GetNeedsRelight() const { return x298_24_dirty; } + bool GetNeedsRelight() const { return x298_24_dirty == TRUE; } private: rstl::reserved_vector< CLight, 4 > x0_areaLights; diff --git a/include/MetroidPrime/CActorModelParticles.hpp b/include/MetroidPrime/CActorModelParticles.hpp index 38a17451..708e3258 100644 --- a/include/MetroidPrime/CActorModelParticles.hpp +++ b/include/MetroidPrime/CActorModelParticles.hpp @@ -3,7 +3,13 @@ #include "types.h" +class CActor; +class CStateManager; + class CActorModelParticles { +public: + void Render(const CStateManager& mgr, const CActor& actor) const; + private: // TODO }; diff --git a/include/MetroidPrime/CAnimData.hpp b/include/MetroidPrime/CAnimData.hpp index a976202b..b046fcae 100644 --- a/include/MetroidPrime/CAnimData.hpp +++ b/include/MetroidPrime/CAnimData.hpp @@ -12,6 +12,7 @@ #include "MetroidPrime/CPoseAsTransforms.hpp" #include "Kyoto/TToken.hpp" +#include "Kyoto/Animation/CSkinnedModel.hpp" #include "rstl/reserved_vector.hpp" @@ -56,6 +57,8 @@ public: return mSoundPOINodes.data(); } + CParticleDatabase& GetParticleDB() { return x120_particleDB; } + const CParticleDatabase& GetParticleDB() const { return x120_particleDB; } // SetIsAnimating__9CAnimDataFb // SetAnimDir__9CAnimDataFQ29CAnimData8EAnimDir // GetBoundingBox__9CAnimDataCFv @@ -113,7 +116,6 @@ public: // GetCharacterInfo__9CAnimDataCFv // GetCharLayoutInfo__9CAnimDataCFv - // GetParticleDB__9CAnimDataFv // GetDeltaRotation__9CAnimDataCFv // GetDeltaOffset__9CAnimDataCFv // IsDeltaOffsetInUse__9CAnimDataCFv @@ -130,7 +132,6 @@ public: // GetAnimationManager__9CAnimDataCFv // GetPoseValid__9CAnimDataCFv // GetPoseBuilderValid__9CAnimDataCFv - // GetParticleDB__9CAnimDataCFv // GetAnimSysContext__9CAnimDataCFv // CacheInt32PoiList__9CAnimDataFRC13CCharAnimTimeiRCQ24rstl25ncrc_ptr<13CAnimTreeNode> @@ -152,6 +153,9 @@ public: // CacheBoolPoiList__9CAnimDataFRCQ24rstl25ncrc_ptr<13CAnimTreeNode>RC13CCharAnimTimei // CacheInt32PoiList__9CAnimDataFRCQ24rstl25ncrc_ptr<13CAnimTreeNode>RC13CCharAnimTimei + static void InitializeCache(); + static void FreeCache(); + private: TLockedToken< CCharacterFactory > x0_charFactory; CCharacterInfo xc_charInfo; diff --git a/include/MetroidPrime/CDecalManager.hpp b/include/MetroidPrime/CDecalManager.hpp new file mode 100644 index 00000000..95296ae4 --- /dev/null +++ b/include/MetroidPrime/CDecalManager.hpp @@ -0,0 +1,12 @@ +#ifndef _CDECALMANAGER_HPP +#define _CDECALMANAGER_HPP + +#include "types.h" + +class CDecalManager { +public: + static void Initialize(); + static void ShutDown(); +}; + +#endif \ No newline at end of file diff --git a/include/MetroidPrime/CEnvFxManager.hpp b/include/MetroidPrime/CEnvFxManager.hpp index b2719a15..22d4f990 100644 --- a/include/MetroidPrime/CEnvFxManager.hpp +++ b/include/MetroidPrime/CEnvFxManager.hpp @@ -35,6 +35,9 @@ private: }; class CEnvFxManager { +public: + static void Initialize(); + private: CAABox x0_particleBounds; CVector3f x18_focusCellPosition; @@ -49,8 +52,8 @@ private: rstl::reserved_vector< CEnvFxManagerGrid, 64 > x50_grids; f32 xb54_baseSplashRate; TLockedToken< CGenDescription > xb58_envRainSplash; - bool xb64_ = true; - TUniqueId xb68_envRainSplashId = kInvalidUniqueId; + bool xb64_; + TUniqueId xb68_envRainSplashId; bool xb6a_rainSoundActive; CSfxHandle xb6c_leftRainSound; CSfxHandle xb70_rightRainSound; diff --git a/include/MetroidPrime/CGameArchitectureSupport.hpp b/include/MetroidPrime/CGameArchitectureSupport.hpp index e77d240e..baf16a6a 100644 --- a/include/MetroidPrime/CGameArchitectureSupport.hpp +++ b/include/MetroidPrime/CGameArchitectureSupport.hpp @@ -3,10 +3,20 @@ #include "types.h" +#include "GuiSys/CGuiSys.hpp" +#include "Kyoto/Audio/CAudioSys.hpp" #include "Kyoto/Basics/COsContext.hpp" #include "Kyoto/Basics/CStopwatch.hpp" #include "Kyoto/TOneStatic.hpp" #include "MetroidPrime/CIOWinManager.hpp" +#include "MetroidPrime/CInputGenerator.hpp" + +class CSavableState; + +class Unknown { +private: + u8 pad[0x2c]; +}; class CGameArchitectureSupport : public TOneStatic< CGameArchitectureSupport > { public: @@ -24,10 +34,26 @@ public: inline int& GetFramesDrawn() const { return *(int*)(((u8*)this) + 0x78); } private: - u8 pad[0x20]; + CAudioSys x0_audioSys; + rstl::list< CSavableState > x8_; + u32 pad; CStopwatch x20_stopwatch1; CStopwatch x28_stopwatch2; - u8 pad2[0xa0]; + CInputGenerator x30_inputGenerator; + CGuiSys x44_guiSys; + CIOWinManager x58_ioWinMgr; + uint x78_gameFrameCount; + f32 x7c_; + f32 x80_; + f32 x84_; + uint x88_; + uint x8c_; // unused? + uint x90_; + uint x94_; + uint x98_; + rstl::optional_object< Unknown > x9c_; + u8 pad2[0x4]; }; +CHECK_SIZEOF(CGameArchitectureSupport, 0xd0) #endif diff --git a/include/MetroidPrime/CGameGlobalObjects.hpp b/include/MetroidPrime/CGameGlobalObjects.hpp index 670dd0ac..cb8eb40b 100644 --- a/include/MetroidPrime/CGameGlobalObjects.hpp +++ b/include/MetroidPrime/CGameGlobalObjects.hpp @@ -13,23 +13,30 @@ #include "Kyoto/CSimplePool.hpp" #include "Kyoto/CToken.hpp" #include "Kyoto/Graphics/CGraphicsSys.hpp" -#include "Kyoto/Text/CRasterFont.hpp" #include "Kyoto/TOneStatic.hpp" +#include "Kyoto/Text/CRasterFont.hpp" #include "MetroidPrime/CInGameTweakManager.hpp" #include "MetroidPrime/Enemies/CAiFuncMap.hpp" #include "MetroidPrime/Factories/CCharacterFactoryBuilder.hpp" #include "MetroidPrime/Player/CGameState.hpp" +class IRenderer; +class CStringTable; + class CGameGlobalObjects : public TOneStatic< CGameGlobalObjects > { public: CGameGlobalObjects(COsContext&, CMemorySys&); void PostInitialize(COsContext&, CMemorySys&); + void AddPaksAndFactories(); + void LoadStringTable(); rstl::single_ptr< CGameState >& GameState() { return x134_gameState; } + static CRasterFont* LoadDefaultFont(); + private: - rstl::single_ptr< CMemoryCardSys > x0_memoryCardSys; + CMemoryCardSys x0_memoryCardSys; CResFactory x4_resFactory; CSimplePool xcc_simplePool; CCharacterFactoryBuilder xec_characterFactoryBuilder; @@ -37,11 +44,12 @@ private: CGraphicsSys x130_graphicsSys; rstl::single_ptr< CGameState > x134_gameState; uint x138_; - rstl::optional_object< TCachedToken< unkptr > > x13c_; - uint x14c_; + rstl::optional_object< TLockedToken< CStringTable > > x13c_stringTable; + rstl::single_ptr< IRenderer > x14c_renderer; rstl::single_ptr< CInGameTweakManager > x150_inGameTweakManager; TToken< CRasterFont > x154_defaultFont; }; +CHECK_SIZEOF(CGameGlobalObjects, 0x15c) // TODO move to related headers extern unkptr gGuiSystem; diff --git a/include/MetroidPrime/CIOWin.hpp b/include/MetroidPrime/CIOWin.hpp new file mode 100644 index 00000000..e1bd1999 --- /dev/null +++ b/include/MetroidPrime/CIOWin.hpp @@ -0,0 +1,30 @@ +#ifndef _CIOWIN_HPP +#define _CIOWIN_HPP + +#include "types.h" + +#include "rstl/string.hpp" + +class CArchitectureMessage; +class CArchitectureQueue; + +class CIOWin { +public: + enum EMessageReturn { + kMR_Normal = 0, + kMR_Exit = 1, + kMR_RemoveIOWinAndExit = 2, + kMR_RemoveIOWin = 3, + }; + + virtual ~CIOWin(); + virtual EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&) = 0; + virtual bool GetIsContinueDraw() const; + virtual void Draw(); + virtual void PreDraw(); + +private: + rstl::string x4_name; +}; + +#endif \ No newline at end of file diff --git a/include/MetroidPrime/CIOWinManager.hpp b/include/MetroidPrime/CIOWinManager.hpp index d4045870..e890a34a 100644 --- a/include/MetroidPrime/CIOWinManager.hpp +++ b/include/MetroidPrime/CIOWinManager.hpp @@ -4,10 +4,16 @@ #include "types.h" #include "rstl/list.hpp" +#include "rstl/rc_ptr.hpp" + +class CIOWin; class CIOWinManager { public: + CIOWinManager(); + void Draw() const; + void AddIOWin(rstl::ncrc_ptr< CIOWin >, int, int); inline bool IsEmpty() const { return x4_ == 0 && x0_ == 0; } @@ -16,5 +22,6 @@ private: uint x4_; rstl::list< unkptr > x8_; }; +CHECK_SIZEOF(CIOWinManager, 0x20) #endif diff --git a/include/MetroidPrime/CInGameTweakManager.hpp b/include/MetroidPrime/CInGameTweakManager.hpp index e23ebf01..40f9a92e 100644 --- a/include/MetroidPrime/CInGameTweakManager.hpp +++ b/include/MetroidPrime/CInGameTweakManager.hpp @@ -7,9 +7,12 @@ class CInGameTweakManager { public: + CInGameTweakManager(); + bool ReadFromMemoryCard(const rstl::string&); private: + u8 pad[0x10]; }; extern CInGameTweakManager* gpTweakManager; diff --git a/include/MetroidPrime/CInputGenerator.hpp b/include/MetroidPrime/CInputGenerator.hpp new file mode 100644 index 00000000..de7bbd40 --- /dev/null +++ b/include/MetroidPrime/CInputGenerator.hpp @@ -0,0 +1,16 @@ +#ifndef _CINPUTGENERATOR_HPP +#define _CINPUTGENERATOR_HPP + +#include "types.h" + +class COsContext; + +class CInputGenerator { +public: + CInputGenerator(COsContext*, f32, f32); + +private: + u8 pad[0x14]; +}; + +#endif \ No newline at end of file diff --git a/include/MetroidPrime/CMain.hpp b/include/MetroidPrime/CMain.hpp index 76ee3c19..1656088f 100644 --- a/include/MetroidPrime/CMain.hpp +++ b/include/MetroidPrime/CMain.hpp @@ -15,8 +15,52 @@ #include "MetroidPrime/TGameTypes.hpp" #include "MetroidPrime/Tweaks/CTweaks.hpp" +class CMain; + +// TODO +class UnkClassArena { +public: + UnkClassArena(CMain*); +}; + +// TODO move to new header +class CDvdRequestSys { +public: + CDvdRequestSys() { + if (mManagerInstalled != true) { + mManagerInstalled = true; + } + } + ~CDvdRequestSys() { + if (mManagerInstalled == true) { + mManagerInstalled = false; + } + } + +private: + static bool mManagerInstalled; +}; + +// TODO where? +enum EFlowState { + kFS_None, + kFS_WinBad, + kFS_WinGood, + kFS_WinBest, + kFS_LoseGame, + kFS_Default, + kFS_StateSetter, + kFS_PreFrontEnd, + kFS_FrontEnd, + kFS_Game, + kFS_GameExit, +}; + class CMain { public: + CMain(); + ~CMain(); + void UpdateStreamedAudio(); void RegisterResourceTweaks(); void ResetGameState(); @@ -33,16 +77,30 @@ public: void DrawDebugMetrics(double dt, CStopwatch& stopWatch); bool CheckTerminate(); bool CheckReset(); + void OpenWindow(); + + void SetMaxSpeed(bool v) { + // ? + x160_26_screenFading = v; + } static void EnsureWorldPaksReady(); static void EnsureWorldPakReady(CAssetId id); + // TODO + COsContext& InitOsContext() { + OpenWindow(); + return x0_osContext; + } + private: COsContext x0_osContext; - u8 x6c_unk; + UnkClassArena x6c_unk; CMemorySys x6d_memorySys; + CDvdRequestSys x6e_dvdRequestSys; CTweaks x70_tweaks; - u8 pad[0x7c]; + u8 pad[0x14]; + f64 xe8_; TReservedAverage< f32, 4 > xf0_; TReservedAverage< f32, 4 > x104_; f32 x118_; @@ -50,7 +108,7 @@ private: f32 x120_; f32 x124_; CGameGlobalObjects* x128_gameGlobalObjects; - uint x12c_flowState; // EFlowState + EFlowState x12c_flowState; rstl::reserved_vector< uint, 10 > x130_frameTimes; int x15c_frameTimeIdx; bool x160_24_finished : 1; diff --git a/include/MetroidPrime/CMemoryCard.hpp b/include/MetroidPrime/CMemoryCard.hpp new file mode 100644 index 00000000..26590188 --- /dev/null +++ b/include/MetroidPrime/CMemoryCard.hpp @@ -0,0 +1,12 @@ +#ifndef _CMEMORYCARD_HPP +#define _CMEMORYCARD_HPP + +#include "types.h" + +class CMemoryCard { + // TODO +}; + +extern CMemoryCard* gpMemoryCard; + +#endif \ No newline at end of file diff --git a/include/MetroidPrime/CModelData.hpp b/include/MetroidPrime/CModelData.hpp index 1f24d330..5bdb53ca 100644 --- a/include/MetroidPrime/CModelData.hpp +++ b/include/MetroidPrime/CModelData.hpp @@ -51,6 +51,9 @@ public: void AdvanceParticles(const CTransform4f& xf, float dt, CStateManager& mgr); void RenderParticles(const CFrustumPlanes& planes) const; void RenderUnsortedParts(EWhichModel which, const CTransform4f& xf, const CActorLights* lights, const CModelFlags& flags) const; + void RenderThermal(const CTransform4f& xf, const CColor& mulColor, const CColor& addColor, const CModelFlags& flags) const; + void Render(const CStateManager&, const CTransform4f&, const CActorLights*, const CModelFlags&) const; + void Render(CModelData::EWhichModel, const CTransform4f&, const CActorLights*, const CModelFlags&) const; const CAnimData* GetAnimationData() const { return xc_animData.get(); } CAnimData* AnimationData() { return xc_animData.get(); } @@ -62,7 +65,9 @@ public: void SetXRayModel(const rstl::pair< CAssetId, CAssetId >& assets); void SetInfraModel(const rstl::pair< CAssetId, CAssetId >& assets); + void SetAmbientColor(const CColor& color) { x18_ambientColor = color; } + bool GetSortThermal() const { return x14_25_sortThermal; } void SetSortThermal(bool b) { x14_25_sortThermal = b; } static EWhichModel GetRenderingModel(const CStateManager& mgr); diff --git a/include/MetroidPrime/CParticleDatabase.hpp b/include/MetroidPrime/CParticleDatabase.hpp index 8a3b10e3..c8657ce1 100644 --- a/include/MetroidPrime/CParticleDatabase.hpp +++ b/include/MetroidPrime/CParticleDatabase.hpp @@ -22,6 +22,10 @@ public: typedef rstl::map< rstl::string, rstl::auto_ptr< CParticleGenInfo > > DrawMap; void SetParticleEffectState(const rstl::string& name, bool active, CStateManager& mgr); + void RenderSystemsToBeDrawnFirst() const; + void RenderSystemsToBeDrawnLast() const; + + bool AreAnySystemsDrawnWithModel() const { return xb4_25_anySystemsDrawnWithModel; } private: rstl::map< CAssetId, rstl::rc_ptr< TLockedToken< CGenDescription > > > x0_particleDescs; diff --git a/include/MetroidPrime/CSplashScreen.hpp b/include/MetroidPrime/CSplashScreen.hpp new file mode 100644 index 00000000..48253ffe --- /dev/null +++ b/include/MetroidPrime/CSplashScreen.hpp @@ -0,0 +1,23 @@ +#ifndef _CSPLASHSCREEN_HPP +#define _CSPLASHSCREEN_HPP + +#include "types.h" + +#include "MetroidPrime/CIOWin.hpp" + +class CSplashScreen : public CIOWin { +public: + enum ESplashScreen { + Nintendo, + Retro, + Dolby, + }; + + CSplashScreen(ESplashScreen); + ~CSplashScreen() override; + + virtual EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&); + virtual void Draw(); +}; + +#endif \ No newline at end of file diff --git a/include/MetroidPrime/CStateManager.hpp b/include/MetroidPrime/CStateManager.hpp index e81dc4ea..78fbf935 100644 --- a/include/MetroidPrime/CStateManager.hpp +++ b/include/MetroidPrime/CStateManager.hpp @@ -38,6 +38,7 @@ class CStateManager { public: void SendScriptMsg(TUniqueId uid, TEditorId target, EScriptObjectMessage msg, EScriptObjectState state); bool AddDrawableActor(const CActor& actor, const CVector3f& pos, const CAABox& bounds) const; + void SetupParticleHook(const CActor& actor) const; CCameraManager* CameraManager() { return x870_cameraManager; } const CCameraManager* GetCameraManager() const { return x870_cameraManager; } @@ -45,6 +46,11 @@ public: const CPlayerState* GetPlayerState() const { return x8b8_playerState.GetPtr(); } CWorld* World() { return x850_world.get(); } const CWorld* GetWorld() const { return x850_world.get(); } + CActorModelParticles* ActorModelParticles() { return x884_actorModelParticles.get(); } + const CActorModelParticles* GetActorModelParticles() const { return x884_actorModelParticles.get(); } + + f32 GetThermalColdScale1() const { return xf24_thermColdScale1; } + f32 GetThermalColdScale2() const { return xf28_thermColdScale2; } private: u16 x0_nextFreeIndex; @@ -69,6 +75,9 @@ private: rstl::rc_ptr< CScriptMailbox > x8bc_mailbox; rstl::rc_ptr< CMapWorldInfo > x8c0_mapWorldInfo; rstl::rc_ptr< CWorldTransManager > x8c4_worldTransManager; + u8 pad2[0x658]; + f32 xf24_thermColdScale1; + f32 xf28_thermColdScale2; }; #endif diff --git a/include/MetroidPrime/Enemies/CAiFuncMap.hpp b/include/MetroidPrime/Enemies/CAiFuncMap.hpp index b58b4823..c1dd3a70 100644 --- a/include/MetroidPrime/Enemies/CAiFuncMap.hpp +++ b/include/MetroidPrime/Enemies/CAiFuncMap.hpp @@ -5,6 +5,7 @@ class CAiFuncMap { public: + CAiFuncMap(); ~CAiFuncMap(); private: diff --git a/include/MetroidPrime/Factories/CCharacterFactoryBuilder.hpp b/include/MetroidPrime/Factories/CCharacterFactoryBuilder.hpp index 79efe544..40c53370 100644 --- a/include/MetroidPrime/Factories/CCharacterFactoryBuilder.hpp +++ b/include/MetroidPrime/Factories/CCharacterFactoryBuilder.hpp @@ -5,6 +5,7 @@ class CCharacterFactoryBuilder { public: + CCharacterFactoryBuilder(); ~CCharacterFactoryBuilder(); private: diff --git a/include/MetroidPrime/ScriptObjects/CScriptMazeNode.hpp b/include/MetroidPrime/ScriptObjects/CScriptMazeNode.hpp new file mode 100644 index 00000000..07a98e85 --- /dev/null +++ b/include/MetroidPrime/ScriptObjects/CScriptMazeNode.hpp @@ -0,0 +1,13 @@ +#ifndef _CSCRIPTMAZENODE_HPP +#define _CSCRIPTMAZENODE_HPP + +#include "types.h" + +#include "MetroidPrime/CActor.hpp" + +class CScriptMazeNode : public CActor { +public: + static void LoadMazeSeeds(); +}; + +#endif \ No newline at end of file diff --git a/include/MetroidPrime/Tweaks/CTweakGame.hpp b/include/MetroidPrime/Tweaks/CTweakGame.hpp index 1e630561..cdddf933 100644 --- a/include/MetroidPrime/Tweaks/CTweakGame.hpp +++ b/include/MetroidPrime/Tweaks/CTweakGame.hpp @@ -3,15 +3,56 @@ #include "types.h" +#include "MetroidPrime/Tweaks/ITweakObject.hpp" + #include "rstl/string.hpp" -class CTweakGame { +class CTweakGame : public ITweakObject { public: + ~CTweakGame() override; + const rstl::string& GetWorldPrefix() { return x4_worldPrefix; } + const rstl::string& GetDefaultRoom() const { return x14_defaultRoom; } + bool GetSplashScreensDisabled() const { return x2b_splashScreensDisabled; } + f32 GetFirstPersonFOV() const { return x24_fov; } + f32 GetPressStartDelay() const { return x30_pressStartDelay; } + f32 GetWavecapIntensityNormal() const { return x34_wavecapIntensityNormal; } + f32 GetWavecapIntensityPoison() const { return x38_wavecapIntensityPoison; } + f32 GetWavecapIntensityLava() const { return x3c_wavecapIntensityLava; } + f32 GetRippleIntensityNormal() const { return x40_rippleIntensityNormal; } + f32 GetRippleIntensityPoison() const { return x44_rippleIntensityPoison; } + f32 GetRippleIntensityLava() const { return x48_rippleIntensityLava; } + f32 GetFluidEnvBumpScale() const { return x4c_fluidEnvBumpScale; } + f32 GetWaterFogDistanceBase() const { return x50_waterFogDistanceBase; } + f32 GetWaterFogDistanceRange() const { return x54_waterFogDistanceRange; } + f32 GetGravityWaterFogDistanceBase() const { return x58_gravityWaterFogDistanceBase; } + f32 GetGravityWaterFogDistanceRange() const { return x5c_gravityWaterFogDistanceRange; } + f32 GetHardModeDamageMultiplier() const { return x60_hardmodeDamageMult; } + f32 GetHardModeWeaponMultiplier() const { return x64_hardmodeWeaponMult; } private: - uint x0_; rstl::string x4_worldPrefix; + rstl::string x14_defaultRoom; + f32 x24_fov; + bool x28_unknown1; + bool x29_unknown2; + bool x2a_unknown3; + bool x2b_splashScreensDisabled; + f32 x2c_unknown5; + f32 x30_pressStartDelay; + f32 x34_wavecapIntensityNormal; + f32 x38_wavecapIntensityPoison; + f32 x3c_wavecapIntensityLava; + f32 x40_rippleIntensityNormal; + f32 x44_rippleIntensityPoison; + f32 x48_rippleIntensityLava; + f32 x4c_fluidEnvBumpScale; + f32 x50_waterFogDistanceBase; + f32 x54_waterFogDistanceRange; + f32 x58_gravityWaterFogDistanceBase; + f32 x5c_gravityWaterFogDistanceRange; + f32 x60_hardmodeDamageMult; + f32 x64_hardmodeWeaponMult; }; extern CTweakGame* gpTweakGame; diff --git a/include/MetroidPrime/Tweaks/CTweakPlayer.hpp b/include/MetroidPrime/Tweaks/CTweakPlayer.hpp new file mode 100644 index 00000000..3896ab17 --- /dev/null +++ b/include/MetroidPrime/Tweaks/CTweakPlayer.hpp @@ -0,0 +1,318 @@ +#ifndef _CTWEAKPLAYER_HPP +#define _CTWEAKPLAYER_HPP + +#include "types.h" + +#include "MetroidPrime/Tweaks/ITweakObject.hpp" + +#include "rstl/string.hpp" + +class CTweakPlayer : public ITweakObject { +public: + ~CTweakPlayer() override; + + // TODO CPlayer::ESurfaceRestraints + f32 GetMaxTranslationalAcceleration(int s) const { return x4_maxTranslationalAcceleration[s]; } + f32 GetMaxRotationalAcceleration(int s) const { return x24_maxRotationalAcceleration[s]; } + f32 GetPlayerTranslationFriction(int s) const { return x44_translationFriction[s]; } + f32 GetPlayerRotationFriction(int s) const { return x64_rotationFriction[s]; } + f32 GetPlayerRotationMaxSpeed(int s) const { return x84_rotationMaxSpeed[s]; } + f32 GetPlayerTranslationMaxSpeed(int s) const { return xa4_translationMaxSpeed[s]; } + f32 GetNormalGravAccel() const { return xc4_normalGravAccel; } + f32 GetFluidGravAccel() const { return xc8_fluidGravAccel; } + f32 GetVerticalJumpAccel() const { return xcc_verticalJumpAccel; } + f32 GetHorizontalJumpAccel() const { return xd0_horizontalJumpAccel; } + f32 GetVerticalDoubleJumpAccel() const { return xd4_verticalDoubleJumpAccel; } + f32 GetHorizontalDoubleJumpAccel() const { return xd8_horizontalDoubleJumpAccel; } + f32 GetWaterJumpFactor() const { return xdc_waterJumpFactor; } + f32 GetWaterBallJumpFactor() const { return xe0_waterBallJumpFactor; } + f32 GetLavaJumpFactor() const { return xe4_lavaJumpFactor; } + f32 GetLavaBallJumpFactor() const { return xe8_lavaBallJumpFactor; } + f32 GetPhazonJumpFactor() const { return xec_phazonJumpFactor; } + f32 GetPhazonBallJumpFactor() const { return xf0_phazonBallJumpFactor; } + f32 GetAllowedJumpTime() const { return xf4_allowedJumpTime; } + f32 GetAllowedDoubleJumpTime() const { return xf8_allowedDoubleJumpTime; } + f32 GetMinDoubleJumpWindow() const { return xfc_minDoubleJumpWindow; } + f32 GetMaxDoubleJumpWindow() const { return x100_maxDoubleJumpWindow; } + f32 GetMinJumpTime() const { return x108_minJumpTime; } + f32 GetMinDoubleJumpTime() const { return x10c_minDoubleJumpTime; } + f32 GetAllowedLedgeTime() const { return x110_allowedLedgeTime; } + f32 GetDoubleJumpImpulse() const { return x114_doubleJumpImpulse; } + f32 GetBackwardsForceMultiplier() const { return x118_backwardsForceMultiplier; } + f32 GetBombJumpRadius() const { return x11c_bombJumpRadius; } + f32 GetBombJumpHeight() const { return x120_bombJumpHeight; } + f32 GetEyeOffset() const { return x124_eyeOffset; } + f32 GetTurnSpeedMultiplier() const { return x128_turnSpeedMultiplier; } + f32 GetFreeLookTurnSpeedMultiplier() const { return x12c_freeLookTurnSpeedMultiplier; } + f32 GetFreeLookSpeed() const { return x138_freeLookSpeed; } + f32 GetFreeLookSnapSpeed() const { return x13c_freeLookSnapSpeed; } + f32 GetFreeLookCenteredThresholdAngle() const { return x144_freeLookCenteredThresholdAngle; } + f32 GetFreeLookCenteredTime() const { return x148_freeLookCenteredTime; } + f32 GetOrbitModeTimer() const { return x180_orbitModeTimer; } + f32 GetOrbitUpperAngle() const { return x188_orbitUpperAngle; } + f32 GetOrbitLowerAngle() const { return x18c_orbitLowerAngle; } + f32 GetOrbitHorizAngle() const { return x190_orbitHorizAngle; } + f32 GetOrbitMaxTargetDistance() const { return x19c_orbitMaxTargetDistance; } + f32 GetOrbitMaxLockDistance() const { return x1a0_orbitMaxLockDistance; } + f32 GetOrbitDistanceThreshold() const { return x1a4_orbitDistanceThreshold; } + uint GetOrbitScreenBoxHalfExtentX(int zone) const { return x1a8_orbitScreenBoxHalfExtentX[zone]; } + uint GetOrbitScreenBoxHalfExtentY(int zone) const { return x1b0_orbitScreenBoxHalfExtentY[zone]; } + uint GetOrbitScreenBoxCenterX(int zone) const { return x1b8_orbitScreenBoxCenterX[zone]; } + uint GetOrbitScreenBoxCenterY(int zone) const { return x1c0_orbitScreenBoxCenterY[zone]; } + uint GetOrbitZoneIdealX(int zone) const { return x1c8_orbitZoneIdealX[zone]; } + uint GetOrbitZoneIdealY(int zone) const { return x1d0_orbitZoneIdealY[zone]; } + f32 GetOrbitNearX() const { return x1d8_orbitNearX; } + f32 GetOrbitNearZ() const { return x1dc_orbitNearZ; } + f32 GetOrbitFixedOffsetZDiff() const { return x1e8_orbitFixedOffsetZDiff; } + f32 GetOrbitZRange() const { return x1ec_orbitZRange; } + bool GetDashEnabled() const { return x200_24_dashEnabled; } + bool GetDashOnButtonRelease() const { return x200_25_dashOnButtonRelease; } + f32 GetDashButtonHoldCancelTime() const { return x204_dashButtonHoldCancelTime; } + f32 GetDashStrafeInputThreshold() const { return x208_dashStrafeInputThreshold; } + f32 GetSidewaysDoubleJumpImpulse() const { return x20c_sidewaysDoubleJumpImpulse; } + f32 GetSidewaysVerticalDoubleJumpAccel() const { return x210_sidewaysVerticalDoubleJumpAccel; } + f32 GetSidewaysHorizontalDoubleJumpAccel() const { return x214_sidewaysHorizontalDoubleJumpAccel; } + f32 GetScanningRange() const { return x218_scanningRange; } + bool GetScanRetention() const { return x21c_24_scanRetention; } + bool GetScanFreezesGame() const { return x21c_25_scanFreezesGame; } + bool GetOrbitWhileScanning() const { return x21c_26_orbitWhileScanning; } + f32 GetScanMaxTargetDistance() const { return x220_scanMaxTargetDistance; } + f32 GetScanMaxLockDistance() const { return x224_scanMaxLockDistance; } + bool GetMoveDuringFreeLook() const { return x228_27_moveDuringFreeLook; } + bool GetHoldButtonsForFreeLook() const { return x228_28_holdButtonsForFreeLook; } + bool GetTwoButtonsForFreeLook() const { return x228_29_twoButtonsForFreeLook; } + bool GetAimWhenOrbitingPoint() const { return x229_25_aimWhenOrbitingPoint; } + bool GetStayInFreeLookWhileFiring() const { return x229_26_stayInFreeLookWhileFiring; } + bool GetOrbitFixedOffset() const { return x229_29_orbitFixedOffset; } + bool GetGunButtonTogglesHolster() const { return x229_30_gunButtonTogglesHolster; } + bool GetGunNotFiringHolstersGun() const { return x229_31_gunNotFiringHolstersGun; } + bool GetFallingDoubleJump() const { return x22a_24_fallingDoubleJump; } + bool GetImpulseDoubleJump() const { return x22a_25_impulseDoubleJump; } + bool GetFiringCancelsCameraPitch() const { return x22a_26_firingCancelsCameraPitch; } + bool GetAssistedAimingIgnoreHorizontal() const { return x22a_27_assistedAimingIgnoreHorizontal; } + bool GetAssistedAimingIgnoreVertical() const { return x22a_28_assistedAimingIgnoreVertical; } + f32 GetAimMaxDistance() const { return x234_aimMaxDistance; } + f32 GetAimThresholdDistance() const { return x24c_aimThresholdDistance; } + f32 GetAimBoxWidth() const { return x258_aimBoxWidth; } + f32 GetAimBoxHeight() const { return x25c_aimBoxHeight; } + f32 GetAimTargetTimer() const { return x260_aimTargetTimer; } + f32 GetAimAssistHorizontalAngle() const { return x264_aimAssistHorizontalAngle; } + f32 GetAimAssistVerticalAngle() const { return x268_aimAssistVerticalAngle; } + f32 GetPlayerHeight() const { return x26c_playerHeight; } + f32 GetPlayerXYHalfExtent() const { return x270_playerXYHalfExtent; } + f32 GetStepUpHeight() const { return x274_stepUpHeight; } + f32 GetStepDownHeight() const { return x278_stepDownHeight; } + f32 GetPlayerBallHalfExtent() const { return x27c_playerBallHalfExtent; } + f32 GetOrbitDistanceMax() const { return x2a0_orbitDistanceMax; } + f32 GetGrappleSwingLength() const { return x2a4_grappleSwingLength; } + f32 GetGrappleSwingPeriod() const { return x2a8_grappleSwingPeriod; } + f32 GetGrapplePullSpeedMin() const { return x2ac_grapplePullSpeedMin; } + f32 GetMaxGrappleLockedTurnAlignDistance() const { return x2b4_maxGrappleLockedTurnAlignDistance; } + f32 GetGrapplePullSpeedProportion() const { return x2b8_grapplePullSpeedProportion; } + f32 GetGrapplePullSpeedMax() const { return x2bc_grapplePullSpeedMax; } + f32 GetGrappleLookCenterSpeed() const { return x2c0_grappleLookCenterSpeed; } + f32 GetMaxGrappleTurnSpeed() const { return x2c4_maxGrappleTurnSpeed; } + f32 GetGrappleJumpForce() const { return x2c8_grappleJumpForce; } + f32 GetGrappleReleaseTime() const { return x2cc_grappleReleaseTime; } + uint GetGrappleJumpMode() const { return x2d0_grappleJumpMode; } + bool GetOrbitReleaseBreaksGrapple() const { return x2d4_orbitReleaseBreaksGrapple; } + bool GetInvertGrappleTurn() const { return x2d5_invertGrappleTurn; } + f32 GetGrappleBeamSpeed() const { return x2d8_grappleBeamSpeed; } + f32 GetGrappleBeamXWaveAmplitude() const { return x2dc_grappleBeamXWaveAmplitude; } + f32 GetGrappleBeamZWaveAmplitude() const { return x2e0_grappleBeamZWaveAmplitude; } + f32 GetGrappleBeamAnglePhaseDelta() const { return x2e4_grappleBeamAnglePhaseDelta; } + f32 GetHorizontalFreeLookAngleVel() const { return x130_horizontalFreeLookAngleVel; } + f32 GetVerticalFreeLookAngleVel() const { return x134_verticalFreeLookAngleVel; } + f32 GetOrbitCameraSpeed() const { return x184_orbitCameraSpeed; } + f32 GetOrbitPreventionTime() const { return x1fc_orbitPreventionTime; } + bool GetFreeLookTurnsPlayer() const { return x228_24_freelookTurnsPlayer; } + f32 GetJumpCameraPitchDownStart() const { return x288_jumpCameraPitchDownStart; } + f32 GetJumpCameraPitchDownFull() const { return x28c_jumpCameraPitchDownFull; } + f32 GetJumpCameraPitchDownAngle() const { return x290_jumpCameraPitchDownAngle; } + f32 GetFallCameraPitchDownStart() const { return x294_fallCameraPitchDownStart; } + f32 GetFallCameraPitchDownFull() const { return x298_fallCameraPitchDownFull; } + f32 GetFallCameraPitchDownAngle() const { return x29c_fallCameraPitchDownAngle; } + f32 GetFirstPersonCameraSpeed() const { return x280_firstPersonCameraSpeed; } + f32 GetGrappleCameraSpeed() const { return x2b0_grappleCameraSpeed; } + f32 GetFreeLookDampenFactor() const { return x14c_freeLookDampenFactor; } + f32 GetLeftAnalogMax() const { return x150_leftDiv; } + f32 GetRightAnalogMax() const { return x154_rightDiv; } + f32 GetOrbitMinDistance(int type) const { return x158_orbitMinDistance[type]; } + f32 GetOrbitNormalDistance(int type) const { return x164_orbitNormalDistance[type]; } + f32 GetOrbitMaxDistance(int type) const { return x170_orbitMaxDistance[type]; } + f32 GetFrozenTimeout() const { return x2f8_frozenTimeout; } + uint GetIceBreakJumpCount() const { return x2fc_iceBreakJumpCount; } + f32 GetVariaDamageReduction() const { return x300_variaDamageReduction; } + f32 GetGravityDamageReduction() const { return x304_gravityDamageReduction; } + f32 GetPhazonDamageReduction() const { return x308_phazonDamageReduction; } + +private: + f32 x4_maxTranslationalAcceleration[8]; + f32 x24_maxRotationalAcceleration[8]; + f32 x44_translationFriction[8]; + f32 x64_rotationFriction[8]; + f32 x84_rotationMaxSpeed[8]; + f32 xa4_translationMaxSpeed[8]; + f32 xc4_normalGravAccel; + f32 xc8_fluidGravAccel; + f32 xcc_verticalJumpAccel; + f32 xd0_horizontalJumpAccel; + f32 xd4_verticalDoubleJumpAccel; + f32 xd8_horizontalDoubleJumpAccel; + f32 xdc_waterJumpFactor; + f32 xe0_waterBallJumpFactor; + f32 xe4_lavaJumpFactor; + f32 xe8_lavaBallJumpFactor; + f32 xec_phazonJumpFactor; + f32 xf0_phazonBallJumpFactor; + f32 xf4_allowedJumpTime; + f32 xf8_allowedDoubleJumpTime; + f32 xfc_minDoubleJumpWindow; + f32 x100_maxDoubleJumpWindow; + f32 x104_; + f32 x108_minJumpTime; + f32 x10c_minDoubleJumpTime; + f32 x110_allowedLedgeTime; + f32 x114_doubleJumpImpulse; + f32 x118_backwardsForceMultiplier; + f32 x11c_bombJumpRadius; + f32 x120_bombJumpHeight; + f32 x124_eyeOffset; + f32 x128_turnSpeedMultiplier; + f32 x12c_freeLookTurnSpeedMultiplier; + f32 x130_horizontalFreeLookAngleVel; + f32 x134_verticalFreeLookAngleVel; + f32 x138_freeLookSpeed; + f32 x13c_freeLookSnapSpeed; + f32 x140_; + f32 x144_freeLookCenteredThresholdAngle; + f32 x148_freeLookCenteredTime; + f32 x14c_freeLookDampenFactor; + f32 x150_leftDiv; + f32 x154_rightDiv; + f32 x158_orbitMinDistance[3]; + f32 x164_orbitNormalDistance[3]; + f32 x170_orbitMaxDistance[3]; + f32 x17c_; + f32 x180_orbitModeTimer; + f32 x184_orbitCameraSpeed; + f32 x188_orbitUpperAngle; + f32 x18c_orbitLowerAngle; + f32 x190_orbitHorizAngle; + f32 x194_; + f32 x198_; + f32 x19c_orbitMaxTargetDistance; + f32 x1a0_orbitMaxLockDistance; + f32 x1a4_orbitDistanceThreshold; + uint x1a8_orbitScreenBoxHalfExtentX[2]; + uint x1b0_orbitScreenBoxHalfExtentY[2]; + uint x1b8_orbitScreenBoxCenterX[2]; + uint x1c0_orbitScreenBoxCenterY[2]; + uint x1c8_orbitZoneIdealX[2]; + uint x1d0_orbitZoneIdealY[2]; + f32 x1d8_orbitNearX; + f32 x1dc_orbitNearZ; + f32 x1e0_; + f32 x1e4_; + f32 x1e8_orbitFixedOffsetZDiff; + f32 x1ec_orbitZRange; + f32 x1f0_; + f32 x1f4_; + f32 x1f8_; + f32 x1fc_orbitPreventionTime; + bool x200_24_dashEnabled : 1; + bool x200_25_dashOnButtonRelease : 1; + f32 x204_dashButtonHoldCancelTime; + f32 x208_dashStrafeInputThreshold; + f32 x20c_sidewaysDoubleJumpImpulse; + f32 x210_sidewaysVerticalDoubleJumpAccel; + f32 x214_sidewaysHorizontalDoubleJumpAccel; + f32 x218_scanningRange; + bool x21c_24_scanRetention : 1; + bool x21c_25_scanFreezesGame : 1; + bool x21c_26_orbitWhileScanning : 1; + f32 x220_scanMaxTargetDistance; + f32 x224_scanMaxLockDistance; + bool x228_24_freelookTurnsPlayer : 1; + bool x228_25_ : 1; + bool x228_26_ : 1; + bool x228_27_moveDuringFreeLook : 1; + bool x228_28_holdButtonsForFreeLook : 1; + bool x228_29_twoButtonsForFreeLook : 1; + bool x228_30_ : 1; + bool x228_31_ : 1; + bool x229_24_ : 1; + bool x229_25_aimWhenOrbitingPoint : 1; + bool x229_26_stayInFreeLookWhileFiring : 1; + bool x229_27_ : 1; + bool x229_28_ : 1; + bool x229_29_orbitFixedOffset : 1; + bool x229_30_gunButtonTogglesHolster : 1; + bool x229_31_gunNotFiringHolstersGun : 1; + bool x22a_24_fallingDoubleJump : 1; + bool x22a_25_impulseDoubleJump : 1; + bool x22a_26_firingCancelsCameraPitch : 1; + bool x22a_27_assistedAimingIgnoreHorizontal : 1; + bool x22a_28_assistedAimingIgnoreVertical : 1; + f32 x22c_; + f32 x230_; + f32 x234_aimMaxDistance; + f32 x238_; + f32 x23c_; + f32 x240_; + f32 x244_; + f32 x248_; + f32 x24c_aimThresholdDistance; + f32 x250_; + f32 x254_; + f32 x258_aimBoxWidth; + f32 x25c_aimBoxHeight; + f32 x260_aimTargetTimer; + f32 x264_aimAssistHorizontalAngle; + f32 x268_aimAssistVerticalAngle; + f32 x26c_playerHeight; + f32 x270_playerXYHalfExtent; + f32 x274_stepUpHeight; + f32 x278_stepDownHeight; + f32 x27c_playerBallHalfExtent; + f32 x280_firstPersonCameraSpeed; + f32 x284_; + f32 x288_jumpCameraPitchDownStart; + f32 x28c_jumpCameraPitchDownFull; + f32 x290_jumpCameraPitchDownAngle; + f32 x294_fallCameraPitchDownStart; + f32 x298_fallCameraPitchDownFull; + f32 x29c_fallCameraPitchDownAngle; + f32 x2a0_orbitDistanceMax; + f32 x2a4_grappleSwingLength; + f32 x2a8_grappleSwingPeriod; + f32 x2ac_grapplePullSpeedMin; + f32 x2b0_grappleCameraSpeed; + f32 x2b4_maxGrappleLockedTurnAlignDistance; + f32 x2b8_grapplePullSpeedProportion; + f32 x2bc_grapplePullSpeedMax; + f32 x2c0_grappleLookCenterSpeed; + f32 x2c4_maxGrappleTurnSpeed; + f32 x2c8_grappleJumpForce; + f32 x2cc_grappleReleaseTime; + uint x2d0_grappleJumpMode; + bool x2d4_orbitReleaseBreaksGrapple; + bool x2d5_invertGrappleTurn; + f32 x2d8_grappleBeamSpeed; + f32 x2dc_grappleBeamXWaveAmplitude; + f32 x2e0_grappleBeamZWaveAmplitude; + f32 x2e4_grappleBeamAnglePhaseDelta; + f32 x2e8_; + f32 x2ec_; + f32 x2f0_; + bool x2f4_; + f32 x2f8_frozenTimeout; + uint x2fc_iceBreakJumpCount; + f32 x300_variaDamageReduction; + f32 x304_gravityDamageReduction; + f32 x308_phazonDamageReduction; +}; + +extern CTweakPlayer* gpTweakPlayer; + +#endif diff --git a/include/MetroidPrime/Tweaks/CTweaks.hpp b/include/MetroidPrime/Tweaks/CTweaks.hpp index 235886c1..3403a7e0 100644 --- a/include/MetroidPrime/Tweaks/CTweaks.hpp +++ b/include/MetroidPrime/Tweaks/CTweaks.hpp @@ -3,13 +3,22 @@ #include "types.h" +#include "rstl/auto_ptr.hpp" +#include "rstl/reserved_vector.hpp" + +class ITweakObject; + class CTweaks { public: + CTweaks(); + ~CTweaks(); + void RegisterResourceTweaks(); void RegisterTweaks(); private: - uint x0_unk; + rstl::reserved_vector< rstl::auto_ptr< ITweakObject >, 12 > x0_; }; +CHECK_SIZEOF(CTweaks, 0x64) #endif diff --git a/include/MetroidPrime/Tweaks/ITweakObject.hpp b/include/MetroidPrime/Tweaks/ITweakObject.hpp new file mode 100644 index 00000000..28fb503a --- /dev/null +++ b/include/MetroidPrime/Tweaks/ITweakObject.hpp @@ -0,0 +1,11 @@ +#ifndef _ITWEAKOBJECT_HPP +#define _ITWEAKOBJECT_HPP + +#include "types.h" + +class ITweakObject { +public: + virtual ~ITweakObject() = 0; +}; + +#endif diff --git a/include/dolphin/__start.h b/include/dolphin/__start.h index 9fa47a84..58cde530 100644 --- a/include/dolphin/__start.h +++ b/include/dolphin/__start.h @@ -1,4 +1,4 @@ -#include "Dolphin/db.h" +#include "dolphin/db.h" #include "types.h" #define PAD3_BUTTON_ADDR 0x800030E4 diff --git a/include/dolphin/ar.h b/include/dolphin/ar.h new file mode 100644 index 00000000..198fd238 --- /dev/null +++ b/include/dolphin/ar.h @@ -0,0 +1,17 @@ +#ifndef __AR_H__ +#define __AR_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +u32 ARInit(u32* stack_index_addr, u32 num_entries); +u32 ARAlloc(u32 length); + +#ifdef __cplusplus +} +#endif + +#endif // __AR_H__ diff --git a/include/dolphin/arq.h b/include/dolphin/arq.h new file mode 100644 index 00000000..815ea33d --- /dev/null +++ b/include/dolphin/arq.h @@ -0,0 +1,18 @@ +#ifndef __ARQ_H__ +#define __ARQ_H__ + +#include "types.h" + +#include "dolphin/ar.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void ARQInit(void); + +#ifdef __cplusplus +} +#endif + +#endif // __ARQ_H__ diff --git a/include/dolphin/dvd.h b/include/dolphin/dvd.h index eaba3235..26cc50e4 100644 --- a/include/dolphin/dvd.h +++ b/include/dolphin/dvd.h @@ -17,6 +17,8 @@ typedef struct DVDDiskID { u8 padding[22]; // 0's are stored } DVDDiskID; +void DVDSetAutoFatalMessaging(BOOL); + #ifdef __cplusplus } #endif diff --git a/include/dolphin/os.h b/include/dolphin/os.h index 86704bf9..5d7c2799 100644 --- a/include/dolphin/os.h +++ b/include/dolphin/os.h @@ -53,6 +53,7 @@ u32 __OSCoreClock AT_ADDRESS(OS_BASE_CACHED | 0x00FC); // sync with OSLoMem.h #define OSRoundUp32B(v) (((u32)(v + 31) & ~31)) OSTime OSGetTime(); +void OSReport(const char* msg, ...); #ifdef __cplusplus } diff --git a/include/dolphin/os/OSCache.h b/include/dolphin/os/OSCache.h index 74fdb304..d3bfa5bc 100644 --- a/include/dolphin/os/OSCache.h +++ b/include/dolphin/os/OSCache.h @@ -7,6 +7,8 @@ extern "C" { #endif +void DCFlushRange(void* addr, u32 nBytes); + void LCEnable(); #ifdef __cplusplus diff --git a/include/dolphin/os/OSMemory.h b/include/dolphin/os/OSMemory.h new file mode 100644 index 00000000..95e5d2ac --- /dev/null +++ b/include/dolphin/os/OSMemory.h @@ -0,0 +1,26 @@ +#ifndef _OSMEMORY_H_ +#define _OSMEMORY_H_ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define OS_PROTECT_CHAN0 0 +#define OS_PROTECT_CHAN1 1 +#define OS_PROTECT_CHAN2 2 +#define OS_PROTECT_CHAN3 3 + +#define OS_PROTECT_CONTROL_NONE 0x00 +#define OS_PROTECT_CONTROL_READ 0x01 +#define OS_PROTECT_CONTROL_WRITE 0x02 +#define OS_PROTECT_CONTROL_RDWR (OS_PROTECT_CONTROL_READ | OS_PROTECT_CONTROL_WRITE) + +void OSProtectRange(u32 chan, void* addr, u32 nBytes, u32 control); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/dolphin/os/OSMutex.h b/include/dolphin/os/OSMutex.h new file mode 100644 index 00000000..ab8d788e --- /dev/null +++ b/include/dolphin/os/OSMutex.h @@ -0,0 +1,23 @@ +#ifndef _OSMUTEX_H_ +#define _OSMUTEX_H_ + +#include "types.h" + +#include "dolphin/os/OSThread.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct OSMutex { + OSThreadQueue queue; + OSThread* thread; // the current owner + s32 count; // lock count + OSMutexLink link; // for OSThread.queueMutex +}; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/dolphin/os/OSThread.h b/include/dolphin/os/OSThread.h index 387d822a..60cabd71 100644 --- a/include/dolphin/os/OSThread.h +++ b/include/dolphin/os/OSThread.h @@ -62,6 +62,8 @@ struct OSThread { void* specific[OS_THREAD_SPECIFIC_MAX]; }; +OSThread* OSGetCurrentThread(void); + #ifdef __cplusplus } #endif diff --git a/include/rstl/construct.hpp b/include/rstl/construct.hpp index f57ebf4f..4cdb74cf 100644 --- a/include/rstl/construct.hpp +++ b/include/rstl/construct.hpp @@ -66,6 +66,7 @@ inline void uninitialized_copy_2(S* begin, D* out, S* end) { } template < typename S, typename D > +// inline void uninitialized_copy_n(S* src, int count, D* dest) { inline void uninitialized_copy_n(D* dest, S* src, int count) { for (int i = 0; i < count; ++dest, ++i, ++src) { construct(dest, *src); diff --git a/include/rstl/hash_map.hpp b/include/rstl/hash_map.hpp new file mode 100644 index 00000000..dcf9be31 --- /dev/null +++ b/include/rstl/hash_map.hpp @@ -0,0 +1,28 @@ +#ifndef _RSTL_HASH_MAP_HPP +#define _RSTL_HASH_MAP_HPP + +#include "types.h" + +#include "rstl/list.hpp" +#include "rstl/pair.hpp" +#include "rstl/red_black_tree.hpp" +#include "rstl/rmemory_allocator.hpp" +#include "rstl/vector.hpp" + +namespace rstl { +template < typename K, typename P, int unk, typename Select, typename Hash, typename Equal, typename Alloc = rmemory_allocator > +class hash_table { +private: + rstl::vector< rstl::list< P, Alloc > /*::iterator*/, Alloc > x; +}; + +template < typename K, typename V, typename Hash, typename Equal, typename Alloc = rmemory_allocator > +class hash_map { + typedef rstl::pair< K, V > Pair; + +private: + hash_table< K, Pair, 0, select1st< Pair >, Hash, Equal, Alloc > table; +}; +} // namespace rstl + +#endif diff --git a/include/rstl/list.hpp b/include/rstl/list.hpp index 88394969..5185dd05 100644 --- a/include/rstl/list.hpp +++ b/include/rstl/list.hpp @@ -9,6 +9,7 @@ namespace rstl { template < typename T, typename Alloc = rmemory_allocator > class list { public: + list() : x4_start(&xc_empty), x8_end(&xc_empty), xc_empty(x8_end, nullptr) {} ~list() { node* cur = x4_start; while (cur != nullptr) { @@ -25,6 +26,8 @@ private: T* x8_item; u32 x8_count; }; + + node(node* prev, node* next) : x0_prev(prev), x4_next(next), x8_count(0) {} }; Alloc x0_allocator; diff --git a/include/rstl/math.hpp b/include/rstl/math.hpp new file mode 100644 index 00000000..8ffbce06 --- /dev/null +++ b/include/rstl/math.hpp @@ -0,0 +1,17 @@ +#ifndef _RSTL_MATH_HPP +#define _RSTL_MATH_HPP + +#include "types.h" + +namespace rstl { +template < typename T > +static inline const T& max_val(const T& a, const T& b) { + return a > b ? a : b; +} +template < typename T > +static inline const T& min_val(const T& a, const T& b) { + return a < b ? a : b; +} +} // namespace rstl + +#endif diff --git a/include/rstl/optional_object.hpp b/include/rstl/optional_object.hpp index 389a1516..d0c537dc 100644 --- a/include/rstl/optional_object.hpp +++ b/include/rstl/optional_object.hpp @@ -13,16 +13,33 @@ public: optional_object(const T& item) : x0_item(item), x4_valid(true) {} ~optional_object() { clear(); } + optional_object& operator=(const T& item) { + assign(item); + return *this; + } + T& data() { return x0_item; } + T* get_ptr() { return &x0_item; } operator bool() const { return x4_valid; } void clear() { rstl::destroy(&x0_item); x4_valid = false; } + T& operator*() { return data(); } + private: T x0_item; bool x4_valid; + + void assign(const T& item) { + if (!x4_valid) { + rstl::construct(get_ptr(), item); + x4_valid = true; + } else { + data() = item; + } + } }; } // namespace rstl diff --git a/include/rstl/rc_ptr.hpp b/include/rstl/rc_ptr.hpp index 3aa6f240..66222e6d 100644 --- a/include/rstl/rc_ptr.hpp +++ b/include/rstl/rc_ptr.hpp @@ -3,29 +3,34 @@ #include "types.h" -template < typename T > class CRefData { public: - T* x0_ptr; + CRefData(void* ptr) : x0_ptr(ptr), x4_refCount(1) {} + CRefData(void* ptr, int refCount) : x0_ptr(ptr), x4_refCount(refCount) {} + + void* x0_ptr; unsigned int x4_refCount; }; namespace rstl { template < typename T > class rc_ptr { - CRefData< T >* x0_refData; - public: + rc_ptr(T* ptr) : x0_refData(new CRefData(ptr)) {} ~rc_ptr(); - T* GetPtr() const { return x0_refData->x0_ptr; } + T* GetPtr() const { return reinterpret_cast< T* >(x0_refData->x0_ptr); } // TODO ReleaseData__Q24rstl20rc_ptr T* operator->() const { return GetPtr(); } T& operator*() const { return *GetPtr(); } + +private: + CRefData* x0_refData; }; template < typename T > class ncrc_ptr : public rc_ptr< T > { - // TODO +public: + ncrc_ptr(T* ptr) : rc_ptr(ptr) {} }; } // namespace rstl diff --git a/include/rstl/reserved_vector.hpp b/include/rstl/reserved_vector.hpp index f09c36f6..e093f1a5 100644 --- a/include/rstl/reserved_vector.hpp +++ b/include/rstl/reserved_vector.hpp @@ -25,6 +25,7 @@ public: reserved_vector(const T& value) : x0_count(N) { rstl::uninitialized_fill_n(data(), N, value); } reserved_vector(const reserved_vector& other) { x0_count = other.size(); + // rstl::uninitialized_copy_n(other.data(), size(), data()); rstl::uninitialized_copy_n(data(), other.data(), size()); } reserved_vector& operator=(const reserved_vector& other) { diff --git a/include/rstl/single_ptr.hpp b/include/rstl/single_ptr.hpp index 06777dc4..a3c97ab2 100644 --- a/include/rstl/single_ptr.hpp +++ b/include/rstl/single_ptr.hpp @@ -16,9 +16,10 @@ public: // const T* get() const { return x0_ptr; } T* operator->() { return x0_ptr; } const T* operator->() const { return x0_ptr; } - void operator=(T* ptr) { + single_ptr& operator=(T* ptr) { delete x0_ptr; x0_ptr = ptr; + return *this; } bool null() const { return x0_ptr == nullptr; } T& operator*() { return *x0_ptr; } diff --git a/include/rstl/vector.hpp b/include/rstl/vector.hpp index f9949381..05f701d4 100644 --- a/include/rstl/vector.hpp +++ b/include/rstl/vector.hpp @@ -7,6 +7,22 @@ #include "rstl/rmemory_allocator.hpp" namespace rstl { +// template < typename T, typename Alloc > +// struct allocator_auto_ptr { +// allocator_auto_ptr(T* ptr, Alloc* alloc) : ptr(ptr) {} +// ~allocator_auto_ptr() { +// if (ptr != nullptr) { +// Alloc::deallocate(ptr); +// ptr = nullptr; +// } +// } + +// T* release() { T* v = ptr; ptr = nullptr; return v; } + +// private: +// T* ptr; +// }; + template < typename T, typename Alloc = rmemory_allocator > class vector { Alloc x0_allocator; @@ -36,6 +52,7 @@ public: } else { x0_allocator.allocate(xc_items, sz); } + // rstl::uninitialized_copy_n(other.data(), x4_count, data()); rstl::uninitialized_copy_n(data(), other.data(), x4_count); } } diff --git a/include/static_assert.hpp b/include/static_assert.hpp index d6af1242..3e28d5e6 100644 --- a/include/static_assert.hpp +++ b/include/static_assert.hpp @@ -1,19 +1,11 @@ // C++98 static assert -template < bool expr > -struct do_static_assert; - -template <> -struct do_static_assert< true > { - static const char test; -}; - struct false_type { - static const bool value = false; + static const int value = 0; }; struct true_type { - static const bool value = true; + static const int value = 1; }; template < int A, int B > @@ -27,7 +19,7 @@ struct check_sizeof : _n_is_equal< sizeof(T), N > {}; #ifdef __MWERKS__ #define CHECK_SIZEOF(cls, size) \ - static void cls##_check() { do_static_assert< check_sizeof< cls, size >::value >::test; } + extern int cls##_check[check_sizeof< cls, size >::value]; #else #define CHECK_SIZEOF(cls, size) #endif \ No newline at end of file diff --git a/libc/stdio.h b/libc/stdio.h index 8ddb6ede..8e6872ba 100644 --- a/libc/stdio.h +++ b/libc/stdio.h @@ -12,7 +12,9 @@ extern "C" { typedef unsigned long __file_handle; typedef unsigned long fpos_t; +#ifndef __cplusplus typedef unsigned short wchar_t; +#endif enum __file_kinds { __closed_file, __disk_file, __console_file, __unavailable_file }; enum __file_orientation { __unoriented, __char_oriented, __wide_oriented }; diff --git a/src/Dolphin/dsp/dsp.c b/src/Dolphin/dsp/dsp.c index a7030103..bb4f204b 100644 --- a/src/Dolphin/dsp/dsp.c +++ b/src/Dolphin/dsp/dsp.c @@ -1,7 +1,7 @@ -#include "Dolphin/dsp.h" -#include "Dolphin/os.h" +#include "dolphin/dsp.h" +#include "dolphin/os.h" -#include "Dolphin/dsp_regs.h" +#include "dolphin/dsp_regs.h" #ifdef __cplusplus extern "C" { diff --git a/src/Dolphin/os/__start.c b/src/Dolphin/os/__start.c index e1164178..ff16adc1 100644 --- a/src/Dolphin/os/__start.c +++ b/src/Dolphin/os/__start.c @@ -1,4 +1,4 @@ -#include "Dolphin/__start.h" +#include "dolphin/__start.h" void __check_pad3(void) { if ((Pad3Button & 0x0eef) == 0x0eef) { diff --git a/src/Kyoto/Basics/CSWDataDolphin.cpp b/src/Kyoto/Basics/CSWDataDolphin.cpp index 94841eb7..674695a9 100644 --- a/src/Kyoto/Basics/CSWDataDolphin.cpp +++ b/src/Kyoto/Basics/CSWDataDolphin.cpp @@ -1,6 +1,6 @@ #include "Kyoto/Basics/CStopwatch.hpp" -#include "Dolphin/os.h" +#include "dolphin/os.h" void CStopwatch::CSWData::Wait(f32 v) const { OSTime duration = OSSecondsToTicks(v); diff --git a/src/MetroidPrime/CActor.cpp b/src/MetroidPrime/CActor.cpp index 99fd0b23..986566dc 100644 --- a/src/MetroidPrime/CActor.cpp +++ b/src/MetroidPrime/CActor.cpp @@ -2,6 +2,7 @@ #include "MetaRender/CCubeRenderer.hpp" #include "MetroidPrime/CActorLights.hpp" +#include "MetroidPrime/CActorModelParticles.hpp" #include "MetroidPrime/CActorParameters.hpp" #include "MetroidPrime/CAnimData.hpp" #include "MetroidPrime/CGameArea.hpp" @@ -15,8 +16,12 @@ #include "Kyoto/Audio/CAudioSys.hpp" #include "Kyoto/Audio/CSfxManager.hpp" +#include "Kyoto/CTimeProvider.hpp" #include "Kyoto/Graphics/CGraphics.hpp" #include "Kyoto/Math/CFrustumPlanes.hpp" +#include "Kyoto/Math/CMath.hpp" + +#include "rstl/math.hpp" static CMaterialList MakeActorMaterialList(const CMaterialList& in, const CActorParameters& params) { CMaterialList ret = in; @@ -194,11 +199,6 @@ void CActor::CalculateRenderBounds() { void CActor::SetModelData(const CModelData& modelData) { x64_modelData = modelData.IsNull() ? nullptr : new CModelData(modelData); } -// Unreferenced -extern "C" { -void sub_8005502c() {} -} - // TODO nonmatching void CActor::PreRender(CStateManager& mgr, const CFrustumPlanes& planes) { if (HasModelData()) { @@ -215,7 +215,8 @@ void CActor::PreRender(CStateManager& mgr, const CFrustumPlanes& planes) { lightsDirty = true; } - if (GetShadowDirty() && GetDrawShadow() && HasShadow()) { + // TODO why doesn't GetDrawShadow() work? + if (GetShadowDirty() && xe5_24_shadowEnabled && HasShadow()) { Shadow()->Calculate(GetModelData()->GetBounds(), GetTransform(), mgr); SetShadowDirty(false); } @@ -225,11 +226,15 @@ void CActor::PreRender(CStateManager& mgr, const CFrustumPlanes& planes) { if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::kPV_Thermal) { ActorLights()->BuildConstantAmbientLighting(); } else { - if (lightsDirty) { - TAreaId aid = x4_areaId; - if (aid != kInvalidAreaId && mgr.GetWorld()->IsAreaValid(aid) && - ActorLights()->BuildAreaLightList(mgr, *mgr.GetWorld()->GetArea(aid), bounds)) { - xe7_28_worldLightingDirty = false; + if (lightsDirty == true) { + if (x4_areaId != kInvalidAreaId) { + TAreaId aid = x4_areaId; + if (mgr.GetWorld()->IsAreaValid(aid)) { + const CGameArea* area = mgr.GetWorld()->GetArea(aid); + if (ActorLights()->BuildAreaLightList(mgr, *area, bounds)) { + xe7_28_worldLightingDirty = false; + } + } } } ActorLights()->BuildDynamicLightList(mgr, bounds); @@ -244,7 +249,8 @@ void CActor::PreRender(CStateManager& mgr, const CFrustumPlanes& planes) { SetPreRenderHasMoved(false); SetShadowDirty(true); } - if (GetShadowDirty() && GetDrawShadow() && HasShadow()) { + // TODO why doesn't GetDrawShadow() work? + if (GetShadowDirty() && xe5_24_shadowEnabled && HasShadow()) { if (planes.BoxInFrustumPlanes(GetShadow()->GetMaxShadowBox(GetModelData()->GetBounds(GetTransform()))) == true) { Shadow()->Calculate(GetModelData()->GetBounds(), GetTransform(), mgr); SetShadowDirty(false); @@ -295,6 +301,77 @@ void CActor::EnsureRendered(const CStateManager& mgr) const { void CActor::DrawTouchBounds() const {} bool CActor::CanRenderUnsorted(const CStateManager& mgr) const { - // if (GetModelData()->IsNull() && ) - return false; + bool result = HasAnimation(); + if (result && GetAnimationData()->GetParticleDB().AreAnySystemsDrawnWithModel() && GetRenderParticleDatabaseInside()) { + result = false; + } else { + result = xe5_30_renderUnsorted || IsModelOpaque(mgr); + } + return result; } + +void CActor::Render(const CStateManager& mgr) const { + if (GetModelData() && !NullModel()) { + bool renderPrePostParticles = GetRenderParticleDatabaseInside() && HasAnimation(); + if (renderPrePostParticles) { + x64_modelData->GetAnimationData()->GetParticleDB().RenderSystemsToBeDrawnFirst(); + } + + if (xe7_27_enableRender) { + if (xe5_31_pointGeneratorParticles) { + mgr.SetupParticleHook(*this); + } + if (xe5_29_globalTimeProvider) { + RenderInternal(mgr); + } else { + const f32 timeSince = CGraphics::GetSecondsMod900() - xbc_time; + const f32 tpTime = CMath::FastFmod(timeSince, 900.f); + CTimeProvider tp(tpTime); + RenderInternal(mgr); + } + if (xe5_31_pointGeneratorParticles) { + CSkinnedModel::ClearPointGeneratorFunc(); + mgr.GetActorModelParticles()->Render(mgr, *this); + } + } + + if (renderPrePostParticles) { + x64_modelData->GetAnimationData()->GetParticleDB().RenderSystemsToBeDrawnLast(); + } + } + DrawTouchBounds(); +} + +void CActor::RenderInternal(const CStateManager& mgr) const { + CModelData::EWhichModel which = CModelData::GetRenderingModel(mgr); + if (which == CModelData::kWM_ThermalHot) { + if (GetModelData()->GetSortThermal()) { + u8 addMag; + u8 mulMag = 255; + if (xd0_damageMag <= 1.f) { + mulMag = CCast::ToUint8(xd0_damageMag * 255.f); + addMag = 0.f; + } else if (xd0_damageMag < 2.f) { + addMag = CCast::ToUint8((xd0_damageMag - 1.f) * 255.f); + } else { + addMag = 255; + } + + const u8 rgb = mulMag * xb4_drawFlags.GetColor().GetAlphau8(); + CColor mulColor(rgb, rgb, rgb, xb4_drawFlags.GetColor().GetAlphau8()); + CColor addColor(addMag, addMag, addMag, xb4_drawFlags.GetColor().GetAlphau8() / 4); + GetModelData()->RenderThermal(x34_transform, mulColor, addColor, xb4_drawFlags); + return; + } else if (mgr.GetThermalColdScale2() > 0.0001f && xb4_drawFlags.GetTrans() == 0) { + const f32 scale = rstl::min_val< f32 >((mgr.GetThermalColdScale2() + mgr.GetThermalColdScale1()) * mgr.GetThermalColdScale2(), + mgr.GetThermalColdScale2()); + const f32 rgbf = CMath::Clamp(0.f, scale * 255.f, 255.f); + const u8 rgb = CCast::ToUint8(rgbf); + CColor color(rgb, rgb, rgb, 255); + CModelFlags flags(xb4_drawFlags, CModelFlags::kT_Two, color); + GetModelData()->Render(which, x34_transform, x90_actorLights.get(), flags); + return; + } + } + GetModelData()->Render(which, x34_transform, x90_actorLights.get(), xb4_drawFlags); +}; \ No newline at end of file diff --git a/src/MetroidPrime/main.cpp b/src/MetroidPrime/main.cpp index 6057ba6f..1f1bb154 100644 --- a/src/MetroidPrime/main.cpp +++ b/src/MetroidPrime/main.cpp @@ -1,38 +1,60 @@ #include "MetroidPrime/CMain.hpp" -#include "Dolphin/os.h" -#include "Dolphin/OSCache.h" -#include "Dolphin/PPCArch.h" +#include "stdint.h" +#include "stdio.h" +#include "stdlib.h" +#include "dolphin/PPCArch.h" +#include "dolphin/ar.h" +#include "dolphin/arq.h" +#include "dolphin/dvd.h" +#include "dolphin/os.h" +#include "dolphin/os/OSCache.h" +#include "dolphin/os/OSMemory.h" +#include "dolphin/os/OSMutex.h" +#include "dolphin/pad.h" + +#include "Kyoto/Alloc/CMemory.hpp" +#include "Kyoto/Audio/CDSPStreamManager.hpp" #include "Kyoto/Audio/CSfxManager.hpp" #include "Kyoto/Audio/CStreamAudioManager.hpp" #include "Kyoto/Basics/CBasics.hpp" #include "Kyoto/CARAMManager.hpp" #include "Kyoto/CARAMToken.hpp" +#include "Kyoto/CFrameDelayedKiller.hpp" #include "Kyoto/CMemoryCardSys.hpp" #include "Kyoto/CPakFile.hpp" #include "Kyoto/CResFactory.hpp" #include "Kyoto/CSimplePool.hpp" #include "Kyoto/Graphics/CGraphics.hpp" +#include "Kyoto/Graphics/CTexture.hpp" +#include "Kyoto/Particles/CElementGen.hpp" #include "Kyoto/Streams/CMemoryInStream.hpp" +#include "Kyoto/Streams/CZipInputStream.hpp" #include "Kyoto/Text/CStringTable.hpp" #include "MetaRender/CCubeRenderer.hpp" +#include "MetroidPrime/CAnimData.hpp" +#include "MetroidPrime/CDecalManager.hpp" +#include "MetroidPrime/CEnvFxManager.hpp" #include "MetroidPrime/CGameGlobalObjects.hpp" #include "MetroidPrime/CInGameTweakManager.hpp" +#include "MetroidPrime/CMemoryCard.hpp" +#include "MetroidPrime/CSplashScreen.hpp" #include "MetroidPrime/Factories/CCharacterFactoryBuilder.hpp" #include "MetroidPrime/Player/CGameOptions.hpp" #include "MetroidPrime/Player/CGameState.hpp" #include "MetroidPrime/Player/CPlayerState.hpp" #include "MetroidPrime/Player/CSystemOptions.hpp" +#include "MetroidPrime/ScriptObjects/CScriptMazeNode.hpp" #include "MetroidPrime/Tweaks/CTweakGame.hpp" +#include "MetroidPrime/Tweaks/CTweakPlayer.hpp" extern "C" { -// something pad -void PADRecalibrate(u32); -// something gx void sub_8036ccfc(); // part of CMain but lazy void nullsub_2(CMain*); +// RAssertDolphin +void SetErrorHandlers(); } CResFactory* gpResourceFactory; @@ -44,7 +66,7 @@ CStringTable* gpStringTable; CMain* gpMain; unkptr gpController; CGameState* gpGameState; -CMemoryCardSys* gpMemoryCard; +CMemoryCard* gpMemoryCard; CInGameTweakManager* gpTweakManager; unkptr gpDefaultFont; unkptr lbl_805A8C50; @@ -52,9 +74,325 @@ unkptr lbl_805A8C54; bool lbl_805A8C58; u32 sARAMMemArray[2]; +#define GRAPHICS_FIFO_SIZE 0x60000 +static u8 sGraphicsFifo[GRAPHICS_FIFO_SIZE]; +static u8 sMainSpace[sizeof(CMain)]; + +const char* s0 = "Misc_AGSC"; +const char* s1 = "MiscSamus_AGSC"; +const char* s2 = "UI_AGSC"; +const char* s3 = "Weapons_AGSC"; +const char* s4 = "ZZZ_AGSC"; +const char* s5 = "??(??)"; +const char* s6 = ""; +const char* s7 = "%d"; +const char* st8 = ".pak"; +const char* s9 = "AudioTweaks"; +const char* s10 = "Loaded audio tweaks from memory card\n"; +const char* s11 = "FAILED to load audio tweaks from memory card\n"; +const char* s12 = "aram:Tweaks"; +const char* s13 = "NoARAM"; +const char* s14 = "AudioGrp"; +const char* s15 = "aram:MiscData"; +const char* st16 = "aram:SamusGun"; +const char* s17 = "aram:TestAnim"; +const char* s18 = "aram:SamGunFx"; +const char* s19 = "aram:MidiData"; +const char* s20 = "aram:GGuiSys"; +const char* s21 = "sound_lookup"; +const char* s22 = "INFINITE LOOP"; +const char* s23 = "STRG_Main"; +const char* s24 = "Initializing renderer...\n"; +const char* s25 = "Stack usage: %d bytes (%dk)\n"; +const char* s26 = "Protecting stack... "; +const char* s27 = "Stack: 0x%8.8x down to 0x%8.8x\n"; +const char* s28 = "Metaforce"; + // sdata bool lbl_805A6BC0; +int main(int argc, char** argv) { + DVDSetAutoFatalMessaging(TRUE); + SetErrorHandlers(); + CMain* main = reinterpret_cast< CMain* >(&sMainSpace); + new (&sMainSpace) CMain(); + gpMain->RsMain(argc, argv); + main->~CMain(); + return 0; +} + +CMain::CMain() +: x0_osContext(true, true) +, x6c_unk(this) +, x6d_memorySys(InitOsContext(), CMemorySys::GetGameAllocator()) +, xe8_(0.0) +, x118_(0.f) +, x11c_(0.f) +, x120_(0.f) +, x124_(0.f) +, x128_gameGlobalObjects(nullptr) +, x12c_flowState(kFS_Default) +, x130_frameTimes(0xF4240) +, x15c_frameTimeIdx(0) +, x160_24_finished(false) +, x160_25_mfGameBuilt(false) +, x160_26_screenFading(false) +, x160_27_(false) +, x160_28_manageCard(false) +, x160_29_(false) +, x160_30_(false) +, x160_31_cardBusy(false) +, x161_24_gameFrameDrawn(false) +, x164_(nullptr) { + gpMain = this; +} + +CMain::~CMain() {} + +#define ALIGN_UP(x, a) (((x) + (a - 1)) & ~(a - 1)) +#define UNUSED_STACK_VAL 0x7337D00D + +void CMain::InitializeSubsystems() { + ARInit(sARAMMemArray, 2); + ARAlloc(0x5fc000); + CARAMManager::PreInitializeAlloc(0x5fc000); + ARQInit(); + OSThread* thread = OSGetCurrentThread(); + printf("Protecting stack... "); + u8* stackEnd = reinterpret_cast< u8* >(ALIGN_UP(reinterpret_cast< uintptr_t >(thread->stackEnd), 0x400)); + u8* stackBase = thread->stackBase; + OSProtectRange(OS_PROTECT_CHAN3, stackEnd, 0x400, OS_PROTECT_CONTROL_NONE); + + u8* end = stackBase - 0x2000; + u8* ptr = stackEnd + 0x400; + for (; ptr < end; ptr += 4) { + *reinterpret_cast< int* >(ptr) = UNUSED_STACK_VAL; + } + + DCFlushRange(stackEnd + 0x400, static_cast< u32 >(end - (stackEnd + 0x400))); + printf("Stack: 0x%8.8x down to 0x%8.8x\n", thread->stackBase, thread->stackEnd); + CElementGen::Initialize(); + CAnimData::InitializeCache(); + CARAMManager::Initialize(0x800); + CDecalManager::Initialize(); + CFrameDelayedKiller::Initialize(); +} + +void CMain::ShutdownSubsystems() { + CFrameDelayedKiller::ShutDown(); + CDecalManager::ShutDown(); + CElementGen::ShutDown(); + CAnimData::FreeCache(); + + OSThread* thread = OSGetCurrentThread(); + u8* stackEnd = reinterpret_cast< u8* >(ALIGN_UP(reinterpret_cast< uintptr_t >(thread->stackEnd), 0x400)); + u8* stackBase = thread->stackBase; + + u8* ptr = stackEnd + 0x400; + u8* end = stackBase - 0x2000; + for (; ptr < end; ptr += 4) { + if (*reinterpret_cast< u32* >(ptr) != UNUSED_STACK_VAL) { + break; + } + } + OSReport("Stack usage: %d bytes (%dk)\n", (int)(stackBase - ptr), ((u32)((int)stackBase - (int)ptr) / 1024)); +} + +CGameGlobalObjects::CGameGlobalObjects(COsContext& osContext, CMemorySys& memorySys) +: xcc_simplePool(x4_resFactory) +, x130_graphicsSys(osContext, memorySys, GRAPHICS_FIFO_SIZE, sGraphicsFifo) +, x134_gameState(new CGameState()) +, x138_(0) +, x14c_renderer(0) +, x150_inGameTweakManager(new CInGameTweakManager()) +, x154_defaultFont(LoadDefaultFont()) { + gpResourceFactory = &x4_resFactory; + gpSimplePool = &xcc_simplePool; + gpCharacterFactoryBuilder = &xec_characterFactoryBuilder; + gpGameState = x134_gameState.get(); + gpTweakManager = x150_inGameTweakManager.get(); + gpDefaultFont = &x154_defaultFont; +} + +const u8 sDefaultFontData[] = { + 0x78, 0xDA, 0x8D, 0x57, 0x5B, 0x6F, 0x54, 0x55, 0x14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xB3, 0xE2, 0x7D, 0x55, 0x67, 0xD3, 0xC3, 0x15, 0xCF, 0x11, 0x1B, 0x03, 0xFF, 0x88, 0x40, + 0x7C, 0x9C, 0xFF, 0xF5, 0x7C, 0x3D, 0x5F, 0xCF, 0x7F, 0xFB, 0xFC, 0x01, 0x92, 0xD9, 0xBE, 0x26, +}; + +CRasterFont* CGameGlobalObjects::LoadDefaultFont() { + CZipInputStream fontDataStream(new CMemoryInStream(sDefaultFontData, sizeof(sDefaultFontData))); + CRasterFont* font = new CRasterFont(fontDataStream, nullptr); + CZipInputStream fontTextureStream(new CMemoryInStream(sDefaultFontTexture, sizeof(sDefaultFontTexture))); + font->SetTexture(new CTexture(fontTextureStream, CTexture::kAM_Zero, CTexture::kBK_Zero)); + return font; +} + +void CGameGlobalObjects::PostInitialize(COsContext& osContext, CMemorySys& memorySys) { + AddPaksAndFactories(); + LoadStringTable(); + printf("Initializing renderer...\n"); + x14c_renderer = Renderer::AllocateRenderer(xcc_simplePool, osContext, memorySys, x4_resFactory); + gpRender = reinterpret_cast< CCubeRenderer* >(x14c_renderer.get()); + CEnvFxManager::Initialize(); + CScriptMazeNode::LoadMazeSeeds(); +} + +void CGameGlobalObjects::LoadStringTable() { + x13c_stringTable = gpSimplePool->GetObj("STRG_Main"); + gpStringTable = **x13c_stringTable; +} + +CGameArchitectureSupport::CGameArchitectureSupport(COsContext& osContext) +: x0_audioSys(0, 0, 0, 0, 0x5fc000) +, x30_inputGenerator(&osContext, gpTweakPlayer->GetLeftAnalogMax(), gpTweakPlayer->GetRightAnalogMax()) +, x44_guiSys(gpResourceFactory, gpSimplePool, CGuiSys::kUM_Zero) +, x78_gameFrameCount(0) +, x7c_(0.f) +, x80_(0.f) +, x84_(0.f) +, x88_(2) +, x90_(0) +, x94_(0) +, x98_(0) { + CAudioSys::SysSetVolume(0x7F, 0, 0xFF); + CAudioSys::SetDefaultVolumeScale(0x75); + CAudioSys::SetVolumeScale(CAudioSys::GetDefaultVolumeScale()); + CDSPStreamManager::Initialize(); + CStreamAudioManager::SetMusicVolume(0x7F); + CAudioSys::TrkSetSampleRate(kTSR_One); + gpMain->SetMaxSpeed(false); + gpMain->ResetGameState(); + if (!gpTweakGame->GetSplashScreensDisabled()) { + x58_ioWinMgr.AddIOWin(new CSplashScreen(CSplashScreen::Nintendo), 1000, 10000); + } + // TODO +} + // 80003658 void CMain::UpdateStreamedAudio() { CStreamAudioManager::Update(1.f / 60.f); } @@ -265,7 +603,7 @@ int CMain::RsMain(int argc, const char* const* argv) { needsReset = true; } if (needsReset) { - x12c_flowState = 5; // Default + x12c_flowState = kFS_Default; CStreamAudioManager::StopAll(); PADRecalibrate(0xf0000000); CGraphics::SetIsBeginSceneClearFb(true);