JKRMemArchive (#66)

* JKRArchivePri OK

* JKRArchivePub OK

* formatting

* removed unused asm files and tried to fixed setExpandSize and getExpandSize

* JKRMemArchive and created JKRCompression

Co-authored-by: Julgodis <>
This commit is contained in:
Jonathan Wase
2021-01-05 17:34:58 +01:00
committed by GitHub
parent 65dbd7e088
commit d89fb99506
33 changed files with 342 additions and 119 deletions
+25 -11
View File
@@ -30,6 +30,22 @@ public:
#define JKRDECOMP_SYNC_BLOCKING 0
#define JKRDECOMP_SYNC_NON_BLOCKING 1
#define READ_BIG_ENDIAN_U32(P) \
(((u32)(((u8*)(P))[0]) << 0x18) | ((u32)(((u8*)(P))[1]) << 0x10) | \
((u32)(((u8*)(P))[2]) << 8) | ((u32)(((u8*)(P))[3])))
#define READ_BIG_ENDIAN_U16(P) (((u32)(((u8*)(P))[0]) << 8) | ((u32)(((u8*)(P))[1])))
enum JKRCompression {
COMPRESSION_NONE = 0,
COMPRESSION_YAY0 = 1,
COMPRESSION_YAZ0 = 2,
COMPRESSION_ASR = 3,
__COMPRESSION_ENUM_FORCE_S32 = INT32_MAX,
__COMPRESSION_ENUM_FORCE_SIGNED = -1,
};
class JKRDecomp : public JKRThread {
private:
JKRDecomp(long);
@@ -38,16 +54,6 @@ private:
/* vt[03] */ virtual void* run(); /* override */
public:
enum Compression {
NONE = 0,
YAY0 = 1,
YAZ0 = 2,
ASR = 3,
__COMPRESSION_ENUM_FORCE_S32 = INT32_MAX,
__COMPRESSION_ENUM_FORCE_SIGNED = -1,
};
static JKRDecomp* create(long);
static JKRDecompCommand* prepareCommand(u8*, u8*, u32, u32, JKRDecompCommand::AsyncCallback);
static void sendCommand(JKRDecompCommand*);
@@ -57,7 +63,15 @@ public:
static void decode(u8*, u8*, u32, u32);
static void decodeSZP(u8*, u8*, u32, u32);
static void decodeSZS(u8*, u8*, u32, u32);
static Compression checkCompressed(u8*);
static JKRCompression checkCompressed(u8*);
};
inline u32 JKRDecompExpandSize(const void* resource) {
return READ_BIG_ENDIAN_U32((u8*)resource + 4);
}
inline void JKRDecompress(u8* srcBuffer, u8* dstBuffer, u32 srcLength, u32 dstLength) {
JKRDecomp::orderSync(srcBuffer, dstBuffer, srcLength, dstLength);
}
#endif