diff options
| author | lepelog <25211966+lepelog@users.noreply.github.com> | 2021-08-28 16:32:14 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-28 16:32:14 +0200 |
| commit | f25c24699bf57f8cfee8e959e998cc82ccb32b36 (patch) | |
| tree | 25a017e2b9f5b39a75f0512c89f758e32fcfaf37 /include/JSystem/JKernel | |
| parent | daf45f768d9ae091a97dce1be8d048ac2b7bd54c (diff) | |
Jsupport stream and JKRAramArchive (#143)
* JSupport streams
* JKRAramArchive
Diffstat (limited to 'include/JSystem/JKernel')
| -rw-r--r-- | include/JSystem/JKernel/JKRAram.h | 9 | ||||
| -rw-r--r-- | include/JSystem/JKernel/JKRAramArchive.h | 20 | ||||
| -rw-r--r-- | include/JSystem/JKernel/JKRAramBlock.h | 3 | ||||
| -rw-r--r-- | include/JSystem/JKernel/JKRArchive.h | 22 |
4 files changed, 35 insertions, 19 deletions
diff --git a/include/JSystem/JKernel/JKRAram.h b/include/JSystem/JKernel/JKRAram.h index ca7a224ed9..5468519ba1 100644 --- a/include/JSystem/JKernel/JKRAram.h +++ b/include/JSystem/JKernel/JKRAram.h @@ -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 */ diff --git a/include/JSystem/JKernel/JKRAramArchive.h b/include/JSystem/JKernel/JKRAramArchive.h index 6b74179e53..5a7f7bd44a 100644 --- a/include/JSystem/JKernel/JKRAramArchive.h +++ b/include/JSystem/JKernel/JKRAramArchive.h @@ -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 */ diff --git a/include/JSystem/JKernel/JKRAramBlock.h b/include/JSystem/JKernel/JKRAramBlock.h index 916db4a73c..5f17050f2d 100644 --- a/include/JSystem/JKernel/JKRAramBlock.h +++ b/include/JSystem/JKernel/JKRAramBlock.h @@ -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; } diff --git a/include/JSystem/JKernel/JKRArchive.h b/include/JSystem/JKernel/JKRArchive.h index 77af4d6e7c..a451fab4fa 100644 --- a/include/JSystem/JKernel/JKRArchive.h +++ b/include/JSystem/JKernel/JKRArchive.h @@ -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; } }; |
