summaryrefslogtreecommitdiff
path: root/src/JSystem/JGadget/binary.cpp
diff options
context:
space:
mode:
authorLagoLunatic <LagoLunatic@users.noreply.github.com>2024-03-05 16:41:32 -0500
committerLagoLunatic <LagoLunatic@users.noreply.github.com>2024-03-05 16:41:32 -0500
commit56107e697a3688ce0d121d0e62581eb0c8e21ff1 (patch)
tree44c66739957ced26ebf53a04b2357991d03dd6e4 /src/JSystem/JGadget/binary.cpp
parent7f543cf441f9ce1f78b7fbc18fbb791ebcdd710c (diff)
Get more JSystem TUs compiling
Diffstat (limited to 'src/JSystem/JGadget/binary.cpp')
-rw-r--r--src/JSystem/JGadget/binary.cpp62
1 files changed, 54 insertions, 8 deletions
diff --git a/src/JSystem/JGadget/binary.cpp b/src/JSystem/JGadget/binary.cpp
index ee3ec55b..86955e9e 100644
--- a/src/JSystem/JGadget/binary.cpp
+++ b/src/JSystem/JGadget/binary.cpp
@@ -3,21 +3,67 @@
// Translation Unit: binary.cpp
//
-#include "binary.h"
+#include "JSystem/JGadget/binary.h"
#include "dolphin/types.h"
+namespace JGadget {
+namespace binary {
+
/* 802BFA48-802BFAAC .text parseVariableUInt_16_32_following__Q27JGadget6binaryFPCvPUlPUlPQ37JGadget6binary5TEBit */
-void JGadget::binary::parseVariableUInt_16_32_following(const void*, unsigned long*, unsigned long*, JGadget::binary::TEBit*) {
- /* Nonmatching */
+const void* parseVariableUInt_16_32_following(const void* buffer, u32* param_1, u32* param_2, TEBit* bit) {
+ JGadget::binary::TEBit temp;
+ if (bit == NULL) {
+ bit = &temp;
+ }
+ u32 uVar1 = *(u16*)buffer;
+ if ((uVar1 & 0x8000) == 0) {
+ bit->value = 0x10;
+ *param_1 = uVar1;
+ *param_2 = *(u16*)((u8*)buffer + 2);
+ return (u8*)buffer + 4;
+ }
+ bit->value = 0x20;
+ uVar1 <<= 16;
+ uVar1 &= 0x7fff0000;
+ uVar1 |= *(u16*)((u8*)buffer + 2);
+ *param_1 = uVar1;
+ *param_2 = *(u32*)((u8*)buffer + 4);
+ return (u8*)buffer + 8;
}
/* 802BFAAC-802BFAF4 .text __dt__Q37JGadget6binary19TParse_header_blockFv */
-JGadget::binary::TParse_header_block::~TParse_header_block() {
- /* Nonmatching */
-}
+TParse_header_block::~TParse_header_block() {}
/* 802BFAF4-802BFC00 .text parse_next__Q37JGadget6binary19TParse_header_blockFPPCvUl */
-void JGadget::binary::TParse_header_block::parse_next(const void**, unsigned long) {
- /* Nonmatching */
+bool TParse_header_block::parse_next(const void** ptrLocation, u32 idx) {
+ u32 headerEnd, blockEnd;
+
+ if ((ptrLocation == NULL) || (*ptrLocation == NULL)) {
+ return false;
+ }
+ bool check, checkLastBlock;
+ checkLastBlock = check = false;
+
+ check = checkNext(ptrLocation, &headerEnd, idx);
+
+ checkLastBlock = check;
+ if (!(idx & 1) && (check == false)) {
+ return check;
+ }
+
+ while (headerEnd > 0) {
+ check = false;
+ if (parseBlock_next(ptrLocation, &blockEnd, idx) && checkLastBlock) {
+ check = true;
+ }
+ checkLastBlock = check;
+ if (((idx & 2) == 0) && (check == false)) {
+ return check;
+ }
+ headerEnd--;
+ }
+ return checkLastBlock;
}
+} // namespace binary
+} // namespace JGadget