diff --git a/DataSpec/DNAMP1/FRME.cpp b/DataSpec/DNAMP1/FRME.cpp index 2cacc5ca7..cb7cbb1ac 100644 --- a/DataSpec/DNAMP1/FRME.cpp +++ b/DataSpec/DNAMP1/FRME.cpp @@ -56,17 +56,17 @@ void FRME::Widget::read(Athena::io::IStreamReader& __dna_reader) case SBIG('BWIG'): widgetInfo.reset(new BWIGInfo); break; case SBIG('HWIG'): widgetInfo.reset(new HWIGInfo); break; case SBIG('CAMR'): widgetInfo.reset(new CAMRInfo); break; - case SBIG('MODL'): widgetInfo.reset(new MODLInfo); break; case SBIG('LITE'): widgetInfo.reset(new LITEInfo); break; + case SBIG('ENRG'): widgetInfo.reset(new ENRGInfo); break; + case SBIG('MODL'): widgetInfo.reset(new MODLInfo); break; + case SBIG('METR'): widgetInfo.reset(new METRInfo); break; + case SBIG('GRUP'): widgetInfo.reset(new GRUPInfo); break; case SBIG('TXPN'): widgetInfo.reset(new TXPNInfo(owner->version)); break; case SBIG('IMGP'): widgetInfo.reset(new IMGPInfo); break; - case SBIG('GRUP'): widgetInfo.reset(new GRUPInfo); break; case SBIG('TBGP'): widgetInfo.reset(new TBGPInfo); break; - case SBIG('ENRG'): widgetInfo.reset(new ENRGInfo); break; - case SBIG('METR'): widgetInfo.reset(new METRInfo); break; case SBIG('SLGP'): widgetInfo.reset(new SLGPInfo); break; default: - Log.report(LogVisor::FatalError, _S("Unsupported FRME widget type %s"), type.toString().c_str()); + Log.report(LogVisor::FatalError, _S("Unsupported FRME widget type %.8X"), type.toUint32()); } /* widgetInfo */ @@ -87,8 +87,8 @@ void FRME::Widget::read(Athena::io::IStreamReader& __dna_reader) basis[1] = __dna_reader.readVec3fBig(); /* basis[2] */ basis[2] = __dna_reader.readVec3fBig(); - /* unk1 */ - unk1 = __dna_reader.readVec3fBig(); + /* rotationCenter */ + rotationCenter = __dna_reader.readVec3fBig(); /* unk2 */ unk2 = __dna_reader.readUint32Big(); /* unk3 */ @@ -122,8 +122,8 @@ void FRME::Widget::write(Athena::io::IStreamWriter& __dna_writer) const __dna_writer.writeVec3fBig(basis[1]); /* basis[2] */ __dna_writer.writeVec3fBig(basis[2]); - /* unk1 */ - __dna_writer.writeVec3fBig(unk1); + /* rotationCenter */ + __dna_writer.writeVec3fBig(rotationCenter); /* unk2 */ __dna_writer.writeUint32Big(unk2); /* unk3 */ @@ -205,8 +205,10 @@ void FRME::Widget::TXPNInfo::read(Athena::io::IStreamReader& __dna_reader) { /* jpnFont */ jpnFont.read(__dna_reader); - /* jpnPointScale */ - jpnPointScale = __dna_reader.readInt32Big(); + /* jpnPointScale[0] */ + jpnPointScale[0] = __dna_reader.readInt32Big(); + /* jpnPointScale[0] */ + jpnPointScale[1] = __dna_reader.readInt32Big(); } } @@ -243,8 +245,10 @@ void FRME::Widget::TXPNInfo::write(Athena::io::IStreamWriter& __dna_writer) cons { /* jpnFont */ jpnFont.write(__dna_writer); - /* jpnPointScale */ - __dna_writer.writeInt32Big(jpnPointScale); + /* jpnPointScale[0] */ + __dna_writer.writeInt32Big(jpnPointScale[0]); + /* jpnPointScale[1] */ + __dna_writer.writeInt32Big(jpnPointScale[1]); } } @@ -255,7 +259,7 @@ size_t FRME::Widget::TXPNInfo::binarySize(size_t __isz) const if (version == 1) __isz = jpnFont.binarySize(__isz); - return __isz + (version == 1 ? 74 : 66); + return __isz + (version == 1 ? 78 : 66); } } diff --git a/DataSpec/DNAMP1/FRME.hpp b/DataSpec/DNAMP1/FRME.hpp index 65c155b6b..8d444b121 100644 --- a/DataSpec/DNAMP1/FRME.hpp +++ b/DataSpec/DNAMP1/FRME.hpp @@ -49,7 +49,7 @@ struct FRME : BigDNA Value group; Value origin; Value basis[3]; - Value unk1; + Value rotationCenter; Value unk2; Value unk3; Value unk4; @@ -192,7 +192,7 @@ struct FRME : BigDNA Value pointScale; /* The following is only found in V1 */ UniqueID32 jpnFont; - Value jpnPointScale; + Value jpnPointScale[2]; }; struct IMGPInfo : IWidgetInfo diff --git a/DataSpec/DNAMP2/MREA.cpp b/DataSpec/DNAMP2/MREA.cpp index c3b08f4e5..439e9b1cb 100644 --- a/DataSpec/DNAMP2/MREA.cpp +++ b/DataSpec/DNAMP2/MREA.cpp @@ -2,6 +2,7 @@ #include #include "MREA.hpp" #include "../DNAMP1/MREA.hpp" +#include "../DNACommon/EGMC.hpp" #include "DeafBabe.hpp" namespace Retro @@ -194,6 +195,19 @@ bool MREA::Extract(const SpecBase& dataSpec, if (!conn.createBlend(mreaPath, HECL::BlenderConnection::BlendType::Area)) return false; + /* Calculate offset to EGMC section */ + atUint64 egmcOffset = 0; + for (int i = 0; i < head.egmcSecIdx; i++) + egmcOffset += head.secSizes[i]; + + /* Load EGMC if possible so we can assign meshes to scanIds */ + drs.seek(egmcOffset, Athena::Begin); + UniqueID32 egmcId(drs); + DNACommon::EGMC egmc; + bool hasEGMC = pakRouter.lookupAndReadDNA(egmcId, egmc); + + drs.seek(0, Athena::Begin); + /* Open Py Stream and read sections */ HECL::BlenderConnection::PyOutStream os = conn.beginPythonOut(true); os.format("import bpy\n"