Skip to content

Commit

Permalink
fix arc v4 load
Browse files Browse the repository at this point in the history
  • Loading branch information
PredatorCZ committed May 12, 2024
1 parent a505d52 commit faa3d5a
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/arc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ struct ARCFile {
}
};

struct ARCFileV4 : ARCFile {
void SwapEndian() {
FByteswapper(typeHash);
FByteswapper(compressedSize);
FByteswapper(reinterpret_cast<uint32 &>(uncompressedSize));
FByteswapper(offset);
}
};

struct ARCExtendedFile {
char fileName[0x80];
uint32 typeHash;
Expand Down Expand Up @@ -88,9 +97,7 @@ struct ARCBase {
struct ARC : ARCBase {
int32 LZXTag = 0;

bool IsLZX() const {
return version == 0x11 && LZXTag > 0;
}
bool IsLZX() const { return version == 0x11 && LZXTag > 0; }
};

using ARCFiles = std::vector<ARCFile>;
Expand All @@ -112,7 +119,13 @@ auto ReadARC(BinReaderRef_e rd) {
}

ARCFiles files;
rd.ReadContainer(files, hdr.numFiles);

if (hdr.version == 4) {
rd.ReadContainer(reinterpret_cast<std::vector<ARCFileV4> &>(files),
hdr.numFiles);
} else {
rd.ReadContainer(files, hdr.numFiles);
}

return std::make_tuple(hdr, files);
}
Expand Down

0 comments on commit faa3d5a

Please sign in to comment.