Jsupport stream and JKRAramArchive (#143)

* JSupport streams

* JKRAramArchive
This commit is contained in:
lepelog
2021-08-28 16:32:14 +02:00
committed by GitHub
parent daf45f768d
commit f25c24699b
38 changed files with 511 additions and 1270 deletions
+9
View File
@@ -69,6 +69,15 @@ private:
static JSUList<JKRAMCommand> sAramCommandList;
};
inline void* JKRAllocFromAram(u32 size, JKRAramHeap::EAllocMode allocMode) {
return JKRAram::getAramHeap()->alloc(size, allocMode);
}
inline void JKRAramToMainRam(u32 p1, u8* p2, u32 p3, JKRExpandSwitch p4, u32 p5, JKRHeap* p6,
int p7, u32* p8) {
JKRAram::aramToMainRam(p1, p2, p3, p4, p5, p6, p7, p8);
}
// void JKRDecompressFromAramToMainRam(u32, void*, u32, u32, u32, u32*);
#endif /* JKRARAM_H */
+12 -8
View File
@@ -1,6 +1,7 @@
#ifndef JKRARAMARCHIVE_H
#define JKRARAMARCHIVE_H
#include "JSystem/JKernel/JKRAramBlock.h"
#include "JSystem/JKernel/JKRArchive.h"
#include "dolphin/types.h"
@@ -9,22 +10,25 @@ public:
JKRAramArchive(long, JKRArchive::EMountDirection);
virtual ~JKRAramArchive();
void open(long);
void getAramAddress_Entry(SDIFileEntry*);
void getAramAddress(char const*);
bool open(long);
u32 getAramAddress_Entry(SDIFileEntry*);
u32 getAramAddress(char const*);
/* vt[15] */ u32 getExpandedResSize(const void*); /* override */
/* vt[15] */ u32 getExpandedResSize(const void*) const; /* override */
/* vt[16] */ void* fetchResource(SDIFileEntry*, u32*); /* override */
/* vt[17] */ void* fetchResource(void*, u32, SDIFileEntry*, u32*); /* override */
public:
static void fetchResource_subroutine(u32, u32, u8*, u32, int);
static void fetchResource_subroutine(u32, u32, JKRHeap*, int, u8**);
static u32 fetchResource_subroutine(u32, u32, u8*, u32, int);
static u32 fetchResource_subroutine(u32, u32, JKRHeap*, int, u8**);
private:
/* 0x00 */ // vtable
/* 0x04 */ // JKRArchive
u8 unk[16];
};
/* 0x5C */ JKRCompression mCompression;
/* 0x60 */ EMountDirection mMountDirection;
/* 0x64 */ JKRAramBlock* mBlock;
/* 0x68 */ JKRDvdFile* mDvdFile;
}; // Size = 0x6C
#endif /* JKRARAMARCHIVE_H */
+2 -1
View File
@@ -3,6 +3,7 @@
#include "dolphin/types.h"
#include "JSystem/JKernel/JKRArchive.h"
#include "JSystem/JSupport/JSUList.h"
#include "dolphin/types.h"
@@ -15,7 +16,7 @@ public:
JKRAramBlock* allocHead(u32, u8, JKRAramHeap*);
JKRAramBlock* allocTail(u32, u8, JKRAramHeap*);
void* getAddress() const { return (void*)mAddress; }
u32 getAddress() const { return mAddress; }
u32 getSize() const { return mSize; }
+12 -10
View File
@@ -3,18 +3,20 @@
#include "JSystem/JKernel/JKRCompression.h"
#include "JSystem/JKernel/JKRDecomp.h"
#include "JSystem/JKernel/JKRDvdFile.h"
#include "JSystem/JKernel/JKRFileLoader.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "global.h"
struct SArcHeader {
u32 signature;
u32 file_length;
u32 header_length;
u32 file_data_offset;
u32 file_data_length;
u32 field_0x14;
u32 field_0x18;
u32 field_0x1c;
/* 0x00 */ u32 signature;
/* 0x04 */ u32 file_length;
/* 0x08 */ u32 header_length;
/* 0x0C */ u32 file_data_offset;
/* 0x10 */ u32 file_data_length;
/* 0x14 */ u32 field_0x14;
/* 0x18 */ u32 field_0x18;
/* 0x1C */ u32 field_0x1c;
};
struct SArcDataInfo {
@@ -46,8 +48,6 @@ inline u32 JKRDecompExpandSize(SArcHeader* header) {
extern u32 sCurrentDirID__10JKRArchive; // JKRArchive::sCurrentDirID
class JKRHeap;
class JKRDvdFile;
class JKRArchive : public JKRFileLoader {
public:
struct SDirEntry {
@@ -82,6 +82,8 @@ public:
bool isDirectory() const { return (getFlags() & 0x02) != 0; }
bool isUnknownFlag1() const { return (getFlags() & 0x01) != 0; }
bool isCompressed() const { return (getFlags() & 0x04) != 0; }
// was needed for open__14JKRAramArchiveFl
u8 getCompressFlag() const { return (getFlags() & 0x04); }
bool isYAZ0Compressed() const { return (getFlags() & 0x80) != 0; }
};