diff options
Diffstat (limited to '')
-rw-r--r-- | NewerProject.yaml | 1 | ||||
-rw-r--r-- | compression.yaml | 18 | ||||
-rw-r--r-- | kamek_ntsc.x | 14 | ||||
-rw-r--r-- | kamek_ntsc2.x | 14 | ||||
-rw-r--r-- | kamek_pal.x | 14 | ||||
-rw-r--r-- | kamek_pal2.x | 14 | ||||
-rw-r--r-- | src/compression.S | 127 |
7 files changed, 202 insertions, 0 deletions
diff --git a/NewerProject.yaml b/NewerProject.yaml index 4d33bbe..b3248b1 100644 --- a/NewerProject.yaml +++ b/NewerProject.yaml @@ -19,3 +19,4 @@ modules: - processed/growup.yaml
- processed/levelspecial.yaml
- processed/eventlooper.yaml
+ - processed/compression.yaml
diff --git a/compression.yaml b/compression.yaml new file mode 100644 index 0000000..9d3a058 --- /dev/null +++ b/compression.yaml @@ -0,0 +1,18 @@ +--- +source_files: [../src/compression.S] +hooks: + - name: InitialiseEverything + type: branch_insn + branch_type: b + src_addr_pal: 0x8015BC70 + target_func: 'InitCompression' + + - name: GetFileEntrynumNew + type: branch_insn + branch_type: b + src_addr_pal: 0x8016BD70 + target_func: 'GetFileEntrynumNew' + + - name: FixStreamingLHDecompression + type: nop_insn + area_pal: 0x801D7884 diff --git a/kamek_ntsc.x b/kamek_ntsc.x index 6e28956..f9a3800 100644 --- a/kamek_ntsc.x +++ b/kamek_ntsc.x @@ -343,6 +343,16 @@ SECTIONS { load__12dDvdLoader_cFPCcUcPv = 0x8008F1B0; unload__12dDvdLoader_cFv = 0x8008F310; + SZSDecompClass = 0x80377AE4; + LZDecompClass = 0x80377AF0; + LHDecompClass = 0x80377AFC; + LRCDecompClass = 0x80377B08; + RLDecompClass = 0x80377B14; + StoreCompressionClassList = 0x8016B090; + DecompBufferPointer = 0x80429460; + + TryAndFindCompressedFile = 0x8016BAA0; + _Z22BgTexMng__LoadAnimTilePvisPcS0_c = 0x80087B60; /* same for ntsc */ BgTexMng__LoadAnimTile__FPvisPcPcc = 0x80087B60; /* same for ntsc */ @@ -416,6 +426,8 @@ SECTIONS { AllocFromGameHeap1__FUi = 0x801628C0; FreeFromGameHeap1__FPv = 0x80162920; + AllocFromGameHeap1 = 0x801628C0; + _Z19lyt__Layout__LayoutPv = 0x802ACB40; _Z15lyt__Layout__dtPvi = 0x802ACB80; _Z18lyt__Layout__BuildPvPKvS_ = 0x802ACCB0; @@ -446,6 +458,8 @@ SECTIONS { DVDReadPrio__FP9DVDHandlePviii = 0x801CAB20; DVDClose__FP9DVDHandle = 0x801CAA00; + DVDConvertPathToEntrynum = 0x801CA680; + _ZN8SaveFile8GetBlockEi = 0x800E0380; _ZN8SaveFile10GetQSBlockEi = 0x800E03B0; diff --git a/kamek_ntsc2.x b/kamek_ntsc2.x index 075d868..8af9cc3 100644 --- a/kamek_ntsc2.x +++ b/kamek_ntsc2.x @@ -343,6 +343,16 @@ SECTIONS { load__12dDvdLoader_cFPCcUcPv = 0x8008F1B0; unload__12dDvdLoader_cFv = 0x8008F310; + SZSDecompClass = 0x80377AE4; + LZDecompClass = 0x80377AF0; + LHDecompClass = 0x80377AFC; + LRCDecompClass = 0x80377B08; + RLDecompClass = 0x80377B14; + StoreCompressionClassList = 0x8016B090; + DecompBufferPointer = 0x80429460; + + TryAndFindCompressedFile = 0x8016BAA0; + _Z22BgTexMng__LoadAnimTilePvisPcS0_c = 0x80087B60; /* same for ntsc */ BgTexMng__LoadAnimTile__FPvisPcPcc = 0x80087B60; /* same for ntsc */ @@ -416,6 +426,8 @@ SECTIONS { AllocFromGameHeap1__FUi = 0x801628C0; FreeFromGameHeap1__FPv = 0x80162920; + AllocFromGameHeap1 = 0x801628C0; + _Z19lyt__Layout__LayoutPv = 0x802ACB40; _Z15lyt__Layout__dtPvi = 0x802ACB80; _Z18lyt__Layout__BuildPvPKvS_ = 0x802ACCB0; @@ -446,6 +458,8 @@ SECTIONS { DVDReadPrio__FP9DVDHandlePviii = 0x801CAB20; DVDClose__FP9DVDHandle = 0x801CAA00; + DVDConvertPathToEntrynum = 0x801CA680; + _ZN8SaveFile8GetBlockEi = 0x800E0380; _ZN8SaveFile10GetQSBlockEi = 0x800E03B0; diff --git a/kamek_pal.x b/kamek_pal.x index 72cce55..720c71b 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -343,6 +343,16 @@ SECTIONS { load__12dDvdLoader_cFPCcUcPv = 0x8008F1B0;
unload__12dDvdLoader_cFv = 0x8008F310;
+ SZSDecompClass = 0x80377DE4;
+ LZDecompClass = 0x80377DF0;
+ LHDecompClass = 0x80377DFC;
+ LRCDecompClass = 0x80377E08;
+ RLDecompClass = 0x80377E14;
+ StoreCompressionClassList = 0x8016B1D0;
+ DecompBufferPointer = 0x80429758;
+
+ TryAndFindCompressedFile = 0x8016BBE0;
+
_Z22BgTexMng__LoadAnimTilePvisPcS0_c = 0x80087B60; /* same for ntsc */
BgTexMng__LoadAnimTile__FPvisPcPcc = 0x80087B60; /* same for ntsc */
@@ -416,6 +426,8 @@ SECTIONS { AllocFromGameHeap1__FUi = 0x80162A00;
FreeFromGameHeap1__FPv = 0x80162A60;
+ AllocFromGameHeap1 = 0x80162A00;
+
_Z19lyt__Layout__LayoutPv = 0x802ACC80;
_Z15lyt__Layout__dtPvi = 0x802ACCC0;
_Z18lyt__Layout__BuildPvPKvS_ = 0x802ACDF0;
@@ -446,6 +458,8 @@ SECTIONS { DVDReadPrio__FP9DVDHandlePviii = 0x801CAC60;
DVDClose__FP9DVDHandle = 0x801CAB40;
+ DVDConvertPathToEntrynum = 0x801CA7C0;
+
_ZN8SaveFile8GetBlockEi = 0x800E0470;
_ZN8SaveFile10GetQSBlockEi = 0x800E04A0;
diff --git a/kamek_pal2.x b/kamek_pal2.x index 3136527..8f6ff14 100644 --- a/kamek_pal2.x +++ b/kamek_pal2.x @@ -343,6 +343,16 @@ SECTIONS { load__12dDvdLoader_cFPCcUcPv = 0xDEADBEEF; unload__12dDvdLoader_cFv = 0xDEADBEEF; + SZSDecompClass = 0xDEADBEEF; + LZDecompClass = 0xDEADBEEF; + LHDecompClass = 0xDEADBEEF; + LRCDecompClass = 0xDEADBEEF; + RLDecompClass = 0xDEADBEEF; + StoreCompressionClassList = 0xDEADBEEF; + DecompBufferPointer = 0xDEADBEEF; + + TryAndFindCompressedFile = 0xDEADBEEF; + _Z22BgTexMng__LoadAnimTilePvisPcS0_c = 0xDEADBEEF; /* same for ntsc */ BgTexMng__LoadAnimTile__FPvisPcPcc = 0xDEADBEEF; /* same for ntsc */ @@ -416,6 +426,8 @@ SECTIONS { AllocFromGameHeap1__FUi = 0xDEADBEEF; FreeFromGameHeap1__FPv = 0xDEADBEEF; + AllocFromGameHeap1 = 0xDEADBEEF; + _Z19lyt__Layout__LayoutPv = 0xDEADBEEF; _Z15lyt__Layout__dtPvi = 0xDEADBEEF; _Z18lyt__Layout__BuildPvPKvS_ = 0xDEADBEEF; @@ -446,6 +458,8 @@ SECTIONS { DVDReadPrio__FP9DVDHandlePviii = 0xDEADBEEF; DVDClose__FP9DVDHandle = 0xDEADBEEF; + DVDConvertPathToEntrynum = 0xDEADBEEF; + _ZN8SaveFile8GetBlockEi = 0xDEADBEEF; _ZN8SaveFile10GetQSBlockEi = 0xDEADBEEF; diff --git a/src/compression.S b/src/compression.S new file mode 100644 index 0000000..dfa2894 --- /dev/null +++ b/src/compression.S @@ -0,0 +1,127 @@ +.text +.align 4 +.set sp, 1 + +#ifndef __MWERKS__ +.set r0,0; .set r1,1; .set r2,2; .set r3,3; .set r4,4 +.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9 +.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14 +.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19 +.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24 +.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29 +.set r30,30; .set r31,31; .set f0,0; .set f2,2; .set f3,3 +.set f1,1; .set f30,30; .set f31,31 +#endif + +.extern StoreCompressionClassList + +.extern SZSDecompClass +.extern LZDecompClass +.extern LHDecompClass +.extern LRCDecompClass +.extern RLDecompClass + +.extern DecompBufferPointer + +.extern AllocFromGameHeap1 +.extern OSReport + +.extern TryAndFindCompressedFile +.extern DVDConvertPathToEntrynum + +.global InitCompression +InitCompression: + stwu sp, -0x10(sp) + mflr r0 + stw r0, 0x14(sp) + # -- Prolog + + lis r3, CMsg@h + ori r3, r3, CMsg@l + crclr 4*cr1+eq + bl OSReport + + lis r3, CCCL@h + ori r3, r3, CCCL@l + lis r4, CCCL_End@h + ori r4, r4, CCCL_End@l + bl StoreCompressionClassList + + # Allocate a buffer for decompression stuff + li r3, 0x8B4 + bl AllocFromGameHeap1 + lis r4, DecompBufferPointer@h + ori r4, r4, DecompBufferPointer@l + stw r3, 0(r4) + + mr r4, r3 + lis r3, CMsg2@h + ori r3, r3, CMsg2@l + crclr 4*cr1+eq + bl OSReport + + # -- Epilog + li r3, 1 + lwz r0, 0x14(sp) + mtlr r0 + addi sp, sp, 0x10 + blr + + +.global GetFileEntrynumNew +GetFileEntrynumNew: + stwu sp, -0x20(sp) + mflr r0 + stw r0, 0x24(sp) + stw r31, 0x1C(sp) + stw r30, 0x18(sp) + stw r29, 0x14(sp) + # Compression Type pointer (byte*) + mr r30, r4 + # Filename + mr r29, r3 + + # first, try compression + # don't bother checking 5278, it's always on in NSMBW anyway + bl TryAndFindCompressedFile + cmpwi r3, -1 + bne returnEntrynum + + # didn't find it, so try the normal version + mr r3, r29 + bl DVDConvertPathToEntrynum + # return value gets passed through + + cmpwi r30, 0 + beq returnEntrynum + li r0, 0 + stb r0, 0(r30) + +returnEntrynum: + lwz r31, 0x1C(sp) + lwz r30, 0x18(sp) + lwz r29, 0x14(sp) + lwz r0, 0x24(sp) + mtlr r0 + addi sp, sp, 0x20 + blr + + +.data +CCCL: + .long LHDecompClass + .long LZDecompClass +CCCL_End: + .long 0 + +CMsg: + .string "Setting up fancy decompression!\n" + +CMsg2: + .string "Buffer: %p\n" + +.align 4 + + + + |