Decompressed MREA outputting

This commit is contained in:
Jack Andersen 2015-09-09 20:22:08 -10:00
parent 23f89ee747
commit bf5bf28a87
5 changed files with 25 additions and 3 deletions

View File

@ -1,3 +1,4 @@
#include <Athena/FileWriter.hpp>
#include <lzo/lzo1x.h>
#include "MREA.hpp"
@ -143,6 +144,16 @@ atUint64 MREA::StreamReader::readUBytesToBuf(void* buf, atUint64 len)
return len;
}
void MREA::StreamReader::writeDecompInfos(Athena::io::IStreamWriter& writer) const
{
for (const BlockInfo& info : m_blockInfos)
{
BlockInfo modInfo = info;
modInfo.compSize = 0;
modInfo.write(writer);
}
}
bool MREA::Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const HECL::ProjectPath& outPath,
@ -161,6 +172,14 @@ bool MREA::Extract(const SpecBase& dataSpec,
/* MREA decompression stream */
StreamReader drs(rs, head.compressedBlockCount);
Athena::io::FileWriter mreaDecompOut(pakRouter.getCooked(&entry).getWithExtension(_S(".decomp")).getAbsolutePath());
head.write(mreaDecompOut);
mreaDecompOut.seekAlign32();
drs.writeDecompInfos(mreaDecompOut);
mreaDecompOut.seekAlign32();
atUint64 decompLen = drs.length();
mreaDecompOut.writeBytes(drs.readBytes(decompLen).get(), decompLen);
drs.seek(0, Athena::Begin);
/* Start up blender connection */
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
@ -222,7 +241,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
mHeader.visorFlags.disableXray() ? "True" : "False",
mHeader.visorFlags.thermalLevelStr());
/* Seek through unknown per-mesh sections */
/* Seek through AROT-relation sections */
drs.seek(head.secSizes[curSec++], Athena::Current);
drs.seek(head.secSizes[curSec++], Athena::Current);
}

View File

@ -45,6 +45,7 @@ struct MREA
atUint64 position() const {return m_pos;}
atUint64 length() const {return m_totalDecompLen;}
atUint64 readUBytesToBuf(void* buf, atUint64 len);
void writeDecompInfos(Athena::io::IStreamWriter& writer) const;
};
struct Header : BigDNA

View File

@ -71,8 +71,10 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK::Entry& entry)
return {STRG::Extract, nullptr, {_S(".yaml")}};
case SBIG('TXTR'):
return {TXTR::Extract, nullptr, {_S(".png")}};
/*
case SBIG('CMDL'):
return {nullptr, CMDL::Extract, {_S(".blend")}, 1};
*/
}
return {};
}

2
NODLib

@ -1 +1 @@
Subproject commit e4f502be580f3258bf0a26b1511afb36eaff111a
Subproject commit 020e7d14c99c34d107a82b9769ce67cbb07f49a3

2
hecl

@ -1 +1 @@
Subproject commit 0935dad69fb8ac18556d280b9886aad11fafec78
Subproject commit de78329cb2cfb52e42cb34444fe16ef905085a83