mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 23:47:43 +00:00
ANIM fixes and explicit-endian refactor
This commit is contained in:
@@ -58,7 +58,7 @@ bool ReadANCSToBlender(HECL::BlenderConnection& conn,
|
||||
}
|
||||
|
||||
/* Establish ANCS blend */
|
||||
if (!conn.createBlend(outPath.getAbsolutePath() + ".blend"))
|
||||
if (!conn.createBlend(outPath.getAbsolutePath()))
|
||||
return false;
|
||||
HECL::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
|
||||
|
||||
|
||||
@@ -301,8 +301,6 @@ bool ReadCMDLToBlender(HECL::BlenderConnection& conn,
|
||||
const HECL::ProjectPath& masterShader,
|
||||
const RIGPAIR* rp=nullptr)
|
||||
{
|
||||
reader.setEndian(Athena::BigEndian);
|
||||
|
||||
Header head;
|
||||
head.read(reader);
|
||||
|
||||
@@ -523,7 +521,7 @@ bool ReadCMDLToBlender(HECL::BlenderConnection& conn,
|
||||
/* Positions */
|
||||
for (size_t i=0 ; i<=maxIdxs.pos ; ++i)
|
||||
{
|
||||
atVec3f pos = reader.readVec3f();
|
||||
atVec3f pos = reader.readVec3fBig();
|
||||
os.format("vert = bm.verts.new((%f,%f,%f))\n",
|
||||
pos.vec[0], pos.vec[1], pos.vec[2]);
|
||||
if (rp)
|
||||
@@ -541,7 +539,7 @@ bool ReadCMDLToBlender(HECL::BlenderConnection& conn,
|
||||
for (size_t i=0 ; i<normCount ; ++i)
|
||||
{
|
||||
os.format("norm_list.append((%f,%f,%f))\n",
|
||||
reader.readInt16(), reader.readInt16(), reader.readInt16());
|
||||
reader.readInt16Big(), reader.readInt16Big(), reader.readInt16Big());
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -549,7 +547,7 @@ bool ReadCMDLToBlender(HECL::BlenderConnection& conn,
|
||||
size_t normCount = head.secSizes[s] / 12;
|
||||
for (size_t i=0 ; i<normCount ; ++i)
|
||||
{
|
||||
atVec3f norm = reader.readVec3f();
|
||||
atVec3f norm = reader.readVec3fBig();
|
||||
os.format("norm_list.append((%f,%f,%f))\n",
|
||||
norm.vec[0], norm.vec[1], norm.vec[2]);
|
||||
}
|
||||
@@ -568,7 +566,7 @@ bool ReadCMDLToBlender(HECL::BlenderConnection& conn,
|
||||
size_t uvCount = head.secSizes[s] / 8;
|
||||
for (size_t i=0 ; i<uvCount ; ++i)
|
||||
{
|
||||
atVec2f uv = reader.readVec2f();
|
||||
atVec2f uv = reader.readVec2fBig();
|
||||
os.format("uv_list.append((%f,%f))\n",
|
||||
uv.vec[0], uv.vec[1]);
|
||||
}
|
||||
@@ -584,7 +582,7 @@ bool ReadCMDLToBlender(HECL::BlenderConnection& conn,
|
||||
for (size_t i=0 ; i<uvCount ; ++i)
|
||||
{
|
||||
os.format("suv_list.append((%f,%f))\n",
|
||||
reader.readInt16(), reader.readInt16());
|
||||
reader.readInt16Big(), reader.readInt16Big());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -48,9 +48,9 @@ public:
|
||||
Delete expl;
|
||||
inline operator bool() const {return m_id != 0xffffffff;}
|
||||
inline void read(Athena::io::IStreamReader& reader)
|
||||
{m_id = reader.readUint32();}
|
||||
{m_id = reader.readUint32Big();}
|
||||
inline void write(Athena::io::IStreamWriter& writer) const
|
||||
{writer.writeUint32(m_id);}
|
||||
{writer.writeUint32Big(m_id);}
|
||||
inline void fromYAML(Athena::io::YAMLDocReader& reader)
|
||||
{m_id = reader.readUint32(nullptr);}
|
||||
inline void toYAML(Athena::io::YAMLDocWriter& writer) const
|
||||
@@ -75,9 +75,9 @@ public:
|
||||
Delete expl;
|
||||
inline operator bool() const {return m_id != 0xffffffffffffffff;}
|
||||
inline void read(Athena::io::IStreamReader& reader)
|
||||
{m_id = reader.readUint64();}
|
||||
{m_id = reader.readUint64Big();}
|
||||
inline void write(Athena::io::IStreamWriter& writer) const
|
||||
{writer.writeUint64(m_id);}
|
||||
{writer.writeUint64Big(m_id);}
|
||||
|
||||
inline bool operator!=(const UniqueID64& other) const {return m_id != other.m_id;}
|
||||
inline bool operator==(const UniqueID64& other) const {return m_id == other.m_id;}
|
||||
@@ -107,13 +107,13 @@ public:
|
||||
{return m_id[0] != 0xffffffffffffffff && m_id[1] != 0xffffffffffffffff;}
|
||||
inline void read(Athena::io::IStreamReader& reader)
|
||||
{
|
||||
m_id[0] = reader.readUint64();
|
||||
m_id[1] = reader.readUint64();
|
||||
m_id[0] = reader.readUint64Big();
|
||||
m_id[1] = reader.readUint64Big();
|
||||
}
|
||||
inline void write(Athena::io::IStreamWriter& writer) const
|
||||
{
|
||||
writer.writeUint64(m_id[0]);
|
||||
writer.writeUint64(m_id[1]);
|
||||
writer.writeUint64Big(m_id[0]);
|
||||
writer.writeUint64Big(m_id[1]);
|
||||
}
|
||||
|
||||
inline bool operator!=(const UniqueID128& other) const
|
||||
@@ -182,7 +182,7 @@ struct WordBitmap
|
||||
m_words.clear();
|
||||
m_words.reserve(wordCount);
|
||||
for (size_t w=0 ; w<wordCount ; ++w)
|
||||
m_words.push_back(reader.readUint32());
|
||||
m_words.push_back(reader.readUint32Big());
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& writer) const
|
||||
{
|
||||
|
||||
@@ -8,15 +8,14 @@ namespace Retro
|
||||
|
||||
std::unique_ptr<ISTRG> LoadSTRG(Athena::io::IStreamReader& reader)
|
||||
{
|
||||
reader.setEndian(Athena::BigEndian);
|
||||
uint32_t magic = reader.readUint32();
|
||||
uint32_t magic = reader.readUint32Big();
|
||||
if (magic != 0x87654321)
|
||||
{
|
||||
LogDNACommon.report(LogVisor::Error, "invalid STRG magic");
|
||||
return std::unique_ptr<ISTRG>();
|
||||
}
|
||||
|
||||
uint32_t version = reader.readUint32();
|
||||
uint32_t version = reader.readUint32Big();
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
|
||||
@@ -481,11 +481,10 @@ static void PNGWarn(png_structp png, png_const_charp msg)
|
||||
|
||||
bool TXTR::Extract(const SpecBase& dataspec, PAKEntryReadStream& rs, const HECL::ProjectPath& outPath)
|
||||
{
|
||||
rs.setEndian(Athena::BigEndian);
|
||||
uint32_t format = rs.readUint32();
|
||||
uint16_t width = rs.readUint16();
|
||||
uint16_t height = rs.readUint16();
|
||||
uint32_t numMips = rs.readUint32();
|
||||
uint32_t format = rs.readUint32Big();
|
||||
uint16_t width = rs.readUint16Big();
|
||||
uint16_t height = rs.readUint16Big();
|
||||
uint32_t numMips = rs.readUint32Big();
|
||||
|
||||
FILE* fp = HECL::Fopen(outPath.getAbsolutePath().c_str(), _S("wb"));
|
||||
if (!fp)
|
||||
|
||||
Reference in New Issue
Block a user