Fix TXPN for version 1

Prelim EGMC support (just getting ID and loading DNA)
This commit is contained in:
Phillip Stephens 2016-01-19 01:45:30 -08:00
parent 367f9a0720
commit 7c6dbacbd3
3 changed files with 34 additions and 16 deletions

View File

@ -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);
}
}

View File

@ -49,7 +49,7 @@ struct FRME : BigDNA
Value<atUint16> group;
Value<atVec3f> origin;
Value<atVec3f> basis[3];
Value<atVec3f> unk1;
Value<atVec3f> rotationCenter;
Value<atUint32> unk2;
Value<bool> unk3;
Value<bool> unk4;
@ -192,7 +192,7 @@ struct FRME : BigDNA
Value<atVec2f> pointScale;
/* The following is only found in V1 */
UniqueID32 jpnFont;
Value<atInt32> jpnPointScale;
Value<atInt32> jpnPointScale[2];
};
struct IMGPInfo : IWidgetInfo

View File

@ -2,6 +2,7 @@
#include <lzo/lzo1x.h>
#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"