mirror of
https://github.com/SwareJonge/mkdd.git
synced 2024-11-26 23:00:25 +00:00
Update JKRExpandSwitch
This commit is contained in:
parent
ef2538e9a9
commit
14eeabb237
@ -1,9 +1,25 @@
|
||||
#ifndef JSYSTEM_JKRCOMPRESSION_H
|
||||
#define JSYSTEM_JKRCOMPRESSION_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#define JKRCOMPRESSION_NONE 0
|
||||
#define JKRCOMPRESSION_YAY0 1
|
||||
#define JKRCOMPRESSION_YAZ0 2
|
||||
#define JKRCOMPRESSION_ASR 3
|
||||
|
||||
typedef enum JKRExpandSwitch
|
||||
{
|
||||
EXPAND_SWITCH_DEFAULT, /* Do nothing? treated same as 2 */
|
||||
EXPAND_SWITCH_DECOMPRESS, /* Check for compression and decompress */
|
||||
EXPAND_SWITCH_NONE /* Do nothing */
|
||||
} JKRExpandSwitch;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -5,15 +5,9 @@
|
||||
#include <dolphin/dvd.h>
|
||||
#include "JSystem/JKernel/JKRDvdFile.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JKernel/JKRCompression.h"
|
||||
#include "types.h"
|
||||
|
||||
enum JKRExpandSwitch
|
||||
{
|
||||
Switch_0 = 0,
|
||||
Switch_1,
|
||||
Switch_2
|
||||
};
|
||||
|
||||
struct SYaz0Header
|
||||
{
|
||||
u32 signature;
|
||||
|
@ -111,11 +111,11 @@ JKRAramBlock *JKRAram::mainRamToAram(u8 *buf, u32 bufSize, u32 alignedSize, JKRE
|
||||
{
|
||||
JKRAramBlock *block = nullptr;
|
||||
checkOkAddress(buf, bufSize, nullptr, 0);
|
||||
if (expandSwitch == Switch_1)
|
||||
if (expandSwitch == EXPAND_SWITCH_DECOMPRESS)
|
||||
{
|
||||
expandSwitch = (JKRCheckCompressed_noASR(buf) == JKRCOMPRESSION_NONE) ? Switch_0 : Switch_1;
|
||||
expandSwitch = (JKRCheckCompressed_noASR(buf) == JKRCOMPRESSION_NONE) ? EXPAND_SWITCH_DEFAULT : EXPAND_SWITCH_DECOMPRESS;
|
||||
}
|
||||
if (expandSwitch == Switch_1)
|
||||
if (expandSwitch == EXPAND_SWITCH_DECOMPRESS)
|
||||
{
|
||||
u32 expandSize = JKRDecompExpandSize(buf);
|
||||
if (fileSize == 0 || fileSize > expandSize)
|
||||
@ -189,7 +189,7 @@ u8 *JKRAram::aramToMainRam(u32 address, u8 *buf, u32 p3, JKRExpandSwitch expandS
|
||||
checkOkAddress(buf, address, nullptr, 0);
|
||||
|
||||
u32 expandSize;
|
||||
if (expandSwitch == Switch_1)
|
||||
if (expandSwitch == EXPAND_SWITCH_DECOMPRESS)
|
||||
{
|
||||
u8 buffer[64];
|
||||
u8 *bufPtr = (u8 *)ALIGN_NEXT((u32)buffer, 32);
|
||||
|
@ -84,7 +84,7 @@ bool JKRAramArchive::open(long entryNum) {
|
||||
mMountMode = 0;
|
||||
}
|
||||
else {
|
||||
JKRDvdToMainRam(entryNum, (u8 *)mem, Switch_1, 32, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, 0, &mCompression, nullptr);
|
||||
JKRDvdToMainRam(entryNum, (u8 *)mem, EXPAND_SWITCH_DECOMPRESS, 32, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, 0, &mCompression, nullptr);
|
||||
DCInvalidateRange(mem, 32);
|
||||
int alignment = mMountDirection == MOUNT_DIRECTION_HEAD ? 32 : -32;
|
||||
u32 alignedSize = ALIGN_NEXT(mem->file_data_offset, 32);
|
||||
@ -93,7 +93,7 @@ bool JKRAramArchive::open(long entryNum) {
|
||||
mMountMode = 0;
|
||||
}
|
||||
else {
|
||||
JKRDvdToMainRam(entryNum, (u8 *)mArcInfoBlock, Switch_1, alignedSize, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, 32, nullptr, nullptr);
|
||||
JKRDvdToMainRam(entryNum, (u8 *)mArcInfoBlock, EXPAND_SWITCH_DECOMPRESS, alignedSize, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, 32, nullptr, nullptr);
|
||||
DCInvalidateRange(mArcInfoBlock, alignedSize);
|
||||
|
||||
mDirectories = (SDIDirEntry *)((u8 *)mArcInfoBlock + mArcInfoBlock->node_offset);
|
||||
@ -138,7 +138,7 @@ bool JKRAramArchive::open(long entryNum) {
|
||||
mMountMode = 0;
|
||||
}
|
||||
else {
|
||||
JKRDvdToAram(entryNum, mBlock->getAddress(), Switch_1, mem->header_length + mem->file_data_offset, 0, nullptr);
|
||||
JKRDvdToAram(entryNum, mBlock->getAddress(), EXPAND_SWITCH_DECOMPRESS, mem->header_length + mem->file_data_offset, 0, nullptr);
|
||||
}
|
||||
|
||||
}
|
||||
@ -265,11 +265,11 @@ u32 JKRAramArchive::fetchResource_subroutine(u32 srcAram, u32 size, u8 *data, u3
|
||||
{
|
||||
alignedSize = prevAlignedSize;
|
||||
}
|
||||
JKRAramToMainRam(srcAram, data, alignedSize, Switch_0, prevAlignedSize, nullptr, -1, &sizeRef);
|
||||
JKRAramToMainRam(srcAram, data, alignedSize, EXPAND_SWITCH_DEFAULT, prevAlignedSize, nullptr, -1, &sizeRef);
|
||||
return sizeRef;
|
||||
case JKRCOMPRESSION_YAY0:
|
||||
case JKRCOMPRESSION_YAZ0:
|
||||
JKRAramToMainRam(srcAram, data, alignedSize, Switch_1, prevAlignedSize, nullptr, -1, &sizeRef);
|
||||
JKRAramToMainRam(srcAram, data, alignedSize, EXPAND_SWITCH_DECOMPRESS, prevAlignedSize, nullptr, -1, &sizeRef);
|
||||
return sizeRef;
|
||||
default:
|
||||
#line 655
|
||||
@ -290,21 +290,21 @@ u32 JKRAramArchive::fetchResource_subroutine(u32 srcAram, u32 size, JKRHeap *hea
|
||||
#line 677
|
||||
JUT_ASSERT(buffer != 0);
|
||||
|
||||
JKRAramToMainRam(srcAram, buffer, alignedSize, Switch_0, alignedSize, nullptr, -1, nullptr);
|
||||
JKRAramToMainRam(srcAram, buffer, alignedSize, EXPAND_SWITCH_DEFAULT, alignedSize, nullptr, -1, nullptr);
|
||||
*pBuf = buffer;
|
||||
return size;
|
||||
case JKRCOMPRESSION_YAY0:
|
||||
case JKRCOMPRESSION_YAZ0:
|
||||
u8 decompBuf[64];
|
||||
u8 *bufptr = (u8 *)ALIGN_NEXT((u32)decompBuf, 32);
|
||||
JKRAramToMainRam(srcAram, bufptr, sizeof(decompBuf) / 2, Switch_0, 0, nullptr, -1, nullptr);
|
||||
|
||||
JKRAramToMainRam(srcAram, bufptr, sizeof(decompBuf) / 2, EXPAND_SWITCH_DEFAULT, 0, nullptr, -1, nullptr);
|
||||
|
||||
u32 expandSize = ALIGN_NEXT(JKRDecompExpandSize(bufptr), 32);
|
||||
buffer = (u8 *)JKRAllocFromHeap(heap, expandSize, 32);
|
||||
#line 703
|
||||
JUT_ASSERT(buffer);
|
||||
|
||||
JKRAramToMainRam(srcAram, buffer, alignedSize, Switch_1, expandSize, heap, -1, &resSize);
|
||||
JKRAramToMainRam(srcAram, buffer, alignedSize, EXPAND_SWITCH_DECOMPRESS, expandSize, heap, -1, &resSize);
|
||||
*pBuf = buffer;
|
||||
return resSize;
|
||||
default:
|
||||
@ -342,7 +342,7 @@ u32 JKRAramArchive::getExpandedResSize(const void *resource) const
|
||||
u8 buf[64];
|
||||
u8 *bufPtr = (u8 *)ALIGN_NEXT((u32)buf, 32);
|
||||
|
||||
JKRAramToMainRam(fileEntry->mDataOffset + mBlock->getAddress(), bufPtr, sizeof(buf) / 2, Switch_0, 0, nullptr, -1, nullptr);
|
||||
JKRAramToMainRam(fileEntry->mDataOffset + mBlock->getAddress(), bufPtr, sizeof(buf) / 2, EXPAND_SWITCH_DEFAULT, 0, nullptr, -1, nullptr);
|
||||
|
||||
u32 decompExpandSize = JKRDecompExpandSize(bufPtr);
|
||||
const_cast<JKRAramArchive *>(this)->setExpandSize(fileEntry, decompExpandSize);
|
||||
|
@ -83,7 +83,7 @@ bool JKRCompArchive::open(long entryNum) {
|
||||
else {
|
||||
int alignment;
|
||||
|
||||
JKRDvdToMainRam(entryNum, (u8 *)arcHeader, Switch_1, 32, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, 0, &mCompression, nullptr);
|
||||
JKRDvdToMainRam(entryNum, (u8 *)arcHeader, EXPAND_SWITCH_DECOMPRESS, 32, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, 0, &mCompression, nullptr);
|
||||
DCInvalidateRange(arcHeader, 32);
|
||||
|
||||
mSizeOfMemPart = arcHeader->_14;
|
||||
@ -103,7 +103,7 @@ bool JKRCompArchive::open(long entryNum) {
|
||||
}
|
||||
else
|
||||
{
|
||||
JKRDvdToMainRam(entryNum, (u8 *)mArcInfoBlock, Switch_1, (u32)arcHeader->file_data_offset + mSizeOfMemPart,
|
||||
JKRDvdToMainRam(entryNum, (u8 *)mArcInfoBlock, EXPAND_SWITCH_DECOMPRESS, (u32)arcHeader->file_data_offset + mSizeOfMemPart,
|
||||
nullptr, JKRDvdRipper::ALLOC_DIR_TOP, 0x20, nullptr, nullptr);
|
||||
DCInvalidateRange(mArcInfoBlock, (u32)arcHeader->file_data_offset + mSizeOfMemPart);
|
||||
_64 = (u32)mArcInfoBlock + arcHeader->file_data_offset;
|
||||
@ -115,7 +115,7 @@ bool JKRCompArchive::open(long entryNum) {
|
||||
break;
|
||||
}
|
||||
|
||||
JKRDvdToAram(entryNum, mAramPart->getAddress(), Switch_1, arcHeader->header_length + arcHeader->file_data_offset + mSizeOfMemPart, 0, nullptr);
|
||||
JKRDvdToAram(entryNum, mAramPart->getAddress(), EXPAND_SWITCH_DECOMPRESS, arcHeader->header_length + arcHeader->file_data_offset + mSizeOfMemPart, 0, nullptr);
|
||||
}
|
||||
|
||||
mDirectories = (SDIDirEntry*)((u32)mArcInfoBlock + mArcInfoBlock->node_offset);
|
||||
@ -134,7 +134,7 @@ bool JKRCompArchive::open(long entryNum) {
|
||||
mMountMode = 0;
|
||||
}
|
||||
else {
|
||||
JKRDvdToMainRam(entryNum, buf, Switch_2, alignedSize, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, 0, nullptr, nullptr);
|
||||
JKRDvdToMainRam(entryNum, buf, EXPAND_SWITCH_NONE, alignedSize, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, 0, nullptr, nullptr);
|
||||
DCInvalidateRange(buf, alignedSize);
|
||||
u32 expandSize = ALIGN_NEXT(JKRDecompExpandSize(buf), 32);
|
||||
u8 *mem = (u8 *)JKRAllocFromHeap(mHeap, expandSize, -alignment);
|
||||
@ -162,7 +162,7 @@ bool JKRCompArchive::open(long entryNum) {
|
||||
}
|
||||
else {
|
||||
JKRMainRamToAram((u8 *)mem + arcHeader->header_length + arcHeader->file_data_offset + mSizeOfMemPart,
|
||||
mAramPart->getAddress(), mSizeOfAramPart, Switch_0, 0, nullptr, -1, nullptr);
|
||||
mAramPart->getAddress(), mSizeOfAramPart, EXPAND_SWITCH_DEFAULT, 0, nullptr, -1, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -380,12 +380,12 @@ u32 JKRCompArchive::getExpandedResSize(const void *resource) const
|
||||
u8 *bufPtr = (u8 *)ALIGN_NEXT((u32)buf, 32);
|
||||
if ((flags & 0x20) != 0)
|
||||
{
|
||||
JKRAramToMainRam(fileEntry->mDataOffset + mAramPart->mAddress, bufPtr, sizeof(buf) / 2, Switch_0, 0, nullptr, -1, nullptr);
|
||||
JKRAramToMainRam(fileEntry->mDataOffset + mAramPart->mAddress, bufPtr, sizeof(buf) / 2, EXPAND_SWITCH_DEFAULT, 0, nullptr, -1, nullptr);
|
||||
DCInvalidateRange(bufPtr, sizeof(buf) / 2);
|
||||
}
|
||||
else if ((flags & 0x40) != 0)
|
||||
{
|
||||
JKRDvdToMainRam(mEntryNum, bufPtr, Switch_2, sizeof(buf) / 2, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, _6C + fileEntry->mDataOffset, nullptr, nullptr);
|
||||
JKRDvdToMainRam(mEntryNum, bufPtr, EXPAND_SWITCH_NONE, sizeof(buf) / 2, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, _6C + fileEntry->mDataOffset, nullptr, nullptr);
|
||||
DCInvalidateRange(bufPtr, sizeof(buf) / 2);
|
||||
}
|
||||
else {
|
||||
|
@ -97,7 +97,7 @@ JKRADCommand *JKRDvdAramRipper::callCommand_Async(JKRADCommand *command)
|
||||
fileSize = command->_40;
|
||||
}
|
||||
fileSize = ALIGN_NEXT(fileSize, 0x20);
|
||||
if (command->mExpandSwitch == Switch_1)
|
||||
if (command->mExpandSwitch == EXPAND_SWITCH_DECOMPRESS)
|
||||
{
|
||||
u8 buffer[0x40];
|
||||
u8 *bufPtr = (u8 *)ALIGN_NEXT((u32)buffer, 0x20);
|
||||
@ -129,10 +129,10 @@ JKRADCommand *JKRDvdAramRipper::callCommand_Async(JKRADCommand *command)
|
||||
|
||||
if (compression == JKRCOMPRESSION_NONE)
|
||||
{
|
||||
command->mExpandSwitch = Switch_0;
|
||||
command->mExpandSwitch = EXPAND_SWITCH_DEFAULT;
|
||||
}
|
||||
|
||||
if (command->mExpandSwitch == Switch_1)
|
||||
if (command->mExpandSwitch == EXPAND_SWITCH_DECOMPRESS)
|
||||
{
|
||||
if (command->_2C == 0 && command->mBlock == nullptr)
|
||||
{
|
||||
|
@ -82,7 +82,7 @@ bool JKRDvdArchive::open(long entryNum)
|
||||
}
|
||||
else
|
||||
{
|
||||
JKRDvdToMainRam(entryNum, (u8 *)mem, Switch_1, 32, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, 0, &mCompression, nullptr);
|
||||
JKRDvdToMainRam(entryNum, (u8 *)mem, EXPAND_SWITCH_DECOMPRESS, 32, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, 0, &mCompression, nullptr);
|
||||
DCInvalidateRange(mem, 32);
|
||||
int alignment = mMountDirection == MOUNT_DIRECTION_HEAD ? 32 : -32;
|
||||
|
||||
@ -91,7 +91,7 @@ bool JKRDvdArchive::open(long entryNum)
|
||||
mMountMode = 0;
|
||||
}
|
||||
else {
|
||||
JKRDvdToMainRam(entryNum, (u8 *)mArcInfoBlock, Switch_1, mem->mSize, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, 32, nullptr, nullptr);
|
||||
JKRDvdToMainRam(entryNum, (u8 *)mArcInfoBlock, EXPAND_SWITCH_DECOMPRESS, mem->mSize, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, 32, nullptr, nullptr);
|
||||
DCInvalidateRange(mArcInfoBlock, mem->mSize);
|
||||
|
||||
mDirectories = (SDIDirEntry *)((u8 *)mArcInfoBlock + mArcInfoBlock->node_offset);
|
||||
@ -230,7 +230,7 @@ u32 JKRDvdArchive::fetchResource_subroutine(long entryNum, u32 offset, u32 size,
|
||||
{
|
||||
alignedSize = prevAlignedSize;
|
||||
}
|
||||
JKRDvdRipper::loadToMainRAM(entryNum, data, Switch_0, alignedSize, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, offset, nullptr, nullptr);
|
||||
JKRDvdToMainRam(entryNum, data, EXPAND_SWITCH_DEFAULT, alignedSize, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, offset, nullptr, nullptr);
|
||||
DCInvalidateRange(data, alignedSize);
|
||||
return alignedSize;
|
||||
|
||||
@ -238,14 +238,14 @@ u32 JKRDvdArchive::fetchResource_subroutine(long entryNum, u32 offset, u32 size,
|
||||
case JKRCOMPRESSION_YAZ0:
|
||||
u8 buf[64];
|
||||
u8 *bufPtr = (u8 *)ALIGN_NEXT((u32)buf, 32);
|
||||
JKRDvdRipper::loadToMainRAM(entryNum, bufPtr, Switch_2, sizeof(buf) / 2, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, offset, nullptr, nullptr);
|
||||
JKRDvdToMainRam(entryNum, bufPtr, EXPAND_SWITCH_NONE, sizeof(buf) / 2, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, offset, nullptr, nullptr);
|
||||
DCInvalidateRange(bufPtr, sizeof(buf) / 2);
|
||||
u32 expandFileSize = JKRDecompExpandSize(bufPtr);
|
||||
alignedSize = ALIGN_NEXT(expandFileSize, 32);
|
||||
if (alignedSize > prevAlignedSize) {
|
||||
alignedSize = prevAlignedSize;
|
||||
}
|
||||
JKRDvdRipper::loadToMainRAM(entryNum, data, Switch_1, alignedSize, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, offset, nullptr, nullptr);
|
||||
JKRDvdToMainRam(entryNum, data, EXPAND_SWITCH_DECOMPRESS, alignedSize, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, offset, nullptr, nullptr);
|
||||
DCInvalidateRange(data, alignedSize);
|
||||
return expandFileSize;
|
||||
}
|
||||
@ -255,7 +255,7 @@ u32 JKRDvdArchive::fetchResource_subroutine(long entryNum, u32 offset, u32 size,
|
||||
{
|
||||
size = prevAlignedSize;
|
||||
}
|
||||
JKRDvdRipper::loadToMainRAM(entryNum, data, Switch_1, size, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, offset, nullptr, nullptr);
|
||||
JKRDvdRipper::loadToMainRAM(entryNum, data, EXPAND_SWITCH_DECOMPRESS, size, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, offset, nullptr, nullptr);
|
||||
DCInvalidateRange(data, size);
|
||||
return size;
|
||||
}
|
||||
@ -288,7 +288,7 @@ u32 JKRDvdArchive::fetchResource_subroutine(long entryNum, u32 offset, u32 size,
|
||||
#line 675
|
||||
JUT_ASSERT(buffer != 0);
|
||||
|
||||
JKRDvdToMainRam(entryNum, buffer, Switch_0, alignedSize, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, offset, nullptr, nullptr);
|
||||
JKRDvdToMainRam(entryNum, buffer, EXPAND_SWITCH_DEFAULT, alignedSize, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, offset, nullptr, nullptr);
|
||||
DCInvalidateRange(buffer, alignedSize);
|
||||
*pBuf = buffer;
|
||||
return alignedSize;
|
||||
@ -297,7 +297,7 @@ u32 JKRDvdArchive::fetchResource_subroutine(long entryNum, u32 offset, u32 size,
|
||||
case JKRCOMPRESSION_YAZ0:
|
||||
u8 decompBuf[64];
|
||||
u8 *bufptr = (u8*)ALIGN_NEXT((u32)decompBuf, 32);
|
||||
JKRDvdToMainRam(entryNum, bufptr, Switch_2, sizeof(decompBuf) / 2, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, offset, nullptr, nullptr);
|
||||
JKRDvdToMainRam(entryNum, bufptr, EXPAND_SWITCH_NONE, sizeof(decompBuf) / 2, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, offset, nullptr, nullptr);
|
||||
DCInvalidateRange(bufptr, 0x20);
|
||||
|
||||
alignedSize = JKRDecompExpandSize(bufptr);
|
||||
@ -306,7 +306,7 @@ u32 JKRDvdArchive::fetchResource_subroutine(long entryNum, u32 offset, u32 size,
|
||||
#line 715
|
||||
JUT_ASSERT(buffer);
|
||||
|
||||
JKRDvdToMainRam(entryNum, buffer, Switch_1, alignedSize, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, offset, nullptr, nullptr);
|
||||
JKRDvdToMainRam(entryNum, buffer, EXPAND_SWITCH_DECOMPRESS, alignedSize, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, offset, nullptr, nullptr);
|
||||
DCInvalidateRange(buffer, alignedSize);
|
||||
*pBuf = buffer;
|
||||
return alignedSize;
|
||||
@ -317,7 +317,7 @@ u32 JKRDvdArchive::fetchResource_subroutine(long entryNum, u32 offset, u32 size,
|
||||
buffer = (u8 *)JKRAllocFromHeap(heap, alignedSize, 32);
|
||||
#line 735
|
||||
JUT_ASSERT(buffer);
|
||||
JKRDvdToMainRam(entryNum, buffer, Switch_1, size, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, offset, nullptr, nullptr);
|
||||
JKRDvdToMainRam(entryNum, buffer, EXPAND_SWITCH_DECOMPRESS, size, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, offset, nullptr, nullptr);
|
||||
DCInvalidateRange(buffer, size);
|
||||
*pBuf = buffer;
|
||||
return alignedSize;
|
||||
@ -365,7 +365,7 @@ u32 JKRDvdArchive::getExpandedResSize(const void *resource) const
|
||||
u8 buf[64];
|
||||
u8 *bufPtr = (u8 *)ALIGN_NEXT((u32)buf, 32);
|
||||
|
||||
JKRDvdToMainRam(mEntryNum, bufPtr, Switch_2, sizeof(buf) / 2, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, _64 + fileEntry->mDataOffset, nullptr, nullptr);
|
||||
JKRDvdToMainRam(mEntryNum, bufPtr, EXPAND_SWITCH_NONE, sizeof(buf) / 2, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, _64 + fileEntry->mDataOffset, nullptr, nullptr);
|
||||
DCInvalidateRange(bufPtr, sizeof(buf) / 2);
|
||||
|
||||
u32 decompExpandSize = JKRDecompExpandSize(bufPtr);
|
||||
|
@ -63,7 +63,7 @@ namespace JKRDvdRipper
|
||||
u8 *mem = nullptr;
|
||||
|
||||
fileSizeAligned = ALIGN_NEXT(jkrDvdFile->getFileSize(), 32);
|
||||
if (expandSwitch == Switch_1)
|
||||
if (expandSwitch == EXPAND_SWITCH_DECOMPRESS)
|
||||
{
|
||||
u8 buffer[0x40];
|
||||
u8 *bufPtr = (u8 *)ALIGN_NEXT((u32)buffer, 32);
|
||||
@ -87,7 +87,7 @@ namespace JKRDvdRipper
|
||||
if (pCompression)
|
||||
*pCompression = (int)compression;
|
||||
|
||||
if (expandSwitch == Switch_1 && compression != JKRCOMPRESSION_NONE)
|
||||
if (expandSwitch == EXPAND_SWITCH_DECOMPRESS && compression != JKRCOMPRESSION_NONE)
|
||||
{
|
||||
if (fileSize != 0 && expandSize > fileSize)
|
||||
{
|
||||
@ -155,7 +155,7 @@ namespace JKRDvdRipper
|
||||
|
||||
compression2 = JKRCheckCompressed_noASR(bufPtr);
|
||||
}
|
||||
if ((compression2 == JKRCOMPRESSION_NONE || expandSwitch == Switch_2) || expandSwitch == Switch_0)
|
||||
if ((compression2 == JKRCOMPRESSION_NONE || expandSwitch == EXPAND_SWITCH_NONE) || expandSwitch == EXPAND_SWITCH_DEFAULT)
|
||||
{
|
||||
s32 size = fileSizeAligned - startOffset;
|
||||
if (fileSize != 0 && fileSize < size)
|
||||
|
@ -74,7 +74,7 @@ bool JKRMemArchive::open(s32 entryNum, JKRArchive::EMountDirection mountDirectio
|
||||
{
|
||||
u32 loadedSize;
|
||||
mArcHeader = (SArcHeader *)JKRDvdRipper::loadToMainRAM(
|
||||
entryNum, nullptr, Switch_1, 0, mHeap, JKRDvdRipper::ALLOC_DIR_TOP,
|
||||
entryNum, nullptr, EXPAND_SWITCH_DECOMPRESS, 0, mHeap, JKRDvdRipper::ALLOC_DIR_TOP,
|
||||
0, (int *)&mCompression, &loadedSize);
|
||||
if (mArcHeader)
|
||||
{
|
||||
@ -85,7 +85,7 @@ bool JKRMemArchive::open(s32 entryNum, JKRArchive::EMountDirection mountDirectio
|
||||
{
|
||||
u32 loadedSize;
|
||||
mArcHeader = (SArcHeader *)JKRDvdRipper::loadToMainRAM(
|
||||
entryNum, nullptr, Switch_1, 0, mHeap,
|
||||
entryNum, nullptr, EXPAND_SWITCH_DECOMPRESS, 0, mHeap,
|
||||
JKRDvdRipper::ALLOC_DIR_BOTTOM, 0, (int *)&mCompression, &loadedSize);
|
||||
if (mArcHeader)
|
||||
{
|
||||
|
@ -511,10 +511,10 @@ namespace ResMgr
|
||||
|
||||
char path[0x40];
|
||||
snprintf(path, sizeof(path), "/CourseName/%s/%s_name.bti", KartLocale::getLanguageName(), getCrsArcName(msCourseID));
|
||||
mspCourseName = JKRDvdToMainRam(path, nullptr, Switch_0, 0, mspCourseHeap, JKRDvdRipper::ALLOC_DIR_TOP, 0, nullptr, nullptr);
|
||||
mspCourseName = JKRDvdToMainRam(path, nullptr, EXPAND_SWITCH_DEFAULT, 0, mspCourseHeap, JKRDvdRipper::ALLOC_DIR_TOP, 0, nullptr, nullptr);
|
||||
|
||||
snprintf(path, sizeof(path), "/StaffGhosts/%s.ght", getCrsArcName(msCourseID));
|
||||
mspStaffGhost = JKRDvdToMainRam(path, nullptr, Switch_0, 0, mspCourseHeap, JKRDvdRipper::ALLOC_DIR_TOP, 0, nullptr, nullptr);
|
||||
mspStaffGhost = JKRDvdToMainRam(path, nullptr, EXPAND_SWITCH_DEFAULT, 0, mspCourseHeap, JKRDvdRipper::ALLOC_DIR_TOP, 0, nullptr, nullptr);
|
||||
|
||||
if (msCourseID == LUIGI_CIRCUIT && gRaceInfo.getRaceLevel() != LVL_50CC)
|
||||
{
|
||||
|
@ -59,8 +59,8 @@ namespace System {
|
||||
JKRSolidHeap *mspAudioHeap;
|
||||
|
||||
void startAudioTask(void*) {
|
||||
void *audioFile = JKRDvdRipper::loadToMainRAM("AudioRes/GCKart.baa", nullptr, Switch_1,
|
||||
0, SequenceApp::mspSequenceApp->getHeap(), JKRDvdRipper::ALLOC_DIR_BOTTOM, 0, nullptr, nullptr);
|
||||
void *audioFile = JKRDvdRipper::loadToMainRAM("AudioRes/GCKart.baa", nullptr, EXPAND_SWITCH_DECOMPRESS,
|
||||
0, SequenceApp::mspSequenceApp->getHeap(), JKRDvdRipper::ALLOC_DIR_BOTTOM, 0, nullptr, nullptr);
|
||||
GetGameAudioMain()->init(mspAudioHeap, SystemData::scAudioAramSize, audioFile, 0, 0);
|
||||
delete audioFile;
|
||||
gSystemRecord.applyAudioSetting();
|
||||
|
Loading…
Reference in New Issue
Block a user