mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 08:05:45 +00:00
Always load/unload project specific zones
This commit is contained in:
parent
fb5c67b5ce
commit
23d0fe1eb0
@ -25,6 +25,7 @@
|
|||||||
#include "Game/T6/ZoneCreatorT6.h"
|
#include "Game/T6/ZoneCreatorT6.h"
|
||||||
|
|
||||||
#include "Utils/ObjFileStream.h"
|
#include "Utils/ObjFileStream.h"
|
||||||
|
#include "Utils/StringUtils.h"
|
||||||
#include "Zone/AssetList/AssetList.h"
|
#include "Zone/AssetList/AssetList.h"
|
||||||
#include "Zone/AssetList/AssetListStream.h"
|
#include "Zone/AssetList/AssetListStream.h"
|
||||||
#include "Zone/Definition/ZoneDefinitionStream.h"
|
#include "Zone/Definition/ZoneDefinitionStream.h"
|
||||||
@ -403,28 +404,21 @@ class LinkerImpl final : public Linker
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BuildFastFile(const std::string& projectName, ZoneDefinition& zoneDefinition, SearchPaths& sourceSearchPaths)
|
bool BuildFastFile(const std::string& projectName, ZoneDefinition& zoneDefinition, SearchPaths& assetSearchPaths, SearchPaths& gdtSearchPaths, SearchPaths& sourceSearchPaths) const
|
||||||
{
|
{
|
||||||
std::string gameName;
|
|
||||||
if (!GetGameNameFromZoneDefinition(gameName, projectName, zoneDefinition))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
for (auto& c : gameName)
|
|
||||||
c = static_cast<char>(std::tolower(c));
|
|
||||||
|
|
||||||
auto assetSearchPaths = m_search_paths.GetAssetSearchPathsForProject(gameName, projectName);
|
|
||||||
auto gdtSearchPaths = m_search_paths.GetGdtSearchPathsForProject(gameName, projectName);
|
|
||||||
|
|
||||||
const auto zone = CreateZoneForDefinition(projectName, zoneDefinition, &assetSearchPaths, &gdtSearchPaths, &sourceSearchPaths);
|
const auto zone = CreateZoneForDefinition(projectName, zoneDefinition, &assetSearchPaths, &gdtSearchPaths, &sourceSearchPaths);
|
||||||
auto result = zone != nullptr;
|
auto result = zone != nullptr;
|
||||||
if (zone)
|
if (zone)
|
||||||
result = WriteZoneToFile(projectName, zone.get());
|
result = WriteZoneToFile(projectName, zone.get());
|
||||||
|
|
||||||
m_search_paths.UnloadProjectSpecificSearchPaths();
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BuildIPak(const std::string& projectName, ZoneDefinition& zoneDefinition, SearchPaths& assetSearchPaths, SearchPaths& sourceSearchPaths)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool BuildProject(const std::string& projectName)
|
bool BuildProject(const std::string& projectName)
|
||||||
{
|
{
|
||||||
auto sourceSearchPaths = m_search_paths.GetSourceSearchPathsForProject(projectName);
|
auto sourceSearchPaths = m_search_paths.GetSourceSearchPathsForProject(projectName);
|
||||||
@ -437,18 +431,33 @@ class LinkerImpl final : public Linker
|
|||||||
if (!GetProjectTypeFromZoneDefinition(projectType, projectName, *zoneDefinition))
|
if (!GetProjectTypeFromZoneDefinition(projectType, projectName, *zoneDefinition))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
std::string gameName;
|
||||||
|
if (!GetGameNameFromZoneDefinition(gameName, projectName, *zoneDefinition))
|
||||||
|
return false;
|
||||||
|
utils::MakeStringLowerCase(gameName);
|
||||||
|
|
||||||
|
auto assetSearchPaths = m_search_paths.GetAssetSearchPathsForProject(gameName, projectName);
|
||||||
|
auto gdtSearchPaths = m_search_paths.GetGdtSearchPathsForProject(gameName, projectName);
|
||||||
|
|
||||||
|
auto result = false;
|
||||||
switch (projectType)
|
switch (projectType)
|
||||||
{
|
{
|
||||||
case ProjectType::FASTFILE:
|
case ProjectType::FASTFILE:
|
||||||
return BuildFastFile(projectName, *zoneDefinition, sourceSearchPaths);
|
result = BuildFastFile(projectName, *zoneDefinition, assetSearchPaths, gdtSearchPaths, sourceSearchPaths);
|
||||||
|
break;
|
||||||
|
|
||||||
case ProjectType::IPAK:
|
case ProjectType::IPAK:
|
||||||
|
result = BuildIPak(projectName, *zoneDefinition, assetSearchPaths, sourceSearchPaths);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
assert(false);
|
assert(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
m_search_paths.UnloadProjectSpecificSearchPaths();
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LoadZones()
|
bool LoadZones()
|
||||||
|
@ -88,4 +88,16 @@ namespace utils
|
|||||||
inEscape = true;
|
inEscape = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MakeStringLowerCase(std::string& str)
|
||||||
|
{
|
||||||
|
for (auto& c : str)
|
||||||
|
c = static_cast<char>(tolower(c));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MakeStringUpperCase(std::string& str)
|
||||||
|
{
|
||||||
|
for (auto& c : str)
|
||||||
|
c = static_cast<char>(toupper(c));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,4 +11,7 @@ namespace utils
|
|||||||
void EscapeStringForQuotationMarks(std::ostream& stream, const std::string_view& str);
|
void EscapeStringForQuotationMarks(std::ostream& stream, const std::string_view& str);
|
||||||
std::string UnescapeStringFromQuotationMarks(const std::string_view& str);
|
std::string UnescapeStringFromQuotationMarks(const std::string_view& str);
|
||||||
void UnescapeStringFromQuotationMarks(std::ostream& stream, const std::string_view& str);
|
void UnescapeStringFromQuotationMarks(std::ostream& stream, const std::string_view& str);
|
||||||
|
|
||||||
|
void MakeStringLowerCase(std::string& str);
|
||||||
|
void MakeStringUpperCase(std::string& str);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user