summaryrefslogtreecommitdiff
path: root/src/JSystem/JSupport/JSUInputStream.cpp
diff options
context:
space:
mode:
authorTakaRikka <38417346+TakaRikka@users.noreply.github.com>2024-10-10 07:29:58 -0700
committerGitHub <noreply@github.com>2024-10-10 08:29:58 -0600
commit12eb254d769d84743b5cc6cd5424057c57eaf0ad (patch)
tree4509be332b2ccfc6fe939f47740d68f7746eca3e /src/JSystem/JSupport/JSUInputStream.cpp
parent2fd702c0ac170a789af879b8b92a82d4dcc9080c (diff)
switch to dtk setup (#2203)
* switch to dtk setup * some cleanup / fixes * cleanup d_a_alink literals * Restore doxygen, update CI & README.md (#1) * Fix build image ref (#2) --------- Co-authored-by: Luke Street <luke@street.dev>
Diffstat (limited to 'src/JSystem/JSupport/JSUInputStream.cpp')
-rw-r--r--src/JSystem/JSupport/JSUInputStream.cpp107
1 files changed, 107 insertions, 0 deletions
diff --git a/src/JSystem/JSupport/JSUInputStream.cpp b/src/JSystem/JSupport/JSUInputStream.cpp
new file mode 100644
index 0000000000..4e7cbd3fee
--- /dev/null
+++ b/src/JSystem/JSupport/JSUInputStream.cpp
@@ -0,0 +1,107 @@
+//
+// Generated By: dol2asm
+// Translation Unit: JSUInputStream
+//
+
+#include "JSystem/JSupport/JSUInputStream.h"
+#include "JSystem/JSupport/JSURandomInputStream.h"
+
+//
+// Forward References:
+//
+
+extern "C" void skip__20JSURandomInputStreamFl();
+
+//
+// External References:
+//
+
+extern "C" void __dt__20JSURandomInputStreamFv();
+extern "C" void getAvailable__20JSURandomInputStreamCFv();
+
+//
+// Declarations:
+//
+
+/* ############################################################################################## */
+/* 803CC4B0-803CC4D4 0295D0 0024+00 0/0 7/7 0/0 .data __vt__20JSURandomInputStream */
+extern void* __vt__20JSURandomInputStream[9] = {
+ (void*)NULL /* RTTI */,
+ (void*)NULL,
+ (void*)__dt__20JSURandomInputStreamFv,
+ (void*)getAvailable__20JSURandomInputStreamCFv,
+ (void*)skip__20JSURandomInputStreamFl,
+ (void*)NULL,
+ (void*)NULL,
+ (void*)NULL,
+ (void*)NULL,
+};
+
+/* 802DC23C-802DC298 2D6B7C 005C+00 1/0 6/6 0/0 .text __dt__14JSUInputStreamFv */
+JSUInputStream::~JSUInputStream() {}
+
+/* 802DC298-802DC2F0 2D6BD8 0058+00 1/1 20/20 0/0 .text read__14JSUInputStreamFPvl */
+s32 JSUInputStream::read(void* buffer, s32 numBytes) {
+ s32 bytesRead = readData(buffer, numBytes);
+ if (bytesRead != numBytes) {
+ setState(IOS_STATE_1);
+ }
+ return bytesRead;
+}
+
+/* 802DC2F0-802DC370 2D6C30 0080+00 1/0 0/0 0/0 .text skip__14JSUInputStreamFl */
+s32 JSUInputStream::skip(s32 count) {
+ s32 skipCount = 0;
+ u8 buffer[1];
+ while (count > skipCount) {
+ if (readData(&buffer, 1) != 1) {
+ setState(IOS_STATE_1);
+ break;
+ }
+ skipCount++;
+ }
+ return skipCount;
+}
+
+/* 802DC370-802DC3FC 2D6CB0 008C+00 0/0 1/1 0/0 .text align__20JSURandomInputStreamFl */
+s32 JSURandomInputStream::align(s32 alignment) {
+ s32 currentPos = getPosition();
+ s32 offset = (alignment + currentPos);
+ offset -= 1;
+ offset &= ~(alignment - 1);
+ s32 alignmentOffset = offset - currentPos;
+ if (alignmentOffset != 0) {
+ s32 seekLen = seekPos(offset, JSUStreamSeekFrom_SET);
+ if (seekLen != alignmentOffset) {
+ setState(IOS_STATE_1);
+ }
+ }
+ return alignmentOffset;
+}
+
+/* 802DC3FC-802DC458 2D6D3C 005C+00 1/0 2/0 0/0 .text skip__20JSURandomInputStreamFl */
+s32 JSURandomInputStream::skip(s32 param_0) {
+ s32 val = seekPos(param_0, JSUStreamSeekFrom_CUR);
+ if (val != param_0) {
+ setState(IOS_STATE_1);
+ }
+ return val;
+}
+
+/* 802DC458-802DC4DC 2D6D98 0084+00 0/0 8/8 0/0 .text peek__20JSURandomInputStreamFPvl */
+s32 JSURandomInputStream::peek(void* buffer, s32 numBytes) {
+ s32 oldPos = getPosition();
+ s32 bytesRead = read(buffer, numBytes);
+ if (bytesRead != 0) {
+ seekPos(oldPos, JSUStreamSeekFrom_SET);
+ }
+ return bytesRead;
+}
+
+/* 802DC4DC-802DC520 2D6E1C 0044+00 0/0 16/16 0/0 .text
+ * seek__20JSURandomInputStreamFl17JSUStreamSeekFrom */
+s32 JSURandomInputStream::seek(s32 param_0, JSUStreamSeekFrom param_1) {
+ s32 seekResult = seekPos(param_0, param_1);
+ clrState(IOS_STATE_1);
+ return seekResult;
+} \ No newline at end of file