From fe65cd6b88269aacaa4365e901ee1542eafa4e7f Mon Sep 17 00:00:00 2001 From: shibbo Date: Sat, 12 Nov 2022 03:38:57 -0500 Subject: [PATCH] TPL 100% --- include/Game/Enemy/AnimScaleController.h | 19 ++++++++- libs/RVL_SDK/check.py | 2 +- libs/RVL_SDK/csv/tpl.csv | 4 +- libs/RVL_SDK/data/SDK.json | 2 +- libs/RVL_SDK/docs/PROGRESS.md | 4 +- libs/RVL_SDK/docs/lib/mem.md | 4 +- libs/RVL_SDK/docs/lib/tpl.md | 6 +-- libs/RVL_SDK/include/revolution/gx/GXEnum.h | 8 ++++ libs/RVL_SDK/include/revolution/tpl.h | 41 +++++++++++++++++++ libs/RVL_SDK/source/revolution/TPL.c | 37 +++++++++++++++++ .../RVL_SDK/source/revolution/dsp/dsp_debug.c | 3 +- 11 files changed, 116 insertions(+), 14 deletions(-) create mode 100644 libs/RVL_SDK/include/revolution/tpl.h create mode 100644 libs/RVL_SDK/source/revolution/TPL.c diff --git a/include/Game/Enemy/AnimScaleController.h b/include/Game/Enemy/AnimScaleController.h index 344fa796..83d8ec86 100644 --- a/include/Game/Enemy/AnimScaleController.h +++ b/include/Game/Enemy/AnimScaleController.h @@ -3,7 +3,24 @@ #include "JSystem/JGeometry.h" #include "Game/System/NerveExecutor.h" -class AnimScaleParam; +class AnimScaleParam { +public: + AnimScaleParam(); + + f32 _0; + f32 _4; + f32 _8; + f32 _C; + f32 _10; + f32 _14; + f32 _18; + f32 _1C; + f32 _20; + f32 _24; + f32 _28; + u32 _2C; + f32 _30; +}; class AnimScaleController : public NerveExecutor { public: diff --git a/libs/RVL_SDK/check.py b/libs/RVL_SDK/check.py index 55a3f8ce..a44bcbb8 100644 --- a/libs/RVL_SDK/check.py +++ b/libs/RVL_SDK/check.py @@ -220,7 +220,7 @@ def check_symbol(function_library, mangled_symbol, obj_name, readonly): print(f"Library {library} is currently not supported.") return False - obj_files = glob.glob(f"build/*/{library}/{obj_name}", recursive=True) + obj_files = glob.glob(f"build/**/{obj_name}", recursive=True) if len(obj_files) > 1: print("Found multiple .o files. This should not happen.") diff --git a/libs/RVL_SDK/csv/tpl.csv b/libs/RVL_SDK/csv/tpl.csv index 8b3aafab..4ced3200 100644 --- a/libs/RVL_SDK/csv/tpl.csv +++ b/libs/RVL_SDK/csv/tpl.csv @@ -1,3 +1,3 @@ Symbol Name, Object File, Library Archive, Matching -TPLBind,TPL.o,tpl.a,false -TPLGet,TPL.o,tpl.a,false +TPLBind,TPL.o,tpl.a,true +TPLGet,TPL.o,tpl.a,true diff --git a/libs/RVL_SDK/data/SDK.json b/libs/RVL_SDK/data/SDK.json index 71306253..42963b9b 100644 --- a/libs/RVL_SDK/data/SDK.json +++ b/libs/RVL_SDK/data/SDK.json @@ -1,6 +1,6 @@ { "schemaVersion": 1, "label": "SDK", - "message": "1.1788394883175823%", + "message": "1.2305812532728226%", "color": "blue" } \ No newline at end of file diff --git a/libs/RVL_SDK/docs/PROGRESS.md b/libs/RVL_SDK/docs/PROGRESS.md index 80048a5c..f27b4a1b 100644 --- a/libs/RVL_SDK/docs/PROGRESS.md +++ b/libs/RVL_SDK/docs/PROGRESS.md @@ -17,7 +17,7 @@ | [gd](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/gd.md) | 0.0% | | [gx](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/gx.md) | 3.0502169869807814% | | [ipc](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/ipc.md) | 0.0% | -| [mem](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/mem.md) | 9.312638580931264% | +| [mem](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/mem.md) | 9.977827050997783% | | [mtx](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/mtx.md) | 0.0% | | [nand](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/nand.md) | 0.0% | | [net](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/net.md) | 0.0% | @@ -27,7 +27,7 @@ | [sc](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/sc.md) | 0.0% | | [si](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/si.md) | 0.0% | | [thp](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/thp.md) | 0.0% | -| [tpl](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/tpl.md) | 0.0% | +| [tpl](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/tpl.md) | 100.0% | | [usb](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/usb.md) | 0.0% | | [vf](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/vf.md) | 0.0% | | [vi](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/vi.md) | 0.0% | diff --git a/libs/RVL_SDK/docs/lib/mem.md b/libs/RVL_SDK/docs/lib/mem.md index 548863b9..d06c4876 100644 --- a/libs/RVL_SDK/docs/lib/mem.md +++ b/libs/RVL_SDK/docs/lib/mem.md @@ -11,7 +11,7 @@ | mem_heapCommon.o | 0.0% | 0 / 3 | 0.0% | :x: | mem_expHeap.o | 0.0% | 0 / 9 | 0.0% | :x: | mem_allocator.o | 100.0% | 5 / 5 | 100.0% | :white_check_mark: -| mem_list.o | 91.30434782608695% | 3 / 4 | 75.0% | :eight_pointed_black_star: +| mem_list.o | 100.0% | 4 / 4 | 100.0% | :white_check_mark: # mem_heapCommon.o @@ -49,7 +49,7 @@ # mem_list.o | Symbol | Decompiled? | | ------------- | ------------- | -| MEMInitList | :x: | +| MEMInitList | :white_check_mark: | | MEMAppendListObject | :white_check_mark: | | MEMRemoveListObject | :white_check_mark: | | MEMGetNextListObject | :white_check_mark: | diff --git a/libs/RVL_SDK/docs/lib/tpl.md b/libs/RVL_SDK/docs/lib/tpl.md index 68895316..5402f5ff 100644 --- a/libs/RVL_SDK/docs/lib/tpl.md +++ b/libs/RVL_SDK/docs/lib/tpl.md @@ -8,13 +8,13 @@ | Object | Percentage (of Bytes) | Functions Done / Total Functions | Percentage (Functions) | Status | ------------- | ------------- | ------------- | ------------- | ------------- -| TPL.o | 0.0% | 0 / 2 | 0.0% | :x: +| TPL.o | 100.0% | 2 / 2 | 100.0% | :white_check_mark: # TPL.o | Symbol | Decompiled? | | ------------- | ------------- | -| TPLBind | :x: | -| TPLGet | :x: | +| TPLBind | :white_check_mark: | +| TPLGet | :white_check_mark: | diff --git a/libs/RVL_SDK/include/revolution/gx/GXEnum.h b/libs/RVL_SDK/include/revolution/gx/GXEnum.h index 0f15843f..b2a3f4d7 100644 --- a/libs/RVL_SDK/include/revolution/gx/GXEnum.h +++ b/libs/RVL_SDK/include/revolution/gx/GXEnum.h @@ -730,6 +730,14 @@ typedef enum _GXCopyMode { GX_COPY_INTLC_ODD = 3 } GXCopyMode; +typedef enum _GXTlutFmt { + GX_TL_IA8 = 0x0, + GX_TL_RGB565 = 0x1, + GX_TL_RGB5A3 = 0x2, + GX_MAX_TLUTFMT + +} GXTlutFmt; + #ifdef __cplusplus } #endif diff --git a/libs/RVL_SDK/include/revolution/tpl.h b/libs/RVL_SDK/include/revolution/tpl.h new file mode 100644 index 00000000..682bd403 --- /dev/null +++ b/libs/RVL_SDK/include/revolution/tpl.h @@ -0,0 +1,41 @@ +#pragma once + +#include "revolution/gx.h" + +typedef struct { + u16 numEntries; + u8 unpacked; + u8 _4; + GXTlutFmt format; + char* data; +} TPLClutHeader, *TPLClutHeaderPtr; + +typedef struct { + u16 height; + u16 width; + u32 format; + char* data; + GXTexWrapMode wrapS; + GXTexWrapMode wrapT; + GXTexFilter minFilter; + GXTexFilter magFilter; + f32 LODBias; + u8 edgeLODEnable; + u8 minLOD; + u8 maxLOD; + u8 unpacked; +} TPLHeader, *TPLHeaderPtr; + +typedef struct { + TPLHeaderPtr textureHeader; + TPLClutHeaderPtr CLUTHeader; +} TPLDescriptor, *TPLDescriptorPtr; + +typedef struct { + u32 versionNumber; + u32 numDescriptors; + TPLDescriptorPtr descriptorArray; +} TPLPalette, *TPLPalettePtr; + +void TPLBind(TPLPalettePtr); +TPLDescriptorPtr TPLGet(TPLPalettePtr, u32); \ No newline at end of file diff --git a/libs/RVL_SDK/source/revolution/TPL.c b/libs/RVL_SDK/source/revolution/TPL.c new file mode 100644 index 00000000..84f8a6b9 --- /dev/null +++ b/libs/RVL_SDK/source/revolution/TPL.c @@ -0,0 +1,37 @@ +#include "revolution/tpl.h" +#include "revolution/os.h" + +void TPLBind(TPLPalettePtr ptr) { + u16 i; + + if (ptr->versionNumber != 2142000) { + OSPanic(__FILE__, 0x19, "invalid version number for texture palette"); + } + + ptr->descriptorArray = (TPLDescriptorPtr)(((u32)(ptr->descriptorArray)) + ((u32)ptr)); + + for (i = 0; i < ptr->numDescriptors; i++) { + if (ptr->descriptorArray[i].textureHeader) { + ptr->descriptorArray[i].textureHeader = (TPLHeaderPtr)(((u32)(ptr->descriptorArray[i].textureHeader)) + ((u32)ptr)); + + if (!ptr->descriptorArray[i].textureHeader->unpacked) { + ptr->descriptorArray[i].textureHeader->data = (char*)((u32)(ptr->descriptorArray[i].textureHeader->data) + (u32)ptr); + ptr->descriptorArray[i].textureHeader->unpacked = 1; + } + } + + if (ptr->descriptorArray[i].CLUTHeader) { + ptr->descriptorArray[i].CLUTHeader = (TPLClutHeaderPtr)((u32)(ptr->descriptorArray[i].CLUTHeader) + (u32)ptr); + + if (!ptr->descriptorArray[i].CLUTHeader->unpacked) { + ptr->descriptorArray[i].CLUTHeader->data = (char*)((u32)(ptr->descriptorArray[i].CLUTHeader->data) + (u32)ptr); + ptr->descriptorArray[i].CLUTHeader->unpacked = 1; + } + } + } +} + +TPLDescriptorPtr TPLGet(TPLPalettePtr ptr, u32 id) { + id %= ptr->numDescriptors; + return &ptr->descriptorArray[id]; +} \ No newline at end of file diff --git a/libs/RVL_SDK/source/revolution/dsp/dsp_debug.c b/libs/RVL_SDK/source/revolution/dsp/dsp_debug.c index ee60896b..592aee20 100644 --- a/libs/RVL_SDK/source/revolution/dsp/dsp_debug.c +++ b/libs/RVL_SDK/source/revolution/dsp/dsp_debug.c @@ -1,6 +1,5 @@ #include -#include -#include +#include void __DSP_debug_printf(char *pFormat, ...) { // oops. code was probably #ifdef'd out at some point