From 137e96c7324a8ac31f8a7721f6dac9b7b530d520 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sun, 30 May 2021 23:10:59 -0700 Subject: [PATCH] Fix cooking new world/area data without an underscore in the name --- DataSpec/DNACommon/MAPA.cpp | 2 +- DataSpec/DNACommon/MAPU.cpp | 2 +- DataSpec/DNAMP1/MLVL.cpp | 10 +++++----- DataSpec/SpecBase.cpp | 4 ++-- DataSpec/SpecMP1.cpp | 2 +- Runtime/MP1/MP1.cpp | 2 +- hecl/driver/ToolPackage.hpp | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/DataSpec/DNACommon/MAPA.cpp b/DataSpec/DNACommon/MAPA.cpp index 2cc8e85d9..3fb81f506 100644 --- a/DataSpec/DNACommon/MAPA.cpp +++ b/DataSpec/DNACommon/MAPA.cpp @@ -291,7 +291,7 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const /* World background */ hecl::ProjectPath worldDir = outPath.getParentPath().getParentPath(); for (const auto& ent : hecl::DirectoryEnumerator(worldDir.getAbsolutePath())) { - if (hecl::StringUtils::BeginsWith(ent.m_name, _SYS_STR("!world_")) && + if (hecl::StringUtils::BeginsWith(ent.m_name, _SYS_STR("!world")) && hecl::StringUtils::EndsWith(ent.m_name, _SYS_STR(".blend"))) { hecl::SystemUTF8Conv conv(ent.m_name); os.linkBackground(fmt::format(FMT_STRING("//../{}"), conv), "World"sv); diff --git a/DataSpec/DNACommon/MAPU.cpp b/DataSpec/DNACommon/MAPU.cpp index e3e7dcf9f..bed0b8a6f 100644 --- a/DataSpec/DNACommon/MAPU.cpp +++ b/DataSpec/DNACommon/MAPU.cpp @@ -115,7 +115,7 @@ bool MAPU::Cook(const hecl::blender::MapUniverse& mapuIn, const hecl::ProjectPat MAPU::World& wldOut = mapu.worlds.back(); wldOut.name = wld.name; for (const auto& ent : wld.worldPath.enumerateDir()) { - if (hecl::StringUtils::BeginsWith(ent.m_name, _SYS_STR("!world_")) && + if (hecl::StringUtils::BeginsWith(ent.m_name, _SYS_STR("!world")) && hecl::StringUtils::EndsWith(ent.m_name, _SYS_STR(".blend"))) { wldOut.mlvl = hecl::ProjectPath(wld.worldPath, ent.m_name); break; diff --git a/DataSpec/DNAMP1/MLVL.cpp b/DataSpec/DNAMP1/MLVL.cpp index d5d85ac4b..f8dadbc7b 100644 --- a/DataSpec/DNAMP1/MLVL.cpp +++ b/DataSpec/DNAMP1/MLVL.cpp @@ -112,15 +112,15 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat mlvl.magic = 0xDEAFBABE; mlvl.version = 0x11; - hecl::ProjectPath namePath = GetPathBeginsWith(dEnum, parentPath, _SYS_STR("!name_")); + hecl::ProjectPath namePath = GetPathBeginsWith(dEnum, parentPath, _SYS_STR("!name")); if (namePath.isFile()) mlvl.worldNameId = namePath; - hecl::ProjectPath savwPath = GetPathBeginsWith(dEnum, parentPath, _SYS_STR("!savw_")); + hecl::ProjectPath savwPath = GetPathBeginsWith(dEnum, parentPath, _SYS_STR("!savw")); if (savwPath.isFile()) { CookSAVW(savwPath.getCookedPath(SpecEntMP1), wld); mlvl.saveWorldId = savwPath; } - hecl::ProjectPath mapwPath = GetPathBeginsWith(dEnum, parentPath, _SYS_STR("!mapw_")); + hecl::ProjectPath mapwPath = GetPathBeginsWith(dEnum, parentPath, _SYS_STR("!mapw")); if (mapwPath.isFile()) { CookMAPW(mapwPath.getCookedPath(SpecEntMP1), wld); mlvl.worldMap = mapwPath; @@ -133,7 +133,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat continue; const hecl::DirectoryEnumerator areaDEnum(area.path.getAbsolutePath()); - const hecl::ProjectPath areaPath = GetPathBeginsWith(areaDEnum, area.path, _SYS_STR("!area_")); + const hecl::ProjectPath areaPath = GetPathBeginsWith(areaDEnum, area.path, _SYS_STR("!area")); if (!areaPath.isFile()) continue; @@ -200,7 +200,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat mlvl.areas.emplace_back(); MLVL::Area& areaOut = mlvl.areas.back(); - hecl::ProjectPath namePath = GetPathBeginsWith(areaDEnum, area.path, _SYS_STR("!name_")); + namePath = GetPathBeginsWith(areaDEnum, area.path, _SYS_STR("!name")); if (namePath.isFile()) areaOut.areaNameId = namePath; diff --git a/DataSpec/SpecBase.cpp b/DataSpec/SpecBase.cpp index 8329e2468..74b576472 100644 --- a/DataSpec/SpecBase.cpp +++ b/DataSpec/SpecBase.cpp @@ -536,7 +536,7 @@ void SpecBase::copyBuildListData(std::vector>& static bool IsWorldBlend(const hecl::ProjectPath& path) { if (path.isFile()) { auto lastComp = path.getLastComponent(); - return hecl::StringUtils::BeginsWith(lastComp, _SYS_STR("!world_")) && + return hecl::StringUtils::BeginsWith(lastComp, _SYS_STR("!world")) && hecl::StringUtils::EndsWith(lastComp, _SYS_STR(".blend")); } return false; @@ -680,7 +680,7 @@ std::optional SpecBase::compileWorldFromDir(const hecl::Pr hecl::blender::Token& btok) const { hecl::ProjectPath asBlend; for (const auto& ent : hecl::DirectoryEnumerator(dir.getAbsolutePath())) { - if (hecl::StringUtils::BeginsWith(ent.m_name, _SYS_STR("!world_"))) { + if (hecl::StringUtils::BeginsWith(ent.m_name, _SYS_STR("!world"))) { asBlend = hecl::ProjectPath(dir, ent.m_name).getWithExtension(_SYS_STR(".blend"), true); break; } diff --git a/DataSpec/SpecMP1.cpp b/DataSpec/SpecMP1.cpp index d3ac0a208..effe4079c 100644 --- a/DataSpec/SpecMP1.cpp +++ b/DataSpec/SpecMP1.cpp @@ -712,7 +712,7 @@ struct SpecMP1 : SpecBase { if (ent2.m_isDir) { hecl::ProjectPath wldDir(pakPath, ent2.m_name); for (const auto& ent3 : wldDir.enumerateDir()) { - if (hecl::StringUtils::BeginsWith(ent3.m_name, _SYS_STR("!world_")) && + if (hecl::StringUtils::BeginsWith(ent3.m_name, _SYS_STR("!world")) && hecl::StringUtils::EndsWith(ent3.m_name, _SYS_STR(".blend"))) { hecl::ProjectPath wldPath(wldDir, ent3.m_name); if (wldPath.isFile()) { diff --git a/Runtime/MP1/MP1.cpp b/Runtime/MP1/MP1.cpp index bc9e2f83d..120b95aa3 100644 --- a/Runtime/MP1/MP1.cpp +++ b/Runtime/MP1/MP1.cpp @@ -348,7 +348,7 @@ void CMain::AddWorldPaks() { } auto pakPrefix = g_tweakGame->GetWorldPrefix(); - for (int i = 0; i < 9; ++i) { + for (int i = 0; i < 10; ++i) { std::string path(pakPrefix); if (i != 0) { diff --git a/hecl/driver/ToolPackage.hpp b/hecl/driver/ToolPackage.hpp index 6f68936d4..b30597674 100644 --- a/hecl/driver/ToolPackage.hpp +++ b/hecl/driver/ToolPackage.hpp @@ -21,7 +21,7 @@ class ToolPackage final : public ToolBase { void CheckFile(const hecl::ProjectPath& path) { auto lastComp = path.getLastComponent(); - if (hecl::StringUtils::BeginsWith(lastComp, _SYS_STR("!world_")) && + if (hecl::StringUtils::BeginsWith(lastComp, _SYS_STR("!world")) && hecl::StringUtils::EndsWith(lastComp, _SYS_STR(".blend"))) AddSelectedItem(path); }