diff --git a/DataSpec/DNACommon/DNACommon.cpp b/DataSpec/DNACommon/DNACommon.cpp index 45a3e9a9c..1df58b420 100644 --- a/DataSpec/DNACommon/DNACommon.cpp +++ b/DataSpec/DNACommon/DNACommon.cpp @@ -7,5 +7,6 @@ namespace DataSpec logvisor::Module LogDNACommon("urde::DNACommon"); SpecBase* g_curSpec = nullptr; PAKRouterBase* g_PakRouter = nullptr; +hecl::Database::Project* UniqueIDBridge::s_Project = nullptr; } diff --git a/DataSpec/DNACommon/DNACommon.hpp b/DataSpec/DNACommon/DNACommon.hpp index 0972de5f7..1a5d761a3 100644 --- a/DataSpec/DNACommon/DNACommon.hpp +++ b/DataSpec/DNACommon/DNACommon.hpp @@ -83,24 +83,34 @@ class UniqueIDBridge { friend class UniqueID32; friend class UniqueID64; + + static hecl::Database::Project* s_Project; public: template static hecl::ProjectPath TranslatePakIdToPath(const IDType& id) { if (!g_PakRouter) LogDNACommon.report(logvisor::Fatal, - "UniqueIDBridge::setPakRouter must be called before translatePakIdToPath"); + "g_Project must be set to non-null before calling UniqueIDBridge::TranslatePakIdToPath"); return g_PakRouter->getWorking(id); } static hecl::ProjectPath MakePathFromString(const std::string& str) { - return hecl::ProjectPath(g_PakRouter->getProject(), str); + if (!s_Project) + LogDNACommon.report(logvisor::Fatal, + "UniqueIDBridge::setGlobalProject must be called before MakePathFromString"); + return hecl::ProjectPath(*s_Project, str); } template static void TransformOldHashToNewHash(IDType& id) { id = TranslatePakIdToPath(id); } + + static void setGlobalProject(hecl::Database::Project& project) + { + s_Project = &project; + } }; /** PAK 32-bit Unique ID */ diff --git a/DataSpec/SpecBase.cpp b/DataSpec/SpecBase.cpp index cb6145873..d1d42c486 100644 --- a/DataSpec/SpecBase.cpp +++ b/DataSpec/SpecBase.cpp @@ -35,7 +35,10 @@ static const hecl::SystemChar* MomErr[] = constexpr uint32_t MomErrCount = std::extent::value; SpecBase::SpecBase(const hecl::Database::DataSpecEntry* specEntry, hecl::Database::Project& project, bool pc) : hecl::Database::IDataSpec(specEntry), m_project(project), m_pc(pc), - m_masterShader(project.getProjectWorkingPath(), ".hecl/RetroMasterShader.blend") {} + m_masterShader(project.getProjectWorkingPath(), ".hecl/RetroMasterShader.blend") +{ + DataSpec::UniqueIDBridge::setGlobalProject(m_project); +} bool SpecBase::canExtract(const ExtractPassInfo& info, std::vector& reps) { diff --git a/Editor/ViewManager.cpp b/Editor/ViewManager.cpp index 6808cdb4d..f21df0c32 100644 --- a/Editor/ViewManager.cpp +++ b/Editor/ViewManager.cpp @@ -25,6 +25,7 @@ void ViewManager::BuildTestPART(urde::IObjectStore& objStore) //m_partGenDesc = objStore.GetObj({hecl::FOURCC('PART'), 0x972A5CD2}); m_partGenDesc = objStore.GetObj("BusterSparks"); + m_partGenDesc.Lock(); m_partGen.reset(new urde::CElementGen(m_partGenDesc, urde::CElementGen::EModelOrientationType::Normal, urde::CElementGen::EOptionalSystemFlags::None)); diff --git a/Runtime/Particle/CElementGen.cpp b/Runtime/Particle/CElementGen.cpp index 548557968..e099b018b 100644 --- a/Runtime/Particle/CElementGen.cpp +++ b/Runtime/Particle/CElementGen.cpp @@ -278,6 +278,11 @@ CElementGen::CElementGen(const TToken& gen, { CGenDescription* desc = x1c_genDesc.GetObj(); + if (desc->x54_x40_TEXR) + desc->x54_x40_TEXR->GetValueTexture(0).GetObj(); + if (desc->x58_x44_TIND) + desc->x58_x44_TIND->GetValueTexture(0).GetObj(); + CIntElement* seedElem = desc->x1c_x10_SEED.get(); if (seedElem) { diff --git a/Runtime/Particle/CParticleDataFactory.cpp b/Runtime/Particle/CParticleDataFactory.cpp index ac1e5adf2..e0c7fb4b1 100644 --- a/Runtime/Particle/CParticleDataFactory.cpp +++ b/Runtime/Particle/CParticleDataFactory.cpp @@ -1118,7 +1118,7 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i } /* Now for our custom additions, if available */ - if (!in.atEnd()) + if (!in.atEnd() && (in.position() + 4) < in.length()) { clsId = GetClassID(in); if (clsId == 0xFFFFFFFF) diff --git a/Runtime/Particle/CUVElement.hpp b/Runtime/Particle/CUVElement.hpp index 85c31b962..03f8e8fe8 100644 --- a/Runtime/Particle/CUVElement.hpp +++ b/Runtime/Particle/CUVElement.hpp @@ -30,7 +30,10 @@ struct CUVEConstant : public CUVElement TLockedToken x4_tex; public: CUVEConstant(TToken&& tex) - : x4_tex(std::move(tex)) {} + : x4_tex(std::move(tex)) + { + + } TLockedToken GetValueTexture(int frame) const { return TLockedToken(x4_tex);