mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-12-08 20:27:48 +00:00
feat: add post processors compiling iwds and ipaks
This commit is contained in:
@@ -257,9 +257,10 @@ class LinkerImpl final : public Linker
|
||||
return true;
|
||||
}
|
||||
|
||||
std::unique_ptr<Zone> CreateZoneForDefinition(LinkerPathManager& paths, const std::string& targetName, ZoneDefinition& zoneDefinition) const
|
||||
std::unique_ptr<Zone> CreateZoneForDefinition(
|
||||
LinkerPathManager& paths, const fs::path& outDir, const fs::path& cacheDir, const std::string& targetName, ZoneDefinition& zoneDefinition) const
|
||||
{
|
||||
ZoneCreationContext context(&zoneDefinition, &paths.m_asset_paths.GetSearchPaths());
|
||||
ZoneCreationContext context(&zoneDefinition, &paths.m_asset_paths.GetSearchPaths(), outDir, cacheDir);
|
||||
if (!ProcessZoneDefinitionIgnores(paths, targetName, context))
|
||||
return nullptr;
|
||||
if (!LoadGdtFilesFromZoneDefinition(context.m_gdt_files, zoneDefinition, &paths.m_gdt_paths.GetSearchPaths()))
|
||||
@@ -268,22 +269,18 @@ class LinkerImpl final : public Linker
|
||||
return zone_creator::CreateZoneForDefinition(zoneDefinition.m_game, context);
|
||||
}
|
||||
|
||||
bool WriteZoneToFile(const LinkerPathManager& paths, const std::string& projectName, Zone* zone) const
|
||||
bool WriteZoneToFile(const LinkerPathManager& paths, const fs::path& outDir, const std::string& projectName, Zone* zone) const
|
||||
{
|
||||
const fs::path zoneFolderPath(paths.m_linker_paths->BuildOutputFolderPath(projectName, zone->m_game->GetId()));
|
||||
auto zoneFilePath(zoneFolderPath);
|
||||
zoneFilePath.append(zone->m_name + ".ff");
|
||||
auto zoneFilePath(outDir);
|
||||
zoneFilePath.append(std::format("{}.ff", zone->m_name));
|
||||
|
||||
fs::create_directories(zoneFolderPath);
|
||||
fs::create_directories(outDir);
|
||||
|
||||
std::ofstream stream(zoneFilePath, std::fstream::out | std::fstream::binary);
|
||||
if (!stream.is_open())
|
||||
return false;
|
||||
|
||||
if (m_args.m_verbose)
|
||||
{
|
||||
std::cout << std::format("Building zone \"{}\"\n", zoneFilePath.string());
|
||||
}
|
||||
std::cout << std::format("Building zone \"{}\"\n", zoneFilePath.string());
|
||||
|
||||
if (!ZoneWriting::WriteZone(stream, zone))
|
||||
{
|
||||
@@ -300,12 +297,14 @@ class LinkerImpl final : public Linker
|
||||
|
||||
bool BuildFastFile(LinkerPathManager& paths, const std::string& projectName, const std::string& targetName, ZoneDefinition& zoneDefinition) const
|
||||
{
|
||||
SoundBankWriter::OutputPath = fs::path(paths.m_linker_paths->BuildOutputFolderPath(projectName, zoneDefinition.m_game));
|
||||
const fs::path outDir(paths.m_linker_paths->BuildOutputFolderPath(projectName, zoneDefinition.m_game));
|
||||
const fs::path cacheDir(paths.m_linker_paths->BuildCacheFolderPath(projectName, zoneDefinition.m_game));
|
||||
SoundBankWriter::OutputPath = outDir;
|
||||
|
||||
const auto zone = CreateZoneForDefinition(paths, targetName, zoneDefinition);
|
||||
const auto zone = CreateZoneForDefinition(paths, outDir, cacheDir, targetName, zoneDefinition);
|
||||
auto result = zone != nullptr;
|
||||
if (zone)
|
||||
result = WriteZoneToFile(paths, projectName, zone.get());
|
||||
result = WriteZoneToFile(paths, outDir, projectName, zone.get());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user