Misc. JKR progress. (#74)

This commit is contained in:
SodiumChlorideLogic 2022-09-18 16:16:40 -04:00 committed by GitHub
parent 165b8d603b
commit 96382f9cb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 1701 additions and 2435 deletions

View File

@ -1,6 +1,7 @@
#ifndef _JSYSTEM_JKR_ARAM_H
#define _JSYSTEM_JKR_ARAM_H
#include "Dolphin/os.h"
#include "JSystem/JKR/JKRArchive.h"
#include "JSystem/JKR/JKRThread.h"
#include "JSystem/JKR/JKRDvdRipper.h"
@ -15,7 +16,7 @@ struct JKRDecompCommand;
struct JKRAramBlock {
JKRAramBlock(u32, u32, u32, u8, bool);
virtual ~JKRAramBlock(); // _00
virtual ~JKRAramBlock(); // _08
JKRAramBlock* allocHead(u32, u8, JKRAramHeap*);
JKRAramBlock* allocTail(u32, u8, JKRAramHeap*);
@ -33,8 +34,8 @@ struct JKRAramHeap : public JKRDisposer {
JKRAramHeap(u32, u32);
virtual ~JKRAramHeap(); // _00
// virtual void _04() = 0;
virtual ~JKRAramHeap(); // _08
// virtual void _0C() = 0;
JKRAramBlock* alloc(u32, EAllocMode);
JKRAramBlock* allocFromHead(u32);
@ -53,8 +54,8 @@ struct JKRAramHeap : public JKRDisposer {
struct JKRAram : public JKRThread {
JKRAram(u32, u32, long);
virtual ~JKRAram(); // _00
virtual void run(); // _04
virtual ~JKRAram(); // _08
virtual void* run(); // _0C
static JKRAram* create(u32, u32, long, long, long);
static JKRAramBlock* mainRamToAram(u8*, u32, u32, JKRExpandSwitch, u32, JKRHeap*, s32, u32*);
@ -70,15 +71,17 @@ struct JKRAram : public JKRThread {
JKRAramHeap* m_aramHeap; // _94
u32 m_blockLength; // _98
u8 _9C[4]; // _9C
static JKRAram* sAramObject;
};
struct JKRAramArchive : public JKRArchive {
JKRAramArchive(long, EMountDirection);
virtual ~JKRAramArchive(); // _00
virtual long getExpandedResSize(const void*) const; // _34
virtual u32 fetchResource(SDIFileEntry*, u32*); // _38
virtual void* fetchResource(void*, u32, SDIFileEntry*, u32*); // _3C
virtual ~JKRAramArchive(); // _08
virtual u32 getExpandedResSize(const void*) const; // _3C
virtual void* fetchResource(SDIFileEntry*, u32*); // _40
virtual void* fetchResource(void*, u32, SDIFileEntry*, u32*); // _44
bool open(long);
void fetchResource_subroutine(u32, u32, u8*, u32, s32);
@ -145,8 +148,8 @@ typedef struct JKRAramStreamCommand {
};
struct JKRAramStream : public JKRThread {
virtual ~JKRAramStream(); // _00
virtual void run(); // _04
virtual ~JKRAramStream(); // _08
virtual void* run(); // _0C
// _00 VTBL
@ -172,4 +175,6 @@ void sendCommand(JKRAMCommand*);
void startDMA(JKRAMCommand*);
} // namespace JKRAramPiece
extern OSMutexObject decompMutex;
#endif

View File

@ -6,18 +6,35 @@
#include "JSystem/JKR/JKRHeap.h"
#include "types.h"
struct JKRArcFinder;
struct JKRArchive : public JKRFileLoader {
enum EMountMode { EMM_Unk0 = 0, EMM_Unk1, EMM_Unk2, EMM_Unk4 = 4 };
enum EMountMode { EMM_Unk0 = 0, EMM_Mem, EMM_Aram, EMM_Dvd, EMM_Comp = 4 };
enum EMountDirection { EMD_Unk0 = 0, EMD_Unk1, EMD_Unk2 };
struct CArcName {
CArcName(const char**, char);
/**
* @reifiedAddress{8001A92C}
* @reifiedFile{JSystem/JKR/JKRArchivePri.cpp}
*/
CArcName(const char** p1, char p2) { p1[0] = store(p1[0], p2); }
const char* getString() const;
u16 getHash() const;
/**
* @reifiedAddress{8001A970}
* @reifiedFile{JSystem/JKR/JKRArchivePri.cpp}
*/
const char* getString() const { return m_string; }
/**
* @reifiedAddress{8001A978}
* @reifiedFile{JSystem/JKR/JKRArchivePri.cpp}
*/
u16 getHash() const { return m_hash; }
void store(const char*);
char* store(const char*, char);
// Unused/inlined:
CArcName() { }
u16 m_hash; // _00
short _02; // _02
char m_string[256]; // _04
@ -28,8 +45,22 @@ struct JKRArchive : public JKRFileLoader {
u16 m_hash; // _02
u32 _04; // _04
int _08; // _08
int m_size; // _0C
int _10; // _10
u32 m_size; // _0C
void* _10; // _10
/**
* @fabricated
*/
inline bool getFlag04() { return _04 >> 0x18 & 0x04; }
/**
* @fabricated
*/
inline bool getFlag80() { return _04 >> 0x18 & 0x80; }
/**
* @fabricated
* Seems particularly important for fetchResource__13JKRDvdArchiveFPvUlPQ210JKRArchive12SDIFileEntryPUl.
*/
inline u32 getSize() { return m_size; }
};
struct SDirEntry {
@ -37,29 +68,40 @@ struct JKRArchive : public JKRFileLoader {
u8 _01; // _01
u16 _02; // _02
char* _04; // _04
u8 _08[8]; // _08
u8 _08[2]; // _08
u16 _0A; // _0A
int _0C; // _0C
};
struct JKRArchive_44 {
u32 m_baseOffset; // _00
u32 m_offsetOfDirEntry; // _04
u32 _08; // _08
u32 m_offsetOfFileEntry; // _0C
u32 _10; // _10
u32 _14; // _14
};
JKRArchive(long, EMountMode);
virtual ~JKRArchive(); // _00
// virtual void unmount(); // _04
virtual bool becomeCurrent(const char*); // _08
virtual void* getResource(const char*); // _0C
virtual void* getResource(unsigned long, const char*); // _10
virtual u32 readResource(void*, unsigned long, const char*); // _14
virtual u32 readResource(void*, unsigned long, unsigned long, const char*); // _18
virtual void removeResourceAll(); // _1C
virtual bool removeResource(void*); // _20
virtual bool detachResource(void*); // _24
virtual long getResSize(const void*) const; // _28
virtual int countFile(const char*) const; // _2C
virtual unkptr getFirstFile(const char*) const; // _30
virtual long getExpandedResSize(const void*) const; // _34
virtual u32 fetchResource(SDIFileEntry*, u32*) = 0; // _38
virtual void* fetchResource(void*, u32, SDIFileEntry*, u32*) = 0; // _3C
virtual void setExpandSize(SDIFileEntry*, unsigned long); // _40
virtual void getExpandSize(SDIFileEntry*) const; // _44
virtual bool becomeCurrent(const char*); // _08
virtual void* getResource(const char*); // _0C
virtual void* getResource(u32, const char*); // _10
virtual u32 readResource(void*, u32, const char*); // _14
virtual u32 readResource(void*, u32, u32, const char*); // _18
virtual void removeResourceAll(); // _1C
virtual bool removeResource(void*); // _20
virtual bool detachResource(void*); // _24
virtual long getResSize(const void*) const; // _28
virtual u16 countFile(const char*) const; // _2C
virtual JKRFileFinder* getFirstFile(const char*) const; // _30
virtual u32 getExpandedResSize(const void*) const; // _34
virtual void* fetchResource(SDIFileEntry* entry, u32* outSize) = 0; // _38
virtual void* fetchResource(void* resourceBuffer, u32 bufferSize, SDIFileEntry* entry, u32* resSize) = 0; // _3C
virtual void setExpandSize(SDIFileEntry*, u32); // _40
virtual u32 getExpandSize(SDIFileEntry*) const; // _44
SDirEntry* findDirectory(const char*, u32) const;
SDIFileEntry* findFsResource(const char*, u32) const;
@ -70,41 +112,88 @@ struct JKRArchive : public JKRFileLoader {
SDIFileEntry* findTypeResource(u32, const char*) const;
bool isSameName(CArcName&, u32, u16) const;
bool getDirEntry(JKRArchive::SDirEntry*, unsigned long) const;
void* getGlbResource(unsigned long, const char*, JKRArchive*);
void* getIdxResource(unsigned long);
unknown readResource(void*, unsigned long, unsigned short);
bool getDirEntry(SDirEntry*, u32) const;
void* getGlbResource(u32 type, const char* name, JKRArchive* archive);
void* getIdxResource(u32);
unknown readResource(void*, u32, unsigned short);
static JKRArchive* mount(char const*, EMountMode, JKRHeap*, EMountDirection);
static JKRArchive* mount(void*, JKRHeap*, EMountDirection);
static JKRArchive* mount(long, EMountMode, JKRHeap*, EMountDirection);
JKRHeap* _38; // _38
u8 m_mountMode; // _3C
u32 : 0;
// Unused/inlined:
JKRArchive();
JKRArchive(const char* p1, EMountMode mountMode);
static JKRArchive* check_mount_already(long);
static JKRArchive* check_mount_already(long, JKRHeap*);
SDirEntry* findResType(u32) const;
SDIFileEntry* findTypeResource(u32, u32) const;
JKRHeap* _38; // _38
u8 m_mountMode; // _3C
long _40; // _40
unkptr _44; // _44
JKRArchive_44* _44; // _44
SDirEntry* _48; // _48 not sure of this one
SDIFileEntry* m_fileEntries; // _4C
unkptr* _50; // _50
char** _54; // _54
u32* _50; // _50
int _54; // _54
int _58; // _58
static u32 sCurrentDirID;
};
enum JKRMemBreakFlag { MBF_0 = 0, MBF_1 = 1 };
struct JKRMemArchive : public JKRArchive {
/**
* @fabricated
*/
struct JKRMemArchive_64 {
u32 _00; // _00
u32 _04; // _04
u32 _08; // _08
u32 _0C; // _0C
};
JKRMemArchive(); // unused/inlined
JKRMemArchive(long, EMountDirection);
JKRMemArchive(void*, u32, JKRMemBreakFlag);
JKRMemArchive(const char*, EMountDirection); // unused/inlined
virtual ~JKRMemArchive(); // _00
virtual void removeResourceAll(); // _1C
virtual bool removeResource(void*); // _20
virtual u32 getExpandedResSize(const void*) const; // _34
virtual void* fetchResource(SDIFileEntry* entry, u32* outSize); // _38
virtual void* fetchResource(void* resourceBuffer, u32 bufferSize, SDIFileEntry* entry, u32* resSize); // _3C
bool open(long, EMountDirection);
bool open(void*, u32, JKRMemBreakFlag);
u32 fetchResource_subroutine(unsigned char*, u32, unsigned char*, u32, int);
// Unused/inlined:
unknown fixedInit(long);
unknown mountFixed(long, EMountDirection);
unknown mountFixed(const char*, EMountDirection);
unknown mountFixed(void*, JKRMemBreakFlag);
unknown unmountFixed(void);
unknown open(const char*, EMountDirection);
int _5C; // _5C
EMountDirection m_mountDirection; // _60
JKRMemArchive_64* _64; // _64
u8* _68; // _68
bool _6C; // _6C
};
struct JKRCompArchive : public JKRArchive {
JKRCompArchive(long, EMountDirection);
virtual ~JKRCompArchive();
virtual void removeResourceAll(); // _1C
virtual bool removeResource(void*); // _20
virtual long getExpandedResSize(const void*) const; // _34
virtual u32 fetchResource(JKRArchive::SDIFileEntry*, unsigned long*); // _38
virtual void* fetchResource(void*, unsigned long, JKRArchive::SDIFileEntry*, unsigned long*); // _3C
virtual void removeResourceAll(); // _1C
virtual bool removeResource(void*); // _20
virtual u32 getExpandedResSize(const void*) const; // _34
virtual void* fetchResource(SDIFileEntry* entry, u32* outSize); // _38
virtual void* fetchResource(void* resourceBuffer, u32 bufferSize, SDIFileEntry* entry, u32* resSize); // _3C
bool open(long);
@ -119,4 +208,28 @@ struct JKRCompArchive : public JKRArchive {
unknown _7C; // _7C
};
struct JKRDvdArchive : public JKRArchive {
JKRDvdArchive(long, JKRArchive::EMountDirection);
virtual ~JKRDvdArchive(); // _00
virtual u32 getExpandedResSize(const void*) const; // _34
virtual void* fetchResource(SDIFileEntry* entry, u32* outSize); // _38
virtual void* fetchResource(void* resourceBuffer, u32 bufferSize, SDIFileEntry* entry, u32* resSize); // _3C
bool open(long);
static u32 fetchResource_subroutine(long, u32, u32, unsigned char*, u32, int, int);
static u32 fetchResource_subroutine(long, u32, u32, JKRHeap*, int, int, unsigned char**);
// Unused/inlined:
unknown fixedInit(long, EMountDirection);
unknown mountFixed(long, EMountDirection);
unknown mountFixed(const char*, EMountDirection);
unknown unmountFixed(void);
int _5C; // _5C
int _60; // _60
int _64; // _64
int* _68; // _68
};
#endif

View File

@ -7,6 +7,77 @@
struct JKRAMCommand;
// #define EXTRACT_TO_UINT(array, i1, i2, i3, i4) ((uint)array[i1] | (uint)array[i2] << 8 | (uint)array[i3] << 16 | (uint)array[i4] << 24)
// inline u32 getU32FromBigEndianBytes(u8* data, int offset) {
// return ((u32)data[offset+3] | (uint)data[offset+2] << 8 | (uint)data[offset+1] << 16 | (uint)data[offset] << 24);
// }
// struct BigEndianU32 {
// u8 data[4];
// inline u32 getU32FromBigEndianBytes() const {
// return ((u32)data[3] | (u32)data[2] << 8 | (u32)data[1] << 16 | (u32)data[0] << 24);
// }
// };
/**
* @fabricated
* TODO: This was a massive failure. Maybe they just did raw byte access here.
*/
struct SZPHeader {
// alternative 1:
// u8 _00;
// u8 _01;
// u8 _02;
// u8 _03;
// u8 _04;
// u8 _05;
// u8 _06;
// u8 _07;
// u8 _08;
// u8 _09;
// u8 _0A;
// u8 _0B;
// u8 _0C;
// u8 _0D;
// u8 _0E;
// u8 _0F;
// u8 _10;
// u8 _11;
// u8 _12;
// u8 _13;
// u8 _14;
// u8 _15;
// u8 _16;
// u8 _17;
// u8 _18;
// u8 _19;
// u8 _1A;
// u8 _1B;
// u8 _1C;
// u8 _1D;
// u8 _1E;
// u8 _1F;
// inline u32 getValue0() { return ((uint)_03 | (uint)_02 << 8 | (uint)_01 << 16 | (uint)_01 << 24); }
// inline u32 getValue1() { return ((uint)_07 | (uint)_06 << 8 | (uint)_05 << 16 | (uint)_04 << 24); }
// alternative 2:
// BigEndianU32 data[8];
// alternative 3:
u8 data[0x20];
// u32 getValue0() { return EXTRACT_TO_UINT(data, 3, 2, 1, 0); }
inline u32 getValue0() { return (((u32)data[0] << 24) | ((u32)data[1] << 16) | ((u32)data[2] << 8) | ((u32)data[3])); }
// value 1 might be decompressed size?
inline u32 getValue1() { return (((u32)data[4] << 24) | ((u32)data[5] << 16) | ((u32)data[6] << 8) | ((u32)data[7])); }
// inline u32 getValue1() { return (u32)(data + 4); }
inline u32 getValue2() { return (((u32)data[8] << 24) | ((u32)data[9] << 16) | ((u32)data[10] << 8) | ((u32)data[11])); }
inline u32 getValue3() { return (((u32)data[12] << 24) | ((u32)data[13] << 16) | ((u32)data[14] << 8) | ((u32)data[15])); }
};
// Size: 0x4C
struct JKRDecompCommand {
typedef void Callback(JKRDecompCommand*);
@ -34,8 +105,8 @@ struct JKRDecomp : public JKRThread {
JKRDecomp(long);
virtual ~JKRDecomp(); // _00
virtual void run(); // _04
virtual ~JKRDecomp(); // _08
virtual void* run(); // _0C
static CompressionMode checkCompressed(u8*);
static JKRDecomp* create(long);

View File

@ -1,10 +1,17 @@
#ifndef _JSYSTEM_JKR_JKRDVDRIPPER_H
#define _JSYSTEM_JKR_JKRDVDRIPPER_H
#include "JSystem/JKR/JKRFile.h"
#include "JSystem/JSupport/JSUList.h"
#include "types.h"
#include "JSystem/JKR/JKRHeap.h"
typedef enum { Switch_0 = 0, Switch_1 } JKRExpandSwitch;
typedef enum { Switch_0 = 0, Switch_1, Switch_2 } JKRExpandSwitch;
struct JKRDMCommand {
JKRDMCommand();
~JKRDMCommand();
};
struct JKRDvdRipper {
enum EAllocDirection {
@ -17,12 +24,18 @@ struct JKRDvdRipper {
static void* loadToMainRAM(const char*, u8*, JKRExpandSwitch, u32, JKRHeap*, EAllocDirection, u32, int*, u32*);
static void* loadToMainRAM(long, u8*, JKRExpandSwitch, u32, JKRHeap*, EAllocDirection, u32, int*, u32*);
static void* loadToMainRAM(JKRDvdFile*, unsigned char*, JKRExpandSwitch, u32, JKRHeap*, EAllocDirection, u32, int*, u32*);
static void* loadToMainRAMAsync(const char*, u8*, JKRExpandSwitch, u32, JKRHeap*, u32*);
static void* loadToMainRAMAsync(long, u8*, JKRExpandSwitch, u32, JKRHeap*, u32*);
static void syncAll(int);
static void countLeftSync();
static bool isErrorRetry();
static bool errorRetry;
static const int sSZSBufferSize = 0x400;
static JSUList<JKRDMCommand> sDvdAsyncList;
};
#endif

View File

@ -83,8 +83,4 @@ struct JKRDvdFile : public JKRFile {
static JSUList<JKRDvdFile> sDvdList;
};
struct JKRFileFinder {
virtual ~JKRFileFinder(); // _00
};
#endif

View File

@ -28,8 +28,8 @@ struct JKRFileCache : public JKRFileLoader {
virtual bool removeResource(void*); // _20
virtual bool detachResource(void*); // _24
virtual long getResSize(const void*) const; // _28
virtual int countFile(const char*) const; // _2C
virtual unkptr getFirstFile(const char*) const; // _30
virtual u16 countFile(const char*) const; // _2C
virtual JKRFileFinder* getFirstFile(const char*) const; // _30
virtual unkptr getFsResource(const char*); // _34
virtual unkptr getNameResource(unsigned long, const char*); // _38
virtual long readFsResource(void*, unsigned long, const char*); // _3C

View File

@ -0,0 +1,62 @@
#ifndef _JKRFILEFINDER_H
#define _JKRFILEFINDER_H
#include "Dolphin/dvd.h"
#include "Dolphin/os.h"
#include "types.h"
struct JKRArchive;
struct JKRFileFinderBase {
char* m_fileName; // _00
s32 _04; // _04
u16 _08; // _08
u16 _0A; // _0A
};
struct JKRFileFinder : JKRFileFinderBase {
inline JKRFileFinder()
: _10(false)
, _11(0)
{
}
/**
* @reifiedAddress{800223E0}
* @reifiedFile{JSystem/JKR/JKRFileCache.cpp}
*/
virtual ~JKRFileFinder() { } // _08 (weak)
// VT _0C
bool _10; // _10
bool _11; // _11
};
struct JKRArcFinder : JKRFileFinder {
JKRArcFinder(JKRArchive*, long, long);
virtual ~JKRArcFinder() { } // _08 (weak)
virtual bool findNextFile(); // _0C
JKRArchive* m_archive; // _14
s32 _18; // _18
s32 _1C; // _1C
s32 _20; // _20
};
struct JKRDvdFinder : JKRFileFinder {
JKRDvdFinder(const char*);
virtual ~JKRDvdFinder() // _08 (weak)
{
if (_20) {
DVDCloseDir(&m_fstEntry);
}
}
virtual bool findNextFile(); // _0C
OSFstEntry m_fstEntry; // _14
bool _20; // _20
};
#endif

View File

@ -5,6 +5,7 @@
#include "JSystem/JSupport/JSUList.h"
struct JKRArchive;
struct JKRFileFinder;
struct JKRFileLoader : public JKRDisposer {
JKRFileLoader();
@ -19,14 +20,14 @@ struct JKRFileLoader : public JKRDisposer {
virtual bool removeResource(void*) = 0; // _20
virtual bool detachResource(void*) = 0; // _24
virtual long getResSize(const void*) const = 0; // _28
virtual int countFile(const char*) const = 0; // _2C
virtual unkptr getFirstFile(const char*) const = 0; // _30
virtual u16 countFile(const char*) const = 0; // _2C
virtual JKRFileFinder* getFirstFile(const char*) const = 0; // _30
// +4 bytes vtable padding
static void* getGlbResource(char const*);
static void* getGlbResource(char const*, JKRFileLoader*);
static JKRArchive* findVolume(char const**);
static JKRFileLoader* findVolume(char const**);
static void fetchVolumeName(char*, long, char const*);
JSULink<JKRFileLoader> _18; // _18
@ -34,7 +35,7 @@ struct JKRFileLoader : public JKRDisposer {
u32 m_magicWord; // _2C
u8 _30; // _30
u32 : 0;
int _34; // _34
u32 m_mountCount; // _34
static JKRFileLoader* sCurrentVolume;
static JSUList<JKRFileLoader> sVolumeList;

View File

@ -247,6 +247,8 @@ void JKRDefaultMemoryErrorRoutine(void*, u32, int);
// void* operator new(size_t size, void* mem) { return mem; }
void* operator new(size_t, JKRHeap*, int);
void* operator new(u32 byteCount, int p2);
void* operator new[](size_t, JKRHeap*, int);
void* operator new[](u32 byteCount, int p2);
#endif

View File

@ -16,13 +16,13 @@ struct JKRThread : public JKRDisposer {
JKRThread(OSThread*, int);
virtual ~JKRThread(); // _08
virtual void run(); // _0C (weak)
virtual void* run(); // _0C (weak)
void setCommon_mesgQueue(JKRHeap*, int);
void setCommon_heapSpecified(JKRHeap*, unsigned long, int);
void* start(void*);
BOOL setCommon_heapSpecified(JKRHeap*, unsigned long, int);
static void* start(void*);
JSUPtrLink m_link; // _18
JSULink<JKRThread> m_link; // _18
JKRHeap* m_heap; // _28
OSThread* m_thread; // _2C
OSMessageQueue m_msgQueue; // _30
@ -46,8 +46,8 @@ struct JKRThread : public JKRDisposer {
*/
struct JKRTask : public JKRThread {
typedef void RequestCallback(void*);
virtual ~JKRTask(); // _08
virtual void run(); // _0C
virtual ~JKRTask(); // _08
virtual void* run(); // _0C
static JKRTask* create(int, int, unsigned long, JKRHeap*);

View File

@ -1,4 +1,8 @@
#include "Dolphin/os.h"
#include "JSystem/JKR/Aram.h"
#include "JSystem/JKR/JKRDecomp.h"
#include "JSystem/JKR/JKRHeap.h"
#include "JSystem/JKR/JKRThread.h"
#include "types.h"
/*
@ -145,8 +149,15 @@
* Address: 80017A10
* Size: 000094
*/
JKRAram* JKRAram::create(u32, u32, long, long, long)
JKRAram* JKRAram::create(u32 p1, u32 p2, long p3, long p4, long p5)
{
if (!sAramObject) {
sAramObject = new (JKRHeap::sSystemHeap, 0) JKRAram(p1, p2, p5);
}
JKRAramStream::create(p3);
JKRDecomp::create(p4);
OSResumeThread(sAramObject->m_thread);
return sAramObject;
/*
stwu r1, -0x20(r1)
mflr r0
@ -197,8 +208,28 @@ lbl_80017A70:
* Address: 80017AA4
* Size: 00011C
*/
JKRAram::JKRAram(u32, u32, long)
JKRAram::JKRAram(u32 p1, u32 p2, long threadPriority)
: JKRThread(0x4000, 0x10, threadPriority)
{
void* arStackPointer = ARInit(&m_blockLength, 3);
ARQInit();
u32 size = ARGetSize();
_80 = p1;
if (p2 == 0xFFFFFFFF) {
_88 = (size - p1) - (s32)arStackPointer;
_90 = 0;
} else {
_88 = p2;
_90 = (size - (p1 + p2)) - (s32)arStackPointer;
}
_7C = ARAlloc(_80);
_84 = ARAlloc(_88);
if (_90) {
_8C = ARAlloc(_90);
} else {
_8C = 0;
}
m_aramHeap = new (JKRHeap::sSystemHeap, 0) JKRAramHeap(_84, _88);
/*
stwu r1, -0x20(r1)
mflr r0

View File

@ -65,7 +65,7 @@
* __ct
*/
JKRAramArchive::JKRAramArchive(long p1, JKRArchive::EMountDirection mountDirection)
: JKRArchive(p1, EMM_Unk2)
: JKRArchive(p1, EMM_Aram)
, _60(mountDirection)
{
if (open(p1)) {
@ -537,7 +537,7 @@ lbl_80018ED8:
* Address: 80018EEC
* Size: 000124
*/
u32 JKRAramArchive::fetchResource(JKRArchive::SDIFileEntry*, unsigned long*)
void* JKRAramArchive::fetchResource(JKRArchive::SDIFileEntry*, unsigned long*)
{
/*
stwu r1, -0x20(r1)
@ -905,7 +905,7 @@ void JKRAramArchive::fetchResource_subroutine(u32, u32, JKRHeap*, s32, u8**)
* Address: 80019310
* Size: 000134
*/
long JKRAramArchive::getExpandedResSize(const void*) const
u32 JKRAramArchive::getExpandedResSize(const void*) const
{
/*
stwu r1, -0x60(r1)

View File

@ -105,7 +105,7 @@ JKRAramStream::~JKRAramStream() {};
* Address: 8001A040
* Size: 000070
*/
void JKRAramStream::run(void)
void* JKRAramStream::run(void)
{
OSMessage result;
OSInitMessageQueue(&JKRAramStream::sMessageQueue, (void**)JKRAramStream::sMessageBuffer,

View File

@ -1,3 +1,5 @@
#include "Dolphin/ctype.h"
#include "Dolphin/string.h"
#include "JSystem/JKR/JKRArchive.h"
#include "JSystem/JKR/JKRFileLoader.h"
#include "types.h"
@ -11,61 +13,49 @@
.skip 0x8
*/
/*
* --INFO--
* Address: ........
* Size: 00004C
* __ct__10JKRArchiveFv
*/
JKRArchive::JKRArchive()
{
// UNUSED FUNCTION
}
/*
* --INFO--
* Address: 8001A4BC
* Size: 0000A8
*/
JKRArchive::JKRArchive(long, JKRArchive::EMountMode)
JKRArchive::JKRArchive(long p1, JKRArchive::EMountMode mountMode)
: JKRFileLoader()
{
/*
stwu r1, -0x20(r1)
mflr r0
stw r0, 0x24(r1)
stw r31, 0x1c(r1)
mr r31, r5
stw r30, 0x18(r1)
mr r30, r4
stw r29, 0x14(r1)
mr r29, r3
bl __ct__13JKRFileLoaderFv
lis r3, __vt__10JKRArchive@ha
li r4, 0
addi r3, r3, __vt__10JKRArchive@l
li r0, 1
stw r3, 0(r29)
mr r3, r29
stb r4, 0x30(r29)
stb r31, 0x3c(r29)
stw r0, 0x34(r29)
stw r0, 0x58(r29)
bl findFromRoot__7JKRHeapFPv
stw r3, 0x38(r29)
lwz r0, 0x38(r29)
cmplwi r0, 0
bne lbl_8001A528
lwz r0, sCurrentHeap__7JKRHeap@sda21(r13)
stw r0, 0x38(r29)
_30 = 0;
m_mountMode = mountMode;
m_mountCount = 1;
_58 = 1;
_38 = JKRHeap::findFromRoot(this);
if (_38 == nullptr) {
_38 = JKRHeap::sCurrentHeap;
}
_40 = p1;
if (sCurrentVolume == nullptr) {
sCurrentDirID = 0;
sCurrentVolume = this;
}
}
lbl_8001A528:
stw r30, 0x40(r29)
lwz r0, sCurrentVolume__13JKRFileLoader@sda21(r13)
cmplwi r0, 0
bne lbl_8001A544
li r0, 0
stw r29, sCurrentVolume__13JKRFileLoader@sda21(r13)
stw r0, sCurrentDirID__10JKRArchive@sda21(r13)
lbl_8001A544:
lwz r0, 0x24(r1)
mr r3, r29
lwz r31, 0x1c(r1)
lwz r30, 0x18(r1)
lwz r29, 0x14(r1)
mtlr r0
addi r1, r1, 0x20
blr
*/
/*
* --INFO--
* Address: ........
* Size: 0000B8
* __ct__10JKRArchiveFPCcQ210JKRArchive10EMountMode
*/
JKRArchive::JKRArchive(const char* p1, JKRArchive::EMountMode mountMode)
{
// UNUSED FUNCTION
}
/*
@ -112,32 +102,32 @@ lbl_8001A5A8:
*/
bool JKRArchive::isSameName(JKRArchive::CArcName& archiveName, u32 nameTableOffset, u16 hash) const
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
rlwinm r0,r6,0,16,31
lhz r6, 0x0(r4)
cmplw r6, r0
beq- .loc_0x24
li r3, 0
b .loc_0x3C
// return (archiveName.m_hash != hash) ? false : strcmp(_54[nameTableOffset], archiveName.getString()) == 0;
u16 arcHash = archiveName.getHash();
if (arcHash != hash) {
return false;
}
const char* name = _54 + nameTableOffset;
const char* arcName = archiveName.getString();
return strcmp(name, arcName) == 0;
}
.loc_0x24:
lwz r0, 0x54(r3)
addi r4, r4, 0x4
add r3, r0, r5
bl 0xB00CC
cntlzw r0, r3
rlwinm r3,r0,27,5,31
.loc_0x3C:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
/*
* --INFO--
* Address: ........
* Size: 000034
* findResType__10JKRArchiveCFUl
*/
JKRArchive::SDirEntry* JKRArchive::findResType(u32 p1) const
{
// UNUSED FUNCTION
SDirEntry* dirEntry = _48;
for (u32 i = _44->m_baseOffset; i > 0; i--, dirEntry++) {
if (dirEntry->_00 == p1) {
return dirEntry;
}
}
return nullptr;
}
/*
@ -145,8 +135,24 @@ bool JKRArchive::isSameName(JKRArchive::CArcName& archiveName, u32 nameTableOffs
* Address: 8001A610
* Size: 00031C
*/
u32 JKRArchive::findDirectory(const char* directoryName, u32) const
JKRArchive::SDirEntry* JKRArchive::findDirectory(const char* path, u32 index) const
{
if (path == nullptr) {
return &_48[index];
} else {
const char* component = path;
CArcName arcName(&component, '/');
SDIFileEntry* entry = m_fileEntries + _48[index]._0C;
for (int i = 0; i < _48[index]._0A; i++, entry++) {
if (isSameName(arcName, entry->_04 & 0xFFFFFF, entry->m_hash)) {
if ((entry->_04 >> 0x18 & 2) != 0) {
return findDirectory(component, entry->_08);
}
return nullptr;
}
}
}
return nullptr;
/*
stwu r1, -0x450(r1)
mflr r0
@ -408,65 +414,105 @@ lbl_8001A918:
* --INFO--
* Address: 8001A92C
* Size: 000044
* __ct__Q210JKRArchive8CArcNameFPPCcc
*/
JKRArchive::CArcName::CArcName(const char**, char)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
stw r31, 0xc(r1)
mr r31, r4
stw r30, 8(r1)
mr r30, r3
lwz r4, 0(r4)
bl store__Q210JKRArchive8CArcNameFPCcc
stw r3, 0(r31)
mr r3, r30
lwz r0, 0x14(r1)
lwz r31, 0xc(r1)
lwz r30, 8(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
// JKRArchive::CArcName::CArcName(const char** p1, char p2)
// {
// p1[0] = store(p1[0], p2);
// }
/*
* --INFO--
* Address: 8001A970
* Size: 000008
*/
const char* JKRArchive::CArcName::getString() const
{
return m_string;
/*
addi r3, r3, 4
blr
*/
}
// const char* JKRArchive::CArcName::getString() const
// {
// return m_string;
// /*
// addi r3, r3, 4
// blr
// */
// }
/*
* --INFO--
* Address: 8001A978
* Size: 000008
*/
u16 JKRArchive::CArcName::getHash() const
// u16 JKRArchive::CArcName::getHash() const
// {
// return m_hash;
// }
/*
* --INFO--
* Address: ........
* Size: 000098
* findTypeResource__10JKRArchiveCFUlUl
*/
JKRArchive::SDIFileEntry* JKRArchive::findTypeResource(u32 p1, u32 p2) const
{
return m_hash;
/*
lhz r3, 0(r3)
blr
*/
// // UNUSED FUNCTION
// SDirEntry* dirEntry = _48 + p2;
// if (p1 != 0) {
// CArcName arcName;
// arcName.store(p2);
// SDirEntry* entry = _48;
// for (int i = _44->_00; i > 0; i++, entry++) {
// findTypeResource(p1, entry->_0C);
// if (isSameName(arcName, entry->_04 & 0xFFFFFF, entry->m_hash)) {
// if ((entry->_04 >> 0x18 & 2) != 0) {
// return findFsResource(path, entry->_08);
// }
// if (path == 0) {
// return entry;
// }
// return nullptr;
// }
// }
// }
// return nullptr;
}
/*
* --INFO--
* Address: 8001A980
* Size: 0000F4
* findTypeResource__10JKRArchiveCFUlPCc
*/
JKRArchive::SDIFileEntry* JKRArchive::findTypeResource(u32, const char*) const
JKRArchive::SDIFileEntry* JKRArchive::findTypeResource(u32 p1, const char* p2) const
{
if (p1 != 0) {
CArcName arcName;
arcName.store(p2);
SDirEntry* dirEntry = findResType(p1);
if (dirEntry != nullptr) {
SDIFileEntry* fileEntry = m_fileEntries + dirEntry->_0C;
if (isSameName(arcName, fileEntry->_04 & 0xFFFFFF, fileEntry->m_hash)) {
return fileEntry;
}
}
}
return nullptr;
// if (p1 != 0) {
// CArcName arcName;
// arcName.store(p2);
// SDirEntry* entry = _48;
// for (int i = _44->_00; i > 0; i++, entry++) {
// findTypeResource(p1, entry->_0C);
// if (isSameName(arcName, entry->_04 & 0xFFFFFF, entry->m_hash)) {
// if ((entry->_04 >> 0x18 & 2) != 0) {
// return findFsResource(path, entry->_08);
// }
// if (path == 0) {
// return entry;
// }
// return nullptr;
// }
// }
// }
// return nullptr;
/*
stwu r1, -0x130(r1)
mflr r0
@ -559,8 +605,24 @@ lbl_8001AA60:
* Address: 8001AA74
* Size: 000340
*/
JKRArchive::SDIFileEntry* JKRArchive::findFsResource(const char*, u32) const
JKRArchive::SDIFileEntry* JKRArchive::findFsResource(const char* path, u32 index) const
{
if (path != nullptr) {
CArcName arcName(&path, '/');
SDIFileEntry* entry = m_fileEntries + _48[index]._0C;
for (int i = 0; i < _48[index]._0A; i++, entry++) {
if (isSameName(arcName, entry->_04 & 0xFFFFFF, entry->m_hash)) {
if ((entry->_04 >> 0x18 & 2) != 0) {
return findFsResource(path, entry->_08);
}
if (path == 0) {
return entry;
}
return nullptr;
}
}
}
return nullptr;
/*
stwu r1, -0x450(r1)
mflr r0
@ -840,22 +902,12 @@ lbl_8001ADA0:
* Address: 8001ADB4
* Size: 000028
*/
JKRArchive::SDIFileEntry* JKRArchive::findIdxResource(u32) const
JKRArchive::SDIFileEntry* JKRArchive::findIdxResource(u32 idx) const
{
/*
lwz r5, 0x44(r3)
lwz r0, 8(r5)
cmplw r4, r0
bge lbl_8001ADD4
mulli r0, r4, 0x14
lwz r3, 0x4c(r3)
add r3, r3, r0
blr
lbl_8001ADD4:
li r3, 0
blr
*/
if (idx < _44->_08) {
return m_fileEntries + idx;
}
return nullptr;
}
/*
@ -926,9 +978,18 @@ lbl_8001AE6C:
* --INFO--
* Address: 8001AE80
* Size: 000034
* findPtrResource__10JKRArchiveCFPCv
*/
JKRArchive::SDIFileEntry* JKRArchive::findPtrResource(const void*) const
JKRArchive::SDIFileEntry* JKRArchive::findPtrResource(const void* p1) const
{
SDIFileEntry* entry = m_fileEntries;
// for (s32 i = _44->_08; i > 0; entry++, i--) {
for (u32 i = _44->_08; i > 0; entry++, i--) {
if (entry->_10 == p1) {
return entry;
}
}
return nullptr;
/*
lwz r5, 0x44(r3)
lwz r3, 0x4c(r3)
@ -954,9 +1015,22 @@ lbl_8001AEAC:
* --INFO--
* Address: 8001AEB4
* Size: 000080
* findIdResource__10JKRArchiveCFUs
*/
JKRArchive::SDIFileEntry* JKRArchive::findIdResource(u16) const
JKRArchive::SDIFileEntry* JKRArchive::findIdResource(u16 id) const
{
if (id != 0xFFFF) {
SDIFileEntry* entry = &m_fileEntries[id];
if (entry->_00 == id && (entry->_04 >> 0x18 & 0x01) != 0) {
return entry;
}
for (s32 i = _44->_08; i > 0; entry++, i--) {
if (entry->_00 == id && (entry->_04 >> 0x18 & 0x01)) {
return entry;
}
}
}
return nullptr;
/*
clrlwi r5, r4, 0x10
cmplwi r5, 0xffff
@ -1001,13 +1075,38 @@ lbl_8001AF2C:
*/
}
/*
* --INFO--
* Address: ........
* Size: 000014
* __ct__Q210JKRArchive8CArcNameFv
*/
// JKRArchive::CArcName::CArcName() {
// // UNUSED FUNCTION
// }
/*
* --INFO--
* Address: 8001AF34
* Size: 000098
*/
void JKRArchive::CArcName::store(const char*)
void JKRArchive::CArcName::store(const char* name)
{
// TODO: This depends on Dolphin::tolower
m_hash = 0;
int count = 0;
for (; *name != '\0'; name++) {
int lower = tolower(*name);
m_hash = lower + m_hash * 3;
int nextIndex = count;
if (count < 0x100) {
nextIndex = count + 1;
m_string[count] = lower;
}
count = nextIndex;
}
_02 = count;
m_string[count] = '\0';
/*
stwu r1, -0x20(r1)
mflr r0
@ -1134,8 +1233,19 @@ lbl_8001B074:
* Address: 8001B094
* Size: 00004C
*/
void JKRArchive::setExpandSize(JKRArchive::SDIFileEntry*, unsigned long)
void JKRArchive::setExpandSize(JKRArchive::SDIFileEntry* entry, unsigned long p2)
{
// u32 index = (entry - m_fileEntries);
// if (_50 != nullptr && index < _44->_08) {
// _50[index] = p2;
// }
u32 index = (entry - m_fileEntries);
if (_50 == nullptr) {
return;
}
if (index < _44->_08) {
_50[index] = p2;
}
/*
lwz r0, 0x4c(r3)
lis r6, 0x66666667@ha
@ -1166,32 +1276,11 @@ lbl_8001B0D4:
* Address: 8001B0E0
* Size: 000050
*/
void JKRArchive::getExpandSize(JKRArchive::SDIFileEntry*) const
unsigned long JKRArchive::getExpandSize(JKRArchive::SDIFileEntry* entry) const
{
/*
lwz r0, 0x4c(r3)
lis r5, 0x66666667@ha
lwz r6, 0x50(r3)
addi r5, r5, 0x66666667@l
subf r0, r0, r4
mulhw r0, r5, r0
cmplwi r6, 0
srawi r0, r0, 3
srwi r4, r0, 0x1f
add r4, r0, r4
beq lbl_8001B11C
lwz r3, 0x44(r3)
lwz r0, 8(r3)
cmplw r4, r0
blt lbl_8001B124
lbl_8001B11C:
li r3, 0
blr
lbl_8001B124:
slwi r0, r4, 2
lwzx r3, r6, r0
blr
*/
u32 index = (entry - m_fileEntries);
if (_50 == nullptr || index >= _44->_08) {
return 0;
}
return _50[index];
}

View File

@ -1,6 +1,9 @@
#include "Dolphin/dvd.h"
#include "JSystem/JKR/Aram.h"
#include "JSystem/JKR/JKRArchive.h"
#include "JSystem/JKR/JKRDisposer.h"
#include "JSystem/JKR/JKRHeap.h"
#include "JSystem/JKR/JKRFileFinder.h"
#include "types.h"
/*
@ -31,6 +34,25 @@
.4byte getExpandSize__10JKRArchiveCFPQ210JKRArchive12SDIFileEntry
*/
JKRArchive* JKRArchive::check_mount_already(long entryNum, JKRHeap* heap)
{
JKRFileLoader* loader = nullptr;
if (heap == nullptr) {
heap = JKRHeap::sCurrentHeap;
}
for (JSULink<JKRFileLoader>* link = JKRArchive::sVolumeList.getFirst(); link != nullptr; link = link->getNext()) {
JKRFileLoader* loader = link->getObject();
if (loader->m_magicWord == 'RARC') {
JKRArchive* archive = static_cast<JKRArchive*>(loader);
if (archive->_40 == entryNum && archive->_38 == heap) {
archive->m_mountCount++;
return archive;
}
}
}
return nullptr;
}
/*
* --INFO--
* Address: 8001B130
@ -46,9 +68,22 @@ JKRArchive* JKRArchive::mount(const char* path, EMountMode mode, JKRHeap* heap,
* --INFO--
* Address: 8001B194
* Size: 0000D8
* mount__10JKRArchiveFPvP7JKRHeapQ210JKRArchive15EMountDirection
*/
JKRArchive* JKRArchive::mount(void*, JKRHeap*, EMountDirection)
JKRArchive* JKRArchive::mount(void* p1, JKRHeap* heap, EMountDirection mountDirection)
{
// JKRHeap* aHeap = heap;
// if (aHeap == nullptr) {
// aHeap = JKRHeap::sCurrentHeap;
// }
JKRArchive* archive = check_mount_already((long)p1, heap);
if (archive) {
return archive;
} else {
int i = (mountDirection == EMD_Unk1) ? 4 : -4;
archive = new (heap, i) JKRMemArchive(p1, 0xFFFF, MBF_0);
}
return archive;
/*
stwu r1, -0x10(r1)
mflr r0
@ -129,9 +164,40 @@ lbl_8001B258:
* --INFO--
* Address: 8001B26C
* Size: 0001D8
* mount__10JKRArchiveFlQ210JKRArchive10EMountModeP7JKRHeapQ210JKRArchive15EMountDirection
*/
JKRArchive* JKRArchive::mount(long, EMountMode, JKRHeap*, EMountDirection)
JKRArchive* JKRArchive::mount(long entryNum, EMountMode mountMode, JKRHeap* heap, EMountDirection mountDirection)
{
// JKRHeap* aHeap = heap;
// if (heap == nullptr) {
// aHeap = JKRHeap::sCurrentHeap;
// }
JKRArchive* archive = check_mount_already(entryNum, heap);
if (archive) {
return archive;
} else {
int i = (mountDirection == EMD_Unk1) ? 4 : -4;
switch (mountMode) {
case EMM_Mem:
archive = new (heap, i) JKRMemArchive(entryNum, mountDirection);
break;
case EMM_Aram:
archive = new (heap, i) JKRAramArchive(entryNum, mountDirection);
break;
case EMM_Dvd:
archive = new (heap, i) JKRDvdArchive(entryNum, mountDirection);
break;
case EMM_Comp:
archive = new (heap, i) JKRCompArchive(entryNum, mountDirection);
break;
}
if (archive != nullptr && archive->m_mountMode == EMM_Unk0) {
delete archive;
archive = nullptr;
}
// archive = new(heap, (mountDirection == EMD_Unk1) ? 4 : -4) JKRMemArchive(entryNum, 0xFFFF, 0);
}
return archive;
/*
.loc_0x0:
stwu r1, -0x10(r1)
@ -314,55 +380,10 @@ bool JKRArchive::becomeCurrent(const char* path)
}
bool result = (entry != nullptr);
if (result) {
int index = entry - _48;
sCurrentDirID = (index >> 4) + (index < 0 && ((index & 0xF) != 0));
sCurrentVolume = this;
sCurrentDirID = (entry - _48);
}
return result;
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lbz r0, 0(r4)
stw r31, 0xc(r1)
mr r31, r3
cmpwi r0, 0x2f
bne lbl_8001B484
lbzu r0, 1(r4)
extsb. r0, r0
bne lbl_8001B474
li r4, 0
lbl_8001B474:
mr r3, r31
li r5, 0
bl findDirectory__10JKRArchiveCFPCcUl
b lbl_8001B48C
lbl_8001B484:
lwz r5, sCurrentDirID__10JKRArchive@sda21(r13)
bl findDirectory__10JKRArchiveCFPCcUl
lbl_8001B48C:
neg r0, r3
or r0, r0, r3
rlwinm. r4, r0, 1, 0x1f, 0x1f
beq lbl_8001B4B4
stw r31, sCurrentVolume__13JKRFileLoader@sda21(r13)
lwz r0, 0x48(r31)
subf r0, r0, r3
srawi r0, r0, 4
addze r0, r0
stw r0, sCurrentDirID__10JKRArchive@sda21(r13)
lbl_8001B4B4:
lwz r0, 0x14(r1)
mr r3, r4
lwz r31, 0xc(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
@ -376,47 +397,11 @@ bool JKRArchive::getDirEntry(JKRArchive::SDirEntry* dirEntry, unsigned long p2)
if (!fileEntry) {
return false;
}
char** names = _54;
char* names = (char*)_54;
dirEntry->_00 = fileEntry->_04 >> 0x18;
dirEntry->_02 = fileEntry->_00;
dirEntry->_04 = names[fileEntry->_04 & 0xFFFFFF];
dirEntry->_04 = names + (fileEntry->_04 & 0xFFFFFF);
return true;
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
stw r31, 0xc(r1)
mr r31, r4
mr r4, r5
stw r30, 8(r1)
mr r30, r3
bl findIdxResource__10JKRArchiveCFUl
cmplwi r3, 0
bne lbl_8001B500
li r3, 0
b lbl_8001B52C
lbl_8001B500:
lwz r0, 4(r3)
lwz r4, 0x54(r30)
srwi r0, r0, 0x18
stb r0, 0(r31)
lhz r0, 0(r3)
sth r0, 2(r31)
lwz r0, 4(r3)
li r3, 1
clrlwi r0, r0, 8
add r0, r4, r0
stw r0, 4(r31)
lbl_8001B52C:
lwz r0, 0x14(r1)
lwz r31, 0xc(r1)
lwz r30, 8(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
@ -424,15 +409,19 @@ lbl_8001B52C:
* Address: 8001B544
* Size: 0000B8
*/
void* JKRArchive::getGlbResource(unsigned long p1, const char* p2, JKRArchive* archive)
void* JKRArchive::getGlbResource(unsigned long type, const char* name, JKRArchive* archive)
{
// JSULink<JKRFileLoader>* link = sVolumeList.getHead();
// void* resource;
// if (archive == nullptr) {
// while (link != nullptr && (link->getValue()->m_magicWord != 'RARC' || ((resource = link->getValue()->getResource(p1, p2)) !=
// nullptr))) { link = ();
// }
// }
void* resource;
if (archive != nullptr) {
resource = archive->getResource(type, name);
} else {
for (JSULink<JKRFileLoader>* link = sVolumeList.getFirst(); link != nullptr; link = link->getNext()) {
if (link->getObject()->m_magicWord == 'RARC' && (resource = link->getObject()->getResource(type, name))) {
break;
}
}
}
return resource;
/*
stwu r1, -0x20(r1)
mflr r0
@ -499,6 +488,7 @@ lbl_8001B5E0:
* --INFO--
* Address: 8001B5FC
* Size: 00007C
* getResource__10JKRArchiveFPCc
*/
void* JKRArchive::getResource(const char* path)
{
@ -509,53 +499,13 @@ void* JKRArchive::getResource(const char* path)
fileEntry = findFsResource(path, sCurrentDirID);
}
return (fileEntry != nullptr) ? (void*)fetchResource(fileEntry, nullptr) : nullptr;
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lbz r0, 0(r4)
stw r31, 0xc(r1)
mr r31, r3
cmpwi r0, 0x2f
bne lbl_8001B630
addi r4, r4, 1
li r5, 0
bl findFsResource__10JKRArchiveCFPCcUl
mr r4, r3
b lbl_8001B63C
lbl_8001B630:
lwz r5, sCurrentDirID__10JKRArchive@sda21(r13)
bl findFsResource__10JKRArchiveCFPCcUl
mr r4, r3
lbl_8001B63C:
cmplwi r4, 0
beq lbl_8001B660
lwz r12, 0(r31)
mr r3, r31
li r5, 0
lwz r12, 0x40(r12)
mtctr r12
bctrl
b lbl_8001B664
lbl_8001B660:
li r3, 0
lbl_8001B664:
lwz r0, 0x14(r1)
lwz r31, 0xc(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 8001B678
* Size: 000080
* getResource__10JKRArchiveFUlPCc
*/
void* JKRArchive::getResource(unsigned long type, const char* name)
{
@ -566,50 +516,6 @@ void* JKRArchive::getResource(unsigned long type, const char* name)
fileEntry = findTypeResource(type, name);
}
return (fileEntry != nullptr) ? (void*)fetchResource(fileEntry, nullptr) : nullptr;
/*
stwu r1, -0x10(r1)
mflr r0
cmplwi r4, 0
stw r0, 0x14(r1)
stw r31, 0xc(r1)
mr r31, r3
beq lbl_8001B6A0
addis r0, r4, 0xc0c1
cmplwi r0, 0x3f3f
bne lbl_8001B6B4
lbl_8001B6A0:
mr r3, r31
mr r4, r5
bl findNameResource__10JKRArchiveCFPCc
mr r4, r3
b lbl_8001B6BC
lbl_8001B6B4:
bl findTypeResource__10JKRArchiveCFUlPCc
mr r4, r3
lbl_8001B6BC:
cmplwi r4, 0
beq lbl_8001B6E0
lwz r12, 0(r31)
mr r3, r31
li r5, 0
lwz r12, 0x40(r12)
mtctr r12
bctrl
b lbl_8001B6E4
lbl_8001B6E0:
li r3, 0
lbl_8001B6E4:
lwz r0, 0x14(r1)
lwz r31, 0xc(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
@ -621,39 +527,13 @@ void* JKRArchive::getIdxResource(unsigned long index)
{
SDIFileEntry* fileEntry = findIdxResource(index);
return (fileEntry != nullptr) ? (void*)fetchResource(fileEntry, nullptr) : nullptr;
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
stw r31, 0xc(r1)
mr r31, r3
bl findIdxResource__10JKRArchiveCFUl
or. r4, r3, r3
beq lbl_8001B734
lwz r12, 0(r31)
mr r3, r31
li r5, 0
lwz r12, 0x40(r12)
mtctr r12
bctrl
b lbl_8001B738
lbl_8001B734:
li r3, 0
lbl_8001B738:
lwz r0, 0x14(r1)
lwz r31, 0xc(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 8001B74C
* Size: 0000AC
* readResource__10JKRArchiveFPvUlUlPCc
*/
u32 JKRArchive::readResource(void* p1, unsigned long p2, unsigned long type, const char* name)
{
@ -804,6 +684,7 @@ lbl_8001B880:
* --INFO--
* Address: 8001B89C
* Size: 00007C
* readResource__10JKRArchiveFPvUlUs
*/
u32 JKRArchive::readResource(void* p1, unsigned long p2, unsigned short index)
{
@ -861,70 +742,23 @@ lbl_8001B8FC:
*/
void JKRArchive::removeResourceAll()
{
// if (_44 != nullptr && m_mountMode != EMM_Unk1) {
// SDIFileEntry* entry = m_fileEntries;
// for (int i = 0; i < _44->_08; i++) {
// if (entry->_10 != nullptr) {
// JKRHeap::free(entry->_10, _38);
// entry->_10 = nullptr;
// }
// entry++;
// }
// }
/*
stwu r1, -0x20(r1)
mflr r0
stw r0, 0x24(r1)
stw r31, 0x1c(r1)
stw r30, 0x18(r1)
stw r29, 0x14(r1)
stw r28, 0x10(r1)
mr r28, r3
lwz r0, 0x44(r3)
cmplwi r0, 0
beq lbl_8001B990
lbz r0, 0x3c(r28)
cmplwi r0, 1
beq lbl_8001B990
lwz r30, 0x4c(r28)
li r29, 0
li r31, 0
b lbl_8001B980
lbl_8001B960:
lwz r3, 0x10(r30)
cmplwi r3, 0
beq lbl_8001B978
lwz r4, 0x38(r28)
bl free__7JKRHeapFPvP7JKRHeap
stw r31, 0x10(r30)
lbl_8001B978:
addi r30, r30, 0x14
addi r29, r29, 1
lbl_8001B980:
lwz r3, 0x44(r28)
lwz r0, 8(r3)
cmplw r29, r0
blt lbl_8001B960
lbl_8001B990:
lwz r0, 0x24(r1)
lwz r31, 0x1c(r1)
lwz r30, 0x18(r1)
lwz r29, 0x14(r1)
lwz r28, 0x10(r1)
mtlr r0
addi r1, r1, 0x20
blr
*/
if (_44 != nullptr && m_mountMode != EMM_Mem) {
SDIFileEntry* entry = m_fileEntries;
for (int i = 0; i < _44->_08; i++) {
if (entry->_10 != nullptr) {
JKRHeap::free(entry->_10, _38);
entry->_10 = nullptr;
}
entry++;
}
}
}
/*
* --INFO--
* Address: 8001B9B0
* Size: 000060
* removeResource__10JKRArchiveFPv
*/
bool JKRArchive::removeResource(void* resource)
{
@ -970,35 +804,16 @@ lbl_8001B9F8:
* --INFO--
* Address: 8001BA10
* Size: 00003C
* detachResource__10JKRArchiveFPv
*/
bool JKRArchive::detachResource(void* resource)
{
SDIFileEntry* entry = findPtrResource(resource);
if (entry != nullptr) {
entry->_10 = nullptr;
if (entry == nullptr) {
return false;
}
return (entry != nullptr);
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
bl findPtrResource__10JKRArchiveCFPCv
cmplwi r3, 0
bne lbl_8001BA30
li r3, 0
b lbl_8001BA3C
lbl_8001BA30:
li r0, 0
stw r0, 0x10(r3)
li r3, 1
lbl_8001BA3C:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
entry->_10 = nullptr;
return true;
}
/*
@ -1009,7 +824,7 @@ lbl_8001BA3C:
long JKRArchive::getResSize(const void* resource) const
{
SDIFileEntry* entry = findPtrResource(resource);
return (entry == nullptr) ? -1 : entry->m_size;
return (entry == nullptr) ? -1 : entry->getSize();
}
/*
@ -1017,44 +832,19 @@ long JKRArchive::getResSize(const void* resource) const
* Address: 8001BA80
* Size: 000060
*/
int JKRArchive::countFile(const char*) const
u16 JKRArchive::countFile(const char* path) const
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lbz r0, 0(r4)
cmpwi r0, 0x2f
bne lbl_8001BAB4
lbzu r0, 1(r4)
extsb. r0, r0
bne lbl_8001BAA8
li r4, 0
lbl_8001BAA8:
li r5, 0
bl findDirectory__10JKRArchiveCFPCcUl
b lbl_8001BABC
lbl_8001BAB4:
lwz r5, sCurrentDirID__10JKRArchive@sda21(r13)
bl findDirectory__10JKRArchiveCFPCcUl
lbl_8001BABC:
cmplwi r3, 0
beq lbl_8001BACC
lhz r3, 0xa(r3)
b lbl_8001BAD0
lbl_8001BACC:
li r3, 0
lbl_8001BAD0:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
SDirEntry* dirEntry;
if (*path == '/') {
const char* pathPtr = path + 1;
if (*pathPtr == '\0') {
pathPtr = nullptr;
}
dirEntry = findDirectory(pathPtr, 0);
} else {
dirEntry = findDirectory(path, sCurrentDirID);
}
return (dirEntry != nullptr) ? dirEntry->_0A : 0;
}
/*
@ -1062,8 +852,22 @@ lbl_8001BAD0:
* Address: 8001BAE0
* Size: 0000AC
*/
unkptr JKRArchive::getFirstFile(const char*) const
JKRFileFinder* JKRArchive::getFirstFile(const char* path) const
{
SDirEntry* dirEntry;
if (*path == '/') {
const char* pathPtr = path + 1;
if (*pathPtr == '\0') {
pathPtr = nullptr;
}
dirEntry = findDirectory(pathPtr, 0);
} else {
dirEntry = findDirectory(path, sCurrentDirID);
}
JKRArcFinder* finder = (dirEntry != nullptr) ? new (JKRHeap::sSystemHeap, 0)
JKRArcFinder(const_cast<JKRArchive*>(this), dirEntry->_0C, dirEntry->_0A)
: nullptr;
return finder;
/*
stwu r1, -0x10(r1)
mflr r0
@ -1128,4 +932,4 @@ lbl_8001BB74:
* Address: 8001BB8C
* Size: 00002C
*/
long JKRArchive::getExpandedResSize(const void* resource) const { return getResSize(resource); }
u32 JKRArchive::getExpandedResSize(const void* resource) const { return getResSize(resource); }

View File

@ -66,7 +66,7 @@
* __ct
*/
JKRCompArchive::JKRCompArchive(long p1, JKRArchive::EMountDirection mountDirection)
: JKRArchive(p1, EMM_Unk4)
: JKRArchive(p1, EMM_Comp)
, m_mountDirection(mountDirection)
{
if (open(p1)) {
@ -660,7 +660,7 @@ lbl_8001C320:
* Address: 8001C334
* Size: 000190
*/
u32 JKRCompArchive::fetchResource(JKRArchive::SDIFileEntry*, unsigned long*)
void* JKRCompArchive::fetchResource(JKRArchive::SDIFileEntry*, unsigned long*)
{
/*
stwu r1, -0x30(r1)
@ -1032,7 +1032,7 @@ lbl_8001C754:
* Address: 8001C770
* Size: 0001C4
*/
long JKRCompArchive::getExpandedResSize(const void*) const
u32 JKRCompArchive::getExpandedResSize(const void*) const
{
/*
stwu r1, -0x60(r1)

View File

@ -136,7 +136,7 @@ lbl_8001CA28:
* Address: 8001CA44
* Size: 0000C8
*/
void JKRDecomp::run()
void* JKRDecomp::run()
{
void* inputBuffer[1];
JKRDecompCommand* command;

View File

@ -1,4 +1,9 @@
#include "Dolphin/os.h"
#include "JSystem/JKR/JKRDecomp.h"
#include "JSystem/JKR/JKRDvdRipper.h"
#include "JSystem/JUT/JUTException.h"
#include "types.h"
#include "JSystem/JKR/JKRArchive.h"
/*
Generated from dpostproc
@ -60,8 +65,17 @@
* Address: 8001E57C
* Size: 0000B0
*/
JKRDvdArchive::JKRDvdArchive(long, JKRArchive::EMountDirection)
JKRDvdArchive::JKRDvdArchive(long entryNum, JKRArchive::EMountDirection mountDirection)
: JKRArchive(entryNum, EMM_Dvd)
, _60(mountDirection)
{
if (open(entryNum) != false) {
m_magicWord = 'RARC';
_28 = _48->_04 + _54;
sVolumeList.prepend(&_18);
_30 = 1;
}
/*
stwu r1, -0x20(r1)
mflr r0
@ -221,7 +235,7 @@ lbl_8001E734:
* Address: 8001E758
* Size: 0002AC
*/
void JKRDvdArchive::open(long)
bool JKRDvdArchive::open(long)
{
/*
stwu r1, -0x20(r1)
@ -434,205 +448,143 @@ lbl_8001E9E4:
* --INFO--
* Address: 8001EA04
* Size: 000128
* fetchResource__13JKRDvdArchiveFPQ210JKRArchive12SDIFileEntryPUl
*/
void JKRDvdArchive::fetchResource(JKRArchive::SDIFileEntry*, unsigned long*)
void* JKRDvdArchive::fetchResource(JKRArchive::SDIFileEntry* entry, unsigned long* outSize)
{
/*
stwu r1, -0x20(r1)
mflr r0
stw r0, 0x24(r1)
stw r31, 0x1c(r1)
stw r30, 0x18(r1)
or. r30, r5, r5
stw r29, 0x14(r1)
mr r29, r4
stw r28, 0x10(r1)
mr r28, r3
bne lbl_8001EA34
addi r30, r1, 0xc
lbl_8001EA34:
lwz r3, 4(r29)
rlwinm. r0, r3, 8, 0x1d, 0x1d
srwi r3, r3, 0x18
bne lbl_8001EA4C
li r31, 0
b lbl_8001EA60
lbl_8001EA4C:
rlwinm. r0, r3, 0, 0x18, 0x18
beq lbl_8001EA5C
li r31, 2
b lbl_8001EA60
lbl_8001EA5C:
li r31, 1
lbl_8001EA60:
lwz r0, 0x10(r29)
cmplwi r0, 0
bne lbl_8001EAD8
lwz r4, 0x64(r28)
mr r7, r31
lwz r0, 8(r29)
addi r9, r1, 8
lwz r3, 0x40(r28)
lwz r5, 0xc(r29)
add r4, r4, r0
lwz r6, 0x38(r28)
lwz r8, 0x5c(r28)
bl fetchResource_subroutine__13JKRDvdArchiveFlUlUlP7JKRHeapiiPPUc
cmplwi r3, 0
stw r3, 0(r30)
bne lbl_8001EAA8
li r3, 0
b lbl_8001EB0C
lbl_8001EAA8:
lwz r0, 8(r1)
cmpwi r31, 2
stw r0, 0x10(r29)
bne lbl_8001EB08
mr r3, r28
mr r4, r29
lwz r12, 0(r28)
lwz r5, 0(r30)
lwz r12, 0x48(r12)
mtctr r12
bctrl
b lbl_8001EB08
lbl_8001EAD8:
cmpwi r31, 2
bne lbl_8001EB00
mr r3, r28
mr r4, r29
lwz r12, 0(r28)
lwz r12, 0x4c(r12)
mtctr r12
bctrl
stw r3, 0(r30)
b lbl_8001EB08
lbl_8001EB00:
lwz r0, 0xc(r29)
stw r0, 0(r30)
lbl_8001EB08:
lwz r3, 0x10(r29)
lbl_8001EB0C:
lwz r0, 0x24(r1)
lwz r31, 0x1c(r1)
lwz r30, 0x18(r1)
lwz r29, 0x14(r1)
lwz r28, 0x10(r1)
mtlr r0
addi r1, r1, 0x20
blr
*/
u32 size;
if (outSize == nullptr) {
outSize = &size;
}
int v1;
if (!entry->getFlag04()) {
v1 = 0;
} else if (entry->getFlag80()) {
v1 = 2;
} else {
v1 = 1;
}
if (entry->_10 == nullptr) {
u8* v2;
if ((*outSize = fetchResource_subroutine(_40, _64 + entry->_08, entry->getSize(), _38, v1, _5C, &v2)) == 0) {
return nullptr;
}
entry->_10 = v2;
if (v1 == 2) {
setExpandSize(entry, *outSize);
}
} else if (v1 == 2) {
*outSize = getExpandSize(entry);
} else {
*outSize = entry->getSize();
}
return entry->_10;
}
/*
* --INFO--
* Address: 8001EB2C
* Size: 0000FC
* fetchResource__13JKRDvdArchiveFPvUlPQ210JKRArchive12SDIFileEntryPUl
*/
void JKRDvdArchive::fetchResource(void*, unsigned long, JKRArchive::SDIFileEntry*, unsigned long*)
void* JKRDvdArchive::fetchResource(void* resourceBuffer, unsigned long bufferSize, JKRArchive::SDIFileEntry* entry, unsigned long* resSize)
{
/*
.loc_0x0:
stwu r1, -0x20(r1)
mflr r0
mr r9, r3
stw r0, 0x24(r1)
stmw r27, 0xC(r1)
mr r29, r6
mr r27, r4
mr r28, r5
mr r30, r7
lwz r3, 0x4(r6)
lwz r6, 0xC(r6)
rlwinm. r0,r3,8,29,29
mr r31, r6
rlwinm r0,r3,8,24,31
bne- .loc_0x44
li r8, 0
b .loc_0x58
.loc_0x44:
rlwinm. r0,r0,0,24,24
beq- .loc_0x54
li r8, 0x2
b .loc_0x58
.loc_0x54:
li r8, 0x1
.loc_0x58:
lwz r0, 0x10(r29)
cmplwi r0, 0
bne- .loc_0x90
lwz r4, 0x64(r9)
mr r5, r6
lwz r0, 0x8(r29)
mr r6, r27
lwz r3, 0x40(r9)
rlwinm r7,r28,0,0,26
lwz r9, 0x5C(r9)
add r4, r4, r0
bl .loc_0xFC
mr r31, r3
b .loc_0xD8
.loc_0x90:
cmpwi r8, 0x2
bne- .loc_0xBC
mr r3, r9
mr r4, r29
lwz r12, 0x0(r9)
lwz r12, 0x4C(r12)
mtctr r12
bctrl
cmplwi r3, 0
beq- .loc_0xBC
mr r31, r3
.loc_0xBC:
cmplw r31, r28
ble- .loc_0xC8
mr r31, r28
.loc_0xC8:
lwz r4, 0x10(r29)
mr r3, r27
mr r5, r31
bl 0x51C4
.loc_0xD8:
cmplwi r30, 0
beq- .loc_0xE4
stw r31, 0x0(r30)
.loc_0xE4:
mr r3, r27
lmw r27, 0xC(r1)
lwz r0, 0x24(r1)
mtlr r0
addi r1, r1, 0x20
blr
.loc_0xFC:
*/
int v1;
u32 size = entry->getSize();
if (!entry->getFlag04()) {
v1 = 0;
} else if (entry->getFlag80()) {
v1 = 2;
} else {
v1 = 1;
}
if (entry->_10 == nullptr) {
size = fetchResource_subroutine(_40, _64 + entry->_08, size, (u8*)resourceBuffer, ALIGN_PREV(bufferSize, 0x20), v1, _5C);
} else {
if (v1 == 2) {
u32 expandSize = getExpandSize(entry);
if (expandSize != 0) {
size = expandSize;
}
}
if (size > bufferSize) {
size = bufferSize;
}
JKRHeap::copyMemory(resourceBuffer, entry->_10, size);
}
if (resSize != nullptr) {
*resSize = size;
}
return resourceBuffer;
}
/*
* --INFO--
* Address: 8001EC28
* Size: 000200
* fetchResource_subroutine__13JKRDvdArchiveFlUlUlPUcUlii
*/
void JKRDvdArchive::fetchResource_subroutine(long, unsigned long, unsigned long, unsigned char*, unsigned long, int, int)
u32 JKRDvdArchive::fetchResource_subroutine(long p1, unsigned long p2, unsigned long fileSize, unsigned char* buffer,
unsigned long bufferSize, int p6, int p7)
{
u32 alignedFileSize = ALIGN_NEXT(fileSize, 0x20);
u32 alignedBufferSize = ALIGN_PREV(bufferSize, 0x20);
// u8 szpHeader[0x20];
// u32 headerValue1;
switch (p7) {
case 0:
switch (p6) {
case 0:
if (alignedFileSize > alignedBufferSize) {
alignedFileSize = alignedBufferSize;
}
JKRDvdRipper::loadToMainRAM(p1, buffer, Switch_0, alignedFileSize, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, p2, nullptr, nullptr);
DCInvalidateRange(buffer, alignedFileSize);
return alignedFileSize;
case 1:
case 2: {
// SZPHeader szpHeader;
// JKRDvdRipper::loadToMainRAM(p1, (u8*)&szpHeader, Switch_2, sizeof(SZPHeader), nullptr, JKRDvdRipper::ALLOC_DIR_TOP,
// ALIGN_NEXT(p2, 0x20), nullptr, nullptr); DCInvalidateRange(&szpHeader, sizeof(SZPHeader)); u32 headerValue1 =
// szpHeader.data[1].getU32FromBigEndianBytes(); JKRDvdRipper::loadToMainRAM(p1, szpHeader, Switch_2, 0x20, nullptr,
// JKRDvdRipper::ALLOC_DIR_TOP, ALIGN_PREV(p2, 0x20), nullptr, nullptr); DCInvalidateRange(szpHeader, 0x20); u32 headerValue1 =
// getU32FromBigEndianBytes(szpHeader, 4); headerValue1 = EXTRACT_TO_UINT(szpHeader, 7, 6, 5, 4);
SZPHeader szpHeader;
JKRDvdRipper::loadToMainRAM(p1, (u8*)&szpHeader, Switch_2, sizeof(SZPHeader), nullptr, JKRDvdRipper::ALLOC_DIR_TOP,
ALIGN_NEXT(p2, 0x20), nullptr, nullptr);
DCInvalidateRange(&szpHeader, sizeof(SZPHeader));
u32 headerValue1 = szpHeader.getValue1();
u32 remainingSize = ALIGN_NEXT(headerValue1, 0x20);
if (remainingSize > alignedBufferSize) {
remainingSize = alignedBufferSize;
}
JKRDvdRipper::loadToMainRAM(p1, buffer, Switch_1, remainingSize, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, ALIGN_NEXT(p2, 0x20),
nullptr, nullptr);
DCInvalidateRange(buffer, remainingSize);
return headerValue1;
break;
}
default:
break;
}
case 2:
if (fileSize > alignedBufferSize) {
fileSize = alignedBufferSize;
}
JKRDvdRipper::loadToMainRAM(p1, buffer, Switch_1, fileSize, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, p2, nullptr, nullptr);
DCInvalidateRange(buffer, fileSize);
return fileSize;
break;
case 1:
OSErrorLine(649, "Sorry, not prepared for SZP archive.\n");
return 0;
break;
default:
break;
}
OSErrorLine(655, ":::??? bad sequence\n");
return 0;
/*
.loc_0x0:
stwu r1, -0x70(r1)
@ -792,9 +744,64 @@ void JKRDvdArchive::fetchResource_subroutine(long, unsigned long, unsigned long,
* --INFO--
* Address: 8001EE28
* Size: 00021C
* fetchResource_subroutine__13JKRDvdArchiveFlUlUlP7JKRHeapiiPPUc
*/
void JKRDvdArchive::fetchResource_subroutine(long, unsigned long, unsigned long, JKRHeap*, int, int, unsigned char**)
u32 JKRDvdArchive::fetchResource_subroutine(long p1, unsigned long p2, unsigned long fileSize, JKRHeap* heap, int p5, int p6,
unsigned char** p7)
{
u32 alignedFileSize = ALIGN_NEXT(fileSize, 0x20);
// u8 szpHeader[0x20];
// u32 headerValue1;
switch (p6) {
case 0:
switch (p5) {
case 0:
// u8* buffer = new(heap, alignedFileSize) u8[0x20];
u8* buffer = (u8*)JKRHeap::alloc(alignedFileSize, 0x20, heap);
JKRDvdRipper::loadToMainRAM(p1, buffer, Switch_0, alignedFileSize, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, p2, nullptr, nullptr);
DCInvalidateRange(buffer, alignedFileSize);
*p7 = buffer;
return alignedFileSize;
case 1:
case 2:
// SZPHeader szpHeader;
// JKRDvdRipper::loadToMainRAM(p1, (u8*)&szpHeader, Switch_2, sizeof(SZPHeader), nullptr, JKRDvdRipper::ALLOC_DIR_TOP,
// ALIGN_NEXT(p2, 0x20), nullptr, nullptr); DCInvalidateRange(&szpHeader, sizeof(SZPHeader)); u32 headerValue1 =
// szpHeader.data[1].getU32FromBigEndianBytes(); JKRDvdRipper::loadToMainRAM(p1, szpHeader, Switch_2, 0x20, nullptr,
// JKRDvdRipper::ALLOC_DIR_TOP, ALIGN_PREV(p2, 0x20), nullptr, nullptr); DCInvalidateRange(szpHeader, 0x20); u32 headerValue1 =
// getU32FromBigEndianBytes(szpHeader, 4); headerValue1 = EXTRACT_TO_UINT(szpHeader, 7, 6, 5, 4);
SZPHeader szpHeader;
JKRDvdRipper::loadToMainRAM(p1, (u8*)&szpHeader, Switch_2, sizeof(SZPHeader), nullptr, JKRDvdRipper::ALLOC_DIR_TOP,
ALIGN_NEXT(p2, 0x20), nullptr, nullptr);
DCInvalidateRange(&szpHeader, sizeof(SZPHeader));
u32 headerValue1 = szpHeader.getValue1();
// buffer = new(heap, headerValue1) u8[0x20];
buffer = (u8*)JKRHeap::alloc(headerValue1, 0x20, heap);
JKRDvdRipper::loadToMainRAM(p1, buffer, Switch_1, headerValue1, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, p2, nullptr, nullptr);
DCInvalidateRange(buffer, headerValue1);
*p7 = buffer;
return headerValue1;
break;
default:
break;
}
case 2:
// u8* buffer = new(heap, alignedFileSize) u8[0x20];
u8* buffer = (u8*)JKRHeap::alloc(alignedFileSize, 0x20, heap);
JKRDvdRipper::loadToMainRAM(p1, buffer, Switch_1, fileSize, nullptr, JKRDvdRipper::ALLOC_DIR_TOP, p2, nullptr, nullptr);
DCInvalidateRange(buffer, fileSize);
*p7 = buffer;
return alignedFileSize;
break;
case 1:
OSErrorLine(756, "Sorry, not prepared for SZP archive.\n");
return 0;
break;
default:
break;
}
OSErrorLine(761, ":::??? bad sequence\n");
return 0;
/*
.loc_0x0:
stwu r1, -0x70(r1)
@ -955,8 +962,9 @@ void JKRDvdArchive::fetchResource_subroutine(long, unsigned long, unsigned long,
* --INFO--
* Address: 8001F044
* Size: 000144
* getExpandedResSize__13JKRDvdArchiveCFPCv
*/
void JKRDvdArchive::getExpandedResSize(const void*) const
u32 JKRDvdArchive::getExpandedResSize(const void* resource) const
{
/*
stwu r1, -0x60(r1)

View File

@ -1,3 +1,4 @@
#include "Dolphin/os.h"
#include "types.h"
#include "Dolphin/dvd.h"
#include "JSystem/JKR/JKRFile.h"
@ -431,7 +432,7 @@ long JKRDvdFile::sync()
{
OSMessage buffer[1];
OSLockMutex(&_1C);
OSReceiveMessage(&_C0, buffer, MSG_QUEUE_SHOULD_BLOCK);
OSReceiveMessage(&_C0, buffer, OS_MESSAGE_BLOCKING);
_F4 = nullptr;
OSUnlockMutex(&_1C);
return (u32)*buffer;

View File

@ -1,3 +1,11 @@
#include "JSystem/JKR/JKRDvdRipper.h"
#include "Dolphin/dvd.h"
#include "Dolphin/os.h"
#include "Dolphin/stl.h"
#include "Dolphin/vi.h"
#include "JSystem/JKR/Aram.h"
#include "JSystem/JKR/JKRDecomp.h"
#include "JSystem/JKR/JKRFile.h"
#include "types.h"
/*
@ -95,140 +103,118 @@
.skip 0x8
*/
u8* firstSrcData();
int decompSZS_subroutine(unsigned char*, unsigned char*);
static u8* szpBuf;
static u8* szpEnd;
static u8* refBuf;
static u8* refEnd;
static u8* refCurrent;
static u32 srcOffset;
static long transLeft;
static u8* srcLimit;
static JKRDvdFile* srcFile;
static u32 fileOffset;
static u32 readCount;
static u32 maxDest;
static bool isInitMutex;
static u32* tsPtr;
static u32 tsArea;
JSUList<JKRDMCommand> JKRDvdRipper::sDvdAsyncList;
/*
* --INFO--
* Address: 8001F188
* Size: 0000B4
* loadToMainRAM__12JKRDvdRipperFPCcPUc15JKRExpandSwitchUlP7JKRHeapQ212JKRDvdRipper15EAllocDirectionUlPiPUl
*/
void JKRDvdRipper::loadToMainRAM(const char*, unsigned char*, JKRExpandSwitch, unsigned long, JKRHeap*, JKRDvdRipper::EAllocDirection,
unsigned long, int*, unsigned long*)
void* JKRDvdRipper::loadToMainRAM(const char* path, unsigned char* p2, JKRExpandSwitch expSwitch, unsigned long p4, JKRHeap* heap,
EAllocDirection allocDir, unsigned long p7, int* p8, unsigned long* p9)
{
/*
.loc_0x0:
stwu r1, -0x130(r1)
mflr r0
stw r0, 0x134(r1)
stmw r23, 0x10C(r1)
mr r23, r3
lwz r31, 0x138(r1)
mr r24, r4
mr r25, r5
mr r26, r6
mr r27, r7
mr r28, r8
mr r29, r9
mr r30, r10
addi r3, r1, 0x10
bl -0x2108
mr r4, r23
addi r3, r1, 0x10
bl -0x1E38
rlwinm. r0,r3,0,24,31
bne- .loc_0x64
addi r3, r1, 0x10
li r4, -0x1
bl -0x1F54
li r3, 0
b .loc_0xA0
.loc_0x64:
stw r31, 0x8(r1)
mr r4, r24
mr r5, r25
mr r6, r26
mr r7, r27
mr r8, r28
mr r9, r29
mr r10, r30
addi r3, r1, 0x10
bl 0xE0
mr r31, r3
addi r3, r1, 0x10
li r4, -0x1
bl -0x1F94
mr r3, r31
.loc_0xA0:
lmw r23, 0x10C(r1)
lwz r0, 0x134(r1)
mtlr r0
addi r1, r1, 0x130
blr
*/
JKRDvdFile file;
if (!file.open(path)) {
return nullptr;
} else {
return loadToMainRAM(&file, p2, expSwitch, p4, heap, allocDir, p7, p8, p9);
}
}
/*
* --INFO--
* Address: 8001F23C
* Size: 0000B4
* loadToMainRAM__12JKRDvdRipperFlPUc15JKRExpandSwitchUlP7JKRHeapQ212JKRDvdRipper15EAllocDirectionUlPiPUl
*/
void JKRDvdRipper::loadToMainRAM(long, unsigned char*, JKRExpandSwitch, unsigned long, JKRHeap*, JKRDvdRipper::EAllocDirection,
unsigned long, int*, unsigned long*)
void* JKRDvdRipper::loadToMainRAM(long inode, unsigned char* p2, JKRExpandSwitch expSwitch, unsigned long p4, JKRHeap* heap,
EAllocDirection allocDir, unsigned long p7, int* p8, unsigned long* p9)
{
/*
.loc_0x0:
stwu r1, -0x130(r1)
mflr r0
stw r0, 0x134(r1)
stmw r23, 0x10C(r1)
mr r23, r3
lwz r31, 0x138(r1)
mr r24, r4
mr r25, r5
mr r26, r6
mr r27, r7
mr r28, r8
mr r29, r9
mr r30, r10
addi r3, r1, 0x10
bl -0x21BC
mr r4, r23
addi r3, r1, 0x10
bl -0x1E74
rlwinm. r0,r3,0,24,31
bne- .loc_0x64
addi r3, r1, 0x10
li r4, -0x1
bl -0x2008
li r3, 0
b .loc_0xA0
.loc_0x64:
stw r31, 0x8(r1)
mr r4, r24
mr r5, r25
mr r6, r26
mr r7, r27
mr r8, r28
mr r9, r29
mr r10, r30
addi r3, r1, 0x10
bl .loc_0xB4
mr r31, r3
addi r3, r1, 0x10
li r4, -0x1
bl -0x2048
mr r3, r31
.loc_0xA0:
lmw r23, 0x10C(r1)
lwz r0, 0x134(r1)
mtlr r0
addi r1, r1, 0x130
blr
.loc_0xB4:
*/
JKRDvdFile file;
if (!file.open(inode)) {
return nullptr;
} else {
return loadToMainRAM(&file, p2, expSwitch, p4, heap, allocDir, p7, p8, p9);
}
}
/*
* --INFO--
* Address: 8001F2F0
* Size: 0004AC
* loadToMainRAM__12JKRDvdRipperFP10JKRDvdFilePUc15JKRExpandSwitchUlP7JKRHeapQ212JKRDvdRipper15EAllocDirectionUlPiPUl
*/
void JKRDvdRipper::loadToMainRAM(JKRDvdFile*, unsigned char*, JKRExpandSwitch, unsigned long, JKRHeap*, JKRDvdRipper::EAllocDirection,
unsigned long, int*, unsigned long*)
void* JKRDvdRipper::loadToMainRAM(JKRDvdFile* file, unsigned char* p2, JKRExpandSwitch expSwitch, unsigned long p4, JKRHeap* heap,
EAllocDirection allocDir, unsigned long p7, int* p8, unsigned long* p9)
{
// JKRDecomp::CompressionMode compressionMode;
// u32 v2;
// bool v3;
// u8* memptr;
// u32 byteCount = ALIGN_NEXT(file->getFileSize(), 0x20);
// if (expSwitch == Switch_1) {
// SZPHeader buffer;
// while (true) {
// int v1 = DVDReadPrio(&file->m_dvdPlayer, &buffer, sizeof(buffer), 0, 2);
// if (v1 >= 0) {
// break;
// }
// if (v1 == -3 || errorRetry == false) {
// return nullptr;
// }
// VIWaitForRetrace();
// }
// DCInvalidateRange(&buffer, 0x20);
// compressionMode = JKRDecomp::checkCompressed((u8*)&buffer);
// v2 = buffer.getValue1();
// }
// if (p8 != nullptr) {
// *p8 = compressionMode;
// }
// if (expSwitch == Switch_1 && compressionMode != JKRDecomp::NOT_COMPRESSED) {
// if (p4 != 0 && p4 < v2) {
// v2 = p4;
// }
// if (p2 == nullptr) {
// p2 = (u8*)JKRHeap::alloc(v2, (allocDir == ALLOC_DIR_TOP) ? 0x20 : -0x20, heap);
// v3 = true;
// }
// if (p2 == nullptr) {
// return nullptr;
// }
// if (compressionMode == JKRDecomp::YAY0) {
// memptr = (u8*)JKRHeap::alloc(byteCount, 0x20, heap);
// if (memptr == nullptr && v3) {
// JKRHeap::free(p2, nullptr);
// return nullptr;
// }
// }
// } else {
// if (p2 == nullptr) {
// }
// }
/*
.loc_0x0:
stwu r1, -0xD0(r1)
@ -630,8 +616,45 @@ void JKRDvdRipper::loadToMainRAM(JKRDvdFile*, unsigned char*, JKRExpandSwitch, u
* Address: 8001F79C
* Size: 000174
*/
void JKRDecompressFromDVD(JKRDvdFile*, void*, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long*)
int JKRDecompressFromDVD(JKRDvdFile* file, void* p2, unsigned long p3, unsigned long inMaxDest, unsigned long inFileOffset,
unsigned long inSrcOffset, unsigned long* inTsPtr)
{
int interrupts = OSDisableInterrupts();
if (isInitMutex == false) {
OSInitMutex(&decompMutex);
isInitMutex = true;
}
OSRestoreInterrupts(interrupts);
OSLockMutex(&decompMutex);
szpBuf = (u8*)JKRHeap::sSystemHeap->alloc(JKRDvdRipper::sSZSBufferSize, -0x20);
szpEnd = szpBuf + JKRDvdRipper::sSZSBufferSize;
if (inFileOffset != 0) {
refBuf = (u8*)JKRHeap::sSystemHeap->alloc(0x1120, -4);
refEnd = refBuf + 0x1120;
refCurrent = refBuf;
} else {
refBuf = nullptr;
}
transLeft = p3 - inSrcOffset;
readCount = 0;
if (inTsPtr == 0) {
inTsPtr = &tsArea;
}
srcOffset = inSrcOffset;
srcFile = file;
fileOffset = inFileOffset;
maxDest = inMaxDest;
tsPtr = inTsPtr;
*inTsPtr = 0;
u8* data = firstSrcData();
int result = (data != nullptr) ? decompSZS_subroutine(data, (u8*)p2) : -1;
JKRHeap::free(szpBuf, nullptr);
if (refBuf != nullptr) {
JKRHeap::free(refBuf, nullptr);
}
DCStoreRangeNoSync(p2, *tsPtr);
OSUnlockMutex(&decompMutex);
return result;
/*
.loc_0x0:
stwu r1, -0x30(r1)
@ -753,7 +776,7 @@ void JKRDecompressFromDVD(JKRDvdFile*, void*, unsigned long, unsigned long, unsi
* Address: 8001F910
* Size: 0002B8
*/
void decompSZS_subroutine(unsigned char*, unsigned char*)
int decompSZS_subroutine(unsigned char*, unsigned char*)
{
/*
stwu r1, -0x20(r1)
@ -984,8 +1007,28 @@ lbl_8001FBAC:
* Address: 8001FBC8
* Size: 0000D4
*/
void firstSrcData()
u8* firstSrcData()
{
srcLimit = szpEnd - 0x19;
u32 byteCount = MIN(transLeft, (u32)(szpEnd - szpBuf));
// u32 byteCount;
// if (transLeft < byteCount) {
// byteCount = transLeft;
// }
while (true) {
int result = DVDReadPrio(&srcFile->m_dvdPlayer, szpBuf, byteCount, srcOffset, 2);
if (0 <= result) {
break;
}
if (result == -3 || JKRDvdRipper::errorRetry == false) {
return nullptr;
}
VIWaitForRetrace();
}
DCInvalidateRange(szpBuf, byteCount);
srcOffset += byteCount;
transLeft -= byteCount;
return szpBuf;
/*
stwu r1, -0x20(r1)
mflr r0
@ -1060,8 +1103,38 @@ lbl_8001FC80:
* Address: 8001FC9C
* Size: 00010C
*/
void nextSrcData(unsigned char*)
u8* nextSrcData(unsigned char* p1)
{
u32 limit = szpEnd - p1;
u8* buf = szpBuf;
if ((limit & 0x1F) != 0) {
buf = szpBuf + (0x20 - (limit & 0x1F));
}
memcpy(buf, p1, limit);
u8* memptr = buf + limit;
u32 byteCount = MIN(transLeft, (u32)(szpEnd - memptr));
// u32 byteCount = szpEnd - memptr;
// if (transLeft < byteCount) {
// byteCount = transLeft;
// }
while (true) {
int result = DVDReadPrio(&srcFile->m_dvdPlayer, memptr, byteCount, srcOffset, 2);
if (0 <= result) {
break;
}
// if (result == -3 || JKRDvdRipper::errorRetry == false) {
if (result == -3) {
return nullptr;
}
VIWaitForRetrace();
}
DCInvalidateRange(szpBuf, byteCount);
if (transLeft - byteCount == 0) {
srcLimit = memptr + byteCount;
}
srcOffset += byteCount;
transLeft -= byteCount;
return szpBuf;
/*
stwu r1, -0x20(r1)
mflr r0
@ -1156,72 +1229,66 @@ lbl_8001FD88:
* Address: 8001FDA8
* Size: 000008
*/
void JKRDvdRipper::isErrorRetry()
{
/*
lbz r3, errorRetry__12JKRDvdRipper@sda21(r13)
blr
*/
}
bool JKRDvdRipper::isErrorRetry() { return errorRetry; }
/*
* --INFO--
* Address: 8001FDB0
* Size: 000044
*/
void __sinit_JKRDvdRipper_cpp(void)
{
/*
stwu r1, -0x10(r1)
mflr r0
lis r3, sDvdAsyncList__12JKRDvdRipper@ha
stw r0, 0x14(r1)
addi r3, r3, sDvdAsyncList__12JKRDvdRipper@l
bl initiate__10JSUPtrListFv
lis r3, sDvdAsyncList__12JKRDvdRipper@ha
lis r4, "__dt__23JSUList<12JKRDMCommand>Fv"@ha
lis r5, lbl_804EFF78@ha
addi r3, r3, sDvdAsyncList__12JKRDvdRipper@l
addi r4, r4, "__dt__23JSUList<12JKRDMCommand>Fv"@l
addi r5, r5, lbl_804EFF78@l
bl __register_global_object
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
// /*
// * --INFO--
// * Address: 8001FDB0
// * Size: 000044
// */
// void __sinit_JKRDvdRipper_cpp(void)
// {
// /*
// stwu r1, -0x10(r1)
// mflr r0
// lis r3, sDvdAsyncList__12JKRDvdRipper@ha
// stw r0, 0x14(r1)
// addi r3, r3, sDvdAsyncList__12JKRDvdRipper@l
// bl initiate__10JSUPtrListFv
// lis r3, sDvdAsyncList__12JKRDvdRipper@ha
// lis r4, "__dt__23JSUList<12JKRDMCommand>Fv"@ha
// lis r5, lbl_804EFF78@ha
// addi r3, r3, sDvdAsyncList__12JKRDvdRipper@l
// addi r4, r4, "__dt__23JSUList<12JKRDMCommand>Fv"@l
// addi r5, r5, lbl_804EFF78@l
// bl __register_global_object
// lwz r0, 0x14(r1)
// mtlr r0
// addi r1, r1, 0x10
// blr
// */
// }
/*
* --INFO--
* Address: 8001FDF4
* Size: 000054
*/
void JSUList<JKRDMCommand>::~JSUList()
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
stw r31, 0xc(r1)
mr r31, r4
stw r30, 8(r1)
or. r30, r3, r3
beq lbl_8001FE2C
li r4, 0
bl __dt__10JSUPtrListFv
extsh. r0, r31
ble lbl_8001FE2C
mr r3, r30
bl __dl__FPv
// /*
// * --INFO--
// * Address: 8001FDF4
// * Size: 000054
// */
// void JSUList<JKRDMCommand>::~JSUList()
// {
// /*
// stwu r1, -0x10(r1)
// mflr r0
// stw r0, 0x14(r1)
// stw r31, 0xc(r1)
// mr r31, r4
// stw r30, 8(r1)
// or. r30, r3, r3
// beq lbl_8001FE2C
// li r4, 0
// bl __dt__10JSUPtrListFv
// extsh. r0, r31
// ble lbl_8001FE2C
// mr r3, r30
// bl __dl__FPv
lbl_8001FE2C:
lwz r0, 0x14(r1)
mr r3, r30
lwz r31, 0xc(r1)
lwz r30, 8(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
// lbl_8001FE2C:
// lwz r0, 0x14(r1)
// mr r3, r30
// lwz r31, 0xc(r1)
// lwz r30, 8(r1)
// mtlr r0
// addi r1, r1, 0x10
// blr
// */
// }

View File

@ -1,4 +1,5 @@
#include "types.h"
#include "JSystem/JKR/JKRHeap.h"
/*
Generated from dpostproc
@ -138,7 +139,7 @@
* Address: 8001FE48
* Size: 000080
*/
void JKRExpHeap::createRoot(int, bool)
JKRExpHeap* JKRExpHeap::createRoot(int, bool)
{
/*
stwu r1, -0x20(r1)
@ -185,7 +186,7 @@ lbl_8001FEA8:
* Address: 8001FEC8
* Size: 0000E4
*/
void JKRExpHeap::create(unsigned long, JKRHeap*, bool)
JKRExpHeap* JKRExpHeap::create(unsigned long, JKRHeap*, bool)
{
/*
stwu r1, -0x20(r1)
@ -404,7 +405,7 @@ lbl_80020114:
* Address: 80020130
* Size: 00011C
*/
void JKRExpHeap::do_alloc(unsigned long, int)
void* JKRExpHeap::do_alloc(unsigned long, int)
{
/*
stwu r1, -0x20(r1)
@ -498,7 +499,7 @@ lbl_80020220:
* Address: 8002024C
* Size: 000254
*/
void JKRExpHeap::allocFromHead(unsigned long, int)
u32 JKRExpHeap::allocFromHead(unsigned long, int)
{
/*
stwu r1, -0x30(r1)
@ -693,7 +694,7 @@ lbl_8002048C:
* Address: 800204A0
* Size: 0000E4
*/
void JKRExpHeap::allocFromHead(unsigned long)
u32 JKRExpHeap::allocFromHead(unsigned long)
{
/*
stwu r1, -0x10(r1)
@ -778,7 +779,7 @@ lbl_8002056C:
* Address: 80020584
* Size: 000158
*/
void JKRExpHeap::allocFromTail(unsigned long, int)
u32 JKRExpHeap::allocFromTail(unsigned long, int)
{
/*
stwu r1, -0x20(r1)
@ -894,7 +895,7 @@ lbl_800206C8:
* Address: 800206DC
* Size: 0000E0
*/
void JKRExpHeap::allocFromTail(unsigned long)
u32 JKRExpHeap::allocFromTail(unsigned long)
{
/*
stwu r1, -0x20(r1)
@ -1022,7 +1023,7 @@ lbl_80020810:
* Address: 80020830
* Size: 000094
*/
void JKRExpHeap::freeGroup(unsigned char)
int JKRExpHeap::freeGroup(unsigned char)
{
/*
stwu r1, -0x20(r1)
@ -1179,7 +1180,7 @@ void JKRExpHeap::do_fillFreeArea() { }
* Address: 800209D4
* Size: 000058
*/
void JKRExpHeap::do_changeGroupID(unsigned char)
u8 JKRExpHeap::do_changeGroupID(unsigned char)
{
/*
stwu r1, -0x20(r1)
@ -1212,7 +1213,7 @@ void JKRExpHeap::do_changeGroupID(unsigned char)
* Address: 80020A2C
* Size: 0001BC
*/
void JKRExpHeap::do_resize(void*, unsigned long)
int JKRExpHeap::do_resize(void*, unsigned long)
{
/*
stwu r1, -0x20(r1)
@ -1358,7 +1359,7 @@ lbl_80020BC8:
* Address: 80020BE8
* Size: 000088
*/
void JKRExpHeap::do_getSize(void*)
int JKRExpHeap::do_getSize(void*)
{
/*
stwu r1, -0x20(r1)
@ -1409,7 +1410,7 @@ lbl_80020C54:
* Address: 80020C70
* Size: 00006C
*/
void JKRExpHeap::do_getFreeSize()
u32 JKRExpHeap::do_getFreeSize()
{
/*
stwu r1, -0x10(r1)
@ -1453,7 +1454,7 @@ lbl_80020CB0:
* Address: 80020CDC
* Size: 000074
*/
void JKRExpHeap::do_getMaxFreeBlock()
void* JKRExpHeap::do_getMaxFreeBlock()
{
/*
stwu r1, -0x10(r1)
@ -1499,7 +1500,7 @@ lbl_80020D24:
* Address: 80020D50
* Size: 000064
*/
void JKRExpHeap::do_getTotalFreeSize()
u32 JKRExpHeap::do_getTotalFreeSize()
{
/*
stwu r1, -0x10(r1)
@ -1539,7 +1540,7 @@ lbl_80020D88:
* Address: 80020DB4
* Size: 000098
*/
void JKRExpHeap::appendUsedList(JKRExpHeap::CMemBlock*)
u32 JKRExpHeap::appendUsedList(JKRExpHeap::CMemBlock*)
{
/*
stwu r1, -0x10(r1)
@ -1912,7 +1913,7 @@ lbl_800211A0:
* Address: 800211B4
* Size: 0001E0
*/
void JKRExpHeap::check()
bool JKRExpHeap::check()
{
/*
stwu r1, -0x20(r1)
@ -2071,7 +2072,7 @@ lbl_80021374:
* Address: 80021394
* Size: 0001C8
*/
void JKRExpHeap::dump()
bool JKRExpHeap::dump()
{
/*
stwu r1, -0x40(r1)
@ -2214,7 +2215,7 @@ lbl_800214E4:
* Address: 8002155C
* Size: 0001F8
*/
void JKRExpHeap::dump_sort()
bool JKRExpHeap::dump_sort()
{
/*
stwu r1, -0x40(r1)
@ -2393,7 +2394,7 @@ void JKRExpHeap::CMemBlock::initiate(JKRExpHeap::CMemBlock*, JKRExpHeap::CMemBlo
* Address: 80021774
* Size: 000044
*/
void JKRExpHeap::CMemBlock::allocFore(unsigned long, unsigned char, unsigned char, unsigned char, unsigned char)
u32 JKRExpHeap::CMemBlock::allocFore(unsigned long, unsigned char, unsigned char, unsigned char, unsigned char)
{
/*
.loc_0x0:
@ -2424,7 +2425,7 @@ void JKRExpHeap::CMemBlock::allocFore(unsigned long, unsigned char, unsigned cha
* Address: 800217B8
* Size: 000058
*/
void JKRExpHeap::CMemBlock::allocBack(unsigned long, unsigned char, unsigned char, unsigned char, unsigned char)
u32 JKRExpHeap::CMemBlock::allocBack(unsigned long, unsigned char, unsigned char, unsigned char, unsigned char)
{
/*
.loc_0x0:
@ -2505,7 +2506,7 @@ lbl_80021850:
* Address: 80021870
* Size: 00001C
*/
void JKRExpHeap::CMemBlock::getHeapBlock(void*)
u32 JKRExpHeap::CMemBlock::getHeapBlock(void*)
{
/*
cmplwi r3, 0
@ -2641,7 +2642,7 @@ void JKRExpHeap::state_compare(const JKRHeap::TState&, const JKRHeap::TState&) c
* Address: 800219B0
* Size: 00000C
*/
void JKRExpHeap::getHeapType()
u32 JKRExpHeap::getHeapType()
{
/*
lis r3, 0x45585048@ha
@ -2655,8 +2656,9 @@ void JKRExpHeap::getHeapType()
* Address: 800219BC
* Size: 000008
*/
void JKRExpHeap::do_getCurrentGroupId()
u8 JKRExpHeap::do_getCurrentGroupId()
{
return m_currentGroupID;
/*
lbz r3, 0x6d(r3)
blr

View File

@ -2,6 +2,7 @@
#include "Dolphin/os.h"
#include "JSystem/JKR/JKRFileCache.h"
#include "JSystem/JKR/JKRFile.h"
#include "JSystem/JKR/JKRFileFinder.h"
#include "JSystem/JKR/JKRHeap.h"
/*
@ -851,7 +852,7 @@ long JKRFileCache::getResSize(const void* resource) const
* Address: 800222C8
* Size: 00007C
*/
int JKRFileCache::countFile(const char* p1) const
u16 JKRFileCache::countFile(const char* p1) const
{
OSFstEntry dir;
OSFstEntry file;
@ -911,7 +912,7 @@ lbl_8002231C:
* Address: 80022344
* Size: 00009C
*/
void* JKRFileCache::getFirstFile(const char* p1) const
JKRFileFinder* JKRFileCache::getFirstFile(const char* p1) const
{
char* path = getDvdPathName(p1);
JKRDvdFinder* finder = new (JKRHeap::sSystemHeap, 0) JKRDvdFinder(path);
@ -977,31 +978,31 @@ lbl_800223C8:
* Address: 800223E0
* Size: 000048
*/
JKRFileFinder::~JKRFileFinder()
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
stw r31, 0xc(r1)
or. r31, r3, r3
beq lbl_80022410
lis r5, __vt__13JKRFileFinder@ha
extsh. r0, r4
addi r0, r5, __vt__13JKRFileFinder@l
stw r0, 0xc(r31)
ble lbl_80022410
bl __dl__FPv
// JKRFileFinder::~JKRFileFinder()
// {
// /*
// stwu r1, -0x10(r1)
// mflr r0
// stw r0, 0x14(r1)
// stw r31, 0xc(r1)
// or. r31, r3, r3
// beq lbl_80022410
// lis r5, __vt__13JKRFileFinder@ha
// extsh. r0, r4
// addi r0, r5, __vt__13JKRFileFinder@l
// stw r0, 0xc(r31)
// ble lbl_80022410
// bl __dl__FPv
lbl_80022410:
lwz r0, 0x14(r1)
mr r3, r31
lwz r31, 0xc(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
// lbl_80022410:
// lwz r0, 0x14(r1)
// mr r3, r31
// lwz r31, 0xc(r1)
// mtlr r0
// addi r1, r1, 0x10
// blr
// */
// }
/*
* --INFO--

View File

@ -1,4 +1,8 @@
#include "Dolphin/dvd.h"
#include "Dolphin/os.h"
#include "types.h"
#include "JSystem/JKR/JKRArchive.h"
#include "JSystem/JKR/JKRFileFinder.h"
/*
Generated from dpostproc
@ -23,8 +27,15 @@
* Address: 80022ADC
* Size: 00008C
*/
JKRArcFinder::JKRArcFinder(JKRArchive*, long, long)
JKRArcFinder::JKRArcFinder(JKRArchive* archive, long p2, long p3)
: JKRFileFinder()
, m_archive(archive)
{
_10 = (bool)p3;
_18 = p2;
_1C = p2 + p3 + -1;
_20 = _18;
findNextFile();
/*
stwu r1, -0x10(r1)
mflr r0
@ -69,55 +80,22 @@ JKRArcFinder::JKRArcFinder(JKRArchive*, long, long)
* Address: 80022B68
* Size: 0000AC
*/
void JKRArcFinder::findNextFile()
bool JKRArcFinder::findNextFile()
{
/*
stwu r1, -0x20(r1)
mflr r0
stw r0, 0x24(r1)
stw r31, 0x1c(r1)
mr r31, r3
lbz r0, 0x10(r3)
cmplwi r0, 0
beq lbl_80022BFC
lwz r0, 0x1c(r31)
lwz r5, 0x20(r31)
srawi r4, r0, 0x1f
srwi r3, r5, 0x1f
subfc r0, r5, r0
adde r0, r4, r3
stb r0, 0x10(r31)
lbz r0, 0x10(r31)
cmplwi r0, 0
beq lbl_80022BFC
lwz r3, 0x14(r31)
addi r4, r1, 8
lwz r5, 0x20(r31)
bl getDirEntry__10JKRArchiveCFPQ210JKRArchive9SDirEntryUl
stb r3, 0x10(r31)
lwz r0, 0xc(r1)
stw r0, 0(r31)
lwz r0, 0x20(r31)
stw r0, 4(r31)
lhz r0, 0xa(r1)
sth r0, 8(r31)
lbz r0, 8(r1)
sth r0, 0xa(r31)
lhz r0, 0xa(r31)
rlwinm r0, r0, 0x1f, 0x1f, 0x1f
stb r0, 0x11(r31)
lwz r3, 0x20(r31)
addi r0, r3, 1
stw r0, 0x20(r31)
lbl_80022BFC:
lwz r0, 0x24(r1)
lbz r3, 0x10(r31)
lwz r31, 0x1c(r1)
mtlr r0
addi r1, r1, 0x20
blr
*/
if (_10) {
_10 = (_20 <= _1C);
if (_10) {
JKRArchive::SDirEntry entry;
_10 = m_archive->getDirEntry(&entry, _20);
m_fileName = entry._04;
_04 = _20;
_08 = entry._02;
_0A = entry._00;
_11 = _0A >> 1 & 1;
_20++;
}
}
return _10;
}
/*
@ -125,102 +103,65 @@ lbl_80022BFC:
* Address: 80022C14
* Size: 000088
*/
JKRDvdFinder::JKRDvdFinder(const char*)
JKRDvdFinder::JKRDvdFinder(const char* p1)
: JKRFileFinder()
{
/*
stwu r1, -0x10(r1)
mflr r0
lis r6, __vt__13JKRFileFinder@ha
lis r5, __vt__12JKRDvdFinder@ha
stw r0, 0x14(r1)
addi r0, r6, __vt__13JKRFileFinder@l
li r6, 0
stw r31, 0xc(r1)
mr r31, r3
stw r0, 0xc(r3)
mr r3, r4
addi r0, r5, __vt__12JKRDvdFinder@l
addi r4, r31, 0x14
stb r6, 0x10(r31)
stb r6, 0x11(r31)
stw r0, 0xc(r31)
bl DVDOpenDir
neg r0, r3
or r0, r0, r3
mr r3, r31
srwi r0, r0, 0x1f
stb r0, 0x20(r31)
lbz r0, 0x20(r31)
stb r0, 0x10(r31)
lwz r12, 0xc(r31)
lwz r12, 0xc(r12)
mtctr r12
bctrl
lwz r0, 0x14(r1)
mr r3, r31
lwz r31, 0xc(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
_20 = DVDOpenDir(const_cast<char*>(p1), &m_fstEntry);
_10 = _20;
findNextFile();
}
/*
* --INFO--
* Address: 80022C9C
* Size: 000080
* __dt__12JKRDvdFinderFv
*/
JKRDvdFinder::~JKRDvdFinder()
// JKRDvdFinder::~JKRDvdFinder()
// {
// }
inline u16 findNextFileHelper(JKRDvdFinder* finder, OSFstEntry& entry)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
stw r31, 0xc(r1)
mr r31, r4
stw r30, 8(r1)
or. r30, r3, r3
beq lbl_80022D00
lis r3, __vt__12JKRDvdFinder@ha
addi r0, r3, __vt__12JKRDvdFinder@l
stw r0, 0xc(r30)
lbz r0, 0x20(r30)
cmplwi r0, 0
beq lbl_80022CDC
addi r3, r30, 0x14
bl DVDCloseDir
lbl_80022CDC:
cmplwi r30, 0
beq lbl_80022CF0
lis r3, __vt__13JKRFileFinder@ha
addi r0, r3, __vt__13JKRFileFinder@l
stw r0, 0xc(r30)
lbl_80022CF0:
extsh. r0, r31
ble lbl_80022D00
mr r3, r30
bl __dl__FPv
lbl_80022D00:
lwz r0, 0x14(r1)
mr r3, r30
lwz r31, 0xc(r1)
lwz r30, 8(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
finder->_11 = (bool)entry.m_nextEntryNum;
finder->m_fileName = entry.m_fileNameMaybe;
finder->_04 = entry.m_entryNum;
finder->_08 = 0;
return finder->_11;
// if (finder->_11) {
// return 2;
// }
// return 1;
}
/*
* --INFO--
* Address: 80022D1C
* Size: 0000A4
* findNextFile__12JKRDvdFinderFv
*/
void JKRDvdFinder::findNextFile()
bool JKRDvdFinder::findNextFile()
{
if (_10) {
OSFstEntry entry;
_10 = DVDReadDir(&m_fstEntry, &entry);
if (_10) {
// _0A = 1;
// _0A = findNextFileHelper(this, entry) ? 2 : 1;
u16 v1 = 1;
_11 = (bool)entry.m_nextEntryNum;
m_fileName = entry.m_fileNameMaybe;
_04 = entry.m_entryNum;
_08 = 0;
// _0A = (_11) ? 2 : v1;
if (_11) {
// _0A = 2;
v1 = 2;
}
_0A = v1;
}
}
return _10;
/*
stwu r1, -0x20(r1)
mflr r0
@ -274,36 +215,8 @@ lbl_80022DA8:
* --INFO--
* Address: 80022DC0
* Size: 00005C
* __dt__12JKRArcFinderFv
*/
JKRArcFinder::~JKRArcFinder()
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
stw r31, 0xc(r1)
or. r31, r3, r3
beq lbl_80022E04
lis r3, __vt__12JKRArcFinder@ha
addi r0, r3, __vt__12JKRArcFinder@l
stw r0, 0xc(r31)
beq lbl_80022DF4
lis r3, __vt__13JKRFileFinder@ha
addi r0, r3, __vt__13JKRFileFinder@l
stw r0, 0xc(r31)
lbl_80022DF4:
extsh. r0, r4
ble lbl_80022E04
mr r3, r31
bl __dl__FPv
lbl_80022E04:
lwz r0, 0x14(r1)
mr r3, r31
lwz r31, 0xc(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
// JKRArcFinder::~JKRArcFinder()
// {
// }

View File

@ -1,4 +1,7 @@
#include "JSystem/JKR/JKRFileLoader.h"
#include "Dolphin/ctype.h"
#include "Dolphin/string.h"
#include "JSystem/JKR/JKRArchive.h"
#include "types.h"
/*
@ -50,89 +53,34 @@
.4byte 0x00000000
*/
static const char* rootPath = "/";
JSUList<JKRFileLoader> JKRFileLoader::sVolumeList;
/*
* --INFO--
* Address: 80022E98
* Size: 000058
*/
JKRFileLoader::JKRFileLoader()
: JKRDisposer()
, _18(this)
, _28(nullptr)
, m_magicWord(0)
, m_mountCount(0)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
stw r31, 0xc(r1)
mr r31, r3
bl __ct__11JKRDisposerFv
lis r3, __vt__13JKRFileLoader@ha
mr r4, r31
addi r0, r3, __vt__13JKRFileLoader@l
addi r3, r31, 0x18
stw r0, 0(r31)
bl __ct__10JSUPtrLinkFPv
li r0, 0
mr r3, r31
stw r0, 0x28(r31)
stw r0, 0x2c(r31)
stw r0, 0x34(r31)
lwz r31, 0xc(r1)
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 80022EF0
* Size: 00008C
* __dt__13JKRFileLoaderFv
*/
JKRFileLoader::~JKRFileLoader()
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
stw r31, 0xc(r1)
mr r31, r4
stw r30, 8(r1)
or. r30, r3, r3
beq lbl_80022F60
lis r3, __vt__13JKRFileLoader@ha
addi r0, r3, __vt__13JKRFileLoader@l
stw r0, 0(r30)
lwz r0, sCurrentVolume__13JKRFileLoader@sda21(r13)
cmplw r0, r30
bne lbl_80022F30
li r0, 0
stw r0, sCurrentVolume__13JKRFileLoader@sda21(r13)
lbl_80022F30:
addic. r0, r30, 0x18
beq lbl_80022F44
addi r3, r30, 0x18
li r4, 0
bl __dt__10JSUPtrLinkFv
lbl_80022F44:
mr r3, r30
li r4, 0
bl __dt__11JKRDisposerFv
extsh. r0, r31
ble lbl_80022F60
mr r3, r30
bl __dl__FPv
lbl_80022F60:
lwz r0, 0x14(r1)
mr r3, r30
lwz r31, 0xc(r1)
lwz r30, 8(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
if (sCurrentVolume == this) {
sCurrentVolume = nullptr;
}
}
/*
@ -142,121 +90,47 @@ lbl_80022F60:
*/
void JKRFileLoader::unmount()
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r4, 0x34(r3)
cmplwi r4, 0
beq lbl_80022FBC
addic. r0, r4, -1
stw r0, 0x34(r3)
bne lbl_80022FBC
cmplwi r3, 0
beq lbl_80022FBC
lwz r12, 0(r3)
li r4, 1
lwz r12, 8(r12)
mtctr r12
bctrl
lbl_80022FBC:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
if (m_mountCount != 0) {
if (--m_mountCount == 0) {
delete this;
}
}
}
/*
* --INFO--
* Address: 80022FCC
* Size: 00004C
* getGlbResource__13JKRFileLoaderFPCc
*/
void* JKRFileLoader::getGlbResource(const char*)
void* JKRFileLoader::getGlbResource(const char* path)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
stw r3, 8(r1)
addi r3, r1, 8
bl findVolume__13JKRFileLoaderFPPCc
cmplwi r3, 0
bne lbl_80022FF4
li r3, 0
b lbl_80023008
lbl_80022FF4:
lwz r12, 0(r3)
lwz r4, 8(r1)
lwz r12, 0x14(r12)
mtctr r12
bctrl
lbl_80023008:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
const char* components[2];
components[0] = path;
JKRFileLoader* loader = findVolume(components);
return (loader == nullptr) ? nullptr : loader->getResource(components[0]);
}
/*
* --INFO--
* Address: 80023018
* Size: 000098
* getGlbResource__13JKRFileLoaderFPCcP13JKRFileLoader
*/
void* JKRFileLoader::getGlbResource(const char*, JKRFileLoader*)
void* JKRFileLoader::getGlbResource(const char* p1, JKRFileLoader* p2)
{
/*
stwu r1, -0x10(r1)
mflr r0
cmplwi r4, 0
stw r0, 0x14(r1)
stw r31, 0xc(r1)
stw r30, 8(r1)
mr r30, r3
li r3, 0
beq lbl_8002305C
mr r3, r4
mr r5, r30
lwz r12, 0(r4)
li r4, 0
lwz r12, 0x18(r12)
mtctr r12
bctrl
b lbl_80023098
lbl_8002305C:
lis r4, sVolumeList__13JKRFileLoader@ha
lwz r31, sVolumeList__13JKRFileLoader@l(r4)
b lbl_80023090
lbl_80023068:
lwz r3, 0(r31)
mr r5, r30
li r4, 0
lwz r12, 0(r3)
lwz r12, 0x18(r12)
mtctr r12
bctrl
cmplwi r3, 0
bne lbl_80023098
lwz r31, 0xc(r31)
lbl_80023090:
cmplwi r31, 0
bne lbl_80023068
lbl_80023098:
lwz r0, 0x14(r1)
lwz r31, 0xc(r1)
lwz r30, 8(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
void* resource = nullptr;
if (p2) {
resource = p2->getResource(0, p1);
} else {
for (JSULink<JKRFileLoader>* link = sVolumeList.getFirst(); link != nullptr; link = link->getNext()) {
resource = link->getObject()->getResource(0, p1);
if (resource) {
break;
}
}
}
return resource;
}
/*
@ -264,8 +138,22 @@ lbl_80023098:
* Address: 800230B0
* Size: 00008C
*/
JKRArchive* JKRFileLoader::findVolume(const char**)
JKRFileLoader* JKRFileLoader::findVolume(const char** components)
{
// TODO: Should this be 0x101 or 0x102?
char nameBuffer[0x104];
if (*components[0] != '/') {
return sCurrentVolume;
}
fetchVolumeName(nameBuffer, 0x101, components[0]);
components[0] = nameBuffer;
// TODO: Link shenanigans
for (JSULink<JKRFileLoader>* link = sVolumeList.getFirst(); link != nullptr; link = link->getNext()) {
if (strcmp(nameBuffer, link->getObject()->_28) == 0) {
return link->getObject();
}
}
return nullptr;
/*
stwu r1, -0x120(r1)
mflr r0
@ -320,8 +208,20 @@ lbl_80023128:
* Address: 8002313C
* Size: 0000E0
*/
void JKRFileLoader::fetchVolumeName(char*, long, const char*)
void JKRFileLoader::fetchVolumeName(char* nameBuffer, long bufferLength, const char* path)
{
if (strcmp(path, "/") == 0) {
strcpy(nameBuffer, rootPath);
} else {
for (const char* v1 = path + 1; *v1 != '\0' && *v1 != '/'; v1++) {
if (1 < bufferLength) {
*nameBuffer = (*v1 == -1) ? -1 : tolower(*v1);
nameBuffer++;
bufferLength--;
}
}
*nameBuffer = '\0';
}
/*
stwu r1, -0x20(r1)
mflr r0
@ -405,59 +305,59 @@ lbl_80023200:
* Address: 8002321C
* Size: 000044
*/
void __sinit_JKRFileLoader_cpp(void)
{
/*
stwu r1, -0x10(r1)
mflr r0
lis r3, sVolumeList__13JKRFileLoader@ha
stw r0, 0x14(r1)
addi r3, r3, sVolumeList__13JKRFileLoader@l
bl initiate__10JSUPtrListFv
lis r3, sVolumeList__13JKRFileLoader@ha
lis r4, "__dt__24JSUList<13JKRFileLoader>Fv"@ha
lis r5, lbl_804EFFA0@ha
addi r3, r3, sVolumeList__13JKRFileLoader@l
addi r4, r4, "__dt__24JSUList<13JKRFileLoader>Fv"@l
addi r5, r5, lbl_804EFFA0@l
bl __register_global_object
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
// void __sinit_JKRFileLoader_cpp(void)
// {
// /*
// stwu r1, -0x10(r1)
// mflr r0
// lis r3, sVolumeList__13JKRFileLoader@ha
// stw r0, 0x14(r1)
// addi r3, r3, sVolumeList__13JKRFileLoader@l
// bl initiate__10JSUPtrListFv
// lis r3, sVolumeList__13JKRFileLoader@ha
// lis r4, "__dt__24JSUList<13JKRFileLoader>Fv"@ha
// lis r5, lbl_804EFFA0@ha
// addi r3, r3, sVolumeList__13JKRFileLoader@l
// addi r4, r4, "__dt__24JSUList<13JKRFileLoader>Fv"@l
// addi r5, r5, lbl_804EFFA0@l
// bl __register_global_object
// lwz r0, 0x14(r1)
// mtlr r0
// addi r1, r1, 0x10
// blr
// */
// }
/*
* --INFO--
* Address: 80023260
* Size: 000054
*/
void JSUList<JKRFileLoader>::~JSUList()
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
stw r31, 0xc(r1)
mr r31, r4
stw r30, 8(r1)
or. r30, r3, r3
beq lbl_80023298
li r4, 0
bl __dt__10JSUPtrListFv
extsh. r0, r31
ble lbl_80023298
mr r3, r30
bl __dl__FPv
// void JSUList<JKRFileLoader>::~JSUList()
// {
// /*
// stwu r1, -0x10(r1)
// mflr r0
// stw r0, 0x14(r1)
// stw r31, 0xc(r1)
// mr r31, r4
// stw r30, 8(r1)
// or. r30, r3, r3
// beq lbl_80023298
// li r4, 0
// bl __dt__10JSUPtrListFv
// extsh. r0, r31
// ble lbl_80023298
// mr r3, r30
// bl __dl__FPv
lbl_80023298:
lwz r0, 0x14(r1)
mr r3, r30
lwz r31, 0xc(r1)
lwz r30, 8(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
// lbl_80023298:
// lwz r0, 0x14(r1)
// mr r3, r30
// lwz r31, 0xc(r1)
// lwz r30, 8(r1)
// mtlr r0
// addi r1, r1, 0x10
// blr
// */
// }

View File

@ -94,10 +94,10 @@ typedef void Destructor(void*, short);
#define INVOKE_VIRT_DTOR(o, v) (((*(Destructor***)(o))[2])((o), (v)))
/*
* __ct__
* --INFO--
* Address: 800232B4
* Size: 000124
* __ct__7JKRHeapFPvUlP7JKRHeapb
*/
JKRHeap::JKRHeap(void* startPtr, u32 size, JKRHeap* parentHeap, bool shouldSetErrorHandlerMaybe)
: _40()
@ -412,13 +412,6 @@ JKRHeap* JKRHeap::becomeSystemHeap()
JKRHeap* old = sSystemHeap;
sSystemHeap = this;
return old;
/*
.loc_0x0:
lwz r0, -0x77D8(r13)
stw r3, -0x77D8(r13)
mr r3, r0
blr
*/
}
/*
@ -431,13 +424,6 @@ JKRHeap* JKRHeap::becomeCurrentHeap()
JKRHeap* old = sCurrentHeap;
sCurrentHeap = this;
return old;
/*
.loc_0x0:
lwz r0, -0x77D4(r13)
stw r3, -0x77D4(r13)
mr r3, r0
blr
*/
}
/*
@ -445,24 +431,7 @@ JKRHeap* JKRHeap::becomeCurrentHeap()
* Address: 800235B4
* Size: 00002C
*/
void JKRHeap::destroy()
{
do_destroy();
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r12, 0x0(r3)
lwz r12, 0x20(r12)
mtctr r12
bctrl
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
void JKRHeap::destroy() { do_destroy(); }
/*
* --INFO--
@ -480,41 +449,6 @@ void* JKRHeap::alloc(u32 byteCount, int padding, JKRHeap* heap)
memory = nullptr;
}
return memory;
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
cmplwi r5, 0
mr r6, r3
stw r0, 0x14(r1)
mr r0, r4
beq- .loc_0x30
mr r3, r5
mr r4, r6
mr r5, r0
bl .loc_0x60
b .loc_0x50
.loc_0x30:
lwz r3, -0x77D4(r13)
cmplwi r3, 0
beq- .loc_0x4C
mr r4, r6
mr r5, r0
bl .loc_0x60
b .loc_0x50
.loc_0x4C:
li r3, 0
.loc_0x50:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
.loc_0x60:
*/
}
/*
@ -551,33 +485,6 @@ void JKRHeap::free(void* memory, JKRHeap* heap)
if ((heap) || (heap = findFromRoot(memory), heap)) {
heap->free(memory);
}
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
cmplwi r4, 0
stw r0, 0x14(r1)
stw r31, 0xC(r1)
mr r31, r3
bne- .loc_0x28
bl 0x26C
mr. r4, r3
beq- .loc_0x34
.loc_0x28:
mr r3, r4
mr r4, r31
bl .loc_0x48
.loc_0x34:
lwz r0, 0x14(r1)
lwz r31, 0xC(r1)
mtlr r0
addi r1, r1, 0x10
blr
.loc_0x48:
*/
}
/*
@ -650,190 +557,63 @@ void JKRHeap::callAllDisposer()
* Address: 80023730
* Size: 00002C
*/
void JKRHeap::freeAll()
{
do_freeAll();
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r12, 0x0(r3)
lwz r12, 0x2C(r12)
mtctr r12
bctrl
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
void JKRHeap::freeAll() { do_freeAll(); }
/*
* --INFO--
* Address: 8002375C
* Size: 00002C
*/
void JKRHeap::freeTail()
{
do_freeTail();
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r12, 0x0(r3)
lwz r12, 0x30(r12)
mtctr r12
bctrl
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
void JKRHeap::freeTail() { do_freeTail(); }
/*
* --INFO--
* Address: 80023788
* Size: 00002C
*/
void JKRHeap::resize(void* memoryBlock, u32 newSize)
{
do_resize(memoryBlock, newSize);
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r12, 0x0(r3)
lwz r12, 0x38(r12)
mtctr r12
bctrl
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
void JKRHeap::resize(void* memoryBlock, u32 newSize) { do_resize(memoryBlock, newSize); }
/*
* --INFO--
* Address: 800237B4
* Size: 00002C
*/
u32 JKRHeap::getFreeSize()
{
return do_getFreeSize();
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r12, 0x0(r3)
lwz r12, 0x40(r12)
mtctr r12
bctrl
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
u32 JKRHeap::getFreeSize() { return do_getFreeSize(); }
/*
* --INFO--
* Address: 800237E0
* Size: 00002C
*/
i32 JKRHeap::getTotalFreeSize()
{
return do_getTotalFreeSize();
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r12, 0x0(r3)
lwz r12, 0x48(r12)
mtctr r12
bctrl
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
u32 JKRHeap::getTotalFreeSize() { return do_getTotalFreeSize(); }
/*
* --INFO--
* Address: 8002380C
* Size: 00002C
*/
u8 JKRHeap::changeGroupID(u8 newGroupID)
{
return do_changeGroupID(newGroupID);
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r12, 0x0(r3)
lwz r12, 0x4C(r12)
mtctr r12
bctrl
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
u8 JKRHeap::changeGroupID(u8 newGroupID) { return do_changeGroupID(newGroupID); }
/*
* --INFO--
* Address: 80023838
* Size: 000008
*/
u8 JKRHeap::do_changeGroupID(u8 newGroupID)
{
return 0;
return 0x0;
}
u8 JKRHeap::do_changeGroupID(u8 newGroupID) { return 0; }
/*
* --INFO--
* Address: 80023840
* Size: 00002C
*/
u8 JKRHeap::getCurrentGroupId()
{
return do_getCurrentGroupId();
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r12, 0x0(r3)
lwz r12, 0x50(r12)
mtctr r12
bctrl
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
u8 JKRHeap::getCurrentGroupId() { return do_getCurrentGroupId(); }
/*
* --INFO--
* Address: 8002386C
* Size: 000008
*/
u8 JKRHeap::do_getCurrentGroupId()
{
return 0;
return 0x0;
}
u8 JKRHeap::do_getCurrentGroupId() { return 0; }
/*
* TODO: What does p1 mean? Alignment?
@ -901,36 +681,13 @@ JKRHeap* JKRHeap::findFromRoot(void* memory)
// return findings;
// // Above isn't tested, but this is cleaner:
return (sRootHeap) ? sRootHeap->find(memory) : nullptr;
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
mr r4, r3
stw r0, 0x14(r1)
lwz r0, -0x77D0(r13)
cmplwi r0, 0
beq- .loc_0x28
mr r3, r0
bl .loc_0x3C
b .loc_0x2C
.loc_0x28:
li r3, 0
.loc_0x2C:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
.loc_0x3C:
*/
}
/*
* --INFO--
* Address: 80023930
* Size: 000270
* find__7JKRHeapCFPv
*/
JKRHeap* JKRHeap::find(void* memory) const
{
@ -1175,19 +932,19 @@ JKRHeap* JKRHeap::find(void* memory) const
* Address: 80023BA0
* Size: 000014
*/
template <> JKRHeap* JSUTree<JKRHeap>::getNextChild() const
{
JSUPtrLink* next = m_link.m_next;
return (next) ? (JKRHeap*)next[-1].m_list : nullptr;
/*
.loc_0x0:
lwz r3, 0x18(r3)
cmplwi r3, 0
beqlr-
subi r3, r3, 0xC
blr
*/
}
// template <> JKRHeap* JSUTree<JKRHeap>::getNextChild() const
// {
// JSUPtrLink* next = m_link.m_next;
// return (next) ? (JKRHeap*)next[-1].m_list : nullptr;
// /*
// .loc_0x0:
// lwz r3, 0x18(r3)
// cmplwi r3, 0
// beqlr-
// subi r3, r3, 0xC
// blr
// */
// }
/*
* --INFO--
@ -1212,14 +969,14 @@ template <> bool JSUTreeIterator<JKRHeap>::operator!=(const JSUTree<JKRHeap>*) c
* Address: 80023BCC
* Size: 000008
*/
template <> JKRHeap* JSUTree<JKRHeap>::getEndChild() const { return nullptr; }
template <> JSUTree<JKRHeap>* JSUTree<JKRHeap>::getEndChild() const { return nullptr; }
/*
* --INFO--
* Address: 80023BD4
* Size: 00001C
*/
template <> void JSUTreeIterator<JKRHeap>::operator++()
template <> JSUTreeIterator<JKRHeap>& JSUTreeIterator<JKRHeap>::operator++()
{
/*
lwz r4, 0(r3)
@ -1239,7 +996,7 @@ lbl_80023BE8:
* Address: 80023BF0
* Size: 00000C
*/
template <> JKRHeap* JSUTreeIterator<JKRHeap>::operator->() const { return (JKRHeap*)m_tree->m_link.m_value; }
template <> JKRHeap* JSUTreeIterator<JKRHeap>::operator->() const { return getObject(); }
/*
* --INFO--
@ -1257,14 +1014,14 @@ JSUTreeIterator<JKRHeap>::JSUTreeIterator(JSUTree<JKRHeap>* tree)
* Address: 80023C04
* Size: 000008
*/
template <> int JSUTree<JKRHeap>::getNumChildren() const { return m_list.m_linkCount; }
template <> int JSUTree<JKRHeap>::getNumChildren() const { return getNumLinks(); }
/*
* --INFO--
* Address: 80023C0C
* Size: 000014
*/
template <> JKRHeap* JSUTree<JKRHeap>::getFirstChild() const
template <> JSUTree<JKRHeap>* JSUTree<JKRHeap>::getFirstChild() const
{
/*
lwz r3, 0(r3)
@ -1280,7 +1037,7 @@ template <> JKRHeap* JSUTree<JKRHeap>::getFirstChild() const
* Address: 80023C20
* Size: 000008
*/
JSUPtrLink* JSUPtrList::getFirstLink() const { return m_head; }
// JSUPtrLink* JSUPtrList::getFirstLink() const { return m_head; }
/*
* --INFO--
@ -1423,6 +1180,7 @@ lbl_80023D4C:
* --INFO--
* Address: 80023D74
* Size: 000050
* dispose__7JKRHeapFv
*/
void JKRHeap::dispose()
{
@ -1519,8 +1277,7 @@ lbl_80023E38:
*/
void JKRDefaultMemoryErrorRoutine(void*, unsigned long, int)
{
#line 791
OSError("abort\n");
OSErrorLine(791, "abort\n");
/*
.loc_0x0:
stwu r1, -0x10(r1)
@ -1552,105 +1309,29 @@ JKRHeapErrorHandler* JKRHeap::setErrorHandler(JKRHeapErrorHandler* newHandler)
}
mErrorHandler = newHandler;
return oldHandler;
/*
.loc_0x0:
cmplwi r3, 0
lwz r0, -0x77CC(r13)
bne- .loc_0x14
lis r3, 0x8002
addi r3, r3, 0x3E50
.loc_0x14:
stw r3, -0x77CC(r13)
mr r3, r0
blr
*/
}
/*
* --INFO--
* Address: 80023EA4
* Size: 00004C
* __nw__FUl
*/
void* operator new(u32 byteCount)
{
return (JKRHeap::sCurrentHeap) ? JKRHeap::sCurrentHeap->do_alloc(byteCount, 4) : nullptr;
// void* memory;
// if (JKRHeap::sCurrentHeap) {
// memory = JKRHeap::sCurrentHeap->do_alloc(byteCount, 4);
// } else {
// memory = nullptr;
// }
// return memory;
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
mr r4, r3
stw r0, 0x14(r1)
lwz r0, -0x77D4(r13)
cmplwi r0, 0
beq- .loc_0x38
mr r3, r0
li r5, 0x4
lwz r12, 0x0(r3)
lwz r12, 0x24(r12)
mtctr r12
bctrl
b .loc_0x3C
.loc_0x38:
li r3, 0
.loc_0x3C:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
void* operator new(u32 byteCount) { return (JKRHeap::sCurrentHeap) ? JKRHeap::sCurrentHeap->do_alloc(byteCount, 4) : nullptr; }
/*
* --INFO--
* Address: 80023EF0
* Size: 000050
* __nw__FUli
*/
void* operator new(u32 byteCount, int p2)
{
return (JKRHeap::sCurrentHeap) ? JKRHeap::sCurrentHeap->do_alloc(byteCount, p2) : nullptr;
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
mr r6, r3
mr r5, r4
stw r0, 0x14(r1)
lwz r0, -0x77D4(r13)
cmplwi r0, 0
beq- .loc_0x3C
mr r3, r0
mr r4, r6
lwz r12, 0x0(r3)
lwz r12, 0x24(r12)
mtctr r12
bctrl
b .loc_0x40
.loc_0x3C:
li r3, 0
.loc_0x40:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
void* operator new(u32 byteCount, int p2) { return (JKRHeap::sCurrentHeap) ? JKRHeap::sCurrentHeap->do_alloc(byteCount, p2) : nullptr; }
/*
* --INFO--
* Address: 80023F40
* Size: 00006C
* __nw__FUlP7JKRHeapi
*/
void* operator new(u32 byteCount, JKRHeap* heap, int p3)
{
@ -1659,121 +1340,29 @@ void* operator new(u32 byteCount, JKRHeap* heap, int p3)
} else {
return (JKRHeap::sCurrentHeap) ? JKRHeap::sCurrentHeap->do_alloc(byteCount, p3) : nullptr;
}
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
cmplwi r4, 0
stw r0, 0x14(r1)
mr r0, r3
beq- .loc_0x34
mr r3, r4
mr r4, r0
lwz r12, 0x0(r3)
lwz r12, 0x24(r12)
mtctr r12
bctrl
b .loc_0x5C
.loc_0x34:
lwz r3, -0x77D4(r13)
cmplwi r3, 0
beq- .loc_0x58
lwz r12, 0x0(r3)
mr r4, r0
lwz r12, 0x24(r12)
mtctr r12
bctrl
b .loc_0x5C
.loc_0x58:
li r3, 0
.loc_0x5C:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 80023FAC
* Size: 00004C
* __nwa__FUl
*/
void* operator new[](u32 byteCount)
{
return (JKRHeap::sCurrentHeap) ? JKRHeap::sCurrentHeap->do_alloc(byteCount, 4) : nullptr;
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
mr r4, r3
stw r0, 0x14(r1)
lwz r0, -0x77D4(r13)
cmplwi r0, 0
beq- .loc_0x38
mr r3, r0
li r5, 0x4
lwz r12, 0x0(r3)
lwz r12, 0x24(r12)
mtctr r12
bctrl
b .loc_0x3C
.loc_0x38:
li r3, 0
.loc_0x3C:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
void* operator new[](u32 byteCount) { return (JKRHeap::sCurrentHeap) ? JKRHeap::sCurrentHeap->do_alloc(byteCount, 4) : nullptr; }
/*
* --INFO--
* Address: 80023FF8
* Size: 000050
* __nwa__FUli
*/
void* operator new[](u32 byteCount, int p2)
{
return (JKRHeap::sCurrentHeap) ? JKRHeap::sCurrentHeap->do_alloc(byteCount, p2) : nullptr;
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
mr r6, r3
mr r5, r4
stw r0, 0x14(r1)
lwz r0, -0x77D4(r13)
cmplwi r0, 0
beq- .loc_0x3C
mr r3, r0
mr r4, r6
lwz r12, 0x0(r3)
lwz r12, 0x24(r12)
mtctr r12
bctrl
b .loc_0x40
.loc_0x3C:
li r3, 0
.loc_0x40:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
void* operator new[](u32 byteCount, int p2) { return (JKRHeap::sCurrentHeap) ? JKRHeap::sCurrentHeap->do_alloc(byteCount, p2) : nullptr; }
/*
* --INFO--
* Address: 80024048
* Size: 00006C
* __nwa__FUlP7JKRHeapi
*/
void* operator new[](u32 byteCount, JKRHeap* heap, int p3)
{
@ -1782,48 +1371,13 @@ void* operator new[](u32 byteCount, JKRHeap* heap, int p3)
} else {
return (JKRHeap::sCurrentHeap) ? JKRHeap::sCurrentHeap->do_alloc(byteCount, p3) : nullptr;
}
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
cmplwi r4, 0
stw r0, 0x14(r1)
mr r0, r3
beq- .loc_0x34
mr r3, r4
mr r4, r0
lwz r12, 0x0(r3)
lwz r12, 0x24(r12)
mtctr r12
bctrl
b .loc_0x5C
.loc_0x34:
lwz r3, -0x77D4(r13)
cmplwi r3, 0
beq- .loc_0x58
lwz r12, 0x0(r3)
mr r4, r0
lwz r12, 0x24(r12)
mtctr r12
bctrl
b .loc_0x5C
.loc_0x58:
li r3, 0
.loc_0x5C:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 800240B4
* Size: 000024
* __dl__FPv
*/
void operator delete(void* memory)
{
@ -1846,6 +1400,7 @@ void operator delete(void* memory)
* --INFO--
* Address: 800240D8
* Size: 000024
* __dla__FPv
*/
void operator delete[](void* memory)
{
@ -1864,10 +1419,41 @@ void operator delete[](void* memory)
*/
}
/*
* --INFO--
* Address: ........
* Size: 00007C
*/
JKRHeap::TState::TState(const JKRHeap::TState::TArgument& arg, const JKRHeap::TState::TLocation& location)
{
// UNUSED FUNCTION
}
/*
* --INFO--
* Address: ........
* Size: 000080
*/
JKRHeap::TState::TState(const JKRHeap::TState& other, bool p2)
{
// UNUSED FUNCTION
}
/*
* --INFO--
* Address: ........
* Size: 000080
*/
JKRHeap::TState::TState(const JKRHeap::TState& other, const JKRHeap::TState::TLocation& location, bool p3)
{
// UNUSED FUNCTION
}
/*
* --INFO--
* Address: 800240FC
* Size: 000414
* __dt__Q27JKRHeap6TStateFv
*/
JKRHeap::TState::~TState()
{
@ -2225,6 +1811,7 @@ bool JKRHeap::TState::isVerbose() { return bVerbose; }
* --INFO--
* Address: 8002454C
* Size: 000080
* __ct__Q27JKRHeap6TStateFPC7JKRHeapUlb
*/
JKRHeap::TState::TState(const JKRHeap* heap, u32 id, bool isCompareOnDestructed)
: _00(0)
@ -2236,45 +1823,6 @@ JKRHeap::TState::TState(const JKRHeap* heap, u32 id, bool isCompareOnDestructed)
, _20(-1)
{
m_heap->state_register(this, m_id);
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
cmplwi r4, 0
stw r0, 0x14(r1)
li r0, 0
stw r31, 0xC(r1)
mr r31, r3
stw r0, 0x0(r3)
stw r0, 0x4(r3)
beq- .loc_0x2C
b .loc_0x30
.loc_0x2C:
lwz r4, -0x77D4(r13)
.loc_0x30:
stw r4, 0x10(r31)
li r3, 0
li r0, -0x1
mr r4, r31
stw r5, 0x14(r31)
stb r6, 0x18(r31)
stw r3, 0x1C(r31)
stw r0, 0x20(r31)
lwz r3, 0x10(r31)
lwz r5, 0x14(r31)
lwz r12, 0x0(r3)
lwz r12, 0x54(r12)
mtctr r12
bctrl
lwz r0, 0x14(r1)
mr r3, r31
lwz r31, 0xC(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
@ -2299,27 +1847,13 @@ JKRHeap::TState::TLocation::TLocation()
* --INFO--
* Address: 800245E8
* Size: 000020
* __ct__Q37JKRHeap6TState9TArgumentFPC7JKRHeapUlb
*/
JKRHeap::TState::TArgument::TArgument(const JKRHeap* heap, u32 p2, bool p3)
: m_heap((heap) ? heap : JKRHeap::sCurrentHeap)
, _04(p2)
, _08(p3)
{
/*
.loc_0x0:
cmplwi r4, 0
beq- .loc_0xC
b .loc_0x10
.loc_0xC:
lwz r4, -0x77D4(r13)
.loc_0x10:
stw r4, 0x0(r3)
stw r5, 0x4(r3)
stb r6, 0x8(r3)
blr
*/
}
/*

View File

@ -1,3 +1,9 @@
#include "Dolphin/os.h"
#include "Dolphin/stl.h"
#include "JSystem/JKR/JKRArchive.h"
#include "JSystem/JKR/JKRDvdRipper.h"
#include "JSystem/JKR/JKRHeap.h"
#include "JSystem/JUT/JUTException.h"
#include "types.h"
/*
@ -43,9 +49,19 @@
* --INFO--
* Address: 80024644
* Size: 0000BC
* __ct__13JKRMemArchiveFlQ210JKRArchive15EMountDirection
*/
JKRMemArchive::JKRMemArchive(long, JKRArchive::EMountDirection)
JKRMemArchive::JKRMemArchive(long p1, JKRArchive::EMountDirection mountDirection)
: JKRArchive(p1, EMM_Mem)
{
_30 = 0;
m_mountDirection = mountDirection;
if (open(p1, m_mountDirection)) {
m_magicWord = 'RARC';
_28 = _54 + _48->_04;
sVolumeList.prepend(&_18);
_30 = 1;
}
/*
stwu r1, -0x20(r1)
mflr r0
@ -105,9 +121,18 @@ lbl_800246E4:
* --INFO--
* Address: 80024700
* Size: 0000C8
* __ct__13JKRMemArchiveFPvUl15JKRMemBreakFlag
*/
JKRMemArchive::JKRMemArchive(void*, unsigned long, JKRMemBreakFlag)
JKRMemArchive::JKRMemArchive(void* p1, unsigned long p2, JKRMemBreakFlag flag)
: JKRArchive((long)p1, EMM_Mem)
{
_30 = 0;
if (open(p1, p2, flag)) {
m_magicWord = 'RARC';
_28 = _54 + _48->_04;
sVolumeList.prepend(&_18);
_30 = 1;
}
/*
stwu r1, -0x20(r1)
mflr r0
@ -230,8 +255,44 @@ lbl_80024854:
* Address: 80024870
* Size: 000168
*/
void JKRMemArchive::open(long, JKRArchive::EMountDirection)
bool JKRMemArchive::open(long p1, EMountDirection mountDirection)
{
_64 = nullptr;
_44 = nullptr;
_68 = nullptr;
_48 = nullptr;
m_fileEntries = nullptr;
_54 = 0;
_6C = 0;
m_mountDirection = mountDirection;
if (m_mountDirection == EMD_Unk1) {
u32 v1;
_64 = (JKRMemArchive_64*)JKRDvdRipper::loadToMainRAM(p1, nullptr, Switch_1, 0, _38, JKRDvdRipper::ALLOC_DIR_TOP, 0, &_5C, &v1);
if (_64) {
DCInvalidateRange(_64, v1);
}
} else {
u32 v1;
_64 = (JKRMemArchive_64*)JKRDvdRipper::loadToMainRAM(p1, nullptr, Switch_1, 0, _38, JKRDvdRipper::ALLOC_DIR_BOTTOM, 0, &_5C, &v1);
if (_64) {
DCInvalidateRange(_64, v1);
}
}
if (_64 == nullptr) {
m_mountMode = EMM_Unk0;
} else {
_44 = (JKRArchive_44*)((u8*)_64 + _64->_08);
_48 = (SDirEntry*)((u8*)_44 + _44->m_offsetOfDirEntry);
m_fileEntries = (SDIFileEntry*)((u8*)_44 + _44->m_offsetOfFileEntry);
_54 = (s32)((u8*)_44 + _44->_14);
// u32 v1 = _64->_0C + _64->_08;
// u32 v1 = _64->_08 + _64->_0C;
// _68 = v1 + (u8*)_64;
// TODO: funny regswap
_68 = (u8*)_64 + _64->_0C + _64->_08;
_6C = 1;
}
return (m_mountMode != EMM_Unk0);
/*
stwu r1, -0x20(r1)
mflr r0
@ -340,9 +401,24 @@ lbl_800249B4:
* --INFO--
* Address: 800249D8
* Size: 0000AC
* open__13JKRMemArchiveFPvUl15JKRMemBreakFlag
*/
void JKRMemArchive::open(void*, unsigned long, JKRMemBreakFlag)
bool JKRMemArchive::open(void* p1, unsigned long p2, JKRMemBreakFlag p3)
{
_64 = (JKRMemArchive_64*)p1;
_44 = (JKRArchive_44*)((u8*)_64 + _64->_08);
_48 = (SDirEntry*)((u8*)_44 + _44->m_offsetOfDirEntry);
m_fileEntries = (SDIFileEntry*)((u8*)_44 + _44->m_offsetOfFileEntry);
_54 = (s32)((u8*)_44 + _44->_14);
// u32 v1 = _64->_0C + _64->_08;
// u32 v1 = _64->_08 + _64->_0C;
// _68 = v1 + (u8*)_64;
// TODO: funny regswap
_68 = (u8*)_64 + _64->_0C + _64->_08;
_6C = p3 == MBF_1;
_38 = JKRHeap::findFromRoot(p1);
_5C = 0;
return true;
/*
stwu r1, -0x10(r1)
mflr r0
@ -394,36 +470,26 @@ void JKRMemArchive::open(void*, unsigned long, JKRMemBreakFlag)
* --INFO--
* Address: 80024A84
* Size: 000034
* fetchResource__13JKRMemArchiveFPQ210JKRArchive12SDIFileEntryPUl
*/
void JKRMemArchive::fetchResource(JKRArchive::SDIFileEntry*, unsigned long*)
void* JKRMemArchive::fetchResource(JKRArchive::SDIFileEntry* entry, unsigned long* outSize)
{
/*
lwz r0, 0x10(r4)
cmplwi r0, 0
bne lbl_80024AA0
lwz r3, 0x68(r3)
lwz r0, 8(r4)
add r0, r3, r0
stw r0, 0x10(r4)
lbl_80024AA0:
cmplwi r5, 0
beq lbl_80024AB0
lwz r0, 0xc(r4)
stw r0, 0(r5)
lbl_80024AB0:
lwz r3, 0x10(r4)
blr
*/
if (entry->_10 == nullptr) {
entry->_10 = _68 + entry->_08;
}
if (outSize != nullptr) {
*outSize = entry->m_size;
}
return entry->_10;
}
/*
* --INFO--
* Address: 80024AB8
* Size: 0000C8
* fetchResource__13JKRMemArchiveFPvUlPQ210JKRArchive12SDIFileEntryPUl
*/
void JKRMemArchive::fetchResource(void*, unsigned long, JKRArchive::SDIFileEntry*, unsigned long*)
void* JKRMemArchive::fetchResource(void*, unsigned long, JKRArchive::SDIFileEntry*, unsigned long*)
{
/*
.loc_0x0:
@ -494,71 +560,42 @@ void JKRMemArchive::fetchResource(void*, unsigned long, JKRArchive::SDIFileEntry
*/
}
/*
/**
* --INFO--
* Address: 80024B80
* Size: 000050
* @warning This method does not actually iterate through m_fileEntries. This feels like a bug.
*/
void JKRMemArchive::removeResourceAll()
{
/*
lwz r0, 0x44(r3)
cmplwi r0, 0
beqlr
lbz r0, 0x3c(r3)
cmplwi r0, 1
beqlr
lwz r6, 0x4c(r3)
li r7, 0
li r5, 0
b lbl_80024BBC
lbl_80024BA8:
lwz r0, 0x10(r6)
cmplwi r0, 0
beq lbl_80024BB8
stw r5, 0x10(r6)
lbl_80024BB8:
addi r7, r7, 1
lbl_80024BBC:
lwz r4, 0x44(r3)
lwz r0, 8(r4)
cmplw r7, r0
blt lbl_80024BA8
blr
*/
if (_44 == nullptr) {
return;
}
if (m_mountMode == EMM_Mem) {
return;
}
SDIFileEntry* entry = m_fileEntries;
for (u32 i = 0; i < _44->_08; i++) {
if (entry->_10 != nullptr) {
entry->_10 = nullptr;
}
}
}
/*
* --INFO--
* Address: 80024BD0
* Size: 00003C
* removeResource__13JKRMemArchiveFPv
*/
void JKRMemArchive::removeResource(void*)
bool JKRMemArchive::removeResource(void* p1)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
bl findPtrResource__10JKRArchiveCFPCv
cmplwi r3, 0
bne lbl_80024BF0
li r3, 0
b lbl_80024BFC
lbl_80024BF0:
li r0, 0
stw r0, 0x10(r3)
li r3, 1
lbl_80024BFC:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
SDIFileEntry* entry = findPtrResource(p1);
if (!entry) {
return false;
}
entry->_10 = nullptr;
return true;
}
/*
@ -566,8 +603,27 @@ lbl_80024BFC:
* Address: 80024C0C
* Size: 0000D4
*/
void JKRMemArchive::fetchResource_subroutine(unsigned char*, unsigned long, unsigned char*, unsigned long, int)
u32 JKRMemArchive::fetchResource_subroutine(unsigned char* p1, unsigned long p2, unsigned char* p3, unsigned long p4, int p5)
{
switch (p5) {
case 0:
if (p2 > p4) {
p2 = p4;
}
memcpy(p3, p1, p2);
break;
case 1:
case 2: {
u8* p = (u8*)p1;
p2 = MIN(p2, p[4] << 0x18 | p[5] << 0x10 | p[6] << 8 | p[7]);
// JKRDecomp::orderSync(p1, p3, p2, 0);
break;
}
default:
JUT_PANICLINE(723, ":::??? bad sequence\n");
return 0;
}
return p2;
/*
.loc_0x0:
stwu r1, -0x10(r1)
@ -643,50 +699,15 @@ void JKRMemArchive::fetchResource_subroutine(unsigned char*, unsigned long, unsi
* Address: 80024CE0
* Size: 000090
*/
void JKRMemArchive::getExpandedResSize(const void*) const
u32 JKRMemArchive::getExpandedResSize(const void* p1) const
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
stw r31, 0xc(r1)
mr r31, r4
stw r30, 8(r1)
mr r30, r3
bl findPtrResource__10JKRArchiveCFPCv
cmplwi r3, 0
bne lbl_80024D10
li r3, -1
b lbl_80024D58
lbl_80024D10:
lwz r0, 4(r3)
rlwinm. r0, r0, 8, 0x1d, 0x1d
bne lbl_80024D38
mr r3, r30
mr r4, r31
lwz r12, 0(r30)
lwz r12, 0x30(r12)
mtctr r12
bctrl
b lbl_80024D58
lbl_80024D38:
lbz r0, 5(r31)
lbz r3, 4(r31)
slwi r0, r0, 0x10
lbz r4, 6(r31)
rlwimi r0, r3, 0x18, 0, 7
lbz r5, 7(r31)
rlwimi r0, r4, 8, 0x10, 0x17
or r3, r5, r0
lbl_80024D58:
lwz r0, 0x14(r1)
lwz r31, 0xc(r1)
lwz r30, 8(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
SDIFileEntry* entry = findPtrResource(p1);
if (entry == nullptr) {
return -1;
} else if ((entry->_04 >> 0x18 & 4) == 0) {
return getResSize(p1);
} else {
u8* p = (u8*)p1;
return p[4] << 0x18 | p[5] << 0x10 | p[6] << 8 | p[7];
}
}

View File

@ -1,4 +1,5 @@
#include "types.h"
#include "JSystem/JKR/JKRHeap.h"
/*
Generated from dpostproc
@ -84,8 +85,26 @@
* Address: 80024D70
* Size: 0000B4
*/
void JKRSolidHeap::create(unsigned long, JKRHeap*, bool)
JKRSolidHeap* JKRSolidHeap::create(unsigned long heapSize, JKRHeap* parent, bool p3)
{
if (parent == nullptr) {
parent = sRootHeap;
}
if (heapSize == 0xFFFFFFFF) {
heapSize = parent->getMaxAllocatableSize(0x10);
}
u32 byteCount = heapSize & 0xFFFFFFF0;
JKRSolidHeap* result;
if (byteCount < 0x80) {
result = nullptr;
} else {
void* memory = JKRHeap::alloc(byteCount, 0x10, parent);
if (memory) {
// (*((JKRSolidHeap*)memory)).JKRSolidHeap(((u8*)memory)+sizeof(JKRSolidHeap), byteCount-0x80, parent, p3);
}
}
// result = new(parent, 0x10) JKRSolidHeap(sizeof(JKRSolidHeap))
return result;
/*
stwu r1, -0x20(r1)
mflr r0
@ -154,6 +173,7 @@ lbl_80024E08:
*/
void JKRSolidHeap::do_destroy()
{
/*
stwu r1, -0x10(r1)
mflr r0
@ -328,7 +348,7 @@ lbl_80024FF0:
* Address: 8002500C
* Size: 0000B0
*/
void JKRSolidHeap::do_alloc(unsigned long, int)
void* JKRSolidHeap::do_alloc(unsigned long, int)
{
/*
stwu r1, -0x20(r1)
@ -645,7 +665,7 @@ void JKRSolidHeap::do_fillFreeArea() { }
* Address: 80025380
* Size: 000030
*/
void JKRSolidHeap::do_resize(void*, unsigned long)
int JKRSolidHeap::do_resize(void*, unsigned long)
{
/*
stwu r1, -0x10(r1)
@ -668,7 +688,7 @@ void JKRSolidHeap::do_resize(void*, unsigned long)
* Address: 800253B0
* Size: 000030
*/
void JKRSolidHeap::do_getSize(void*)
int JKRSolidHeap::do_getSize(void*)
{
/*
stwu r1, -0x10(r1)
@ -691,7 +711,7 @@ void JKRSolidHeap::do_getSize(void*)
* Address: 800253E0
* Size: 00008C
*/
void JKRSolidHeap::check()
bool JKRSolidHeap::check()
{
/*
stwu r1, -0x10(r1)
@ -739,7 +759,7 @@ lbl_80025448:
* Address: 8002546C
* Size: 000104
*/
void JKRSolidHeap::dump()
bool JKRSolidHeap::dump()
{
/*
stwu r1, -0x30(r1)
@ -849,7 +869,7 @@ void JKRSolidHeap::state_register(JKRHeap::TState*, unsigned long) const
* Address: 800255CC
* Size: 000030
*/
void JKRSolidHeap::state_compare(const JKRHeap::TState&, const JKRHeap::TState&) const
bool JKRSolidHeap::state_compare(const JKRHeap::TState&, const JKRHeap::TState&) const
{
/*
.loc_0x0:
@ -875,7 +895,7 @@ void JKRSolidHeap::state_compare(const JKRHeap::TState&, const JKRHeap::TState&)
* Address: 800255FC
* Size: 00000C
*/
void JKRSolidHeap::getHeapType()
u32 JKRSolidHeap::getHeapType()
{
/*
lis r3, 0x534C4944@ha
@ -889,7 +909,7 @@ void JKRSolidHeap::getHeapType()
* Address: 80025608
* Size: 000008
*/
void JKRSolidHeap::do_getFreeSize()
u32 JKRSolidHeap::do_getFreeSize()
{
/*
lwz r3, 0x6c(r3)
@ -902,7 +922,7 @@ void JKRSolidHeap::do_getFreeSize()
* Address: 80025610
* Size: 000008
*/
void JKRSolidHeap::do_getMaxFreeBlock()
void* JKRSolidHeap::do_getMaxFreeBlock()
{
/*
lwz r3, 0x70(r3)
@ -915,7 +935,7 @@ void JKRSolidHeap::do_getMaxFreeBlock()
* Address: 80025618
* Size: 000020
*/
void JKRSolidHeap::do_getTotalFreeSize()
u32 JKRSolidHeap::do_getTotalFreeSize()
{
/*
stwu r1, -0x10(r1)

View File

@ -51,6 +51,7 @@
* --INFO--
* Address: 80025638
* Size: 0000B8
* __ct__9JKRThreadFUlii
*/
JKRThread::JKRThread(unsigned long stackSize, int msgCount, int threadPriority)
: JKRDisposer()
@ -67,63 +68,13 @@ JKRThread::JKRThread(unsigned long stackSize, int msgCount, int threadPriority)
}
setCommon_heapSpecified(heap, stackSize, threadPriority);
setCommon_mesgQueue(m_heap, msgCount);
/*
stwu r1, -0x20(r1)
mflr r0
stw r0, 0x24(r1)
stw r31, 0x1c(r1)
mr r31, r6
stw r30, 0x18(r1)
mr r30, r5
stw r29, 0x14(r1)
mr r29, r4
stw r28, 0x10(r1)
mr r28, r3
bl __ct__11JKRDisposerFv
lis r3, __vt__9JKRThread@ha
mr r4, r28
addi r0, r3, __vt__9JKRThread@l
addi r3, r28, 0x18
stw r0, 0(r28)
bl __ct__10JSUPtrLinkFPv
li r0, 0
mr r3, r28
stw r0, 0x68(r28)
stw r0, 0x64(r28)
stw r0, 0x6c(r28)
stb r0, 0x60(r28)
stw r0, 0x70(r28)
bl findFromRoot__7JKRHeapFPv
or. r4, r3, r3
bne lbl_800256AC
lwz r4, sSystemHeap__7JKRHeap@sda21(r13)
lbl_800256AC:
mr r3, r28
mr r5, r29
mr r6, r31
bl setCommon_heapSpecified__9JKRThreadFP7JKRHeapUli
lwz r4, 0x28(r28)
mr r3, r28
mr r5, r30
bl setCommon_mesgQueue__9JKRThreadFP7JKRHeapi
lwz r0, 0x24(r1)
mr r3, r28
lwz r31, 0x1c(r1)
lwz r30, 0x18(r1)
lwz r29, 0x14(r1)
lwz r28, 0x10(r1)
mtlr r0
addi r1, r1, 0x20
blr
*/
}
/*
* --INFO--
* Address: 800256F0
* Size: 0000A0
* __ct__9JKRThreadFP7JKRHeapUlii
*/
JKRThread::JKRThread(JKRHeap* heap, unsigned long stackSize, int msgCount, int threadPriority)
: JKRDisposer()
@ -135,61 +86,17 @@ JKRThread::JKRThread(JKRHeap* heap, unsigned long stackSize, int msgCount, int t
_60 = 0;
_70 = 0;
if (heap == nullptr) {
heap = JKRHeap::sSystemHeap;
heap = JKRHeap::sCurrentHeap;
}
setCommon_heapSpecified(heap, stackSize, threadPriority);
setCommon_mesgQueue(m_heap, msgCount);
/*
stwu r1, -0x20(r1)
mflr r0
stw r0, 0x24(r1)
stmw r27, 0xc(r1)
mr r27, r3
mr r28, r4
mr r29, r5
mr r30, r6
mr r31, r7
bl __ct__11JKRDisposerFv
lis r3, __vt__9JKRThread@ha
mr r4, r27
addi r0, r3, __vt__9JKRThread@l
addi r3, r27, 0x18
stw r0, 0(r27)
bl __ct__10JSUPtrLinkFPv
li r0, 0
cmplwi r28, 0
stw r0, 0x68(r27)
stw r0, 0x64(r27)
stw r0, 0x6c(r27)
stb r0, 0x60(r27)
stw r0, 0x70(r27)
bne lbl_80025754
lwz r28, sCurrentHeap__7JKRHeap@sda21(r13)
lbl_80025754:
mr r3, r27
mr r4, r28
mr r5, r29
mr r6, r31
bl setCommon_heapSpecified__9JKRThreadFP7JKRHeapUli
lwz r4, 0x28(r27)
mr r3, r27
mr r5, r30
bl setCommon_mesgQueue__9JKRThreadFP7JKRHeapi
mr r3, r27
lmw r27, 0xc(r1)
lwz r0, 0x24(r1)
mtlr r0
addi r1, r1, 0x20
blr
*/
}
/*
* --INFO--
* Address: 80025790
* Size: 0000A8
* __ct__9JKRThreadFP8OSThreadi
*/
JKRThread::JKRThread(OSThread* thread, int msgCount)
: JKRDisposer()
@ -202,53 +109,9 @@ JKRThread::JKRThread(OSThread* thread, int msgCount)
_70 = 0;
m_heap = nullptr;
m_thread = thread;
m_stackSize = (int*)thread->stackEnd - (int*)thread->stackBase;
m_stackSize = (u32)thread->stackEnd - (u32)thread->stackBase;
m_stack = thread->stackBase;
setCommon_mesgQueue(m_heap, msgCount);
/*
stwu r1, -0x20(r1)
mflr r0
stw r0, 0x24(r1)
stw r31, 0x1c(r1)
mr r31, r5
stw r30, 0x18(r1)
mr r30, r4
stw r29, 0x14(r1)
mr r29, r3
bl __ct__11JKRDisposerFv
lis r3, __vt__9JKRThread@ha
mr r4, r29
addi r0, r3, __vt__9JKRThread@l
addi r3, r29, 0x18
stw r0, 0(r29)
bl __ct__10JSUPtrLinkFPv
li r0, 0
mr r3, r29
stw r0, 0x68(r29)
mr r5, r31
stw r0, 0x64(r29)
stw r0, 0x6c(r29)
stb r0, 0x60(r29)
stw r0, 0x70(r29)
stw r0, 0x28(r29)
stw r30, 0x2c(r29)
lwz r4, 0x304(r30)
lwz r0, 0x308(r30)
subf r0, r4, r0
stw r0, 0x5c(r29)
lwz r0, 0x304(r30)
stw r0, 0x58(r29)
lwz r4, sSystemHeap__7JKRHeap@sda21(r13)
bl setCommon_mesgQueue__9JKRThreadFP7JKRHeapi
lwz r0, 0x24(r1)
mr r3, r29
lwz r31, 0x1c(r1)
lwz r30, 0x18(r1)
lwz r29, 0x14(r1)
mtlr r0
addi r1, r1, 0x20
blr
*/
setCommon_mesgQueue(JKRHeap::sSystemHeap, msgCount);
}
/*
@ -333,7 +196,7 @@ void JKRThread::setCommon_mesgQueue(JKRHeap* heap, int msgCount)
{
m_msgCount = msgCount;
m_msgBuffer = (OSMessage*)JKRHeap::alloc(m_msgCount << 2, 0, heap);
OSInitMessageQueue(&m_msgQueue, m_msgBuffer, m_msgCount);
OSInitMessageQueue(&m_msgQueue, (void**)m_msgBuffer, m_msgCount);
JKRThread::sThreadList.append(&m_link);
_74 = 0;
_78 = 0;
@ -344,51 +207,13 @@ void JKRThread::setCommon_mesgQueue(JKRHeap* heap, int msgCount)
* Address: 80025980
* Size: 000090
*/
bool JKRThread::setCommon_heapSpecified(JKRHeap* heap, unsigned long stackSize, int threadPriority)
BOOL JKRThread::setCommon_heapSpecified(JKRHeap* heap, unsigned long stackSize, int threadPriority)
{
m_heap = heap;
m_stackSize = stackSize & ~0x1F;
m_stack = JKRHeap::alloc(m_stackSize, 0x20, m_heap);
m_thread = (OSThread*)JKRHeap::alloc(sizeof(OSThread), 0x20, m_heap);
return OSCreateThread(m_thread, &JKRThread::start, this, (int*)m_stack + m_stackSize, m_stackSize, threadPriority, 1);
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
rlwinm r0, r5, 0, 0, 0x1a
stw r31, 0xc(r1)
mr r31, r6
stw r30, 8(r1)
mr r30, r3
stw r4, 0x28(r3)
li r4, 0x20
stw r0, 0x5c(r3)
lwz r3, 0x5c(r3)
lwz r5, 0x28(r30)
bl alloc__7JKRHeapFUliP7JKRHeap
stw r3, 0x58(r30)
li r3, 0x318
li r4, 0x20
lwz r5, 0x28(r30)
bl alloc__7JKRHeapFUliP7JKRHeap
stw r3, 0x2c(r30)
lis r3, start__9JKRThreadFPv@ha
addi r4, r3, start__9JKRThreadFPv@l
mr r5, r30
lwz r7, 0x5c(r30)
mr r8, r31
lwz r0, 0x58(r30)
li r9, 1
lwz r3, 0x2c(r30)
add r6, r0, r7
bl OSCreateThread
lwz r0, 0x14(r1)
lwz r31, 0xc(r1)
lwz r30, 8(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
return OSCreateThread(m_thread, &JKRThread::start, this, (void*)((u32)m_stack + m_stackSize), m_stackSize, threadPriority, 1);
}
/*
@ -396,30 +221,14 @@ bool JKRThread::setCommon_heapSpecified(JKRHeap* heap, unsigned long stackSize,
* Address: 80025A10
* Size: 00002C
*/
void* JKRThread::start(void*)
{
return (void*)run();
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r12, 0(r3)
lwz r12, 0xc(r12)
mtctr r12
bctrl
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
void* JKRThread::start(void* thread) { return static_cast<JKRThread*>(thread)->run(); }
/*
* --INFO--
* Address: 80025A3C
* Size: 000008
*/
u32 JKRThread::run() { return 0x0; }
void* JKRThread::run() { return nullptr; }
/*
* --INFO--
@ -849,7 +658,7 @@ lbl_80025F68:
* Address: 80025F7C
* Size: 00009C
*/
u32 JKRTask::run()
void* JKRTask::run()
{
/*
stwu r1, -0x20(r1)

View File

@ -1,19 +0,0 @@
#ifndef _JKRARCFINDER_H
#define _JKRARCFINDER_H
/*
__vt__12JKRArcFinder:
.4byte 0
.4byte 0
.4byte __dt__12JKRArcFinderFv
.4byte findNextFile__12JKRArcFinderFv
*/
struct JKRArcFinder {
virtual ~JKRArcFinder(); // _08 (weak)
virtual void findNextFile(); // _0C
JKRArcFinder(JKRArchive*, long, long);
};
#endif

View File

@ -1,26 +0,0 @@
#ifndef _JKRDECOMP_H
#define _JKRDECOMP_H
/*
__vt__9JKRDecomp:
.4byte 0
.4byte 0
.4byte __dt__9JKRDecompFv
.4byte run__9JKRDecompFv
*/
struct JKRDecomp {
virtual ~JKRDecomp(); // _08
virtual void run(); // _0C
void create(long);
JKRDecomp(long);
void sendCommand(JKRDecompCommand*);
void orderSync(unsigned char*, unsigned char*, unsigned long, unsigned long);
void decode(unsigned char*, unsigned char*, unsigned long, unsigned long);
void decodeSZP(unsigned char*, unsigned char*, unsigned long, unsigned long);
void decodeSZS(unsigned char*, unsigned char*, unsigned long, unsigned long);
void checkCompressed(unsigned char*);
};
#endif

View File

@ -1,66 +0,0 @@
#ifndef _JKRDVDARCHIVE_H
#define _JKRDVDARCHIVE_H
/*
__vt__13JKRDvdArchive:
.4byte 0
.4byte 0
.4byte __dt__13JKRDvdArchiveFv
.4byte unmount__13JKRFileLoaderFv
.4byte becomeCurrent__10JKRArchiveFPCc
.4byte getResource__10JKRArchiveFPCc
.4byte getResource__10JKRArchiveFUlPCc
.4byte readResource__10JKRArchiveFPvUlPCc
.4byte readResource__10JKRArchiveFPvUlUlPCc
.4byte removeResourceAll__10JKRArchiveFv
.4byte removeResource__10JKRArchiveFPv
.4byte detachResource__10JKRArchiveFPv
.4byte getResSize__10JKRArchiveCFPCv
.4byte countFile__10JKRArchiveCFPCc
.4byte getFirstFile__10JKRArchiveCFPCc
.4byte getExpandedResSize__13JKRDvdArchiveCFPCv
.4byte fetchResource__13JKRDvdArchiveFPQ210JKRArchive12SDIFileEntryPUl
.4byte fetchResource__13JKRDvdArchiveFPvUlPQ210JKRArchive12SDIFileEntryPUl
.4byte setExpandSize__10JKRArchiveFPQ210JKRArchive12SDIFileEntryUl
.4byte getExpandSize__10JKRArchiveCFPQ210JKRArchive12SDIFileEntry
*/
struct JKRFileLoader {
virtual ~JKRFileLoader(); // _08
virtual void unmount(); // _0C
};
struct JKRArchive {
virtual ~JKRArchive(); // _08
virtual void _0C() = 0; // _0C
virtual void becomeCurrent(const char*); // _10
virtual void getResource(const char*); // _14
virtual void getResource(unsigned long, const char*); // _18
virtual void readResource(void*, unsigned long, const char*); // _1C
virtual void readResource(void*, unsigned long, unsigned long, const char*); // _20
virtual void removeResourceAll(); // _24
virtual void removeResource(void*); // _28
virtual void detachResource(void*); // _2C
virtual void getResSize(const void*) const; // _30
virtual void countFile(const char*) const; // _34
virtual void getFirstFile(const char*) const; // _38
virtual void getExpandedResSize(const void*) const; // _3C
virtual void fetchResource(JKRArchive::SDIFileEntry*, unsigned long*); // _40
virtual void fetchResource(void*, unsigned long, JKRArchive::SDIFileEntry*, unsigned long*); // _44
virtual void setExpandSize(SDIFileEntry*, unsigned long); // _48
virtual void getExpandSize(SDIFileEntry*) const; // _4C
};
struct JKRDvdArchive : public JKRFileLoader, public JKRArchive {
virtual ~JKRDvdArchive(); // _08
virtual void getExpandedResSize(const void*) const; // _3C
virtual void fetchResource(JKRArchive::SDIFileEntry*, unsigned long*); // _40
virtual void fetchResource(void*, unsigned long, JKRArchive::SDIFileEntry*, unsigned long*); // _44
JKRDvdArchive(long, JKRArchive::EMountDirection);
void open(long);
void fetchResource_subroutine(long, unsigned long, unsigned long, unsigned char*, unsigned long, int, int);
void fetchResource_subroutine(long, unsigned long, unsigned long, JKRHeap*, int, int, unsigned char**);
};
#endif

View File

@ -1,17 +0,0 @@
#ifndef _JKRFILEFINDER_H
#define _JKRFILEFINDER_H
/*
__vt__13JKRFileFinder:
.4byte 0
.4byte 0
.4byte __dt__13JKRFileFinderFv
.4byte 0
*/
struct JKRFileFinder {
virtual ~JKRFileFinder(); // _08 (weak)
virtual void _0C() = 0; // _0C
};
#endif

View File

@ -1,69 +0,0 @@
#ifndef _JKRMEMARCHIVE_H
#define _JKRMEMARCHIVE_H
/*
__vt__13JKRMemArchive:
.4byte 0
.4byte 0
.4byte __dt__13JKRMemArchiveFv
.4byte unmount__13JKRFileLoaderFv
.4byte becomeCurrent__10JKRArchiveFPCc
.4byte getResource__10JKRArchiveFPCc
.4byte getResource__10JKRArchiveFUlPCc
.4byte readResource__10JKRArchiveFPvUlPCc
.4byte readResource__10JKRArchiveFPvUlUlPCc
.4byte removeResourceAll__13JKRMemArchiveFv
.4byte removeResource__13JKRMemArchiveFPv
.4byte detachResource__10JKRArchiveFPv
.4byte getResSize__10JKRArchiveCFPCv
.4byte countFile__10JKRArchiveCFPCc
.4byte getFirstFile__10JKRArchiveCFPCc
.4byte getExpandedResSize__13JKRMemArchiveCFPCv
.4byte fetchResource__13JKRMemArchiveFPQ210JKRArchive12SDIFileEntryPUl
.4byte fetchResource__13JKRMemArchiveFPvUlPQ210JKRArchive12SDIFileEntryPUl
.4byte setExpandSize__10JKRArchiveFPQ210JKRArchive12SDIFileEntryUl
.4byte getExpandSize__10JKRArchiveCFPQ210JKRArchive12SDIFileEntry
*/
struct JKRFileLoader {
virtual ~JKRFileLoader(); // _08
virtual void unmount(); // _0C
};
struct JKRArchive {
virtual ~JKRArchive(); // _08
virtual void _0C() = 0; // _0C
virtual void becomeCurrent(const char*); // _10
virtual void getResource(const char*); // _14
virtual void getResource(unsigned long, const char*); // _18
virtual void readResource(void*, unsigned long, const char*); // _1C
virtual void readResource(void*, unsigned long, unsigned long, const char*); // _20
virtual void removeResourceAll(); // _24
virtual void removeResource(void*); // _28
virtual void detachResource(void*); // _2C
virtual void getResSize(const void*) const; // _30
virtual void countFile(const char*) const; // _34
virtual void getFirstFile(const char*) const; // _38
virtual void getExpandedResSize(const void*) const; // _3C
virtual void fetchResource(JKRArchive::SDIFileEntry*, unsigned long*); // _40
virtual void fetchResource(void*, unsigned long, JKRArchive::SDIFileEntry*, unsigned long*); // _44
virtual void setExpandSize(SDIFileEntry*, unsigned long); // _48
virtual void getExpandSize(SDIFileEntry*) const; // _4C
};
struct JKRMemArchive : public JKRFileLoader, public JKRArchive {
virtual ~JKRMemArchive(); // _08
virtual void removeResourceAll(); // _24
virtual void removeResource(void*); // _28
virtual void getExpandedResSize(const void*) const; // _3C
virtual void fetchResource(JKRArchive::SDIFileEntry*, unsigned long*); // _40
virtual void fetchResource(void*, unsigned long, JKRArchive::SDIFileEntry*, unsigned long*); // _44
JKRMemArchive(long, JKRArchive::EMountDirection);
JKRMemArchive(void*, unsigned long, JKRMemBreakFlag);
void open(long, JKRArchive::EMountDirection);
void open(void*, unsigned long, JKRMemBreakFlag);
void fetchResource_subroutine(unsigned char*, unsigned long, unsigned char*, unsigned long, int);
};
#endif