From dc221b4795f415c8500740dd33e2243f91d527a6 Mon Sep 17 00:00:00 2001 From: Elijah Thomas <42302100+elijah-thomas774@users.noreply.github.com> Date: Tue, 1 Oct 2024 20:24:25 -0400 Subject: [PATCH] Misc Egg (#37) * EGG: Archive, DvdFile, DvdRipper * start eggStream * FrmHeap and AssertHeap OK * progress on EggController * port in WPAD stuff * update WPAD/WUD/KPAD/SC symbols * eggController OK * bytematch more CoreController virtual funcs * eggDecomp/eggStreamDecomp Ok * eggDvdRipper OK * EGG gfx splits * Finished Splitting EGG * create egg Files * eggDecomp.h -> eggStreamDecomp.h * Revert some format changes --- .clang-format | 41 +- .vscode/settings.json | 3 +- config/SOUE01/splits.txt | 152 +++- config/SOUE01/symbols.txt | 648 +++++++------- configure.py | 73 +- include/MSL_C/stdint.h | 14 + include/common.h | 4 +- include/context_bte.h | 978 ++++++++++++++++++++++ include/egg/audio/eggAudioArcPlayerMgr.h | 10 + include/egg/audio/eggAudioHeapMgr.h | 10 + include/egg/audio/eggAudioMgr.h | 7 +- include/egg/audio/eggAudioRmtSpeakerMgr.h | 6 + include/egg/audio/eggAudioSystem.h | 6 + include/egg/audio/eggAudioUtility.h | 6 + include/egg/core/eggAllocator.h | 11 +- include/egg/core/eggArchive.h | 61 +- include/egg/core/eggAssertHeap.h | 29 +- include/egg/core/eggAsyncDisplay.h | 21 +- include/egg/core/eggColorFader.h | 33 +- include/egg/core/eggController.h | 260 +++--- include/egg/core/eggDecomp.h | 85 -- include/egg/core/eggDisplay.h | 36 +- include/egg/core/eggDisposer.h | 9 +- include/egg/core/eggDvdFile.h | 32 +- include/egg/core/eggDvdRipper.h | 46 +- include/egg/core/eggExpHeap.h | 31 +- include/egg/core/eggFader.h | 12 +- include/egg/core/eggFrmHeap.h | 31 +- include/egg/core/eggGraphicsFifo.h | 13 +- include/egg/core/eggHeap.h | 83 +- include/egg/core/eggStreamDecomp.h | 116 +++ include/egg/core/eggSystem.h | 29 +- include/egg/core/eggThread.h | 33 +- include/egg/core/eggUnk.h | 2 + include/egg/core/eggVideo.h | 15 +- include/egg/core/eggXfb.h | 8 +- include/egg/core/eggXfbManager.h | 9 +- include/egg/gfx/eggCamera.h | 6 + include/egg/gfx/eggCapTexture.h | 6 + include/egg/gfx/eggCpuTexture.h | 6 + include/egg/gfx/eggDrawPathBase.h | 6 + include/egg/gfx/eggDrawPathDOF.h | 6 + include/egg/gfx/eggDrawPathUnk1.h | 6 + include/egg/gfx/eggDrawPathUnk2.h | 6 + include/egg/gfx/eggFrustum.h | 8 +- include/egg/gfx/eggG3DUtility.h | 6 + include/egg/gfx/eggGXUtility.h | 6 + include/egg/gfx/eggGlobalDrawState.h | 6 + include/egg/gfx/eggIScnProc.h | 6 + include/egg/gfx/eggLight.h | 1 + include/egg/gfx/eggLightTexture.h | 6 + include/egg/gfx/eggLightTextureMgr.h | 6 + include/egg/gfx/eggModelEx.h | 6 + include/egg/gfx/eggPalette.h | 6 + include/egg/gfx/eggPostEffectBase.h | 6 + include/egg/gfx/eggPostEffectBlur.h | 6 + include/egg/gfx/eggPostEffectMask.h | 6 + include/egg/gfx/eggPostEffectMaskDOF.h | 6 + include/egg/gfx/eggPostEffectSimple.h | 6 + include/egg/gfx/eggPostEffectUnk1.h | 6 + include/egg/gfx/eggPostEffectUnk2.h | 6 + include/egg/gfx/eggScreen.h | 8 +- include/egg/gfx/eggScreenEffectBase.h | 6 + include/egg/gfx/eggScreenEffectBlur.h | 6 + include/egg/gfx/eggStateEfb.h | 6 + include/egg/gfx/eggTextureBuffer.h | 6 + include/egg/gfx/eggUnk1.h | 6 + include/egg/math/eggMath.h | 8 +- include/egg/math/eggMatrix.h | 80 +- include/egg/math/eggQuat.h | 1 + include/egg/math/eggVector.h | 92 +- include/egg/prim/eggAssert.h | 18 +- include/egg/prim/eggBinary.h | 2 + include/egg/prim/eggBitFlag.h | 32 +- include/egg/prim/eggBuffer.h | 33 +- include/egg/util/eggException.h | 6 + include/m/m_dvd.h | 18 +- include/rvl/CX/cx.h | 27 +- include/rvl/KPAD.h | 12 + include/rvl/KPAD/KPAD.h | 14 + include/rvl/OS/OSTime.h | 15 +- include/rvl/PAD/Pad.h | 3 + include/rvl/WPAD.h | 1 + include/rvl/WPAD/WPAD.h | 639 +++++++++++++- include/rvl/WPAD/WPADMem.h | 57 ++ include/rvl/WPAD/WUD.h | 108 +++ src/egg/audio/eggAudioArcPlayerMgr.cpp | 3 + src/egg/audio/eggAudioHeapMgr.cpp | 3 + src/egg/audio/eggAudioMgr.cpp | 3 + src/egg/audio/eggAudioRmtSpeakerMgr.cpp | 3 + src/egg/audio/eggAudioSystem.cpp | 3 + src/egg/audio/eggAudioUtility.cpp | 3 + src/egg/core/eggAllocator.cpp | 11 +- src/egg/core/eggArchive.cpp | 332 ++++++++ src/egg/core/eggAssertHeap.cpp | 126 +++ src/egg/core/eggAsyncDisplay.cpp | 11 +- src/egg/core/eggColorFader.cpp | 9 +- src/egg/core/eggController.cpp | 532 ++++++++---- src/egg/core/eggDisplay.cpp | 69 +- src/egg/core/eggDvdFile.cpp | 101 +++ src/egg/core/eggDvdRipper.cpp | 188 +++++ src/egg/core/eggExpHeap.cpp | 32 +- src/egg/core/eggFrmHeap.cpp | 112 +++ src/egg/core/eggHeap.cpp | 6 +- src/egg/core/eggStreamDecomp.cpp | 209 +++++ src/egg/core/eggThread.cpp | 7 +- src/egg/core/eggVideo.cpp | 543 ++++++------ src/egg/core/eggXfb.cpp | 1 - src/egg/gfx/eggCamera.cpp | 3 + src/egg/gfx/eggCapTexture.cpp | 3 + src/egg/gfx/eggCpuTexture.cpp | 3 + src/egg/gfx/eggDrawGX.cpp | 3 + src/egg/gfx/eggDrawPathBase.cpp | 3 + src/egg/gfx/eggDrawPathDOF.cpp | 3 + src/egg/gfx/eggDrawPathUnk1.cpp | 3 + src/egg/gfx/eggDrawPathUnk2.cpp | 3 + src/egg/gfx/eggFog.cpp | 3 + src/egg/gfx/eggFrustum.cpp | 3 + src/egg/gfx/eggG3DUtility.cpp | 3 + src/egg/gfx/eggGXUtility.cpp | 3 + src/egg/gfx/eggGfxEngine.cpp | 3 + src/egg/gfx/eggGlobalDrawState.cpp | 3 + src/egg/gfx/eggIScnProc.cpp | 3 + src/egg/gfx/eggLight.cpp | 3 + src/egg/gfx/eggLightTexture.cpp | 3 + src/egg/gfx/eggLightTextureMgr.cpp | 3 + src/egg/gfx/eggModelEx.cpp | 3 + src/egg/gfx/eggPalette.cpp | 3 + src/egg/gfx/eggPostEffectBase.cpp | 3 + src/egg/gfx/eggPostEffectBlur.cpp | 3 + src/egg/gfx/eggPostEffectMask.cpp | 3 + src/egg/gfx/eggPostEffectMaskDOF.cpp | 3 + src/egg/gfx/eggPostEffectSimple.cpp | 3 + src/egg/gfx/eggPostEffectUnk1.cpp | 3 + src/egg/gfx/eggPostEffectUnk2.cpp | 3 + src/egg/gfx/eggScreen.cpp | 3 + src/egg/gfx/eggScreenEffectBase.cpp | 3 + src/egg/gfx/eggScreenEffectBlur.cpp | 3 + src/egg/gfx/eggStateEfb.cpp | 3 + src/egg/gfx/eggStateGX.cpp | 3 + src/egg/gfx/eggTexture.cpp | 3 + src/egg/gfx/eggTextureBuffer.cpp | 3 + src/egg/gfx/eggUnk1.cpp | 3 + src/egg/math/eggVector.cpp | 2 +- src/egg/util/eggException.cpp | 1 + src/m/m3d/m_shadow.cpp | 31 +- src/m/m_dvd.cpp | 48 +- src/m/m_pad.cpp | 29 +- 148 files changed, 5294 insertions(+), 1537 deletions(-) create mode 100644 include/MSL_C/stdint.h create mode 100644 include/context_bte.h create mode 100644 include/egg/audio/eggAudioRmtSpeakerMgr.h create mode 100644 include/egg/audio/eggAudioSystem.h create mode 100644 include/egg/audio/eggAudioUtility.h delete mode 100644 include/egg/core/eggDecomp.h create mode 100644 include/egg/core/eggStreamDecomp.h create mode 100644 include/egg/gfx/eggCamera.h create mode 100644 include/egg/gfx/eggCapTexture.h create mode 100644 include/egg/gfx/eggCpuTexture.h create mode 100644 include/egg/gfx/eggDrawPathBase.h create mode 100644 include/egg/gfx/eggDrawPathDOF.h create mode 100644 include/egg/gfx/eggDrawPathUnk1.h create mode 100644 include/egg/gfx/eggDrawPathUnk2.h create mode 100644 include/egg/gfx/eggG3DUtility.h create mode 100644 include/egg/gfx/eggGXUtility.h create mode 100644 include/egg/gfx/eggGlobalDrawState.h create mode 100644 include/egg/gfx/eggIScnProc.h create mode 100644 include/egg/gfx/eggLightTexture.h create mode 100644 include/egg/gfx/eggLightTextureMgr.h create mode 100644 include/egg/gfx/eggModelEx.h create mode 100644 include/egg/gfx/eggPalette.h create mode 100644 include/egg/gfx/eggPostEffectBase.h create mode 100644 include/egg/gfx/eggPostEffectBlur.h create mode 100644 include/egg/gfx/eggPostEffectMask.h create mode 100644 include/egg/gfx/eggPostEffectMaskDOF.h create mode 100644 include/egg/gfx/eggPostEffectSimple.h create mode 100644 include/egg/gfx/eggPostEffectUnk1.h create mode 100644 include/egg/gfx/eggPostEffectUnk2.h create mode 100644 include/egg/gfx/eggScreenEffectBase.h create mode 100644 include/egg/gfx/eggScreenEffectBlur.h create mode 100644 include/egg/gfx/eggStateEfb.h create mode 100644 include/egg/gfx/eggTextureBuffer.h create mode 100644 include/egg/gfx/eggUnk1.h create mode 100644 include/egg/util/eggException.h create mode 100644 include/rvl/KPAD.h create mode 100644 include/rvl/WPAD/WPADMem.h create mode 100644 include/rvl/WPAD/WUD.h create mode 100644 src/egg/audio/eggAudioArcPlayerMgr.cpp create mode 100644 src/egg/audio/eggAudioHeapMgr.cpp create mode 100644 src/egg/audio/eggAudioMgr.cpp create mode 100644 src/egg/audio/eggAudioRmtSpeakerMgr.cpp create mode 100644 src/egg/audio/eggAudioSystem.cpp create mode 100644 src/egg/audio/eggAudioUtility.cpp create mode 100644 src/egg/core/eggArchive.cpp create mode 100644 src/egg/core/eggAssertHeap.cpp create mode 100644 src/egg/core/eggDvdFile.cpp create mode 100644 src/egg/core/eggDvdRipper.cpp create mode 100644 src/egg/core/eggFrmHeap.cpp create mode 100644 src/egg/core/eggStreamDecomp.cpp create mode 100644 src/egg/gfx/eggCamera.cpp create mode 100644 src/egg/gfx/eggCapTexture.cpp create mode 100644 src/egg/gfx/eggCpuTexture.cpp create mode 100644 src/egg/gfx/eggDrawGX.cpp create mode 100644 src/egg/gfx/eggDrawPathBase.cpp create mode 100644 src/egg/gfx/eggDrawPathDOF.cpp create mode 100644 src/egg/gfx/eggDrawPathUnk1.cpp create mode 100644 src/egg/gfx/eggDrawPathUnk2.cpp create mode 100644 src/egg/gfx/eggFog.cpp create mode 100644 src/egg/gfx/eggFrustum.cpp create mode 100644 src/egg/gfx/eggG3DUtility.cpp create mode 100644 src/egg/gfx/eggGXUtility.cpp create mode 100644 src/egg/gfx/eggGfxEngine.cpp create mode 100644 src/egg/gfx/eggGlobalDrawState.cpp create mode 100644 src/egg/gfx/eggIScnProc.cpp create mode 100644 src/egg/gfx/eggLight.cpp create mode 100644 src/egg/gfx/eggLightTexture.cpp create mode 100644 src/egg/gfx/eggLightTextureMgr.cpp create mode 100644 src/egg/gfx/eggModelEx.cpp create mode 100644 src/egg/gfx/eggPalette.cpp create mode 100644 src/egg/gfx/eggPostEffectBase.cpp create mode 100644 src/egg/gfx/eggPostEffectBlur.cpp create mode 100644 src/egg/gfx/eggPostEffectMask.cpp create mode 100644 src/egg/gfx/eggPostEffectMaskDOF.cpp create mode 100644 src/egg/gfx/eggPostEffectSimple.cpp create mode 100644 src/egg/gfx/eggPostEffectUnk1.cpp create mode 100644 src/egg/gfx/eggPostEffectUnk2.cpp create mode 100644 src/egg/gfx/eggScreen.cpp create mode 100644 src/egg/gfx/eggScreenEffectBase.cpp create mode 100644 src/egg/gfx/eggScreenEffectBlur.cpp create mode 100644 src/egg/gfx/eggStateEfb.cpp create mode 100644 src/egg/gfx/eggStateGX.cpp create mode 100644 src/egg/gfx/eggTexture.cpp create mode 100644 src/egg/gfx/eggTextureBuffer.cpp create mode 100644 src/egg/gfx/eggUnk1.cpp create mode 100644 src/egg/util/eggException.cpp diff --git a/.clang-format b/.clang-format index 884e5c20..7912b862 100644 --- a/.clang-format +++ b/.clang-format @@ -1,16 +1,23 @@ AccessModifierOffset: -4 -AlignAfterOpenBracket: DontAlign +AlignAfterOpenBracket: BlockIndent +AlignArrayOfStructures: Right AlignConsecutiveAssignments: None AlignConsecutiveBitFields: None AlignConsecutiveDeclarations: None AlignConsecutiveMacros: None -AlignEscapedNewlines: DontAlign -AlignOperands: DontAlign -AllowAllArgumentsOnNextLine: False -AllowAllParametersOfDeclarationOnNextLine: False +AlignConsecutiveShortCaseStatements: + Enabled: true + AcrossEmptyLines: true + AcrossComments: true + AlignCaseColons: false +AlignOperands: AlignAfterOperator +AlignTrailingComments: Always +AlignEscapedNewlines: Right +AllowAllArgumentsOnNextLine: True +AllowAllParametersOfDeclarationOnNextLine: True AllowShortBlocksOnASingleLine: Empty -AllowShortCaseLabelsOnASingleLine: False -AllowShortEnumsOnASingleLine: True +AllowShortCaseLabelsOnASingleLine: True +AllowShortEnumsOnASingleLine: False AllowShortFunctionsOnASingleLine: Empty AllowShortIfStatementsOnASingleLine: Never AllowShortLoopsOnASingleLine: False @@ -20,15 +27,27 @@ AlwaysBreakTemplateDeclarations: Yes BinPackArguments: True BinPackParameters: True BitFieldColonSpacing: Both +BreakBeforeBraces: Custom +BraceWrapping: + AfterCaseLabel: False + AfterClass: False + AfterControlStatement: Never + AfterEnum: False + AfterFunction: False + AfterNamespace: False + AfterUnion: False + AfterExternBlock: False + BeforeCatch: True + BeforeElse: False + BeforeWhile: False BreakBeforeBinaryOperators: None -BreakBeforeBraces: Attach BreakBeforeTernaryOperators: False BreakStringLiterals: True ColumnLimit: 120 -ContinuationIndentWidth: 8 -IncludeBlocks: Preserve +ContinuationIndentWidth: 4 +IncludeBlocks: Regroup IndentAccessModifiers: False -IndentCaseLabels: False +IndentCaseLabels: True IndentGotoLabels: True IndentWidth: 4 InsertBraces: True diff --git a/.vscode/settings.json b/.vscode/settings.json index 000066a6..33737cf2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -29,6 +29,7 @@ "utility": "cpp", "initializer_list": "cpp", "new": "cpp", - "cstdlib": "cpp" + "cstdlib": "cpp", + "xmemory": "cpp" } } diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index f8d9a6cc..bd9b121a 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -1190,23 +1190,24 @@ nw4r/lyt/lyt_util.cpp: egg/core/eggArchive.cpp: .text start:0x80493510 end:0x80494254 - .data start:0x8056E820 end:0x8056E830 - .sbss start:0x80576728 end:0x80576730 - .bss start:0x80673AC8 end:0x80673AD8 + .data start:0x8056E820 end:0x8056E82C + .sdata start:0x80574EC8 end:0x80574ECA + .sbss start:0x80576728 end:0x80576729 + .bss start:0x80673AC8 end:0x80673AD4 egg/core/eggDvdFile.cpp: .text start:0x80494260 end:0x80494678 .data start:0x8056E830 end:0x8056E858 - .sbss start:0x80576730 end:0x80576738 - .bss start:0x80673AD8 end:0x80673AE8 + .sbss start:0x80576730 end:0x80576731 + .bss start:0x80673AD8 end:0x80673AE4 egg/core/eggDvdRipper.cpp: .text start:0x80494680 end:0x80494C80 - .sdata start:0x80574ED0 end:0x80574ED8 - .sbss start:0x80576738 end:0x80576740 + .sdata start:0x80574ED0 end:0x80574ED1 + .sbss start:0x80576738 end:0x8057673C -egg/core/eggStream.cpp: - .text start:0x80494C80 end:0x804952B8 +egg/core/eggStreamDecomp.cpp: + .text start:0x80494C80 end:0x804952C8 .data start:0x8056E858 end:0x8056E8D0 egg/core/eggAllocator.cpp: @@ -1292,6 +1293,7 @@ egg/core/eggController.cpp: .ctors start:0x804DB98C end:0x804DB990 .rodata start:0x804FBA20 end:0x804FBA30 .data start:0x8056EB90 end:0x8056EC88 + .sdata start:0x80574EE8 end:0x80574EEC .sbss start:0x805767A8 end:0x805767C0 .sdata2 start:0x8057F338 end:0x8057F360 .bss start:0x80673B40 end:0x80674C00 @@ -1325,7 +1327,137 @@ egg/prim/eggAssert.cpp: .bss start:0x80674C60 end:0x80674D68 egg/gfx/eggCamera.cpp: - .text start:0x8049C5C0 end:0x8049CAC8 + .text start:0x8049C5C0 end:0x8049CAC0 + +egg/gfx/eggPalette.cpp: + .text start:0x8049CAD0 end:0x8049CB44 + +egg/gfx/eggTexture.cpp: + .text start:0x8049CB50 end:0x8049CFE4 + +egg/gfx/eggUnk1.cpp: + .text start:0x8049CFF0 end:0x8049D7C0 + +egg/gfx/eggCapTexture.cpp: + .text start:0x8049D7C0 end:0x8049D9D0 + +egg/gfx/eggCpuTexture.cpp: + .text start:0x8049DA30 end:0x8049EC94 + +egg/gfx/eggDrawGX.cpp: + .text start:0x8049ECA0 end:0x804A0C24 + .ctors start:0x804DB998 end:0x804DB99C + +egg/gfx/eggDrawPathBase.cpp: + .text start:0x804A0C30 end:0x804A0E98 + +egg/gfx/eggDrawPathUnk1.cpp: + .text start:0x804A0EA0 end:0x804A29B8 + +egg/gfx/eggDrawPathDOF.cpp: + .text start:0x804A29C0 end:0x804A4BE8 + +egg/gfx/eggDrawPathUnk2.cpp: + .text start:0x804A4BF0 end:0x804A54E8 + +egg/gfx/eggFog.cpp: + .text start:0x804A54F0 end:0x804A5F60 + +egg/gfx/eggFrustum.cpp: + .text start:0x804A5F60 end:0x804A6854 + .ctors start:0x804DB99C end:0x804DB9A0 + +egg/gfx/eggG3DUtility.cpp: + .text start:0x804A6860 end:0x804A75B0 + +egg/gfx/eggGfxEngine.cpp: + .text start:0x804A75B0 end:0x804A7744 + +egg/gfx/eggGlobalDrawState.cpp: + .text start:0x804A7750 end:0x804A7814 + .ctors start:0x804DB9A0 end:0x804DB9A4 + +egg/gfx/eggGXUtility.cpp: + .text start:0x804A7820 end:0x804A7BC0 + +egg/gfx/eggIScnProc.cpp: + .text start:0x804A7BC0 end:0x804A7F7C + +egg/gfx/eggLight.cpp: + .text start:0x804A7F80 end:0x804AB24C + +egg/gfx/eggLightTexture.cpp: + .text start:0x804AB250 end:0x804AD448 + .ctors start:0x804DB9A4 end:0x804DB9A8 + +egg/gfx/eggLightTextureMgr.cpp: + .text start:0x804AD450 end:0x804AE644 + +egg/gfx/eggModelEx.cpp: + .text start:0x804AE650 end:0x804AEC20 + +egg/gfx/eggPostEffectBase.cpp: + .text start:0x804AEC20 end:0x804AF4B4 + +egg/gfx/eggPostEffectBlur.cpp: + .text start:0x804AF4C0 end:0x804AFC04 + +egg/gfx/eggPostEffectUnk1.cpp: + .text start:0x804AFC10 end:0x804B0098 + +egg/gfx/eggPostEffectUnk2.cpp: + .text start:0x804B00A0 end:0x804B0AA4 + +egg/gfx/eggPostEffectMask.cpp: + .text start:0x804B0AB0 end:0x804B0F60 + +egg/gfx/eggPostEffectMaskDOF.cpp: + .text start:0x804B0F60 end:0x804B1BE8 + +egg/gfx/eggPostEffectSimple.cpp: + .text start:0x804B1BF0 end:0x804B1E58 + +egg/gfx/eggScreen.cpp: + .text start:0x804B1E60 end:0x804B30B4 + .ctors start:0x804DB9A8 end:0x804DB9AC + +egg/gfx/eggScreenEffectBase.cpp: + .text start:0x804B30C0 end:0x804B30EC + .ctors start:0x804DB9AC end:0x804DB9B0 + +egg/gfx/eggScreenEffectBlur.cpp: + .text start:0x804B30F0 end:0x804B3D98 + +egg/gfx/eggStateEfb.cpp: + .text start:0x804B3DA0 end:0x804B460C + +egg/gfx/eggStateGX.cpp: + .text start:0x804B4610 end:0x804B53EC + +egg/gfx/eggTextureBuffer.cpp: + .text start:0x804B53F0 end:0x804B59DC + +egg/audio/eggAudioArcPlayerMgr.cpp: + .text start:0x804B59E0 end:0x804B6428 + +egg/audio/eggAudioHeapMgr.cpp: + .text start:0x804B6430 end:0x804B64A8 + +egg/audio/eggAudioMgr.cpp: + .text start:0x804B64B0 end:0x804B69C8 + +egg/audio/eggAudioRmtSpeakerMgr.cpp: + .text start:0x804B69D0 end:0x804B6F58 + +egg/audio/eggAudioUtility.cpp: + .text start:0x804B6F60 end:0x804B720C + .ctors start:0x804DB9B0 end:0x804DB9B4 + +egg/audio/eggAudioSystem.cpp: + .text start:0x804B7210 end:0x804B7544 + +egg/util/eggException.cpp: + .text start:0x804B7550 end:0x804B7B48 Runtime.PPCEABI.H/global_destructor_chain.c: .text start:0x804C65C0 end:0x804C6620 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 0974450f..c5a4d571 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -498,7 +498,7 @@ fn_800146E0 = .text:0x800146E0; // type:function size:0x38 fn_80014720 = .text:0x80014720; // type:function size:0x228 fn_80014950 = .text:0x80014950; // type:function size:0x5C fn_800149B0 = .text:0x800149B0; // type:function size:0x478 -isTriggered__Q23EGG14CoreControllerFUl = .text:0x80014E30; // type:function size:0x18 +downTrigger__Q23EGG14CoreControllerCFUl = .text:0x80014E30; // type:function size:0x18 fn_80014E50 = .text:0x80014E50; // type:function size:0x54 fn_80014EB0 = .text:0x80014EB0; // type:function size:0x3C4 fn_80015280 = .text:0x80015280; // type:function size:0x1C @@ -2251,7 +2251,7 @@ fn_80055330 = .text:0x80055330; // type:function size:0x98 fn_800553D0 = .text:0x800553D0; // type:function size:0x50 fn_80055420 = .text:0x80055420; // type:function size:0x73C fn_80055B60 = .text:0x80055B60; // type:function size:0x10 -EGG__TBuffer__errRangeOver = .text:0x80055B70; // type:function size:0x4 +errRangeOver__Q23EGG29TBufferFv = .text:0x80055B70; // type:function size:0x4 mPad__endPad = .text:0x80055B80; // type:function size:0x4 fn_80055B90 = .text:0x80055B90; // type:function size:0x94 fn_80055C30 = .text:0x80055C30; // type:function size:0x10 @@ -2370,8 +2370,8 @@ checkButton2Pressed = .text:0x800597A0; // type:function size:0x18 checkButtonMinusPressed = .text:0x800597C0; // type:function size:0x18 checkButtonPlusPressed = .text:0x800597E0; // type:function size:0x18 checkInputManagerHeldMask = .text:0x80059800; // type:function size:0x18 -isPressed__Q23EGG14CoreControllerFUl = .text:0x80059820; // type:function size:0x18 -isAllPressed__Q23EGG14CoreControllerFv = .text:0x80059840; // type:function size:0x18 +down__Q23EGG14CoreControllerCFUl = .text:0x80059820; // type:function size:0x18 +downAll__Q23EGG14CoreControllerCFUl = .text:0x80059840; // type:function size:0x18 checkButtonAHeld = .text:0x80059860; // type:function size:0x18 checkButtonBHeld = .text:0x80059880; // type:function size:0x18 checkButtonCHeld = .text:0x800598A0; // type:function size:0x18 @@ -2384,12 +2384,12 @@ checkButton1Held = .text:0x80059960; // type:function size:0x18 checkButton2Held = .text:0x80059980; // type:function size:0x18 checkButtonMinusHeld = .text:0x800599A0; // type:function size:0x18 checkButtonPlusHeld = .text:0x800599C0; // type:function size:0x18 -isReleased__Q23EGG14CoreControllerFv = .text:0x800599E0; // type:function size:0x18 +upTrigger__Q23EGG14CoreControllerCFUl = .text:0x800599E0; // type:function size:0x18 checkButtonAReleased = .text:0x80059A00; // type:function size:0x18 buttonBReleased = .text:0x80059A20; // type:function size:0x18 checkButtonZReleased = .text:0x80059A40; // type:function size:0x18 -isAnyPressed__Q23EGG14CoreControllerFUl = .text:0x80059A60; // type:function size:0x1C -isNotPressed__Q23EGG14CoreControllerFv = .text:0x80059A80; // type:function size:0x14 +up__Q23EGG14CoreControllerCFUl = .text:0x80059A60; // type:function size:0x1C +upAll__Q23EGG14CoreControllerCFUl = .text:0x80059A80; // type:function size:0x14 checkButtonAHeldReleased = .text:0x80059AA0; // type:function size:0x18 fn_80059AC0 = .text:0x80059AC0; // type:function size:0x8 fn_80059AD0 = .text:0x80059AD0; // type:function size:0xC @@ -10212,7 +10212,7 @@ fn_8018E420 = .text:0x8018E420; // type:function size:0x74 fn_8018E4A0 = .text:0x8018E4A0; // type:function size:0x3C fn_8018E4E0 = .text:0x8018E4E0; // type:function size:0x3C fn_8018E520 = .text:0x8018E520; // type:function size:0x514 -fn_8018EA40 = .text:0x8018EA40; // type:function size:0x8 +getViewMatrix__Q23EGG12LookAtCameraFv = .text:0x8018EA40; // type:function size:0x8 fn_8018EA50 = .text:0x8018EA50; // type:function size:0x44 fn_8018EAA0 = .text:0x8018EAA0; // type:function size:0x18 fn_8018EAC0 = .text:0x8018EAC0; // type:function size:0x54 @@ -17187,7 +17187,7 @@ __dt__16sStateMethodIf_cFv = .text:0x802DE0B0; // type:function size:0x40 __dt__20sStateMethodUsr_FI_cFv = .text:0x802DE0F0; // type:function size:0x58 __dt__13sStateMgrIf_cFv = .text:0x802DE150; // type:function size:0x40 isNormalID__13sStateIDChk_cCFRC12sStateIDIf_c = .text:0x802DE190; // type:function size:0x8 -__sinit_\s_StateId_cpp = .text:0x802DE1A0; // type:function size:0x54 scope:local +__sinit_\s_StateID_cpp = .text:0x802DE1A0; // type:function size:0x54 scope:local __ct__14sStateMethod_cFR15sStateIDChkIf_cR13sStateFctIf_cRC12sStateIDIf_c = .text:0x802DE200; // type:function size:0x48 __dt__14sStateMethod_cFv = .text:0x802DE250; // type:function size:0x58 initializeStateMethod__14sStateMethod_cFv = .text:0x802DE2B0; // type:function size:0xA8 @@ -17363,7 +17363,7 @@ searchBaseByGroupType__10fManager_cFUcPC7fBase_c = .text:0x802E2980; // type:fun mainLoop__10fManager_cFv = .text:0x802E29E0; // type:function size:0xC0 __sinit_\f_manager_cpp = .text:0x802E2AA0; // type:function size:0x138 scope:local __ct__9fLiMgBa_cFv = .text:0x802E2BE0; // type:function size:0x10 -__arraydtor = .text:0x802E2BF0; // type:function size:0x1C scope:local +__arraydtor$4290 = .text:0x802E2BF0; // type:function size:0x1C scope:local walkPack__11fTrMgPTMF_cFv = .text:0x802E2C10; // type:function size:0x84 searchNodeByProfName__9fTrMgBa_cCFUsPC9fTrNdBa_c = .text:0x802E2CA0; // type:function size:0x68 searchNodeByGroupType__9fTrMgBa_cCFUcPC9fTrNdBa_c = .text:0x802E2D10; // type:function size:0x68 @@ -22587,9 +22587,9 @@ MEMGetAllocatableSizeForFrmHeapEx = .text:0x803CD820; // type:function size:0x78 MEMRecordStateForFrmHeap = .text:0x803CD8A0; // type:function size:0xD4 MEMFreeByStateToFrmHeap = .text:0x803CD980; // type:function size:0xB4 MEMAdjustFrmHeap = .text:0x803CDA40; // type:function size:0x84 -fn_803CDAD0 = .text:0x803CDAD0; // type:function size:0xD0 -fn_803CDBA0 = .text:0x803CDBA0; // type:function size:0x10 -fn_803CDBB0 = .text:0x803CDBB0; // type:function size:0x8 +MEMResizeForMBlockFrmHeap = .text:0x803CDAD0; // type:function size:0xD0 +AllocatorAllocForExpHeap_ = .text:0x803CDBA0; // type:function size:0x10 +AllocatorFreeForExpHeap_ = .text:0x803CDBB0; // type:function size:0x8 MEMAllocFromAllocator = .text:0x803CDBC0; // type:function size:0x10 MEMFreeToAllocator = .text:0x803CDBD0; // type:function size:0x10 MEMInitAllocatorForExpHeap = .text:0x803CDBE0; // type:function size:0x1C @@ -22634,7 +22634,7 @@ CXReadUncompLRC = .text:0x803D0390; // type:function size:0x3F8 CXGetUncompressedSize = .text:0x803D0790; // type:function size:0x40 CXUncompressLZ = .text:0x803D07D0; // type:function size:0x14C CXiLHVerifyTable = .text:0x803D0920; // type:function size:0x1F4 -NANDCreateGhidra = .text:0x803D0B20; // type:function size:0x140 +fn_803D0B20 = .text:0x803D0B20; // type:function size:0x140 NANDCreate = .text:0x803D0C60; // type:function size:0x74 NANDPrivateCreate = .text:0x803D0CE0; // type:function size:0x74 NANDPrivateCreateAsync = .text:0x803D0D60; // type:function size:0x78 @@ -22743,8 +22743,8 @@ SCGetScreenSaverMode = .text:0x803D6700; // type:function size:0x54 SCGetSoundMode = .text:0x803D6760; // type:function size:0x54 SCGetCounterBias = .text:0x803D67C0; // type:function size:0x40 SCGetBtDeviceInfoArray = .text:0x803D6800; // type:function size:0xC -SCSetBtDeviceInfoArrray = .text:0x803D6810; // type:function size:0xC -ScGetBtCmpDevIndoArray = .text:0x803D6820; // type:function size:0xC +SCSetBtDeviceInfoArray = .text:0x803D6810; // type:function size:0xC +SCGetBtCmpDevInfoArray = .text:0x803D6820; // type:function size:0xC SCSetBtCmpDevInfoArray = .text:0x803D6830; // type:function size:0xC SCGetBtDpdSensibility = .text:0x803D6840; // type:function size:0x68 fn_803D68B0 = .text:0x803D68B0; // type:function size:0x3C @@ -22753,27 +22753,27 @@ SCSetWpadMotorMode = .text:0x803D6950; // type:function size:0x8 SCGetWpadSensorBarPosition = .text:0x803D6960; // type:function size:0x54 SCGetWpadSpeakerVolume = .text:0x803D69C0; // type:function size:0x54 SCSetWpadSpeakerVolume = .text:0x803D6A20; // type:function size:0x8 -__SCF1 = .text:0x803D6A30; // type:function size:0x170 +__SCF1 = .text:0x803D6A30; // type:function size:0x170 scope:local SCGetProductArea = .text:0x803D6BA0; // type:function size:0x84 -SCGetProductGameRegon = .text:0x803D6C30; // type:function size:0x84 +SCGetProductGameRegion = .text:0x803D6C30; // type:function size:0x84 __PADDisableRecalibration = .text:0x803D6CC0; // type:function size:0x5C scope:global -fn_803D6D20 = .text:0x803D6D20; // type:function size:0x8 -fn_803D6D30 = .text:0x803D6D30; // type:function size:0x8 -fn_803D6D40 = .text:0x803D6D40; // type:function size:0x8 -fn_803D6D50 = .text:0x803D6D50; // type:function size:0x8 -fn_803D6D60 = .text:0x803D6D60; // type:function size:0x8 -fn_803D6D70 = .text:0x803D6D70; // type:function size:0x8 -fn_803D6D80 = .text:0x803D6D80; // type:function size:0x8 -fn_803D6D90 = .text:0x803D6D90; // type:function size:0x8 -fn_803D6DA0 = .text:0x803D6DA0; // type:function size:0x8 -fn_803D6DB0 = .text:0x803D6DB0; // type:function size:0x8 -fn_803D6DC0 = .text:0x803D6DC0; // type:function size:0x8 -fn_803D6DD0 = .text:0x803D6DD0; // type:function size:0x8 -fn_803D6DE0 = .text:0x803D6DE0; // type:function size:0x8 -fn_803D6DF0 = .text:0x803D6DF0; // type:function size:0x8 -fn_803D6E00 = .text:0x803D6E00; // type:function size:0x8 -fn_803D6E10 = .text:0x803D6E10; // type:function size:0x8 -OnShutdown2 = .text:0x803D6E20; // type:function size:0x1AC +__wpadNoAlloc = .text:0x803D6D20; // type:function size:0x8 +__wpadNoFree = .text:0x803D6D30; // type:function size:0x8 +WPADIsEnabledVSM = .text:0x803D6D40; // type:function size:0x8 +WPADIsEnabledTRN = .text:0x803D6D50; // type:function size:0x8 +WPADIsEnabledGTR = .text:0x803D6D60; // type:function size:0x8 +WPADIsEnabledDRM = .text:0x803D6D70; // type:function size:0x8 +WPADIsEnabledTKO = .text:0x803D6D80; // type:function size:0x8 +WPADIsEnabledTBL = .text:0x803D6D90; // type:function size:0x8 +WPADIsEnabledBLK = .text:0x803D6DA0; // type:function size:0x8 +WPADIsEnabledWBC = .text:0x803D6DB0; // type:function size:0x8 +WBCSetupCalibration = .text:0x803D6DC0; // type:function size:0x8 +WBCGetCalibrationStatus = .text:0x803D6DD0; // type:function size:0x8 +WBCGetBatteryLevel = .text:0x803D6DE0; // type:function size:0x8 +WBCRead = .text:0x803D6DF0; // type:function size:0x8 +WBCSetZEROPoint = .text:0x803D6E00; // type:function size:0x8 +WBCGetTGCWeight = .text:0x803D6E10; // type:function size:0x8 +OnShutdown = .text:0x803D6E20; // type:function size:0x1AC scope:local __wpadSendDataSub = .text:0x803D6FD0; // type:function size:0x1C4 __wpadCalcRadioQuality = .text:0x803D71A0; // type:function size:0x110 __wpadFmt2Size = .text:0x803D72B0; // type:function size:0x74 @@ -22785,212 +22785,212 @@ __wpadManageHandler0 = .text:0x803D8D50; // type:function size:0x20 __wpadClearControlBlock = .text:0x803D8D70; // type:function size:0x338 __wpadInitSub = .text:0x803D90B0; // type:function size:0x2A4 WPADInit = .text:0x803D9360; // type:function size:0x70 -fn_803D93D0 = .text:0x803D93D0; // type:function size:0x4 -fn_803D93E0 = .text:0x803D93E0; // type:function size:0x4 -fn_803D93F0 = .text:0x803D93F0; // type:function size:0x4 +WPADStartFastSimpleSync = .text:0x803D93D0; // type:function size:0x4 +WPADStopSimpleSync = .text:0x803D93E0; // type:function size:0x4 +WPADSetSimpleSyncCallback = .text:0x803D93F0; // type:function size:0x4 WPADRegisterAllocator = .text:0x803D9400; // type:function size:0x4 WPADGetWorkMemorySize = .text:0x803D9410; // type:function size:0x4 WPADGetStatus = .text:0x803D9420; // type:function size:0x4 WPADGetRadioSensitivity = .text:0x803D9430; // type:function size:0x44 -fn_803D9480 = .text:0x803D9480; // type:function size:0x34 -fn_803D94C0 = .text:0x803D94C0; // type:function size:0x68 -fn_803D9530 = .text:0x803D9530; // type:function size:0xCC -fn_803D9600 = .text:0x803D9600; // type:function size:0xE8 +WPADGetSensorBarPosition = .text:0x803D9480; // type:function size:0x34 +WPADSetAcceptConnection = .text:0x803D94C0; // type:function size:0x68 +__wpadSetupConnectionCallback = .text:0x803D9530; // type:function size:0xCC +__wpadAbortConnectionCallback = .text:0x803D9600; // type:function size:0xE8 fn_803D96F0 = .text:0x803D96F0; // type:function size:0x124 -fn_803D9820 = .text:0x803D9820; // type:function size:0xBD0 -fn_803DA3F0 = .text:0x803DA3F0; // type:function size:0x120 -fn_803DA510 = .text:0x803DA510; // type:function size:0x490 -fn_803DA9A0 = .text:0x803DA9A0; // type:function size:0x24 -fn_803DA9D0 = .text:0x803DA9D0; // type:function size:0xD4 -fn_803DAAB0 = .text:0x803DAAB0; // type:function size:0x24 -fn_803DAAE0 = .text:0x803DAAE0; // type:function size:0xC0 -WPADSetSpeakerVolume = .text:0x803DABA0; // type:function size:0x34 -fn_803DABE0 = .text:0x803DABE0; // type:function size:0x58 +__wpadInitConnectionCallback = .text:0x803D9820; // type:function size:0xBD0 +__wpadRetrieveChannel = .text:0x803DA3F0; // type:function size:0x120 +__wpadConnectionCallback = .text:0x803DA510; // type:function size:0x490 +__wpadReceiveCallback = .text:0x803DA9A0; // type:function size:0x24 +WPADGetAccGravityUnit = .text:0x803DA9D0; // type:function size:0xD4 +__wpadDisconnectCallback = .text:0x803DAAB0; // type:function size:0x24 +WPADDisconnect = .text:0x803DAAE0; // type:function size:0xC0 +WPADSetAutoSleepTime = .text:0x803DABA0; // type:function size:0x34 +WPADSetControllerLastDataUpdateTime = .text:0x803DABE0; // type:function size:0x58 WPADProbe = .text:0x803DAC40; // type:function size:0x8C WPADSetSamplingCallback = .text:0x803DACD0; // type:function size:0x88 -fn_803DAD60 = .text:0x803DAD60; // type:function size:0x88 -fn_803DADF0 = .text:0x803DADF0; // type:function size:0x5C -fn_803DAE50 = .text:0x803DAE50; // type:function size:0x44 -fn_803DAEA0 = .text:0x803DAEA0; // type:function size:0xC0 -fn_803DAF60 = .text:0x803DAF60; // type:function size:0x54 +WPADSetConnectCallback = .text:0x803DAD60; // type:function size:0x88 +WPADSetExtensionCallback = .text:0x803DADF0; // type:function size:0x5C +WPADGetDataFormat = .text:0x803DAE50; // type:function size:0x44 +WPADSetDataFormat = .text:0x803DAEA0; // type:function size:0xC0 +__wpadInfoCallback = .text:0x803DAF60; // type:function size:0x54 WPADGetInfoAsync = .text:0x803DAFC0; // type:function size:0x220 WPADControlMotor = .text:0x803DB1E0; // type:function size:0xCC -fn_803DB2B0 = .text:0x803DB2B0; // type:function size:0x34 +WPADEnableMotor = .text:0x803DB2B0; // type:function size:0x34 WPADIsMotorEnabled = .text:0x803DB2F0; // type:function size:0x34 -fn_803DB330 = .text:0x803DB330; // type:function size:0x1E8 +WPADControlLed = .text:0x803DB330; // type:function size:0x1E8 WPADSaveConfig = .text:0x803DB520; // type:function size:0xAC -fn_803DB5D0 = .text:0x803DB5D0; // type:function size:0x98 -fn_803DB670 = .text:0x803DB670; // type:function size:0x15C -fn_803DB7D0 = .text:0x803DB7D0; // type:function size:0x11C -fn_803DB8F0 = .text:0x803DB8F0; // type:function size:0xFC -fn_803DB9F0 = .text:0x803DB9F0; // type:function size:0x44 -fn_803DBA40 = .text:0x803DBA40; // type:function size:0x15FC -fn_803DD040 = .text:0x803DD040; // type:function size:0x34 -fn_803DD080 = .text:0x803DD080; // type:function size:0x50 -IsBusyStream = .text:0x803DD0D0; // type:function size:0x138 +WPADRead = .text:0x803DB5D0; // type:function size:0x98 +WPADSetAutoSamplingBuf = .text:0x803DB670; // type:function size:0x15C +WPADiExcludeButton = .text:0x803DB7D0; // type:function size:0x11C +WPADiCopyOut = .text:0x803DB8F0; // type:function size:0xFC +WPADIsSpeakerEnabled = .text:0x803DB9F0; // type:function size:0x44 +WPADControlSpeaker = .text:0x803DBA40; // type:function size:0x15FC +WPADGetSpeakerVolume = .text:0x803DD040; // type:function size:0x34 +WPADSetSpeakerVolume = .text:0x803DD080; // type:function size:0x50 +__wpadIsBusyStream = .text:0x803DD0D0; // type:function size:0x138 scope:local WPADCanSendStreamData = .text:0x803DD210; // type:function size:0x84 -fn_803DD2A0 = .text:0x803DD2A0; // type:function size:0x210 -GetDpdSensitivity = .text:0x803DD4B0; // type:function size:0x34 -fn_803DD4F0 = .text:0x803DD4F0; // type:function size:0x44 -fn_803DD540 = .text:0x803DD540; // type:function size:0x38 -fn_803DD580 = .text:0x803DD580; // type:function size:0x1080 -fn_803DE600 = .text:0x803DE600; // type:function size:0x224 -fn_803DE830 = .text:0x803DE830; // type:function size:0x6C -fn_803DE8A0 = .text:0x803DE8A0; // type:function size:0x1164 -fn_803DFA10 = .text:0x803DFA10; // type:function size:0x368 -fn_803DFD80 = .text:0x803DFD80; // type:function size:0xD4 -fn_803DFE60 = .text:0x803DFE60; // type:function size:0x298 -fn_803E0100 = .text:0x803E0100; // type:function size:0x1B4 -fn_803E02C0 = .text:0x803E02C0; // type:function size:0x1B8 -fn_803E0480 = .text:0x803E0480; // type:function size:0x1AC -fn_803E0630 = .text:0x803E0630; // type:function size:0x88 +WPADSendStreamData = .text:0x803DD2A0; // type:function size:0x210 +WPADGetDpdSensitivity = .text:0x803DD4B0; // type:function size:0x34 +WPADIsDpdEnabled = .text:0x803DD4F0; // type:function size:0x44 +__wpadDpdCallback = .text:0x803DD540; // type:function size:0x38 scope:local +WPADControlDpd = .text:0x803DD580; // type:function size:0x1080 +WPADControlBLC = .text:0x803DE600; // type:function size:0x224 +WPADiGetMplsStatus = .text:0x803DE830; // type:function size:0x6C +__wpadMplsCallback = .text:0x803DE8A0; // type:function size:0x1164 scope:local +WPADiControlMpls = .text:0x803DFA10; // type:function size:0x368 +WPADiGetMplsCalibration = .text:0x803DFD80; // type:function size:0xD4 +WPADiSendSetReportType = .text:0x803DFE60; // type:function size:0x298 +WPADiSendWriteDataCmd = .text:0x803E0100; // type:function size:0x1B4 +WPADiSendWriteData = .text:0x803E02C0; // type:function size:0x1B8 +WPADiSendReadData = .text:0x803E0480; // type:function size:0x1AC +WPADiIsAvailableCmdQueue = .text:0x803E0630; // type:function size:0x88 WPADiClearQueue = .text:0x803E06C0; // type:function size:0x60 -fn_803E0720 = .text:0x803E0720; // type:function size:0x8 -fn_803E0730 = .text:0x803E0730; // type:function size:0x8 -fn_803E0740 = .text:0x803E0740; // type:function size:0xE0 -fn_803E0820 = .text:0x803E0820; // type:function size:0x11C -fn_803E0940 = .text:0x803E0940; // type:function size:0x11C -fn_803E0A60 = .text:0x803E0A60; // type:function size:0x64 -fn_803E0AD0 = .text:0x803E0AD0; // type:function size:0xD8 -fn_803E0BB0 = .text:0x803E0BB0; // type:function size:0x168 -fn_803E0D20 = .text:0x803E0D20; // type:function size:0x2E4 -fn_803E1010 = .text:0x803E1010; // type:function size:0xD04 -fn_803E1D20 = .text:0x803E1D20; // type:function size:0x194 -fn_803E1EC0 = .text:0x803E1EC0; // type:function size:0xA60 -fn_803E2920 = .text:0x803E2920; // type:function size:0x140 -fn_803E2A60 = .text:0x803E2A60; // type:function size:0xC0 -fn_803E2B20 = .text:0x803E2B20; // type:function size:0x848 -fn_803E3370 = .text:0x803E3370; // type:function size:0x1C8 -fn_803E3540 = .text:0x803E3540; // type:function size:0x48 -fn_803E3590 = .text:0x803E3590; // type:function size:0x6D0 -fn_803E3C60 = .text:0x803E3C60; // type:function size:0x1A4 -fn_803E3E10 = .text:0x803E3E10; // type:function size:0x128 -fn_803E3F40 = .text:0x803E3F40; // type:function size:0x140 -fn_803E4080 = .text:0x803E4080; // type:function size:0x440 -fn_803E44C0 = .text:0x803E44C0; // type:function size:0x370 -fn_803E4830 = .text:0x803E4830; // type:function size:0x108 -fn_803E4940 = .text:0x803E4940; // type:function size:0x494 -fn_803E4DE0 = .text:0x803E4DE0; // type:function size:0x278 -fn_803E5060 = .text:0x803E5060; // type:function size:0x54C -fn_803E55B0 = .text:0x803E55B0; // type:function size:0x100 -fn_803E56B0 = .text:0x803E56B0; // type:function size:0x178 -fn_803E5830 = .text:0x803E5830; // type:function size:0x900 -fn_803E6130 = .text:0x803E6130; // type:function size:0x5A4 -fn_803E66E0 = .text:0x803E66E0; // type:function size:0x34 -fn_803E6720 = .text:0x803E6720; // type:function size:0xD0 -fn_803E67F0 = .text:0x803E67F0; // type:function size:0x44 -fn_803E6840 = .text:0x803E6840; // type:function size:0x10C -fn_803E6950 = .text:0x803E6950; // type:function size:0x44 -fn_803E69A0 = .text:0x803E69A0; // type:function size:0xE0 -fn_803E6A80 = .text:0x803E6A80; // type:function size:0xA8 -fn_803E6B30 = .text:0x803E6B30; // type:function size:0x150 -fn_803E6C80 = .text:0x803E6C80; // type:function size:0x28 -fn_803E6CB0 = .text:0x803E6CB0; // type:function size:0x168 -fn_803E6E20 = .text:0x803E6E20; // type:function size:0x158 -fn_803E6F80 = .text:0x803E6F80; // type:function size:0x4 -fn_803E6F90 = .text:0x803E6F90; // type:function size:0x5D8 -fn_803E7570 = .text:0x803E7570; // type:function size:0x5F0 -fn_803E7B60 = .text:0x803E7B60; // type:function size:0x2E4 -fn_803E7E50 = .text:0x803E7E50; // type:function size:0x2C -fn_803E7E80 = .text:0x803E7E80; // type:function size:0xD4 -fn_803E7F60 = .text:0x803E7F60; // type:function size:0x80 -fn_803E7FE0 = .text:0x803E7FE0; // type:function size:0x2CC -fn_803E82B0 = .text:0x803E82B0; // type:function size:0xD4 -fn_803E8390 = .text:0x803E8390; // type:function size:0x10C -fn_803E84A0 = .text:0x803E84A0; // type:function size:0x32C -fn_803E87D0 = .text:0x803E87D0; // type:function size:0x8 -fn_803E87E0 = .text:0x803E87E0; // type:function size:0x14 -fn_803E8800 = .text:0x803E8800; // type:function size:0x14 -fn_803E8820 = .text:0x803E8820; // type:function size:0x34 -fn_803E8860 = .text:0x803E8860; // type:function size:0x158 -fn_803E89C0 = .text:0x803E89C0; // type:function size:0x158 -fn_803E8B20 = .text:0x803E8B20; // type:function size:0x3EC -fn_803E8F10 = .text:0x803E8F10; // type:function size:0x120 -fn_803E9030 = .text:0x803E9030; // type:function size:0x6C -fn_803E90A0 = .text:0x803E90A0; // type:function size:0x74 -fn_803E9120 = .text:0x803E9120; // type:function size:0x6C -fn_803E9190 = .text:0x803E9190; // type:function size:0x44 -fn_803E91E0 = .text:0x803E91E0; // type:function size:0x158 -fn_803E9340 = .text:0x803E9340; // type:function size:0x9CC -fn_803E9D10 = .text:0x803E9D10; // type:function size:0x20 -fn_803E9D30 = .text:0x803E9D30; // type:function size:0x20 -WUDiTerminateDevice = .text:0x803E9D50; // type:function size:0x98 -fn_803E9DF0 = .text:0x803E9DF0; // type:function size:0x204 -fn_803EA000 = .text:0x803EA000; // type:function size:0x270 -fn_803EA270 = .text:0x803EA270; // type:function size:0x20 -fn_803EA290 = .text:0x803EA290; // type:function size:0x10C -fn_803EA3A0 = .text:0x803EA3A0; // type:function size:0x180 -fn_803EA520 = .text:0x803EA520; // type:function size:0x20 -fn_803EA540 = .text:0x803EA540; // type:function size:0x14 -fn_803EA560 = .text:0x803EA560; // type:function size:0x550 -fn_803EAAB0 = .text:0x803EAAB0; // type:function size:0x80 -fn_803EAB30 = .text:0x803EAB30; // type:function size:0x18 -fn_803EAB50 = .text:0x803EAB50; // type:function size:0x434 -fn_803EAF90 = .text:0x803EAF90; // type:function size:0x144 -fn_803EB0E0 = .text:0x803EB0E0; // type:function size:0x20 -fn_803EB100 = .text:0x803EB100; // type:function size:0x14 -fn_803EB120 = .text:0x803EB120; // type:function size:0xB4 -fn_803EB1E0 = .text:0x803EB1E0; // type:function size:0x20 -fn_803EB200 = .text:0x803EB200; // type:function size:0x384 -fn_803EB590 = .text:0x803EB590; // type:function size:0x104 +WPADIsUsedCallbackByKPAD = .text:0x803E0720; // type:function size:0x8 +WPADSetCallbackByKPAD = .text:0x803E0730; // type:function size:0x8 +__wpadCertFailed = .text:0x803E0740; // type:function size:0xE0 +__wpadCertCalcModX = .text:0x803E0820; // type:function size:0x11C +__wpadCertCalcModY = .text:0x803E0940; // type:function size:0x11C +__wpadCertChallengeCallback = .text:0x803E0A60; // type:function size:0x64 +__wpadCertProbeReadyCallback = .text:0x803E0AD0; // type:function size:0xD8 +__wpadCertGetParamCallback = .text:0x803E0BB0; // type:function size:0x168 +__wpadCertGetParam = .text:0x803E0D20; // type:function size:0x2E4 +__wpadCertWork = .text:0x803E1010; // type:function size:0xD04 +__wpadAbortInitExtension = .text:0x803E1D20; // type:function size:0x194 +__wpadGetDevConfig = .text:0x803E1EC0; // type:function size:0xA60 +__wpadCheckCalibration = .text:0x803E2920; // type:function size:0x140 +__wpadGetClConfig = .text:0x803E2A60; // type:function size:0xC0 +__wpadGetExtConfig = .text:0x803E2B20; // type:function size:0x848 +__wpadGetExtConfig2 = .text:0x803E3370; // type:function size:0x1C8 +__wpadIsExtEncryptMain = .text:0x803E3540; // type:function size:0x48 +__wpadGetExtType = .text:0x803E3590; // type:function size:0x6D0 +__wpadGetGameInfo = .text:0x803E3C60; // type:function size:0x1A4 +__wpadCheckDataFormat = .text:0x803E3E10; // type:function size:0x128 +WPADiHIDParser = .text:0x803E3F40; // type:function size:0x140 +__a1_20_status_report = .text:0x803E4080; // type:function size:0x440 +__a1_21_user_data = .text:0x803E44C0; // type:function size:0x370 +__a1_22_ack = .text:0x803E4830; // type:function size:0x108 +__parse_dpd_data = .text:0x803E4940; // type:function size:0x494 +__parse_dpdex_data = .text:0x803E4DE0; // type:function size:0x278 +__parse_acc_data = .text:0x803E5060; // type:function size:0x54C +__parse_fs_data = .text:0x803E55B0; // type:function size:0x100 +__parse_vs_data = .text:0x803E56B0; // type:function size:0x178 +__parse_mp_data = .text:0x803E5830; // type:function size:0x900 +__parse_ext_data = .text:0x803E6130; // type:function size:0x5A4 +__a1_30_data_type = .text:0x803E66E0; // type:function size:0x34 +__a1_31_data_type = .text:0x803E6720; // type:function size:0xD0 +__a1_32_data_type = .text:0x803E67F0; // type:function size:0x44 +__a1_33_data_type = .text:0x803E6840; // type:function size:0x10C +__a1_34_data_type = .text:0x803E6950; // type:function size:0x44 +__a1_35_data_type = .text:0x803E69A0; // type:function size:0xE0 +__a1_36_data_type = .text:0x803E6A80; // type:function size:0xA8 +__a1_37_data_type = .text:0x803E6B30; // type:function size:0x150 +__a1_3d_data_type = .text:0x803E6C80; // type:function size:0x28 +__a1_3e_data_type = .text:0x803E6CB0; // type:function size:0x168 +__a1_3f_data_type = .text:0x803E6E20; // type:function size:0x158 +__a1_unused_report = .text:0x803E6F80; // type:function size:0x4 +WPADiCreateKey = .text:0x803E6F90; // type:function size:0x5D8 +WPADiCreateKeyFor3rd = .text:0x803E7570; // type:function size:0x5F0 +WPADiDecode = .text:0x803E7B60; // type:function size:0x2E4 +WPADiClearMemBlock = .text:0x803E7E50; // type:function size:0x2C +WPADWriteExtReg = .text:0x803E7E80; // type:function size:0xD4 +LINTCmp = .text:0x803E7F60; // type:function size:0x80 +LINTLshift = .text:0x803E7FE0; // type:function size:0x2CC +LINTMsb = .text:0x803E82B0; // type:function size:0xD4 +LINTSub = .text:0x803E8390; // type:function size:0x10C +LINTMul = .text:0x803E84A0; // type:function size:0x32C +WUDIsLinkedWBC = .text:0x803E87D0; // type:function size:0x8 +App_MEMalloc = .text:0x803E87E0; // type:function size:0x14 +App_MEMfree = .text:0x803E8800; // type:function size:0x14 +__wudSyncFlushCallback = .text:0x803E8820; // type:function size:0x34 +__wudSyncPrepareSearch = .text:0x803E8860; // type:function size:0x158 +__wudSyncVirginStandard = .text:0x803E89C0; // type:function size:0x158 +__wudSyncStoredLinkKeyToE2prom = .text:0x803E8B20; // type:function size:0x3EC +__wudSyncStoredDevInfoToNand = .text:0x803E8F10; // type:function size:0x120 +__wudOpenWiiFitCallback = .text:0x803E9030; // type:function size:0x6C +__wudSeekWiiFitCallback = .text:0x803E90A0; // type:function size:0x74 +__wudUpdateWiiFitCallback = .text:0x803E9120; // type:function size:0x6C +__wudCloseWiiFitCallback = .text:0x803E9190; // type:function size:0x44 +__wudSyncDone = .text:0x803E91E0; // type:function size:0x158 +__wudSyncHandler = .text:0x803E9340; // type:function size:0x9CC +__wudSyncHandler0 = .text:0x803E9D10; // type:function size:0x20 +__wudDeleteFlushCallback = .text:0x803E9D30; // type:function size:0x20 +__wudDeleteDisconnectAll = .text:0x803E9D50; // type:function size:0x98 +__wudDeleteCleanupDatabase = .text:0x803E9DF0; // type:function size:0x204 +__wudDeleteHandler = .text:0x803EA000; // type:function size:0x270 +__wudDeleteHandler0 = .text:0x803EA270; // type:function size:0x20 +__wudStackCheckDeviceInfo = .text:0x803EA290; // type:function size:0x10C +__wudStackHandler = .text:0x803EA3A0; // type:function size:0x180 +__wudStackHandler0 = .text:0x803EA520; // type:function size:0x20 +__wudInitFlushCallback = .text:0x803EA540; // type:function size:0x14 +__wudInitDevInfo = .text:0x803EA560; // type:function size:0x550 +__wudNandResultCallback = .text:0x803EAAB0; // type:function size:0x80 +__wudNandFlushCallback = .text:0x803EAB30; // type:function size:0x18 +__wudGetDevInfoFromWiiFit = .text:0x803EAB50; // type:function size:0x434 +__wudInitHandler = .text:0x803EAF90; // type:function size:0x144 +__wudInitHandler0 = .text:0x803EB0E0; // type:function size:0x20 +__wudShutdownFlushCallback = .text:0x803EB100; // type:function size:0x14 +__wudShutdownDone = .text:0x803EB120; // type:function size:0xB4 +__wudShutdownHandler0 = .text:0x803EB1E0; // type:function size:0x20 +__wudClearControlBlock = .text:0x803EB200; // type:function size:0x384 +WUDInit = .text:0x803EB590; // type:function size:0x104 WUDRegisterAllocator = .text:0x803EB6A0; // type:function size:0x4C -WUDGetWorkMemeorySize = .text:0x803EB6F0; // type:function size:0x4 -fn_803EB700 = .text:0x803EB700; // type:function size:0x210 -WPADGetStatus2 = .text:0x803EB910; // type:function size:0x3C +WUDGetAllocatedMemSize = .text:0x803EB6F0; // type:function size:0x4 +WUDShutdown = .text:0x803EB700; // type:function size:0x210 +WUDGetStatus = .text:0x803EB910; // type:function size:0x3C WUDGetBufferStatus = .text:0x803EB950; // type:function size:0x48 WUDSetSniffMode = .text:0x803EB9A0; // type:function size:0x6C -fn_803EBA10 = .text:0x803EBA10; // type:function size:0x4C -fn_803EBA60 = .text:0x803EBA60; // type:function size:0x14C -fn_803EBBB0 = .text:0x803EBBB0; // type:function size:0x14 -fn_803EBBD0 = .text:0x803EBBD0; // type:function size:0x90 -fn_803EBC60 = .text:0x803EBC60; // type:function size:0x88 -fn_803EBCF0 = .text:0x803EBCF0; // type:function size:0xC0 -fn_803EBDB0 = .text:0x803EBDB0; // type:function size:0x4C -fn_803EBE00 = .text:0x803EBE00; // type:function size:0x4C +WUDSetSyncSimpleCallback = .text:0x803EBA10; // type:function size:0x4C +__wudStartSyncDevice = .text:0x803EBA60; // type:function size:0x14C +WUDStartFastSyncSimple = .text:0x803EBBB0; // type:function size:0x14 +WUDCancelSyncDevice = .text:0x803EBBD0; // type:function size:0x90 +WUDStopSyncSimple = .text:0x803EBC60; // type:function size:0x88 +WUDSetDisableChannel = .text:0x803EBCF0; // type:function size:0xC0 +WUDSetHidRecvCallback = .text:0x803EBDB0; // type:function size:0x4C +WUDSetHidConnCallback = .text:0x803EBE00; // type:function size:0x4C WUDSetVisibility = .text:0x803EBE50; // type:function size:0x58 -fn_803EBEB0 = .text:0x803EBEB0; // type:function size:0x4 -fn_803EBEC0 = .text:0x803EBEC0; // type:function size:0xCC -fn_803EBF90 = .text:0x803EBF90; // type:function size:0x230 -fn_803EC1C0 = .text:0x803EC1C0; // type:function size:0x178 -fn_803EC340 = .text:0x803EC340; // type:function size:0x20 -fn_803EC360 = .text:0x803EC360; // type:function size:0x160 -fn_803EC4C0 = .text:0x803EC4C0; // type:function size:0x130 -fn_803EC5F0 = .text:0x803EC5F0; // type:function size:0x104 +__wudModuleRebootCallback = .text:0x803EBEB0; // type:function size:0x4 +__wudInstallPatchCallback = .text:0x803EBEC0; // type:function size:0xCC +__wudWritePatchCallback = .text:0x803EBF90; // type:function size:0x230 +__wudRemovePatchCallback = .text:0x803EC1C0; // type:function size:0x178 +__wudSuperPeekPokeCallback = .text:0x803EC340; // type:function size:0x20 +__wudAppendRuntimePatch = .text:0x803EC360; // type:function size:0x160 +WUDiRegisterDevice = .text:0x803EC4C0; // type:function size:0x130 +WUDiRemoveDevice = .text:0x803EC5F0; // type:function size:0x104 WUDiGetDevInfo = .text:0x803EC700; // type:function size:0xD8 -fn_803EC7E0 = .text:0x803EC7E0; // type:function size:0x114 -fn_803EC900 = .text:0x803EC900; // type:function size:0x114 -fn_803ECA20 = .text:0x803ECA20; // type:function size:0x168 -fn_803ECB90 = .text:0x803ECB90; // type:function size:0x114 -fn_803ECCB0 = .text:0x803ECCB0; // type:function size:0x114 -fn_803ECDD0 = .text:0x803ECDD0; // type:function size:0x190 -fn_803ECF60 = .text:0x803ECF60; // type:function size:0x198 -fn_803ED100 = .text:0x803ED100; // type:function size:0x74 -fn_803ED180 = .text:0x803ED180; // type:function size:0x20 -fn_803ED1A0 = .text:0x803ED1A0; // type:function size:0x374 -fn_803ED520 = .text:0x803ED520; // type:function size:0x144 -fn_803ED670 = .text:0x803ED670; // type:function size:0x278 -fn_803ED8F0 = .text:0x803ED8F0; // type:function size:0x1C -fn_803ED910 = .text:0x803ED910; // type:function size:0x1F0 -fn_803EDB00 = .text:0x803EDB00; // type:function size:0x9C +WUDiMoveTopSmpDevInfoPtr = .text:0x803EC7E0; // type:function size:0x114 +WUDiMoveBottomSmpDevInfoPtr = .text:0x803EC900; // type:function size:0x114 +WUDiMoveTopOfDisconnectedSmpDevice = .text:0x803ECA20; // type:function size:0x168 +WUDiMoveTopStdDevInfoPtr = .text:0x803ECB90; // type:function size:0x114 +WUDiMoveBottomStdDevInfoPtr = .text:0x803ECCB0; // type:function size:0x114 +WUDiMoveTopOfDisconnectedStdDevice = .text:0x803ECDD0; // type:function size:0x190 +WUDiMoveTopOfUnusedStdDevice = .text:0x803ECF60; // type:function size:0x198 +WUDIsBusy = .text:0x803ED100; // type:function size:0x74 +__wudCleanupStackCallback = .text:0x803ED180; // type:function size:0x20 +__wudSecurityEventStackCallback = .text:0x803ED1A0; // type:function size:0x374 +__wudSearchEventStackCallback = .text:0x803ED520; // type:function size:0x144 +__wudVendorSpecificEventStackCallback = .text:0x803ED670; // type:function size:0x278 +__wudDeviceStatusEventStackCallback = .text:0x803ED8F0; // type:function size:0x1C +__wudLinkKeyEventStackCallback = .text:0x803ED910; // type:function size:0x1F0 +__wudPowerMangeEventStackCallback = .text:0x803EDB00; // type:function size:0x9C _WUDGetDevAddr = .text:0x803EDBA0; // type:function size:0x54 -fn_803EDC00 = .text:0x803EDC00; // type:function size:0x58 -fn_803EDC60 = .text:0x803EDC60; // type:function size:0x58 -fn_803EDCC0 = .text:0x803EDCC0; // type:function size:0x3C -fn_803EDD00 = .text:0x803EDD00; // type:function size:0xC -fn_803EDD10 = .text:0x803EDD10; // type:function size:0x74 -fn_803EDD90 = .text:0x803EDD90; // type:function size:0x54 -fn_803EDDF0 = .text:0x803EDDF0; // type:function size:0x4C -fn_803EDE40 = .text:0x803EDE40; // type:function size:0x14 -fn_803EDE60 = .text:0x803EDE60; // type:function size:0x14 -fn_803EDE80 = .text:0x803EDE80; // type:function size:0x14 -fn_803EDEA0 = .text:0x803EDEA0; // type:function size:0x14 -fn_803EDEC0 = .text:0x803EDEC0; // type:function size:0x410 +_WUDGetQueuedSize = .text:0x803EDC00; // type:function size:0x58 +_WUDGetNotAckedSize = .text:0x803EDC60; // type:function size:0x58 +_WUDGetLinkNumber = .text:0x803EDCC0; // type:function size:0x3C +WUDiGetDiscoverDevice = .text:0x803EDD00; // type:function size:0xC +WUDSetDeviceHistory = .text:0x803EDD10; // type:function size:0x74 +WUDIsLatestDevice = .text:0x803EDD90; // type:function size:0x54 +WUDUpdateSCSetting = .text:0x803EDDF0; // type:function size:0x4C +WUDiSetDevAddrForHandle = .text:0x803EDE40; // type:function size:0x14 +WUDiGetDevAddrForHandle = .text:0x803EDE60; // type:function size:0x14 +WUDiSetQueueSizeForHandle = .text:0x803EDE80; // type:function size:0x14 +WUDiSetNotAckNumForHandle = .text:0x803EDEA0; // type:function size:0x14 +WUDiHidHostEventCallback = .text:0x803EDEC0; // type:function size:0x410 bta_hh_co_data = .text:0x803EE2D0; // type:function size:0x28 -fn_803EE300 = .text:0x803EE300; // type:function size:0x4 -fn_803EE310 = .text:0x803EE310; // type:function size:0x4 -fn_803EE320 = .text:0x803EE320; // type:function size:0x8 -fn_803EE330 = .text:0x803EE330; // type:function size:0x90 -SetPosParam = .text:0x803EE3C0; // type:function size:0x1C +bta_hh_co_open = .text:0x803EE300; // type:function size:0x4 +bta_hh_co_close = .text:0x803EE310; // type:function size:0x4 +bta_dm_co_get_compress_memory = .text:0x803EE320; // type:function size:0x8 +KPADSetBtnRepeat = .text:0x803EE330; // type:function size:0x90 +KPADSetPosParam = .text:0x803EE3C0; // type:function size:0x1C KPADSetHoriParam = .text:0x803EE3E0; // type:function size:0x1C KPADSetDistParam = .text:0x803EE400; // type:function size:0x1C KPADSetAccParam = .text:0x803EE420; // type:function size:0x1C @@ -22998,30 +22998,30 @@ reset_kpad = .text:0x803EE440; // type:function size:0x1B4 fn_803EE600 = .text:0x803EE600; // type:function size:0x18 fn_803EE620 = .text:0x803EE620; // type:function size:0x18 calc_button_repeat = .text:0x803EE640; // type:function size:0x1A8 -fn_803EE7F0 = .text:0x803EE7F0; // type:function size:0xB4 +read_kpad_button = .text:0x803EE7F0; // type:function size:0xB4 calc_acc = .text:0x803EE8B0; // type:function size:0xB4 calc_acc_horizon = .text:0x803EE970; // type:function size:0x194 -fn_803EEB10 = .text:0x803EEB10; // type:function size:0x124 +calc_acc_vertical = .text:0x803EEB10; // type:function size:0x124 read_kpad_acc = .text:0x803EEC40; // type:function size:0x588 select_2obj_first = .text:0x803EF1D0; // type:function size:0x1E8 -fn_803EF3C0 = .text:0x803EF3C0; // type:function size:0x228 +select_2obj_continue = .text:0x803EF3C0; // type:function size:0x228 select_1obj_first = .text:0x803EF5F0; // type:function size:0x1B4 -fn_803EF7B0 = .text:0x803EF7B0; // type:function size:0x174 -fn_803EF930 = .text:0x803EF930; // type:function size:0x5D4 +select_1obj_continue = .text:0x803EF7B0; // type:function size:0x174 +calc_dpd_variable = .text:0x803EF930; // type:function size:0x5D4 read_kpad_dpd = .text:0x803EFF10; // type:function size:0x4BC clamp_stick_circle = .text:0x803F03D0; // type:function size:0x128 clamp_stick_cross = .text:0x803F0500; // type:function size:0x224 -read_kpad_stick = .text:0x803F0730; // type:function size:0x103C +read_kpad_ext = .text:0x803F0730; // type:function size:0x103C fn_803F1770 = .text:0x803F1770; // type:function size:0xA0 KPADRead = .text:0x803F1810; // type:function size:0xC KPADReadEx = .text:0x803F1820; // type:function size:0x8 KPADiRead = .text:0x803F1830; // type:function size:0x808 -KPADInit = .text:0x803F2040; // type:function size:0x468 -fn_803F24B0 = .text:0x803F24B0; // type:function size:0x1FC -fn_803F26B0 = .text:0x803F26B0; // type:function size:0x58 -fn_803F2710 = .text:0x803F2710; // type:function size:0x1C -fn_803F2730 = .text:0x803F2730; // type:function size:0x2C -fn_803F2760 = .text:0x803F2760; // type:function size:0x94 +KPADInitEx = .text:0x803F2040; // type:function size:0x468 +KPADiConnectCallback = .text:0x803F24B0; // type:function size:0x1FC +KPADSetConnectCallback = .text:0x803F26B0; // type:function size:0x58 +KPADiControlWbcCallback = .text:0x803F2710; // type:function size:0x1C +KPADiUpdateTempWbcCallback = .text:0x803F2730; // type:function size:0x2C +KPADiControlDpdCallback = .text:0x803F2760; // type:function size:0x94 fn_803F2800 = .text:0x803F2800; // type:function size:0x2C fn_803F2830 = .text:0x803F2830; // type:function size:0x28 fn_803F2860 = .text:0x803F2860; // type:function size:0x4 @@ -23047,7 +23047,7 @@ fn_803F2AA0 = .text:0x803F2AA0; // type:function size:0x4 fn_803F2AB0 = .text:0x803F2AB0; // type:function size:0x4 fn_803F2AC0 = .text:0x803F2AC0; // type:function size:0x1C fn_803F2AE0 = .text:0x803F2AE0; // type:function size:0x6C -fn_803F2B50 = .text:0x803F2B50; // type:function size:0x9D0 +KPADiSamplingCallback = .text:0x803F2B50; // type:function size:0x9D0 fn_803F3520 = .text:0x803F3520; // type:function size:0xE4 fn_803F3610 = .text:0x803F3610; // type:function size:0x18 fn_803F3630 = .text:0x803F3630; // type:function size:0x34 @@ -26120,28 +26120,28 @@ BindAnimation__Q24nw4r3lytFPQ34nw4r3lyt5GroupPQ34nw4r3lyt13AnimTransformbb = .te UnbindAnimation__Q24nw4r3lytFPQ34nw4r3lyt5GroupPQ34nw4r3lyt13AnimTransformb = .text:0x80493350; // type:function size:0x78 SetAnimationEnable__Q24nw4r3lytFPQ34nw4r3lyt5GroupPQ34nw4r3lyt13AnimTransformbb = .text:0x804933D0; // type:function size:0x70 IsContain__Q24nw4r3lytFPQ34nw4r3lyt4PaneRCQ34nw4r4math4VEC2 = .text:0x80493440; // type:function size:0xCC -readNand__Q23EGG7ArchiveFP12NANDFileInfoPvUll = .text:0x80493510; // type:function size:0x70 +readNANDFile__3EGGFP12NANDFileInfoPvUll = .text:0x80493510; // type:function size:0x70 __ct__Q23EGG7ArchiveFv = .text:0x80493580; // type:function size:0x70 __dt__Q23EGG7ArchiveFv = .text:0x804935F0; // type:function size:0x6C initHandle__Q23EGG7ArchiveFPvQ33EGG7Archive9MountType = .text:0x80493660; // type:function size:0x70 findArchive__Q23EGG7ArchiveFPv = .text:0x804936D0; // type:function size:0x88 -findArchive2__Q23EGG7ArchiveFPv = .text:0x80493760; // type:function size:0x88 -appendList__Q23EGG7ArchiveFPQ23EGG7Arc = .text:0x804937F0; // type:function size:0x5C +findArchive__Q23EGG7ArchiveFP12NANDFileInfo = .text:0x80493760; // type:function size:0x88 +appendList__Q23EGG7ArchiveFPQ23EGG7Archive = .text:0x804937F0; // type:function size:0x5C removeList__Q23EGG7ArchiveFPQ23EGG7Archive = .text:0x80493850; // type:function size:0x10 mount__Q23EGG7ArchiveFPvPQ23EGG4Heapi = .text:0x80493860; // type:function size:0xE4 -mountType2__Q23EGG7ArchiveFPvPQ23EGG4Heapi = .text:0x80493950; // type:function size:0xE4 -mountNandFile__EGG__Archive = .text:0x80493A40; // type:function size:0x7C -loadFST__Q23EGG7ArchiveFPCcPQ23EGG4Heapl = .text:0x80493AC0; // type:function size:0xBC +mountFST__Q23EGG7ArchiveFPvPQ23EGG4Heapi = .text:0x80493950; // type:function size:0xE4 +mountNAND__Q23EGG7ArchiveFP12NANDFileInfoPQ23EGG4Heapi = .text:0x80493A40; // type:function size:0x7C +loadFST__Q23EGG7ArchiveFPCcPQ23EGG4Heapi = .text:0x80493AC0; // type:function size:0xBC unmount__Q23EGG7ArchiveFv = .text:0x80493B80; // type:function size:0x94 getFile__Q23EGG7ArchiveFPCcPQ33EGG7Archive8FileInfo = .text:0x80493C20; // type:function size:0xC4 convertPathToEntryID__Q23EGG7ArchiveFPCc = .text:0x80493CF0; // type:function size:0x8 getFileFast__Q23EGG7ArchiveFlPQ33EGG7Archive8FileInfo = .text:0x80493D00; // type:function size:0xB8 -getFileFast__Q23EGG7ArchiveFlPQ23EGG4Heapl = .text:0x80493DC0; // type:function size:0x148 -countFileCallbackFunc__3EGGFPvPvUlPC11ARCDirEntryPCc = .text:0x80493F10; // type:function size:0x18 +getFileFast__Q23EGG7ArchiveFlPQ23EGG4Heapi = .text:0x80493DC0; // type:function size:0x148 +countFileCallbackFunc__3EGGFPvPvPC11ARCDirEntryPCc = .text:0x80493F10; // type:function size:0x18 countFile__Q23EGG7ArchiveFv = .text:0x80493F30; // type:function size:0x38 -searchInsideWithPath__3EGGFPQ23EGG7ArchiveP9ARCHandlePFPvPvUlPC11ARCDirEntryPCc_vPvPcUl = .text:0x80493F70; // type:function size:0x144 +searchInsideWithPath__3EGGFPQ23EGG7ArchiveP9ARCHandlePFPvPvPC11ARCDirEntryPCc_vPvPcUl = .text:0x80493F70; // type:function size:0x144 searchInside__Q23EGG7ArchiveFPFPvPvPC11ARCDirEntryPCc_vPv = .text:0x804940C0; // type:function size:0x74 -loadFromDisc__EGG__Archive = .text:0x80494140; // type:function size:0x114 +loadNAND__Q23EGG7ArchiveFP12NANDFileInfoPQ23EGG4Heapi = .text:0x80494140; // type:function size:0x114 initialize__Q23EGG7DvdFileFv = .text:0x80494260; // type:function size:0x40 __ct__Q23EGG7DvdFileFv = .text:0x804942A0; // type:function size:0x44 __dt__Q23EGG7DvdFileFv = .text:0x804942F0; // type:function size:0x68 @@ -26154,10 +26154,10 @@ readData__Q23EGG7DvdFileFPvll = .text:0x80494510; // type:function size:0xC4 writeData__Q23EGG7DvdFileFPCvll = .text:0x804945E0; // type:function size:0x8 sync__Q23EGG7DvdFileFv = .text:0x804945F0; // type:function size:0x54 doneProcess__Q23EGG7DvdFileFlP11DVDFileInfo = .text:0x80494650; // type:function size:0x14 -getFileSize__Q23EGG7DvdFileFv = .text:0x80494670; // type:function size:0x8 +getFileSize__Q23EGG7DvdFileCFv = .text:0x80494670; // type:function size:0x8 loadToMainRAM__Q23EGG9DvdRipperFlPUcPQ23EGG4HeapQ33EGG9DvdRipper15EAllocDirectionUlPUlPUl = .text:0x80494680; // type:function size:0xAC -loadToMainRAM__Q23EGG9DvdRipperFPQ23EGG7DvdFilePUcPQ23EGG4HeapQ33EGG9DvdRipper15EAllocDirectionUlPUlPUl = .text:0x80494730; // type:function size:0xAC -EGG__DvdRipper__loadToMainRAM = .text:0x804947E0; // type:function size:0x1C8 +loadToMainRAM__Q23EGG9DvdRipperFPCcPUcPQ23EGG4HeapQ33EGG9DvdRipper15EAllocDirectionUlPUlPUl = .text:0x80494730; // type:function size:0xAC +loadToMainRAM__Q23EGG9DvdRipperFPQ23EGG7DvdFilePUcPQ23EGG4HeapQ33EGG9DvdRipper15EAllocDirectionUlPUlPUl = .text:0x804947E0; // type:function size:0x1C8 loadToMainRAMDecomp__Q23EGG9DvdRipperFPQ23EGG7DvdFilePQ23EGG12StreamDecompPUcPQ23EGG4HeapQ33EGG9DvdRipper15EAllocDirectionlUlUlPUlPUl = .text:0x804949B0; // type:function size:0x2D0 init__Q23EGG14StreamDecompLZFPvUl = .text:0x80494C80; // type:function size:0x30 decomp__Q23EGG14StreamDecompLZFPCvUl = .text:0x80494CB0; // type:function size:0x2C @@ -26167,22 +26167,22 @@ init__Q23EGG14StreamDecompLHFPvUl = .text:0x80494D40; // type:function size:0x30 decomp__Q23EGG14StreamDecompLHFPCvUl = .text:0x80494D70; // type:function size:0x2C init__Q23EGG15StreamDecompLRCFPvUl = .text:0x80494DA0; // type:function size:0x30 decomp__Q23EGG15StreamDecompLRCFPCvUl = .text:0x80494DD0; // type:function size:0x2C -GetSZSUncompressedSize__EGG__StreamDecompSZS = .text:0x80494E00; // type:function size:0x24 -InitUncompContextSZS__EGG__StreamDecompSZS = .text:0x80494E30; // type:function size:0x30 -VerifiesSZSHeader__EGG__StreamDecompSZS = .text:0x80494E60; // type:function size:0xFC -ReadUncompSZS__EGG__StreamDecompSZS = .text:0x80494F60; // type:function size:0x270 +getUncompressedSize__Q23EGG16UncompContextSZSFPCv = .text:0x80494E00; // type:function size:0x24 +initUncompContext__Q23EGG16UncompContextSZSFPv = .text:0x80494E30; // type:function size:0x30 +readHeader__Q23EGG16UncompContextSZSFPUcPlPCUcUll = .text:0x80494E60; // type:function size:0xFC +readUncomp__Q23EGG16UncompContextSZSFPCvUl = .text:0x80494F60; // type:function size:0x270 init__Q23EGG15StreamDecompSZSFPvUl = .text:0x804951D0; // type:function size:0x30 decomp__Q23EGG15StreamDecompSZSFPCvUl = .text:0x80495200; // type:function size:0x2C -getUncompressedSize__Q23EGG15StreamDecompSZSFPCv = .text:0x80495230; // type:function size:0x8 -getHeaderSize__Q23EGG15StreamDecompSZSFv = .text:0x80495240; // type:function size:0x8 -getUncompressedSize__Q23EGG15StreamDecompLRCFPCv = .text:0x80495250; // type:function size:0x8 -getHeaderSize__Q23EGG15StreamDecompLRCFv = .text:0x80495260; // type:function size:0x8 -getUncompressedSize__Q23EGG14StreamDecompLHFPCv = .text:0x80495270; // type:function size:0x8 -getHeaderSize__Q23EGG14StreamDecompLHFv = .text:0x80495280; // type:function size:0x8 -getUncompressedSize__Q23EGG14StreamDecompRLFPCv = .text:0x80495290; // type:function size:0x8 -getHeaderSize__Q23EGG14StreamDecompRLFv = .text:0x804952A0; // type:function size:0x8 -getUncompressedSize__Q23EGG14StreamDecompLZFPCv = .text:0x804952B0; // type:function size:0x8 -getHeaderSize__Q23EGG14StreamDecompLZFv = .text:0x804952C0; // type:function size:0x8 +getUncompressedSize__Q23EGG15StreamDecompSZSFPCv = .text:0x80495230; // type:function size:0x8 scope:weak +getHeaderSize__Q23EGG15StreamDecompSZSFv = .text:0x80495240; // type:function size:0x8 scope:weak +getUncompressedSize__Q23EGG15StreamDecompLRCFPCv = .text:0x80495250; // type:function size:0x8 scope:weak +getHeaderSize__Q23EGG15StreamDecompLRCFv = .text:0x80495260; // type:function size:0x8 scope:weak +getUncompressedSize__Q23EGG14StreamDecompLHFPCv = .text:0x80495270; // type:function size:0x8 scope:weak +getHeaderSize__Q23EGG14StreamDecompLHFv = .text:0x80495280; // type:function size:0x8 scope:weak +getUncompressedSize__Q23EGG14StreamDecompRLFPCv = .text:0x80495290; // type:function size:0x8 scope:weak +getHeaderSize__Q23EGG14StreamDecompRLFv = .text:0x804952A0; // type:function size:0x8 scope:weak +getUncompressedSize__Q23EGG14StreamDecompLZFPCv = .text:0x804952B0; // type:function size:0x8 scope:weak +getHeaderSize__Q23EGG14StreamDecompLZFv = .text:0x804952C0; // type:function size:0x8 scope:weak MEM_AllocFor_Heap__FP12MEMAllocatorUl = .text:0x804952D0; // type:function size:0x1C scope:local MEM_FreeFor_Heap__FP12MEMAllocatorPv = .text:0x804952F0; // type:function size:0x14 scope:local MEMInitAllocatorFor_Heap__FP12MEMAllocatorlPv = .text:0x80495310; // type:function size:0x1C @@ -26235,7 +26235,7 @@ getTotalFreeSize__Q23EGG7FrmHeapFv = .text:0x804962C0; // type:function size:0x1 getAllocatableSize__Q23EGG7FrmHeapFl = .text:0x804962E0; // type:function size:0x8 adjust__Q23EGG7FrmHeapFv = .text:0x804962F0; // type:function size:0x78 recordState__Q23EGG7FrmHeapFUl = .text:0x80496370; // type:function size:0x8 -freeState__Q23EGG7FrmHeapFUl = .text:0x80496380; // type:function size:0x8 +freeByState__Q23EGG7FrmHeapFUl = .text:0x80496380; // type:function size:0x8 getHeapKind__Q23EGG7FrmHeapCFv = .text:0x80496390; // type:function size:0x8 __ct__Q23EGG10AssertHeapFP12MEMiHeapHead = .text:0x804963A0; // type:function size:0x3C __dt__Q23EGG10AssertHeapFv = .text:0x804963E0; // type:function size:0x74 @@ -26315,8 +26315,8 @@ init__Q23EGG10CoreStatusFv = .text:0x80498F90; // type:function size:0xC getFSStickButton__Q23EGG10CoreStatusCFv = .text:0x80498FA0; // type:function size:0xAC __ct__Q23EGG14CoreControllerFv = .text:0x80499050; // type:function size:0x60 sceneReset__Q23EGG14CoreControllerFv = .text:0x804990B0; // type:function size:0xB4 -getDpdRawPos__Q23EGG14CoreControllerCFv = .text:0x80499170; // type:function size:0x14 -getDpdDistance__Q23EGG14CoreControllerCFv = .text:0x80499190; // type:function size:0xC +getDpdRawPos__Q23EGG14CoreControllerFv = .text:0x80499170; // type:function size:0x14 +getDpdValidFlag__Q23EGG14CoreControllerFv = .text:0x80499190; // type:function size:0xC startMotor__Q23EGG14CoreControllerFv = .text:0x804991A0; // type:function size:0xC stopMotor__Q23EGG14CoreControllerFv = .text:0x804991B0; // type:function size:0xC createRumbleMgr__Q23EGG14CoreControllerFUc = .text:0x804991C0; // type:function size:0x58 @@ -26324,7 +26324,7 @@ startPatternRumble__Q23EGG14CoreControllerFPCcib = .text:0x80499220; // type:fun stopRumbleMgr__Q23EGG14CoreControllerFv = .text:0x80499240; // type:function size:0x14 getCoreStatus__Q23EGG14CoreControllerFi = .text:0x80499260; // type:function size:0x10 calc_posture_matrix__Q23EGG14CoreControllerFRQ23EGG9Matrix34fb = .text:0x80499270; // type:function size:0x3E8 -beginFrame__Q23EGG14CoreControllerFPv = .text:0x80499660; // type:function size:0x3F4 +beginFrame__Q23EGG14CoreControllerFP9PADStatus = .text:0x80499660; // type:function size:0x3F4 endFrame__Q23EGG14CoreControllerFv = .text:0x80499A60; // type:function size:0x5C getFreeStickX__Q23EGG14CoreControllerCFv = .text:0x80499AC0; // type:function size:0x1C getFreeStickY__Q23EGG14CoreControllerCFv = .text:0x80499AE0; // type:function size:0x1C @@ -26333,8 +26333,8 @@ createInstance__Q23EGG17CoreControllerMgrFv = .text:0x80499B80; // type:function deleteInstance__Q23EGG17CoreControllerMgrFv = .text:0x80499BD0; // type:function size:0x10 getNthController__Q23EGG17CoreControllerMgrFi = .text:0x80499BE0; // type:function size:0x74 errRangeOver__Q23EGG32TBufferFv = .text:0x80499C60; // type:function size:0x4 -allocThunk__Q23EGG17CoreControllerMgrFUl = .text:0x80499C70; // type:function size:0x18 -deleteThunk__Q23EGG17CoreControllerMgrFPv = .text:0x80499C90; // type:function size:0x38 +alloc__Q23EGG27@unnamed@eggController_cpp@FUl = .text:0x80499C70; // type:function size:0x18 +free__Q23EGG27@unnamed@eggController_cpp@FPv = .text:0x80499C90; // type:function size:0x38 connectCallback__Q23EGG17CoreControllerMgrFll = .text:0x80499CD0; // type:function size:0x3C __ct__Q23EGG17CoreControllerMgrFv = .text:0x80499D10; // type:function size:0x320 __dt__Q23EGG32TBufferFv = .text:0x8049A030; // type:function size:0x78 @@ -26350,16 +26350,16 @@ stop__Q23EGG19ControllerRumbleMgrFv = .text:0x8049A620; // type:function size:0x calc__Q23EGG19ControllerRumbleMgrFv = .text:0x8049A690; // type:function size:0x104 startPattern__Q23EGG19ControllerRumbleMgrFPCcib = .text:0x8049A7A0; // type:function size:0x50 getUnitFromList__Q23EGG19ControllerRumbleMgrFb = .text:0x8049A7F0; // type:function size:0xAC -__dt__Q23EGG19ControllerRumbleMgrFv = .text:0x8049A8A0; // type:function size:0x40 -__dt__Q23EGG20ControllerRumbleUnitFv = .text:0x8049A8E0; // type:function size:0x40 -setAccParam__Q23EGG14CoreControllerFff = .text:0x8049A920; // type:function size:0x8 -setDistParam__Q23EGG14CoreControllerFff = .text:0x8049A930; // type:function size:0x8 -setHoriParam__Q23EGG14CoreControllerFff = .text:0x8049A940; // type:function size:0x8 -allocate__Q23EGG29TBufferFii = .text:0x8049A950; // type:function size:0x50 -allocate__Q23EGG29TBufferFiPQ23EGG4Heapi = .text:0x8049A9A0; // type:function size:0x74 -onAllocate__Q23EGG29TBufferFPQ23EGG4Heap = .text:0x8049AA20; // type:function size:0x4 -allocate__Q23EGG32TBufferFii = .text:0x8049AA30; // type:function size:0x50 -allocate__Q23EGG32TBufferFiPQ23EGG4Heapi = .text:0x8049AA80; // type:function size:0x74 +__dt__Q23EGG19ControllerRumbleMgrFv = .text:0x8049A8A0; // type:function size:0x40 scope:weak +__dt__Q23EGG20ControllerRumbleUnitFv = .text:0x8049A8E0; // type:function size:0x40 scope:weak +setAccParam__Q23EGG14CoreControllerFff = .text:0x8049A920; // type:function size:0x8 scope:weak +setDistParam__Q23EGG14CoreControllerFff = .text:0x8049A930; // type:function size:0x8 scope:weak +setHoriParam__Q23EGG14CoreControllerFff = .text:0x8049A940; // type:function size:0x8 scope:weak +allocate__Q23EGG29TBufferFii = .text:0x8049A950; // type:function size:0x50 scope:weak +allocate__Q23EGG29TBufferFiPQ23EGG4Heapi = .text:0x8049A9A0; // type:function size:0x74 scope:weak +onAllocate__Q23EGG29TBufferFPQ23EGG4Heap = .text:0x8049AA20; // type:function size:0x4 scope:weak +allocate__Q23EGG32TBufferFii = .text:0x8049AA30; // type:function size:0x50 scope:weak +allocate__Q23EGG32TBufferFiPQ23EGG4Heapi = .text:0x8049AA80; // type:function size:0x74 scope:weak onAllocate__Q23EGG32TBufferFPQ23EGG4Heap = .text:0x8049AB00; // type:function size:0x4 __sinit_\eggController_cpp = .text:0x8049AB10; // type:function size:0x48 scope:local sqrt__Q23EGG7MathFf = .text:0x8049AB60; // type:function size:0x50 @@ -26402,27 +26402,27 @@ isOutsideMEM1__Q23EGG6AssertFUl = .text:0x8049C150; // type:function size:0x2C setAssertCallback__Q23EGG6AssertFPFv_v = .text:0x8049C180; // type:function size:0x10 system_halt__Q23EGG6AssertFPCcUlPCcP16__va_list_struct = .text:0x8049C190; // type:function size:0x398 assert__Q23EGG6AssertFPCcUlPCce = .text:0x8049C530; // type:function size:0x8C -EGG__BaseCamera__updateMatrix = .text:0x8049C5C0; // type:function size:0x10 -EGG__BaseCamera__draw = .text:0x8049C5D0; // type:function size:0x50 -EGG__BaseCamera__setG3DCamera = .text:0x8049C620; // type:function size:0x44 -EGG__BaseCamera__getSomething = .text:0x8049C670; // type:function size:0x8 -doUpdateMatrix = .text:0x8049C680; // type:function size:0x25C -FUN_8049c8e0 = .text:0x8049C8E0; // type:function size:0x4 -loadMatrix = .text:0x8049C8F0; // type:function size:0x4C -FUN_8049c940 = .text:0x8049C940; // type:function size:0x4 -EGG__OrthoCamera____ct = .text:0x8049C950; // type:function size:0x78 -EGG__OrthoCamera__update_params = .text:0x8049C9D0; // type:function size:0x88 -FUN_8049ca60 = .text:0x8049CA60; // type:function size:0x34 -FUN_8049caa0 = .text:0x8049CAA0; // type:function size:0x1C -FUN_8049cac0 = .text:0x8049CAC0; // type:function size:0x8 -storeTLUT__10JUTPaletteF7_GXTlut10_GXTlutFmt15JUTTransparencyUsPv = .text:0x8049CAD0; // type:function size:0x24 -load__10JUTPaletteFv = .text:0x8049CB00; // type:function size:0x44 -__dt__10JUTTextureFv = .text:0x8049CB50; // type:function size:0x78 -storeTIMG__10JUTTextureFPC7ResTIMGP10JUTPalette7_GXTlut = .text:0x8049CBD0; // type:function size:0x184 -attachPalette__10JUTTextureFP10JUTPalette = .text:0x8049CD60; // type:function size:0x40 -initTexObj__10JUTTextureFv = .text:0x8049CDA0; // type:function size:0xF0 -initTexObj__10JUTTextureF7_GXTlut = .text:0x8049CE90; // type:function size:0xF8 -load__10JUTTextureF11_GXTexMapID = .text:0x8049CF90; // type:function size:0x54 +updateMatrix__Q23EGG10BaseCameraFv = .text:0x8049C5C0; // type:function size:0x10 +draw__Q23EGG10BaseCameraFPQ23EGG10BaseCamera = .text:0x8049C5D0; // type:function size:0x50 +setG3DCamera__Q23EGG10BaseCameraFRQ34nw4r3g3d6Camera = .text:0x8049C620; // type:function size:0x44 +getViewMatrixOld__Q23EGG12LookAtCameraFv = .text:0x8049C670; // type:function size:0x8 +doUpdateMatrix__Q23EGG12LookAtCameraFv = .text:0x8049C680; // type:function size:0x25C +doDraw__Q23EGG12LookAtCameraFv = .text:0x8049C8E0; // type:function size:0x4 +loadMatrix__Q23EGG12LookAtCameraFv = .text:0x8049C8F0; // type:function size:0x4C +loadOldMatrix__Q23EGG12LookAtCameraFv = .text:0x8049C940; // type:function size:0x4 +__ct__Q23EGG11OrthoCameraFv = .text:0x8049C950; // type:function size:0x78 +update_parms__Q23EGG11OrthoCameraFv = .text:0x8049C9D0; // type:function size:0x88 +doUpdateMatrix__Q23EGG11OrthoCameraFv = .text:0x8049CA60; // type:function size:0x34 +getPosition__Q23EGG12LookAtCameraFv = .text:0x8049CAA0; // type:function size:0x1C +getViewMatrix__Q23EGG12LookAtCameraCFv = .text:0x8049CAC0; // type:function size:0x8 +storeTLUT__Q23EGG7PaletteF7_GXTlut10_GXTlutFmtQ23EGG15JUTTransparencyUsPv = .text:0x8049CAD0; // type:function size:0x24 +load__Q23EGG7PaletteFv = .text:0x8049CB00; // type:function size:0x44 +__dt__Q23EGG7TextureFv = .text:0x8049CB50; // type:function size:0x78 +storeTIMG__Q23EGG7TextureFPCQ23EGG7ResTIMGUc = .text:0x8049CBD0; // type:function size:0x184 +attachPalette__Q23EGG7TextureFPQ23EGG7Palette = .text:0x8049CD60; // type:function size:0x40 +initTexObj__Q23EGG7TextureFvl = .text:0x8049CDA0; // type:function size:0xF0 +initTexObj__Q23EGG7TextureF7_GXTlut = .text:0x8049CE90; // type:function size:0xF8 +load__Q23EGG7TextureF11_GXTexMapID = .text:0x8049CF90; // type:function size:0x54 FUN_8049cff0 = .text:0x8049CFF0; // type:function size:0x12C FUN_8049d120 = .text:0x8049D120; // type:function size:0x590 FUN_8049d6b0 = .text:0x8049D6B0; // type:function size:0xB8 @@ -26456,31 +26456,31 @@ DrawCircleYPolygonFan__23@unnamed@eggDrawGX_cpp@FRCQ34nw4r4math5MTX34fUs = .text Initialize__Q23EGG6DrawGXFPQ23EGG4Heap = .text:0x8049F070; // type:function size:0xA8 GetTexMapDefault__Q23EGG6DrawGXFv = .text:0x8049F120; // type:function size:0x8 GetLightMaskDefault__Q23EGG6DrawGXFv = .text:0x8049F130; // type:function size:0x8 -EGG__DrawGX__BeginDrawLine = .text:0x8049F140; // type:function size:0x78 -EGG__DrawGX__BeginDrawCircleZ = .text:0x8049F1C0; // type:function size:0x78 -EGG__DrawGX__BeginDrawQuad = .text:0x8049F240; // type:function size:0xDC +BeginDrawLine__Q23EGG6DrawGXFQ33EGG6DrawGX12ColorChannelQ33EGG6DrawGX5ZMode = .text:0x8049F140; // type:function size:0x78 +BeginDrawCircleZ__Q23EGG6DrawGXFQ33EGG6DrawGX12ColorChannelQ33EGG6DrawGX5ZMode = .text:0x8049F1C0; // type:function size:0x78 +BeginDrawQuad__Q23EGG6DrawGXFQ33EGG6DrawGX12ColorChannelQ33EGG6DrawGX5ZModeQ33EGG6DrawGX5Blendbb = .text:0x8049F240; // type:function size:0xDC BeginDrawScreen__Q23EGG6DrawGXFbbb = .text:0x8049F320; // type:function size:0xE0 -EGG__DrawGX__DrawLineStrip = .text:0x8049F400; // type:function size:0x1EC -EGG__DrawGX__DrawLine = .text:0x8049F5F0; // type:function size:0x1EC +DrawLineStrip__Q23EGG6DrawGXFPCQ23EGG8Vector3fUs7GXColorUc = .text:0x8049F400; // type:function size:0x1EC +DrawLine__Q23EGG6DrawGXFPCQ23EGG8Vector3fUs7GXColorUc = .text:0x8049F5F0; // type:function size:0x1EC ClearEfb__Q23EGG6DrawGXFRCQ34nw4r4math5MTX34bbb8_GXColorb = .text:0x8049F7E0; // type:function size:0x264 -EGG__DrawGX__ResetMaterial = .text:0x8049FA50; // type:function size:0x64 +ResetMaterial__Q23EGG6DrawGXFQ33EGG6DrawGX12ColorChannel = .text:0x8049FA50; // type:function size:0x64 SetMat_ColorChannel__Q23EGG6DrawGXFQ33EGG6DrawGX12ColorChannel = .text:0x8049FAC0; // type:function size:0xD8 SetMat_TexGen__Q23EGG6DrawGXFQ33EGG6DrawGX6TexGen = .text:0x8049FBA0; // type:function size:0x7C SetMat_Ind__Q23EGG6DrawGXFv = .text:0x8049FC20; // type:function size:0x8 SetMat_Tev__Q23EGG6DrawGXF13_GXTevStageIDQ33EGG6DrawGX10TevSetting = .text:0x8049FC30; // type:function size:0x1FC -SetMat_PE__Q23EGG6DrawGXFQ33EGG6DrawGX5ZModeQ33EGG6Dr = .text:0x8049FE30; // type:function size:0x64 +SetMat_PE__Q23EGG6DrawGXFQ33EGG6DrawGX5ZModeQ33EGG6DrawGX5Blend = .text:0x8049FE30; // type:function size:0x64 LoadTexture__Q23EGG6DrawGXFPCQ23EGG7ResTIMG11_GXTexMapID = .text:0x8049FEA0; // type:function size:0x40 LoadTexture__Q23EGG6DrawGXFQ34nw4r3g3d6ResTex11_GXTexMapID = .text:0x8049FEE0; // type:function size:0x58 SetVtxState__Q23EGG6DrawGXFQ33EGG6DrawGX7VtxType = .text:0x8049FF40; // type:function size:0x398 -EGG__DrawGX__CreateDisplayList = .text:0x804A02E0; // type:function size:0x800 +CreateDisplayList__Q23EGG6DrawGXFPQ23EGG4Heap = .text:0x804A02E0; // type:function size:0x800 DrawDL__Q23EGG6DrawGXFQ33EGG6DrawGX2DLRCQ34nw4r4math5MTX348_GXColor = .text:0x804A0AE0; // type:function size:0x88 SetZMode__Q23EGG6DrawGXFQ33EGG6DrawGX5ZMode = .text:0x804A0B70; // type:function size:0x20 SetBlendMode__Q23EGG6DrawGXFQ33EGG6DrawGX5Blend = .text:0x804A0B90; // type:function size:0x24 -CreateDisplayList__Q23EGG6DrawGXFPQ23EGG4Heap = .text:0x804A0BC0; // type:function size:0x5C -__sinit_\eggDrawGX_cpp = .text:0x804A0C20; // type:function size:0x4 +DrawDLWorld__Q23EGG6DrawGXFQ33EGG6DrawGX2DLRCQ23EGG9Matrix34f7GXColor = .text:0x804A0BC0; // type:function size:0x5C +__sinit_\eggDrawGX_cpp = .text:0x804A0C20; // type:function size:0x4 scope:local __ct__Q23EGG12DrawPathBaseFv = .text:0x804A0C30; // type:function size:0x58 createScnProc__Q23EGG12DrawPathBaseFP12MEMAllocator = .text:0x804A0C90; // type:function size:0x1B0 -internalResetForDraw__Q23EGG12DrawPathBaseFv = .text:0x804A0E40; // type:function size:0x20 +ExecCallback_CALC_VIEW__Q23EGG12DrawPathBaseFQ44nw4r3g3d6ScnObj6TimingPQ34nw4r3g3d6ScnObjUlPv = .text:0x804A0E40; // type:function size:0x20 scnProcDraw__Q23EGG12DrawPathBaseFUs = .text:0x804A0E60; // type:function size:0x20 @8@__dt__Q23EGG12DrawPathBaseFv = .text:0x804A0E80; // type:function size:0x8 @20@__dt__Q23EGG12DrawPathBaseFv = .text:0x804A0E90; // type:function size:0x8 @@ -37140,8 +37140,8 @@ __vt__Q34nw4r3lyt18AnimTransformBasic = .data:0x8056E7B8; // type:object size:0x __vt__Q34nw4r3lyt16ResourceAccessor = .data:0x8056E7E0; // type:object size:0x14 __vt__Q34nw4r3lyt24MultiArcResourceAccessor = .data:0x8056E7F8; // type:object size:0x14 __vt__Q34nw4r3lyt19ArcResourceAccessor = .data:0x8056E80C; // type:object size:0x14 -Egg__Archive__vtable = .data:0x8056E820; // type:object size:0x10 -EGG__DvdFile__vtable = .data:0x8056E830; // type:object size:0x28 +__vt__Q23EGG7Archive = .data:0x8056E820; // type:object size:0xC +__vt__Q23EGG7DvdFile = .data:0x8056E830; // type:object size:0x28 __vt__Q23EGG15StreamDecompSZS = .data:0x8056E858; // type:object size:0x18 __vt__Q23EGG15StreamDecompLRC = .data:0x8056E870; // type:object size:0x18 __vt__Q23EGG14StreamDecompLH = .data:0x8056E888; // type:object size:0x18 @@ -37155,8 +37155,8 @@ __vt__Q23EGG4Heap = .data:0x8056E950; // type:object size:0x30 lbl_8056E980 = .data:0x8056E980; // type:object size:0xF data:string lbl_8056E990 = .data:0x8056E990; // type:object size:0xB data:string __vt__Q23EGG7ExpHeap = .data:0x8056E9A0; // type:object size:0x30 -EGG__FrmHeap__vtable = .data:0x8056E9D0; // type:object size:0x30 -EGG__AssertHeap__vtable = .data:0x8056EA00; // type:object size:0x30 +__vt__Q23EGG7FrmHeap = .data:0x8056E9D0; // type:object size:0x30 +__vt__Q23EGG10AssertHeap = .data:0x8056EA00; // type:object size:0x30 __vt__Q23EGG8Disposer = .data:0x8056EA30; // type:object size:0xC __vt__Q23EGG6Thread = .data:0x8056EA40; // type:object size:0x18 lbl_8056EA58 = .data:0x8056EA58; // type:object size:0x70 @@ -37165,14 +37165,14 @@ __vt__Q23EGG10ColorFader = .data:0x8056EAE8; // type:object size:0x24 clear_z_TX__29@unnamed@eggAsyncDisplay_cpp@ = .data:0x8056EB20; // type:object size:0x40 scope:local __vt__Q23EGG12AsyncDisplay = .data:0x8056EB60; // type:object size:0x20 __vt__Q23EGG12GraphicsFifo = .data:0x8056EB80; // type:object size:0xC -lbl_8056EB90 = .data:0x8056EB90; // type:object size:0x18 +lbl_8056EB90 = .data:0x8056EB90; // type:object size:0x17 data:string __vt__Q23EGG19ControllerRumbleMgr = .data:0x8056EBA8; // type:object size:0xC __vt__Q23EGG20ControllerRumbleUnit = .data:0x8056EBB4; // type:object size:0xC __vt__Q23EGG14NullController = .data:0x8056EBC0; // type:object size:0x38 __vt__Q23EGG17CoreControllerMgr = .data:0x8056EBF8; // type:object size:0x10 __vt__Q23EGG29TBuffer = .data:0x8056EC08; // type:object size:0x1C __vt__Q23EGG32TBuffer = .data:0x8056EC24; // type:object size:0x1C -__vt__Q33EGG17CoreControllerMgr11T__Disposer = .data:0x8056EC40; // type:object size:0x10 +__vt__Q33EGG17CoreControllerMgr11T__Disposer = .data:0x8056EC40; // type:object size:0xC __vt__Q23EGG14CoreController = .data:0x8056EC50; // type:object size:0x38 lbl_8056EC88 = .data:0x8056EC88; // type:object size:0xE data:string lbl_8056EC98 = .data:0x8056EC98; // type:object size:0x16 data:string @@ -39642,11 +39642,11 @@ NW4R_LYT_Version___22@unnamed@lyt_init_cpp@ = .sdata:0x80574EB0; // type:object lbl_80574EB8 = .sdata:0x80574EB8; // type:object size:0x4 data:string lbl_80574EC0 = .sdata:0x80574EC0; // type:object size:0x2 data:string lbl_80574EC4 = .sdata:0x80574EC4; // type:object size:0x3 data:string -lbl_80574EC8 = .sdata:0x80574EC8; // type:object size:0x8 -EGG__DvdRipper__sErrorRetry = .sdata:0x80574ED0; // type:object size:0x8 data:byte +lbl_80574EC8 = .sdata:0x80574EC8; // type:object size:0x2 data:string +sErrorRetry__Q23EGG9DvdRipper = .sdata:0x80574ED0; // type:object size:0x1 data:byte lbl_80574ED8 = .sdata:0x80574ED8; // type:object size:0x7 data:string lbl_80574EE0 = .sdata:0x80574EE0; // type:object size:0x5 data:string -EGG__CoreControllerMgr__sWPADWorkSize = .sdata:0x80574EE8; // type:object size:0x8 data:4byte +sWPADWorkSize__Q23EGG17CoreControllerMgr = .sdata:0x80574EE8; // type:object size:0x4 data:4byte lbl_80574EF0 = .sdata:0x80574EF0; // type:object size:0x2 data:string lbl_80574EF8 = .sdata:0x80574EF8; // type:object size:0x8 data:string lbl_80574F00 = .sdata:0x80574F00; // type:object size:0x8 data:string @@ -40936,9 +40936,9 @@ typeInfo__Q34nw4r3lyt7TextBox = .sbss:0x80576708; // type:object size:0x4 data:4 typeInfo__Q34nw4r3lyt6Window = .sbss:0x80576710; // type:object size:0x4 data:4byte typeInfo__Q34nw4r3lyt8Bounding = .sbss:0x80576718; // type:object size:0x4 data:4byte @GUARD@SetSize__Q44nw4r3lyt6detail11TexCoordAryFUc@texCoords = .sbss:0x80576720; // type:object size:0x1 data:byte -EGG__Archive__sIsArchiveListInitialized = .sbss:0x80576728; // type:object size:0x8 data:byte -EGG__DvdFile__sIsInitialized = .sbss:0x80576730; // type:object size:0x8 data:byte -EGG__DvdRipper__sCallback = .sbss:0x80576738; // type:object size:0x8 data:4byte +sIsArchiveListInitialized__Q23EGG7Archive = .sbss:0x80576728; // type:object size:0x1 data:byte +sIsInitialized__Q23EGG7DvdFile = .sbss:0x80576730; // type:object size:0x1 data:byte +sCallback__Q23EGG9DvdRipper = .sbss:0x80576738; // type:object size:0x4 data:4byte sCurrentHeap__Q23EGG4Heap = .sbss:0x80576740; // type:object size:0x4 data:4byte sIsHeapListInitialized__Q23EGG4Heap = .sbss:0x80576744; // type:object size:0x4 data:4byte sAllocatableHeap__Q23EGG4Heap = .sbss:0x80576748; // type:object size:0x4 data:4byte @@ -40962,7 +40962,7 @@ sStaticDisposer__Q33EGG17CoreControllerMgr11T__Disposer = .sbss:0x805767AC; // t sCoreControllerFactory__Q23EGG17CoreControllerMgr = .sbss:0x805767B0; // type:object size:0x4 data:4byte sConnectCallback__Q23EGG17CoreControllerMgr = .sbss:0x805767B4; // type:object size:0x4 data:4byte sUseBuiltinWpadAllocator__Q23EGG17CoreControllerMgr = .sbss:0x805767B8; // type:object size:0x1 data:byte -sWPADAllocator__3EGG = .sbss:0x805767BC; // type:object size:0x4 data:4byte +sAllocator__Q23EGG27@unnamed@eggController_cpp@ = .sbss:0x805767BC; // type:object size:0x4 data:4byte zero__Q23EGG8Vector2f = .sbss:0x805767C0; // type:object size:0x8 data:float ex__Q23EGG8Vector2f = .sbss:0x805767C8; // type:object size:0x8 data:float ey__Q23EGG8Vector2f = .sbss:0x805767D0; // type:object size:0x8 data:float @@ -49409,8 +49409,8 @@ lbl_80673A44 = .bss:0x80673A44; // type:object size:0x3C lbl_80673A80 = .bss:0x80673A80; // type:object size:0xC lbl_80673A8C = .bss:0x80673A8C; // type:object size:0x1C data:byte @LOCAL@SetSize__Q44nw4r3lyt6detail11TexCoordAryFUc@texCoords = .bss:0x80673AA8; // type:object size:0x20 scope:local data:float -EGG__Archive__sArchiveList = .bss:0x80673AC8; // type:object size:0x10 -EGG__DvdFile__sDvdList = .bss:0x80673AD8; // type:object size:0x10 +sArchiveList__Q23EGG7Archive = .bss:0x80673AC8; // type:object size:0xC +sDvdList__Q23EGG7DvdFile = .bss:0x80673AD8; // type:object size:0xC sHeapList__Q23EGG4Heap = .bss:0x80673AE8; // type:object size:0xC sRootMutex__Q23EGG4Heap = .bss:0x80673AF8; // type:object size:0x18 sThreadList__Q23EGG6Thread = .bss:0x80673B10; // type:object size:0xC diff --git a/configure.py b/configure.py index 5f37ce50..96ed1ad4 100644 --- a/configure.py +++ b/configure.py @@ -665,21 +665,21 @@ config.libs = [ Object(Matching, "nw4r/lyt/lyt_arcResourceAccessor.cpp"), Object(Matching, "nw4r/lyt/lyt_common.cpp"), Object(Matching, "nw4r/lyt/lyt_util.cpp"), - ], [""] + ], ), # EGG EGGLib( "core", [ - Object(NonMatching, "egg/core/eggArchive.cpp"), - Object(NonMatching, "egg/core/eggDvdFile.cpp"), - Object(NonMatching, "egg/core/eggDvdRipper.cpp"), - Object(NonMatching, "egg/core/eggStream.cpp"), + Object(Matching, "egg/core/eggArchive.cpp"), + Object(Matching, "egg/core/eggDvdFile.cpp"), + Object(Matching, "egg/core/eggDvdRipper.cpp"), + Object(Matching, "egg/core/eggStreamDecomp.cpp"), Object(Matching, "egg/core/eggAllocator.cpp"), Object(Matching, "egg/core/eggHeap.cpp"), Object(Matching, "egg/core/eggExpHeap.cpp"), - Object(NonMatching, "egg/core/eggFrmHeap.cpp"), - Object(NonMatching, "egg/core/eggAssertHeap.cpp"), + Object(Matching, "egg/core/eggFrmHeap.cpp"), + Object(Matching, "egg/core/eggAssertHeap.cpp"), Object(Matching, "egg/core/eggDisposer.cpp"), Object(Matching, "egg/core/eggThread.cpp"), Object(NonMatching, "egg/core/eggUnk.cpp"), @@ -691,7 +691,7 @@ config.libs = [ Object(Matching, "egg/core/eggXfb.cpp"), Object(Matching, "egg/core/eggXfbManager.cpp"), Object(Matching, "egg/core/eggGraphicsFifo.cpp"), - Object(NonMatching, "egg/core/eggController.cpp"), + Object(Matching, "egg/core/eggController.cpp"), ], ), EGGLib( @@ -709,6 +709,63 @@ config.libs = [ Object(Matching, "egg/prim/eggAssert.cpp"), ], ), + EGGLib( + "gfx", + [ + Object(NonMatching, "egg/gfx/eggCamera.cpp"), + Object(NonMatching, "egg/gfx/eggPalette.cpp"), + Object(NonMatching, "egg/gfx/eggTexture.cpp"), + Object(NonMatching, "egg/gfx/eggUnk1.cpp"), # Unknown + Object(NonMatching, "egg/gfx/eggCapTexture.cpp"), + Object(NonMatching, "egg/gfx/eggCpuTexture.cpp"), + Object(NonMatching, "egg/gfx/eggDrawGX.cpp"), + Object(NonMatching, "egg/gfx/eggDrawPathBase.cpp"), + Object(NonMatching, "egg/gfx/eggDrawPathUnk1.cpp"), + Object(NonMatching, "egg/gfx/eggDrawPathDOF.cpp"), + Object(NonMatching, "egg/gfx/eggDrawPathUnk2.cpp"), + Object(NonMatching, "egg/gfx/eggFog.cpp"), + Object(NonMatching, "egg/gfx/eggFrustum.cpp"), + Object(NonMatching, "egg/gfx/eggG3DUtility.cpp"), # Unknown Guess + Object(NonMatching, "egg/gfx/eggGfxEngine.cpp"), + Object(NonMatching, "egg/gfx/eggGlobalDrawState.cpp"), + Object(NonMatching, "egg/gfx/eggGXUtility.cpp"), + Object(NonMatching, "egg/gfx/eggIScnProc.cpp"), + Object(NonMatching, "egg/gfx/eggLight.cpp"), + Object(NonMatching, "egg/gfx/eggLightTexture.cpp"), + Object(NonMatching, "egg/gfx/eggLightTextureMgr.cpp"), + Object(NonMatching, "egg/gfx/eggModelEx.cpp"), + Object(NonMatching, "egg/gfx/eggPostEffectBase.cpp"), + Object(NonMatching, "egg/gfx/eggPostEffectBlur.cpp"), + Object(NonMatching, "egg/gfx/eggPostEffectUnk1.cpp"), # Unknown + Object(NonMatching, "egg/gfx/eggPostEffectUnk2.cpp"), # Unknown + Object(NonMatching, "egg/gfx/eggPostEffectMask.cpp"), + Object(NonMatching, "egg/gfx/eggPostEffectMaskDOF.cpp"), + Object(NonMatching, "egg/gfx/eggPostEffectSimple.cpp"), + Object(NonMatching, "egg/gfx/eggScreen.cpp"), + Object(NonMatching, "egg/gfx/eggScreenEffectBase.cpp"), + Object(NonMatching, "egg/gfx/eggScreenEffectBlur.cpp"), # Unknown Guess + Object(NonMatching, "egg/gfx/eggStateEfb.cpp"), + Object(NonMatching, "egg/gfx/eggStateGX.cpp"), + Object(NonMatching, "egg/gfx/eggTextureBuffer.cpp"), + ], + ), + EGGLib( + "audio", + [ + Object(NonMatching, "egg/audio/eggAudioArcPlayerMgr.cpp"), + Object(NonMatching, "egg/audio/eggAudioHeapMgr.cpp"), + Object(NonMatching, "egg/audio/eggAudioMgr.cpp"), + Object(NonMatching, "egg/audio/eggAudioRmtSpeakerMgr.cpp"), + Object(NonMatching, "egg/audio/eggAudioUtility.cpp"), + Object(NonMatching, "egg/audio/eggAudioSystem.cpp"), + ], + ), + EGGLib( + "util", + [ + Object(NonMatching, "egg/util/eggException.cpp"), + ], + ), # { # "lib": "MSL_C", # "mw_version": "GC/1.3.2", diff --git a/include/MSL_C/stdint.h b/include/MSL_C/stdint.h new file mode 100644 index 00000000..8430cfc8 --- /dev/null +++ b/include/MSL_C/stdint.h @@ -0,0 +1,14 @@ +#ifndef __STDC_STDINT_H__ +#define __STDC_STDINT_H__ + +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned long uint32_t; +typedef unsigned long long uint64_t; + +typedef signed char int8_t; +typedef signed short int16_t; +typedef signed long int32_t; +typedef signed long long int64_t; + +#endif // __STDC_STDINT_H__ diff --git a/include/common.h b/include/common.h index 7abfcc28..4cda72d9 100644 --- a/include/common.h +++ b/include/common.h @@ -22,7 +22,7 @@ #define DONT_INLINE __attribute__((never_inline)) // TODO - Fix MSL (stddef.h) -#define offsetof(ST, M) ((size_t) & (((ST*)0)->M)) +#define offsetof(ST, M) ((size_t) & (((ST *)0)->M)) // Codewarrior tricks for matching decomp // (Functions are given prototypes for -requireprotos) @@ -73,6 +73,8 @@ typedef void UNKTYPE; enum { FALSE, TRUE }; typedef int BOOL; +typedef unsigned char byte_t; + #ifdef __CWCC__ typedef unsigned long size_t; #endif diff --git a/include/context_bte.h b/include/context_bte.h new file mode 100644 index 00000000..fcb17b14 --- /dev/null +++ b/include/context_bte.h @@ -0,0 +1,978 @@ +#ifndef CONTEXT_BTE_H +#define CONTEXT_BTE_H + +#include + +/* Contains the context of the BTE library that the WPAD library needs to + * compile. + * + * This is not the full context; the other half of the context is in + * "context_rvl.h". + * + * Most of this code is copyright (C) 2003-2012 Broadcom Corporation under the + * Apache 2.0 License . The original + * source can be found at + * ; + * specifically, I used the earliest commit available (late 2012, commit hash + * 5738f83aeb59361a0a2eda2460113f6dc9194271). + */ + +/* License redistribution conditions + * + * a. You may obtain a copy of the License at + * . + * b. Some of the code is modified. Comments will be marked with my name + * (muff1n) to show what I modified and where. + * c. See the following comment block, which is copied verbatim from bluedroid + * source. + * d. No NOTICE file is present in the commit that I used. + */ + +/****************************************************************************** + * + * Copyright (C) 2003-2012 Broadcom Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ******************************************************************************/ + +// from bluedroid source + +typedef uint8_t UINT8; +typedef uint16_t UINT16; +typedef uint32_t UINT32; + +typedef int8_t INT8; + +typedef unsigned char BOOLEAN; + +#define BD_ADDR_LEN 6 /* Device address length */ +typedef UINT8 BD_ADDR[BD_ADDR_LEN]; /* Device address */ +typedef UINT8 *BD_ADDR_PTR; /* Pointer to Device Address */ + +#define LINK_KEY_LEN 16 +typedef UINT8 LINK_KEY[LINK_KEY_LEN]; /* Link Key */ + +#define DEV_CLASS_LEN 3 +typedef UINT8 DEV_CLASS[DEV_CLASS_LEN]; /* Device class */ +typedef UINT8 *DEV_CLASS_PTR; /* Pointer to Device class */ + +/* muff1n: TODO: bta_dm_pin_cback looks mostly the same except that BD_NAME_LEN + * is 33 (or it was 32 and BD_NAME_LEN was not decreased by 1 in BCM_STRNCPY_S + * calls)? + * confirm this + * + * UPDATE: there is a case where it is 248 + */ +#define BD_NAME_LEN 248 +typedef UINT8 BD_NAME[BD_NAME_LEN]; /* Device name */ +typedef UINT8 *BD_NAME_PTR; /* Pointer to Device name */ + +#define BD_FEATURES_LEN 8 +typedef UINT8 BD_FEATURES[BD_FEATURES_LEN]; /* LMP features supported by device */ + +#define BT_DEVICE_TYPE_BREDR 0x01 +#define BT_DEVICE_TYPE_BLE 0x02 +#define BT_DEVICE_TYPE_DUMO 0x03 +typedef UINT8 tBT_DEVICE_TYPE; + +/* Maximum UUID size - 16 bytes, and structure to hold any type of UUID. */ +#define MAX_UUID_SIZE 16 +typedef struct { +#define LEN_UUID_16 2 +#define LEN_UUID_32 4 +#define LEN_UUID_128 16 + + UINT16 len; + + union { + UINT16 uuid16; + UINT32 uuid32; + UINT8 uuid128[MAX_UUID_SIZE]; + } uu; + +} tBT_UUID; + +/* Status Return Value */ +#define BTA_SUCCESS 0 /* Successful operation. */ +#define BTA_FAILURE 1 /* Generic failure. */ +#define BTA_PENDING 2 /* API cannot be completed right now */ +#define BTA_BUSY 3 +#define BTA_NO_RESOURCES 4 +#define BTA_WRONG_MODE 5 + +typedef UINT8 tBTA_STATUS; + +/* + * Service ID + * + * NOTES: When you add a new Service ID for BTA AND require to change the value of BTA_MAX_SERVICE_ID, + * make sure that the correct security ID of the new service from Security service definitions (btm_api.h) + * should be added to bta_service_id_to_btm_srv_id_lkup_tbl table in bta_dm_act.c. + */ + +#define BTA_RES_SERVICE_ID 0 /* Reserved */ +#define BTA_SPP_SERVICE_ID 1 /* Serial port profile. */ +#define BTA_DUN_SERVICE_ID 2 /* Dial-up networking profile. */ +#define BTA_A2DP_SOURCE_SERVICE_ID 3 /* A2DP Source profile. */ +#define BTA_LAP_SERVICE_ID 4 /* LAN access profile. */ +#define BTA_HSP_SERVICE_ID 5 /* Headset profile. */ +#define BTA_HFP_SERVICE_ID 6 /* Hands-free profile. */ +#define BTA_OPP_SERVICE_ID 7 /* Object push */ +#define BTA_FTP_SERVICE_ID 8 /* File transfer */ +#define BTA_CTP_SERVICE_ID 9 /* Cordless Terminal */ +#define BTA_ICP_SERVICE_ID 10 /* Intercom Terminal */ +#define BTA_SYNC_SERVICE_ID 11 /* Synchronization */ +#define BTA_BPP_SERVICE_ID 12 /* Basic printing profile */ +#define BTA_BIP_SERVICE_ID 13 /* Basic Imaging profile */ +#define BTA_PANU_SERVICE_ID 14 /* PAN User */ +#define BTA_NAP_SERVICE_ID 15 /* PAN Network access point */ +#define BTA_GN_SERVICE_ID 16 /* PAN Group Ad-hoc networks */ +#define BTA_SAP_SERVICE_ID 17 /* SIM Access profile */ +#define BTA_A2DP_SERVICE_ID 18 /* A2DP Sink */ +#define BTA_AVRCP_SERVICE_ID 19 /* A/V remote control */ +#define BTA_HID_SERVICE_ID 20 /* HID */ +#define BTA_VDP_SERVICE_ID 21 /* Video distribution */ +#define BTA_PBAP_SERVICE_ID 22 /* PhoneBook Access Server*/ +#define BTA_HSP_HS_SERVICE_ID 23 /* HFP HS role */ +#define BTA_HFP_HS_SERVICE_ID 24 /* HSP HS role */ +#define BTA_MAP_SERVICE_ID 25 /* Message Access Profile */ +#define BTA_MN_SERVICE_ID 26 /* Message Notification Service */ +#define BTA_HDP_SERVICE_ID 27 /* Health Device Profile */ +#define BTA_PCE_SERVICE_ID 28 /* PhoneBook Access Client*/ + +#define BTA_USER_SERVICE_ID 29 /* User requested UUID */ +#define BTA_MAX_SERVICE_ID 30 + +/* service IDs (BTM_SEC_SERVICE_FIRST_EMPTY + 1) to (BTM_SEC_MAX_SERVICES - 1) + * are used by BTA JV */ +#define BTA_FIRST_JV_SERVICE_ID (BTM_SEC_SERVICE_FIRST_EMPTY + 1) +#define BTA_LAST_JV_SERVICE_ID (BTM_SEC_MAX_SERVICES - 1) + +typedef UINT8 tBTA_SERVICE_ID; + +/* Service ID Mask */ +#define BTA_RES_SERVICE_MASK 0x00000001 /* Reserved */ +#define BTA_SPP_SERVICE_MASK 0x00000002 /* Serial port profile. */ +#define BTA_DUN_SERVICE_MASK 0x00000004 /* Dial-up networking profile. */ +#define BTA_FAX_SERVICE_MASK 0x00000008 /* Fax profile. */ +#define BTA_LAP_SERVICE_MASK 0x00000010 /* LAN access profile. */ +#define BTA_HSP_SERVICE_MASK 0x00000020 /* HSP AG role. */ +#define BTA_HFP_SERVICE_MASK 0x00000040 /* HFP AG role */ +#define BTA_OPP_SERVICE_MASK 0x00000080 /* Object push */ +#define BTA_FTP_SERVICE_MASK 0x00000100 /* File transfer */ +#define BTA_CTP_SERVICE_MASK 0x00000200 /* Cordless Terminal */ +#define BTA_ICP_SERVICE_MASK 0x00000400 /* Intercom Terminal */ +#define BTA_SYNC_SERVICE_MASK 0x00000800 /* Synchronization */ +#define BTA_BPP_SERVICE_MASK 0x00001000 /* Print server */ +#define BTA_BIP_SERVICE_MASK 0x00002000 /* Basic Imaging */ +#define BTA_PANU_SERVICE_MASK 0x00004000 /* PAN User */ +#define BTA_NAP_SERVICE_MASK 0x00008000 /* PAN Network access point */ +#define BTA_GN_SERVICE_MASK 0x00010000 /* PAN Group Ad-hoc networks */ +#define BTA_SAP_SERVICE_MASK 0x00020000 /* PAN Group Ad-hoc networks */ +#define BTA_A2DP_SERVICE_MASK 0x00040000 /* Advanced audio distribution */ +#define BTA_AVRCP_SERVICE_MASK 0x00080000 /* A/V remote control */ +#define BTA_HID_SERVICE_MASK 0x00100000 /* HID */ +#define BTA_VDP_SERVICE_MASK 0x00200000 /* Video distribution */ +#define BTA_PBAP_SERVICE_MASK 0x00400000 /* Phone Book Server */ +#define BTA_HSP_HS_SERVICE_MASK 0x00800000 /* HFP HS role */ +#define BTA_HFP_HS_SERVICE_MASK 0x01000000 /* HSP HS role */ +#define BTA_MAS_SERVICE_MASK 0x02000000 /* Message Access Profile */ +#define BTA_MN_SERVICE_MASK 0x04000000 /* Message Notification Profile */ +#define BTA_HL_SERVICE_MASK 0x08000000 /* Health Device Profile */ +#define BTA_PCE_SERVICE_MASK 0x10000000 /* Phone Book Client */ + +// btla-specific ++ +#define BTA_USER_SERVICE_MASK 0x20000000 /* Message Notification Profile */ +// btla-specific -- + +#define BTA_ALL_SERVICE_MASK 0x1FFFFFFF /* All services supported by BTA. */ + +typedef UINT32 tBTA_SERVICE_MASK; + +/* SW sub-systems */ +#define BTA_ID_SYS 0 /* system manager */ +/* BLUETOOTH PART - from 0 to BTA_ID_BLUETOOTH_MAX */ +#define BTA_ID_DM 1 /* device manager */ +#define BTA_ID_DM_SEARCH 2 /* device manager search */ +#define BTA_ID_DM_SEC 3 /* device manager security */ +#define BTA_ID_DG 4 /* data gateway */ +#define BTA_ID_AG 5 /* audio gateway */ +#define BTA_ID_OPC 6 /* object push client */ +#define BTA_ID_OPS 7 /* object push server */ +#define BTA_ID_FTS 8 /* file transfer server */ +#define BTA_ID_CT 9 /* cordless telephony terminal */ +#define BTA_ID_FTC 10 /* file transfer client */ +#define BTA_ID_SS 11 /* synchronization server */ +#define BTA_ID_PR 12 /* Printer client */ +#define BTA_ID_BIC 13 /* Basic Imaging Client */ +#define BTA_ID_PAN 14 /* Personal Area Networking */ +#define BTA_ID_BIS 15 /* Basic Imaging Server */ +#define BTA_ID_ACC 16 /* Advanced Camera Client */ +#define BTA_ID_SC 17 /* SIM Card Access server */ +#define BTA_ID_AV 18 /* Advanced audio/video */ +#define BTA_ID_AVK 19 /* Audio/video sink */ +#define BTA_ID_HD 20 /* HID Device */ +#define BTA_ID_CG 21 /* Cordless Gateway */ +#define BTA_ID_BP 22 /* Basic Printing Client */ +#define BTA_ID_HH 23 /* Human Interface Device Host */ +#define BTA_ID_PBS 24 /* Phone Book Access Server */ +#define BTA_ID_PBC 25 /* Phone Book Access Client */ +#define BTA_ID_JV 26 /* Java */ +#define BTA_ID_HS 27 /* Headset */ +#define BTA_ID_MSE 28 /* Message Server Equipment */ +#define BTA_ID_MCE 29 /* Message Client Equipment */ +#define BTA_ID_HL 30 /* Health Device Profile*/ +#define BTA_ID_GATTC 31 /* GATT Client */ +#define BTA_ID_GATTS 32 /* GATT Client */ +#define BTA_ID_BLUETOOTH_MAX 33 /* last BT profile */ + +/* FM */ +#define BTA_ID_FM 34 /* FM */ +#define BTA_ID_FMTX 35 /* FM TX */ + +/* SENSOR */ +#define BTA_ID_SSR 36 /* Sensor */ + +/* GPS */ +#define BTA_ID_GPS 37 /* GPS */ + +/* GENERIC */ +#define BTA_ID_PRM 38 +#define BTA_ID_SYSTEM 39 /* platform-specific */ +#define BTA_ID_SWRAP 40 /* Insight script wrapper */ +#define BTA_ID_MIP 41 /* Multicase Individual Polling */ +#define BTA_ID_RT 42 /* Audio Routing module: This module is always on. */ + +/* JV */ +#define BTA_ID_JV1 43 /* JV1 */ +#define BTA_ID_JV2 44 /* JV2 */ + +#define BTA_ID_MAX (43 + BTA_DM_NUM_JV_ID) + +typedef UINT8 tBTA_SYS_ID; + +enum { + BTM_SUCCESS = 0, /* 0 Command succeeded */ + BTM_CMD_STARTED, /* 1 Command started OK. */ + BTM_BUSY, /* 2 Device busy with another command */ + BTM_NO_RESOURCES, /* 3 No resources to issue command */ + BTM_MODE_UNSUPPORTED, /* 4 Request for 1 or more unsupported modes */ + BTM_ILLEGAL_VALUE, /* 5 Illegal parameter value */ + BTM_WRONG_MODE, /* 6 Device in wrong mode for request */ + BTM_UNKNOWN_ADDR, /* 7 Unknown remote BD address */ + BTM_DEVICE_TIMEOUT, /* 8 Device timeout */ + BTM_BAD_VALUE_RET, /* 9 A bad value was received from HCI */ + BTM_ERR_PROCESSING, /* 10 Generic error */ + BTM_NOT_AUTHORIZED, /* 11 Authorization failed */ + BTM_DEV_RESET, /* 12 Device has been reset */ + BTM_CMD_STORED, /* 13 request is stored in control block */ + BTM_ILLEGAL_ACTION, /* 14 state machine gets illegal command */ + BTM_DELAY_CHECK, /* 15 delay the check on encryption */ + BTM_SCO_BAD_LENGTH, /* 16 Bad SCO over HCI data length */ + BTM_SUCCESS_NO_SECURITY, /* 17 security passed, no security set */ + BTM_FAILED_ON_SECURITY, /* 18 security failed */ + BTM_REPEATED_ATTEMPTS /* 19 repeated attempts for LE security requests */ +}; +typedef UINT8 tBTM_STATUS; + +typedef struct { + UINT16 event; + UINT16 len; + UINT16 offset; + UINT16 layer_specific; +} BT_HDR; + +#define BT_HDR_SIZE (sizeof(BT_HDR)) + +/* Security Service Levels [bit mask] (BTM_SetSecurityLevel) +** Encryption should not be used without authentication +*/ +#define BTM_SEC_NONE 0x0000 /* Nothing required */ +#define BTM_SEC_IN_AUTHORIZE 0x0001 /* Inbound call requires authorization */ +#define BTM_SEC_IN_AUTHENTICATE 0x0002 /* Inbound call requires authentication */ +#define BTM_SEC_IN_ENCRYPT 0x0004 /* Inbound call requires encryption */ +#define BTM_SEC_OUT_AUTHORIZE 0x0008 /* Outbound call requires authorization */ +#define BTM_SEC_OUT_AUTHENTICATE 0x0010 /* Outbound call requires authentication */ +#define BTM_SEC_OUT_ENCRYPT 0x0020 /* Outbound call requires encryption */ +#define BTM_SEC_BOND 0x0040 /* Bonding */ +#define BTM_SEC_BOND_CONN 0x0080 /* bond_created_connection */ +#define BTM_SEC_FORCE_MASTER 0x0100 /* Need to switch connection to be master */ +#define BTM_SEC_ATTEMPT_MASTER 0x0200 /* Try to switch connection to be master */ +#define BTM_SEC_FORCE_SLAVE 0x0400 /* Need to switch connection to be master */ +#define BTM_SEC_ATTEMPT_SLAVE 0x0800 /* Try to switch connection to be slave */ +#define BTM_SEC_IN_MITM 0x1000 /* inbound Do man in the middle protection */ +#define BTM_SEC_OUT_MITM 0x2000 /* outbound Do man in the middle protection */ + +/* Security Setting Mask */ +#define BTA_SEC_NONE BTM_SEC_NONE /* No security. */ +#define BTA_SEC_AUTHORIZE (BTM_SEC_IN_AUTHORIZE) /* Authorization required (only needed for out going connection )*/ +#define BTA_SEC_AUTHENTICATE (BTM_SEC_IN_AUTHENTICATE | BTM_SEC_OUT_AUTHENTICATE) /* Authentication required. */ +#define BTA_SEC_ENCRYPT (BTM_SEC_IN_ENCRYPT | BTM_SEC_OUT_ENCRYPT) /* Encryption required. */ + +typedef UINT8 tBTA_SEC; + +/* Pairable Modes */ +#define BTA_DM_PAIRABLE 1 +#define BTA_DM_NON_PAIRABLE 0 + +/* Connectable Paired Only Mode */ +#define BTA_DM_CONN_ALL 0 +#define BTA_DM_CONN_PAIRED 1 + +/* Inquiry modes + * Note: These modes are associated with the inquiry active values (BTM_*ACTIVE) */ +#define BTM_GENERAL_INQUIRY 0 +#define BTM_LIMITED_INQUIRY 1 +#define BTM_BR_INQUIRY_MASK 0x0f +/* high byte of inquiry mode for BLE inquiry mode */ +#define BTM_BLE_INQUIRY_NONE 0x00 +#define BTM_BLE_GENERAL_INQUIRY 0x10 +#define BTM_BLE_LIMITED_INQUIRY 0x20 +#define BTM_BLE_INQUIRY_MASK (BTM_BLE_GENERAL_INQUIRY | BTM_BLE_LIMITED_INQUIRY) + +#define BTA_BLE_INQUIRY_NONE BTM_BLE_INQUIRY_NONE +#define BTA_BLE_GENERAL_INQUIRY BTM_BLE_GENERAL_INQUIRY /* Perform LE general inquiry. */ +#define BTA_BLE_LIMITED_INQUIRY BTM_BLE_LIMITED_INQUIRY /* Perform LE limited inquiry. */ +typedef UINT8 tBTA_DM_INQ_MODE; + +/* Inquiry Filter Type */ +#define BTA_DM_INQ_CLR BTM_CLR_INQUIRY_FILTER /* Clear inquiry filter. */ +#define BTA_DM_INQ_DEV_CLASS BTM_FILTER_COND_DEVICE_CLASS /* Filter on device class. */ +#define BTA_DM_INQ_BD_ADDR BTM_FILTER_COND_BD_ADDR /* Filter on a specific BD address. */ + +typedef UINT8 tBTA_DM_INQ_FILT; + +/* Inquiry filter device class condition */ +typedef struct { + DEV_CLASS dev_class; /* device class of interest */ + DEV_CLASS dev_class_mask; /* mask to determine the bits of device class of interest */ +} tBTA_DM_COD_COND; + +/* Inquiry Filter Condition */ +typedef union { + BD_ADDR bd_addr; /* BD address of device to filter. */ + tBTA_DM_COD_COND dev_class_cond; /* Device class filter condition */ +} tBTA_DM_INQ_COND; + +/* Inquiry Parameters */ +typedef struct { + tBTA_DM_INQ_MODE mode; /* Inquiry mode, limited or general. */ + UINT8 duration; /* Inquiry duration in 1.28 sec units. */ + UINT8 max_resps; /* Maximum inquiry responses. Set to zero for unlimited responses. */ + BOOLEAN report_dup; /* report duplicated inquiry response with higher RSSI value */ + tBTA_DM_INQ_FILT filter_type; /* Filter condition type. */ + tBTA_DM_INQ_COND filter_cond; /* Filter condition data. */ +} tBTA_DM_INQ; + +/* Security Callback Events */ +#define BTA_DM_ENABLE_EVT 0 /* Enable Event */ +#define BTA_DM_DISABLE_EVT 1 /* Disable Event */ +#define BTA_DM_PIN_REQ_EVT 2 /* PIN request. */ +#define BTA_DM_AUTH_CMPL_EVT 3 /* Authentication complete indication. */ +#define BTA_DM_AUTHORIZE_EVT 4 /* Authorization request. */ +#define BTA_DM_LINK_UP_EVT 5 /* Connection UP event */ +#define BTA_DM_LINK_DOWN_EVT 6 /* Connection DOWN event */ +#define BTA_DM_SIG_STRENGTH_EVT 7 /* Signal strength for bluetooth connection */ +#define BTA_DM_BUSY_LEVEL_EVT 8 /* System busy level */ +#define BTA_DM_BOND_CANCEL_CMPL_EVT 9 /* Bond cancel complete indication */ +#define BTA_DM_SP_CFM_REQ_EVT 10 /* Simple Pairing User Confirmation request. */ +#define BTA_DM_SP_KEY_NOTIF_EVT 11 /* Simple Pairing Passkey Notification */ +#define BTA_DM_SP_RMT_OOB_EVT 12 /* Simple Pairing Remote OOB Data request. */ +#define BTA_DM_SP_KEYPRESS_EVT 13 /* Key press notification event. */ +#define BTA_DM_ROLE_CHG_EVT 14 /* Role Change event. */ +#define BTA_DM_BLE_KEY_EVT 15 /* BLE SMP key event for peer device keys */ +#define BTA_DM_BLE_SEC_REQ_EVT 16 /* BLE SMP security request */ +#define BTA_DM_BLE_PASSKEY_NOTIF_EVT 17 /* SMP passkey notification event */ +#define BTA_DM_BLE_PASSKEY_REQ_EVT 18 /* SMP passkey request event */ +#define BTA_DM_BLE_OOB_REQ_EVT 19 /* SMP OOB request event */ +#define BTA_DM_BLE_LOCAL_IR_EVT 20 /* BLE local IR event */ +#define BTA_DM_BLE_LOCAL_ER_EVT 21 /* BLE local ER event */ +// btla-specific ++ +#define BTA_DM_BLE_AUTH_CMPL_EVT 22 /* BLE Auth complete */ +// btla-specific -- +#define BTA_DM_DEV_UNPAIRED_EVT 23 +#define BTA_DM_HW_ERROR_EVT 24 /* BT Chip H/W error */ +typedef UINT8 tBTA_DM_SEC_EVT; + +/* Structure associated with BTA_DM_ENABLE_EVT */ +typedef struct { + BD_ADDR bd_addr; /* BD address of local device. */ + tBTA_STATUS status; +} tBTA_DM_ENABLE; + +/* Structure associated with BTA_DM_PIN_REQ_EVT */ +typedef struct { + BD_ADDR bd_addr; /* BD address peer device. */ + BD_NAME bd_name; /* Name of peer device. */ + DEV_CLASS dev_class; /* Class of Device */ +} tBTA_DM_PIN_REQ; + +/* Link Key Notification Event (Key Type) definitions */ +#define HCI_LKEY_TYPE_COMBINATION 0x00 +#define HCI_LKEY_TYPE_LOCAL_UNIT 0x01 +#define HCI_LKEY_TYPE_REMOTE_UNIT 0x02 +#define HCI_LKEY_TYPE_DEBUG_COMB 0x03 +#define HCI_LKEY_TYPE_UNAUTH_COMB 0x04 +#define HCI_LKEY_TYPE_AUTH_COMB 0x05 +#define HCI_LKEY_TYPE_CHANGED_COMB 0x06 + +/* Structure associated with BTA_DM_AUTH_CMPL_EVT */ +typedef struct { + BD_ADDR bd_addr; /* BD address peer device. */ + BD_NAME bd_name; /* Name of peer device. */ + BOOLEAN key_present; /* Valid link key value in key element */ + LINK_KEY key; /* Link key associated with peer device. */ + UINT8 key_type; /* The type of Link Key */ + BOOLEAN success; /* TRUE of authentication succeeded, FALSE if failed. */ + UINT8 fail_reason; /* The HCI reason/error code for when success=FALSE */ +} tBTA_DM_AUTH_CMPL; + +/* Structure associated with BTA_DM_AUTHORIZE_EVT */ +typedef struct { + BD_ADDR bd_addr; /* BD address peer device. */ + BD_NAME bd_name; /* Name of peer device. */ + tBTA_SERVICE_ID service; /* Service ID to authorize. */ + // btla-specific ++ + DEV_CLASS dev_class; + // btla-specific -- +} tBTA_DM_AUTHORIZE; + +/* Structure associated with BTA_DM_LINK_UP_EVT */ +typedef struct { + BD_ADDR bd_addr; /* BD address peer device. */ +} tBTA_DM_LINK_UP; + +/* +** Defentions for HCI Error Codes that are past in the events +*/ +#define HCI_SUCCESS 0x00 +#define HCI_PENDING 0x00 +#define HCI_ERR_ILLEGAL_COMMAND 0x01 +#define HCI_ERR_NO_CONNECTION 0x02 +#define HCI_ERR_HW_FAILURE 0x03 +#define HCI_ERR_PAGE_TIMEOUT 0x04 +#define HCI_ERR_AUTH_FAILURE 0x05 +#define HCI_ERR_KEY_MISSING 0x06 +#define HCI_ERR_MEMORY_FULL 0x07 +#define HCI_ERR_CONNECTION_TOUT 0x08 +#define HCI_ERR_MAX_NUM_OF_CONNECTIONS 0x09 +#define HCI_ERR_MAX_NUM_OF_SCOS 0x0A +#define HCI_ERR_CONNECTION_EXISTS 0x0B +#define HCI_ERR_COMMAND_DISALLOWED 0x0C +#define HCI_ERR_HOST_REJECT_RESOURCES 0x0D +#define HCI_ERR_HOST_REJECT_SECURITY 0x0E +#define HCI_ERR_HOST_REJECT_DEVICE 0x0F +#define HCI_ERR_HOST_TIMEOUT 0x10 +#define HCI_ERR_UNSUPPORTED_VALUE 0x11 +#define HCI_ERR_ILLEGAL_PARAMETER_FMT 0x12 +#define HCI_ERR_PEER_USER 0x13 +#define HCI_ERR_PEER_LOW_RESOURCES 0x14 +#define HCI_ERR_PEER_POWER_OFF 0x15 +#define HCI_ERR_CONN_CAUSE_LOCAL_HOST 0x16 +#define HCI_ERR_REPEATED_ATTEMPTS 0x17 +#define HCI_ERR_PAIRING_NOT_ALLOWED 0x18 +#define HCI_ERR_UNKNOWN_LMP_PDU 0x19 +#define HCI_ERR_UNSUPPORTED_REM_FEATURE 0x1A +#define HCI_ERR_SCO_OFFSET_REJECTED 0x1B +#define HCI_ERR_SCO_INTERVAL_REJECTED 0x1C +#define HCI_ERR_SCO_AIR_MODE 0x1D +#define HCI_ERR_INVALID_LMP_PARAM 0x1E +#define HCI_ERR_UNSPECIFIED 0x1F +#define HCI_ERR_UNSUPPORTED_LMP_FEATURE 0x20 +#define HCI_ERR_ROLE_CHANGE_NOT_ALLOWED 0x21 +#define HCI_ERR_LMP_RESPONSE_TIMEOUT 0x22 +#define HCI_ERR_LMP_ERR_TRANS_COLLISION 0x23 +#define HCI_ERR_LMP_PDU_NOT_ALLOWED 0x24 +#define HCI_ERR_ENCRY_MODE_NOT_ACCEPTABLE 0x25 +#define HCI_ERR_UNIT_KEY_USED 0x26 +#define HCI_ERR_QOS_NOT_SUPPORTED 0x27 +#define HCI_ERR_INSTANT_PASSED 0x28 +#define HCI_ERR_PAIRING_WITH_UNIT_KEY_NOT_SUPPORTED 0x29 +#define HCI_ERR_DIFF_TRANSACTION_COLLISION 0x2A +#define HCI_ERR_UNDEFINED_0x2B 0x2B +#define HCI_ERR_QOS_UNACCEPTABLE_PARAM 0x2C +#define HCI_ERR_QOS_REJECTED 0x2D +#define HCI_ERR_CHAN_CLASSIF_NOT_SUPPORTED 0x2E +#define HCI_ERR_INSUFFCIENT_SECURITY 0x2F +#define HCI_ERR_PARAM_OUT_OF_RANGE 0x30 +#define HCI_ERR_UNDEFINED_0x31 0x31 +#define HCI_ERR_ROLE_SWITCH_PENDING 0x32 +#define HCI_ERR_UNDEFINED_0x33 0x33 +#define HCI_ERR_RESERVED_SLOT_VIOLATION 0x34 +#define HCI_ERR_ROLE_SWITCH_FAILED 0x35 +#define HCI_ERR_INQ_RSP_DATA_TOO_LARGE 0x36 +#define HCI_ERR_SIMPLE_PAIRING_NOT_SUPPORTED 0x37 +#define HCI_ERR_HOST_BUSY_PAIRING 0x38 +#define HCI_ERR_REJ_NO_SUITABLE_CHANNEL 0x39 +#define HCI_ERR_CONTROLLER_BUSY 0x3A +#define HCI_ERR_UNACCEPT_CONN_INTERVAL 0x3B +#define HCI_ERR_DIRECTED_ADVERTISING_TIMEOUT 0x3C +#define HCI_ERR_CONN_TOUT_DUE_TO_MIC_FAILURE 0x3D +#define HCI_ERR_CONN_FAILED_ESTABLISHMENT 0x3E +#define HCI_ERR_MAC_CONNECTION_FAILED 0x3F + +#define HCI_ERR_MAX_ERR 0x40 + +#define HCI_HINT_TO_RECREATE_AMP_PHYS_LINK 0xFF + +/* Structure associated with BTA_DM_LINK_DOWN_EVT */ +typedef struct { + BD_ADDR bd_addr; /* BD address peer device. */ + UINT8 status; /* connection open/closed */ +} tBTA_DM_LINK_DOWN; + +typedef INT8 tBTA_DM_RSSI_VALUE; +typedef UINT8 tBTA_DM_LINK_QUALITY_VALUE; + +/* signal strength mask */ +#define BTA_SIG_STRENGTH_RSSI_MASK 1 +#define BTA_SIG_STRENGTH_LINK_QUALITY_MASK 2 + +typedef UINT8 tBTA_SIG_STRENGTH_MASK; + +/* Structure associated with BTA_DM_SIG_STRENGTH_EVT */ +typedef struct { + BD_ADDR bd_addr; /* BD address peer device. */ + tBTA_SIG_STRENGTH_MASK mask; /* mask for the values that are valid */ + tBTA_DM_RSSI_VALUE rssi_value; + tBTA_DM_LINK_QUALITY_VALUE link_quality_value; + +} tBTA_DM_SIG_STRENGTH; + +/* Structure associated with BTA_DM_BUSY_LEVEL_EVT */ +typedef struct { + UINT8 level; /* when paging or inquiring, level is 10. + Otherwise, the number of ACL links */ +} tBTA_DM_BUSY_LEVEL; + +// muff1n: only filled with used members +typedef union { + tBTA_DM_ENABLE enable; /* BTA enabled */ + tBTA_DM_PIN_REQ pin_req; /* PIN request */ + tBTA_DM_AUTH_CMPL auth_cmpl; /* Authentication complete indication */ + tBTA_DM_AUTHORIZE authorize; /* Authorization request */ + tBTA_DM_LINK_UP link_up; /* ACL connection up event */ + tBTA_DM_LINK_DOWN link_down; /* ACL connection down event */ + tBTA_DM_SIG_STRENGTH sig_strength; /* rssi and link quality value */ + tBTA_DM_BUSY_LEVEL busy_level; /* System busy level */ +} tBTA_DM_SEC; + +typedef void(tBTA_DM_SEC_CBACK)(tBTA_DM_SEC_EVT event, tBTA_DM_SEC *p_data); + +/* Search callback events */ +#define BTA_DM_INQ_RES_EVT 0 /* Inquiry result for a peer device. */ +#define BTA_DM_INQ_CMPL_EVT 1 /* Inquiry complete. */ +#define BTA_DM_DISC_RES_EVT 2 /* Discovery result for a peer device. */ +#define BTA_DM_DISC_BLE_RES_EVT 3 /* Discovery result for BLE GATT based service on a peer device. */ +#define BTA_DM_DISC_CMPL_EVT 4 /* Discovery complete. */ +#define BTA_DM_DI_DISC_CMPL_EVT 5 /* Discovery complete. */ +#define BTA_DM_SEARCH_CANCEL_CMPL_EVT 6 /* Search cancelled */ + +typedef UINT8 tBTA_DM_SEARCH_EVT; + +#define BTA_DM_INQ_RES_IGNORE_RSSI BTM_INQ_RES_IGNORE_RSSI /* 0x7f RSSI value not supplied (ignore it) */ + +// muff1n: commented some fields out +/* Structure associated with BTA_DM_INQ_RES_EVT */ +typedef struct { + BD_ADDR bd_addr; /* BD address peer device. */ + DEV_CLASS dev_class; /* Device class of peer device. */ + // BOOLEAN remt_name_not_required; /* Application sets this flag if it already knows the name of the device + // */ + /* If the device name is known to application BTA skips the remote name request */ + // BOOLEAN is_limited; /* TRUE, if the limited inquiry bit is set in the CoD */ + INT8 rssi; /* The rssi value */ + UINT8 *p_eir; /* received EIR */ +} tBTA_DM_INQ_RES; + +/* Structure associated with BTA_DM_INQ_CMPL_EVT */ +typedef struct { + UINT8 num_resps; /* Number of inquiry responses. */ +} tBTA_DM_INQ_CMPL; + +/* Structure associated with BTA_DM_DI_DISC_CMPL_EVT */ +typedef struct { + BD_ADDR bd_addr; /* BD address peer device. */ + UINT8 num_record; /* Number of DI record */ + tBTA_STATUS result; +} tBTA_DM_DI_DISC_CMPL; + +/* Structure associated with BTA_DM_DISC_RES_EVT */ +typedef struct { + BD_ADDR bd_addr; /* BD address peer device. */ + BD_NAME bd_name; /* Name of peer device. */ + tBTA_SERVICE_MASK services; /* Services found on peer device. */ + // btla-specific ++ + UINT8 *p_raw_data; /* Raw data for discovery DB */ + UINT32 raw_data_size; /* size of raw data */ + tBT_DEVICE_TYPE device_type; /* device type in case it is BLE device */ + UINT32 num_uuids; + UINT8 *p_uuid_list; + // btla-specific -- + tBTA_STATUS result; +} tBTA_DM_DISC_RES; + +/* Structure associated with tBTA_DM_DISC_BLE_RES */ +typedef struct { + BD_ADDR bd_addr; /* BD address peer device. */ + BD_NAME bd_name; /* Name of peer device. */ + tBT_UUID service; /* GATT based Services UUID found on peer device. */ +} tBTA_DM_DISC_BLE_RES; + +/* Union of all search callback structures */ +typedef union { + tBTA_DM_INQ_RES inq_res; /* Inquiry result for a peer device. */ + tBTA_DM_INQ_CMPL inq_cmpl; /* Inquiry complete. */ + tBTA_DM_DISC_RES disc_res; /* Discovery result for a peer device. */ + tBTA_DM_DISC_BLE_RES disc_ble_res; /* discovery result for GATT based service */ + tBTA_DM_DI_DISC_CMPL di_disc; /* DI discovery result for a peer device */ +} tBTA_DM_SEARCH; + +/* Search callback */ +typedef void(tBTA_DM_SEARCH_CBACK)(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_data); + +/* type of protocol mode */ +#define BTA_HH_PROTO_RPT_MODE (0x00) +#define BTA_HH_PROTO_BOOT_MODE (0x01) +#define BTA_HH_PROTO_UNKNOWN (0xff) +typedef UINT8 tBTA_HH_PROTO_MODE; + +/* BTA HID Host callback events */ +#define BTA_HH_ENABLE_EVT 0 /* HH enabled */ +#define BTA_HH_DISABLE_EVT 1 /* HH disabled */ +#define BTA_HH_OPEN_EVT 2 /* connection opened */ +#define BTA_HH_CLOSE_EVT 3 /* connection closed */ +#define BTA_HH_GET_RPT_EVT 4 /* BTA_HhGetReport callback */ +#define BTA_HH_SET_RPT_EVT 5 /* BTA_HhSetReport callback */ +#define BTA_HH_GET_PROTO_EVT 6 /* BTA_GetProtoMode callback */ +#define BTA_HH_SET_PROTO_EVT 7 /* BTA_HhSetProtoMode callback */ +#define BTA_HH_GET_IDLE_EVT 8 /* BTA_HhGetIdle comes callback */ +#define BTA_HH_SET_IDLE_EVT 9 /* BTA_HhSetIdle finish callback */ +#define BTA_HH_GET_DSCP_EVT 10 /* Get report descripotor */ +#define BTA_HH_ADD_DEV_EVT 11 /* Add Device callback */ +#define BTA_HH_RMV_DEV_EVT 12 /* remove device finished */ +#define BTA_HH_VC_UNPLUG_EVT 13 /* virtually unplugged */ +#define BTA_HH_UPDATE_UCD_EVT 14 +#define BTA_HH_API_ERR_EVT 15 /* API error is caught */ + +typedef UINT16 tBTA_HH_EVT; + +enum { + BTA_HH_OK, + BTA_HH_HS_HID_NOT_READY, /* handshake error : device not ready */ + BTA_HH_HS_INVALID_RPT_ID, /* handshake error : invalid report ID */ + BTA_HH_HS_TRANS_NOT_SPT, /* handshake error : transaction not spt */ + BTA_HH_HS_INVALID_PARAM, /* handshake error : invalid paremter */ + BTA_HH_HS_ERROR, /* handshake error : unspecified HS error */ + BTA_HH_ERR, /* general BTA HH error */ + BTA_HH_ERR_SDP, /* SDP error */ + BTA_HH_ERR_PROTO, /* SET_Protocol error, + only used in BTA_HH_OPEN_EVT callback */ + BTA_HH_ERR_DB_FULL, /* device database full error, used in + BTA_HH_OPEN_EVT/BTA_HH_ADD_DEV_EVT */ + BTA_HH_ERR_TOD_UNSPT, /* type of device not supported */ + BTA_HH_ERR_NO_RES, /* out of system resources */ + BTA_HH_ERR_AUTH_FAILED, /* authentication fail */ + BTA_HH_ERR_HDL +}; +typedef UINT8 tBTA_HH_STATUS; + +/* callback event data for BTA_HH_OPEN_EVT */ +typedef struct { + BD_ADDR bda; /* HID device bd address */ + tBTA_HH_STATUS status; /* operation status */ + UINT8 handle; /* device handle */ +} tBTA_HH_CONN; + +typedef tBTA_HH_CONN tBTA_HH_DEV_INFO; + +/* callback event data */ +typedef struct { + tBTA_HH_STATUS status; /* operation status */ + UINT8 handle; /* device handle */ +} tBTA_HH_CBDATA; + +// muff1n: only filled with used members +typedef union { + tBTA_HH_DEV_INFO dev_info; /* BTA_HH_ADD_DEV_EVT, BTA_HH_RMV_DEV_EVT */ + tBTA_HH_CONN conn; /* BTA_HH_OPEN_EVT */ + tBTA_HH_CBDATA dev_status; /* BTA_HH_CLOSE_EVT, + BTA_HH_SET_PROTO_EVT + BTA_HH_SET_RPT_EVT + BTA_HH_SET_IDLE_EVT */ +} tBTA_HH; + +/* BTA HH callback function */ +typedef void(tBTA_HH_CBACK)(tBTA_HH_EVT event, tBTA_HH *p_data); + +/* General callback function for notifying an application that a synchronous +** BTM function is complete. The pointer contains the address of any returned data. +*/ +typedef void(tBTM_CMPL_CB)(void *p1); +/* Structure returned with local version information */ + +typedef struct { + UINT8 hci_version; + UINT16 hci_revision; + UINT8 lmp_version; + UINT16 manufacturer; + UINT16 lmp_subversion; +} tBTM_VERSION_INFO; + +/* Structure returned with Vendor Specific Command complete callback */ +typedef struct { + UINT16 opcode; + UINT16 param_len; + UINT8 *p_param_buf; +} tBTM_VSC_CMPL; + +#define BTM_VSC_CMPL_DATA_SIZE (BTM_MAX_VENDOR_SPECIFIC_LEN + sizeof(tBTM_VSC_CMPL)) +/* Callback function for when device status changes. Appl must poll for +** what the new state is (BTM_IsDeviceUp). The event occurs whenever the stack +** has detected that the controller status has changed. This asynchronous event +** is enabled/disabled by calling BTM_RegisterForDeviceStatusNotif(). +*/ +enum { BTM_DEV_STATUS_UP, BTM_DEV_STATUS_DOWN, BTM_DEV_STATUS_CMD_TOUT }; +typedef UINT8 tBTM_DEV_STATUS; + +typedef void(tBTM_DEV_STATUS_CB)(tBTM_DEV_STATUS status); + +/* Callback function for when a vendor specific event occurs. The length and +** array of returned parameter bytes are included. This asynchronous event +** is enabled/disabled by calling BTM_RegisterForVSEvents(). +*/ +typedef void(tBTM_VS_EVT_CB)(UINT8 len, UINT8 *p); + +/* VSC callback function for notifying an application that a synchronous +** BTM function is complete. The pointer contains the address of any returned data. +*/ +typedef void(tBTM_VSC_CMPL_CB)(tBTM_VSC_CMPL *p1); + +/* Attributes mask values to be used in HID_HostAddDev API */ +#define HID_VIRTUAL_CABLE 0x0001 +#define HID_NORMALLY_CONNECTABLE 0x0002 +#define HID_RECONN_INIT 0x0004 +#define HID_SDP_DISABLE 0x0008 +#define HID_BATTERY_POWER 0x0010 +#define HID_REMOTE_WAKE 0x0020 +#define HID_SUP_TOUT_AVLBL 0x0040 +#define HID_SSR_MAX_LATENCY 0x0080 +#define HID_SSR_MIN_TOUT 0x0100 + +#define HID_SEC_REQUIRED 0x8000 + +#define BTA_HH_VIRTUAL_CABLE HID_VIRTUAL_CABLE +#define BTA_HH_NORMALLY_CONNECTABLE HID_NORMALLY_CONNECTABLE +#define BTA_HH_RECONN_INIT HID_RECONN_INIT +#define BTA_HH_SDP_DISABLE HID_SDP_DISABLE +#define BTA_HH_BATTERY_POWER HID_BATTERY_POWER +#define BTA_HH_REMOTE_WAKE HID_REMOTE_WAKE +#define BTA_HH_SUP_TOUT_AVLBL HID_SUP_TOUT_AVLBL +#define BTA_HH_SEC_REQUIRED HID_SEC_REQUIRED +typedef UINT16 tBTA_HH_ATTR_MASK; + +typedef struct desc_info { + UINT16 dl_len; + UINT8 *dsc_list; +} tHID_DEV_DSCP_INFO; + +typedef tHID_DEV_DSCP_INFO tBTA_HH_DEV_DESCR; + +/* Policy settings status */ +#define HCI_DISABLE_ALL_LM_MODES 0x0000 +#define HCI_ENABLE_MASTER_SLAVE_SWITCH 0x0001 +#define HCI_ENABLE_HOLD_MODE 0x0002 +#define HCI_ENABLE_SNIFF_MODE 0x0004 +#define HCI_ENABLE_PARK_MODE 0x0008 + +/* HCI mode defenitions */ +#define HCI_MODE_ACTIVE 0x00 +#define HCI_MODE_HOLD 0x01 +#define HCI_MODE_SNIFF 0x02 +#define HCI_MODE_PARK 0x03 + +/* BTM Power manager status codes */ +enum { + BTM_PM_STS_ACTIVE = HCI_MODE_ACTIVE, + BTM_PM_STS_HOLD = HCI_MODE_HOLD, + BTM_PM_STS_SNIFF = HCI_MODE_SNIFF, + BTM_PM_STS_PARK = HCI_MODE_PARK, + BTM_PM_STS_SSR, /* report the SSR parameters in HCI_SNIFF_SUB_RATE_EVT */ + BTM_PM_STS_PENDING, /* when waiting for status from controller */ + BTM_PM_STS_ERROR /* when HCI command status returns error */ +}; +typedef UINT8 tBTM_PM_STATUS; + +/* BTM Power manager modes */ + +enum { + BTM_PM_MD_ACTIVE = BTM_PM_STS_ACTIVE, + BTM_PM_MD_HOLD = BTM_PM_STS_HOLD, + BTM_PM_MD_SNIFF = BTM_PM_STS_SNIFF, + BTM_PM_MD_PARK = BTM_PM_STS_PARK, + BTM_PM_MD_FORCE = 0x10 /* OR this to force ACL link to a certain mode */ +}; +typedef UINT8 tBTM_PM_MODE; + +#define BTM_PM_SET_ONLY_ID 0x80 + +/* Operation codes */ +#define BTM_PM_REG_SET 1 /* The module wants to set the desired power mode */ +#define BTM_PM_REG_NOTIF 2 /* The module wants to receive mode change event */ +#define BTM_PM_DEREG 4 /* The module does not want to involve with PM anymore */ + +typedef struct { + UINT16 max; + UINT16 min; + UINT16 attempt; + UINT16 timeout; + tBTM_PM_MODE mode; +} tBTM_PM_PWR_MD; + +/************************************* +** Power Manager Callback Functions +**************************************/ +typedef void(tBTM_PM_STATUS_CBACK)(BD_ADDR p_bda, tBTM_PM_STATUS status, UINT16 value, UINT8 hci_status); + +/************************ +** Stored Linkkey Types +*************************/ +#define BTM_CB_EVT_RETURN_LINK_KEYS 1 +#define BTM_CB_EVT_READ_STORED_LINK_KEYS 2 +#define BTM_CB_EVT_WRITE_STORED_LINK_KEYS 3 +#define BTM_CB_EVT_DELETE_STORED_LINK_KEYS 4 + +typedef struct { + UINT8 event; + +} tBTM_STORED_LINK_KEYS_EVT; + +typedef struct { + UINT8 event; + UINT8 num_keys; + +} tBTM_RETURN_LINK_KEYS_EVT; + +typedef struct { + BD_ADDR bd_addr; + LINK_KEY link_key; + +} tBTM_BD_ADDR_LINK_KEY_PAIR; + +typedef struct { + UINT8 event; + UINT8 status; + UINT16 max_keys; + UINT16 read_keys; + +} tBTM_READ_STORED_LINK_KEY_COMPLETE; + +typedef struct { + UINT8 event; + UINT8 status; + UINT8 num_keys; + +} tBTM_WRITE_STORED_LINK_KEY_COMPLETE; + +typedef struct { + UINT8 event; + UINT8 status; + UINT16 num_keys; + +} tBTM_DELETE_STORED_LINK_KEY_COMPLETE; + +// --- + +tBTA_STATUS BTA_EnableBluetooth(tBTA_DM_SEC_CBACK *p_cback); +tBTA_STATUS BTA_DisableBluetooth(void); + +// muff1n: most changed prototype so far +tBTA_STATUS BTA_DmAddDevice(BD_ADDR bd_addr, LINK_KEY link_key, tBTA_SERVICE_MASK trusted_mask, BOOLEAN is_trusted); +tBTA_STATUS BTA_DmRemoveDevice(BD_ADDR bd_addr); +void BTA_DmSearch(tBTA_DM_INQ *p_dm_inq, tBTA_SERVICE_MASK services, tBTA_DM_SEARCH_CBACK *p_cback); +void BTA_DmSearchCancel(void); +void BTA_DmPinReply(BD_ADDR bd_addr, BOOLEAN accept, UINT8 pin_len, UINT8 *p_pin); +BOOLEAN BTA_DmIsDeviceUp(void); +void BTA_DmSetDeviceName(char *p_name); + +// muff1n: disc_mode and conn_mode might be the , based on usage +void BTA_DmSetVisibility(UINT8, UINT8); + +// muff1n: ucd_enabled might be the missing parameter +void BTA_HhEnable(tBTA_SEC sec_mask, tBTA_HH_CBACK *p_cback); +// muff1n: possibly takes just a tBTA_HH_DEV_DESCR in this version? i wrote it like that +void BTA_HhAddDev(BD_ADDR bda, tBTA_HH_ATTR_MASK attr_mask, UINT8 sub_class, UINT8 app_id, tBTA_HH_DEV_DESCR descr); +void BTA_HhRemoveDev(UINT8 dev_handle); +void BTA_HhOpen(BD_ADDR dev_bda, tBTA_HH_PROTO_MODE mode, tBTA_SEC sec_mask); +void BTA_HhClose(UINT8 dev_handle); + +// muff1n: dev_bda is likely the missing parameter, as it is not used +void BTA_HhSendData(UINT8 dev_handle, BT_HDR *p_data); + +void bta_sys_set_trace_level(UINT8 level); + +void BTM_DeviceReset(tBTM_CMPL_CB *p_cb); + +tBTM_STATUS BTM_ReadStoredLinkKey(BD_ADDR bd_addr, tBTM_CMPL_CB *p_cb); +tBTM_STATUS BTM_WriteStoredLinkKey(UINT8 num_keys, BD_ADDR *bd_addr, LINK_KEY *link_key, tBTM_CMPL_CB *p_cb); +tBTM_STATUS BTM_DeleteStoredLinkKey(BD_ADDR bd_addr, tBTM_CMPL_CB *p_cb); + +tBTM_STATUS BTM_SetPowerMode(UINT8 pm_id, BD_ADDR remote_bda, tBTM_PM_PWR_MD *p_mode); +tBTM_STATUS BTM_SetAfhChannels(UINT8 first, UINT8 last); + +tBTM_STATUS BTM_VendorSpecificCommand(UINT16 opcode, UINT8 param_len, UINT8 *p_param_buf, tBTM_VSC_CMPL_CB *p_cb); + +tBTM_STATUS BTM_ReadLocalVersion(tBTM_VERSION_INFO *p_vers); +tBTM_STATUS BTM_SetDeviceClass(DEV_CLASS dev_class); + +tBTM_STATUS btm_remove_acl(BD_ADDR bd_addr); + +// muff1n: is_register is probably the missing parameter here +tBTM_STATUS BTM_RegisterForVSEvents(tBTM_VS_EVT_CB *p_cb); +tBTM_DEV_STATUS_CB *BTM_RegisterForDeviceStatusNotif(tBTM_DEV_STATUS_CB *p_cb); + +tBTM_STATUS BTM_PmRegister(UINT8 mask, UINT8 *p_pm_id, tBTM_PM_STATUS_CBACK *p_cb); +tBTM_STATUS BTM_WritePageTimeout(UINT16 timeout); +void BTM_SetDefaultLinkPolicy(UINT16 settings); +void BTM_SetDefaultLinkSuperTout(UINT16 timeout); + +BOOLEAN BTM_SecAddDevice(BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name, BD_FEATURES features, + UINT32 trusted_mask[], LINK_KEY link_key); + +void *GKI_getbuf(UINT16 size); + +UINT8 L2CA_SetTraceLevel(UINT8 trace_level); + +UINT8 SDP_SetTraceLevel(UINT8 new_level); + +/* muff1n: not in bluedroid source; might be older removed API functions */ +void BTA_DmSendHciReset(void); +void BTA_HhGetAclQueueInfo(void); +void BTA_Init(void); +void BTA_CleanUp(void (*p_cb)(tBTA_STATUS status)); // probably + +// --- +/* muff1n: I wrote this definition myself + * TODO: would this be part of BLE or WUD? + */ + +struct small_dev_info { + char devName[20]; // size 0x14? offset 0x00 // might be 0x13? + char at_0x14[1]; // size 0x??, offset 0x14? + char __pad0[0x20 - (0x14 + 0x01)]; + LINK_KEY linkKey; // size 0x10, offset 0x20 + char __pad1[0x10]; +}; // size 0x40 + +#endif // CONTEXT_BTE_H diff --git a/include/egg/audio/eggAudioArcPlayerMgr.h b/include/egg/audio/eggAudioArcPlayerMgr.h index e69de29b..a2ef8a7e 100644 --- a/include/egg/audio/eggAudioArcPlayerMgr.h +++ b/include/egg/audio/eggAudioArcPlayerMgr.h @@ -0,0 +1,10 @@ +#ifndef EGG_AUDIO_ARC_PLAYER_MANAGER_H +#define EGG_AUDIO_ARC_PLAYER_MANAGER_H + +namespace EGG { + +class ArcPlayer {}; + +} // namespace EGG + +#endif diff --git a/include/egg/audio/eggAudioHeapMgr.h b/include/egg/audio/eggAudioHeapMgr.h index e69de29b..ac7296e2 100644 --- a/include/egg/audio/eggAudioHeapMgr.h +++ b/include/egg/audio/eggAudioHeapMgr.h @@ -0,0 +1,10 @@ +#ifndef EGG_AUDIO_HEAP_MANAGER_H +#define EGG_AUDIO_HEAP_MANAGER_H + +namespace EGG { + +class SoundHeapMgr {}; + +} // namespace EGG + +#endif diff --git a/include/egg/audio/eggAudioMgr.h b/include/egg/audio/eggAudioMgr.h index 13aa37a6..603c30bf 100644 --- a/include/egg/audio/eggAudioMgr.h +++ b/include/egg/audio/eggAudioMgr.h @@ -1,10 +1,11 @@ -#ifndef EGG_IAUDIO_MANAGER_H -#define EGG_IAUDIO_MANAGER_H +#ifndef EGG_AUDIO_MANAGER_H +#define EGG_AUDIO_MANAGER_H +#include "egg/audio/eggAudioArcPlayerMgr.h" +#include "egg/audio/eggAudioHeapMgr.h" #include "egg/core/eggHeap.h" #include "egg/egg_types.h" - namespace EGG { class IAudioMgr { public: diff --git a/include/egg/audio/eggAudioRmtSpeakerMgr.h b/include/egg/audio/eggAudioRmtSpeakerMgr.h new file mode 100644 index 00000000..aa209ecc --- /dev/null +++ b/include/egg/audio/eggAudioRmtSpeakerMgr.h @@ -0,0 +1,6 @@ +#ifndef EGG_AUDIO_REMOTE_SPEAKER_MANAGER_H +#define EGG_AUDIO_REMOTE_SPEAKER_MANAGER_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/audio/eggAudioSystem.h b/include/egg/audio/eggAudioSystem.h new file mode 100644 index 00000000..f7b11811 --- /dev/null +++ b/include/egg/audio/eggAudioSystem.h @@ -0,0 +1,6 @@ +#ifndef EGG_AUDIO_SYSTEM_H +#define EGG_AUDIO_SYSTEM_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/audio/eggAudioUtility.h b/include/egg/audio/eggAudioUtility.h new file mode 100644 index 00000000..96fcf1cc --- /dev/null +++ b/include/egg/audio/eggAudioUtility.h @@ -0,0 +1,6 @@ +#ifndef EGG_AUDIO_ARC_UTILITY_H +#define EGG_AUDIO_ARC_UTILITY_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/core/eggAllocator.h b/include/egg/core/eggAllocator.h index e5c51d81..4526e8ca 100644 --- a/include/egg/core/eggAllocator.h +++ b/include/egg/core/eggAllocator.h @@ -1,20 +1,21 @@ #ifndef EGG_ALLOCATOR_H #define EGG_ALLOCATOR_H #include "rvl/MEM.h" + #include -/* 80495310 */ void MEMInitAllocatorFor_Heap(MEMAllocator *alloc, s32 align, void *heap); +void MEMInitAllocatorFor_Heap(MEMAllocator *alloc, s32 align, void *heap); namespace EGG { class Heap; class Allocator : public MEMAllocator { public: - /* 80495330 */ Allocator(Heap *heap, s32 align); + Allocator(Heap *heap, s32 align); public: - /* vt 0x08 | 80495380 */ virtual ~Allocator(); - /* vt 0x0C | 804953c0 */ virtual void *alloc(u32 size); - /* vt 0x10 | 804953e0 */ virtual void free(void *block); + /* vt 0x08 */ virtual ~Allocator(); + /* vt 0x0C */ virtual void *alloc(u32 size); + /* vt 0x10 */ virtual void free(void *block); inline MEMAllocator *getHandle() { return static_cast(this); diff --git a/include/egg/core/eggArchive.h b/include/egg/core/eggArchive.h index 506362d8..d37c3d24 100644 --- a/include/egg/core/eggArchive.h +++ b/include/egg/core/eggArchive.h @@ -4,13 +4,12 @@ #include "egg/core/eggDisposer.h" #include "rvl/ARC.h" #include "rvl/NAND.h" + #include typedef void (*FileCallbackFunc)(void *, void *, const ARCDirEntry *, const char *); namespace EGG { -// Functions that need a proper home: -/* 80493510 */ void readNANDFile(NANDFileInfo *info, void *buf, u32 len, s32 offs); class Archive : public Disposer { public: @@ -19,46 +18,46 @@ public: u32 mArcLength; }; enum MountType { // enum name is correct, values arent official - NOT_LOADED, - LOADED_CAN_FAST_READ, - NAND_File, + MOUNT_NONE, + MOUNT_MEM, + MOUNT_NAND, }; /* 0x10 */ MountType mMountType; /* 0x14 */ u32 mRefCount; /* 0x18 */ ARCHandle mHandle; - /* 0x34 */ s32 mDvdEntryNum; // gets put into first param of DVDFastOpen - /* 0x38 */ s32 mNandFile; // pointer to NANDFileInfo (was allocated) + /* 0x34 */ s32 mDvdEntryNum; // gets put into first param of DVDFastOpen + /* 0x38 */ NANDFileInfo *mNandFile; // pointer to NANDFileInfo (was allocated) /* 0x3C */ nw4r::ut::Node mLink; public: - /* 804935f0 */ virtual ~Archive(); + virtual ~Archive(); public: - /* 80493580 */ Archive(); - /* 80493660 */ void initHandle(void *data, MountType mountType); - /* 804936d0 */ static Archive *findArchive(void *data); - /* 80493760 */ static Archive *findArchive(NANDFileInfo *file); - /* 804937f0 */ static void appendList(Archive *); // prob private - /* 80493850 */ static void removeList(Archive *); - /* 80493860 */ static Archive *mount(void *data, Heap *heap, int align); - /* 80493950 */ static Archive *mountFST(void *data, Heap *heap, s32 align); - /* 80493a40 */ static Archive *mountNandFile(NANDFileInfo *, Heap *heap, s32 align); - /* 80493ac0 */ static Archive *loadFST(const char *fileName, Heap *heap, s32 align); - /* 80493b80 */ void unmount(); - /* 80493c20 */ void *getFile(const char *name, FileInfo *out); - /* 80493cf0 */ s32 convertPathToEntryID(const char *path); - /* 80493d00 */ void *getFileFast(s32 entryId, FileInfo *fileinfo); - /* 80493dc0 */ void *getFileFast(s32 entryId, Heap *heap, s32 align); - /* 80493f30 */ s32 countFile(); - /* 804940c0 */ void searchInside(FileCallbackFunc, void *); - /* 80494140 */ static void *loadFromNAND(NANDFileInfo *fileInfo, Heap *heap, s32 align); + Archive(); + bool initHandle(void *data, MountType mountType); + static Archive *findArchive(void *data); + static Archive *findArchive(NANDFileInfo *file); + static Archive *mount(void *data, Heap *pHeap, int align); + static Archive *mountFST(void *data, Heap *pHeap, int align); // name assumed + static Archive *mountNAND(NANDFileInfo *, Heap *pHeap, int align); // name assumed + static Archive *loadFST(const char *fileName, Heap *pHeap, int align); // name assumed + void unmount(); + void *getFile(const char *name, FileInfo *out); + s32 convertPathToEntryID(const char *path); + void *getFileFast(s32 entryId, FileInfo *fileinfo); + void *getFileFast(s32 entryId, Heap *pHeap, int align); + s32 countFile(); + void searchInside(FileCallbackFunc, void *); -public: - /* 80576728 */ static bool sIsArchiveListInitialized; - /* 80673ac8 */ static nw4r::ut::List sArchiveList; + static void *loadNAND(NANDFileInfo *fileInfo, Heap *pHeap, int align); + + static nw4r::ut::List sArchiveList; + +private: + static bool sIsArchiveListInitialized; + static void appendList(Archive *); + static void removeList(Archive *); }; -/* 80493f10 */ void countFileCallbackFunc(void *, void *, const ARCDirEntry *, const char *); -/* 80493f70 */ void searchInsideWithPath(Archive *arc, ARCHandle *handle, FileCallbackFunc, void *, char *outPath, u32); } // namespace EGG #endif diff --git a/include/egg/core/eggAssertHeap.h b/include/egg/core/eggAssertHeap.h index 983a94bc..0cacafc6 100644 --- a/include/egg/core/eggAssertHeap.h +++ b/include/egg/core/eggAssertHeap.h @@ -2,28 +2,29 @@ #define EGG_ASSERT_HEAP_H #include "egg/core/eggHeap.h" + #include namespace EGG { class AssertHeap : public Heap { public: - // vtable at 0x0 | 8056ea00 - /* vt 0x08 | 804963e0 */ virtual ~AssertHeap(); - /* vt 0x0C | 80496820 */ virtual eHeapKind getHeapKind() const; - /* vt 0x14 | 804966b0 */ virtual void *alloc(u32 size, s32 align); - /* vt 0x18 | 80496710 */ virtual void free(void *block); - /* vt 0x1C | 80496620 */ virtual void destroy(); - /* vt 0x20 | 80496760 */ virtual u32 resizeForMBlock(void *block, u32 size); - /* vt 0x24 | 80496770 */ virtual u32 getTotalFreeSize(); - /* vt 0x28 | 80496780 */ virtual u32 getAllocatableSize(s32 align); - /* vt 0x2C | 80496790 */ virtual u32 adjust(); + // vtable at 0x0 + virtual ~AssertHeap(); + virtual eHeapKind getHeapKind() const override; + virtual void *alloc(u32 size, s32 align) override; + virtual void free(void *block) override; + virtual void destroy() override; + virtual u32 resizeForMBlock(void *block, u32 size) override; + virtual u32 getTotalFreeSize() override; + virtual u32 getAllocatableSize(s32 align) override; + virtual u32 adjust() override; public: - /* 804963a0 */ AssertHeap(MEMiHeapHead *heapHead); - /* 80496460 */ static AssertHeap *create(void *block, size_t size, u16 attr); - /* 80496530 */ static AssertHeap *create(size_t size, Heap *heap); - /* 80496810 */ static size_t getSize(); // returns 0x7C + AssertHeap(MEMiHeapHead *heapHead); + static AssertHeap *create(void *block, u32 size); + static AssertHeap *create(u32 size, Heap *heap); + static size_t getSize(); // returns 0x7C }; } // namespace EGG diff --git a/include/egg/core/eggAsyncDisplay.h b/include/egg/core/eggAsyncDisplay.h index 36109cbc..20991a20 100644 --- a/include/egg/core/eggAsyncDisplay.h +++ b/include/egg/core/eggAsyncDisplay.h @@ -2,18 +2,19 @@ #define EGG_ASYNC_DISPLAY_H #include "egg/core/eggDisplay.h" + #include namespace EGG { class AsyncDisplay : public Display { public: - // vtable at 0x04 | 8056eb60 - /* vt 0x08 | 80497f20 */ virtual void beginFrame(); - /* vt 0x10 | 804980e0 */ virtual void endRender(); - /* vt 0x14 | 804980c0 */ virtual void endFrame(); - /* vt 0x18 | 804982d0 */ virtual u32 getTickPerFrame(); - /* vt 0x1C | 80498100 */ virtual void preVRetrace(); + // vtable at 0x04 + /* vt 0x08 */ virtual void beginFrame(); + /* vt 0x10 */ virtual void endRender(); + /* vt 0x14 */ virtual void endFrame(); + /* vt 0x18 */ virtual u32 getTickPerFrame(); + /* vt 0x1C */ virtual void preVRetrace(); private: inline void waitForMsg(bool); @@ -35,10 +36,10 @@ public: /* 0xBC */ u32 field_0xBC; public: - /* 80497e40 */ AsyncDisplay(u8 maxRetrace); - /* 80497ec0 */ f32 calcS(); - /* 80498260 */ void clearEFB(); - /* 804982f0 */ void clearEFB(u16, u16, u16, u16, u16, u16, nw4r::ut::Color); + AsyncDisplay(u8 maxRetrace); + f32 calcS(); + void clearEFB(); + void clearEFB(u16, u16, u16, u16, u16, u16, nw4r::ut::Color); }; } // namespace EGG diff --git a/include/egg/core/eggColorFader.h b/include/egg/core/eggColorFader.h index 5acc1672..ed6df394 100644 --- a/include/egg/core/eggColorFader.h +++ b/include/egg/core/eggColorFader.h @@ -4,20 +4,23 @@ #include "egg/core/eggFader.h" #include "egg/prim/eggBitFlag.h" #include "nw4r/ut.h" + #include namespace EGG { class ColorFader : public Fader { public: - // vtable at 0x00 | 8056eae8 - /* vt 0x08 | 80497a10 */ virtual void setStatus(EStatus); - /* vt 0x0C | 80067ec0 */ virtual EStatus getStatus() const { return mStatus; }; - /* vt 0x10 | 80497a50 */ virtual bool fadeIn(); - /* vt 0x14 | 80497a80 */ virtual bool fadeOut(); - /* vt 0x18 | 80497ab0 */ virtual bool calc(); - /* vt 0x1C | 80497ba0 */ virtual void draw(); - /* vt 0x1C | 80131b70 */ virtual ~ColorFader() {} + // vtable at 0x00 + /* vt 0x08 */ virtual void setStatus(EStatus); + /* vt 0x0C */ virtual EStatus getStatus() const { + return mStatus; + }; + /* vt 0x10 */ virtual bool fadeIn(); + /* vt 0x14 */ virtual bool fadeOut(); + /* vt 0x18 */ virtual bool calc(); + /* vt 0x1C */ virtual void draw(); + /* vt 0x1C */ virtual ~ColorFader() {} public: /* 0x04 */ EStatus mStatus; @@ -32,11 +35,15 @@ public: /* 0x20 */ f32 mEndY; public: - /* 80497930 */ ColorFader(f32 startX, f32 startY, f32 lengthX, f32 lengthY, nw4r::ut::Color color, EStatus status); - /* 804979e0 */ void setFrame(u16 frame); - /* 804979f0 */ void setColor(nw4r::ut::Color); - float getWidth() const { return mEndX - mStartX; } - float getHeight() const { return mEndY - mStartY; } + ColorFader(f32 startX, f32 startY, f32 lengthX, f32 lengthY, nw4r::ut::Color color, EStatus status); + void setFrame(u16 frame); + void setColor(nw4r::ut::Color); + float getWidth() const { + return mEndX - mStartX; + } + float getHeight() const { + return mEndY - mStartY; + } }; } // namespace EGG diff --git a/include/egg/core/eggController.h b/include/egg/core/eggController.h index 384df8a6..16911869 100644 --- a/include/egg/core/eggController.h +++ b/include/egg/core/eggController.h @@ -1,14 +1,16 @@ #ifndef EGG_CONTROLLER_H #define EGG_CONTROLLER_H -#include - #include "egg/math/eggMath.h" #include "egg/math/eggMatrix.h" #include "egg/math/eggVector.h" #include "egg/prim/eggBitFlag.h" #include "egg/prim/eggBuffer.h" +#include "rvl/KPAD.h" #include "rvl/PAD.h" +#include "rvl/WPAD.h" + +#include namespace EGG { @@ -16,96 +18,138 @@ class ControllerRumbleMgr; class CoreController; // To Be Filled out -enum eCoreDevType {}; +enum eCoreDevType { +}; typedef void (*ConnectCallback)(int args[]); typedef class CoreController *(*ControllerFactory)(); class CoreStatus { public: - /* 0x00 */ u8 field_0x00[0x0C]; - /* 0x0C */ f32 accel[3]; + /* 0x00 */ u32 mHold; + /* 0x04 */ u32 mTrig; + /* 0x08 */ u32 mRelease; + /* 0x0C */ Vector3f mAccel; /* 0x18 */ u8 field_0x01[0x20 - 0x18]; - /* 0x20 */ f32 dpdRawX; - /* 0x24 */ f32 dpdRawY; - /* 0x28 */ u8 field_0x02[0x54 - 0x28]; + /* 0x20 */ f32 mDpdRawX; + /* 0x24 */ f32 mDpdRawY; + /* 0x28 */ u8 field_0x02[0x48 - 0x28]; + /* 0x48 */ f32 mDpdDistance; + /* 0x4C */ f32 float_0x4C; + /* 0x50 */ f32 float_0x50; /* 0x54 */ f32 float_0x54; /* 0x58 */ f32 float_0x58; - /* 0x5C */ u8 field_0x5C[0x5E - 0x5C]; - /* 0x5E */ s8 dpdDistance; + /* 0x5C */ u8 mDevType; + /* 0x5D */ u8 field_0x5D; + /* 0x5E */ s8 mDpdValid; /* 0x5F */ s8 unknown; - /* 0x60 */ f32 fsStickButton; - /* 0x60 */ f32 fsStickButton2; - /* 0x64 */ u8 field_0x03[0x88]; + /* 0x60 */ f32 mFSStickX; + /* 0x64 */ f32 mFSStickY; + /* 0x68 */ u8 field_0x03[0x88]; public: - /* 80498f90 */ void init(); - /* 80498fa0 */ u32 getFSStickButton() const; + void init(); + u32 getFSStickButton() const; + f32 getFSStickX() const { + return mFSStickX; + } + f32 getFSStickY() const { + return mFSStickY; + } + bool down(u32 mask) const { + return (mask & mHold); + } + bool up(u32 mask) const { + return (mask & mHold) != mask; + } + bool downTrigger(u32 mask) const { + return (mask & mTrig); + } + bool upTrigger(u32 mask) const { + return (mask & mRelease); + } + bool downAll(u32 mask) const { + return (mask & mHold) == mask; + } + bool upAll(u32 mask) const { + return (mask & mHold) == 0; + } - inline Vector2f getUnk() { + s32 getDevType() const { + return mDevType; + } + bool isCore() const { + return getDevType() == WPAD_DEV_CORE; + } + bool isFreestyle() const { + return getDevType() == WPAD_DEV_FS; + } + + u32 getHold() const { + return mHold; + } + + s8 getDpdValidFlag() const { + return mDpdValid; + }; + + Vector2f getUnk() { return Vector2f(float_0x54, float_0x58); } + + const Vector3f &getAccel() const { + return mAccel; + } }; class CoreController { public: - // vtable 0x000 | 8056ec50 - // TODO all of these have inline implementations and are scattered - // across the binary - /* vt 0x08 | 80064920 */ virtual void setPosParam(f32, f32) { - // TODO + // vtable 0x0000 + /* vt 0x08 */ virtual void setPosParam(f32 f1, f32 f2) { + KPADSetPosParam(mChannelID, f1, f2); } - /* vt 0x0C | 8049a940 */ virtual void setHoriParam(f32, f32) { - // TODO + /* vt 0x0C */ virtual void setHoriParam(f32 f1, f32 f2) { + KPADSetHoriParam(mChannelID, f1, f2); } - /* vt 0x10 | 8049a930 */ virtual void setDistParam(f32, f32) { - // TODO + /* vt 0x10 */ virtual void setDistParam(f32 f1, f32 f2) { + KPADSetDistParam(mChannelID, f1, f2); } - /* vt 0x14 | 8049a920 */ virtual void setAccParam(f32, f32) { - // TODO + /* vt 0x14 */ virtual void setAccParam(f32 f1, f32 f2) { + KPADSetAccParam(mChannelID, f1, f2); } - /* vt 0x18 | 80059820 */ virtual bool isPressed(u32 mask) { - // TODO - return false; + /* vt 0x18 */ virtual bool down(u32 mask) const { + return mCoreStatus[0].down(mask); } - /* vt 0x1C | 80059a60 */ virtual bool isAnyPressed(u32 mask) { - // TODO - return false; + /* vt 0x1C */ virtual bool up(u32 mask) const { + return mCoreStatus[0].up(mask); } - /* vt 0x20 | 80014e30 */ virtual bool isTriggered(u32 mask) { - // TODO - return false; + /* vt 0x20 */ virtual bool downTrigger(u32 mask) const { + return mCoreStatus[0].downTrigger(mask); } - /* vt 0x24 | 800599e0 */ virtual bool isReleased() { - // TODO - return false; + /* vt 0x24 */ virtual bool upTrigger(u32 mask) const { + return mCoreStatus[0].upTrigger(mask); } - /* vt 0x28 | 80059840 */ virtual bool isAllPressed() { - // TODO - return false; + /* vt 0x28 */ virtual bool downAll(u32 mask) const { + return mCoreStatus[0].downAll(mask); } - /* vt 0x2C | 80059a80 */ virtual bool isNotPressed() { - // TODO - return false; + /* vt 0x2C */ virtual bool upAll(u32 mask) const { + return mCoreStatus[0].upAll(mask); } - // We know the above are inline because if a class has any non-inline virtual functions, - // then the TU that contains an implementation of said function gets the vtable, - // and we know that eggController.cpp contains the vtable and the functions below - /* vt 0x30 | 80499660 */ virtual void beginFrame(void *padStatus); // Really needs to be PADStatus - /* vt 0x34 | 80499a60 */ virtual void endFrame(); + /* vt 0x30 */ virtual void beginFrame(PADStatus *padStatus); + /* vt 0x34 */ virtual void endFrame(); public: /* 0x004 */ s32 mChannelID; - /* 0x008 */ u32 mButtonHeld; // these fields may need a slight amount of work + /* 0x008 */ u32 mButtonHeld; /* 0x00C */ u32 mButtonTriggered; /* 0x010 */ u32 mButtonReleased; /* 0x014 */ u32 field_0x14; - /* 0x018 */ CoreStatus coreStatus[16]; - /* 0xf18 */ int mKPADResult; + /* 0x018 */ CoreStatus mCoreStatus[16]; + /* 0xf18 */ int mReadStatusIdx; /* 0xf1c */ TBitFlag mFlag; /* 0xf20 */ Vector3f mAccel; /* 0xf2c */ Vector2f mDpdPos; - /* 0xf34 */ u32 field_0xf28; + /* 0xf34 */ u32 mIdleTime; /* 0xf38 */ u32 mMotorPattern; /* 0xf3c */ bool mEnableMotor; /* 0xf40 */ s32 mMotorFrameDuration; @@ -114,67 +158,79 @@ public: /* 0xf48 */ ControllerRumbleMgr *mRumbleMgr; /* 0xf4c */ Matrix34f mPostureMatrix; /* 0xf7c */ Matrix34f mPostureMatrixPrev; - /* 0xfac */ TBitFlag mAccelFlags; + /* 0xfac */ TBitFlag mAccelFlags; // May not be TBitFlag? /* 0xfb0 */ s32 mMaxAccelFrameTime; - /* 0xfb4 */ s32 mAccelFrameTimeX; - /* 0xfb8 */ s32 mAccelFrameTimeY; - /* 0xfbc */ s32 mAccelFrameTimeZ; + /* 0xfb4 */ s32 mAccelFrameTime[3]; /* 0xfc0 */ f32 mMaxAccelDiff; /* 0xfc4 */ Vector3f mPrevAccel; public: - /* 80499050 */ CoreController(); - /* 804990b0 */ void sceneReset(); - /* 80499170 */ Vector2f getDpdRawPos() const; - /* 80499190 */ s32 getDpdDistance() const; - /* 804991a0 */ void startMotor(); - /* 804991b0 */ void stopMotor(); - /* 804991c0 */ void createRumbleMgr(u8); - /* 80499220 */ void startPatternRumble(const char *, int, bool); - /* 80499240 */ void stopRumbleMgr(); - /* 80499260 */ CoreStatus *getCoreStatus(s32 idx); - /* 80499270 */ void calc_posture_matrix(Matrix34f &mat, bool); - /* 80499ac0 */ f32 getFreeStickX() const; - /* 80499ae0 */ f32 getFreeStickY() const; + CoreController(); + void sceneReset(); + Vector2f getDpdRawPos(); + f32 getDpdDistance(); + s32 getDpdValidFlag(); // Name Assumed. BBA hints at variable + void startMotor(); + void stopMotor(); + void createRumbleMgr(u8); + void startPatternRumble(const char *, int, bool); + void stopRumbleMgr(); + CoreStatus *getCoreStatus(int idx); + void calc_posture_matrix(Matrix34f &mat, bool); + f32 getFreeStickX() const; + f32 getFreeStickY() const; + + const Vector3f &getAccel() const { + return mCoreStatus[0].getAccel(); + } + + // Guess ? + bool isStable(u8 p1) const { + return (mAccelFlags.getDirect() & p1) == p1; + } }; class CoreControllerMgr { public: struct T__Disposer : Disposer { - /* vt 0x08 | 80499b00 */ virtual ~T__Disposer(); - /* 805767ac */ static T__Disposer *sStaticDisposer; + /* vt 0x08 */ virtual ~T__Disposer(); + static T__Disposer *sStaticDisposer; }; - // Disposer Vtable: 8056ec40 - /* 0x0000 */ T__Disposer mDisposer; // for the static T__Disposer + /* 0x0000 */ T__Disposer mDisposer; + + struct UnkField0x10A0 { + virtual void v_08(UNKTYPE *); + }; + public: - // 0x0010 vtable | 8056ebf8 - /* vt 0x08 | 8049a130 */ virtual void beginFrame(); - /* vt 0x0C | 8049a1e0 */ virtual void endFrame(); + // 0x0010 vtable + /* vt 0x08 */ virtual void beginFrame(); + /* vt 0x0C */ virtual void endFrame(); public: /* 0x0014 */ TBuffer mControllers; /* 0x0020 */ u8 field_0x20[0x10a0 - 0x0020]; - /* 0x10A0 */ u32 field_0x10A0; + /* 0x10A0 */ UnkField0x10A0 *field_0x10A0; /* 0x10A4 */ TBuffer mDevTypes; /* 0x10b0 */ u8 field_0x10B0[0x10e0 - 0x10b0]; public: - /* 80499b80 */ static CoreControllerMgr *createInstance(); - /* 80499bd0 */ static void deleteInstance(); - /* 80499be0 */ CoreController *getNthController(int); + static CoreControllerMgr *createInstance(); + static void deleteInstance(); + CoreController *getNthController(int); static void *allocThunk(size_t size); static int deleteThunk(void *ptr); - /* 80499cd0 */ static void connectCallback(s32, s32); - /* 80499d10 */ CoreControllerMgr(); + static void connectCallback(s32, s32); + CoreControllerMgr(); public: - /* 805767a8 */ static CoreControllerMgr *sInstance; - /* 805767b0 */ static CoreController *(*sCoreControllerFactory)(); - /* 805767b4 */ static ConnectCallback sConnectCallback; - /* 805767b8 */ static bool sUseBuiltinWpadAllocator; - // /* 805767bc */ static sAllocator; // defined in cpp file + static CoreControllerMgr *sInstance; + static CoreController *(*sCoreControllerFactory)(); + static ConnectCallback sConnectCallback; + static bool sUseBuiltinWpadAllocator; + static s32 sWPADWorkSize; }; class NullController : public CoreController { @@ -188,11 +244,11 @@ public: class ControllerRumbleUnit { public: - // 0x00 vtable | 8056ebb4 + // 0x00 vtable inline ControllerRumbleUnit() : mFlag(0) { init(); } - /* vt 0x08 | 8049a8e0 */ virtual ~ControllerRumbleUnit() {} + /* vt 0x08 */ virtual ~ControllerRumbleUnit() {} public: /* 0x04 */ const char *mPattern; @@ -204,15 +260,15 @@ public: /* 0x1C */ nw4r::ut::Node mNode; /* 0x24 */ u32 field_0x24; // could just be part of the node (List) public: - /* 8049a3b0 */ void init(); - /* 8049a3e0 */ void startPattern(const char *patter, int); - /* 8049a440 */ f32 calc(); + void init(); + void startPattern(const char *patter, int); + f32 calc(); }; class ControllerRumbleMgr { public: - // 0x00 vtable | 8056eba8 - /* vt 0x08 | 8049a8a0 */ virtual ~ControllerRumbleMgr() {} + // 0x00 vtable + /* vt 0x08 */ virtual ~ControllerRumbleMgr() {} public: /* 0x04 */ nw4r::ut::List mActiveUnitList; @@ -220,12 +276,12 @@ public: /* 0x1C */ CoreController *mController; public: - /* 8049a530 */ ControllerRumbleMgr(); - /* 8049a590 */ void createUnit(u8 numUnits, CoreController *controller); - /* 8049a620 */ void stop(); - /* 8049a690 */ void calc(); - /* 8049a7a0 */ void startPattern(const char *pattern, int, bool); - /* 8049a7f0 */ ControllerRumbleUnit *getUnitFromList(bool bGrabActive); + ControllerRumbleMgr(); + void createUnit(u8 numUnits, CoreController *controller); + void stop(); + void calc(); + void startPattern(const char *pattern, int, bool); + ControllerRumbleUnit *getUnitFromList(bool bGrabActive); }; } // namespace EGG diff --git a/include/egg/core/eggDecomp.h b/include/egg/core/eggDecomp.h deleted file mode 100644 index 83248930..00000000 --- a/include/egg/core/eggDecomp.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef EGG_STREAM_DECOMP_H -#define EGG_STREAM_DECOMP_H - -#include "rvl/CX/cx.h" -#include - -// NOTE: I put StreamDecomp stuff here. im unsure of the correct place - -namespace EGG { -class StreamDecomp { -public: - /* vt 0x08 */ virtual bool init(void *dest, u32 maxCompressedSize); - /* vt 0x0C */ virtual bool decomp(const void *src, u32 len); - /* vt 0x10 */ virtual u32 getHeaderSize(); - /* vt 0x14 */ virtual u32 getUncompressedSize(const void *src); - -public: - /* 0x04 */ void *dest; - /* 0x08 */ u32 maxCompressedSize; -}; - -class StreamDecompLZ : public StreamDecomp { -public: - /* vt 0x08 | 80494c80 */ virtual bool init(void *dest, u32 maxCompressedSize); - /* vt 0x0C | 80494cb0 */ virtual bool decomp(const void *src, u32 len); - /* vt 0x10 | 804952c0 */ virtual u32 getHeaderSize(); - /* vt 0x14 | 804952b0 */ virtual u32 getUncompressedSize(const void *src); - -public: - /* 0x0C */ CXUncompContextLZ context; -}; -class StreamDecompRL : public StreamDecomp { -public: - /* vt 0x08 | 80494ce0 */ virtual bool init(void *dest, u32 maxCompressedSize); - /* vt 0x0C | 80494d10 */ virtual bool decomp(const void *src, u32 len); - /* vt 0x10 | 804952a0 */ virtual u32 getHeaderSize(); - /* vt 0x14 | 80495290 */ virtual u32 getUncompressedSize(const void *src); - -public: - /* 0x0C */ CXUncompContextRL context; -}; - -class StreamDecompLH : public StreamDecomp { -public: - /* vt 0x08 | 80494d40 */ virtual bool init(void *dest, u32 maxCompressedSize); - /* vt 0x0C | 80494d70 */ virtual bool decomp(const void *src, u32 len); - /* vt 0x10 | 80495280 */ virtual u32 getHeaderSize(); - /* vt 0x14 | 80495270 */ virtual u32 getUncompressedSize(const void *src); - -public: - /* 0x0C */ CXUncompContextLH context; -}; -class StreamDecompLRC : public StreamDecomp { -public: - /* vt 0x08 | 80494da0 */ virtual bool init(void *dest, u32 maxCompressedSize); - /* vt 0x0C | 80494dd0 */ virtual bool decomp(const void *src, u32 len); - /* vt 0x10 | 80495260 */ virtual u32 getHeaderSize(); - /* vt 0x14 | 80495250 */ virtual u32 getUncompressedSize(const void *src); - -public: - /* 0x0C */ CXUncompContextLRC context; -}; -class StreamDecompSZS : public StreamDecomp { -public: - /* vt 0x08 | 804951d0 */ virtual bool init(void *dest, u32 maxCompressedSize); - /* vt 0x0C | 80495200 */ virtual bool decomp(const void *src, u32 len); - /* vt 0x10 | 80495240 */ virtual u32 getHeaderSize(); - /* vt 0x14 | 80495230 */ virtual u32 getUncompressedSize(const void *src); - -private: - // NON-OFFICIAL - struct SZSCompContext { - u8 _[0x14]; - /* 80494e00 */ static u32 getUncompressedSize(const void *src); - /* 80494e30 */ void init(u32 maxCompSize); - /* 80494e60 */ static int readSzsHeader(/* unk params*/); - /* 80494f60 */ void *decomp(const void *src, u32 len); - }; - -public: - /* 0x0C */ SZSCompContext context; -}; -} // namespace EGG - -#endif diff --git a/include/egg/core/eggDisplay.h b/include/egg/core/eggDisplay.h index 04125c66..52cf56ce 100644 --- a/include/egg/core/eggDisplay.h +++ b/include/egg/core/eggDisplay.h @@ -6,29 +6,33 @@ #include "egg/prim/eggBitFlag.h" #include "nw4r/ut.h" #include "rvl/VI.h" -#include -/* 80497530 */ // void PreRetraceCallback(void); +#include namespace EGG { class Display { public: - enum EFlagBits { mFlag_SetClear, mFlag_WaitForRetrace }; + enum EFlagBits { + mFlag_SetClear, + mFlag_WaitForRetrace + }; /* 0x00*/ TBitFlag mFlag; + enum EScreenStateBits { + mScreenStateFlag_SetBlack + }; public: - // vtable at 0x04 | 8056eac8 - /* vt 0x08 | 80497600 */ virtual void beginFrame(); - /* vt 0x0C | 804976c0 */ virtual void beginRender(); - /* vt 0x10 | 804976d0 */ virtual void endRender(); - /* vt 0x14 | 804976e0 */ virtual void endFrame(); - /* vt 0x18 | 804975f0 */ virtual u32 getTickPerFrame(); - /* vt 0x1C | 804976f0 */ virtual void preVRetrace(); + // vtable at 0x04 + /* vt 0x08 */ virtual void beginFrame(); + /* vt 0x0C */ virtual void beginRender(); + /* vt 0x10 */ virtual void endRender(); + /* vt 0x14 */ virtual void endFrame(); + /* vt 0x18 */ virtual u32 getTickPerFrame(); + /* vt 0x1C */ virtual void preVRetrace(); public: /* 0x08 */ u8 mMaxRetraces; - enum EScreenStateBits { mScreenStateFlag_SetBlack }; /* 0x09 */ TBitFlag mScreenStateFlag; /* 0x0C */ u32 mRetraceCount; /* 0x10 */ u32 mFrameCount; @@ -40,13 +44,13 @@ public: /* 0x28 */ f32 mFrequency; public: - /* 80497570 */ Display(u8 maxRetrace); - /* 804977d0 */ void copyEFBtoXFB(); - /* 80497870 */ void calcFrequency(); - /* inline */ void setBlack(bool b) {} + Display(u8 maxRetrace); + void copyEFBtoXFB(); + void calcFrequency(); + void setBlack(bool b) {} public: - /* 80497900 */ static u32 sTickPeriod; + static u32 sTickPeriod; }; } // namespace EGG diff --git a/include/egg/core/eggDisposer.h b/include/egg/core/eggDisposer.h index 0009137d..c92d8163 100644 --- a/include/egg/core/eggDisposer.h +++ b/include/egg/core/eggDisposer.h @@ -4,19 +4,22 @@ // This file was adapted from https://github.com/riidefi/mkw/blob/master/source/egg/core/eggDisposer.hpp #include "nw4r/ut.h" + #include namespace EGG { class Heap; class Disposer : private NonCopyable { - public: - /* vt 0x08 | 80496890 */ virtual ~Disposer(); + /* vt 0x08 */ virtual ~Disposer(); /* 80496830 */ Disposer(); public: - enum eLifetime { LIFETIME_UNMANAGED, LIFETIME_HEAP_GC }; + enum eLifetime { + LIFETIME_UNMANAGED, + LIFETIME_HEAP_GC + }; inline eLifetime getLifetime() const { return mContainHeap != nullptr ? LIFETIME_HEAP_GC : LIFETIME_UNMANAGED; } diff --git a/include/egg/core/eggDvdFile.h b/include/egg/core/eggDvdFile.h index a9e9ef2b..4833da31 100644 --- a/include/egg/core/eggDvdFile.h +++ b/include/egg/core/eggDvdFile.h @@ -5,6 +5,7 @@ #include "nw4r/ut.h" #include "rvl/DVD.h" #include "rvl/OS.h" + #include namespace EGG { @@ -28,24 +29,25 @@ public: /* 0xc8 */ nw4r::ut::Node mNode; public: - /* vt 0x08 | 804942f0 */ virtual ~DvdFile(); - /* vt 0x0C | 80494450 */ virtual bool open(const char *path); - /* vt 0x10 | 804944b0 */ virtual void close(); - /* vt 0x14 | 80494510 */ virtual s32 readData(void *buffer, s32 length, s32 offset); - /* vt 0x18 | 804945e0 */ virtual s32 writeData(const void *buffer, s32 length, s32 offset); - /* vt 0x1C | 80494670 */ virtual u32 getFileSize() const; - /* vt 0x20 | 804943d0 */ virtual bool open(s32 entryNum); - /* vt 0x24 | 804944a0 */ virtual bool open(const char *path, void *); + /* vt 0x08 */ virtual ~DvdFile(); + /* vt 0x0C */ virtual bool open(const char *path); + /* vt 0x10 */ virtual void close(); + /* vt 0x14 */ virtual s32 readData(void *buffer, s32 length, s32 offset); + /* vt 0x18 */ virtual s32 writeData(const void *buffer, s32 length, s32 offset); + /* vt 0x1C */ virtual u32 getFileSize() const; + /* vt 0x20 */ virtual bool open(s32 entryNum); + /* vt 0x24 */ virtual bool open(const char *path, void *); public: - /* 804942a0 */ DvdFile(); - /* 80494360 */ void initiate(); - /* 804945f0 */ s32 sync(); - /* 80494650 */ static void doneProcess(s32 result, DVDFileInfo *fileInfo); + void initialize(); + DvdFile(); + void initiate(); + s32 sync(); + static void doneProcess(s32 result, DVDFileInfo *fileInfo); -public: - /* 80576730 */ static bool sIsInitialized; - /* 80673ad8 */ static nw4r::ut::List sDvdList; +private: + static bool sIsInitialized; + static nw4r::ut::List sDvdList; }; } // namespace EGG diff --git a/include/egg/core/eggDvdRipper.h b/include/egg/core/eggDvdRipper.h index fc2cc374..dce0aad4 100644 --- a/include/egg/core/eggDvdRipper.h +++ b/include/egg/core/eggDvdRipper.h @@ -1,30 +1,52 @@ #ifndef EGG_DVD_RIPPER_H #define EGG_DVD_RIPPER_H -#include "egg/core/eggDecomp.h" #include "egg/core/eggDvdFile.h" #include "egg/core/eggHeap.h" +#include "egg/core/eggStreamDecomp.h" + #include namespace EGG { class DvdRipper { public: - enum EAllocDirection { ALLOC_CIR_PAD, ALLOC_DIR_TOP, ALLOC_DIR_BOTTOM }; + enum EAllocDirection { + ALLOC_CIR_PAD, + ALLOC_DIR_TOP, + ALLOC_DIR_BOTTOM + }; + + struct UnkCallback_Arg { + u8 UNK_0x00[4]; + u32 UNK_0x04; + u32 UNK_0x08; + u32 UNK_0x0C; + u32 UNK_0x10; + void *buf; + }; + typedef void (*UnkCallback)(void *); public: - /* 80494680 */ static u8 *loadToMainRAM(s32 entryNum, u8 *dst, Heap *heap, EAllocDirection allocDir, u32 offset, - u32 *amountRead, u32 *fileSize); - /* 80494730 */ static u8 *loadToMainRAM(const char *path, u8 *dst, Heap *heap, EAllocDirection allocDir, u32 offset, - u32 *amountRead, u32 *fileSize); - /* 804947e0 */ static u8 *loadToMainRAM(DvdFile *file, u8 *dst, Heap *heap, EAllocDirection allocDir, u32 offset, - u32 *amountRead, u32 *fileSize); - /* 804949b0 */ static void *loadToMainRAMDecomp(DvdFile *file, StreamDecomp *decompressor, u8 *dst, Heap *heap, - EAllocDirection allocDir, s32 offset, u32 size, u32 maxChunkSize, u32 *amountRead, u32 *fileSize); + static u8 * + loadToMainRAM(s32 entryNum, u8 *pOut, Heap *pHeap, EAllocDirection allocDir, u32 offset, u32 *pRead, u32 *fileSize); + + static u8 *loadToMainRAM( + const char *path, u8 *pOut, Heap *pHeap, EAllocDirection allocDir, u32 offset, u32 *pRead, u32 *fileSize + ); + + static u8 *loadToMainRAM( + DvdFile *pFile, u8 *pOut, Heap *pHeap, EAllocDirection allocDir, u32 offset, u32 *pRead, u32 *fileSize + ); + + static void *loadToMainRAMDecomp( + DvdFile *pFile, StreamDecomp *decompressor, u8 *pOut, Heap *pHeap, EAllocDirection allocDir, s32 offset, + u32 size, u32 chunkSize, u32 *pRead, u32 *fileSize + ); public: - /* 80574ed0 */ static bool sErrorRetry; - /* */ // static sCallback; + static bool sErrorRetry; + static UnkCallback sCallback; }; } // namespace EGG diff --git a/include/egg/core/eggExpHeap.h b/include/egg/core/eggExpHeap.h index 69b35128..6d48da17 100644 --- a/include/egg/core/eggExpHeap.h +++ b/include/egg/core/eggExpHeap.h @@ -2,29 +2,30 @@ #define EGG_EXP_HEAP_H #include "egg/core/eggHeap.h" + #include namespace EGG { class ExpHeap : public Heap { public: - // vtable at 0x0 | 8056e980 - /* vt 0x08 | 80495af0 */ virtual ~ExpHeap(); - /* vt 0x0C | 80495f90 */ virtual eHeapKind getHeapKind() const; - /* vt 0x14 | 80495d90 */ virtual void *alloc(u32 size, s32 align); - /* vt 0x18 | 80495e50 */ virtual void free(void *block); - /* vt 0x1C | 80495d00 */ virtual void destroy(); - /* vt 0x20 | 80495ec0 */ virtual u32 resizeForMBlock(void *block, u32 size); - /* vt 0x24 | 80495ed0 */ virtual u32 getTotalFreeSize(); - /* vt 0x28 | 80495ee0 */ virtual u32 getAllocatableSize(s32 align); - /* vt 0x2C | 80495f00 */ virtual u32 adjust(); + // vtable at 0x0 + /* vt 0x08 */ virtual ~ExpHeap(); + /* vt 0x0C */ virtual eHeapKind getHeapKind() const override; + /* vt 0x14 */ virtual void *alloc(u32 size, s32 align) override; + /* vt 0x18 */ virtual void free(void *block) override; + /* vt 0x1C */ virtual void destroy() override; + /* vt 0x20 */ virtual u32 resizeForMBlock(void *block, u32 size) override; + /* vt 0x24 */ virtual u32 getTotalFreeSize() override; + /* vt 0x28 */ virtual u32 getAllocatableSize(s32 align) override; + /* vt 0x2C */ virtual u32 adjust() override; public: - /* 80495ab0 */ ExpHeap(MEMiHeapHead *heapHead); - /* 80495b70 */ static ExpHeap *create(void *block, size_t size, u16 attr); - /* 80495c30 */ static ExpHeap *create(size_t size, Heap *heap, u16 attr); - /* 80495d00 */ void setGroupID(u16 groupId); - /* 80495f80 */ static u32 getSizeForMBlock(const void *block); + ExpHeap(MEMiHeapHead *heapHead); + static ExpHeap *create(void *block, size_t size, u16 attr); + static ExpHeap *create(size_t size, Heap *heap, u16 attr); + void setGroupID(u16 groupId); + static u32 getSizeForMBlock(const void *block); // Placement new for ::create inline void *operator new(size_t size, void *ptr) { diff --git a/include/egg/core/eggFader.h b/include/egg/core/eggFader.h index e0183dad..950b5dbb 100644 --- a/include/egg/core/eggFader.h +++ b/include/egg/core/eggFader.h @@ -16,12 +16,12 @@ public: public: // vtable at 0x00 - /* vt 0x08 | 00000000 */ virtual void setStatus(EStatus) = 0; - /* vt 0x0C | 00000000 */ virtual EStatus getStatus() const = 0; - /* vt 0x10 | 00000000 */ virtual bool fadeIn() = 0; - /* vt 0x14 | 00000000 */ virtual bool fadeOut() = 0; - /* vt 0x18 | 00000000 */ virtual bool calc() = 0; - /* vt 0x1C | 00000000 */ virtual void draw() = 0; + /* vt 0x08 */ virtual void setStatus(EStatus) = 0; + /* vt 0x0C */ virtual EStatus getStatus() const = 0; + /* vt 0x10 */ virtual bool fadeIn() = 0; + /* vt 0x14 */ virtual bool fadeOut() = 0; + /* vt 0x18 */ virtual bool calc() = 0; + /* vt 0x1C */ virtual void draw() = 0; }; } // namespace EGG diff --git a/include/egg/core/eggFrmHeap.h b/include/egg/core/eggFrmHeap.h index 10757d7c..863e6350 100644 --- a/include/egg/core/eggFrmHeap.h +++ b/include/egg/core/eggFrmHeap.h @@ -2,29 +2,30 @@ #define EGG_FRM_HEAP_H #include "egg/core/eggHeap.h" + #include namespace EGG { class FrmHeap : public Heap { public: - // vtable at 0x0 | 8056e9d0 - /* vt 0x08 | 80495fe0 */ virtual ~FrmHeap(); - /* vt 0x0C | 80496390 */ virtual eHeapKind getHeapKind() const; - /* vt 0x14 | 804961c0 */ virtual void *alloc(u32 size, s32 align); - /* vt 0x18 | 80496250 */ virtual void free(void *block); - /* vt 0x1C | 80496130 */ virtual void destroy(); - /* vt 0x20 | 804962b0 */ virtual u32 resizeForMBlock(void *block, u32 size); - /* vt 0x24 | 804962c0 */ virtual u32 getTotalFreeSize(); - /* vt 0x28 | 804962e0 */ virtual u32 getAllocatableSize(s32 align); - /* vt 0x2C | 804962f0 */ virtual u32 adjust(); + // vtable at 0x0 + virtual ~FrmHeap(); + virtual eHeapKind getHeapKind() const override; + virtual void *alloc(u32 size, s32 align) override; + virtual void free(void *block) override; + virtual void destroy() override; + virtual u32 resizeForMBlock(void *block, u32 size) override; + virtual u32 getTotalFreeSize() override; + virtual u32 getAllocatableSize(s32 align) override; + virtual u32 adjust() override; public: - /* 80495fa0 */ FrmHeap(MEMiHeapHead *heapHead); - /* 80496060 */ static FrmHeap *create(void *block, size_t size, u16 attr); - /* 804962a0 */ void free(s32 flags); - /* 80496370 */ void recordState(u32 id); // non official for now - /* 80496380 */ void freeState(u32 id); // non official for now + FrmHeap(MEMiHeapHead *heapHead); + static FrmHeap *create(void *block, u32 size, u16 attr); + void free(s32 flags); + void recordState(u32 id); + void freeByState(u32 id); }; } // namespace EGG diff --git a/include/egg/core/eggGraphicsFifo.h b/include/egg/core/eggGraphicsFifo.h index 8226aa90..d66f225f 100644 --- a/include/egg/core/eggGraphicsFifo.h +++ b/include/egg/core/eggGraphicsFifo.h @@ -2,14 +2,15 @@ #define EGG_GRAPHICS_FIFO_H #include "egg/core/eggHeap.h" + #include namespace EGG { class GraphicsFifo { public: - // vtable 0x00 | 8056eb80 - /* vt 0x08 | 80498e90*/ virtual ~GraphicsFifo(); + // vtable 0x00 + /* vt 0x08 */ virtual ~GraphicsFifo(); public: /* 0x04 */ void *mGxInitData; @@ -17,12 +18,12 @@ public: /* 0x0C */ u32 mBufSize; public: - /* 80498e20 */ static void create(u32 size, Heap *heap); - /* 80498f30 */ GraphicsFifo(u32 size, Heap *heap); + static void create(u32 size, Heap *heap); + GraphicsFifo(u32 size, Heap *heap); public: - /* 80576798 */ static GraphicsFifo *sGraphicsFifo; - /* 8057679c */ static u8 sGpStatus[5]; + static GraphicsFifo *sGraphicsFifo; + static u8 sGpStatus[5]; }; } // namespace EGG diff --git a/include/egg/core/eggHeap.h b/include/egg/core/eggHeap.h index 956a8bfd..78e39029 100644 --- a/include/egg/core/eggHeap.h +++ b/include/egg/core/eggHeap.h @@ -9,6 +9,7 @@ #include "nw4r/ut.h" #include "rvl/MEM.h" #include "rvl/OS.h" + #include namespace EGG { @@ -54,17 +55,17 @@ public: HEAP_KIND_UNIT, HEAP_KIND_ASSERT, }; - // vtable at 0x0 | 8056e950 - /* vt 0x08 | 804954c0 */ virtual ~Heap(); - /* vt 0x0C | 00000000 */ virtual eHeapKind getHeapKind() const = 0; - /* vt 0x10 | 80495a40 */ virtual void initAllocator(Allocator *allocator, s32 align); - /* vt 0x14 | 00000000 */ virtual void *alloc(u32 size, s32 align) = 0; - /* vt 0x18 | 00000000 */ virtual void free(void *block) = 0; - /* vt 0x1C | 00000000 */ virtual void destroy() = 0; - /* vt 0x20 | 00000000 */ virtual u32 resizeForMBlock(void *block, u32 size) = 0; - /* vt 0x24 | 00000000 */ virtual u32 getTotalFreeSize() = 0; - /* vt 0x28 | 00000000 */ virtual u32 getAllocatableSize(s32 align) = 0; - /* vt 0x2C | 00000000 */ virtual u32 adjust() = 0; + // vtable at 0x0 + /* vt 0x08 */ virtual ~Heap(); + /* vt 0x0C */ virtual eHeapKind getHeapKind() const = 0; + /* vt 0x10 */ virtual void initAllocator(Allocator *allocator, s32 align); + /* vt 0x14 */ virtual void *alloc(u32 size, s32 align) = 0; + /* vt 0x18 */ virtual void free(void *block) = 0; + /* vt 0x1C */ virtual void destroy() = 0; + /* vt 0x20 */ virtual u32 resizeForMBlock(void *block, u32 size) = 0; + /* vt 0x24 */ virtual u32 getTotalFreeSize() = 0; + /* vt 0x28 */ virtual u32 getAllocatableSize(s32 align) = 0; + /* vt 0x2C */ virtual u32 adjust() = 0; public: void setName(const char *name) { @@ -94,18 +95,18 @@ public: }; public: - /* 804953f0 */ static void initialize(); - /* 80495430 */ Heap(MEMiHeapHead *heapHandle); - /* 80495690 */ static Heap *findHeap(MEMiHeapHead *heapHandle); - /* 80495730 */ Heap *findParentHeap(); - /* 80495780 */ static Heap *findContainHeap(const void *memBlock); - /* 80495560 */ static void *alloc(size_t size, int align, Heap *heap); - /* 804957c0 */ static void free(void *memBlock, Heap *heap); - /* 80495830 */ void dispose(); - /* 804958a0 */ void dump(); - /* 804958b0 */ static void dumpAll(); - /* 804959a0 */ Heap *becomeCurrentHeap(); - /* 80495a00 */ Heap *_becomeCurrentHeapWithoutLock(); + static void initialize(); + Heap(MEMiHeapHead *heapHandle); + static Heap *findHeap(MEMiHeapHead *heapHandle); + Heap *findParentHeap(); + static Heap *findContainHeap(const void *memBlock); + static void *alloc(size_t size, int align, Heap *heap); + static void free(void *memBlock, Heap *heap); + void dispose(); + void dump(); + static void dumpAll(); + Heap *becomeCurrentHeap(); + Heap *_becomeCurrentHeapWithoutLock(); public: template @@ -177,26 +178,26 @@ public: return ret; } - /* 80673ae8 */ static nw4r::ut::List sHeapList; - /* 80673af8 */ static OSMutex sRootMutex; - /* 80576740 */ static Heap *sCurrentHeap; - /* 80576744 */ static int sIsHeapListInitialized; - /* 80576748 */ static Heap *sAllocatableHeap; - /* 8057674c */ static ErrorCallback sErrorCallback; - /* 80576750 */ static HeapAllocCallback sAllocCallback; - /* 80576754 */ static HeapFreeCallback sFreeCallback; - /* 80576758 */ static void *sErrorCallbackArg; - /* 8057675c */ static void *sAllocCallbackArg; - /* 80576760 */ static void *sFreeCallbackArg; - /* 80576764 */ static HeapCreateCallback sCreateCallback; - /* 80576764 */ static HeapDestroyCallback sDestroyCallback; + static nw4r::ut::List sHeapList; + static OSMutex sRootMutex; + static Heap *sCurrentHeap; + static int sIsHeapListInitialized; + static Heap *sAllocatableHeap; + static ErrorCallback sErrorCallback; + static HeapAllocCallback sAllocCallback; + static HeapFreeCallback sFreeCallback; + static void *sErrorCallbackArg; + static void *sAllocCallbackArg; + static void *sFreeCallbackArg; + static HeapCreateCallback sCreateCallback; + static HeapDestroyCallback sDestroyCallback; }; } // namespace EGG -/* 80495a60 */ void *operator new(size_t, void *p); -/* 80495a70 */ void *operator new(size_t size, EGG::Heap *heap, int align = 4); -/* 80495a80 */ void *operator new(size_t size, EGG::Allocator *alloc); -/* 80495a90 */ void *operator new[](size_t size, int align); -/* 80495aa0 */ void *operator new[](size_t size, EGG::Heap *heap, int align = 4); +void *operator new(size_t, void *p); +void *operator new(size_t size, EGG::Heap *heap, int align = 4); +void *operator new(size_t size, EGG::Allocator *alloc); +void *operator new[](size_t size, int align); +void *operator new[](size_t size, EGG::Heap *heap, int align = 4); #endif diff --git a/include/egg/core/eggStreamDecomp.h b/include/egg/core/eggStreamDecomp.h new file mode 100644 index 00000000..ffda8f69 --- /dev/null +++ b/include/egg/core/eggStreamDecomp.h @@ -0,0 +1,116 @@ +#ifndef EGG_STREAM_DECOMP_H +#define EGG_STREAM_DECOMP_H + +#include "rvl/CX/cx.h" + +#include + +// NOTE: I put StreamDecomp stuff here. im unsure of the correct place + +namespace EGG { +class StreamDecomp { +public: + /* vt 0x08 */ virtual bool init(void *pDest, u32 maxCompressedSize); + /* vt 0x0C */ virtual bool decomp(const void *pSrc, u32 len); + /* vt 0x10 */ virtual u32 getHeaderSize(); + /* vt 0x14 */ virtual u32 getUncompressedSize(const void *pSrc); + +public: + /* 0x04 */ void *mpDest; + /* 0x08 */ u32 mMaxCompressedSize; +}; + +class StreamDecompLZ : public StreamDecomp { +public: + virtual bool init(void *pDest, u32 maxCompressedSize) override; + virtual bool decomp(const void *pSrc, u32 len) override; + virtual u32 getHeaderSize() override { + return 0x20; + } + virtual u32 getUncompressedSize(const void *pSrc) override { + return CXGetUncompressedSize(pSrc); + } + +public: + /* 0x0C */ CXUncompContextLZ mContext; +}; +class StreamDecompRL : public StreamDecomp { +public: + virtual bool init(void *pDest, u32 maxCompressedSize) override; + virtual bool decomp(const void *pSrc, u32 len) override; + virtual u32 getHeaderSize() override { + return 0x20; + } + virtual u32 getUncompressedSize(const void *pSrc) override { + return CXGetUncompressedSize(pSrc); + } + +public: + /* 0x0C */ CXUncompContextRL mContext; +}; + +class StreamDecompLH : public StreamDecomp { +public: + virtual bool init(void *pDest, u32 maxCompressedSize) override; + virtual bool decomp(const void *pSrc, u32 len) override; + virtual u32 getHeaderSize() override { + return 0x20; + } + virtual u32 getUncompressedSize(const void *pSrc) override { + return CXGetUncompressedSize(pSrc); + } + +public: + /* 0x0C */ CXUncompContextLH mContext; +}; +class StreamDecompLRC : public StreamDecomp { +public: + virtual bool init(void *pDest, u32 maxCompressedSize) override; + virtual bool decomp(const void *pSrc, u32 len) override; + virtual u32 getHeaderSize() override { + return 0x20; + } + virtual u32 getUncompressedSize(const void *pSrc) override { + return CXGetUncompressedSize(pSrc); + } + +public: + /* 0x0C */ CXUncompContextLRC mContext; +}; + +// NON-OFFICIAL +struct UncompContextSZS { + /* 80494e00 */ static u32 getUncompressedSize(const void *pSrc); + /* 80494e30 */ void initUncompContext(void *pDest); + /* 80494e60 */ static s32 + readHeader(u8 *pHeaderLen, s32 *pUncompSize, const u8 *src, u32 maxCompLen, s32 maxUncompSize); + /* 80494f60 */ s32 readUncomp(const void *pSrca, u32 len); + + /* 0x00 */ u8 *mpDest; + /* 0x04 */ s32 mUncompSize; + /* 0x08 */ s32 mMaxUncompSize; + /* 0x0C */ u8 mGroupHead; + /* 0x0D */ u8 mSecondByte; + /* 0x0E */ u8 mFirstByte; + /* 0x0F */ u8 mState; + /* 0x10 */ u16 mCopySrc; + /* 0x12 */ u8 mHeaderLen; +}; + +class StreamDecompSZS : public StreamDecomp { +public: + virtual bool init(void *pDest, u32 maxCompressedSize) override; + virtual bool decomp(const void *pSrc, u32 len) override; + virtual u32 getHeaderSize() override { + return 0x20; + } + virtual u32 getUncompressedSize(const void *pSrc) override { + return mContext.getUncompressedSize(pSrc); + } + +public: + /* 0x0C */ UncompContextSZS mContext; +}; +} // namespace EGG + +#endif diff --git a/include/egg/core/eggSystem.h b/include/egg/core/eggSystem.h index 9fe8e9db..d9e5cafa 100644 --- a/include/egg/core/eggSystem.h +++ b/include/egg/core/eggSystem.h @@ -2,6 +2,7 @@ #define EGG_SYSTEM_H #include "egg/core/eggHeap.h" + #include namespace EGG { @@ -12,19 +13,19 @@ class Video; class ConfigurationData { public: - // vtable at 0x0 | 8056ea8c - /* vt 0x08 | 00000000 */ virtual Video *getVideo() = 0; - /* vt 0x0C | 00000000 */ virtual Heap *getSystemHeap() = 0; - /* vt 0x10 | 00000000 */ virtual Display *getDisplay() = 0; - /* vt 0x14 | 00000000 */ virtual XfbManager *getXfbMgr() = 0; - /* vt 0x18 | 00000000 */ virtual void getPerfView() = 0; - /* vt 0x1C | 00000000 */ virtual void getScnMgr() = 0; - /* vt 0x20 | 00000000 */ virtual void getAudioMgr() = 0; - /* vt 0x24 | 800643d0 */ virtual void onBeginFrame(); - /* vt 0x28 | 80064430 */ virtual void onEndFrame(); - /* vt 0x2C | 80064ea0 */ virtual void initRenderMode(); - /* vt 0x30 | 80497170 */ virtual void initMemory(); - /* vt 0x34 | 804972f0 */ virtual void run(); + // vtable at 0x0 + /* vt 0x08 */ virtual Video *getVideo() = 0; + /* vt 0x0C */ virtual Heap *getSystemHeap() = 0; + /* vt 0x10 */ virtual Display *getDisplay() = 0; + /* vt 0x14 */ virtual XfbManager *getXfbMgr() = 0; + /* vt 0x18 */ virtual void getPerfView() = 0; + /* vt 0x1C */ virtual void getScnMgr() = 0; + /* vt 0x20 */ virtual void getAudioMgr() = 0; + /* vt 0x24 */ virtual void onBeginFrame(); + /* vt 0x28 */ virtual void onEndFrame(); + /* vt 0x2C */ virtual void initRenderMode(); + /* vt 0x30 */ virtual void initMemory(); + /* vt 0x34 */ virtual void run(); public: /* 0x04 */ u32 mRoot1HeapStart; @@ -45,7 +46,7 @@ public: }; class BaseSystem { public: - /* 80576780 */ static ConfigurationData *mConfigData; + static ConfigurationData *mConfigData; static XfbManager *getXfbMgr() { return mConfigData->getXfbMgr(); } diff --git a/include/egg/core/eggThread.h b/include/egg/core/eggThread.h index 048cb88e..735dc4ef 100644 --- a/include/egg/core/eggThread.h +++ b/include/egg/core/eggThread.h @@ -4,16 +4,19 @@ #include "egg/core/eggHeap.h" #include "nw4r/ut.h" #include "rvl/OS.h" + #include namespace EGG { class Thread { -public: // vtable: 0x00 | 8056ea40 - /* 0x08 | 80496a60 */ virtual ~Thread(); - /* 0x0C | 80496dd0 */ virtual void *run() { return nullptr; } - /* 0x10 | 800bd600 */ virtual void onEnter() {} - /* 0x14 | 800bd5f0 */ virtual void onExit() {} +public: // vtable: 0x00 + /* 0x08 */ virtual ~Thread(); + /* 0x0C */ virtual void *run() { + return nullptr; + } + /* 0x10 */ virtual void onEnter() {} + /* 0x14 */ virtual void onExit() {} public: /* 0x04 */ Heap *mContainingHeap; @@ -30,18 +33,18 @@ public: /* 0x44 */ nw4r::ut::Node mLink; public: - /* 80496910 */ Thread(u32 stackSize, int msgCount, int priority, Heap *heap); - /* 804969e0 */ Thread(OSThread *osThread, int msgCount); - /* 80496b20 */ static Thread *findThread(OSThread *thread); - /* 80496b90 */ static void initialize(); - /* 80496bd0 */ void setThreadCurrentHeap(Heap *heap); - /* 80496c70 */ static void switchThreadCallback(OSThread *from, OSThread *to); - /* 80496d60 */ void setCommonMesgQueue(int mesgCount, Heap *heap); - /* 80496dc0 */ static void *start(void *thread); + Thread(u32 stackSize, int msgCount, int priority, Heap *heap); + Thread(OSThread *osThread, int msgCount); + static Thread *findThread(OSThread *thread); + static void initialize(); + void setThreadCurrentHeap(Heap *heap); + static void switchThreadCallback(OSThread *from, OSThread *to); + void setCommonMesgQueue(int mesgCount, Heap *heap); + static void *start(void *thread); public: - /* 80673b10 */ static nw4r::ut::List sThreadList; - /* 80576770 */ static void (*sOldSwitchThreadCallback)(OSThread *, OSThread *); + static nw4r::ut::List sThreadList; + static void (*sOldSwitchThreadCallback)(OSThread *, OSThread *); }; } // namespace EGG diff --git a/include/egg/core/eggUnk.h b/include/egg/core/eggUnk.h index 4470800a..76d7c3e5 100644 --- a/include/egg/core/eggUnk.h +++ b/include/egg/core/eggUnk.h @@ -2,8 +2,10 @@ #define EGG_UNK_H #include "rvl/OS.h" + #include + // This is seen in Animal Crossing: City Folk also. Idk where it belongs // Seen between EGG::Thread and EGG::ConfigurationData (eggThread and eggSystem) diff --git a/include/egg/core/eggVideo.h b/include/egg/core/eggVideo.h index 0a282516..00ebf89c 100644 --- a/include/egg/core/eggVideo.h +++ b/include/egg/core/eggVideo.h @@ -4,6 +4,7 @@ #include "egg/prim/eggBitFlag.h" #include "rvl/GX.h" #include "rvl/VI.h" + #include namespace EGG { @@ -20,15 +21,15 @@ public: /* 0x08 */ u32 mConfiguredTime; public: - /* inline */ Video() : pRenderMode(0), mFlag(), mConfiguredTime(){}; - /* 80498690 */ void initialize(GXRenderModeObj *, const RenderModeObjSet *); - /* 804986f0 */ GXRenderModeObj *configure(GXRenderModeObj *, const RenderModeObjSet *); - /* 80498800 */ static u32 getTickPerVRetrace(u32 tvFormat); - /* 80498860 */ static u32 getTickPerVRetrace(); - /* 80498890 */ static const GXRenderModeObj *getStandardRenderModeObj(const RenderModeObjSet *); + Video() : pRenderMode(0), mFlag(), mConfiguredTime(){}; + void initialize(GXRenderModeObj *, const RenderModeObjSet *); + GXRenderModeObj *configure(GXRenderModeObj *, const RenderModeObjSet *); + static u32 getTickPerVRetrace(u32 tvFormat); + static u32 getTickPerVRetrace(); + static const GXRenderModeObj *getStandardRenderModeObj(const RenderModeObjSet *); public: - /* inline */ void setBlack(bool b) { + void setBlack(bool b) { VISetBlack(!mFlag.onBit(0)); mFlag.toggleBit(0); } diff --git a/include/egg/core/eggXfb.h b/include/egg/core/eggXfb.h index b7c1d5b2..ee6eafea 100644 --- a/include/egg/core/eggXfb.h +++ b/include/egg/core/eggXfb.h @@ -2,6 +2,7 @@ #define EGG_XFB_H #include "egg/core/eggHeap.h" + #include namespace EGG { @@ -23,9 +24,10 @@ public: /* 0x0C */ Xfb *mNext; // idk the actual order, but they always link to each other /* 0x10 */ Xfb *mPrev; // idk the actual order, but they always link to each other public: - /* 804989e0 */ void init(u16 width, u16 height, Heap *heap); - /* 80498a60 */ Xfb(Heap *heap); - /* 80498ad0 */ static u32 calcBufferSize(u16 width, u16 height); + Xfb(Heap *heap); + void init(u16 width, u16 height, Heap *heap); + + static u32 calcBufferSize(u16 width, u16 height); }; } // namespace EGG diff --git a/include/egg/core/eggXfbManager.h b/include/egg/core/eggXfbManager.h index 948b0349..df749598 100644 --- a/include/egg/core/eggXfbManager.h +++ b/include/egg/core/eggXfbManager.h @@ -2,6 +2,7 @@ #define EGG_XFB_MANAGER_H #include "egg/core/eggXfb.h" + #include namespace EGG { @@ -14,10 +15,10 @@ public: /* 0xC */ u8 mNumXfbs; // Total number of Xfbs ever attached /* 0xD */ u8 mNumXfbs_Copy; // Unsure of purpose yet, but showing wont proceed until its under 3 public: - /* 80498af0 */ bool isRegisterd(Xfb &xfb) const; // yes. this is correct spelling - /* 80498b30 */ bool attach(Xfb *xfb); - /* 80498c10 */ void copyEFB(bool); - /* 80498d00 */ void setNextFrameBuffer(); + bool isRegisterd(Xfb &xfb) const; // yes. this is correct spelling + bool attach(Xfb *xfb); + void copyEFB(bool); + void setNextFrameBuffer(); }; } // namespace EGG diff --git a/include/egg/gfx/eggCamera.h b/include/egg/gfx/eggCamera.h new file mode 100644 index 00000000..58937440 --- /dev/null +++ b/include/egg/gfx/eggCamera.h @@ -0,0 +1,6 @@ +#ifndef EGG_CAMERA_H +#define EGG_CAMERA_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggCapTexture.h b/include/egg/gfx/eggCapTexture.h new file mode 100644 index 00000000..6fea561c --- /dev/null +++ b/include/egg/gfx/eggCapTexture.h @@ -0,0 +1,6 @@ +#ifndef EGG_CAP_TEXTURE_H +#define EGG_CAP_TEXTURE_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggCpuTexture.h b/include/egg/gfx/eggCpuTexture.h new file mode 100644 index 00000000..61de3178 --- /dev/null +++ b/include/egg/gfx/eggCpuTexture.h @@ -0,0 +1,6 @@ +#ifndef EGG_CPU_TEXTURE_H +#define EGG_CPU_TEXTURE_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggDrawPathBase.h b/include/egg/gfx/eggDrawPathBase.h new file mode 100644 index 00000000..536864b3 --- /dev/null +++ b/include/egg/gfx/eggDrawPathBase.h @@ -0,0 +1,6 @@ +#ifndef EGG_DRAW_PATH_BASE_H +#define EGG_DRAW_PATH_BASE_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggDrawPathDOF.h b/include/egg/gfx/eggDrawPathDOF.h new file mode 100644 index 00000000..054464d1 --- /dev/null +++ b/include/egg/gfx/eggDrawPathDOF.h @@ -0,0 +1,6 @@ +#ifndef EGG_DRAW_PATH_DOF_H +#define EGG_DRAW_PATH_DOF_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggDrawPathUnk1.h b/include/egg/gfx/eggDrawPathUnk1.h new file mode 100644 index 00000000..4b2c3cc7 --- /dev/null +++ b/include/egg/gfx/eggDrawPathUnk1.h @@ -0,0 +1,6 @@ +#ifndef EGG_DRAW_PATH_UNK1_H +#define EGG_DRAW_PATH_UNK1_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggDrawPathUnk2.h b/include/egg/gfx/eggDrawPathUnk2.h new file mode 100644 index 00000000..3b04c908 --- /dev/null +++ b/include/egg/gfx/eggDrawPathUnk2.h @@ -0,0 +1,6 @@ +#ifndef EGG_DRAW_PATH_UNK2_H +#define EGG_DRAW_PATH_UNK2_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggFrustum.h b/include/egg/gfx/eggFrustum.h index 92c8579f..fce9a28d 100644 --- a/include/egg/gfx/eggFrustum.h +++ b/include/egg/gfx/eggFrustum.h @@ -9,8 +9,12 @@ namespace EGG { // TODO: Fill out more class Frustum { public: - enum CanvasMode {}; - enum ProjectionType { PROJ_ORTHO, PROJ_PERSP }; + enum CanvasMode { + }; + enum ProjectionType { + PROJ_ORTHO, + PROJ_PERSP + }; private: /* 0x00 */ ProjectionType mProjType; diff --git a/include/egg/gfx/eggG3DUtility.h b/include/egg/gfx/eggG3DUtility.h new file mode 100644 index 00000000..994b7376 --- /dev/null +++ b/include/egg/gfx/eggG3DUtility.h @@ -0,0 +1,6 @@ +#ifndef EGG_G3D_UTILITY_H +#define EGG_G3D_UTILITY_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggGXUtility.h b/include/egg/gfx/eggGXUtility.h new file mode 100644 index 00000000..d36dfff1 --- /dev/null +++ b/include/egg/gfx/eggGXUtility.h @@ -0,0 +1,6 @@ +#ifndef EGG_GX_UTILITY_H +#define EGG_GX_UTILITY_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggGlobalDrawState.h b/include/egg/gfx/eggGlobalDrawState.h new file mode 100644 index 00000000..36e5203a --- /dev/null +++ b/include/egg/gfx/eggGlobalDrawState.h @@ -0,0 +1,6 @@ +#ifndef EGG_GLOBAL_DRAW_STATE_H +#define EGG_GLOBAL_DRAW_STATE_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggIScnProc.h b/include/egg/gfx/eggIScnProc.h new file mode 100644 index 00000000..c7ef3ce2 --- /dev/null +++ b/include/egg/gfx/eggIScnProc.h @@ -0,0 +1,6 @@ +#ifndef EGG_ISCNPROC_H +#define EGG_ISCNPROC_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggLight.h b/include/egg/gfx/eggLight.h index f48991ba..cb4741ae 100644 --- a/include/egg/gfx/eggLight.h +++ b/include/egg/gfx/eggLight.h @@ -1,6 +1,7 @@ #ifndef EGG_LIGHT_H #define EGG_LIGHT_H +#include #include #include diff --git a/include/egg/gfx/eggLightTexture.h b/include/egg/gfx/eggLightTexture.h new file mode 100644 index 00000000..263fbaac --- /dev/null +++ b/include/egg/gfx/eggLightTexture.h @@ -0,0 +1,6 @@ +#ifndef EGG_LIGHT_TEXTURE_H +#define EGG_LIGHT_TEXTURE_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggLightTextureMgr.h b/include/egg/gfx/eggLightTextureMgr.h new file mode 100644 index 00000000..4acca7ce --- /dev/null +++ b/include/egg/gfx/eggLightTextureMgr.h @@ -0,0 +1,6 @@ +#ifndef EGG_LIGHT_TEXTURE_MGR_H +#define EGG_LIGHT_TEXTURE_MGR_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggModelEx.h b/include/egg/gfx/eggModelEx.h new file mode 100644 index 00000000..9fc2283b --- /dev/null +++ b/include/egg/gfx/eggModelEx.h @@ -0,0 +1,6 @@ +#ifndef EGG_MODEL_EX_H +#define EGG_MODEL_EX_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggPalette.h b/include/egg/gfx/eggPalette.h new file mode 100644 index 00000000..a7677d52 --- /dev/null +++ b/include/egg/gfx/eggPalette.h @@ -0,0 +1,6 @@ +#ifndef EGG_PALETTE_H +#define EGG_PALETTE_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggPostEffectBase.h b/include/egg/gfx/eggPostEffectBase.h new file mode 100644 index 00000000..2c7fa0b9 --- /dev/null +++ b/include/egg/gfx/eggPostEffectBase.h @@ -0,0 +1,6 @@ +#ifndef EGG_POST_EFFECT_BASE_H +#define EGG_POST_EFFECT_BASE_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggPostEffectBlur.h b/include/egg/gfx/eggPostEffectBlur.h new file mode 100644 index 00000000..61133991 --- /dev/null +++ b/include/egg/gfx/eggPostEffectBlur.h @@ -0,0 +1,6 @@ +#ifndef EGG_POST_EFFECT_BLUR_H +#define EGG_POST_EFFECT_BLUR_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggPostEffectMask.h b/include/egg/gfx/eggPostEffectMask.h new file mode 100644 index 00000000..5af4ee11 --- /dev/null +++ b/include/egg/gfx/eggPostEffectMask.h @@ -0,0 +1,6 @@ +#ifndef EGG_POST_EFFECT_MASK_H +#define EGG_POST_EFFECT_MASK_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggPostEffectMaskDOF.h b/include/egg/gfx/eggPostEffectMaskDOF.h new file mode 100644 index 00000000..cf6398f6 --- /dev/null +++ b/include/egg/gfx/eggPostEffectMaskDOF.h @@ -0,0 +1,6 @@ +#ifndef EGG_POST_EFFECT_MASK_DOF_H +#define EGG_POST_EFFECT_MASK_DOF_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggPostEffectSimple.h b/include/egg/gfx/eggPostEffectSimple.h new file mode 100644 index 00000000..c0053367 --- /dev/null +++ b/include/egg/gfx/eggPostEffectSimple.h @@ -0,0 +1,6 @@ +#ifndef EGG_POST_EFFECT_SIMPLE_H +#define EGG_POST_EFFECT_SIMPLE_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggPostEffectUnk1.h b/include/egg/gfx/eggPostEffectUnk1.h new file mode 100644 index 00000000..24b1df6e --- /dev/null +++ b/include/egg/gfx/eggPostEffectUnk1.h @@ -0,0 +1,6 @@ +#ifndef EGG_POST_EFFECT_UNK1_H +#define EGG_POST_EFFECT_UNK1_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggPostEffectUnk2.h b/include/egg/gfx/eggPostEffectUnk2.h new file mode 100644 index 00000000..2e324f7a --- /dev/null +++ b/include/egg/gfx/eggPostEffectUnk2.h @@ -0,0 +1,6 @@ +#ifndef EGG_POST_EFFECT_UNK2_H +#define EGG_POST_EFFECT_UNK2_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggScreen.h b/include/egg/gfx/eggScreen.h index e5432150..0e18bd29 100644 --- a/include/egg/gfx/eggScreen.h +++ b/include/egg/gfx/eggScreen.h @@ -21,7 +21,13 @@ public: u8 TODO_0x3C[0x88 - 0x3C]; - enum TVMode { TV_MODE_1, TV_MODE_2, TV_MODE_3, TV_MODE_4, TV_MODE_MAX }; + enum TVMode { + TV_MODE_1, + TV_MODE_2, + TV_MODE_3, + TV_MODE_4, + TV_MODE_MAX + }; struct TVModeInfo { TVModeInfo() {} diff --git a/include/egg/gfx/eggScreenEffectBase.h b/include/egg/gfx/eggScreenEffectBase.h new file mode 100644 index 00000000..447b328d --- /dev/null +++ b/include/egg/gfx/eggScreenEffectBase.h @@ -0,0 +1,6 @@ +#ifndef EGG_SCREEN_EFFECT_BASE_H +#define EGG_SCREEN_EFFECT_BASE_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggScreenEffectBlur.h b/include/egg/gfx/eggScreenEffectBlur.h new file mode 100644 index 00000000..18f33154 --- /dev/null +++ b/include/egg/gfx/eggScreenEffectBlur.h @@ -0,0 +1,6 @@ +#ifndef EGG_SCREEN_EFFECT_BLUR_H +#define EGG_SCREEN_EFFECT_BLUR_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggStateEfb.h b/include/egg/gfx/eggStateEfb.h new file mode 100644 index 00000000..5590f9c7 --- /dev/null +++ b/include/egg/gfx/eggStateEfb.h @@ -0,0 +1,6 @@ +#ifndef EGG_STATE_EFB_H +#define EGG_STATE_EFB_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggTextureBuffer.h b/include/egg/gfx/eggTextureBuffer.h new file mode 100644 index 00000000..bf648ebb --- /dev/null +++ b/include/egg/gfx/eggTextureBuffer.h @@ -0,0 +1,6 @@ +#ifndef EGG_TEXTURE_BUFFER_H +#define EGG_TEXTURE_BUFFER_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggUnk1.h b/include/egg/gfx/eggUnk1.h new file mode 100644 index 00000000..1d3f32a0 --- /dev/null +++ b/include/egg/gfx/eggUnk1.h @@ -0,0 +1,6 @@ +#ifndef EGG_UNK_H +#define EGG_UNK_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/egg/math/eggMath.h b/include/egg/math/eggMath.h index d608e4a0..ebb8ec9b 100644 --- a/include/egg/math/eggMath.h +++ b/include/egg/math/eggMath.h @@ -1,8 +1,8 @@ #ifndef EGG_MATH_H #define EGG_MATH_H -#include #include +#include namespace EGG { @@ -32,7 +32,11 @@ public: } static T abs(T t) { - return t > 0 ? t : -t; + return t > (T)0 ? t : -t; + } + + static T zero() { + return (T)0; } static T sqrt(T); diff --git a/include/egg/math/eggMatrix.h b/include/egg/math/eggMatrix.h index 81acd6c3..f527f74f 100644 --- a/include/egg/math/eggMatrix.h +++ b/include/egg/math/eggMatrix.h @@ -3,16 +3,15 @@ #include "egg/math/eggQuat.h" #include "egg/math/eggVector.h" + #include namespace EGG { struct Matrix34f { Matrix34f() {} - /* 8049acd0 */ Matrix34f(f32 xx, f32 xy, f32 xz, f32 xw, f32 yx, f32 yy, f32 yz, f32 yw, f32 zx, f32 zy, f32 zz, f32 zw); - ////////////////////////////////////////////////////////////////////////////// f32 operator()(int i, int j) const { return m[i][j]; } @@ -26,71 +25,76 @@ struct Matrix34f { return arr[i]; } - /* */ void rotateBaseX(Vector3f &, Matrix34f &); - /* */ void rotateVectorChange(Vector3f &, Vector3f &, Matrix34f &); - /* 8049ac70 */ void inverseTo(Matrix34f &to) const; - /* 8049ac80 */ void inverseTransposeTo(Matrix34f &to) const; - /* 8049ac90 */ void makeIdentity(); - /* */ void makeSRT(const Vector3f &s, const Vector3f &r, const Vector3f &t); - /* */ void makeRT(const Vector3f &r, const Vector3f &t); - /* */ void makeR(const Vector3f &r); - /* */ void makeST(const Vector3f &s, const Vector3f &t); - /* */ void makeSQT(const Vector3f &s, const Quatf &q, const Vector3f &t); - /* */ void makeSQ(const Vector3f &, const Quatf &); - /* 8049ad20 */ void makeQT(const Quatf &, const Vector3f &); - /* 8049ade0 */ void makeQ(const Quatf &); - /* */ void makeS(const Vector3f &s); - /* */ void makeT(const Vector3f &t); - /* 8049ae90 */ void fromQuat(const Quatf &q); - /* 8049af40 */ void toQuat(Quatf &q) const; - /* 8049b250 */ void slerpTo(const Matrix34f &, Matrix34f &, f32) const; - /* */ void copyTo16(f32 *pf) const; - /* 8049b2d0 */ void setAxisRotation(const Vector3f &, f32); - /* */ Vector3f multVector(const Vector3f &vec) const; - /* 8049b310 */ void loadPosMtx(u32); - /* */ void loadNrmMtx(u32 nrmMtxId); - /* 8049b320 */ void multiplyTo(const Matrix34f &m2, Matrix34f &to) const; - /* */ void dump(); + void rotateBaseX(Vector3f &, Matrix34f &); + void rotateVectorChange(Vector3f &, Vector3f &, Matrix34f &); + void inverseTo(Matrix34f &to) const; + void inverseTransposeTo(Matrix34f &to) const; + void makeIdentity(); + void makeSRT(const Vector3f &s, const Vector3f &r, const Vector3f &t); + void makeRT(const Vector3f &r, const Vector3f &t); + void makeR(const Vector3f &r); + void makeST(const Vector3f &s, const Vector3f &t); + void makeSQT(const Vector3f &s, const Quatf &q, const Vector3f &t); + void makeSQ(const Vector3f &, const Quatf &); + void makeQT(const Quatf &, const Vector3f &); + void makeQ(const Quatf &); + void makeS(const Vector3f &s); + void makeT(const Vector3f &t); + void fromQuat(const Quatf &q); + void toQuat(Quatf &q) const; + void slerpTo(const Matrix34f &, Matrix34f &, f32) const; + void copyTo16(f32 *pf) const; + void setAxisRotation(const Vector3f &, f32); + Vector3f multVector(const Vector3f &vec) const; + void loadPosMtx(u32); + void loadNrmMtx(u32 nrmMtxId); + void multiplyTo(const Matrix34f &m2, Matrix34f &to) const; + void dump(); - ////////////////////////////////////////////////////////////////////////////// public: void concat(const Matrix34f &, Matrix34f &) const; - void copyFrom(const Matrix34f &other); void rotate(const Vector3f &rpy) const; void multVectorTo(const Vector3f &from, Vector3f &to) const; void transposeTo(Matrix34f &to) const; + void copyFrom(const Matrix34f &other) { + for (int i = 0; i < 12; i++) { + (*this)(i) = other(i); + } + } void setBase(int idx, const Vector3f &b) { - m[0][idx] = b.x; - m[1][idx] = b.y; - m[2][idx] = b.z; + (*this)(0, idx) = b.x; + (*this)(1, idx) = b.y; + (*this)(2, idx) = b.z; } + void getBase(int idx, Vector3f &b) const { - b.x = m[0][idx]; - b.y = m[1][idx]; - b.z = m[2][idx]; + b(0) = (*this)(0, idx); + b(1) = (*this)(1, idx); + b(2) = (*this)(2, idx); } + void setTranslation(const Vector3f &t) { setBase(3, t); } + void getTranslation(Vector3f &t) const { getBase(3, t); } + void makeZero() { for (int i = 0; i < 12; i++) { arr[i] = 0.0f; } } - ////////////////////////////////////////////////////////////////////////////// public: union { f32 m[3][4]; f32 arr[12]; }; - ////////////////////////////////////////////////////////////////////////////// public: - /* 80674c00 */ static Matrix34f ident; + static Matrix34f ident; }; } // namespace EGG diff --git a/include/egg/math/eggQuat.h b/include/egg/math/eggQuat.h index 079de39a..8d0368ea 100644 --- a/include/egg/math/eggQuat.h +++ b/include/egg/math/eggQuat.h @@ -2,6 +2,7 @@ #define EGG_QUAT_H #include "egg/math/eggVector.h" + #include namespace EGG { diff --git a/include/egg/math/eggVector.h b/include/egg/math/eggVector.h index 43d340dd..78620eb2 100644 --- a/include/egg/math/eggVector.h +++ b/include/egg/math/eggVector.h @@ -3,75 +3,91 @@ #include "MSL_C/float.h" #include "egg/math/eggMath.h" + #include #include namespace EGG { struct Vector3f : public nw4r::math::VEC3 { - Vector3f() {} // __ct__Q23EGG8Vector3fFv - Vector3f(f32 fx, f32 fy, f32 fz) : VEC3(fx, fy, fz) {} // __ct__Q23EGG8Vector3fFfff + // __ct__Q23EGG8Vector3fFv + Vector3f() : nw4r::math::VEC3() {} + + // __ct__Q23EGG8Vector3fFfff + Vector3f(f32 fx, f32 fy, f32 fz) : VEC3(fx, fy, fz) {} // ~Vector3f() {} - f32 &operator()(int i) { // __cl__Q23EGG8Vector3fFi + // __cl__Q23EGG8Vector3fFi + f32 &operator()(int i) { return ((f32 *)this)[i]; } - Vector3f operator*(f32 f) const { // __ml__Q23EGG8Vector3fCFf + + // __ml__Q23EGG8Vector3fCFf + Vector3f operator*(f32 f) const { return Vector3f(x * f, y * f, z * f); } + friend Vector3f operator*(f32 f, const Vector3f &v) { return v.operator*(f); } - Vector3f operator+(const Vector3f &v) { // __pl__Q23EGG8Vector3fCFRCQ23EGG8Vector3f + // __pl__Q23EGG8Vector3fCFRCQ23EGG8Vector3f + Vector3f operator+(const Vector3f &v) { return Vector3f(x + v.x, y + v.y, z + v.z); } - Vector3f &operator+=(const Vector3f &v) { // __apl__Q23EGG8Vector3fFRCQ23EGG8Vector3f + // __apl__Q23EGG8Vector3fFRCQ23EGG8Vector3f + Vector3f &operator+=(const Vector3f &v) { x += v.x; y += v.y; z += v.z; return *this; } - Vector3f operator-() const { // __mi__Q23EGG8Vector3fCFv - return Vector3f(-1.0f * x, -1.0f * y, -1.0f * z); + // __mi__Q23EGG8Vector3fCFv + Vector3f operator-() const { + f32 z = this->z; + f32 y = this->y; + f32 x = this->x; + return Vector3f(-x, -y, -z); } - Vector3f operator-(const Vector3f &v) { // __mi__Q23EGG8Vector3fCFRCQ23EGG8Vector3f + // __mi__Q23EGG8Vector3fCFRCQ23EGG8Vector3f + Vector3f operator-(const Vector3f &v) { return Vector3f(x - v.x, y - v.y, z - v.z); } - Vector3f &operator-=(const Vector3f &v) { // __ami__Q23EGG8Vector3fFRCQ23EGG8Vector3f + // __ami__Q23EGG8Vector3fFRCQ23EGG8Vector3f + Vector3f &operator-=(const Vector3f &v) { x -= v.x; y -= v.y; z -= v.z; return *this; } - Vector3f &operator*=(f32 f) { // __amu__Q23EGG8Vector3fFf + // __amu__Q23EGG8Vector3fFf + Vector3f &operator*=(f32 f) { multScalar(f); return *this; } - Vector3f operator/(f32 f) const { // __dv__Q23EGG8Vector3fCFf + // __dv__Q23EGG8Vector3fCFf + Vector3f operator/(f32 f) const { return Vector3f(x / f, y / f, z / f); } - Vector3f &operator/=(f32 f) { // __adv__Q23EGG8Vector3fCFf // assumed + // __adv__Q23EGG8Vector3fCFf // assumed + Vector3f &operator/=(f32 f) { divScalar(f); return *this; } - bool operator!=(const Vector3f &v) { // __ne__Q23EGG8Vector3fCFRCQ23EGG8Vector3f + // __ne__Q23EGG8Vector3fCFRCQ23EGG8Vector3f + bool operator!=(const Vector3f &v) { return x != v.x || y != v.y || z != v.z; } - /* 8049bcc0 */ f32 normalise(); - /* 8049bd50 */ f32 setLength(const Vector3f &src, f32 len); - /* 8049be10 */ f32 setLength(f32 len); - void multScalar(f32 f) { x *= f; y *= f; @@ -80,11 +96,14 @@ struct Vector3f : public nw4r::math::VEC3 { void divScalar(f32 f) { multScalar(1.0f / f); } - f32 dot(const Vector3f &v) const { // dot__Q23EGG8Vector3fCFRCQ23EGG8Vector3f + + // dot__Q23EGG8Vector3fCFRCQ23EGG8Vector3f + f32 dot(const Vector3f &v) const { return x * v.x + y * v.y + z * v.z; } - Vector3f cross(const Vector3f &b) const { // cross__Q23EGG8Vector3fCFRCQ23EGG8Vector3f + // cross__Q23EGG8Vector3fCFRCQ23EGG8Vector3f + Vector3f cross(const Vector3f &b) const { f32 _x = (y * b.z) - (z * b.y); f32 _y = (z * b.x) - (x * b.z); f32 _z = (x * b.y) - (y * b.x); @@ -102,25 +121,32 @@ struct Vector3f : public nw4r::math::VEC3 { z = fz; } - /* 80674c30 */ static const Vector3f zero; - /* 80674c3c */ static const Vector3f ex; - /* 80674c48 */ static const Vector3f ey; - /* 80674c54 */ static const Vector3f ez; + f32 normalise(); + f32 setLength(const Vector3f &src, f32 len); + f32 setLength(f32 len); + + static const Vector3f zero; + static const Vector3f ex; + static const Vector3f ey; + static const Vector3f ez; }; struct Vector2f : nw4r::math::VEC2 { - inline Vector2f() {} + Vector2f() {} Vector2f(f32 fx, f32 fy) : VEC2(fx, fy) {} - inline ~Vector2f() {} + ~Vector2f() {} public: - /* 805767c0 */ static const Vector2f zero; - /* 805767c8 */ static const Vector2f ex; - /* 805767d0 */ static const Vector2f ey; + static const Vector2f zero; + static const Vector2f ex; + static const Vector2f ey; Vector2f operator-(const Vector2f &v) { return Vector2f(x - v.x, y - v.y); } + f32 squaredLength() const { + return (x * x + y * y); + } }; struct Vector3s { @@ -133,10 +159,10 @@ public: y = sy; z = sz; } - /* 805767d8 */ static const Vector3s zero; - /* 805767e0 */ static const Vector3s ex; - /* 805767e8 */ static const Vector3s ey; - /* 805767f0 */ static const Vector3s ez; + static const Vector3s zero; + static const Vector3s ex; + static const Vector3s ey; + static const Vector3s ez; }; } // namespace EGG diff --git a/include/egg/prim/eggAssert.h b/include/egg/prim/eggAssert.h index e44e1e7b..2d04cfe0 100644 --- a/include/egg/prim/eggAssert.h +++ b/include/egg/prim/eggAssert.h @@ -11,15 +11,15 @@ namespace Assert { typedef void (*AssertCallback)(); -/* 8049bf90 */ void wait(u32 time); -/* 8049c010 */ void system_vreport(const char *str, va_list list); -/* 8049c010 */ void system_report(const char *str, ...); -/* 8049c0a0 */ s32 getPeriodPos(const char *); -/* 8049c100 */ char *getMapSymbol(); -/* 8049c150 */ bool isOutsideMEM1(u32 addr); -/* 8049c180 */ AssertCallback setAssertCallback(AssertCallback cb); -/* 8049c190 */ void system_halt(const char *file, u32 line, const char *msg, va_list list); -/* 8049c530 */ void assert(const char *file, u32 line, const char *msg, ...); +void wait(u32 time); +void system_vreport(const char *str, va_list list); +void system_report(const char *str, ...); +s32 getPeriodPos(const char *); +char *getMapSymbol(); +bool isOutsideMEM1(u32 addr); +AssertCallback setAssertCallback(AssertCallback cb); +void system_halt(const char *file, u32 line, const char *msg, va_list list); +void assert(const char *file, u32 line, const char *msg, ...); } // namespace Assert diff --git a/include/egg/prim/eggBinary.h b/include/egg/prim/eggBinary.h index 6f127955..129706f2 100644 --- a/include/egg/prim/eggBinary.h +++ b/include/egg/prim/eggBinary.h @@ -1,6 +1,8 @@ #ifndef EGG_BINARY_H #define EGG_BINARY_H +#include + template class IBinary { public: diff --git a/include/egg/prim/eggBitFlag.h b/include/egg/prim/eggBitFlag.h index f9a9a4ae..c75d1bfa 100644 --- a/include/egg/prim/eggBitFlag.h +++ b/include/egg/prim/eggBitFlag.h @@ -11,53 +11,53 @@ template class TBitFlag { public: T value; - inline void makeAllZero() { + void makeAllZero() { value = T(); } - inline TBitFlag() {} - inline TBitFlag(T value): value(value) {} - inline T makeMask(u8 bit) const { + TBitFlag() {} + TBitFlag(T value) : value(value) {} + T makeMask(u8 bit) const { return 1 << bit; } - inline bool on(T mask) const { - return value & mask; + bool on(T mask) const { + return (value & mask); } - inline bool off(T mask) const { + bool off(T mask) const { return !(value & mask); } - inline void set(T mask) { + void set(T mask) { value |= mask; } - inline void reset(T mask) { + void reset(T mask) { value &= ~mask; } - inline bool onBit(u8 bit) const { + bool onBit(u8 bit) const { return on(makeMask(bit)); } - inline bool offBit(u8 bit) const { + bool offBit(u8 bit) const { return off(makeMask(bit)); } - inline void setBit(u8 bit) { + void setBit(u8 bit) { set(makeMask(bit)); } - inline void resetBit(u8 bit) { + void resetBit(u8 bit) { reset(makeMask(bit)); } - inline void toggleBit(u8 bit) { + void toggleBit(u8 bit) { if (!onBit(bit)) { setBit(bit); } else { resetBit(bit); } } - inline void changeBit(u8 bit, bool b) { + void changeBit(u8 bit, bool b) { if (b) { setBit(bit); } else { resetBit(bit); } } - inline T getDirect() { + T getDirect() const { return value; } }; diff --git a/include/egg/prim/eggBuffer.h b/include/egg/prim/eggBuffer.h index c757d2af..7f0f622b 100644 --- a/include/egg/prim/eggBuffer.h +++ b/include/egg/prim/eggBuffer.h @@ -2,6 +2,7 @@ #define EGG_BUFFER_H #include "egg/core/eggHeap.h" + #include namespace EGG { @@ -16,19 +17,8 @@ public: mBuffer = nullptr; } } - /* vt 0x0C */ virtual void allocate(int n, int) { - mSize = n; - mBuffer = new T[n]; - onAllocate(nullptr); - } - /* vt 0x10 */ virtual void allocate(int n, Heap *heap, int) { - mSize = n; - if (heap == nullptr) { - heap = Heap::sCurrentHeap; - } - mBuffer = new (heap, 4) T[mSize]; - onAllocate(heap); - } + /* vt 0x0C */ virtual void allocate(int n, int); + /* vt 0x10 */ virtual void allocate(int n, Heap *heap, int); /* vt 0x14 */ virtual void onAllocate(Heap *) { return; } @@ -60,6 +50,23 @@ public: } }; +template +void TBuffer::allocate(int n, int) { + mSize = n; + mBuffer = new T[n]; + onAllocate(nullptr); +} + +template +void TBuffer::allocate(int n, Heap *heap, int) { + mSize = n; + if (heap == nullptr) { + heap = Heap::sCurrentHeap; + } + mBuffer = new (heap, 4) T[mSize]; + onAllocate(heap); +} + } // namespace EGG #endif diff --git a/include/egg/util/eggException.h b/include/egg/util/eggException.h new file mode 100644 index 00000000..c2e21809 --- /dev/null +++ b/include/egg/util/eggException.h @@ -0,0 +1,6 @@ +#ifndef EGG_EXCEPTION_H +#define EGG_EXCEPTION_H + +namespace EGG {} // namespace EGG + +#endif diff --git a/include/m/m_dvd.h b/include/m/m_dvd.h index 8045f220..9035398f 100644 --- a/include/m/m_dvd.h +++ b/include/m/m_dvd.h @@ -2,8 +2,8 @@ #define M_DVD_H #include -#include #include +#include #include #include @@ -19,9 +19,7 @@ class TUncompressInfo_Base_c { public: TUncompressInfo_Base_c(u8 type, const char *extension) : mType(type), mExtension(extension) {} virtual ~TUncompressInfo_Base_c() {} - virtual EGG::StreamDecomp *Construct() const { - return nullptr; - } + virtual EGG::StreamDecomp *Construct() const { return nullptr; } virtual void Destruct() const {} u8 mType; @@ -32,9 +30,7 @@ template class TUncompressInfo_c : public TUncompressInfo_Base_c { public: TUncompressInfo_c(u8 type, const char *extension) : TUncompressInfo_Base_c(type, extension) {} - virtual T *Construct() const { - return new (somePtr) T(); - } + virtual T *Construct() const { return new (somePtr) T(); } virtual void Destruct() const {} }; @@ -172,13 +168,9 @@ public: virtual void *run() override; - OSThread *getMyOsThread() { - return mOSThread; - } + OSThread *getMyOsThread() { return mOSThread; } - void setThreadHeap(EGG::Heap *heap) { - setThreadCurrentHeap(heap); - } + void setThreadHeap(EGG::Heap *heap) { setThreadCurrentHeap(heap); } static void *run(mDvd_param_c *dvd); }; diff --git a/include/rvl/CX/cx.h b/include/rvl/CX/cx.h index 4d5b87d2..1c4d0e3e 100644 --- a/include/rvl/CX/cx.h +++ b/include/rvl/CX/cx.h @@ -9,6 +9,14 @@ extern "C" { #endif +enum CXReadResult { + CX_READ_ERR_4 = -4, + CX_READ_ERR_3 = -3, + CX_READ_ERR_2 = -2, + CX_READ_ERR_1 = -1, + CX_READ_OK = 0, +}; + typedef struct CXUncompContextLZ { u8 _[0x18]; } CXUncompContextLZ; @@ -40,19 +48,18 @@ typedef struct CXUncompContextLRC { u8 _[0x902C]; } CXUncompContextLRC; -// TODO(Zeldex) : Fix Params -/* 803cee90 */ void CXInitUncompContextRL(); -/* 803ceec0 */ void CXInitUncompContextLZ(); -/* 803cef00 */ void CXReadUncompRL(); -/* 803cf1b0 */ void CXReadUncompLZ(); -/* 803cf570 */ void CXInitUncompContextLH(); -/* 803cf5b0 */ void CXReadUncompLH(); +/* 803cee90 */ void CXInitUncompContextRL(CXUncompContextRL *); +/* 803ceec0 */ void CXInitUncompContextLZ(CXUncompContextLZ *); +/* 803cef00 */ s32 CXReadUncompRL(CXUncompContextRL *, const void *, u32); +/* 803cf1b0 */ s32 CXReadUncompLZ(CXUncompContextLZ *, const void *, u32); +/* 803cf570 */ void CXInitUncompContextLH(CXUncompContextLH *); +/* 803cf5b0 */ s32 CXReadUncompLH(CXUncompContextLH *, const void *, u32); /* 803cfda0 */ void RCAddCount_(); /* 803cff90 */ void RCSearch_(); /* 803d0030 */ void RCGetData_(); -/* 803d0140 */ void CXInitUncompContextLRC(); -/* 803d0390 */ void CXReadUncompLRC(); -/* 803d0790 */ void CXGetUncompressedSize(); +/* 803d0140 */ void CXInitUncompContextLRC(CXUncompContextLRC *); +/* 803d0390 */ s32 CXReadUncompLRC(CXUncompContextLRC *, const void *, u32); +/* 803d0790 */ u32 CXGetUncompressedSize(const void *); /* 803d07d0 */ void CXUncompressLZ(); /* 803d0920 */ void CXiLHVerifyTable(); diff --git a/include/rvl/KPAD.h b/include/rvl/KPAD.h new file mode 100644 index 00000000..8286be8c --- /dev/null +++ b/include/rvl/KPAD.h @@ -0,0 +1,12 @@ +#ifndef RVL_SDK_PUBLIC_KPAD_H +#define RVL_SDK_PUBLIC_KPAD_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/rvl/KPAD/KPAD.h b/include/rvl/KPAD/KPAD.h index 8f46eb08..6eac5f21 100644 --- a/include/rvl/KPAD/KPAD.h +++ b/include/rvl/KPAD/KPAD.h @@ -6,8 +6,22 @@ extern "C" { #endif typedef struct { + // TODO } KPADStatus; +typedef void (*KPADConnectCallback)(s32, s32); +// TODO: Create Proper Headers +void KPADInitEx(void * /* UNKTYPE */, u32); + +s32 KPADReadEx(s32 chan, UNKTYPE *status, s32, s32 *); + +void KPADSetConnectCallback(u32, KPADConnectCallback); + +void KPADSetPosParam(u32, f32, f32); +void KPADSetHoriParam(u32, f32, f32); +void KPADSetDistParam(u32, f32, f32); +void KPADSetAccParam(u32, f32, f32); + #ifdef __cplusplus } #endif diff --git a/include/rvl/OS/OSTime.h b/include/rvl/OS/OSTime.h index 9628edc4..1d1310d2 100644 --- a/include/rvl/OS/OSTime.h +++ b/include/rvl/OS/OSTime.h @@ -6,6 +6,9 @@ extern "C" { #endif +typedef s64 OSTime; +typedef u32 OSTick; + // Time base frequency = 1/4 bus clock #define OS_TIME_SPEED (OS_BUS_CLOCK_SPEED / 4) @@ -34,14 +37,14 @@ typedef struct OSCalendarTime { s32 usec; // at 0x24 } OSCalendarTime; -s64 OSGetTime(void); -s32 OSGetTick(void); +OSTime OSGetTime(void); +OSTick OSGetTick(void); -s64 __OSGetSystemTime(void); -s64 __OSTimeToSystemTime(s64 time); +OSTime __OSGetSystemTime(void); +OSTime __OSTimeToSystemTime(OSTime time); -void OSTicksToCalendarTime(s64 time, OSCalendarTime *cal); -s64 OSCalendarTimeToTicks(const OSCalendarTime *cal); +void OSTicksToCalendarTime(OSTime time, OSCalendarTime *cal); +OSTime OSCalendarTimeToTicks(const OSCalendarTime *cal); #ifdef __cplusplus } diff --git a/include/rvl/PAD/Pad.h b/include/rvl/PAD/Pad.h index d2f90312..9766355a 100644 --- a/include/rvl/PAD/Pad.h +++ b/include/rvl/PAD/Pad.h @@ -5,6 +5,9 @@ extern "C" { #endif +typedef struct { +} PADStatus; + extern u32 __PADSpec; BOOL __PADDisableRecalibration(BOOL); diff --git a/include/rvl/WPAD.h b/include/rvl/WPAD.h index f3cb5f35..8f63eb9e 100644 --- a/include/rvl/WPAD.h +++ b/include/rvl/WPAD.h @@ -5,6 +5,7 @@ extern "C" { #endif #include +#include #ifdef __cplusplus } diff --git a/include/rvl/WPAD/WPAD.h b/include/rvl/WPAD/WPAD.h index 271433bf..5154aadc 100644 --- a/include/rvl/WPAD/WPAD.h +++ b/include/rvl/WPAD/WPAD.h @@ -1,44 +1,627 @@ -#ifndef REVOSDK_WPAD_H -#define REVOSDK_WPAD_H +#ifndef RVL_SDK_WPAD_H +#define RVL_SDK_WPAD_H + +// From +// https://github.com/muff1n1634/wpad_11dec2009/blob/3c3aa5416d15ccc5867517d9ed4aaf6d25a70e9c/include/revolution/WPAD/WPAD.h + #include +#include +#include + +/******************************************************************************* + * macros + */ + +#define WPAD_MAX_DPD_OBJECTS 4 + +#define WPAD_MIN_DPD_SENS 1 +#define WPAD_MAX_DPD_SENS 5 + +/******************************************************************************* + * types + */ + #ifdef __cplusplus extern "C" { #endif -typedef void (*WPADCallback)(s32 chan, s32 result); +// for ease of use in ternaries +typedef s32 WPADResult; +enum WPADResult_et { + WPAD_ERR_OK = 0, -typedef enum { WPAD_CHAN_0, WPAD_CHAN_1, WPAD_CHAN_2, WPAD_CHAN_3, WPAD_MAX_CONTROLLERS } WPADChan; + WPAD_ERR_NO_CONTROLLER = -1, /* name known from asserts */ + WPAD_ERR_COMMUNICATION_ERROR = -2, // [RT3P54] has this as WPAD_ERR_BUSY + WPAD_ERR_3 = -3, // [RT3P54] has this as WPAD_ERR_TRANSFER + WPAD_ERR_INVALID = -4, /* name comes from [R89JEL] */ + // WPAD_ERR_5 = -5, /* unknown */ + // WPAD_ERR_6 = -6, /* unknown */ + WPAD_ERR_CORRUPTED = -7, /* name comes from [R89JEL] */ -typedef enum { - WPAD_RESULT_ERR_3 = -3, - WPAD_RESULT_ERR_2, - WPAD_RESULT_ERR_1, +#define WPAD_ESUCCESS WPAD_ERR_OK +#define WPAD_ENODEV WPAD_ERR_NO_CONTROLLER +#define WPAD_ECOMM WPAD_ERR_COMMUNICATION_ERROR +// #define WPAD_E3 +#define WPAD_EINVAL WPAD_ERR_INVALID - WPAD_RESULT_SUCCESS = 0, -} WPADResult; +/* maybe? i was scouring the internet for explanation and usage of this error + * macro, and it seems close enough + * + * it's not ENODATA, that's more like if you got no data, but here it's that we + * did get the data but it wasn't good + */ +#define WPAD_EBADE WPAD_ERR_CORRUPTED +// apparently enum vs literal is a thing. cool +#define WPAD_CESUCCESS (WPAD_ESUCCESS + 0) +#define WPAD_CENODEV (WPAD_ENODEV + 0) +#define WPAD_CECOMM (WPAD_ECOMM + 0) +#define WPAD_CERR_3 (WPAD_ERR_3 + 0) +#define WPAD_CEINVAL (WPAD_EINVAL + 0) +#define WPAD_CEBADE (WPAD_EBADE + 0) +}; -typedef struct { - u32 field_0x00; - u32 field_0x04; - u32 field_0x08; - u32 field_0x0C; - u32 field_0x10; - bool field_0x14; - bool field_0x15; - bool field_0x16; - bool field_0x17; -} WPADInfo; +typedef WUDLibStatus WPADLibStatus; +enum WPADLibStatus_et { + WPAD_LIB_STATUS_0 = WUD_LIB_STATUS_0, + WPAD_LIB_STATUS_1 = WUD_LIB_STATUS_1, + WPAD_LIB_STATUS_2 = WUD_LIB_STATUS_2, + WPAD_LIB_STATUS_3 = WUD_LIB_STATUS_3, + WPAD_LIB_STATUS_4 = WUD_LIB_STATUS_4, +}; -UNKTYPE WPADControlSpeaker(s32, UNKWORD, WPADCallback); -BOOL WPADCanSendStreamData(s32); -UNKWORD WPADSendStreamData(s32, UNKTYPE *, UNKWORD); +// for ease of use in for loops +typedef s32 WPADChannel; +enum WPADChannel_et { + WPAD_CHAN0, + WPAD_CHAN1, + WPAD_CHAN2, + WPAD_CHAN3, /* name known from asserts */ -s32 WPADProbe(s32 chan, u32 *type); -s32 WPADReadFaceData(s32 chan, void *dst, u32 size, u32 src, WPADCallback cb); -s32 WPADGetInfoAsync(s32 chan, WPADInfo *dst, WPADCallback cb); + WPAD_MAX_CONTROLLERS, /* name known from asserts */ + WPAD_CHAN_INVALID = -1, +}; + +typedef s32 WPADDeviceType; +enum WPADDeviceType_et { + WPAD_DEV_CORE = 0, + WPAD_DEV_FS = 1, + WPAD_DEV_CLASSIC = 2, /* name known from asserts, but not value */ + WPAD_DEV_BALANCE_CHECKER = 3, + WPAD_DEV_VSM = 4, + + WPAD_DEV_MOTION_PLUS = 5, + WPAD_DEV_MPLS_PT_FS = 6, + WPAD_DEV_MPLS_PT_CLASSIC = 7, + + WPAD_DEV_TRAIN = 16, + WPAD_DEV_GUITAR = 17, + WPAD_DEV_DRUM = 18, + WPAD_DEV_TAIKO = 19, + WPAD_DEV_TURNTABLE = 20, + + // seems to be like maybe general purpose non-specific device types + // maybe this was for testing or something? idk + WPAD_DEV_BULK_1 = 21, + WPAD_DEV_BULK_2 = 22, + WPAD_DEV_BULK_3 = 23, + WPAD_DEV_BULK_4 = 24, + WPAD_DEV_BULK_5 = 25, + WPAD_DEV_BULK_6 = 26, + WPAD_DEV_BULK_7 = 27, + WPAD_DEV_BULK_8 = 28, + + WPAD_DEV_MPLS_PT_UNKNOWN = 250, + + WPAD_DEV_251 = 251, + WPAD_DEV_252 = 252, // invalid device mode? + WPAD_DEV_NONE = + 253, // sort of like WPAD_ENODEV (see __wpadAbortInitExtension in WPADHIDParser.c) + // WPAD_DEV_254 = 254, /* unknown, doesn't seem to be used anywhere */ + WPAD_DEV_INITIALIZING = 255, // see __a1_20_status_report +}; + +typedef u32 WPADDataFormat; +enum WPADDataFormat_et { + // see WPADiSendSetReportType and __wpadFmt2Size + WPAD_FMT_CORE_BTN = 0, + WPAD_FMT_CORE_BTN_ACC = 1, + WPAD_FMT_CORE_BTN_ACC_DPD = 2, + + WPAD_FMT_FS_BTN = 3, + WPAD_FMT_FS_BTN_ACC = 4, + WPAD_FMT_FS_BTN_ACC_DPD = 5, + + WPAD_FMT_CLASSIC_BTN = 6, + WPAD_FMT_CLASSIC_BTN_ACC = 7, + WPAD_FMT_CLASSIC_BTN_ACC_DPD = 8, + + WPAD_FMT_BTN_ACC_DPD_EXTENDED = 9, + + // extensions + WPAD_FMT_TRAIN = 10, /* name known from asserts */ + WPAD_FMT_GUITAR = 11, /* name known from asserts */ + WPAD_FMT_BALANCE_CHECKER = 12, /* name known from asserts */ + WPAD_FMT_VSM = 13, /* name known from asserts */ + // WPAD_FMT_14 = 14, /* unknown */ + WPAD_FMT_DRUM = 15, /* name known from asserts */ + WPAD_FMT_MOTION_PLUS = 16, // see __wpadFmt2Size + WPAD_FMT_TAIKO = 17, /* name known from asserts */ + WPAD_FMT_TURNTABLE = 18, /* name known from asserts */ + WPAD_FMT_BULK = 19, /* name known from asserts */ +}; + +typedef s32 WPADDeviceMode; +enum WPADDeviceMode_et { + WPAD_DEV_MODE_NORMAL = 0, + + WPAD_DEV_MODE_CLASSIC_REDUCED = 1, + WPAD_DEV_MODE_CLASSIC_EXTENDED = 2, + WPAD_DEV_MODE_CLASSIC_STANDARD = 3, + + WPAD_DEV_MODE_MPLS_PT_MAIN = 4, + WPAD_DEV_MODE_MPLS_PT_FS = 5, + // WPAD_DEV_MODE_6 = 6, /* unknown */ + WPAD_DEV_MODE_MPLS_PT_CLASSIC = 7, +}; + +// names from wiiuse/wpad.h +typedef u16 WPADButton; +enum WPADButton_et { + // H..-AB12 ...+^v>< + /* NOTE: the bytes from the report are swapped when being placed into this + * format (see MAKE_BUTTON in WPADHIDParser.c) + */ + WPAD_BUTTON_LEFT = (1 << 0), + WPAD_BUTTON_RIGHT = (1 << 1), + WPAD_BUTTON_DOWN = (1 << 2), + WPAD_BUTTON_UP = (1 << 3), + WPAD_BUTTON_PLUS = (1 << 4), + // (1 << 5), + // (1 << 6), + // (1 << 7), + WPAD_BUTTON_2 = (1 << 8), + WPAD_BUTTON_1 = (1 << 9), + WPAD_BUTTON_B = (1 << 10), + WPAD_BUTTON_A = (1 << 11), + WPAD_BUTTON_MINUS = (1 << 12), + // (1 << 13), // WPAD_BUTTON_FS_Z + // (1 << 14), // WPAD_BUTTON_FS_C + WPAD_BUTTON_HOME = (1 << 15), + + WPAD_BUTTON_ALL = 0x9f1f +}; + +// names from wiiuse/wpad.h +typedef u16 WPADExtButton; +enum WPADExtButton_et { + // Nunchuk (fight stick?) + // .CZ..... ........ + /* NOTE: these bits are actually in the normal button variable, but are + * enumerated here because they are buttons for an extension + */ + WPAD_BUTTON_FS_Z = (1 << 13), + WPAD_BUTTON_FS_C = (1 << 14), + + WPAD_BUTTON_FS_ALL = 0x6000, + + // Classic Controller + // >vL-H+R. lBYAXr<^ + WPAD_BUTTON_CL_UP = (1 << 0), + WPAD_BUTTON_CL_LEFT = (1 << 1), + WPAD_BUTTON_CL_ZR = (1 << 2), + WPAD_BUTTON_CL_X = (1 << 3), + WPAD_BUTTON_CL_A = (1 << 4), + WPAD_BUTTON_CL_Y = (1 << 5), + WPAD_BUTTON_CL_B = (1 << 6), + WPAD_BUTTON_CL_ZL = (1 << 7), + // (1 << 8), + WPAD_BUTTON_CL_FULL_R = (1 << 9), + WPAD_BUTTON_CL_PLUS = (1 << 10), + WPAD_BUTTON_CL_HOME = (1 << 11), + WPAD_BUTTON_CL_MINUS = (1 << 12), + WPAD_BUTTON_CL_FULL_L = (1 << 13), + WPAD_BUTTON_CL_DOWN = (1 << 14), + WPAD_BUTTON_CL_RIGHT = (1 << 15), + + WPAD_BUTTON_CL_ALL = 0xfeff, + + // Shinkansen train controller + // shares the same format as the Classic Controller + // (see WPADiExcludeButton) + WPAD_BUTTON_TR_UP = WPAD_BUTTON_CL_UP, + WPAD_BUTTON_TR_LEFT = WPAD_BUTTON_CL_LEFT, + WPAD_BUTTON_TR_ZR = WPAD_BUTTON_CL_ZR, + WPAD_BUTTON_TR_X = WPAD_BUTTON_CL_X, + WPAD_BUTTON_TR_A = WPAD_BUTTON_CL_A, + WPAD_BUTTON_TR_Y = WPAD_BUTTON_CL_Y, + WPAD_BUTTON_TR_B = WPAD_BUTTON_CL_B, + WPAD_BUTTON_TR_ZL = WPAD_BUTTON_CL_ZL, + // = WPAD_BUTTON_CL_8, + WPAD_BUTTON_TR_FULL_R = WPAD_BUTTON_CL_FULL_R, + WPAD_BUTTON_TR_PLUS = WPAD_BUTTON_CL_PLUS, + WPAD_BUTTON_TR_HOME = WPAD_BUTTON_CL_HOME, + WPAD_BUTTON_TR_MINUS = WPAD_BUTTON_CL_MINUS, + WPAD_BUTTON_TR_FULL_L = WPAD_BUTTON_CL_FULL_L, + WPAD_BUTTON_TR_DOWN = WPAD_BUTTON_CL_DOWN, + WPAD_BUTTON_TR_RIGHT = WPAD_BUTTON_CL_RIGHT, + + WPAD_BUTTON_TR_ALL = WPAD_BUTTON_CL_ALL, +}; + +// WPADControlMotor +typedef u32 WPADMotorCommand; +enum WPADMotorCommand_et { + WPAD_MOTOR_STOP = 0, /* name known from asserts */ + WPAD_MOTOR_RUMBLE = 1, /* name known from asserts */ +}; + +// WPADControlSpeaker +typedef u32 WPADSpeakerCommand; +enum WPADSpeakerCommand_et { + WPAD_SPEAKER_DISABLE = 0, + WPAD_SPEAKER_ENABLE = 1, // might be ON? see HBMRemoteSpk.cpp + WPAD_SPEAKER_MUTE = 2, + WPAD_SPEAKER_UNMUTE = 3, + WPAD_SPEAKER_PLAY = 4, // figured out from HBM usage + + // does the same thing as ENABLE? unless i'm missing something + // not used so i don't know the context + WPAD_SPEAKER_CMD_05 = 5, +}; + +// WPADControlDpd +typedef u32 WPADDpdCommand; +enum WPADDpdCommand_et { + WPAD_DPD_DISABLE = 0x00, + + // the command here is actually the data format + WPAD_DPD_BASIC = 0x01, + WPAD_DPD_STANDARD = 0x03, + WPAD_DPD_EXTENDED = 0x05, +}; + +// WPADControlBLC +typedef u8 WPADBLCCommand; +enum WPADBLCCommand_et { + WPAD_BLC_DISABLE = 0x00, + WPAD_BLC_CMD_55 = 0x55, + + /* NOTE: maybe? the code on this case in WPADControlBLC seems to follow what + * WiiBrew describes as the initialization sequence after the generic one + * (https://wiibrew.org/wiki/Wii_Balance_Board#Wii_Initialisation_Sequence). + */ + WPAD_BLC_ENABLE = 0xaa, +}; + +// WPADMPStatus::stat +typedef u8 WPADMPStatusFlags; +enum WPADMPStatusFlags_et { + WPAD_MPLS_STATUS_DATA_VALID = (1 << 7), + WPAD_MPLS_STATUS_EXTENSION_DATA_VALID = (1 << 6), + + WPAD_MPLS_STATUS_YAW_SLOW_MODE = (1 << 3), + WPAD_MPLS_STATUS_PITCH_SLOW_MODE = (1 << 2), + WPAD_MPLS_STATUS_ROLL_SLOW_MODE = (1 << 1), + WPAD_MPLS_STATUS_EXTENSION_CONNECTED = (1 << 0), // just that it's present; not that it's actually being used +}; + +// WPADGetAccGravityUnit +typedef u32 WPADAccGravityUnitType; +enum WPADAccGravityUnitType_et { + WPAD_ACC_GRAVITY_UNIT_CORE, + WPAD_ACC_GRAVITY_UNIT_FS, +}; + +typedef WUDAllocFunc WPADAllocFunc; +typedef WUDFreeFunc WPADFreeFunc; + +typedef void WPADInitFunc(void); // see __wpadInitSub in WPAD.c + +typedef void WPADCallback(WPADChannel chan, WPADResult result); + +typedef void WPADSamplingCallback(WPADChannel chan); +typedef void WPADConnectCallback(WPADChannel chan, s32 result); +typedef void WPADExtensionCallback(WPADChannel chan, WPADDeviceType devType); + +typedef WUDSyncDeviceCallback WPADSimpleSyncCallback; + +// [SGLEA4]/GormitiDebug.elf:.debug_info::0x79f49 +typedef struct DPDObject { + s16 x; // size 0x02, offset 0x00 + s16 y; // size 0x02, offset 0x02 + u16 size; // size 0x02, offset 0x04 + u8 traceId; // size 0x01, offset 0x06 + // 1 byte padding +} DPDObject; // size 0x08 + +// TODO: get a specific source (name, game id) +// TODO: check library version of game that has this +// dwarfv1_megadump.txt:21551-21559 +typedef struct DPDObjEx { + s16 range_x1; // size 0x02, offset 0x00 + s16 range_y1; // size 0x02, offset 0x02 + s16 range_x2; // size 0x02, offset 0x04 + s16 range_y2; // size 0x02, offset 0x06 + u16 pixel; // size 0x02, offset 0x08 + s8 radius; // size 0x01, offset 0x0a + // 1 byte padding +} DPDObjEx; // size 0x0c + +// [SPQE7T]/ISpyD.elf:.debug_info::0xd675b +typedef struct WPADInfo { + BOOL dpd; // size 0x04, offset 0x00 + BOOL speaker; // size 0x04, offset 0x04 + BOOL attach; // size 0x04, offset 0x08 + BOOL lowBat; // size 0x04, offset 0x0c + BOOL nearempty; // size 0x04, offset 0x10 + u8 battery; // size 0x01, offset 0x14 + u8 led; // size 0x01, offset 0x15 + u8 protocol; // size 0x01, offset 0x16 + u8 firmware; // size 0x01, offset 0x17 +} WPADInfo; // size 0x18 + +// [SGLEA4]/GormitiDebug.elf:.debug_info::0x7ab19 +typedef struct WPADStatus { + WPADButton button; // size 0x02, offset 0x00 + s16 accX; // size 0x02, offset 0x02 + s16 accY; // size 0x02, offset 0x04 + s16 accZ; // size 0x02, offset 0x06 + DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // size 0x20, offset 0x08 + u8 dev; // size 0x01, offset 0x28 + s8 err; // size 0x01, offset 0x29 +} WPADStatus; // size 0x2a + +/* The following take their initial members from WPADStatus instead of including + * an instance of it. For ease of use? + */ + +// TODO: get a specific source (name, game id) +// TODO: check library version of game that has this +// dwarfv1_megadump.txt:21560-21570 +typedef struct WPADStatusEx { + WPADButton button; // size 0x02, offset 0x00 + s16 accX; // size 0x02, offset 0x02 + s16 accY; // size 0x02, offset 0x04 + s16 accZ; // size 0x02, offset 0x06 + DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // size 0x20, offset 0x08 + u8 dev; // size 0x01, offset 0x28 + s8 err; // size 0x01, offset 0x29 + + DPDObjEx exp[WPAD_MAX_DPD_OBJECTS]; // size 0x30, offset 0x2a +} WPADStatusEx; // size 0x5a + +// [SGLEA4]/GormitiDebug.elf:.debug_info::0x79e65 +typedef struct WPADFSStatus { + WPADButton button; // size 0x02, offset 0x00 + s16 accX; // size 0x02, offset 0x02 + s16 accY; // size 0x02, offset 0x04 + s16 accZ; // size 0x02, offset 0x06 + DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // size 0x20, offset 0x08 + u8 dev; // size 0x01, offset 0x28 + s8 err; // size 0x01, offset 0x29 + + s16 fsAccX; // size 0x02, offset 0x2a + s16 fsAccY; // size 0x02, offset 0x2c + s16 fsAccZ; // size 0x02, offset 0x2e + s8 fsStickX; // size 0x01, offset 0x30 + s8 fsStickY; // size 0x01, offset 0x31 +} WPADFSStatus; // size 0x32 + +// [SGLEA4]/GormitiDebug.elf:.debug_info::0x7aba2 +typedef struct WPADCLStatus { + WPADButton button; // size 0x02, offset 0x00 + s16 accX; // size 0x02, offset 0x02 + s16 accY; // size 0x02, offset 0x04 + s16 accZ; // size 0x02, offset 0x06 + DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // size 0x20, offset 0x08 + u8 dev; // size 0x01, offset 0x28 + s8 err; // size 0x01, offset 0x29 + + WPADExtButton clButton; // size 0x02, offset 0x2a + s16 clLStickX; // size 0x02, offset 0x2c + s16 clLStickY; // size 0x02, offset 0x2e + s16 clRStickX; // size 0x02, offset 0x30 + s16 clRStickY; // size 0x02, offset 0x32 + u8 clTriggerL; // size 0x01, offset 0x34 + u8 clTriggerR; // size 0x01, offset 0x35 +} WPADCLStatus; // size 0x36 + +// [SGLEA4]/GormitiDebug.elf:.debug_info::0x7acba +typedef struct WPADTRStatus { + WPADButton button; // size 0x02, offset 0x00 + s16 accX; // size 0x02, offset 0x02 + s16 accY; // size 0x02, offset 0x04 + s16 accZ; // size 0x02, offset 0x06 + DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // size 0x20, offset 0x08 + u8 dev; // size 0x01, offset 0x28 + s8 err; // size 0x01, offset 0x29 + + WPADExtButton trButton; // size 0x02, offset 0x2a + u8 brake; // size 0x01, offset 0x2c + u8 mascon; // size 0x01, offset 0x2d +} WPADTRStatus; // size 0x2e + +// [SGLEA4]/GormitiDebug.elf:.debug_info::0x7ad79 +typedef struct WPADBLStatus { + WPADButton button; // size 0x02, offset 0x00 + s16 accX; // size 0x02, offset 0x02 + s16 accY; // size 0x02, offset 0x04 + s16 accZ; // size 0x02, offset 0x06 + DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // size 0x20, offset 0x08 + u8 dev; // size 0x01, offset 0x28 + s8 err; // size 0x01, offset 0x29 + + u16 press[4]; // size 0x08, offset 0x2a + s8 temp; // size 0x01, offset 0x32 + u8 battery; // size 0x01, offset 0x33 +} WPADBLStatus; // size 0x34 + +// [SGLEA4]/GormitiDebug.elf:.debug_info::0x7ae44 +typedef struct WPADMPStatus { + WPADButton button; // size 0x02, offset 0x00 + s16 accX; // size 0x02, offset 0x02 + s16 accY; // size 0x02, offset 0x04 + s16 accZ; // size 0x02, offset 0x06 + DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // size 0x20, offset 0x08 + u8 dev; // size 0x01, offset 0x28 + s8 err; // size 0x01, offset 0x29 + + // [SGLEA4]/GormitiDebug.elf:.debug_info::0x7af2c + union /* explicitly untagged */ + { + // Takes its members from WPADFSStatus + // [SGLEA4]/GormitiDebug.elf:.debug_info::0x7af54 + struct /* explicitly untagged */ + { + s16 fsAccX; // size 0x02, offset 0x00 + s16 fsAccY; // size 0x02, offset 0x02 + s16 fsAccZ; // size 0x02, offset 0x04 + s8 fsStickX; // size 0x01, offset 0x06 + s8 fsStickY; // size 0x01, offset 0x07 + } fs; // size 0x08 + + // Takes its members from WPADCLStatus + // [SGLEA4]/GormitiDebug.elf:.debug_info::0x7afbb + struct /* explicitly untagged */ + { + WPADExtButton clButton; // size 0x02, offset 0x00 + s16 clLStickX; // size 0x02, offset 0x02 + s16 clLStickY; // size 0x02, offset 0x04 + s16 clRStickX; // size 0x02, offset 0x06 + s16 clRStickY; // size 0x02, offset 0x08 + u8 clTriggerL; // size 0x01, offset 0x0a + u8 clTriggerR; // size 0x01, offset 0x0b + } cl; // size 0x0c + } ext; // size 0x0c, offset 0x2a + + WPADMPStatusFlags stat; // size 0x01, offset 0x36 + u8 reserved; // size 0x01, offset 0x37 + + s16 pitch; // size 0x02, offset 0x38 + s16 yaw; // size 0x02, offset 0x3a + s16 roll; // size 0x02, offset 0x3c +} WPADMPStatus; // size 0x3e + +// [SGLEA4]/GormitiDebug.elf:.debug_info::0x7b056 +typedef struct WPADBKStatus { + WPADButton button; // size 0x02, offset 0x00 + s16 accX; // size 0x02, offset 0x02 + s16 accY; // size 0x02, offset 0x04 + s16 accZ; // size 0x02, offset 0x06 + DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // size 0x20, offset 0x08 + u8 dev; // size 0x01, offset 0x28 + s8 err; // size 0x01, offset 0x29 + + byte_t bulk[21]; // size 0x15, offset 0x2a + byte_t padding[1]; // size 0x01, offset 0x3f +} WPADBKStatus; // size 0x40 + +typedef struct WPADVSStatus { + WPADButton button; // size 0x02, offset 0x00 + s16 accX; // size 0x02, offset 0x02 + s16 accY; // size 0x02, offset 0x04 + s16 accZ; // size 0x02, offset 0x06 + DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // size 0x20, offset 0x08 + u8 dev; // size 0x01, offset 0x28 + s8 err; // size 0x01, offset 0x29 + + u16 at_0x2a[5]; // size 0x0a, offset 0x2a + u8 at_0x34; // size 0x02, offset 0x34 + // 1 byte padding (alignment? probably) + u16 at_0x36[5]; // size 0x0a, offset 0x36 + u8 at_0x40; // size 0x02, offset 0x40 + // 1 byte padding (alignment? probably) + u16 at_0x42; // size 0x02, offset 0x42 + u8 at_0x44; // size 0x01, offset 0x44 + // 1 byte padding (alignment? probably) +} WPADVSStatus; // size 0x46 (see __wpadFmt2Size) + +typedef struct WPADAccGravityUnit { + // probably maybe + s16 x; // size 0x02, offset 0x00 + s16 y; // size 0x02, offset 0x02 + s16 z; // size 0x02, offset 0x04 +} WPADAccGravityUnit; // size 0x06 + +/******************************************************************************* + * functions + */ + +BOOL WPADIsEnabledVSM(void); +BOOL WPADIsEnabledTRN(void); +BOOL WPADIsEnabledGTR(void); +BOOL WPADIsEnabledDRM(void); +BOOL WPADIsEnabledTKO(void); +BOOL WPADIsEnabledTBL(void); +BOOL WPADIsEnabledBLK(void); + +// Likely overridden by a WBC-specific library +__attribute__((weak)) WPADResult WBCSetupCalibration(void); +__attribute__((weak)) signed WBCGetCalibrationStatus(void); +__attribute__((weak)) signed WBCGetBatteryLevel(u8); +__attribute__((weak)) WPADResult WBCRead(WPADBLStatus *, f64 *, int); +__attribute__((weak)) WPADResult WBCSetZEROPoint(f64 *, int); +__attribute__((weak)) WPADResult WBCGetTGCWeight(f64, f64 *, WPADBLStatus *); + +void WPADInit(void); +void WPADShutdown(void); + +BOOL WPADStartFastSimpleSync(void); +BOOL WPADStopSimpleSync(void); +BOOL WPADCancelSyncDevice(void); +WPADSimpleSyncCallback *WPADSetSimpleSyncCallback(WPADSimpleSyncCallback *cb); +void WPADRegisterAllocator(WPADAllocFunc *alloc, WPADFreeFunc *free); +WPADLibStatus WPADGetStatus(void); +u8 WPADGetRadioSensitivity(WPADChannel chan); +void WPADGetAddress(WPADChannel chan, BD_ADDR_PTR addr); +u8 WPADGetSensorBarPosition(void); + +void WPADGetAccGravityUnit(WPADChannel chan, WPADAccGravityUnitType type, WPADAccGravityUnit *acc); + +void WPADDisconnect(WPADChannel chan); +WPADResult WPADProbe(WPADChannel chan, WPADDeviceType *devTypeOut); +WPADSamplingCallback *WPADSetSamplingCallback(WPADChannel chan, WPADSamplingCallback *cb); +WPADConnectCallback *WPADSetConnectCallback(WPADChannel chan, WPADConnectCallback *cb); +WPADExtensionCallback *WPADSetExtensionCallback(WPADChannel chan, WPADExtensionCallback *cb); +WPADDataFormat WPADGetDataFormat(WPADChannel chan); +WPADResult WPADSetDataFormat(WPADChannel chan, WPADDataFormat fmt); + +WPADResult WPADGetInfoAsync(WPADChannel chan, WPADInfo *info, WPADCallback *cb); +void WPADControlMotor(WPADChannel chan, WPADMotorCommand command); +void WPADEnableMotor(BOOL enabled); +BOOL WPADIsMotorEnabled(void); +WPADResult WPADControlLed(WPADChannel chan, u8 ledFlags, WPADCallback cb); +BOOL WPADSaveConfig(SCFlushCallback *cb); + +/* NOTE: status should match the WPADStatus type for the channel; a check + * against the currently assigned device type is made to know how much to copy + * + * for example, if devType[chan] == WPAD_DEV_CLASSIC, status should be a + * pointer to WPADCLStatus cast to a pointer to WPADStatus + */ +void WPADRead(WPADChannel chan, WPADStatus *status); +void WPADSetAutoSamplingBuf(WPADChannel chan, void *buf, u32 length); + +BOOL WPADIsSpeakerEnabled(WPADChannel chan); +WPADResult WPADControlSpeaker(WPADChannel chan, WPADSpeakerCommand command, WPADCallback *cb); +u8 WPADGetSpeakerVolume(void); +void WPADSetSpeakerVolume(u8 vol); + +BOOL WPADCanSendStreamData(WPADChannel chan); +WPADResult WPADSendStreamData(WPADChannel chan, void *p_buf, u16 len); +u8 WPADGetDpdSensitivity(void); +BOOL WPADIsDpdEnabled(WPADChannel chan); + +WPADResult WPADControlDpd(WPADChannel chan, WPADDpdCommand command, WPADCallback *cb); +WPADResult WPADControlBLC(WPADChannel chan, WPADBLCCommand command, WPADCallback *cb); + +void WPADRecalibrate(WPADChannel chan); +BOOL WPADIsUsedCallbackByKPAD(void); +void WPADSetCallbackByKPAD(BOOL isKPAD); #ifdef __cplusplus } #endif -#endif + +#endif // RVL_SDK_WPAD_H diff --git a/include/rvl/WPAD/WPADMem.h b/include/rvl/WPAD/WPADMem.h new file mode 100644 index 00000000..d5d2c259 --- /dev/null +++ b/include/rvl/WPAD/WPADMem.h @@ -0,0 +1,57 @@ +#ifndef RVL_SDK_WPAD_MEMORY_H +#define RVL_SDK_WPAD_MEMORY_H + +#include +#include +#include + + +/******************************************************************************* + * macros + */ + +#define WM_MEM_ADDR(addr_) ((addr_) & 0xffff) +#define WM_EXT_REG_ADDR(type_, addr_) (((addr_) & 0xffff) | ((WPAD_EXT_REG_##type_) << 16) | (1 << 26)) + +/******************************************************************************* + * types + */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef u8 WPADExtRegType; +enum WPADExtRegType_et { + WPAD_EXT_REG_SPEAKER = 0xa2, + WPAD_EXT_REG_EXTENSION = 0xa4, + WPAD_EXT_REG_MOTION_PLUS = 0xa6, + WPAD_EXT_REG_DPD = 0xb0, +}; + +// https://wiibrew.org/wiki/Wiimote#EEPROM_Memory +typedef struct WPADGameInfo { + OSTime timestamp; // size 0x08, offset 0x00 + u16 gameName[17]; // size 0x22, offset 0x08 + char gameID[4]; // size 0x04, offset 0x2a + u8 gameType; // size 0x01, offset 0x2e + u8 checksum; // size 0x01, offset 0x2f + + /* wiibrew says this exists in the header on the Wiimote but goes unused, + * which matches up with the code I see here + */ + byte_t unknown[8]; +} WPADGameInfo; // size 0x38 + +/******************************************************************************* + * functions + */ + +WPADResult +WPADWriteExtReg(WPADChannel chan, const void *data, u16 length, WPADExtRegType extReg, u16 address, WPADCallback *cb); + +#ifdef __cplusplus +} +#endif + +#endif // RVL_SDK_WPAD_MEMORY_H diff --git a/include/rvl/WPAD/WUD.h b/include/rvl/WPAD/WUD.h new file mode 100644 index 00000000..a363bd40 --- /dev/null +++ b/include/rvl/WPAD/WUD.h @@ -0,0 +1,108 @@ +#ifndef RVL_SDK_WPAD_WUD_H +#define RVL_SDK_WPAD_WUD_H + +#include + +// TODO: Fix when possible +#include "context_bte.h" + +#define WUD_MAX_DEV_ENTRY_FOR_STD 10 // name known from asserts +#define WUD_MAX_DEV_ENTRY_FOR_SMP 6 // name known from asserts + +#define WUD_MAX_DEV_ENTRY 16 // name known from asserts + +#ifdef __cplusplus +extern "C" { +#endif + +typedef s8 WUDDevHandle; +#define WUD_DEV_HANDLE_INVALID (-1) + +typedef s32 WUDChannel; +enum WUDChannel_et { + WUD_CHAN0, + WUD_CHAN1, + WUD_CHAN2, + WUD_CHAN3, + + WUD_MAX_CHANNELS, + WUD_CHAN_INVALID = -1 +}; + +typedef s32 WUDLibStatus; +enum WUDLibStatus_et { + WUD_LIB_STATUS_0, + WUD_LIB_STATUS_1, + WUD_LIB_STATUS_2, + WUD_LIB_STATUS_3, + WUD_LIB_STATUS_4, +}; + +typedef u8 WUDSyncType; +enum WUDSyncType_et { + WUD_SYNC_TYPE_STANDARD, + WUD_SYNC_TYPE_SIMPLE, +}; + +typedef void *WUDAllocFunc(size_t size); +typedef int WUDFreeFunc(void *ptr); // signature from petari. not sure what the int is, though + +typedef void WUDSyncDeviceCallback(s32 result, s32 num); // what is result? +typedef void WUDClearDeviceCallback(signed); + +typedef struct WUDDevInfo WUDDevInfo; +typedef void WUDHidConnectCallback(WUDDevInfo *devInfo, u8 isOpenEvent); +typedef void WUDHidReceiveCallback(UINT8 dev_handle, UINT8 *p_rpt, UINT16 len); + +struct WUDDevInfo { + struct small_dev_info small; // size 0x40, offset 0x00 + BD_ADDR devAddr; // size 0x06, offset 0x40 + LINK_KEY linkKey; // size 0x10, offset 0x46 + UINT8 devHandle; // size 0x01, offset 0x56 + UINT8 subclass; // size 0x01, offset 0x57 + UINT8 appID; // size 0x01, offset 0x58 + u8 at_0x59; // size 0x01, offset 0x59 + char signed at_0x5a; // size 0x01, offset 0x5a /* unknown */ + u8 at_0x5b; // size 0x01, offset 0x5b + u8 at_0x5c; // size 0x01, offset 0x5c + byte_t unk_0x5d[1]; // padding? + tBTA_HH_ATTR_MASK hhAttrMask; // size 0x02, offset 0x5e +}; // size 0x60 + +/******************************************************************************* + * functions + */ + +BOOL WUDIsLinkedWBC(void); + +BOOL WUDInit(void); +void WUDRegisterAllocator(WUDAllocFunc *alloc, WUDFreeFunc *free); +void WUDShutdown(BOOL saveSimpleDevs); +WUDLibStatus WUDGetStatus(void); +u8 WUDGetBufferStatus(void); +void WUDSetSniffMode(BD_ADDR addr, int interval); +WUDSyncDeviceCallback *WUDSetSyncSimpleCallback(WUDSyncDeviceCallback *cb); + +BOOL WUDStartSyncDevice(void); +BOOL WUDStartFastSyncSimple(void); + +BOOL WUDCancelSyncDevice(void); +BOOL WUDStopSyncSimple(void); +BOOL WUDStartClearDevice(void); +BOOL WUDSetDisableChannel(s8 afhChannel); +WUDHidConnectCallback *WUDSetHidConnCallback(WUDHidConnectCallback *hidConn); +WUDHidReceiveCallback *WUDSetHidRecvCallback(WUDHidReceiveCallback *hidRecv); +void WUDSetVisibility(u8 discoverable, u8 connectable); +u8 WUDGetConnectable(void); + +BOOL WUDIsBusy(void); + +void WUDSetDeviceHistory(WUDChannel chan, BD_ADDR addr); +BOOL WUDIsLatestDevice(WUDChannel chan, BD_ADDR addr); +void WUDUpdateSCSetting(void); + +#ifdef __cplusplus +} +#endif + +#endif // RVL_SDK_WPAD_WUD_H diff --git a/src/egg/audio/eggAudioArcPlayerMgr.cpp b/src/egg/audio/eggAudioArcPlayerMgr.cpp new file mode 100644 index 00000000..89b4927c --- /dev/null +++ b/src/egg/audio/eggAudioArcPlayerMgr.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/audio/eggAudioHeapMgr.cpp b/src/egg/audio/eggAudioHeapMgr.cpp new file mode 100644 index 00000000..b9582070 --- /dev/null +++ b/src/egg/audio/eggAudioHeapMgr.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/audio/eggAudioMgr.cpp b/src/egg/audio/eggAudioMgr.cpp new file mode 100644 index 00000000..02f2f40f --- /dev/null +++ b/src/egg/audio/eggAudioMgr.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/audio/eggAudioRmtSpeakerMgr.cpp b/src/egg/audio/eggAudioRmtSpeakerMgr.cpp new file mode 100644 index 00000000..62eeaa21 --- /dev/null +++ b/src/egg/audio/eggAudioRmtSpeakerMgr.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/audio/eggAudioSystem.cpp b/src/egg/audio/eggAudioSystem.cpp new file mode 100644 index 00000000..12b88463 --- /dev/null +++ b/src/egg/audio/eggAudioSystem.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/audio/eggAudioUtility.cpp b/src/egg/audio/eggAudioUtility.cpp new file mode 100644 index 00000000..5fc52e30 --- /dev/null +++ b/src/egg/audio/eggAudioUtility.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/core/eggAllocator.cpp b/src/egg/core/eggAllocator.cpp index b8ce55f2..c89e5755 100644 --- a/src/egg/core/eggAllocator.cpp +++ b/src/egg/core/eggAllocator.cpp @@ -1,11 +1,11 @@ #include #include -/* 804952d0 */ static void *MEM_AllocFor_Heap(MEMAllocator* alloc, u32 size) { - return static_cast(static_cast(alloc)->heap)->alloc(size, alloc->heapParam1); +/* 804952d0 */ static void *MEM_AllocFor_Heap(MEMAllocator *alloc, u32 size) { + return static_cast(static_cast(alloc)->heap)->alloc(size, alloc->heapParam1); } -/* 804952f0 */ static void MEM_FreeFor_Heap(MEMAllocator* alloc, void* block) { - return static_cast(static_cast(alloc)->heap)->free(block); +/* 804952f0 */ static void MEM_FreeFor_Heap(MEMAllocator *alloc, void *block) { + return static_cast(static_cast(alloc)->heap)->free(block); } const MEMAllocatorFuncs eggAllocatorFuncs = { @@ -15,14 +15,13 @@ const MEMAllocatorFuncs eggAllocatorFuncs = { // TODO this is used from eggHeap for some reason. Figure out // the correct privacy boundary later. -/* 80495310 */ void MEMInitAllocatorFor_Heap(MEMAllocator* alloc, s32 align, void* heap) { +/* 80495310 */ void MEMInitAllocatorFor_Heap(MEMAllocator *alloc, s32 align, void *heap) { alloc->funcs = &eggAllocatorFuncs; alloc->heap = heap; alloc->heapParam1 = align; alloc->heapParam2 = 0; } - namespace EGG { /* 80495330 */ Allocator::Allocator(Heap *heap, s32 align) : mHeap(heap), align(align) { diff --git a/src/egg/core/eggArchive.cpp b/src/egg/core/eggArchive.cpp new file mode 100644 index 00000000..374356a1 --- /dev/null +++ b/src/egg/core/eggArchive.cpp @@ -0,0 +1,332 @@ +#include +#include +#include + +namespace EGG { + +bool Archive::sIsArchiveListInitialized; +nw4r::ut::List Archive::sArchiveList; + +s32 readNANDFile(NANDFileInfo *info, void *buf, u32 len, s32 offs) { + s32 seek = NANDSeek(info, offs, NAND_SEEK_BEG); + if (seek == offs) { + return NANDRead(info, buf, len); + } + return seek; +} + +Archive::Archive() { + mDvdEntryNum = -1; + mNandFile = nullptr; + mRefCount = 1; + mMountType = MOUNT_NONE; + memset(&mHandle, 0, sizeof(ARCHandle)); + appendList(this); +} + +Archive::~Archive() { + removeList(this); +} + +bool Archive::initHandle(void *data, MountType mount) { + bool success = false; + + if (data) { + success = ARCInitHandle(data, &mHandle); + } + + if (success) { + mMountType = mount; + } else { + mMountType = MOUNT_NONE; + } + + return success; +} + +Archive *Archive::findArchive(void *data) { + Archive *arc = nullptr; + + if (sIsArchiveListInitialized && data) { + Archive *node = nullptr; + while (node = (Archive *)nw4r::ut::List_GetNext(&sArchiveList, node)) { + if (node->mHandle.header == data) { + arc = node; + break; + } + } + } + + return arc; +} + +Archive *Archive::findArchive(NANDFileInfo *data) { + Archive *arc = nullptr; + + if (sIsArchiveListInitialized && data) { + Archive *node = nullptr; + while (node = (Archive *)nw4r::ut::List_GetNext(&sArchiveList, node)) { + if (node->mNandFile == data) { + arc = node; + break; + } + } + } + + return arc; +} + +void Archive::appendList(Archive *arc) { + if (!sIsArchiveListInitialized) { + nw4r::ut::List_Init(&sArchiveList, offsetof(Archive, mLink)); + sIsArchiveListInitialized = true; + } + + nw4r::ut::List_Append(&sArchiveList, arc); +} + +void Archive::removeList(Archive *arc) { + nw4r::ut::List_Remove(&sArchiveList, arc); +} + +Archive *Archive::mount(void *data, Heap *pHeap, int align) { + if (data == nullptr) { + return nullptr; + } + + Archive *arc = findArchive(data); + if (!arc) { + arc = new (pHeap, align) Archive(); + + if (!arc || !arc->initHandle(data, MOUNT_MEM)) { + delete arc; + arc = nullptr; + } + } else { + arc->mRefCount++; + } + + return arc; +} + +Archive *Archive::mountFST(void *data, Heap *pHeap, int align) { + if (data == nullptr) { + return nullptr; + } + + Archive *arc = findArchive(data); + if (!arc) { + arc = new (pHeap, align) Archive(); + + if (!arc || !arc->initHandle(data, MOUNT_NAND)) { + delete arc; + arc = nullptr; + } + } else { + arc->mRefCount++; + } + + return arc; +} + +Archive *Archive::mountNAND(NANDFileInfo *nandFile, Heap *pHeap, int align) { + Archive *arc = findArchive(nandFile); + if (!arc) { + void *arc_bin = loadNAND(nandFile, pHeap, align); + arc = mountFST(arc_bin, pHeap, align); + arc->mNandFile = nandFile; + } else { + arc->mRefCount++; + } + return arc; +} + +Archive *Archive::loadFST(const char *fileName, Heap *pHeap, int align) { + NANDFileInfo *nandFile = (NANDFileInfo *)pHeap->alloc(sizeof(NANDFileInfo), align > 0 ? -0x20 : 0x20); + + if (NANDOpen(fileName, nandFile, NAND_ACCESS_READ) != NAND_RESULT_OK) { + pHeap->free(nandFile); + return nullptr; + } + + return mountNAND(nandFile, pHeap, align); +} + +void Archive::unmount() { + if (mRefCount == 0) { + return; + } + if (--mRefCount) { + return; + } + + if (mNandFile) { + NANDClose(mNandFile); + Heap::free(mNandFile, nullptr); + mNandFile = nullptr; + } + mDvdEntryNum = -1; + mMountType = MOUNT_NONE; + delete this; +} + +void *Archive::getFile(const char *path, FileInfo *fileInfo) { + ARCFileInfo arcFileInfo; + void *file = nullptr; + bool opened = false; + int entryNum = ARCConvertPathToEntrynum(&mHandle, path); + + if (entryNum != -1) { + opened = ARCFastOpen(&mHandle, entryNum, &arcFileInfo); + } + + if (opened) { + if (mMountType == MOUNT_MEM) { + file = ARCGetStartAddrInMem(&arcFileInfo); + } + if (fileInfo) { + fileInfo->mArcStartOffset = ARCGetStartOffset(&arcFileInfo); + fileInfo->mArcLength = ARCGetLength(&arcFileInfo); + } + } + + ARCClose(&arcFileInfo); + return file; +} + +s32 Archive::convertPathToEntryID(const char *path) { + return ARCConvertPathToEntrynum(&mHandle, path); +} + +void *Archive::getFileFast(s32 entryId, FileInfo *fileInfo) { + if (entryId == -1) { + if (fileInfo) { + fileInfo->mArcStartOffset = 0; + fileInfo->mArcLength = 0; + } + return nullptr; + } + + void *file = nullptr; + if (mMountType == MOUNT_MEM) { + ARCFileInfo arcFileInfo; + bool opened = ARCFastOpen(&mHandle, entryId, &arcFileInfo); + if (opened) { + file = ARCGetStartAddrInMem(&arcFileInfo); + if (fileInfo) { + fileInfo->mArcStartOffset = ARCGetStartOffset(&arcFileInfo); + fileInfo->mArcLength = ARCGetLength(&arcFileInfo); + } + } + ARCClose(&arcFileInfo); + } + + return file; +} + +void *Archive::getFileFast(s32 entryId, Heap *pHeap, int align) { + if (entryId == -1) { + return nullptr; + } + + u32 file_len; + void *file = nullptr; + ARCFileInfo arcFileInfo; + bool opened = ARCFastOpen(&mHandle, entryId, &arcFileInfo); + + if (opened) { + file_len = ROUND_UP(ARCGetLength(&arcFileInfo), 0x20); + file = pHeap->alloc(file_len, align); + if (file) { + if (mMountType == MOUNT_MEM) { + void *startAddr = ARCGetStartAddrInMem(&arcFileInfo); + memcpy(file, startAddr, file_len); + } else { + u32 offs = ARCGetStartOffset(&arcFileInfo); + if (mNandFile) { + readNANDFile(mNandFile, file, file_len, offs); + } else { + if (mDvdEntryNum != -1) { + DVDFileInfo dvdFileInfo; + DVDFastOpen(mDvdEntryNum, &dvdFileInfo); + DVDReadPrio(&dvdFileInfo, file, file_len, offs, DVD_PRIO_MEDIUM); + DVDClose(&dvdFileInfo); + } + } + } + } + } + ARCClose(&arcFileInfo); + return file; +} + +void countFileCallbackFunc(void *arg1, void *arg2, const ARCDirEntry *, const char *) { + if (!arg2) { + return; + } + (*(u32 *)arg1)++; + return; +} + +s32 Archive::countFile() { + u32 count = 0; + searchInside(countFileCallbackFunc, &count); + return count; +} + +void searchInsideWithPath( + Archive *arc, ARCHandle *handle, FileCallbackFunc cb, void *cbArg, char *outPath, u32 max_len +) { + ARCDir dir; + if (ARCOpenDir(handle, outPath, &dir)) { + ARCDirEntry dirEntry; + while (ARCReadDir(&dir, &dirEntry)) { + size_t path_len = strlen(outPath); + if (dirEntry.isDir) { + size_t dir_len = strlen(dirEntry.name) + 1; + strcat(outPath, dirEntry.name); + cb(cbArg, nullptr, &dirEntry, outPath); + strcat(outPath, "/"); + searchInsideWithPath(arc, handle, cb, cbArg, outPath, max_len - dir_len); + } else { + size_t _unused = strlen(dirEntry.name); + strcat(outPath, dirEntry.name); + cb(cbArg, arc->getFile(outPath, nullptr), &dirEntry, outPath); + } + outPath[path_len] = '\0'; + } + ARCCloseDir(&dir); + } +} + +void Archive::searchInside(FileCallbackFunc cb, void *cbArg) { + char buffer[256]; + strcpy(buffer, "/"); + size_t bufSize = sizeof(buffer); + bufSize -= 1 + strlen(buffer); + searchInsideWithPath(this, &mHandle, cb, cbArg, buffer, bufSize); +} + +void *Archive::loadNAND(NANDFileInfo *fileInfo, Heap *pHeap, int align) { + int file_align = align >= 0 ? 0x20 : -0x20; + void *arc_file = nullptr; + ARCHeader *header = (ARCHeader *)pHeap->alloc(sizeof(ARCHeader), -file_align); + if (header) { + s32 readres = readNANDFile(fileInfo, header, sizeof(ARCHeader), 0); + if (readres >= sizeof(ARCHeader)) { + u32 file_len = ROUND_UP(header->nodes.size + sizeof(ARCHeader), 0x20); + arc_file = pHeap->alloc(file_len, file_align); + if (arc_file) { + readres = readNANDFile(fileInfo, arc_file, file_len, 0); + if (readres != file_len) { + pHeap->free(arc_file); + arc_file = nullptr; + } + } + } + pHeap->free(header); + } + return arc_file; +} + +} // namespace EGG diff --git a/src/egg/core/eggAssertHeap.cpp b/src/egg/core/eggAssertHeap.cpp new file mode 100644 index 00000000..a3e49c9e --- /dev/null +++ b/src/egg/core/eggAssertHeap.cpp @@ -0,0 +1,126 @@ +#include + +namespace EGG { + +AssertHeap::AssertHeap(MEMiHeapHead *pHead) : Heap(pHead) {} + +AssertHeap::~AssertHeap() { + dispose(); + MEMDestroyFrmHeap(mHeapHandle); +} + +AssertHeap *AssertHeap::create(void *pBlock, u32 size) { + AssertHeap *heap = nullptr; + void *startAddr = pBlock; + void *heapEnd = ROUND_DOWN_PTR((u8 *)pBlock + size, 0x04); + pBlock = ROUND_UP_PTR(pBlock, 0x04); + + if (pBlock > heapEnd || ((u8 *)heapEnd - (u8 *)pBlock) < 0x38u) { + return nullptr; + } + + MEMiHeapHead *head = + MEMCreateFrmHeapEx((u8 *)pBlock + sizeof(AssertHeap), ((u8 *)heapEnd - (u8 *)pBlock) - sizeof(AssertHeap), 0); + if (head != nullptr) { + heap = new (pBlock) AssertHeap(head); + heap->mParentBlock = startAddr; + if (sCreateCallback != nullptr) { + (sCreateCallback)(heap); + } + } + + return heap; +} + +AssertHeap *AssertHeap::create(u32 size, Heap *pHeap) { + AssertHeap *assertHeap = nullptr; + + if (!pHeap) { + pHeap = sCurrentHeap; + } + if (size == -1) { + size = pHeap->getAllocatableSize(4); + } else if (size == 0) { + size = getSize(); + } + + void *pBlock = pHeap->alloc(size, 4); + if (pBlock) { + assertHeap = create(pBlock, size); + if (!assertHeap) { + pHeap->free(pBlock); + } + } + + return assertHeap; +} + +void AssertHeap::destroy() { + if (sDestroyCallback) { + sDestroyCallback(this); + } + + Heap *parent = findParentHeap(); + this->~AssertHeap(); + if (parent) { + parent->free(this); + } +} + +void *AssertHeap::alloc(u32 size, s32 align) { + if (sAllocCallback) { + HeapAllocArg arg; + arg.userArg = sAllocCallbackArg; + arg.size = size; + arg.align = align; + arg.heap = this; + arg.ptr = nullptr; + sAllocCallback(&arg); + } + return nullptr; +} + +void AssertHeap::free(void *pBlock) { + if (sFreeCallback != nullptr) { + HeapFreeArg arg; + arg.userArg = sFreeCallbackArg; + arg.ptr = pBlock; + arg.heap = this; + (sFreeCallback)(&arg); + } +} + +u32 AssertHeap::resizeForMBlock(void *pBlock, u32 size) { + return 0; +} + +u32 AssertHeap::getTotalFreeSize() { + return 0; +} + +u32 AssertHeap::getAllocatableSize(s32 align) { + return 0; +} + +u32 AssertHeap::adjust() { + u32 adjustedSize = MEMAdjustFrmHeap(mHeapHandle); + u32 totalSize = adjustedSize + sizeof(AssertHeap); + if (totalSize > sizeof(AssertHeap)) { + Heap *parent = findParentHeap(); + if (parent != nullptr) { + parent->resizeForMBlock(mParentBlock, totalSize); + return totalSize; + } + } + return 0; +} + +size_t AssertHeap::getSize() { + return 0x7C; +} + +Heap::eHeapKind AssertHeap::getHeapKind() const { + return HEAP_KIND_ASSERT; +} + +} // namespace EGG diff --git a/src/egg/core/eggAsyncDisplay.cpp b/src/egg/core/eggAsyncDisplay.cpp index d2b4bf81..d04156a6 100644 --- a/src/egg/core/eggAsyncDisplay.cpp +++ b/src/egg/core/eggAsyncDisplay.cpp @@ -58,8 +58,10 @@ inline void AsyncDisplay::waitForMsg(bool b) { // This is really ugly but I couldn't find a different way // to make the compiler use the registers XfbManager *xfb; - while (!((xfb = BaseSystem::mConfigData->getXfbMgr(), 1 < xfb->mNumXfbs - this->field_0xAC) && - (BaseSystem::mConfigData->getXfbMgr()->mToCopyXfb != nullptr || b))) { + while ( + !((xfb = BaseSystem::mConfigData->getXfbMgr(), 1 < xfb->mNumXfbs - this->field_0xAC) && + (BaseSystem::mConfigData->getXfbMgr()->mToCopyXfb != nullptr || b)) + ) { OSReceiveMessage(&this->mMesgQueue, this->mMesgBuf, 1); while (OSReceiveMessage(&this->mMesgQueue, this->mMesgBuf, 0)) {} @@ -159,8 +161,9 @@ void AsyncDisplay::preVRetrace() { void AsyncDisplay::clearEFB() { Video *video = BaseSystem::mConfigData->getVideo(); GXRenderModeObj const *renderMode = video->pRenderMode; - this->clearEFB(renderMode->fbWidth, renderMode->efbHeight, 0, 0, renderMode->fbWidth, renderMode->efbHeight, - this->mClearColor); + this->clearEFB( + renderMode->fbWidth, renderMode->efbHeight, 0, 0, renderMode->fbWidth, renderMode->efbHeight, this->mClearColor + ); } u32 AsyncDisplay::getTickPerFrame() { diff --git a/src/egg/core/eggColorFader.cpp b/src/egg/core/eggColorFader.cpp index a0f9863b..69185240 100644 --- a/src/egg/core/eggColorFader.cpp +++ b/src/egg/core/eggColorFader.cpp @@ -2,11 +2,12 @@ #include #include - /* 80497930 */ -EGG::ColorFader::ColorFader(float startX, float startY, float lengthX, float lengthY, nw4r::ut::Color color, - Fader::EStatus initialStatus) - : mStartX(startX), mStartY(startY), mEndX(startX + lengthX), mEndY(startY + lengthY), mFrame(0x14), mFadeTimer(0), mFlags(0) { +EGG::ColorFader::ColorFader( + float startX, float startY, float lengthX, float lengthY, nw4r::ut::Color color, Fader::EStatus initialStatus +) + : mStartX(startX), mStartY(startY), mEndX(startX + lengthX), mEndY(startY + lengthY), mFrame(0x14), mFadeTimer(0), + mFlags(0) { setColor(color); setStatus(initialStatus); mFlags.setBit(1); diff --git a/src/egg/core/eggController.cpp b/src/egg/core/eggController.cpp index 3088eff2..3a8242d8 100644 --- a/src/egg/core/eggController.cpp +++ b/src/egg/core/eggController.cpp @@ -1,11 +1,13 @@ + #include "egg/core/eggController.h" + #include "MSL_C/string.h" #include "egg/core/eggAllocator.h" #include "egg/core/eggExpHeap.h" #include "egg/core/eggSystem.h" +#include "egg/math/eggMath.h" #include "rvl/VI.h" - EGG::NullController null_controller; namespace EGG { @@ -15,33 +17,32 @@ ControllerFactory CoreControllerMgr::sCoreControllerFactory; ConnectCallback CoreControllerMgr::sConnectCallback; // This controls whether EggController registers an allocator within the WPAD driver bool CoreControllerMgr::sUseBuiltinWpadAllocator; -static Allocator *sWPADAllocator; +s32 CoreControllerMgr::sWPADWorkSize = 0x32000; -/* 0x80498F90 */ void CoreStatus::init() { +void CoreStatus::init() { memset(this, 0, sizeof(CoreStatus)); } -/* 0x80498FA0 */ u32 CoreStatus::getFSStickButton() const { - f32 button = this->fsStickButton; +u32 CoreStatus::getFSStickButton() const { + f32 stick = getFSStickX(); u32 result = 0; - // TODO what are these flags and why is this code so weird? - if (!(-0.25f < button) || !(button < 0.25f)) { - if (button <= -0.5f) { + if (!(-0.25f < stick) || !(stick < 0.25f)) { + if (stick <= -0.5f) { result = 0; result |= 0x40000; - } else if (button >= 0.5f) { + } else if (stick >= 0.5f) { result = 0; result |= 0x80000; } } - button = this->fsStickButton2; - if (!(-0.25f < button) || !(button < 0.25f)) { - if (button <= -0.5f) { + stick = getFSStickY(); + if (!(-0.25f < stick) || !(stick < 0.25f)) { + if (stick <= -0.5f) { result &= ~0x10000; result |= 0x20000; - } else if (button >= 0.5f) { + } else if (stick >= 0.5f) { result &= ~0x20000; result |= 0x10000; } @@ -50,116 +51,262 @@ static Allocator *sWPADAllocator; return result; } -/* 0x80499050 */ CoreController::CoreController() : mDpdPos(), mAccel(), mAccelFlags(), mFlag(0) { - this->mRumbleMgr = nullptr; - this->mButtonHeld = 0; - this->mButtonTriggered = 0; - this->mButtonReleased = 0; - this->sceneReset(); - this->mFlag.makeAllZero(); +CoreController::CoreController() : mDpdPos(), mAccel(), mAccelFlags(), mFlag(0) { + mRumbleMgr = nullptr; + mButtonHeld = 0; + mButtonTriggered = 0; + mButtonReleased = 0; + sceneReset(); + mFlag.makeAllZero(); } -/* 0x804990B0 */ void CoreController::sceneReset() { - this->mAccel.set(0.0, 0.0, 0.0); - this->mDpdPos.x = 0.0; - this->mDpdPos.y = 0.0; - this->field_0xf28 = 0; - this->mPostureMatrixPrev.makeIdentity(); - this->mPostureMatrix.makeIdentity(); - this->mMaxAccelFrameTime = 10; - this->mMaxAccelDiff = 0.13; - this->mPrevAccel.set(0.0, 0.0, 0.0); - this->mAccelFlags.makeAllZero(); - this->mAccelFrameTimeZ = 0; - this->mAccelFrameTimeY = 0; - this->mAccelFrameTimeX = 0; - this->mMotorPattern = 0; - this->mMotorFrameDuration = 0; - this->mEnableMotor = false; - this->mMotorPatternLength = 0x20; - this->mMotorPatternPos = 0x1f; - this->stopRumbleMgr(); +void CoreController::sceneReset() { + mAccel.set(0.0, 0.0, 0.0); + mDpdPos.x = 0.0; + mDpdPos.y = 0.0; + mIdleTime = 0; + mPostureMatrixPrev.makeIdentity(); + mPostureMatrix.makeIdentity(); + mMaxAccelFrameTime = 10; + mMaxAccelDiff = 0.13; + mPrevAccel.set(0.0, 0.0, 0.0); + mAccelFlags.makeAllZero(); + mAccelFrameTime[2] = 0; + mAccelFrameTime[1] = 0; + mAccelFrameTime[0] = 0; + mMotorPattern = 0; + mMotorFrameDuration = 0; + mEnableMotor = false; + mMotorPatternLength = 0x20; + mMotorPatternPos = 0x1f; + stopRumbleMgr(); } -/* 0x80499170 */ Vector2f CoreController::getDpdRawPos() const { - return Vector2f(this->coreStatus[0].dpdRawX, this->coreStatus[0].dpdRawY); +Vector2f CoreController::getDpdRawPos() { + return Vector2f(mCoreStatus[0].mDpdRawX, mCoreStatus[0].mDpdRawY); } -/* 0x80499190 */ s32 CoreController::getDpdDistance() const { - return this->coreStatus[0].dpdDistance; +f32 CoreController::getDpdDistance() { + return mCoreStatus[0].mDpdDistance; } -// TODO -extern "C" void fn_803DB1E0(s32 channel, bool arg); - -/* 0x804991A0 */ void CoreController::startMotor() { - fn_803DB1E0(mChannelID, true); +s32 CoreController::getDpdValidFlag() { + return mCoreStatus[0].getDpdValidFlag(); } -/* 0x804991B0 */ void CoreController::stopMotor() { - fn_803DB1E0(mChannelID, false); +void CoreController::startMotor() { + WPADControlMotor(mChannelID, WPAD_MOTOR_RUMBLE); } -/* 0x804991C0 */ void CoreController::createRumbleMgr(u8 numUnits) { - this->mRumbleMgr = new ControllerRumbleMgr(); - this->mRumbleMgr->createUnit(numUnits, this); +void CoreController::stopMotor() { + WPADControlMotor(mChannelID, WPAD_MOTOR_STOP); } -/* 0x80499220 */ void CoreController::startPatternRumble(const char *pattern, int duration, bool bGrabActive) { - if (this->mRumbleMgr) { - this->mRumbleMgr->startPattern(pattern, duration, bGrabActive); +void CoreController::createRumbleMgr(u8 numUnits) { + mRumbleMgr = new ControllerRumbleMgr(); + mRumbleMgr->createUnit(numUnits, this); +} + +void CoreController::startPatternRumble(const char *pattern, int duration, bool bGrabActive) { + if (mRumbleMgr) { + mRumbleMgr->startPattern(pattern, duration, bGrabActive); } } -/* 0x80499240 */ void CoreController::stopRumbleMgr() { - if (this->mRumbleMgr) { - this->mRumbleMgr->stop(); +void CoreController::stopRumbleMgr() { + if (mRumbleMgr) { + mRumbleMgr->stop(); } } -/* 0x80499260 */ CoreStatus *CoreController::getCoreStatus(s32 idx) { - return &this->coreStatus[idx]; +CoreStatus *CoreController::getCoreStatus(int idx) { + return &mCoreStatus[idx]; } -/* 0x80499270 */ void CoreController::calc_posture_matrix(Matrix34f &mat, bool someBool) { - if (!someBool || this->mAccelFlags.onBit(7)) { - Vector3f vec = Vector3f(-mat(2, 3), -mat(2, 2), -mat(2, 1)); - Vector3f vec3 = vec; - vec.normalise(); - // TODO lots of inlined math +void CoreController::calc_posture_matrix(Matrix34f &posture, bool checkStable) { + if (checkStable && !isStable(7)) { + return; + } + Vector3f acc = -getAccel(); + Vector3f vy = acc; + vy.normalise(); + + Vector3f vz(0.0f, 0.0f, 1.0f); + Vector3f vx(1.0f, 0.0f, 0.0f); + + Vector3f bx, by, bz; + mPostureMatrixPrev.getBase(0, bx); + mPostureMatrixPrev.getBase(1, by); + mPostureMatrixPrev.getBase(2, bz); + + Vector3f vz_n(0.0f, 0.0f, -1.0f); + Vector3f vx_n(-1.0f, 0.0f, 0.0f); + + if (vz.dot(bz) < vz_n.dot(bz)) { + vz = vz_n; + } + + if (vx.dot(bx) < vx_n.dot(bx)) { + vx = vx_n; + } + + if (Math::abs(vy.dot(vz)) < Math::abs(vy.dot(vx))) { + vx = vy.cross(vz); + vx.normalise(); + vz = vx.cross(vy); + vz.normalise(); + } else { + vz = vx.cross(vy); + vz.normalise(); + vx = vy.cross(vz); + vx.normalise(); + } + + posture.setBase(0, vx); + posture.setBase(1, vy); + posture.setBase(2, vz); +} + +void CoreController::beginFrame(PADStatus *padStatus) { + s32 kpad_result; + mReadStatusIdx = KPADReadEx(mChannelID, mCoreStatus, 0x10, &kpad_result); + if (mReadStatusIdx == 0 && kpad_result == -1 /* Rvl usually uses negative nums for results */) { + mReadStatusIdx = 1; + } + + WPADDeviceType dev_type; + switch (WPADProbe(mChannelID, &dev_type)) { + case WPAD_ERR_OK: { + if ((u32)dev_type == WPAD_DEV_NONE) { + mFlag.resetBit(0); + } else { + mFlag.setBit(0); + } + } break; + case WPAD_ERR_NO_CONTROLLER: { + mFlag.resetBit(0); + } break; + } + + if (mReadStatusIdx > 0) { + CoreStatus *pStatus = mCoreStatus; + u32 prev_held = mButtonHeld; + if (pStatus->isFreestyle()) { + mButtonHeld = pStatus->getFSStickButton(); + } else { + mButtonHeld = 0; + } + + mButtonTriggered = mButtonHeld & ~prev_held; + mButtonReleased = prev_held & ~mButtonHeld; + pStatus->mHold &= ~0xF0000; + pStatus->mTrig &= ~0xF0000; + pStatus->mRelease &= ~0xF0000; + pStatus->mHold |= (mButtonHeld & 0xF0000); + pStatus->mTrig |= (mButtonTriggered & 0xF0000); + pStatus->mRelease |= (mButtonReleased & 0xF0000); + } + + mPostureMatrixPrev.copyFrom(mPostureMatrix); + mAccelFlags.makeAllZero(); + Vector3f acc = mCoreStatus->getAccel(); + + for (int i = 0; i < 3; i++) { + if (acc(i) - mAccel(i) < mMaxAccelDiff) { + if (mMaxAccelFrameTime <= ++mAccelFrameTime[i]) { + mAccelFrameTime[i] = mMaxAccelFrameTime; + mAccelFlags.set(1 << i); + mPrevAccel(i) = acc(i); + } + } else { + mAccelFlags.value &= ~(1 << i); // ? + mAccelFrameTime[i] = 0; + } + } + + calc_posture_matrix(mPostureMatrix, true); + + if (mEnableMotor) { + if (mMotorPattern & (1 << mMotorPatternPos)) { + startMotor(); + } else { + stopMotor(); + } + if (mMotorPatternPos == 0) { + mMotorPatternPos = mMotorPatternLength - 1; + } else { + mMotorPatternPos = mMotorPatternPos - 1; + } + + if (--mMotorFrameDuration == 0) { + stopMotor(); + mEnableMotor = false; + } + } + + if (mRumbleMgr) { + mRumbleMgr->calc(); + } + bool increment = true; + + if (mCoreStatus->getHold() != 0) { + increment = false; + } + + if (increment) { + Vector3f diff = (mAccel - mCoreStatus->getAccel()); + if (diff.squaredLength() > 0.01f) { + increment = false; + } + } + if (increment) { + Vector2f diff = (mDpdPos - getDpdRawPos()); + if (diff.squaredLength() > 0.05f) { + increment = false; + } + } + + if (increment) { + // I dont know what this is for... + // if no interaction, this increments? (30fps -> 2hrs) + if (mIdleTime < 216000) { + mIdleTime++; + } + } else { + mIdleTime = 0; } } -/* 0x80499660 */ void CoreController::beginFrame(void *padStatus) {} - -/* 0x80499A60 */ void CoreController::endFrame() { - this->mAccel(0) = this->coreStatus[0].accel[0]; - this->mAccel(1) = this->coreStatus[0].accel[1]; - this->mAccel(2) = this->coreStatus[0].accel[2]; - this->mDpdPos = this->getDpdRawPos(); +void CoreController::endFrame() { + mAccel = getAccel(); + mDpdPos = getDpdRawPos(); } -/* 0x80499AC0 */ f32 CoreController::getFreeStickX() const { - if (this->coreStatus[0].field_0x00[0x5C] == 0) { +/* 0x80499AC0 */ +f32 CoreController::getFreeStickX() const { + if (mCoreStatus->getDevType() == WPAD_DEV_CORE) { return 0.0; } - return ((f32 *)(&this->coreStatus[0].field_0x00))[0x18]; + return mCoreStatus[0].getFSStickX(); } -/* 0x80499AE0 */ f32 CoreController::getFreeStickY() const { - if (this->coreStatus[0].field_0x00[0x5C] == 0) { +/* 0x80499AE0 */ +f32 CoreController::getFreeStickY() const { + if (mCoreStatus->getDevType() == WPAD_DEV_CORE) { return 0.0; } - return ((f32 *)(&this->coreStatus[0].field_0x00))[0x19]; + return mCoreStatus[0].getFSStickY(); } -/* 0x80499B00 */ CoreControllerMgr::T__Disposer::~T__Disposer() { +/* 0x80499B00 */ +CoreControllerMgr::T__Disposer::~T__Disposer() { if (this == CoreControllerMgr::T__Disposer::sStaticDisposer) { deleteInstance(); } } -/* 0x80499B80 */ CoreControllerMgr *CoreControllerMgr::createInstance() { +/* 0x80499B80 */ +CoreControllerMgr *CoreControllerMgr::createInstance() { if (CoreControllerMgr::sInstance == nullptr) { CoreControllerMgr *mgr = new CoreControllerMgr(); CoreControllerMgr::sInstance = mgr; @@ -168,56 +315,58 @@ extern "C" void fn_803DB1E0(s32 channel, bool arg); return CoreControllerMgr::sInstance; } -/* 0x80499BD0 */ void CoreControllerMgr::deleteInstance() { +/* 0x80499BD0 */ +void CoreControllerMgr::deleteInstance() { CoreControllerMgr::sInstance = nullptr; CoreControllerMgr::T__Disposer::sStaticDisposer = nullptr; } -/* 0x80499BE0 */ EGG::CoreController *CoreControllerMgr::getNthController(int n) { - return this->mControllers(n); +/* 0x80499BE0 */ +EGG::CoreController *CoreControllerMgr::getNthController(int n) { + return mControllers(n); } -/* 0x80499C70 */ void *CoreControllerMgr::allocThunk(size_t size) { - return sWPADAllocator->alloc(size); +namespace { + +static Allocator *sAllocator; + +void *alloc(size_t size) { + return sAllocator->alloc(size); } -/* 0x80499C90 */ int CoreControllerMgr::deleteThunk(void *ptr) { - sWPADAllocator->free(ptr); +int free(void *ptr) { + sAllocator->free(ptr); return 1; } -/* 0x80499CD0 */ void CoreControllerMgr::connectCallback(s32 a1, s32 a2) { +} // namespace + +/* 0x80499CD0 */ +void CoreControllerMgr::connectCallback(s32 a1, s32 a2) { int args[] = {a1, a2}; if (sConnectCallback != nullptr) { (sConnectCallback)(args); } } -extern "C" s32 lbl_80574EE8; -// TODO headers -extern "C" void fn_803D9400(void *a, void *b); -extern "C" void fn_803F2040(void *a, int b); -extern "C" void fn_803F26B0(int a, void *b); - -/* 0x80499D10 */ CoreControllerMgr::CoreControllerMgr() { +/* 0x80499D10 */ +CoreControllerMgr::CoreControllerMgr() { const int idxes[] = {0, 1, 2, 3}; if (sUseBuiltinWpadAllocator == false) { - Heap *heap = ExpHeap::create(lbl_80574EE8, BaseSystem::mConfigData->mRootHeapMem2, 0); + Heap *heap = ExpHeap::create(sWPADWorkSize, BaseSystem::mConfigData->mRootHeapMem2, 0); heap->mName = "EGG::CoreControllerMgr"; - sWPADAllocator = new Allocator(heap, 0x20); - fn_803D9400(allocThunk, deleteThunk); + sAllocator = new Allocator(heap, 0x20); + WPADRegisterAllocator(alloc, free); } - fn_803F2040(field_0x20, 0x40); + KPADInitEx(field_0x20, 0x40); beginFrame(); endFrame(); VIWaitForRetrace(); for (int i = 0; i < 4; i++) { - fn_803F26B0(idxes[i], connectCallback); + KPADSetConnectCallback(idxes[i], connectCallback); } - // TODO these allocate calls cause the relevant inline buffer functions to be moved - // from the bottom of the TU to after this ctor. How to fix? mControllers.allocate(4, 0); for (int i = 0; i < 4; i++) { if (sCoreControllerFactory != nullptr) { @@ -232,133 +381,166 @@ extern "C" void fn_803F26B0(int a, void *b); mControllers(i)->mChannelID = idxes[i]; mDevTypes(i) = (eCoreDevType)0xfd; } - field_0x10A0 = 0; + field_0x10A0 = nullptr; } -/* 0x8049A130 */ void CoreControllerMgr::beginFrame() { +/* 0x8049A130 */ +void CoreControllerMgr::beginFrame() { for (int i = 0; i < mControllers.getSize(); ++i) { mControllers(i)->beginFrame(NULL); } } -/* 0x8049A1E0 */ void CoreControllerMgr::endFrame() { +/* 0x8049A1E0 */ +void CoreControllerMgr::endFrame() { for (int i = 0; i < mControllers.mSize; i++) { mControllers(i)->endFrame(); - // TODO WPADprobe - // Update device type after probe? + + WPADDeviceType dev_type; + s32 result = WPADProbe(i, &dev_type); + + WPADDeviceType res_dev_type; + if (result == WPAD_ERR_OK) { + res_dev_type = dev_type; + } else if (result == WPAD_ERR_NO_CONTROLLER) { + res_dev_type = WPAD_DEV_NONE; + } else { + continue; + } + + if (field_0x10A0) { + if (res_dev_type != mDevTypes(i)) { + s32 sp0C[3]; + sp0C[0] = res_dev_type; + sp0C[1] = mDevTypes(i); + sp0C[2] = i; + + field_0x10A0->v_08(sp0C); + } + } + + mDevTypes(i) = (eCoreDevType)res_dev_type; } } -/* 0x8049A3B0 */ void ControllerRumbleUnit::init() { - this->mPattern = nullptr; - this->mPatternPos = nullptr; - this->mTimer = 0; - this->mIntensity = 0.0; - this->mRampUp = 0.0; - this->mFlag.makeAllZero(); +/* 0x8049A3B0 */ +void ControllerRumbleUnit::init() { + mPattern = nullptr; + mPatternPos = nullptr; + mTimer = 0; + mIntensity = 0.0; + mRampUp = 0.0; + mFlag.makeAllZero(); } -/* 0x8049A3E0 */ void ControllerRumbleUnit::startPattern(const char *pattern, int duration) { - this->mPattern = pattern; - this->mPatternPos = pattern; +/* 0x8049A3E0 */ +void ControllerRumbleUnit::startPattern(const char *pattern, int duration) { + mPattern = pattern; + mPatternPos = pattern; - this->mFlag.value &= 0xef; - this->mFlag.value &= 0xdf; + mFlag.value &= 0xef; + mFlag.value &= 0xdf; if (duration < 0) { - this->mFlag.set(0x10); + mFlag.set(0x10); } else if (duration > 0) { - this->mFlag.set(0x30); + mFlag.set(0x30); } - this->mTimer = duration; - this->mFlag.value = ((this->mFlag.value | 0x01) & 0xfd) | 0x8; + mTimer = duration; + + mFlag.setBit(0); + mFlag.resetBit(1); + mFlag.setBit(3); } -/* 0x8049A440 */ f32 ControllerRumbleUnit::calc() { +/* 0x8049A440 */ +f32 ControllerRumbleUnit::calc() { f32 result = 0.0f; - if (this->mFlag.onBit(3)) { - if (this->mFlag.onBit(0)) { - char x = *++this->mPatternPos; + if (mFlag.onBit(3)) { + if (mFlag.onBit(0)) { + char x = *++mPatternPos; if (x == '\0') { - if (this->mFlag.onBit(4)) { - this->mPatternPos = this->mPattern; + if (mFlag.onBit(4)) { + mPatternPos = mPattern; } else { - this->mFlag.reset(~0xf7); + mFlag.resetBit(3); } } else if (x == '*') { result = 1.0f; } - if (this->mFlag.offBit(5)) { + if (mFlag.offBit(5)) { return result; } - if (--this->mTimer > 0) { + if (--mTimer > 0) { return result; } - this->mFlag.reset(~0xf7); + mFlag.resetBit(3); return result; } else { - f32 intensity = this->mIntensity + this->mRampUp; - this->mIntensity = intensity; + f32 intensity = mIntensity + mRampUp; + mIntensity = intensity; if (intensity >= 1.0f) { result = 1.0f; - this->mIntensity = 0.0f; + mIntensity = 0.0f; } - // infinite flag? - if (this->mFlag.onBit(2)) { + if (mFlag.onBit(2)) { return result; } - if (--this->mTimer > 0) { + if (--mTimer > 0) { return result; } } - this->mFlag.reset(~0xf7); + mFlag.resetBit(3); return result; } else { return -1.0f; } } -/* 0x8049A530 */ ControllerRumbleMgr::ControllerRumbleMgr() { - this->mController = nullptr; - // TODO offsetof macro - List_Init(&this->mActiveUnitList, 0x1c); - List_Init(&this->mInactiveUnitList, 0x1c); +/* 0x8049A530 */ +ControllerRumbleMgr::ControllerRumbleMgr() { + mController = nullptr; + List_Init(&mActiveUnitList, offsetof(ControllerRumbleUnit, mNode)); + List_Init(&mInactiveUnitList, offsetof(ControllerRumbleUnit, mNode)); } -/* 0x8049A590 */ void ControllerRumbleMgr::createUnit(u8 numUnits, CoreController *ctrl) { +/* 0x8049A590 */ +void ControllerRumbleMgr::createUnit(u8 numUnits, CoreController *ctrl) { for (u8 created = 0; created < numUnits; created++) { ControllerRumbleUnit *unit = new ControllerRumbleUnit(); - List_Append(&this->mInactiveUnitList, unit); + List_Append(&mInactiveUnitList, unit); } - this->mController = ctrl; + mController = ctrl; } -/* 0x8049A620 */ void ControllerRumbleMgr::stop() { - this->mController->stopMotor(); - while (List_GetSize(&this->mActiveUnitList) != 0) { - ControllerRumbleUnit *unit = static_cast(List_GetNext(&this->mActiveUnitList, nullptr)); - List_Remove(&this->mActiveUnitList, unit); - List_Append(&this->mInactiveUnitList, unit); +/* 0x8049A620 */ +void ControllerRumbleMgr::stop() { + mController->stopMotor(); + while (List_GetSize(&mActiveUnitList) != 0) { + ControllerRumbleUnit *unit = static_cast(List_GetNext(&mActiveUnitList, nullptr)); + List_Remove(&mActiveUnitList, unit); + List_Append(&mInactiveUnitList, unit); } } -/* 0x8049A690 */ void ControllerRumbleMgr::calc() { - if (List_GetSize(&this->mActiveUnitList) != 0) { - void *object = List_GetFirst(&this->mActiveUnitList); +/* 0x8049A690 */ +void ControllerRumbleMgr::calc() { + if (List_GetSize(&mActiveUnitList) != 0) { + void *object = List_GetFirst(&mActiveUnitList); f32 acc = 0.0f; while (object != nullptr) { ControllerRumbleUnit *unit = static_cast(object); f32 x = unit->calc(); - void *nextObject = List_GetNext(&this->mActiveUnitList, object); + void *nextObject = List_GetNext(&mActiveUnitList, object); if (x < 0.0f) { - List_Remove(&this->mActiveUnitList, object); - List_Append(&this->mInactiveUnitList, object); + List_Remove(&mActiveUnitList, object); + List_Append(&mInactiveUnitList, object); } else { acc += x; } @@ -366,28 +548,30 @@ extern "C" void fn_803F26B0(int a, void *b); } if (acc >= 1.0f) { - this->mController->startMotor(); + mController->startMotor(); } else { - this->mController->stopMotor(); + mController->stopMotor(); } } } -/* 0x8049A7A0 */ void ControllerRumbleMgr::startPattern(const char *pattern, int duration, bool bGrabActive) { +/* 0x8049A7A0 */ +void ControllerRumbleMgr::startPattern(const char *pattern, int duration, bool bGrabActive) { EGG::ControllerRumbleUnit *unit = getUnitFromList(bGrabActive); - if (unit != nullptr) { + if (unit) { unit->startPattern(pattern, duration); } } -/* 0x8049A7F0 */ ControllerRumbleUnit *ControllerRumbleMgr::getUnitFromList(bool bGrabActive) { +/* 0x8049A7F0 */ +ControllerRumbleUnit *ControllerRumbleMgr::getUnitFromList(bool bGrabActive) { void *first = List_GetFirst(&this->mInactiveUnitList); - if (first != nullptr) { - List_Remove(&this->mInactiveUnitList, first); - List_Append(&this->mActiveUnitList, first); - } else if (bGrabActive && (first = List_GetFirst(&this->mActiveUnitList), first != nullptr)) { - List_Remove(&this->mActiveUnitList, first); - List_Append(&this->mActiveUnitList, first); + if (first) { + List_Remove(&mInactiveUnitList, first); + List_Append(&mActiveUnitList, first); + } else if (bGrabActive && (first = List_GetFirst(&mActiveUnitList), first != nullptr)) { + List_Remove(&mActiveUnitList, first); + List_Append(&mActiveUnitList, first); } return static_cast(first); diff --git a/src/egg/core/eggDisplay.cpp b/src/egg/core/eggDisplay.cpp index 6fb5b0f5..6a5a75a7 100644 --- a/src/egg/core/eggDisplay.cpp +++ b/src/egg/core/eggDisplay.cpp @@ -1,51 +1,43 @@ #include "egg/core/eggDisplay.h" -#include "nw4r/db/db_directPrint.h" + #include "egg/core/eggXfbManager.h" +#include "nw4r/db/db_directPrint.h" #include "rvl/GX.h" #include "rvl/OS/OSHardware.h" + extern "C" { - void PreRetraceCallback(u32 retraceCount) { - EGG::BaseSystem::getDisplay()->preVRetrace(); - } +void PreRetraceCallback(u32 retraceCount) { + EGG::BaseSystem::getDisplay()->preVRetrace(); } -namespace EGG { +} +namespace EGG { -u32 Display::sTickPeriod = ((OS_BUS_CLOCK_SPEED >> 2)/125000)*300 >> 3; +u32 Display::sTickPeriod = ((OS_BUS_CLOCK_SPEED >> 2) / 125000) * 300 >> 3; -/* 80497570 */ -Display::Display(u8 maxRetrace) : - mMaxRetraces(maxRetrace), - mScreenStateFlag(0), - mRetraceCount(0), - mFrameCount(0), - mClearColor(0x808080ff), - mClearZ(0xFFFFFF), - mBeginTick(0), - mFlag(0) -{ +/* 80497570 */ +Display::Display(u8 maxRetrace) + : mMaxRetraces(maxRetrace), mScreenStateFlag(0), mRetraceCount(0), mFrameCount(0), mClearColor(0x808080ff), + mClearZ(0xFFFFFF), mBeginTick(0), mFlag(0) { mFlag.setBit(mFlag_SetClear); mFlag.setBit(mFlag_WaitForRetrace); nw4r::db::DirectPrint_Init(); VISetPreRetraceCallback(PreRetraceCallback); } -/* vt 0x18 | 804975f0 */ +/* vt 0x18 | 804975f0 */ u32 Display::getTickPerFrame() { return Video::getTickPerVRetrace(); } -/* vt 0x08 | 80497600 */ +/* vt 0x08 | 80497600 */ void Display::beginFrame() { - GXDrawDone(); - if ( - mFlag.onBit(mFlag_WaitForRetrace) - || (BaseSystem::getXfbMgr()->mNumXfbs == 1 - && OSGetTick()-mLastTick > sTickPeriod)) { - VIWaitForRetrace(); + if (mFlag.onBit(mFlag_WaitForRetrace) || + (BaseSystem::getXfbMgr()->mNumXfbs == 1 && OSGetTick() - mLastTick > sTickPeriod)) { + VIWaitForRetrace(); } // Holds while the next XFB gets to its copy state - while (BaseSystem::getXfbMgr()->mToCopyXfb == 0 ) { + while (BaseSystem::getXfbMgr()->mToCopyXfb == 0) { VIWaitForRetrace(); } copyEFBtoXFB(); @@ -53,26 +45,27 @@ void Display::beginFrame() { mFrameCount++; } -/* vt 0x0C | 804976c0 */ +/* vt 0x0C | 804976c0 */ void Display::beginRender() { return; } -/* vt 0x10 | 804976d0 */ +/* vt 0x10 | 804976d0 */ void Display::endRender() { return; -} +} -/* vt 0x14 | 804976e0 */ +/* vt 0x14 | 804976e0 */ void Display::endFrame() { return; } - -/* vt 0x1C | 804976f0 */ +/* vt 0x1C | 804976f0 */ void Display::preVRetrace() { mLastTick = OSGetTick(); - if (VIGetRetraceCount() - mRetraceCount < mMaxRetraces) return; + if (VIGetRetraceCount() - mRetraceCount < mMaxRetraces) { + return; + } if (mScreenStateFlag.onBit(mScreenStateFlag_SetBlack)) { BaseSystem::getVideo()->setBlack(1); mScreenStateFlag.resetBit(mScreenStateFlag_SetBlack); @@ -81,20 +74,20 @@ void Display::preVRetrace() { mRetraceCount = VIGetRetraceCount(); } -/* 804977d0 */ +/* 804977d0 */ void Display::copyEFBtoXFB() { - if (mFlag.onBit(mFlag_SetClear)) { + if (mFlag.onBit(mFlag_SetClear)) { GXSetCopyClear(mClearColor, mClearZ); } - GXRenderModeObj const* renderObj = BaseSystem::getVideo()->pRenderMode; + GXRenderModeObj const *renderObj = BaseSystem::getVideo()->pRenderMode; GXSetCopyFilter(renderObj->aa, renderObj->sample_pattern, renderObj->aa == 0, renderObj->vfilter); BaseSystem::getXfbMgr()->copyEFB(mFlag.onBit(mFlag_SetClear)); } -/* 80497870 */ +/* 80497870 */ void Display::calcFrequency() { s32 endTick = OSGetTick(); - mDeltaTick = endTick-mBeginTick; + mDeltaTick = endTick - mBeginTick; mFrequency = 1000000.0f / ((mDeltaTick * 8) / ((OS_BUS_CLOCK_SPEED >> 2) / 125000)); mBeginTick = endTick; } diff --git a/src/egg/core/eggDvdFile.cpp b/src/egg/core/eggDvdFile.cpp new file mode 100644 index 00000000..d067fdce --- /dev/null +++ b/src/egg/core/eggDvdFile.cpp @@ -0,0 +1,101 @@ +#include + +namespace EGG { + +bool DvdFile::sIsInitialized; +nw4r::ut::List DvdFile::sDvdList; + +void DvdFile::initialize() { + if (!sIsInitialized) { + nw4r::ut::List_Init(&sDvdList, offsetof(DvdFile, mNode)); + sIsInitialized = true; + } +} + +DvdFile::DvdFile() { + initiate(); +} + +DvdFile::~DvdFile() { + close(); +} + +void DvdFile::initiate() { + mFileInfo.dvdFile = this; + OSInitMutex(&mMutex); + OSInitMutex(&mMutexUnused); + OSInitMessageQueue(&mMsgQueue, &mMsg, 1); + OSInitMessageQueue(&mMsgQueueUnsued, &mMsgUnused, 1); + mThread = nullptr; + field_0x38 = 0; +} + +bool DvdFile::open(s32 entryId) { + if (!mIsOpen && entryId != -1) { + s32 res = DVDFastOpen(entryId, &mFileInfo); + mIsOpen = res; + if (mIsOpen) { + nw4r::ut::List_Append(&sDvdList, this); + s32 _status = DVDGetCommandBlockStatus(&mFileInfo.block); + } + } + return mIsOpen; +} + +bool DvdFile::open(const char *path) { + return open(DVDConvertPathToEntrynum(path)); +} + +bool DvdFile::open(const char *path, void *) { + return open(path); +} + +void DvdFile::close() { + if (mIsOpen && DVDClose(&mFileInfo)) { + mIsOpen = false; + nw4r::ut::List_Remove(&sDvdList, this); + } +} + +s32 DvdFile::readData(void *buffer, s32 length, s32 offset) { + OSLockMutex(&mMutex); + if (mThread) { + OSUnlockMutex(&mMutex); + return -1; + } + + mThread = OSGetCurrentThread(); + s32 res = -1; + + if (DVDReadAsyncPrio(&mFileInfo, buffer, length, offset, doneProcess, DVD_PRIO_MEDIUM)) { + res = sync(); + } + + mThread = nullptr; + OSUnlockMutex(&mMutex); + + return res; +} + +s32 DvdFile::writeData(const void *buffer, s32 length, s32 offset) { + return -1; +} + +s32 DvdFile::sync() { + OSMessage msg; + OSLockMutex(&mMutex); + OSReceiveMessage(&mMsgQueue, &msg, OS_MSG_PERSISTENT); + mThread = nullptr; + OSUnlockMutex(&mMutex); + return (s32)(msg); +} + +void DvdFile::doneProcess(s32 result, DVDFileInfo *pFileInfo) { + OSSendMessage(&((FileInfo *)pFileInfo)->dvdFile->mMsgQueue, (OSMessage)result, 0); +} + +u32 DvdFile::getFileSize() const { + return mFileInfo.size; +} + +} // namespace EGG diff --git a/src/egg/core/eggDvdRipper.cpp b/src/egg/core/eggDvdRipper.cpp new file mode 100644 index 00000000..217df265 --- /dev/null +++ b/src/egg/core/eggDvdRipper.cpp @@ -0,0 +1,188 @@ +#include +#include + +namespace EGG { + +bool DvdRipper::sErrorRetry = true; +DvdRipper::UnkCallback DvdRipper::sCallback; + +/* 80494680 */ +u8 *DvdRipper::loadToMainRAM( + s32 entryNum, u8 *dst, Heap *heap, EAllocDirection allocDir, u32 offset, u32 *amountRead, u32 *fileSize +) { + DvdFile file = DvdFile(); + if (!file.open(entryNum)) { + return nullptr; + } + return loadToMainRAM(&file, dst, heap, allocDir, offset, amountRead, fileSize); +} + +/* 80494730 */ +u8 *DvdRipper::loadToMainRAM( + const char *path, u8 *dst, Heap *heap, EAllocDirection allocDir, u32 offset, u32 *amountRead, u32 *fileSize +) { + DvdFile file = DvdFile(); + if (!file.open(path)) { + return nullptr; + } + return loadToMainRAM(&file, dst, heap, allocDir, offset, amountRead, fileSize); +} + +/* 804947e0 */ +u8 *DvdRipper::loadToMainRAM( + DvdFile *pFile, u8 *pOut, Heap *pHeap, EAllocDirection allocDir, u32 offset, u32 *pRead, u32 *pSize +) { + u32 size; + bool memAllocated = false; + u32 alignedSize; + s32 result; + u8 buf[0x40]; + + // msg could be a buffer, it could be a completely different structure, + // there is no good way to know. (callback is never set D: ) + // Issue with the callback argument not being placed on the stack properly + if (sCallback) { + UnkCallback_Arg cb_arg; + cb_arg.UNK_0x04 = 0; + cb_arg.UNK_0x08 = 0; + cb_arg.UNK_0x0C = 1; + cb_arg.UNK_0x10 = 0; + cb_arg.buf = &buf; + sCallback(&cb_arg); + } + + size = pFile->getFileSize(); + if (pSize) { + *pSize = size; + } + alignedSize = nw4r::ut::RoundUp(size, 0x20); + + if (!pOut) { + u32 size = alignedSize - offset; + pOut = (u8 *)Heap::alloc(size, allocDir == ALLOC_DIR_TOP ? 0x20 : -0x20, pHeap); + memAllocated = true; + } + if (pOut == nullptr) { + return nullptr; + } + + if (offset != 0) { + // Fakematch???? This just feels weird + void *ptr = ROUND_UP_PTR(&buf[8], 0x20); + while (true) { + result = DVDReadPrio(&pFile->mFileInfo, ptr, 0x20, offset, DVD_PRIO_MEDIUM); + if (result >= DVD_RESULT_OK) { + break; + } + + if (result == DVD_RESULT_CANCELED || !sErrorRetry) { + if (memAllocated) { + Heap::free(pOut, nullptr); + } + return nullptr; + } + + VIWaitForRetrace(); + } + DCInvalidateRange(ptr, 0x20); + } + while (true) { + result = DVDReadPrio(&pFile->mFileInfo, pOut, alignedSize - offset, offset, DVD_PRIO_MEDIUM); + if (result >= DVD_RESULT_OK) { + break; + } + if (result == DVD_RESULT_CANCELED || !sErrorRetry) { + if (memAllocated) { + Heap::free(pOut, nullptr); + } + return nullptr; + } + VIWaitForRetrace(); + } + if (pRead) { + *pRead = alignedSize - offset; + } + + return pOut; +} + +/* 804949b0 */ +void *DvdRipper::loadToMainRAMDecomp( + DvdFile *file, StreamDecomp *decompressor, u8 *pOut, Heap *heap, EAllocDirection allocDir, s32 offset, u32 size, + u32 chunkSize, u32 *pRead, u32 *pSize +) { + s32 uncomp_align = allocDir == ALLOC_DIR_TOP ? 0x20 : -0x20; + s32 align = allocDir == ALLOC_DIR_TOP ? -0x20 : 0x20; + + // Ouput size of file + s32 file_size = file->getFileSize(); + if (pSize) { + *pSize = file_size; + } + + // Setup amount to read + s32 max_read = ROUND_UP(file->getFileSize(), 0x20) - offset; + if (size != 0) { + max_read = size; + } + + void *read_buffer = heap->alloc(decompressor->getHeaderSize(), align); + + if (!read_buffer) { + return nullptr; + } + + s32 result = DVDReadPrio(&file->mFileInfo, read_buffer, decompressor->getHeaderSize(), offset, DVD_PRIO_MEDIUM); + file_size = decompressor->getHeaderSize(); + + if (result == file_size) { + file_size = decompressor->getUncompressedSize(read_buffer); + } else { + // BUG? - Read buffer never freed + return nullptr; + } + heap->free(read_buffer); + read_buffer = nullptr; + + // Already Read header to get size + if (pRead) { + *pRead = decompressor->getHeaderSize(); + } + + // Ensure decompression space + if (!pOut) { + pOut = (u8 *)heap->alloc(file_size, uncomp_align); + } + + if (!pOut) { + return nullptr; + } + + // Read and decompress the chunks + void *chunk_buffer = heap->alloc(chunkSize, align); + if (chunk_buffer) { + s32 file_size = 0; + decompressor->init(pOut, max_read); + + while (true) { + u32 chunk_size = MIN(max_read - file_size, chunkSize); + u32 chunk_offset = offset + file_size; + + s32 result = + DVDReadPrio(&file->mFileInfo, chunk_buffer, ROUND_UP(chunk_size, 0x20), chunk_offset, DVD_PRIO_MEDIUM); + + if (result < DVD_RESULT_OK || decompressor->decomp(chunk_buffer, result)) { + break; + } + file_size += result; + } + heap->free(chunk_buffer); + if (pRead) { + *pRead = file_size + decompressor->getHeaderSize(); + } + } + + return pOut; +} + +} // namespace EGG diff --git a/src/egg/core/eggExpHeap.cpp b/src/egg/core/eggExpHeap.cpp index 4c7c72c4..96bf38f1 100644 --- a/src/egg/core/eggExpHeap.cpp +++ b/src/egg/core/eggExpHeap.cpp @@ -2,14 +2,14 @@ namespace EGG { -/* 80495ab0 */ ExpHeap::ExpHeap(MEMiHeapHead *heapHandle) : Heap(heapHandle) {} +ExpHeap::ExpHeap(MEMiHeapHead *heapHandle) : Heap(heapHandle) {} -/* 80495af0 */ ExpHeap::~ExpHeap() { +ExpHeap::~ExpHeap() { dispose(); MEMDestroyExpHeap(mHeapHandle); } -/* 80495b70 */ ExpHeap *ExpHeap::create(void *heapStart, size_t size, u16 attr) { +ExpHeap *ExpHeap::create(void *heapStart, size_t size, u16 attr) { ExpHeap *heap = nullptr; void *startAddr = heapStart; void *heapEnd = ROUND_DOWN_PTR((u8 *)heapStart + size, 0x04); @@ -31,7 +31,7 @@ namespace EGG { return heap; } -/* 80495c30 */ ExpHeap *ExpHeap::create(size_t size, Heap *heap, u16 attr) { +ExpHeap *ExpHeap::create(size_t size, Heap *heap, u16 attr) { ExpHeap *newHeap = nullptr; if (heap == nullptr) { heap = sCurrentHeap; @@ -52,7 +52,7 @@ namespace EGG { return newHeap; } -/* 80495d00 */ void ExpHeap::destroy() { +void ExpHeap::destroy() { if (sDestroyCallback != nullptr) { sDestroyCallback(this); } @@ -64,7 +64,7 @@ namespace EGG { } } -/* 80495d90 */ void *ExpHeap::alloc(u32 size, s32 align) { +void *ExpHeap::alloc(u32 size, s32 align) { if (mFlag.onBit(0)) { #line 182 OSError("DAME DAME\n"); @@ -84,7 +84,7 @@ namespace EGG { return ptr; } -/* 80495e50 */ void ExpHeap::free(void *ptr) { +void ExpHeap::free(void *ptr) { if (sFreeCallback != nullptr) { HeapFreeArg arg; arg.userArg = sFreeCallbackArg; @@ -95,26 +95,26 @@ namespace EGG { MEMFreeToExpHeap(mHeapHandle, ptr); } -/* 80495ec0 */ u32 ExpHeap::resizeForMBlock(void *block, u32 size) { +u32 ExpHeap::resizeForMBlock(void *block, u32 size) { return MEMResizeForMBlockExpHeap(mHeapHandle, block, size); } -/* 80495ed0 */ u32 ExpHeap::getTotalFreeSize() { +u32 ExpHeap::getTotalFreeSize() { return MEMGetAllocatableSizeForExpHeap(mHeapHandle); } -/* 80495ee0 */ u32 ExpHeap::getAllocatableSize(s32 align) { +u32 ExpHeap::getAllocatableSize(s32 align) { return MEMGetAllocatableSizeForExpHeapEx(mHeapHandle, align); } -/* 80495d00 */ void ExpHeap::setGroupID(u16 groupId) { +void ExpHeap::setGroupID(u16 groupId) { MEMSetGroupIdForExpHeap(mHeapHandle, groupId); } -/* 80495f00 */ u32 ExpHeap::adjust() { +u32 ExpHeap::adjust() { u32 adjustedSize = MEMAdjustExpHeap(mHeapHandle); - u32 totalSize = adjustedSize + 0x34; - if (totalSize > 0x34) { + u32 totalSize = adjustedSize + sizeof(ExpHeap); + if (totalSize > sizeof(ExpHeap)) { Heap *parent = findParentHeap(); if (parent != nullptr) { parent->resizeForMBlock(mParentBlock, totalSize); @@ -124,11 +124,11 @@ namespace EGG { return 0; } -/* 80495f80 */ u32 ExpHeap::getSizeForMBlock(const void *block) { +u32 ExpHeap::getSizeForMBlock(const void *block) { return MEMGetSizeForMBlockExpHeap(block); } -/* 80495f90 */ Heap::eHeapKind ExpHeap::getHeapKind() const { +Heap::eHeapKind ExpHeap::getHeapKind() const { return HEAP_KIND_EXPANDED; } diff --git a/src/egg/core/eggFrmHeap.cpp b/src/egg/core/eggFrmHeap.cpp new file mode 100644 index 00000000..ad2931d1 --- /dev/null +++ b/src/egg/core/eggFrmHeap.cpp @@ -0,0 +1,112 @@ +#include + +namespace EGG { + +FrmHeap::FrmHeap(MEMiHeapHead *pHead) : Heap(pHead) {} + +FrmHeap::~FrmHeap() { + dispose(); + MEMDestroyFrmHeap(mHeapHandle); +} + +FrmHeap *FrmHeap::create(void *pBlock, u32 size, u16 attr) { + FrmHeap *heap = nullptr; + void *startAddr = pBlock; + void *heapEnd = ROUND_DOWN_PTR((u8 *)pBlock + size, 0x04); + pBlock = ROUND_UP_PTR(pBlock, 0x04); + + if (pBlock > heapEnd || ((u8 *)heapEnd - (u8 *)pBlock) < 0x38u) { + return nullptr; + } + + MEMiHeapHead *head = + MEMCreateFrmHeapEx((u8 *)pBlock + sizeof(FrmHeap), ((u8 *)heapEnd - (u8 *)pBlock) - sizeof(FrmHeap), attr); + if (head != nullptr) { + heap = new (pBlock) FrmHeap(head); + heap->mParentBlock = startAddr; + if (sCreateCallback != nullptr) { + (sCreateCallback)(heap); + } + } + + return heap; +} + +void FrmHeap::destroy() { + if (sDestroyCallback) { + sDestroyCallback(this); + } + + Heap *parent = findParentHeap(); + this->~FrmHeap(); + if (parent) { + parent->free(this); + } +} + +void *FrmHeap::alloc(u32 size, s32 align) { + void *pBlock = MEMAllocFromFrmHeapEx(mHeapHandle, size, align); + if (sAllocCallback) { + HeapAllocArg arg; + arg.userArg = sAllocCallbackArg; + arg.ptr = pBlock; + arg.size = size; + arg.align = align; + arg.heap = this; + sAllocCallback(&arg); + } + return pBlock; +} + +void FrmHeap::free(void *pBlock) { + if (sFreeCallback != nullptr) { + HeapFreeArg arg; + arg.userArg = sFreeCallbackArg; + arg.ptr = pBlock; + arg.heap = this; + (sFreeCallback)(&arg); + } +} + +void FrmHeap::free(s32 flags) { + MEMFreeToFrmHeap(mHeapHandle, flags); +} + +u32 FrmHeap::resizeForMBlock(void *pBlock, u32 size) { + return MEMResizeForMBlockFrmHeap(mHeapHandle, pBlock, size); +} + +u32 FrmHeap::getTotalFreeSize() { + return getAllocatableSize(4); +} + +u32 FrmHeap::getAllocatableSize(s32 align) { + return MEMGetAllocatableSizeForFrmHeapEx(mHeapHandle, align); +} + +u32 FrmHeap::adjust() { + u32 adjustedSize = MEMAdjustFrmHeap(mHeapHandle); + u32 totalSize = adjustedSize + sizeof(FrmHeap); + if (totalSize > sizeof(FrmHeap)) { + Heap *parent = findParentHeap(); + if (parent != nullptr) { + parent->resizeForMBlock(mParentBlock, totalSize); + return totalSize; + } + } + return 0; +} + +void FrmHeap::recordState(u32 id) { + MEMRecordStateForFrmHeap(mHeapHandle, id); +} + +void FrmHeap::freeByState(u32 id) { + MEMFreeByStateToFrmHeap(mHeapHandle, id); +} + +Heap::eHeapKind FrmHeap::getHeapKind() const { + return HEAP_KIND_FRAME; +} + +} // namespace EGG diff --git a/src/egg/core/eggHeap.cpp b/src/egg/core/eggHeap.cpp index 63b9fd7f..a6ebc139 100644 --- a/src/egg/core/eggHeap.cpp +++ b/src/egg/core/eggHeap.cpp @@ -58,8 +58,10 @@ void *Heap::alloc(size_t size, int align, Heap *heap) { heap = currentHeap; } if (heap != sAllocatableHeap) { - OSReport("cannot allocate from heap %x(%s) : allocatable heap is %x(%s)\n", heap, heap->getName(), - sAllocatableHeap, sAllocatableHeap->getName()); + OSReport( + "cannot allocate from heap %x(%s) : allocatable heap is %x(%s)\n", heap, heap->getName(), + sAllocatableHeap, sAllocatableHeap->getName() + ); OSReport("\tthread heap=%x(%s)\n", threadHeap, threadHeap != nullptr ? threadHeap->getName() : "none"); if (sErrorCallback != nullptr) { HeapErrorArg arg; diff --git a/src/egg/core/eggStreamDecomp.cpp b/src/egg/core/eggStreamDecomp.cpp new file mode 100644 index 00000000..1a9e2e5b --- /dev/null +++ b/src/egg/core/eggStreamDecomp.cpp @@ -0,0 +1,209 @@ +#include + +namespace EGG { + +// *********************************** LZ ********************************** // + +bool StreamDecompLZ::init(void *pDest, u32 maxCompressedSize) { + mpDest = pDest; + mMaxCompressedSize = maxCompressedSize; + CXInitUncompContextLZ(&mContext); + return true; +} + +bool StreamDecompLZ::decomp(const void *pSrc, u32 len) { + return CXReadUncompLZ(&mContext, pSrc, len) == CX_READ_OK; +} + +// *********************************** RL ********************************** // + +bool StreamDecompRL::init(void *pDest, u32 maxCompressedSize) { + mpDest = pDest; + mMaxCompressedSize = maxCompressedSize; + CXInitUncompContextRL(&mContext); + return true; +} + +bool StreamDecompRL::decomp(const void *pSrc, u32 len) { + return CXReadUncompRL(&mContext, pSrc, len) == CX_READ_OK; +} + +// *********************************** LH ********************************** // + +bool StreamDecompLH::init(void *pDest, u32 maxCompressedSize) { + mpDest = pDest; + mMaxCompressedSize = maxCompressedSize; + CXInitUncompContextLH(&mContext); + return true; +} + +bool StreamDecompLH::decomp(const void *pSrc, u32 len) { + return CXReadUncompLH(&mContext, pSrc, len) == CX_READ_OK; +} + +// ********************************** LRC ********************************** // + +bool StreamDecompLRC::init(void *pDest, u32 maxCompressedSize) { + mpDest = pDest; + mMaxCompressedSize = maxCompressedSize; + CXInitUncompContextLRC(&mContext); + return true; +} + +bool StreamDecompLRC::decomp(const void *pSrc, u32 len) { + return CXReadUncompLRC(&mContext, pSrc, len) == CX_READ_OK; +} + +// ********************************** SZS ********************************** // + +u32 UncompContextSZS::getUncompressedSize(const void *pSrc) { + const u8 *pData = (u8 *)pSrc; + return (pData[4] << 24) | (pData[5] << 16) | (pData[6] << 8) | (pData[7] << 0); +} + +void UncompContextSZS::initUncompContext(void *pDest) { + mpDest = (u8 *)pDest; + mUncompSize = 0; + mHeaderLen = 0x10; + mMaxUncompSize = 0; + mGroupHead = 0; + mSecondByte = 0; + mFirstByte = 0; + mState = 0; + mCopySrc = 0; +} + +s32 UncompContextSZS::readHeader(u8 *pHeaderLen, s32 *pUncompSize, const u8 *src, u32 maxCompLen, s32 maxUncompSize) { + s32 read_amount = 0; + while (*pHeaderLen != 0) { + (*pHeaderLen)--; + if (*pHeaderLen == 0xF) { + if (*src != (u8)'Y') { + return -1; + } + } else if (*pHeaderLen == 0xE) { + if (*src != (u8)'a') { + return -1; + } + } else if (*pHeaderLen == 0xD) { + if (*src != (u8)'z') { + return -1; + } + } else if (*pHeaderLen == 0xC) { + if (*src != (u8)'0') { + return -1; + } + } else if (*pHeaderLen >= 0x8) { + *pUncompSize |= *src << ((*pHeaderLen - 8) << 3); + } + + maxCompLen--; + src++; + read_amount++; + + if (maxCompLen == 0 && *pHeaderLen != 0) { + return read_amount; + } + } + if (maxUncompSize > 0 && maxUncompSize < *pUncompSize) { + *pUncompSize = maxUncompSize; + } + return read_amount; +} + +s32 UncompContextSZS::readUncomp(const void *pSrca, u32 len) { + const u8 *pSrc = static_cast(pSrca); + if (mHeaderLen != 0) { + s32 read_len = readHeader(&mHeaderLen, &mUncompSize, pSrc, len, mMaxUncompSize); + pSrc += read_len; + len -= read_len; + + if (len == 0) { + if (mHeaderLen == 0) { + return mUncompSize; + } + return CX_READ_ERR_1; + } + } + + while (mUncompSize > 0) { + if (mState == 2) { + u32 num_bytes = *pSrc++ + 0x12; + len--; + if (num_bytes > mUncompSize) { + if (mMaxUncompSize == 0) { + return CX_READ_ERR_4; + } + num_bytes = (u16)mUncompSize; + } + mUncompSize -= num_bytes; + do { + *mpDest = *(mpDest - mCopySrc); + mpDest++; + } while (--num_bytes); + mState = 0; + } else if (mState == 1) { + len--; + u32 b1 = (mFirstByte << 8) | *pSrc++; + u32 num_bytes = b1 >> 12; + mCopySrc = (b1 & 0xFFF) + 1; + + if (num_bytes == 0) { + mState = 2; + } else { + num_bytes += 2; + if (num_bytes > mUncompSize) { + if (mMaxUncompSize == 0) { + return CX_READ_ERR_4; + } + num_bytes = (u16)mUncompSize; + } + mUncompSize -= num_bytes; + do { + *mpDest = *(mpDest - mCopySrc); + mpDest++; + } while (--num_bytes); + mState = 0; + } + } else { + if (mGroupHead == 0) { + len--; + mSecondByte = *pSrc++; + mGroupHead = 0x80; + if (len == 0) { + break; + } + } + if (mSecondByte & mGroupHead) { + *mpDest++ = *pSrc++; + mUncompSize--; + } else { + mFirstByte = *pSrc++; + mState = 1; + } + len--; + mGroupHead >>= 1; + } + if (len == 0) { + break; + } + } + + if (mUncompSize == 0 && mMaxUncompSize == 0 && len > 0x20) { + return CX_READ_ERR_3; + } + return mUncompSize; +} + +bool StreamDecompSZS::init(void *pDest, u32 maxCompressedSize) { + mpDest = pDest; + mMaxCompressedSize = maxCompressedSize; + mContext.initUncompContext(pDest); + return true; +} + +bool StreamDecompSZS::decomp(const void *pSrc, u32 len) { + return mContext.readUncomp((const u8 *)pSrc, len) == CX_READ_OK; +} + +} // namespace EGG diff --git a/src/egg/core/eggThread.cpp b/src/egg/core/eggThread.cpp index 36f44d4d..0179359a 100644 --- a/src/egg/core/eggThread.cpp +++ b/src/egg/core/eggThread.cpp @@ -5,7 +5,6 @@ namespace EGG { /* 80673b10 */ nw4r::ut::List Thread::sThreadList; /* 80576770 */ void (*Thread::sOldSwitchThreadCallback)(OSThread *, OSThread *); - /* 80496910 */ Thread::Thread(u32 stackSize, int msgCount, int priority, Heap *heap) { if (heap == nullptr) { heap = Heap::sCurrentHeap; @@ -86,7 +85,7 @@ namespace EGG { /* 80496c70 */ void Thread::switchThreadCallback(OSThread *from, OSThread *to) { Thread *fromThread = from != nullptr ? findThread(from) : nullptr; Thread *toThread = to != nullptr ? findThread(to) : nullptr; - + if (fromThread != nullptr) { fromThread->onExit(); if (fromThread->mCurrentHeap != nullptr) { @@ -95,7 +94,7 @@ namespace EGG { fromThread->mCurrentHeap = curr; } } - + if (toThread != nullptr) { if (toThread->mCurrentHeap != nullptr) { Heap *curr = Heap::sCurrentHeap; @@ -118,7 +117,7 @@ namespace EGG { } /* 80496dc0 */ void *Thread::start(void *arg) { - Thread *thread = static_cast(arg); + Thread *thread = static_cast(arg); return thread->run(); } diff --git a/src/egg/core/eggVideo.cpp b/src/egg/core/eggVideo.cpp index 76479432..e84f4fec 100644 --- a/src/egg/core/eggVideo.cpp +++ b/src/egg/core/eggVideo.cpp @@ -6,303 +6,305 @@ namespace { const GXRenderModeObj gRMO_Pal60_640x456Prog_16x9 = { - 0, // tvInfo - 640, // fbWidth - 456, // efbHeight - 456, // xfbHeight - 25, // viXOrigin - 12, // viYOrigin - 670, // viWidth - 456, // viHeight - 1, // xfbMode - 0, // field_rendering - 0, // aa - { - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - }, // sample_pattern - {7, 7, 12, 12, 12, 7, 7} // vFilter + 0, // tvInfo + 640, // fbWidth + 456, // efbHeight + 456, // xfbHeight + 25, // viXOrigin + 12, // viYOrigin + 670, // viWidth + 456, // viHeight + 1, // xfbMode + 0, // field_rendering + 0, // aa + { + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + }, // sample_pattern + {7, 7, 12, 12, 12, 7, 7} // vFilter }; const GXRenderModeObj gRMO_Pal60_640x456IntDf_16x9 = { - 2, // tvInfo - 640, // fbWidth - 456, // efbHeight - 456, // xfbHeight - 25, // viXOrigin - 12, // viYOrigin - 670, // viWidth - 456, // viHeight - 0, // xfbMode - 0, // field_rendering - 0, // aa - { - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - }, // sample_pattern - {0, 0, 21, 22, 21, 0, 0} // vFilter + 2, // tvInfo + 640, // fbWidth + 456, // efbHeight + 456, // xfbHeight + 25, // viXOrigin + 12, // viYOrigin + 670, // viWidth + 456, // viHeight + 0, // xfbMode + 0, // field_rendering + 0, // aa + { + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + }, // sample_pattern + {0, 0, 21, 22, 21, 0, 0} // vFilter }; const GXRenderModeObj gRMO_Pal50_640x456IntDf_16x9 = { - 4, // tvInfo - 640, // fbWidth - 456, // efbHeight - 542, // xfbHeight - 27, // viXOrigin - 16, // viYOrigin - 666, // viWidth - 542, // viHeight - 1, // xfbMode - 0, // field_rendering - 0, // aa - { - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - }, // sample_pattern - {7, 7, 12, 12, 12, 7, 7} // vFilter + 4, // tvInfo + 640, // fbWidth + 456, // efbHeight + 542, // xfbHeight + 27, // viXOrigin + 16, // viYOrigin + 666, // viWidth + 542, // viHeight + 1, // xfbMode + 0, // field_rendering + 0, // aa + { + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + }, // sample_pattern + {7, 7, 12, 12, 12, 7, 7} // vFilter }; const GXRenderModeObj gRMO_Ntsc_640x456Prog_16x9 = { - 20, // tvInfo - 640, // fbWidth - 456, // efbHeight - 456, // xfbHeight - 25, // viXOrigin - 12, // viYOrigin - 670, // viWidth - 456, // viHeight - 1, // xfbMode - 0, // field_rendering - 0, // aa - { - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - }, // sample_pattern - {7, 7, 12, 12, 12, 7, 7} // vFilter + 20, // tvInfo + 640, // fbWidth + 456, // efbHeight + 456, // xfbHeight + 25, // viXOrigin + 12, // viYOrigin + 670, // viWidth + 456, // viHeight + 1, // xfbMode + 0, // field_rendering + 0, // aa + { + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + }, // sample_pattern + {7, 7, 12, 12, 12, 7, 7} // vFilter }; const GXRenderModeObj gRMO_Ntsc_640x456IntDf_16x9 = { - 22, // tvInfo - 640, // fbWidth - 456, // efbHeight - 456, // xfbHeight - 25, // viXOrigin - 12, // viYOrigin - 670, // viWidth - 456, // viHeight - 0, // xfbMode - 0, // field_rendering - 0, // aa - { - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - }, // sample_pattern - {0, 0, 21, 22, 21, 0, 0} // vFilter + 22, // tvInfo + 640, // fbWidth + 456, // efbHeight + 456, // xfbHeight + 25, // viXOrigin + 12, // viYOrigin + 670, // viWidth + 456, // viHeight + 0, // xfbMode + 0, // field_rendering + 0, // aa + { + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + }, // sample_pattern + {0, 0, 21, 22, 21, 0, 0} // vFilter }; const GXRenderModeObj gRMO_Pal60_640x456Prog_4x3 = { - 0, // tvInfo - 640, // fbWidth - 456, // efbHeight - 456, // xfbHeight - 17, // viXOrigin - 12, // viYOrigin - 686, // viWidth - 456, // viHeight - 1, // xfbMode - 0, // field_rendering - 0, // aa - { - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - }, // sample_pattern - {7, 7, 12, 12, 12, 7, 7} // vFilter + 0, // tvInfo + 640, // fbWidth + 456, // efbHeight + 456, // xfbHeight + 17, // viXOrigin + 12, // viYOrigin + 686, // viWidth + 456, // viHeight + 1, // xfbMode + 0, // field_rendering + 0, // aa + { + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + }, // sample_pattern + {7, 7, 12, 12, 12, 7, 7} // vFilter }; const GXRenderModeObj gRMO_Pal60_640x456IntDf_4x3 = { - 2, // tvInfo - 640, // fbWidth - 456, // efbHeight - 456, // xfbHeight - 17, // viXOrigin - 12, // viYOrigin - 686, // viWidth - 456, // viHeight - 0, // xfbMode - 0, // field_rendering - 0, // aa - { - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - }, // sample_pattern - {0, 0, 21, 22, 21, 0, 0} // vFilter + 2, // tvInfo + 640, // fbWidth + 456, // efbHeight + 456, // xfbHeight + 17, // viXOrigin + 12, // viYOrigin + 686, // viWidth + 456, // viHeight + 0, // xfbMode + 0, // field_rendering + 0, // aa + { + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + }, // sample_pattern + {0, 0, 21, 22, 21, 0, 0} // vFilter }; const GXRenderModeObj gRMO_Pal50_640x456IntDf_4x3 = { - 4, // tvInfo - 640, // fbWidth - 456, // efbHeight - 542, // xfbHeight - 19, // viXOrigin - 16, // viYOrigin - 682, // viWidth - 542, // viHeight - 1, // xfbMode - 0, // field_rendering - 0, // aa - { - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - }, // sample_pattern - {7, 7, 12, 12, 12, 7, 7} // vFilter + 4, // tvInfo + 640, // fbWidth + 456, // efbHeight + 542, // xfbHeight + 19, // viXOrigin + 16, // viYOrigin + 682, // viWidth + 542, // viHeight + 1, // xfbMode + 0, // field_rendering + 0, // aa + { + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + }, // sample_pattern + {7, 7, 12, 12, 12, 7, 7} // vFilter }; const GXRenderModeObj gRMO_Ntsc_640x456Prog_4x3 = { - 20, // tvInfo - 640, // fbWidth - 456, // efbHeight - 456, // xfbHeight - 17, // viXOrigin - 12, // viYOrigin - 686, // viWidth - 456, // viHeight - 1, // xfbMode - 0, // field_rendering - 0, // aa - { - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - }, // sample_pattern - {7, 7, 12, 12, 12, 7, 7} // vFilter + 20, // tvInfo + 640, // fbWidth + 456, // efbHeight + 456, // xfbHeight + 17, // viXOrigin + 12, // viYOrigin + 686, // viWidth + 456, // viHeight + 1, // xfbMode + 0, // field_rendering + 0, // aa + { + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + }, // sample_pattern + {7, 7, 12, 12, 12, 7, 7} // vFilter }; const GXRenderModeObj gRMO_Ntsc_640x456IntDf_4x3 = { - 22, // tvInfo - 640, // fbWidth - 456, // efbHeight - 456, // xfbHeight - 17, // viXOrigin - 12, // viYOrigin - 686, // viWidth - 456, // viHeight - 0, // xfbMode - 0, // field_rendering - 0, // aa - { - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - {6, 6}, - }, // sample_pattern - {0, 0, 21, 22, 21, 0, 0} // vFilter + 22, // tvInfo + 640, // fbWidth + 456, // efbHeight + 456, // xfbHeight + 17, // viXOrigin + 12, // viYOrigin + 686, // viWidth + 456, // viHeight + 0, // xfbMode + 0, // field_rendering + 0, // aa + { + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + }, // sample_pattern + {0, 0, 21, 22, 21, 0, 0} // vFilter }; } // namespace namespace EGG { -const EGG::Video::RenderModeObjSet renderModes = {{&gRMO_Pal60_640x456Prog_16x9, &gRMO_Pal60_640x456IntDf_16x9, - &gRMO_Pal50_640x456IntDf_16x9, &gRMO_Ntsc_640x456Prog_16x9, &gRMO_Ntsc_640x456IntDf_16x9, - &gRMO_Pal60_640x456Prog_4x3, &gRMO_Pal60_640x456IntDf_4x3, &gRMO_Pal50_640x456IntDf_4x3, - &gRMO_Ntsc_640x456Prog_4x3, &gRMO_Ntsc_640x456IntDf_4x3}}; +const EGG::Video::RenderModeObjSet renderModes = { + {&gRMO_Pal60_640x456Prog_16x9, &gRMO_Pal60_640x456IntDf_16x9, &gRMO_Pal50_640x456IntDf_16x9, + &gRMO_Ntsc_640x456Prog_16x9, &gRMO_Ntsc_640x456IntDf_16x9, &gRMO_Pal60_640x456Prog_4x3, + &gRMO_Pal60_640x456IntDf_4x3, &gRMO_Pal50_640x456IntDf_4x3, &gRMO_Ntsc_640x456Prog_4x3, + &gRMO_Ntsc_640x456IntDf_4x3} +}; /* 80498690 */ void Video::initialize(GXRenderModeObj *obj, const RenderModeObjSet *set) { VIInit(); @@ -362,15 +364,10 @@ f32 itof(u32 n) { bool isNtscLike; switch (tvFormat) { - case VI_TV_FMT_NTSC: - isNtscLike = true; - break; - case VI_TV_FMT_PAL: - case VI_TV_FMT_EURGB60: - isNtscLike = false; - break; - default: - isNtscLike = true; + case VI_TV_FMT_NTSC: isNtscLike = true; break; + case VI_TV_FMT_PAL: + case VI_TV_FMT_EURGB60: isNtscLike = false; break; + default: isNtscLike = true; } if (dtvstatus && pmode) { diff --git a/src/egg/core/eggXfb.cpp b/src/egg/core/eggXfb.cpp index 4347689f..0ea620e4 100644 --- a/src/egg/core/eggXfb.cpp +++ b/src/egg/core/eggXfb.cpp @@ -2,7 +2,6 @@ #include #include - namespace EGG { /* 804989e0 */ void Xfb::init(u16 width, u16 height, Heap *heap) { diff --git a/src/egg/gfx/eggCamera.cpp b/src/egg/gfx/eggCamera.cpp new file mode 100644 index 00000000..980fa65d --- /dev/null +++ b/src/egg/gfx/eggCamera.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggCapTexture.cpp b/src/egg/gfx/eggCapTexture.cpp new file mode 100644 index 00000000..6a0d6b29 --- /dev/null +++ b/src/egg/gfx/eggCapTexture.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggCpuTexture.cpp b/src/egg/gfx/eggCpuTexture.cpp new file mode 100644 index 00000000..1d91d1d0 --- /dev/null +++ b/src/egg/gfx/eggCpuTexture.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggDrawGX.cpp b/src/egg/gfx/eggDrawGX.cpp new file mode 100644 index 00000000..123b5372 --- /dev/null +++ b/src/egg/gfx/eggDrawGX.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggDrawPathBase.cpp b/src/egg/gfx/eggDrawPathBase.cpp new file mode 100644 index 00000000..bbb5a2c0 --- /dev/null +++ b/src/egg/gfx/eggDrawPathBase.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggDrawPathDOF.cpp b/src/egg/gfx/eggDrawPathDOF.cpp new file mode 100644 index 00000000..ff43fac9 --- /dev/null +++ b/src/egg/gfx/eggDrawPathDOF.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggDrawPathUnk1.cpp b/src/egg/gfx/eggDrawPathUnk1.cpp new file mode 100644 index 00000000..5c81e59c --- /dev/null +++ b/src/egg/gfx/eggDrawPathUnk1.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggDrawPathUnk2.cpp b/src/egg/gfx/eggDrawPathUnk2.cpp new file mode 100644 index 00000000..a903174e --- /dev/null +++ b/src/egg/gfx/eggDrawPathUnk2.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggFog.cpp b/src/egg/gfx/eggFog.cpp new file mode 100644 index 00000000..2da4345a --- /dev/null +++ b/src/egg/gfx/eggFog.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggFrustum.cpp b/src/egg/gfx/eggFrustum.cpp new file mode 100644 index 00000000..5c2946fc --- /dev/null +++ b/src/egg/gfx/eggFrustum.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggG3DUtility.cpp b/src/egg/gfx/eggG3DUtility.cpp new file mode 100644 index 00000000..0ba51e9e --- /dev/null +++ b/src/egg/gfx/eggG3DUtility.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggGXUtility.cpp b/src/egg/gfx/eggGXUtility.cpp new file mode 100644 index 00000000..68b6893f --- /dev/null +++ b/src/egg/gfx/eggGXUtility.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggGfxEngine.cpp b/src/egg/gfx/eggGfxEngine.cpp new file mode 100644 index 00000000..98c394b2 --- /dev/null +++ b/src/egg/gfx/eggGfxEngine.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggGlobalDrawState.cpp b/src/egg/gfx/eggGlobalDrawState.cpp new file mode 100644 index 00000000..085467aa --- /dev/null +++ b/src/egg/gfx/eggGlobalDrawState.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggIScnProc.cpp b/src/egg/gfx/eggIScnProc.cpp new file mode 100644 index 00000000..60b81f8e --- /dev/null +++ b/src/egg/gfx/eggIScnProc.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggLight.cpp b/src/egg/gfx/eggLight.cpp new file mode 100644 index 00000000..7e7867df --- /dev/null +++ b/src/egg/gfx/eggLight.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggLightTexture.cpp b/src/egg/gfx/eggLightTexture.cpp new file mode 100644 index 00000000..fb016069 --- /dev/null +++ b/src/egg/gfx/eggLightTexture.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggLightTextureMgr.cpp b/src/egg/gfx/eggLightTextureMgr.cpp new file mode 100644 index 00000000..1d4f43c0 --- /dev/null +++ b/src/egg/gfx/eggLightTextureMgr.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggModelEx.cpp b/src/egg/gfx/eggModelEx.cpp new file mode 100644 index 00000000..9f213d6d --- /dev/null +++ b/src/egg/gfx/eggModelEx.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggPalette.cpp b/src/egg/gfx/eggPalette.cpp new file mode 100644 index 00000000..490c1e9a --- /dev/null +++ b/src/egg/gfx/eggPalette.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggPostEffectBase.cpp b/src/egg/gfx/eggPostEffectBase.cpp new file mode 100644 index 00000000..c26fc8e1 --- /dev/null +++ b/src/egg/gfx/eggPostEffectBase.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggPostEffectBlur.cpp b/src/egg/gfx/eggPostEffectBlur.cpp new file mode 100644 index 00000000..a2094497 --- /dev/null +++ b/src/egg/gfx/eggPostEffectBlur.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggPostEffectMask.cpp b/src/egg/gfx/eggPostEffectMask.cpp new file mode 100644 index 00000000..edd8e1fc --- /dev/null +++ b/src/egg/gfx/eggPostEffectMask.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggPostEffectMaskDOF.cpp b/src/egg/gfx/eggPostEffectMaskDOF.cpp new file mode 100644 index 00000000..67e87a23 --- /dev/null +++ b/src/egg/gfx/eggPostEffectMaskDOF.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggPostEffectSimple.cpp b/src/egg/gfx/eggPostEffectSimple.cpp new file mode 100644 index 00000000..b336e626 --- /dev/null +++ b/src/egg/gfx/eggPostEffectSimple.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggPostEffectUnk1.cpp b/src/egg/gfx/eggPostEffectUnk1.cpp new file mode 100644 index 00000000..395447bb --- /dev/null +++ b/src/egg/gfx/eggPostEffectUnk1.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggPostEffectUnk2.cpp b/src/egg/gfx/eggPostEffectUnk2.cpp new file mode 100644 index 00000000..49c853fe --- /dev/null +++ b/src/egg/gfx/eggPostEffectUnk2.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggScreen.cpp b/src/egg/gfx/eggScreen.cpp new file mode 100644 index 00000000..aec1ceb2 --- /dev/null +++ b/src/egg/gfx/eggScreen.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggScreenEffectBase.cpp b/src/egg/gfx/eggScreenEffectBase.cpp new file mode 100644 index 00000000..ba916c5d --- /dev/null +++ b/src/egg/gfx/eggScreenEffectBase.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggScreenEffectBlur.cpp b/src/egg/gfx/eggScreenEffectBlur.cpp new file mode 100644 index 00000000..1617c385 --- /dev/null +++ b/src/egg/gfx/eggScreenEffectBlur.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggStateEfb.cpp b/src/egg/gfx/eggStateEfb.cpp new file mode 100644 index 00000000..d26203ba --- /dev/null +++ b/src/egg/gfx/eggStateEfb.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggStateGX.cpp b/src/egg/gfx/eggStateGX.cpp new file mode 100644 index 00000000..848ef301 --- /dev/null +++ b/src/egg/gfx/eggStateGX.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggTexture.cpp b/src/egg/gfx/eggTexture.cpp new file mode 100644 index 00000000..32c3707a --- /dev/null +++ b/src/egg/gfx/eggTexture.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggTextureBuffer.cpp b/src/egg/gfx/eggTextureBuffer.cpp new file mode 100644 index 00000000..9c7d9568 --- /dev/null +++ b/src/egg/gfx/eggTextureBuffer.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/gfx/eggUnk1.cpp b/src/egg/gfx/eggUnk1.cpp new file mode 100644 index 00000000..a5a63d35 --- /dev/null +++ b/src/egg/gfx/eggUnk1.cpp @@ -0,0 +1,3 @@ +#include + +namespace EGG {} // namespace EGG diff --git a/src/egg/math/eggVector.cpp b/src/egg/math/eggVector.cpp index f90a7e4c..7b480314 100644 --- a/src/egg/math/eggVector.cpp +++ b/src/egg/math/eggVector.cpp @@ -57,4 +57,4 @@ f32 Vector3f::setLength(f32 len) { return mag; } -} // namespace EGG \ No newline at end of file +} // namespace EGG diff --git a/src/egg/util/eggException.cpp b/src/egg/util/eggException.cpp new file mode 100644 index 00000000..65bab2ae --- /dev/null +++ b/src/egg/util/eggException.cpp @@ -0,0 +1 @@ +#include diff --git a/src/m/m3d/m_shadow.cpp b/src/m/m3d/m_shadow.cpp index 0b26a3b0..750e261a 100644 --- a/src/m/m3d/m_shadow.cpp +++ b/src/m/m3d/m_shadow.cpp @@ -38,7 +38,7 @@ void mShadow_c::drawOpa() { } void mShadow_c::create(int count, u8 unk1, int unk2, u16 texSize, u32 drawOpaPriority, nw4r::g3d::ResMdl mdl, - u32 heapSize) { + u32 heapSize) { // Regswaps mAllocator.attach(mpHeap, 0x20); proc_c::create(&mAllocator, nullptr); @@ -180,7 +180,7 @@ bool mShadow_c::addCircle(mShadowCircle_c *circle, u32 priority, u32 isMdl) { } bool mShadow_c::drawMdl(mShadowCircle_c *circle, u32 priority, scnLeaf_c &mdl, const mQuat_c &quat, mVec3_c &pos, - mColor color, u32 param9, f32 dist) { + mColor color, u32 param9, f32 dist) { if (!addCircle(circle, priority, 1)) { return false; } @@ -213,14 +213,14 @@ static f32 sTexMtx[2][4] = {{1.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f, 0.0f}}; static u32 STEP = 0x2492; static GXColor sColors[] = { - {0xFF, 0x00, 0x00, 0x00}, - {0x00, 0xFF, 0x00, 0x00}, - {0x00, 0x00, 0xFF, 0x00}, - {0x00, 0x00, 0x00, 0x00}, + {0xFF, 0x00, 0x00, 0x00}, + {0x00, 0xFF, 0x00, 0x00}, + {0x00, 0x00, 0xFF, 0x00}, + {0x00, 0x00, 0x00, 0x00}, }; bool mShadow_c::drawTexObj(mShadowCircle_c *circle, u32 priority, const GXTexObj *texObj, const mMtx_c &mtx, - const mQuat_c &quat, mVec3_c &pos, mColor color, u32 param9, f32 dist) { + const mQuat_c &quat, mVec3_c &pos, mColor color, u32 param9, f32 dist) { if (!addCircle(circle, priority, 0)) { return false; } @@ -254,7 +254,7 @@ static void drawSub2(void *data, u8 i) { GXSetTevColor(GX_TEVREG1, nw4r::ut::Color(0, 0, 0, 0x20)); ang = 0; for (int id = GX_TEXCOORD0, idx = GX_TEXMTX0; id < GX_MAX_TEXCOORD; - id += 1, idx += (GX_TEXMTX1 - GX_TEXMTX0), ang += STEP) { + id += 1, idx += (GX_TEXMTX1 - GX_TEXMTX0), ang += STEP) { GXSetTexCoordGen2((GXTexCoordID)id, GX_TG_MTX2x4, GX_TG_TEX0, idx, FALSE, GX_DUALMTX_IDENT); sTexMtx[0][3] = 0.01f * nw4r::math::CosIdx(ang); sTexMtx[1][3] = 0.01f * nw4r::math::SinIdx(ang); @@ -402,7 +402,7 @@ void mShadow_c::drawAllShadows() { void mShadow_c::create(const mShadowCircleConfig *config, nw4r::g3d::ResMdl mdl, EGG::Heap *heap) { mShadow_c::sInstance = new (heap, 0x04) mShadow_c(heap); mShadow_c::sInstance->create(config->count, config->unk1, config->unk2, config->texBufferSize, - config->drawOpaPriority, mdl, config->heapSize); + config->drawOpaPriority, mdl, config->heapSize); } void mShadow_c::beforeDraw() { @@ -425,7 +425,7 @@ void mShadow_c::afterDraw() { void mShadow_c::swapHeaps() { changeHeap(mCurrentHeapIdx + 1); - mpCurrentHeap->freeState(FRM_HEAP_STATE); + mpCurrentHeap->freeByState(FRM_HEAP_STATE); mpCurrentHeap->recordState(FRM_HEAP_STATE); } @@ -506,9 +506,8 @@ void mShadowChild_c::updateMtx() { mVec3_c b = *(mVec3_c *)(&mQuat) - mPositionMaybe * field_0x13C; mMtx_c mtx; C_MTXLookAt(mtx.m, b, - *(fabsf((a.x - b.x) * (a.x - b.x) + (a.z - b.z) * (a.z - b.z)) <= FLT_EPSILON ? &mVec3_c::Ez : - &mVec3_c::Ey), - a); + *(fabsf((a.x - b.x) * (a.x - b.x) + (a.z - b.z) * (a.z - b.z)) <= FLT_EPSILON ? &mVec3_c::Ez : &mVec3_c::Ey), + a); f32 f = field_0x13C; mFrustum.set(f, -f, -f, f, f, f + mOffsetMaybe, mtx, true); } @@ -531,7 +530,7 @@ void mShadowChild_c::drawMdl() { math::MTX34 *viewPosArray = static_cast(mShadow_c::sInstance->mpHeap->alloc(bufSize, 0x20)); g3d::CalcView(viewPosArray, nullptr, mdl->GetWldMtxArray(), mdl->GetWldMtxAttribArray(), - mdl->GetNumViewMtx(), mFrustum.mView, mdl->GetResMdl(), nullptr); + mdl->GetNumViewMtx(), mFrustum.mView, mdl->GetResMdl(), nullptr); DCStoreRange(viewPosArray, bufSize); g3d::ScnMdl *mdl2 = g3d::G3dObj::DynamicCast(lf->getG3dObject()); @@ -539,8 +538,8 @@ void mShadowChild_c::drawMdl() { g3d::DrawResMdlReplacement *pRep = mdl2 ? mdl2->GetDrawResMdlReplacement() : nullptr; g3d::DrawResMdlDirectly(mdl->GetResMdl(), viewPosArray, nullptr, nullptr, - mdl2->GetByteCode(g3d::ScnMdlSimple::BYTE_CODE_DRAW_OPA), nullptr, pRep, - g3d::RESMDL_DRAWMODE_FORCE_LIGHTOFF | g3d::RESMDL_DRAWMODE_IGNORE_MATERIAL); + mdl2->GetByteCode(g3d::ScnMdlSimple::BYTE_CODE_DRAW_OPA), nullptr, pRep, + g3d::RESMDL_DRAWMODE_FORCE_LIGHTOFF | g3d::RESMDL_DRAWMODE_IGNORE_MATERIAL); GXInvalidateVtxCache(); } else { // this happens with bomb bag, and goes to 0x802EDC90 (mCustomShadow_c::draw) diff --git a/src/m/m_dvd.cpp b/src/m/m_dvd.cpp index 8472c878..4587caf1 100644 --- a/src/m/m_dvd.cpp +++ b/src/m/m_dvd.cpp @@ -1,15 +1,12 @@ +#include #include -#include #include #include #include +#include #include #include #include -// clang-format off -// TODO a define in here stomps another header -#include -// clang-format on static int ConvertPathToEntrynum(const char *path, u8 *outType); @@ -31,7 +28,7 @@ mDvd_param_c l_param; // unofficial TUncompressInfo_Base_c *decompressorPtrs[1] = { - &s_UncompressInfoLZ, + &s_UncompressInfoLZ, }; u8 g_mountDirection = 1; @@ -127,8 +124,10 @@ void create(int priority, EGG::Heap *commandHeap, EGG::Heap *archiveHeap, EGG::H } /** 802eef30 */ -static void *loadToMainRAM(int entryNum, char *dst, EGG::Heap *heap, EGG::DvdRipper::EAllocDirection allocDir, - s32 offset, u32 *outAmountRead, u32 *outFileSize, u32 decompressorType) { +static void *loadToMainRAM( + int entryNum, char *dst, EGG::Heap *heap, EGG::DvdRipper::EAllocDirection allocDir, s32 offset, u32 *outAmountRead, + u32 *outFileSize, u32 decompressorType +) { void *result; u32 amountRead = 0; u32 fileSize = 0; @@ -138,8 +137,9 @@ static void *loadToMainRAM(int entryNum, char *dst, EGG::Heap *heap, EGG::DvdRip static EGG::DvdFile DvdFile; DvdFile.open(entryNum); - result = EGG::DvdRipper::loadToMainRAMDecomp(&DvdFile, decomp, (u8 *)dst, heap, allocDir, offset, 0, - maxChunkSize, nullptr, nullptr); + result = EGG::DvdRipper::loadToMainRAMDecomp( + &DvdFile, decomp, (u8 *)dst, heap, allocDir, offset, 0, maxChunkSize, nullptr, nullptr + ); deleteUncompressObj(decompressorType); u32 size = DvdFile.mFileInfo.size; @@ -345,7 +345,8 @@ mDvd_callback_c *mDvd_callback_c::create(dvdReadCallback cb, void *cbData) { /** 802ef650 */ mDvd_callback_c *mDvd_callback_c::createOrFail(dvdReadCallback cb, void *cbData) { mDvd_callback_c *cmd = mDvd_callback_c::create(cb, cbData); - while (!cmd) {} + while (!cmd) { + } return cmd; } @@ -548,8 +549,8 @@ mDvd_toMainRam_arc_c::mDvd_toMainRam_arc_c(EGG::Archive *arc, int entryNum, int } /** 802efda0 */ -mDvd_toMainRam_arc_c *mDvd_toMainRam_arc_c::makeRequest(EGG::Archive *arc, int entryNum, int mountDirection, - EGG::Heap *heap) { +mDvd_toMainRam_arc_c * +mDvd_toMainRam_arc_c::makeRequest(EGG::Archive *arc, int entryNum, int mountDirection, EGG::Heap *heap) { mDvd_toMainRam_arc_c *cmd = new mDvd_toMainRam_arc_c(arc, entryNum, mountDirection); if (cmd != nullptr) { cmd->mHeap = heap; @@ -559,8 +560,8 @@ mDvd_toMainRam_arc_c *mDvd_toMainRam_arc_c::makeRequest(EGG::Archive *arc, int e } /** 802efe20 */ -mDvd_toMainRam_arc_c *mDvd_toMainRam_arc_c::create(EGG::Archive *arc, const char *path, int mountDirection, - EGG::Heap *heap) { +mDvd_toMainRam_arc_c * +mDvd_toMainRam_arc_c::create(EGG::Archive *arc, const char *path, int mountDirection, EGG::Heap *heap) { int entryNum = arc->convertPathToEntryID(path); mDvd_toMainRam_arc_c *cmd = nullptr; if (entryNum != -1) { @@ -570,10 +571,11 @@ mDvd_toMainRam_arc_c *mDvd_toMainRam_arc_c::create(EGG::Archive *arc, const char } /** 802efe90 */ -mDvd_toMainRam_arc_c *mDvd_toMainRam_arc_c::createOrFail(EGG::Archive *arc, const char *path, int mountDirection, - EGG::Heap *heap) { +mDvd_toMainRam_arc_c * +mDvd_toMainRam_arc_c::createOrFail(EGG::Archive *arc, const char *path, int mountDirection, EGG::Heap *heap) { mDvd_toMainRam_arc_c *cmd = mDvd_toMainRam_arc_c::create(arc, path, mountDirection, heap); - while (!cmd) {} + while (!cmd) { + } return cmd; } @@ -613,13 +615,15 @@ mDvd_toMainRam_normal_c *mDvd_toMainRam_normal_c::create(const char *path, int m /** 802f0030 */ mDvd_toMainRam_normal_c *mDvd_toMainRam_normal_c::createOrFail(const char *path, int mountDirection, EGG::Heap *heap) { mDvd_toMainRam_normal_c *cmd = mDvd_toMainRam_normal_c::create(path, mountDirection, heap); - while (!cmd) {} + while (!cmd) { + } return cmd; } /** 802f0060 */ -void mDvd_toMainRam_normal_c::create2(mDvd_toMainRam_normal_c **cmd, const char *path, int mountDirection, - EGG::Heap *heap) { +void mDvd_toMainRam_normal_c::create2( + mDvd_toMainRam_normal_c **cmd, const char *path, int mountDirection, EGG::Heap *heap +) { if (*cmd == nullptr) { *cmd = mDvd_toMainRam_normal_c::create(path, mountDirection, heap); } @@ -634,7 +638,7 @@ u32 mDvd_toMainRam_normal_c::execute() { u32 fileSize; EGG::Heap *heap = mHeap != nullptr ? mHeap : mDvd::l_ArchiveHeap; EGG::DvdRipper::EAllocDirection allocDirection = - mMountDirection == 1 ? EGG::DvdRipper::ALLOC_DIR_TOP : EGG::DvdRipper::ALLOC_DIR_BOTTOM; + mMountDirection == 1 ? EGG::DvdRipper::ALLOC_DIR_TOP : EGG::DvdRipper::ALLOC_DIR_BOTTOM; mDataPtr = mDvd::loadToMainRAM(mEntryNum, 0, heap, allocDirection, 0, &amountRead, &fileSize, mCompressionType2); if (mDataPtr != nullptr) { mAmountRead = amountRead; diff --git a/src/m/m_pad.cpp b/src/m/m_pad.cpp index 3b880d96..d7d67ad1 100644 --- a/src/m/m_pad.cpp +++ b/src/m/m_pad.cpp @@ -18,7 +18,6 @@ static bool s_WPADInfoAvailable[4]; static u32 s_GetWPADInfoInterval = 0; static u32 s_GetWPADInfoCount = 0; - struct PadAdditionalData_t { PadAdditionalData_t() {} ~PadAdditionalData_t() {} @@ -48,7 +47,6 @@ void create() { // (just indexing the arrays normally) // but has an annoying regshuffle void beginPad() { - g_PadFrame++; g_padMg->beginFrame(); @@ -65,7 +63,7 @@ void beginPad() { if (ctl->mFlag.onBit(0)) { // These sort of look like value, first order derivative, and second order derivative // So perhaps value, velocity, acceleration? - EGG::Vector2f pos = ctl->coreStatus[0].getUnk(); + EGG::Vector2f pos = ctl->mCoreStatus[0].getUnk(); EGG::Vector2f v = pos - dat->v1; dat->v1 = pos; dat->v3 = v - dat->v2; @@ -77,12 +75,13 @@ void beginPad() { // Not sure why this checks the controller index against the tick count if (s_GetWPADInfoInterval != 0 && - ((s_GetWPADInfoInterval == 1 || s_GetWPADInfoCount == i) || - (s_GetWPADInfoInterval <= 3 && (s_GetWPADInfoCount & 1) == (i & 1)))) { + ((s_GetWPADInfoInterval == 1 || s_GetWPADInfoCount == i) || + (s_GetWPADInfoInterval <= 3 && (s_GetWPADInfoCount & 1) == (i & 1)))) + { getWPADInfoCB(i); } } else if (*connected) { - ctl->coreStatus->init(); + ctl->mCoreStatus->init(); ctl->sceneReset(); dat->v1.x = 0.0f; dat->v1.y = 0.0f; @@ -113,15 +112,15 @@ void endPad() { } static inline void clear(WPADInfo *info) { - info->field_0x00 = 0; - info->field_0x04 = 0; - info->field_0x08 = 0; - info->field_0x0C = 0; - info->field_0x10 = 0; - info->field_0x14 = false; - info->field_0x15 = false; - info->field_0x16 = false; - info->field_0x17 = false; + info->dpd = FALSE; + info->speaker = FALSE; + info->attach = FALSE; + info->lowBat = FALSE; + info->nearempty = FALSE; + info->battery = 0; + info->led = 0; + info->protocol = 0; + info->firmware = 0; } static void clearWPADInfo(int controller) {