summaryrefslogtreecommitdiff
path: root/ZAPD/ZRom.cpp
diff options
context:
space:
mode:
authorlouist103 <35883445+louist103@users.noreply.github.com>2023-10-28 01:06:21 -0400
committerlouist103 <35883445+louist103@users.noreply.github.com>2023-10-28 01:06:21 -0400
commit5934e4e0772eb910536e566728e14d3537d8e412 (patch)
treee4065cf06b22a4e2ec1f6da2a4e99568f3c86246 /ZAPD/ZRom.cpp
parentcc8bd2fd01672446bb2f4613f402f2310f5ce62d (diff)
MM
Diffstat (limited to 'ZAPD/ZRom.cpp')
-rw-r--r--ZAPD/ZRom.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/ZAPD/ZRom.cpp b/ZAPD/ZRom.cpp
index 938ac3a..1dd5174 100644
--- a/ZAPD/ZRom.cpp
+++ b/ZAPD/ZRom.cpp
@@ -203,9 +203,10 @@ ZRom::ZRom(std::string romPath)
std::vector<uint8_t> decompressedData(1);
- for (int i = 0; i < lines.size(); i++)
+ for (unsigned int i = 0; i < lines.size(); i++)
{
lines[i] = StringHelper::Strip(lines[i], "\r");
+ bool yarCompressed = false;
const int romOffset = version.offset + (DMA_ENTRY_SIZE * i);
const int virtStart = BitConverter::ToInt32BE(romData, romOffset + 0);
@@ -227,6 +228,11 @@ ZRom::ZRom(std::string romPath)
outData.resize(size);
memcpy(outData.data(), romData.data() + physStart, size);
+ if ((i >= 15 && i <= 20) || i == 22)
+ {
+ yarCompressed = true;
+ }
+
if (compressed)
{
int decSize = virtEnd - virtStart;
@@ -235,6 +241,14 @@ ZRom::ZRom(std::string romPath)
yaz0_decode(outData.data(), decompressedData.data(), decSize);
files[lines[i]] = decompressedData;
}
+ else if (yarCompressed)
+ {
+ //int decSize = virtEnd - virtStart;
+ decompressedData = std::vector<uint8_t>();
+ decompressedData.resize(1024*1024); //TODO FIX THIS PLEASE
+ yaz0_decodeYarArchive(outData.data(), decompressedData.data(), size);
+ files[lines[i]] = decompressedData;
+ }
else
files[lines[i]] = outData;