From 364f03d7e5d974aa1e5ae7c212a0371de779f504 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sun, 11 Oct 2015 14:04:11 -1000 Subject: [PATCH 1/4] Update README.md --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 686679b49..c7077162b 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,10 @@ * Mac OS X 10.9+ * Linux (with recent udev, xcb, xinput, glx) * **[Coming Soon]** FreeBSD + +### Build Prerequisites: +* [CMake 3+](https://cmake.org) +* [Python 3+](https://python.org) +* LLVM + * [Specialized Windows Package](https://www.dropbox.com/s/4u0rckvh3d3tvr1/LLVM-3.7.0-win64.exe) + * [OS X Package](http://llvm.org/releases/3.7.0/clang+llvm-3.7.0-x86_64-apple-darwin.tar.xz) From faa262b73cb3bc92b745b70e537128c327bb6050 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sun, 11 Oct 2015 18:41:28 -1000 Subject: [PATCH 2/4] Windows fixes --- DataSpec/DNACommon/BabeDead.hpp | 5 +++++ DataSpec/DNAMP1/MREA.cpp | 6 ++++-- DataSpec/DNAMP2/MREA.cpp | 4 ++-- DataSpec/DNAMP3/MREA.cpp | 10 +++++----- DataSpec/SpecMP1.cpp | 2 +- DataSpec/SpecMP2.cpp | 2 +- DataSpec/SpecMP3.cpp | 2 +- MathLib | 2 +- Runtime/MP1/main.cpp | 3 +++ hecl | 2 +- 10 files changed, 24 insertions(+), 14 deletions(-) diff --git a/DataSpec/DNACommon/BabeDead.hpp b/DataSpec/DNACommon/BabeDead.hpp index 77f3b7742..6b05002a4 100644 --- a/DataSpec/DNACommon/BabeDead.hpp +++ b/DataSpec/DNACommon/BabeDead.hpp @@ -3,6 +3,11 @@ #include +#ifndef _USE_MATH_DEFINES +#define _USE_MATH_DEFINES 1 +#endif +#include + namespace Retro { diff --git a/DataSpec/DNAMP1/MREA.cpp b/DataSpec/DNAMP1/MREA.cpp index 8077dc5c5..8865007cb 100644 --- a/DataSpec/DNAMP1/MREA.cpp +++ b/DataSpec/DNAMP1/MREA.cpp @@ -3,7 +3,9 @@ #include "DeafBabe.hpp" #include "../DNACommon/BabeDead.hpp" -#define _USE_MATH_DEFINES +#ifndef _USE_MATH_DEFINES +#define _USE_MATH_DEFINES 1 +#endif #include namespace Retro @@ -92,7 +94,7 @@ bool MREA::Extract(const SpecBase& dataSpec, /* Read meshes */ atUint32 curSec = 1; - for (int m=0 ; m& idx = m_secIdxs.back(); @@ -136,7 +136,7 @@ bool MREA::Extract(const SpecBase& dataSpec, atUint32 curSec = 1; std::vector surfaceCounts; surfaceCounts.reserve(head.meshCount); - for (int m=0 ; mfirst == FOURCC('GPUD')) { - for (int m=0 ; m, MaterialSet, RigPair, DNACMDL::SurfaceHeader_3> (os, drs, pakRouter, entry, dummy, true, @@ -195,7 +195,7 @@ bool MREA::Extract(const SpecBase& dataSpec, /* Skip SOBJ (SCLY) */ if (secIdxIt->first == FOURCC('SOBJ')) { - for (int l=0 ; l #endif diff --git a/hecl b/hecl index b33c31a34..7dd981997 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit b33c31a34bf8f2c8d13ac923abe58da624814368 +Subproject commit 7dd98199713427ee1c998387bc4714b2898eaccb From cb57d0ed93e2bd89028c0bcd56190062219c41d2 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sun, 11 Oct 2015 19:19:27 -1000 Subject: [PATCH 3/4] Updated hecl --- hecl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hecl b/hecl index 7dd981997..abb371d22 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 7dd98199713427ee1c998387bc4714b2898eaccb +Subproject commit abb371d22ba32982f87c174d494756e0477c21c1 From 30b486c76feb1cec32eaa168846f43ed3a96191a Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sun, 11 Oct 2015 23:30:18 -1000 Subject: [PATCH 4/4] Shader extract crash fix; SCLY trilogy fixes --- DataSpec/DNAMP1/CMDLMaterials.cpp | 46 +++- DataSpec/DNAMP1/SCLY.cpp | 5 +- DataSpec/DNAMP1/ScriptObjects/PlayerActor.hpp | 6 +- .../DNAMP1/ScriptObjects/WorldTeleporter.hpp | 255 +++++++++++++++++- MathLib | 2 +- 5 files changed, 297 insertions(+), 17 deletions(-) diff --git a/DataSpec/DNAMP1/CMDLMaterials.cpp b/DataSpec/DNAMP1/CMDLMaterials.cpp index 54f734d65..17d734e01 100644 --- a/DataSpec/DNAMP1/CMDLMaterials.cpp +++ b/DataSpec/DNAMP1/CMDLMaterials.cpp @@ -494,28 +494,43 @@ static void AddTEVStage(Stream& out, const MaterialSet::Material::TEVStage& stag ++c_combiner_idx; } } + + const char* c_soc_log[2] = {"color_combiner_sockets[-1]", "color_combiner_sockets[-2]"}; if (!(c_tev_opts & 2)) { /* B nodes */ if (!strcmp(cc, "ONE")) - out.format("color_combiner_sockets.append(%s)\n", cb); + { + if (strcmp(cb, "ZERO") && strcmp(cb, "HALF") && strcmp(cb, "ONE")) + { + out.format("color_combiner_sockets.append(%s)\n", cb); + ++c_combiner_idx; + } + else + { + c_soc_log[1] = c_soc_log[0]; + c_soc_log[0] = cb; + } + } else + { AddColorCombiner(out, COMB_MULT, cc, cb, nullptr); - ++c_combiner_idx; + ++c_combiner_idx; + } } if (!(c_tev_opts & 4)) { /* A+B node */ - AddColorCombiner(out, COMB_ADD, "color_combiner_sockets[-1]", "color_combiner_sockets[-2]", nullptr); + AddColorCombiner(out, COMB_ADD, c_soc_log[0], c_soc_log[1], nullptr); ++c_combiner_idx; } if (!(c_tev_opts & 8)) { /* +D node */ - AddColorCombiner(out, COMB_ADD, cd, "color_combiner_sockets[-1]", nullptr); + AddColorCombiner(out, COMB_ADD, cd, c_soc_log[0], nullptr); ++c_combiner_idx; } @@ -541,28 +556,43 @@ static void AddTEVStage(Stream& out, const MaterialSet::Material::TEVStage& stag ++a_combiner_idx; } } + + const char* a_soc_log[2] = {"alpha_combiner_sockets[-1]", "alpha_combiner_sockets[-2]"}; if (!(a_tev_opts & 2)) { /* B nodes */ if (!strcmp(ac, "ONE")) - out.format("alpha_combiner_sockets.append(%s)\n", ab); + { + if (strcmp(ab, "ZERO") && strcmp(ab, "HALF") && strcmp(ab, "ONE")) + { + out.format("alpha_combiner_sockets.append(%s)\n", ab); + ++a_combiner_idx; + } + else + { + a_soc_log[1] = a_soc_log[0]; + a_soc_log[0] = ab; + } + } else + { AddAlphaCombiner(out, COMB_MULT, ac, ab, nullptr); - ++a_combiner_idx; + ++a_combiner_idx; + } } if (!(a_tev_opts & 4)) { /* A+B node */ - AddAlphaCombiner(out, COMB_ADD, "alpha_combiner_sockets[-1]", "alpha_combiner_sockets[-2]", nullptr); + AddAlphaCombiner(out, COMB_ADD, a_soc_log[0], a_soc_log[1], nullptr); ++a_combiner_idx; } if (!(a_tev_opts & 8)) { /* +D node */ - AddAlphaCombiner(out, COMB_ADD, ad, "alpha_combiner_sockets[-1]", nullptr); + AddAlphaCombiner(out, COMB_ADD, ad, a_soc_log[0], nullptr); ++a_combiner_idx; } diff --git a/DataSpec/DNAMP1/SCLY.cpp b/DataSpec/DNAMP1/SCLY.cpp index e4a67ce41..5083eed1b 100644 --- a/DataSpec/DNAMP1/SCLY.cpp +++ b/DataSpec/DNAMP1/SCLY.cpp @@ -90,8 +90,9 @@ void SCLY::ScriptLayer::read(Athena::io::IStreamReader& rs) obj->type = type; obj->read(rs); objects.push_back(obj); - if ((rs.position() - start) != len) - Log.report(LogVisor::FatalError, _S("Error while reading object of type 0x%.2X, did not read the expected amount of data, read 0x%x, expected 0x%x"), (atUint32)type, (rs.position() - start), len); + size_t actualLen = rs.position() - start; + if (actualLen != len) + Log.report(LogVisor::Warning, _S("Error while reading object of type 0x%.2X, did not read the expected amount of data, read 0x%x, expected 0x%x"), (atUint32)type, actualLen, len); rs.seek(start + len, Athena::Begin); } else diff --git a/DataSpec/DNAMP1/ScriptObjects/PlayerActor.hpp b/DataSpec/DNAMP1/ScriptObjects/PlayerActor.hpp index 6cc83fb8c..0525b7cb6 100644 --- a/DataSpec/DNAMP1/ScriptObjects/PlayerActor.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/PlayerActor.hpp @@ -33,11 +33,7 @@ struct PlayerActor : IScriptObject { DECL_YAML Value propertyCount; - Value unknown1; - Value unknown2; - Value unknown3; - Value unknown4; - Value unknown5; + Vector bools; } playerParameters; Value unknown8; }; diff --git a/DataSpec/DNAMP1/ScriptObjects/WorldTeleporter.hpp b/DataSpec/DNAMP1/ScriptObjects/WorldTeleporter.hpp index 6087e597c..7fc2ab94a 100644 --- a/DataSpec/DNAMP1/ScriptObjects/WorldTeleporter.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/WorldTeleporter.hpp @@ -11,7 +11,7 @@ namespace DNAMP1 { struct WorldTeleporter : IScriptObject { - DECL_YAML + Delete expl; String<-1> name; Value unknown1; UniqueID32 mlvl; @@ -33,7 +33,260 @@ struct WorldTeleporter : IScriptObject Value unknown10; Value unknown11; Value unknown12; + + /* Trilogy additions (property count 26) */ + Value unknown13; + Value unknown14; + Value unknown15; + Value unknown16; + Value unknown17; + + void read(Athena::io::IStreamReader& __dna_reader) + { + IScriptObject::read(__dna_reader); + /* name */ + name = __dna_reader.readString(-1); + /* unknown1 */ + unknown1 = __dna_reader.readBool(); + /* mlvl */ + mlvl.read(__dna_reader); + /* mrea */ + mrea.read(__dna_reader); + /* animationParameters */ + animationParameters.read(__dna_reader); + /* unknown2 */ + unknown2 = __dna_reader.readVec3fBig(); + /* model1 */ + model1.read(__dna_reader); + /* unknown3 */ + unknown3 = __dna_reader.readVec3fBig(); + /* model2 */ + model2.read(__dna_reader); + /* unknown4 */ + unknown4 = __dna_reader.readVec3fBig(); + /* unknown5 */ + unknown5 = __dna_reader.readBool(); + /* soundID */ + soundID = __dna_reader.readUint32Big(); + /* unknown6 */ + unknown6 = __dna_reader.readUint32Big(); + /* unknown7 */ + unknown7 = __dna_reader.readUint32Big(); + /* unknown8 */ + unknown8 = __dna_reader.readBool(); + /* font */ + font.read(__dna_reader); + /* strg */ + strg.read(__dna_reader); + /* unknown9 */ + unknown9 = __dna_reader.readBool(); + /* unknown10 */ + unknown10 = __dna_reader.readFloatBig(); + /* unknown11 */ + unknown11 = __dna_reader.readFloatBig(); + /* unknown12 */ + unknown12 = __dna_reader.readFloatBig(); + + if (propertyCount == 26) + { + unknown13 = __dna_reader.readBool(); + unknown14 = __dna_reader.readBool(); + unknown15 = __dna_reader.readFloatBig(); + unknown16 = __dna_reader.readFloatBig(); + unknown17 = __dna_reader.readFloatBig(); + } + else + { + unknown13 = false; + unknown14 = false; + unknown15 = 0.0; + unknown16 = 0.0; + unknown17 = 0.0; + } + } + + void write(Athena::io::IStreamWriter& __dna_writer) const + { + IScriptObject::write(__dna_writer); + /* name */ + __dna_writer.writeString(name, -1); + /* unknown1 */ + __dna_writer.writeBool(unknown1); + /* mlvl */ + mlvl.write(__dna_writer); + /* mrea */ + mrea.write(__dna_writer); + /* animationParameters */ + animationParameters.write(__dna_writer); + /* unknown2 */ + __dna_writer.writeVec3fBig(unknown2); + /* model1 */ + model1.write(__dna_writer); + /* unknown3 */ + __dna_writer.writeVec3fBig(unknown3); + /* model2 */ + model2.write(__dna_writer); + /* unknown4 */ + __dna_writer.writeVec3fBig(unknown4); + /* unknown5 */ + __dna_writer.writeBool(unknown5); + /* soundID */ + __dna_writer.writeUint32Big(soundID); + /* unknown6 */ + __dna_writer.writeUint32Big(unknown6); + /* unknown7 */ + __dna_writer.writeUint32Big(unknown7); + /* unknown8 */ + __dna_writer.writeBool(unknown8); + /* font */ + font.write(__dna_writer); + /* strg */ + strg.write(__dna_writer); + /* unknown9 */ + __dna_writer.writeBool(unknown9); + /* unknown10 */ + __dna_writer.writeFloatBig(unknown10); + /* unknown11 */ + __dna_writer.writeFloatBig(unknown11); + /* unknown12 */ + __dna_writer.writeFloatBig(unknown12); + + if (propertyCount == 26) + { + __dna_writer.writeBool(unknown13); + __dna_writer.writeBool(unknown14); + __dna_writer.writeFloatBig(unknown15); + __dna_writer.writeFloatBig(unknown16); + __dna_writer.writeFloatBig(unknown17); + } + } + + void fromYAML(Athena::io::YAMLDocReader& __dna_docin) + { + IScriptObject::fromYAML(__dna_docin); + /* name */ + name = __dna_docin.readString("name"); + /* unknown1 */ + unknown1 = __dna_docin.readBool("unknown1"); + /* mlvl */ + __dna_docin.enumerate("mlvl", mlvl); + /* mrea */ + __dna_docin.enumerate("mrea", mrea); + /* animationParameters */ + __dna_docin.enumerate("animationParameters", animationParameters); + /* unknown2 */ + unknown2 = __dna_docin.readVec3f("unknown2"); + /* model1 */ + __dna_docin.enumerate("model1", model1); + /* unknown3 */ + unknown3 = __dna_docin.readVec3f("unknown3"); + /* model2 */ + __dna_docin.enumerate("model2", model2); + /* unknown4 */ + unknown4 = __dna_docin.readVec3f("unknown4"); + /* unknown5 */ + unknown5 = __dna_docin.readBool("unknown5"); + /* soundID */ + soundID = __dna_docin.readUint32("soundID"); + /* unknown6 */ + unknown6 = __dna_docin.readUint32("unknown6"); + /* unknown7 */ + unknown7 = __dna_docin.readUint32("unknown7"); + /* unknown8 */ + unknown8 = __dna_docin.readBool("unknown8"); + /* font */ + __dna_docin.enumerate("font", font); + /* strg */ + __dna_docin.enumerate("strg", strg); + /* unknown9 */ + unknown9 = __dna_docin.readBool("unknown9"); + /* unknown10 */ + unknown10 = __dna_docin.readFloat("unknown10"); + /* unknown11 */ + unknown11 = __dna_docin.readFloat("unknown11"); + /* unknown12 */ + unknown12 = __dna_docin.readFloat("unknown12"); + + if (propertyCount == 26) + { + unknown13 = __dna_docin.readBool("unknown13"); + unknown14 = __dna_docin.readBool("unknown14"); + unknown15 = __dna_docin.readFloat("unknown15"); + unknown16 = __dna_docin.readFloat("unknown16"); + unknown17 = __dna_docin.readFloat("unknown17"); + } + else + { + unknown13 = false; + unknown14 = false; + unknown15 = 0.0; + unknown16 = 0.0; + unknown17 = 0.0; + } + } + + void toYAML(Athena::io::YAMLDocWriter& __dna_docout) const + { + IScriptObject::toYAML(__dna_docout); + /* name */ + __dna_docout.writeString("name", name); + /* unknown1 */ + __dna_docout.writeBool("unknown1", unknown1); + /* mlvl */ + __dna_docout.enumerate("mlvl", mlvl); + /* mrea */ + __dna_docout.enumerate("mrea", mrea); + /* animationParameters */ + __dna_docout.enumerate("animationParameters", animationParameters); + /* unknown2 */ + __dna_docout.writeVec3f("unknown2", unknown2); + /* model1 */ + __dna_docout.enumerate("model1", model1); + /* unknown3 */ + __dna_docout.writeVec3f("unknown3", unknown3); + /* model2 */ + __dna_docout.enumerate("model2", model2); + /* unknown4 */ + __dna_docout.writeVec3f("unknown4", unknown4); + /* unknown5 */ + __dna_docout.writeBool("unknown5", unknown5); + /* soundID */ + __dna_docout.writeUint32("soundID", soundID); + /* unknown6 */ + __dna_docout.writeUint32("unknown6", unknown6); + /* unknown7 */ + __dna_docout.writeUint32("unknown7", unknown7); + /* unknown8 */ + __dna_docout.writeBool("unknown8", unknown8); + /* font */ + __dna_docout.enumerate("font", font); + /* strg */ + __dna_docout.enumerate("strg", strg); + /* unknown9 */ + __dna_docout.writeBool("unknown9", unknown9); + /* unknown10 */ + __dna_docout.writeFloat("unknown10", unknown10); + /* unknown11 */ + __dna_docout.writeFloat("unknown11", unknown11); + /* unknown12 */ + __dna_docout.writeFloat("unknown12", unknown12); + + if (propertyCount == 26) + { + __dna_docout.writeBool("unknown13", unknown13); + __dna_docout.writeBool("unknown14", unknown14); + __dna_docout.writeFloat("unknown15", unknown15); + __dna_docout.writeFloat("unknown16", unknown16); + __dna_docout.writeFloat("unknown17", unknown17); + } + } + + static const char* DNAType() + { + return "Retro::DNAMP1::WorldTeleporter"; + } }; + } } diff --git a/MathLib b/MathLib index 72972196a..5ec947366 160000 --- a/MathLib +++ b/MathLib @@ -1 +1 @@ -Subproject commit 72972196a4ebf8d41ba9e5c212fe89cd796f97eb +Subproject commit 5ec947366a9577369e68091945ddb93eaaefcc74