From 234573938a74c9792f5f9b7dd4fc2e6749f3ad46 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Tue, 5 Apr 2016 16:16:27 -1000 Subject: [PATCH 1/3] Use base ID where needed --- DataSpec/DNAMP1/ANCS.hpp | 6 +++--- DataSpec/DNAMP2/ANCS.hpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/DataSpec/DNAMP1/ANCS.hpp b/DataSpec/DNAMP1/ANCS.hpp index b877e14f4..d9ec8e905 100644 --- a/DataSpec/DNAMP1/ANCS.hpp +++ b/DataSpec/DNAMP1/ANCS.hpp @@ -569,11 +569,11 @@ struct ANCS : BigYAML DNAANCS::CharacterResInfo& chOut = out.back(); chOut.name = ci.name; chOut.cmdl = ci.cmdl; - chOut.cskr = ci.cskr; - chOut.cinf = ci.cinf; + chOut.cskr = ci.cskr.getBaseId(); + chOut.cinf = ci.cinf.getBaseId(); if (ci.cmdlOverlay) - chOut.overlays.emplace_back(FOURCC('OVER'), std::make_pair(ci.cmdlOverlay, ci.cskrOverlay)); + chOut.overlays.emplace_back(FOURCC('OVER'), std::make_pair(ci.cmdlOverlay, ci.cskrOverlay.getBaseId())); } } diff --git a/DataSpec/DNAMP2/ANCS.hpp b/DataSpec/DNAMP2/ANCS.hpp index dc4944e62..134d47a9d 100644 --- a/DataSpec/DNAMP2/ANCS.hpp +++ b/DataSpec/DNAMP2/ANCS.hpp @@ -201,11 +201,11 @@ struct ANCS : BigYAML DNAANCS::CharacterResInfo& chOut = out.back(); chOut.name = ci.name; chOut.cmdl = ci.cmdl; - chOut.cskr = ci.cskr; - chOut.cinf = ci.cinf; + chOut.cskr = ci.cskr.getBaseId(); + chOut.cinf = ci.cinf.getBaseId(); if (ci.cmdlOverlay) - chOut.overlays.emplace_back(FOURCC('OVER'), std::make_pair(ci.cmdlOverlay, ci.cskrOverlay)); + chOut.overlays.emplace_back(FOURCC('OVER'), std::make_pair(ci.cmdlOverlay, ci.cskrOverlay.getBaseId())); } } From 3723076ae36cb4e8eeb6b4b738516176e7d32a99 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Tue, 5 Apr 2016 17:28:10 -1000 Subject: [PATCH 2/3] Fix horrible memory leak --- DataSpec/DNAMP1/ANCS.hpp | 12 +++++++++--- DataSpec/DNAMP2/ANCS.hpp | 9 ++++++--- hecl | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/DataSpec/DNAMP1/ANCS.hpp b/DataSpec/DNAMP1/ANCS.hpp index d9ec8e905..0a5ecc66e 100644 --- a/DataSpec/DNAMP1/ANCS.hpp +++ b/DataSpec/DNAMP1/ANCS.hpp @@ -40,6 +40,8 @@ struct ANCS : BigYAML atUint32 idx; std::string name; UniqueID32 cmdl; + UniqueID32 _cskrOld; + UniqueID32 _cinfOld; AuxiliaryID32 cskr = _S("skin"); AuxiliaryID32 cinf = {_S("layout"), _S(".blend")}; @@ -145,6 +147,7 @@ struct ANCS : BigYAML std::vector effects; UniqueID32 cmdlOverlay; + UniqueID32 _cskrOverlayOld; AuxiliaryID32 cskrOverlay = _S("skin"); std::vector animIdxs; @@ -569,11 +572,11 @@ struct ANCS : BigYAML DNAANCS::CharacterResInfo& chOut = out.back(); chOut.name = ci.name; chOut.cmdl = ci.cmdl; - chOut.cskr = ci.cskr.getBaseId(); - chOut.cinf = ci.cinf.getBaseId(); + chOut.cskr = ci._cskrOld; + chOut.cinf = ci._cinfOld; if (ci.cmdlOverlay) - chOut.overlays.emplace_back(FOURCC('OVER'), std::make_pair(ci.cmdlOverlay, ci.cskrOverlay.getBaseId())); + chOut.overlays.emplace_back(FOURCC('OVER'), std::make_pair(ci.cmdlOverlay, ci._cskrOverlayOld)); } } @@ -599,8 +602,11 @@ struct ANCS : BigYAML { for (CharacterSet::CharacterInfo& character : characterSet.characters) { + character._cskrOld = character.cskr; + character._cinfOld = character.cinf; character.cskr = character.cmdl; character.cinf = ancsId; + character._cskrOverlayOld = character.cskrOverlay; character.cskrOverlay = character.cmdlOverlay; } } diff --git a/DataSpec/DNAMP2/ANCS.hpp b/DataSpec/DNAMP2/ANCS.hpp index 134d47a9d..d3911c51c 100644 --- a/DataSpec/DNAMP2/ANCS.hpp +++ b/DataSpec/DNAMP2/ANCS.hpp @@ -41,6 +41,8 @@ struct ANCS : BigYAML atUint32 idx; std::string name; UniqueID32 cmdl; + UniqueID32 _cskrOld; + UniqueID32 _cinfOld; AuxiliaryID32 cskr = _S("skin"); AuxiliaryID32 cinf = {_S("layout"), _S("skin")}; @@ -88,6 +90,7 @@ struct ANCS : BigYAML std::vector effects; UniqueID32 cmdlOverlay; + UniqueID32 _cskrOverlayOld; AuxiliaryID32 cskrOverlay = _S("skin"); std::vector animIdxs; @@ -201,11 +204,11 @@ struct ANCS : BigYAML DNAANCS::CharacterResInfo& chOut = out.back(); chOut.name = ci.name; chOut.cmdl = ci.cmdl; - chOut.cskr = ci.cskr.getBaseId(); - chOut.cinf = ci.cinf.getBaseId(); + chOut.cskr = ci._cskrOld; + chOut.cinf = ci._cinfOld; if (ci.cmdlOverlay) - chOut.overlays.emplace_back(FOURCC('OVER'), std::make_pair(ci.cmdlOverlay, ci.cskrOverlay.getBaseId())); + chOut.overlays.emplace_back(FOURCC('OVER'), std::make_pair(ci.cmdlOverlay, ci._cskrOverlayOld)); } } diff --git a/hecl b/hecl index de043503e..22d1a5a98 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit de043503e5d2312ccc10876b0ac3d5ebb91bb768 +Subproject commit 22d1a5a98969e82bc314e9908f7f0d677eb4a9d5 From cd8b6b6ed403f90d1aaa347a3c7cecf54e19ff55 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Tue, 5 Apr 2016 17:43:14 -1000 Subject: [PATCH 3/3] Decide against emitting ANIM IDs in ANCS YAML --- DataSpec/DNACommon/ANCS.hpp | 14 -------------- DataSpec/DNAMP1/ANCS.hpp | 11 +++++++---- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/DataSpec/DNACommon/ANCS.hpp b/DataSpec/DNACommon/ANCS.hpp index e45dd281a..03d36e5d9 100644 --- a/DataSpec/DNACommon/ANCS.hpp +++ b/DataSpec/DNACommon/ANCS.hpp @@ -32,20 +32,6 @@ struct AnimationResInfo bool additive; }; -static void WriteOutAnimId(athena::io::YAMLDocWriter& __dna_docout, - const UniqueID32& ancsId, - const std::string& animName) -{ - __dna_docout.enterSubRecord("animId"); - hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(ancsId); - if (path) - { - path = path.getWithExtension(_S(".blend")); - __dna_docout.writeString(nullptr, path.getRelativePathUTF8() + _S('|') + animName); - } - __dna_docout.leaveSubRecord(); -} - template bool ReadANCSToBlender(hecl::BlenderConnection& conn, const ANCSDNA& ancs, diff --git a/DataSpec/DNAMP1/ANCS.hpp b/DataSpec/DNAMP1/ANCS.hpp index 0a5ecc66e..0ae0c4291 100644 --- a/DataSpec/DNAMP1/ANCS.hpp +++ b/DataSpec/DNAMP1/ANCS.hpp @@ -230,8 +230,6 @@ struct ANCS : BigYAML void read(athena::io::YAMLDocReader& __dna_docin) { - /* animId */ - __dna_docin.enumerate("animId", animId); /* animIdx */ animIdx = __dna_docin.readUint32("animIdx"); /* animName */ @@ -240,12 +238,17 @@ struct ANCS : BigYAML unk1 = __dna_docin.readFloat("unk1"); /* unk2 */ unk2 = __dna_docin.readUint32("unk2"); + + hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(m_ancsId); + if (path) + { + hecl::SystemStringView sysView(animName); + animId = path.ensureAuxInfo(sysView.sys_str().c_str()); + } } void write(athena::io::YAMLDocWriter& __dna_docout) const { - /* animId */ - DNAANCS::WriteOutAnimId(__dna_docout, m_ancsId, animName); /* animIdx */ __dna_docout.writeUint32("animIdx", animIdx); /* animName */