mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 21:07:42 +00:00
Decompressed MREA outputting
This commit is contained in:
@@ -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
Submodule NODLib updated: e4f502be58...020e7d14c9
2
hecl
2
hecl
Submodule hecl updated: 0935dad69f...de78329cb2
Reference in New Issue
Block a user