mirror of https://github.com/AxioDL/metaforce.git
Decompressed MREA outputting
This commit is contained in:
parent
23f89ee747
commit
bf5bf28a87
|
@ -1,3 +1,4 @@
|
||||||
|
#include <Athena/FileWriter.hpp>
|
||||||
#include <lzo/lzo1x.h>
|
#include <lzo/lzo1x.h>
|
||||||
#include "MREA.hpp"
|
#include "MREA.hpp"
|
||||||
|
|
||||||
|
@ -143,6 +144,16 @@ atUint64 MREA::StreamReader::readUBytesToBuf(void* buf, atUint64 len)
|
||||||
return 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,
|
bool MREA::Extract(const SpecBase& dataSpec,
|
||||||
PAKEntryReadStream& rs,
|
PAKEntryReadStream& rs,
|
||||||
const HECL::ProjectPath& outPath,
|
const HECL::ProjectPath& outPath,
|
||||||
|
@ -161,6 +172,14 @@ bool MREA::Extract(const SpecBase& dataSpec,
|
||||||
|
|
||||||
/* MREA decompression stream */
|
/* MREA decompression stream */
|
||||||
StreamReader drs(rs, head.compressedBlockCount);
|
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 */
|
/* Start up blender connection */
|
||||||
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
|
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
|
||||||
|
@ -222,7 +241,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
|
||||||
mHeader.visorFlags.disableXray() ? "True" : "False",
|
mHeader.visorFlags.disableXray() ? "True" : "False",
|
||||||
mHeader.visorFlags.thermalLevelStr());
|
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);
|
||||||
drs.seek(head.secSizes[curSec++], Athena::Current);
|
drs.seek(head.secSizes[curSec++], Athena::Current);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ struct MREA
|
||||||
atUint64 position() const {return m_pos;}
|
atUint64 position() const {return m_pos;}
|
||||||
atUint64 length() const {return m_totalDecompLen;}
|
atUint64 length() const {return m_totalDecompLen;}
|
||||||
atUint64 readUBytesToBuf(void* buf, atUint64 len);
|
atUint64 readUBytesToBuf(void* buf, atUint64 len);
|
||||||
|
void writeDecompInfos(Athena::io::IStreamWriter& writer) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Header : BigDNA
|
struct Header : BigDNA
|
||||||
|
|
|
@ -71,8 +71,10 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK::Entry& entry)
|
||||||
return {STRG::Extract, nullptr, {_S(".yaml")}};
|
return {STRG::Extract, nullptr, {_S(".yaml")}};
|
||||||
case SBIG('TXTR'):
|
case SBIG('TXTR'):
|
||||||
return {TXTR::Extract, nullptr, {_S(".png")}};
|
return {TXTR::Extract, nullptr, {_S(".png")}};
|
||||||
|
/*
|
||||||
case SBIG('CMDL'):
|
case SBIG('CMDL'):
|
||||||
return {nullptr, CMDL::Extract, {_S(".blend")}, 1};
|
return {nullptr, CMDL::Extract, {_S(".blend")}, 1};
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
2
NODLib
2
NODLib
|
@ -1 +1 @@
|
||||||
Subproject commit e4f502be580f3258bf0a26b1511afb36eaff111a
|
Subproject commit 020e7d14c99c34d107a82b9769ce67cbb07f49a3
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
||||||
Subproject commit 0935dad69fb8ac18556d280b9886aad11fafec78
|
Subproject commit de78329cb2cfb52e42cb34444fe16ef905085a83
|
Loading…
Reference in New Issue