2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-10 00:27:43 +00:00

Various MREA-generation fixes

This commit is contained in:
Jack Andersen
2016-08-12 15:23:27 -10:00
parent a0f6c18e35
commit 7a653bc3af
9 changed files with 89 additions and 9 deletions

View File

@@ -180,7 +180,13 @@ void SCLY::ScriptLayer::write(athena::io::IStreamWriter& ws) const
for (const std::unique_ptr<IScriptObject>& obj : objects)
{
ws.writeByte(obj->type);
atUint32 expLen = obj->binarySize(0);
ws.writeUint32Big(expLen);
auto start = ws.position();
obj->write(ws);
auto wrote = ws.position() - start;
if (wrote != expLen)
Log.report(logvisor::Error, "expected writing %lu byte SCLY obj; wrote %llu", expLen, wrote);
}
}
@@ -189,7 +195,7 @@ size_t SCLY::ScriptLayer::binarySize(size_t __isz) const
__isz += 5;
for (const std::unique_ptr<IScriptObject>& obj : objects)
{
__isz += 1;
__isz += 5;
__isz = obj->binarySize(__isz);
}
return __isz;