From 5ecfe0da7173d4c096203f1bb40f0daddbce5b80 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sun, 29 Oct 2023 12:13:52 -0700 Subject: [PATCH] JKRDvdAramRipper match --- configure.py | 2 +- include/JSystem/JKernel/JKRDecomp.h | 2 +- src/JSystem/JKernel/JKRDvdAramRipper.cpp | 22 ++++++++++++++-------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/configure.py b/configure.py index 21e9fe5ea..1b725fbcc 100644 --- a/configure.py +++ b/configure.py @@ -787,7 +787,7 @@ config.libs = [ Object(Matching, "JSystem/JKernel/JKRFile.cpp"), Object(NonMatching, "JSystem/JKernel/JKRDvdFile.cpp"), Object(Matching, "JSystem/JKernel/JKRDvdRipper.cpp"), - Object(NonMatching, "JSystem/JKernel/JKRDvdAramRipper.cpp"), + Object(NonMatching, "JSystem/JKernel/JKRDvdAramRipper.cpp", extra_cflags=["-sym off"]), Object(Matching, "JSystem/JKernel/JKRDecomp.cpp"), ], ), diff --git a/include/JSystem/JKernel/JKRDecomp.h b/include/JSystem/JKernel/JKRDecomp.h index c4b9c949a..e62482184 100644 --- a/include/JSystem/JKernel/JKRDecomp.h +++ b/include/JSystem/JKernel/JKRDecomp.h @@ -67,7 +67,7 @@ inline JKRCompression JKRCheckCompressed(u8 *pBuf) { } inline u32 JKRDecompExpandSize(u8* pBuf) { - return (pBuf[4] << 0x18) | (pBuf[5] << 0x10) | (pBuf[6] << 8) | pBuf[7]; + return (pBuf[4] << 24) | (pBuf[5] << 16) | (pBuf[6] << 8) | pBuf[7]; } #endif /* JKRDECOMP_H */ diff --git a/src/JSystem/JKernel/JKRDvdAramRipper.cpp b/src/JSystem/JKernel/JKRDvdAramRipper.cpp index d70020ecd..262a723d6 100644 --- a/src/JSystem/JKernel/JKRDvdAramRipper.cpp +++ b/src/JSystem/JKernel/JKRDvdAramRipper.cpp @@ -79,7 +79,6 @@ JSUList JKRDvdAramRipper::sDvdAramAsyncList; /* 802BDBFC-802BDF34 .text callCommand_Async__16JKRDvdAramRipperFP12JKRADCommand */ JKRADCommand* JKRDvdAramRipper::callCommand_Async(JKRADCommand* command) { - /* Nonmatching */ s32 compression; s32 uncompressedSize; bool bVar1 = true; @@ -116,7 +115,8 @@ JKRADCommand* JKRDvdAramRipper::callCommand_Async(JKRADCommand* command) { DCInvalidateRange(bufPtr, 0x20); compression = JKRCheckCompressed(bufPtr); - uncompressedSize = JKRDecompExpandSize(bufPtr); + u32 expandSize = JKRDecompExpandSize(bufPtr); + uncompressedSize = expandSize; if (command->field_0x18 && uncompressedSize > command->field_0x18) { uncompressedSize = command->field_0x18; } @@ -277,9 +277,15 @@ static int JKRDecompressFromDVDToAram(JKRDvdFile* dvdFile, u32 param_1, u32 file /* 802BE34C-802BE5C0 .text decompSZS_subroutine__FPUcUl */ static int decompSZS_subroutine(u8* src, u32 dest) { u32 endAddr; - s32 validBitCount = 0; - u32 currCodeByte = 0; - u32 startDest = dest; + u8* copySource; + s32 validBitCount; + u32 currCodeByte; + s32 numBytes; + u32 startDest; + + validBitCount = 0; + currCodeByte = 0; + startDest = dest; if (src[0] != 'Y' || src[1] != 'a' || src[2] != 'z' || src[3] != '0') { return -1; @@ -319,10 +325,10 @@ static int decompSZS_subroutine(u8* src, u32 dest) { src++; readCount++; } else { - u32 dist = src[1] | (src[0] & 0x0f) << 8; - s32 numBytes = src[0] >> 4; + u32 dist = ((src[0] & 0x0F) << 8) | src[1]; + numBytes = src[0] >> 4; src += 2; - u8* copySource = refCurrent - dist - 1; + copySource = refCurrent - dist - 1; if (copySource < refBuf) { copySource += refEnd - refBuf; }