summaryrefslogtreecommitdiff
path: root/include/JSystem/JSupport
diff options
context:
space:
mode:
authorlepelog <25211966+lepelog@users.noreply.github.com>2021-08-28 16:32:14 +0200
committerGitHub <noreply@github.com>2021-08-28 16:32:14 +0200
commitf25c24699bf57f8cfee8e959e998cc82ccb32b36 (patch)
tree25a017e2b9f5b39a75f0512c89f758e32fcfaf37 /include/JSystem/JSupport
parentdaf45f768d9ae091a97dce1be8d048ac2b7bd54c (diff)
Jsupport stream and JKRAramArchive (#143)
* JSupport streams * JKRAramArchive
Diffstat (limited to 'include/JSystem/JSupport')
-rw-r--r--include/JSystem/JSupport/JSUFileStream.h15
-rw-r--r--include/JSystem/JSupport/JSUInputStream.h14
-rw-r--r--include/JSystem/JSupport/JSUIosBase.h4
-rw-r--r--include/JSystem/JSupport/JSUMemoryStream.h16
-rw-r--r--include/JSystem/JSupport/JSURandomInputStream.h16
5 files changed, 44 insertions, 21 deletions
diff --git a/include/JSystem/JSupport/JSUFileStream.h b/include/JSystem/JSupport/JSUFileStream.h
index 31ae686210..44c3f4ed7a 100644
--- a/include/JSystem/JSupport/JSUFileStream.h
+++ b/include/JSystem/JSupport/JSUFileStream.h
@@ -1,21 +1,24 @@
#ifndef JSUFILESTREAM_H
#define JSUFILESTREAM_H
+#include "JSystem/JKernel/JKRFile.h"
#include "JSystem/JSupport/JSURandomInputStream.h"
#include "dolphin/types.h"
-struct JKRFile;
-
class JSUFileInputStream : public JSURandomInputStream {
public:
- virtual ~JSUFileInputStream();
+ virtual ~JSUFileInputStream() {}
// TODO: fix return values
/* 802DC638 */ JSUFileInputStream(JKRFile*);
- /* 802DC67C */ s32 readData(void*, s32);
- /* 802DC74C */ void seekPos(s32, JSUStreamSeekFrom);
+ /* 802DC67C */ u32 readData(void*, s32);
+ /* 802DC74C */ s32 seekPos(s32, JSUStreamSeekFrom);
/* 802DC82C */ s32 getLength() const;
/* 802DC85C */ s32 getPosition() const;
-};
+
+private:
+ /* 0x08 */ JKRFile* mFile;
+ /* 0x0C */ s32 mPosition;
+}; // Size = 0x10
#endif /* JSUFILESTREAM_H */
diff --git a/include/JSystem/JSupport/JSUInputStream.h b/include/JSystem/JSupport/JSUInputStream.h
index e4b6648fe5..f4a3ed3af3 100644
--- a/include/JSystem/JSupport/JSUInputStream.h
+++ b/include/JSystem/JSupport/JSUInputStream.h
@@ -4,19 +4,23 @@
#include "JSystem/JSupport/JSUIosBase.h"
#include "dolphin/types.h"
-struct JSUStreamSeekFrom {};
+enum JSUStreamSeekFrom {
+ JSUStreamSeekFrom_SET = 0, // absolute
+ JSUStreamSeekFrom_CUR = 1, // relative
+ JSUStreamSeekFrom_END = 2, // relative to end
+};
class JSUInputStream : public JSUIosBase {
public:
- JSUInputStream();
+ JSUInputStream() {}
virtual ~JSUInputStream();
/* vt[3] */ virtual s32 getAvailable() const = 0;
/* vt[4] */ virtual s32 skip(s32);
- /* vt[5] */ virtual s32 readData(void*, s32) = 0;
+ /* vt[5] */ virtual u32 readData(void*, s32) = 0;
// TODO: return value probably wrong
- /* 802DC298 */ void read(void*, s32);
-};
+ /* 802DC298 */ s32 read(void*, s32);
+}; // Size = 0x8
#endif /* JSUINPUTSTREAM_H */
diff --git a/include/JSystem/JSupport/JSUIosBase.h b/include/JSystem/JSupport/JSUIosBase.h
index ef4046b673..c44a81e2f0 100644
--- a/include/JSystem/JSupport/JSUIosBase.h
+++ b/include/JSystem/JSupport/JSUIosBase.h
@@ -11,7 +11,7 @@ class JSUIosBase {
public:
JSUIosBase() { mState = false; }
- virtual ~JSUIosBase();
+ virtual ~JSUIosBase() {}
bool isGood() const { return mState == 0; }
void clrState(EIoState state) { mState &= ~state; }
@@ -19,6 +19,6 @@ public:
private:
u8 mState;
-};
+}; // Size = 0x8
#endif
diff --git a/include/JSystem/JSupport/JSUMemoryStream.h b/include/JSystem/JSupport/JSUMemoryStream.h
index d2f603aaa6..5ce4fcb170 100644
--- a/include/JSystem/JSupport/JSUMemoryStream.h
+++ b/include/JSystem/JSupport/JSUMemoryStream.h
@@ -1,6 +1,22 @@
#ifndef JSUMEMORYSTREAM_H
#define JSUMEMORYSTREAM_H
+#include "JSystem/JSupport/JSURandomInputStream.h"
#include "dolphin/types.h"
+class JSUMemoryInputStream : JSURandomInputStream {
+public:
+ /* 802552B8 */ ~JSUMemoryInputStream() {}
+ /* 802DC520 */ void setBuffer(void const*, s32);
+ /* 802DC534 */ u32 readData(void*, s32);
+ /* 802DC5AC */ s32 seekPos(s32, JSUStreamSeekFrom);
+ /* 802DC628 */ s32 getLength() const;
+ /* 802DC630 */ s32 getPosition() const;
+
+private:
+ /* 0x08 */ const void* mBuffer;
+ /* 0x0C */ s32 mLength;
+ /* 0x10 */ s32 mPosition;
+}; // Size = 0x14
+
#endif /* JSUMEMORYSTREAM_H */
diff --git a/include/JSystem/JSupport/JSURandomInputStream.h b/include/JSystem/JSupport/JSURandomInputStream.h
index d6f56fc594..f26c4d202f 100644
--- a/include/JSystem/JSupport/JSURandomInputStream.h
+++ b/include/JSystem/JSupport/JSURandomInputStream.h
@@ -6,20 +6,20 @@
class JSURandomInputStream : public JSUInputStream {
public:
- JSURandomInputStream();
- virtual ~JSURandomInputStream();
+ JSURandomInputStream() {}
+ virtual ~JSURandomInputStream() {}
/* vt[3] */ virtual s32 getAvailable() const; /* override */
/* vt[4] */ virtual s32 skip(s32); /* override */
- /* vt[5] */ virtual s32 readData(void*, s32) = 0;
+ /* vt[5] */ virtual u32 readData(void*, s32) = 0;
/* vt[6] */ virtual s32 getLength() const = 0;
/* vt[7] */ virtual s32 getPosition() const = 0;
- /* vt[7] */ virtual s32 seekPos() = 0;
+ /* vt[8] */ virtual s32 seekPos(s32, JSUStreamSeekFrom) = 0;
// TODO: fix return types
- /* 802DC370 */ void align(s32);
- /* 802DC458 */ void peek(void*, s32);
- /* 802DC4DC */ void seek(s32, JSUStreamSeekFrom);
-};
+ /* 802DC370 */ s32 align(s32);
+ /* 802DC458 */ s32 peek(void*, s32);
+ /* 802DC4DC */ s32 seek(s32, JSUStreamSeekFrom);
+}; // Size = 0x8
#endif