mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 00:02:55 +00:00
Merge pull request #144 from Laupetin/refactor/minor-code-improvements
refactor: minor code improvements
This commit is contained in:
commit
c1504eb993
@ -25,7 +25,7 @@ void GameIW3::AddZone(Zone* zone)
|
|||||||
|
|
||||||
void GameIW3::RemoveZone(Zone* zone)
|
void GameIW3::RemoveZone(Zone* zone)
|
||||||
{
|
{
|
||||||
const auto foundEntry = std::find(m_zones.begin(), m_zones.end(), zone);
|
const auto foundEntry = std::ranges::find(m_zones, zone);
|
||||||
|
|
||||||
if (foundEntry != m_zones.end())
|
if (foundEntry != m_zones.end())
|
||||||
m_zones.erase(foundEntry);
|
m_zones.erase(foundEntry);
|
||||||
|
@ -25,7 +25,7 @@ void GameIW4::AddZone(Zone* zone)
|
|||||||
|
|
||||||
void GameIW4::RemoveZone(Zone* zone)
|
void GameIW4::RemoveZone(Zone* zone)
|
||||||
{
|
{
|
||||||
const auto foundEntry = std::find(m_zones.begin(), m_zones.end(), zone);
|
const auto foundEntry = std::ranges::find(m_zones, zone);
|
||||||
|
|
||||||
if (foundEntry != m_zones.end())
|
if (foundEntry != m_zones.end())
|
||||||
m_zones.erase(foundEntry);
|
m_zones.erase(foundEntry);
|
||||||
|
@ -25,7 +25,7 @@ void GameIW5::AddZone(Zone* zone)
|
|||||||
|
|
||||||
void GameIW5::RemoveZone(Zone* zone)
|
void GameIW5::RemoveZone(Zone* zone)
|
||||||
{
|
{
|
||||||
const auto foundEntry = std::find(m_zones.begin(), m_zones.end(), zone);
|
const auto foundEntry = std::ranges::find(m_zones, zone);
|
||||||
|
|
||||||
if (foundEntry != m_zones.end())
|
if (foundEntry != m_zones.end())
|
||||||
m_zones.erase(foundEntry);
|
m_zones.erase(foundEntry);
|
||||||
|
@ -25,7 +25,7 @@ void GameT5::AddZone(Zone* zone)
|
|||||||
|
|
||||||
void GameT5::RemoveZone(Zone* zone)
|
void GameT5::RemoveZone(Zone* zone)
|
||||||
{
|
{
|
||||||
const auto foundEntry = std::find(m_zones.begin(), m_zones.end(), zone);
|
const auto foundEntry = std::ranges::find(m_zones, zone);
|
||||||
|
|
||||||
if (foundEntry != m_zones.end())
|
if (foundEntry != m_zones.end())
|
||||||
m_zones.erase(foundEntry);
|
m_zones.erase(foundEntry);
|
||||||
|
@ -25,7 +25,7 @@ void GameT6::AddZone(Zone* zone)
|
|||||||
|
|
||||||
void GameT6::RemoveZone(Zone* zone)
|
void GameT6::RemoveZone(Zone* zone)
|
||||||
{
|
{
|
||||||
const auto foundEntry = std::find(m_zones.begin(), m_zones.end(), zone);
|
const auto foundEntry = std::ranges::find(m_zones, zone);
|
||||||
|
|
||||||
if (foundEntry != m_zones.end())
|
if (foundEntry != m_zones.end())
|
||||||
m_zones.erase(foundEntry);
|
m_zones.erase(foundEntry);
|
||||||
|
@ -37,8 +37,7 @@ namespace state_map
|
|||||||
|
|
||||||
for (auto& resultVar : entry.m_result_vars)
|
for (auto& resultVar : entry.m_result_vars)
|
||||||
{
|
{
|
||||||
const auto correspondingVar = std::find_if(layout.m_var_layout.m_vars.begin(),
|
const auto correspondingVar = std::ranges::find_if(layout.m_var_layout.m_vars,
|
||||||
layout.m_var_layout.m_vars.end(),
|
|
||||||
[&resultVar](const StateMapLayoutVar& var)
|
[&resultVar](const StateMapLayoutVar& var)
|
||||||
{
|
{
|
||||||
return var.m_name == resultVar;
|
return var.m_name == resultVar;
|
||||||
|
@ -39,7 +39,7 @@ bool ZoneCreator::CreateIgnoredAssetMap(const ZoneCreationContext& context, std:
|
|||||||
const auto foundAssetTypeEntry = m_asset_types_by_name.find(ignoreEntry.m_type);
|
const auto foundAssetTypeEntry = m_asset_types_by_name.find(ignoreEntry.m_type);
|
||||||
if (foundAssetTypeEntry == m_asset_types_by_name.end())
|
if (foundAssetTypeEntry == m_asset_types_by_name.end())
|
||||||
{
|
{
|
||||||
std::cout << "Unknown asset type \"" << ignoreEntry.m_type << "\" for ignore \"" << ignoreEntry.m_name << "\"" << std::endl;
|
std::cout << "Unknown asset type \"" << ignoreEntry.m_type << "\" for ignore \"" << ignoreEntry.m_name << "\"\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext&
|
|||||||
const auto foundAssetTypeEntry = m_asset_types_by_name.find(assetEntry.m_asset_type);
|
const auto foundAssetTypeEntry = m_asset_types_by_name.find(assetEntry.m_asset_type);
|
||||||
if (foundAssetTypeEntry == m_asset_types_by_name.end())
|
if (foundAssetTypeEntry == m_asset_types_by_name.end())
|
||||||
{
|
{
|
||||||
std::cout << "Unknown asset type \"" << assetEntry.m_asset_type << "\"" << std::endl;
|
std::cout << "Unknown asset type \"" << assetEntry.m_asset_type << "\"\n";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ bool ZoneCreator::CreateIgnoredAssetMap(const ZoneCreationContext& context, std:
|
|||||||
const auto foundAssetTypeEntry = m_asset_types_by_name.find(ignoreEntry.m_type);
|
const auto foundAssetTypeEntry = m_asset_types_by_name.find(ignoreEntry.m_type);
|
||||||
if (foundAssetTypeEntry == m_asset_types_by_name.end())
|
if (foundAssetTypeEntry == m_asset_types_by_name.end())
|
||||||
{
|
{
|
||||||
std::cout << "Unknown asset type \"" << ignoreEntry.m_type << "\" for ignore \"" << ignoreEntry.m_name << "\"" << std::endl;
|
std::cout << "Unknown asset type \"" << ignoreEntry.m_type << "\" for ignore \"" << ignoreEntry.m_name << "\"\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext&
|
|||||||
const auto foundAssetTypeEntry = m_asset_types_by_name.find(assetEntry.m_asset_type);
|
const auto foundAssetTypeEntry = m_asset_types_by_name.find(assetEntry.m_asset_type);
|
||||||
if (foundAssetTypeEntry == m_asset_types_by_name.end())
|
if (foundAssetTypeEntry == m_asset_types_by_name.end())
|
||||||
{
|
{
|
||||||
std::cout << "Unknown asset type \"" << assetEntry.m_asset_type << "\"" << std::endl;
|
std::cout << "Unknown asset type \"" << assetEntry.m_asset_type << "\"\n";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ bool ZoneCreator::CreateIgnoredAssetMap(const ZoneCreationContext& context, std:
|
|||||||
const auto foundAssetTypeEntry = m_asset_types_by_name.find(ignoreEntry.m_type);
|
const auto foundAssetTypeEntry = m_asset_types_by_name.find(ignoreEntry.m_type);
|
||||||
if (foundAssetTypeEntry == m_asset_types_by_name.end())
|
if (foundAssetTypeEntry == m_asset_types_by_name.end())
|
||||||
{
|
{
|
||||||
std::cout << "Unknown asset type \"" << ignoreEntry.m_type << "\" for ignore \"" << ignoreEntry.m_name << "\"" << std::endl;
|
std::cout << "Unknown asset type \"" << ignoreEntry.m_type << "\" for ignore \"" << ignoreEntry.m_name << "\"\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext&
|
|||||||
const auto foundAssetTypeEntry = m_asset_types_by_name.find(assetEntry.m_asset_type);
|
const auto foundAssetTypeEntry = m_asset_types_by_name.find(assetEntry.m_asset_type);
|
||||||
if (foundAssetTypeEntry == m_asset_types_by_name.end())
|
if (foundAssetTypeEntry == m_asset_types_by_name.end())
|
||||||
{
|
{
|
||||||
std::cout << "Unknown asset type \"" << assetEntry.m_asset_type << "\"" << std::endl;
|
std::cout << "Unknown asset type \"" << assetEntry.m_asset_type << "\"\n";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ bool ZoneCreator::CreateIgnoredAssetMap(const ZoneCreationContext& context, std:
|
|||||||
const auto foundAssetTypeEntry = m_asset_types_by_name.find(ignoreEntry.m_type);
|
const auto foundAssetTypeEntry = m_asset_types_by_name.find(ignoreEntry.m_type);
|
||||||
if (foundAssetTypeEntry == m_asset_types_by_name.end())
|
if (foundAssetTypeEntry == m_asset_types_by_name.end())
|
||||||
{
|
{
|
||||||
std::cout << "Unknown asset type \"" << ignoreEntry.m_type << "\" for ignore \"" << ignoreEntry.m_name << "\"" << std::endl;
|
std::cout << "Unknown asset type \"" << ignoreEntry.m_type << "\" for ignore \"" << ignoreEntry.m_name << "\"\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext&
|
|||||||
const auto foundAssetTypeEntry = m_asset_types_by_name.find(assetEntry.m_asset_type);
|
const auto foundAssetTypeEntry = m_asset_types_by_name.find(assetEntry.m_asset_type);
|
||||||
if (foundAssetTypeEntry == m_asset_types_by_name.end())
|
if (foundAssetTypeEntry == m_asset_types_by_name.end())
|
||||||
{
|
{
|
||||||
std::cout << "Unknown asset type \"" << assetEntry.m_asset_type << "\"" << std::endl;
|
std::cout << "Unknown asset type \"" << assetEntry.m_asset_type << "\"\n";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ bool ZoneCreator::CreateIgnoredAssetMap(const ZoneCreationContext& context, std:
|
|||||||
const auto foundAssetTypeEntry = m_asset_types_by_name.find(ignoreEntry.m_type);
|
const auto foundAssetTypeEntry = m_asset_types_by_name.find(ignoreEntry.m_type);
|
||||||
if (foundAssetTypeEntry == m_asset_types_by_name.end())
|
if (foundAssetTypeEntry == m_asset_types_by_name.end())
|
||||||
{
|
{
|
||||||
std::cout << "Unknown asset type \"" << ignoreEntry.m_type << "\" for ignore \"" << ignoreEntry.m_name << "\"" << std::endl;
|
std::cout << "Unknown asset type \"" << ignoreEntry.m_type << "\" for ignore \"" << ignoreEntry.m_name << "\"\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ void ZoneCreator::HandleMetadata(Zone* zone, const ZoneCreationContext& context)
|
|||||||
|
|
||||||
if (endPtr != &strValue[strValue.size()])
|
if (endPtr != &strValue[strValue.size()])
|
||||||
{
|
{
|
||||||
std::cout << "Could not parse metadata key \"" << metaData->m_key << "\" as hash" << std::endl;
|
std::cout << "Could not parse metadata key \"" << metaData->m_key << "\" as hash\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,7 +135,7 @@ std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext&
|
|||||||
const auto foundAssetTypeEntry = m_asset_types_by_name.find(assetEntry.m_asset_type);
|
const auto foundAssetTypeEntry = m_asset_types_by_name.find(assetEntry.m_asset_type);
|
||||||
if (foundAssetTypeEntry == m_asset_types_by_name.end())
|
if (foundAssetTypeEntry == m_asset_types_by_name.end())
|
||||||
{
|
{
|
||||||
std::cout << "Unknown asset type \"" << assetEntry.m_asset_type << "\"" << std::endl;
|
std::cout << "Unknown asset type \"" << assetEntry.m_asset_type << "\"\n";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ class LinkerImpl final : public Linker
|
|||||||
const auto definitionStream = sourceSearchPath->Open(definitionFileName);
|
const auto definitionStream = sourceSearchPath->Open(definitionFileName);
|
||||||
if (!definitionStream.IsOpen())
|
if (!definitionStream.IsOpen())
|
||||||
{
|
{
|
||||||
std::cout << "Could not find zone definition file for project \"" << source << "\"." << std::endl;
|
std::cout << "Could not find zone definition file for project \"" << source << "\".\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ class LinkerImpl final : public Linker
|
|||||||
|
|
||||||
if (!includeDefinition)
|
if (!includeDefinition)
|
||||||
{
|
{
|
||||||
std::cout << "Failed to read zone definition file for project \"" << source << "\"." << std::endl;
|
std::cout << "Failed to read zone definition file for project \"" << source << "\".\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ class LinkerImpl final : public Linker
|
|||||||
{
|
{
|
||||||
if (name != i->second->m_value)
|
if (name != i->second->m_value)
|
||||||
{
|
{
|
||||||
std::cout << "Conflicting names in target \"" << targetName << "\": " << name << " != " << i->second << std::endl;
|
std::cout << "Conflicting names in target \"" << targetName << "\": " << name << " != " << i->second << "\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -203,7 +203,7 @@ class LinkerImpl final : public Linker
|
|||||||
const auto definitionStream = sourceSearchPath->Open(definitionFileName);
|
const auto definitionStream = sourceSearchPath->Open(definitionFileName);
|
||||||
if (!definitionStream.IsOpen())
|
if (!definitionStream.IsOpen())
|
||||||
{
|
{
|
||||||
std::cout << "Could not find zone definition file for target \"" << targetName << "\"." << std::endl;
|
std::cout << "Could not find zone definition file for target \"" << targetName << "\".\n";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +213,7 @@ class LinkerImpl final : public Linker
|
|||||||
|
|
||||||
if (!zoneDefinition)
|
if (!zoneDefinition)
|
||||||
{
|
{
|
||||||
std::cout << "Failed to read zone definition file for target \"" << targetName << "\"." << std::endl;
|
std::cout << "Failed to read zone definition file for target \"" << targetName << "\".\n";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ class LinkerImpl final : public Linker
|
|||||||
std::vector<AssetListEntry> assetList;
|
std::vector<AssetListEntry> assetList;
|
||||||
if (!ReadAssetList(ignore, context.m_ignored_assets, sourceSearchPath))
|
if (!ReadAssetList(ignore, context.m_ignored_assets, sourceSearchPath))
|
||||||
{
|
{
|
||||||
std::cout << "Failed to read asset listing for ignoring assets of project \"" << ignore << "\"." << std::endl;
|
std::cout << "Failed to read asset listing for ignoring assets of project \"" << ignore << "\".\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -292,7 +292,7 @@ class LinkerImpl final : public Linker
|
|||||||
if (projectType != parsedProjectType)
|
if (projectType != parsedProjectType)
|
||||||
{
|
{
|
||||||
std::cerr << "Conflicting types in target \"" << targetName << "\": " << PROJECT_TYPE_NAMES[static_cast<unsigned>(projectType)]
|
std::cerr << "Conflicting types in target \"" << targetName << "\": " << PROJECT_TYPE_NAMES[static_cast<unsigned>(projectType)]
|
||||||
<< " != " << PROJECT_TYPE_NAMES[static_cast<unsigned>(parsedProjectType)] << std::endl;
|
<< " != " << PROJECT_TYPE_NAMES[static_cast<unsigned>(parsedProjectType)] << "\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -324,7 +324,7 @@ class LinkerImpl final : public Linker
|
|||||||
{
|
{
|
||||||
if (gameName != i->second->m_value)
|
if (gameName != i->second->m_value)
|
||||||
{
|
{
|
||||||
std::cout << "Conflicting game names in target \"" << targetName << "\": " << gameName << " != " << i->second << std::endl;
|
std::cout << "Conflicting game names in target \"" << targetName << "\": " << gameName << " != " << i->second << "\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -332,7 +332,7 @@ class LinkerImpl final : public Linker
|
|||||||
|
|
||||||
if (firstGameEntry)
|
if (firstGameEntry)
|
||||||
{
|
{
|
||||||
std::cout << "No game name was specified for target \"" << targetName << "\"" << std::endl;
|
std::cout << "No game name was specified for target \"" << targetName << "\"\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,7 +347,7 @@ class LinkerImpl final : public Linker
|
|||||||
const auto gdtFile = gdtSearchPath->Open(i->second->m_value + ".gdt");
|
const auto gdtFile = gdtSearchPath->Open(i->second->m_value + ".gdt");
|
||||||
if (!gdtFile.IsOpen())
|
if (!gdtFile.IsOpen())
|
||||||
{
|
{
|
||||||
std::cout << "Failed to open file for gdt \"" << i->second->m_value << "\"" << std::endl;
|
std::cout << "Failed to open file for gdt \"" << i->second->m_value << "\"\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,7 +355,7 @@ class LinkerImpl final : public Linker
|
|||||||
auto gdt = std::make_unique<Gdt>();
|
auto gdt = std::make_unique<Gdt>();
|
||||||
if (!gdtReader.Read(*gdt))
|
if (!gdtReader.Read(*gdt))
|
||||||
{
|
{
|
||||||
std::cout << "Failed to read gdt file \"" << i->second << "\"" << std::endl;
|
std::cout << "Failed to read gdt file \"" << i->second << "\"\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,7 +402,7 @@ class LinkerImpl final : public Linker
|
|||||||
|
|
||||||
if (!ZoneWriting::WriteZone(stream, zone))
|
if (!ZoneWriting::WriteZone(stream, zone))
|
||||||
{
|
{
|
||||||
std::cout << "Writing zone failed." << std::endl;
|
std::cout << "Writing zone failed.\n";
|
||||||
stream.close();
|
stream.close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -454,7 +454,7 @@ class LinkerImpl final : public Linker
|
|||||||
|
|
||||||
if (!ipakWriter->Write())
|
if (!ipakWriter->Write())
|
||||||
{
|
{
|
||||||
std::cout << "Writing ipak failed." << std::endl;
|
std::cout << "Writing ipak failed.\n";
|
||||||
stream.close();
|
stream.close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -467,8 +467,7 @@ class LinkerImpl final : public Linker
|
|||||||
|
|
||||||
bool BuildReferencedTargets(const std::string& projectName, const std::string& targetName, const ZoneDefinition& zoneDefinition)
|
bool BuildReferencedTargets(const std::string& projectName, const std::string& targetName, const ZoneDefinition& zoneDefinition)
|
||||||
{
|
{
|
||||||
return std::all_of(zoneDefinition.m_targets_to_build.begin(),
|
return std::ranges::all_of(zoneDefinition.m_targets_to_build,
|
||||||
zoneDefinition.m_targets_to_build.end(),
|
|
||||||
[this, &projectName, &targetName](const std::string& buildTargetName)
|
[this, &projectName, &targetName](const std::string& buildTargetName)
|
||||||
{
|
{
|
||||||
if (buildTargetName == targetName)
|
if (buildTargetName == targetName)
|
||||||
|
@ -45,12 +45,12 @@ SearchPaths LinkerSearchPaths::GetAssetSearchPathsForProject(const std::string&
|
|||||||
if (!fs::is_directory(absolutePath))
|
if (!fs::is_directory(absolutePath))
|
||||||
{
|
{
|
||||||
if (m_args.m_verbose)
|
if (m_args.m_verbose)
|
||||||
std::cout << "Adding asset search path (Not found): " << absolutePath.string() << std::endl;
|
std::cout << "Adding asset search path (Not found): " << absolutePath.string() << "\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_args.m_verbose)
|
if (m_args.m_verbose)
|
||||||
std::cout << "Adding asset search path: " << absolutePath.string() << std::endl;
|
std::cout << "Adding asset search path: " << absolutePath.string() << "\n";
|
||||||
|
|
||||||
auto searchPath = std::make_unique<SearchPathFilesystem>(searchPathStr);
|
auto searchPath = std::make_unique<SearchPathFilesystem>(searchPathStr);
|
||||||
LoadSearchPath(searchPath.get());
|
LoadSearchPath(searchPath.get());
|
||||||
@ -79,12 +79,12 @@ SearchPaths LinkerSearchPaths::GetGdtSearchPathsForProject(const std::string& ga
|
|||||||
if (!fs::is_directory(absolutePath))
|
if (!fs::is_directory(absolutePath))
|
||||||
{
|
{
|
||||||
if (m_args.m_verbose)
|
if (m_args.m_verbose)
|
||||||
std::cout << "Adding gdt search path (Not found): " << absolutePath.string() << std::endl;
|
std::cout << "Adding gdt search path (Not found): " << absolutePath.string() << "\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_args.m_verbose)
|
if (m_args.m_verbose)
|
||||||
std::cout << "Adding gdt search path: " << absolutePath.string() << std::endl;
|
std::cout << "Adding gdt search path: " << absolutePath.string() << "\n";
|
||||||
|
|
||||||
searchPathsForProject.CommitSearchPath(std::make_unique<SearchPathFilesystem>(searchPathStr));
|
searchPathsForProject.CommitSearchPath(std::make_unique<SearchPathFilesystem>(searchPathStr));
|
||||||
}
|
}
|
||||||
@ -105,12 +105,12 @@ SearchPaths LinkerSearchPaths::GetSourceSearchPathsForProject(const std::string&
|
|||||||
if (!fs::is_directory(absolutePath))
|
if (!fs::is_directory(absolutePath))
|
||||||
{
|
{
|
||||||
if (m_args.m_verbose)
|
if (m_args.m_verbose)
|
||||||
std::cout << "Adding source search path (Not found): " << absolutePath.string() << std::endl;
|
std::cout << "Adding source search path (Not found): " << absolutePath.string() << "\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_args.m_verbose)
|
if (m_args.m_verbose)
|
||||||
std::cout << "Adding source search path: " << absolutePath.string() << std::endl;
|
std::cout << "Adding source search path: " << absolutePath.string() << "\n";
|
||||||
|
|
||||||
searchPathsForProject.CommitSearchPath(std::make_unique<SearchPathFilesystem>(searchPathStr));
|
searchPathsForProject.CommitSearchPath(std::make_unique<SearchPathFilesystem>(searchPathStr));
|
||||||
}
|
}
|
||||||
@ -129,12 +129,12 @@ bool LinkerSearchPaths::BuildProjectIndependentSearchPaths()
|
|||||||
if (!fs::is_directory(absolutePath))
|
if (!fs::is_directory(absolutePath))
|
||||||
{
|
{
|
||||||
if (m_args.m_verbose)
|
if (m_args.m_verbose)
|
||||||
std::cout << "Adding asset search path (Not found): " << absolutePath.string() << std::endl;
|
std::cout << "Adding asset search path (Not found): " << absolutePath.string() << "\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_args.m_verbose)
|
if (m_args.m_verbose)
|
||||||
std::cout << "Adding asset search path: " << absolutePath.string() << std::endl;
|
std::cout << "Adding asset search path: " << absolutePath.string() << "\n";
|
||||||
|
|
||||||
auto searchPath = std::make_unique<SearchPathFilesystem>(absolutePath.string());
|
auto searchPath = std::make_unique<SearchPathFilesystem>(absolutePath.string());
|
||||||
LoadSearchPath(searchPath.get());
|
LoadSearchPath(searchPath.get());
|
||||||
@ -148,12 +148,12 @@ bool LinkerSearchPaths::BuildProjectIndependentSearchPaths()
|
|||||||
if (!fs::is_directory(absolutePath))
|
if (!fs::is_directory(absolutePath))
|
||||||
{
|
{
|
||||||
if (m_args.m_verbose)
|
if (m_args.m_verbose)
|
||||||
std::cout << "Loading gdt search path (Not found): " << absolutePath.string() << std::endl;
|
std::cout << "Loading gdt search path (Not found): " << absolutePath.string() << "\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_args.m_verbose)
|
if (m_args.m_verbose)
|
||||||
std::cout << "Adding gdt search path: " << absolutePath.string() << std::endl;
|
std::cout << "Adding gdt search path: " << absolutePath.string() << "\n";
|
||||||
|
|
||||||
m_gdt_search_paths.CommitSearchPath(std::make_unique<SearchPathFilesystem>(absolutePath.string()));
|
m_gdt_search_paths.CommitSearchPath(std::make_unique<SearchPathFilesystem>(absolutePath.string()));
|
||||||
}
|
}
|
||||||
@ -165,12 +165,12 @@ bool LinkerSearchPaths::BuildProjectIndependentSearchPaths()
|
|||||||
if (!fs::is_directory(absolutePath))
|
if (!fs::is_directory(absolutePath))
|
||||||
{
|
{
|
||||||
if (m_args.m_verbose)
|
if (m_args.m_verbose)
|
||||||
std::cout << "Loading source search path (Not found): " << absolutePath.string() << std::endl;
|
std::cout << "Loading source search path (Not found): " << absolutePath.string() << "\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_args.m_verbose)
|
if (m_args.m_verbose)
|
||||||
std::cout << "Adding source search path: " << absolutePath.string() << std::endl;
|
std::cout << "Adding source search path: " << absolutePath.string() << "\n";
|
||||||
|
|
||||||
m_source_search_paths.CommitSearchPath(std::make_unique<SearchPathFilesystem>(absolutePath.string()));
|
m_source_search_paths.CommitSearchPath(std::make_unique<SearchPathFilesystem>(absolutePath.string()));
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,9 @@ std::string ParsedCsvRow::GetValue(const std::string& header, const bool require
|
|||||||
if (this->headers.find(header) == this->headers.end())
|
if (this->headers.find(header) == this->headers.end())
|
||||||
{
|
{
|
||||||
if (required)
|
if (required)
|
||||||
std::cerr << "ERROR: Required column \"" << header << "\" was not found" << std::endl;
|
std::cerr << "ERROR: Required column \"" << header << "\" was not found\n";
|
||||||
else
|
else
|
||||||
std::cerr << "WARNING: Expected column \"" << header << "\" was not found" << std::endl;
|
std::cerr << "WARNING: Expected column \"" << header << "\" was not found\n";
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@ -21,7 +21,7 @@ std::string ParsedCsvRow::GetValue(const std::string& header, const bool require
|
|||||||
auto& value = this->values.at(this->headers[header]);
|
auto& value = this->values.at(this->headers[header]);
|
||||||
if (required && value.empty())
|
if (required && value.empty())
|
||||||
{
|
{
|
||||||
std::cerr << "ERROR: Required column \"" << header << "\" does not have a value" << std::endl;
|
std::cerr << "ERROR: Required column \"" << header << "\" does not have a value\n";
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,8 +60,7 @@ uint32_t CommonStructuredDataEnum::CalculateChecksum(const uint32_t initialValue
|
|||||||
|
|
||||||
void CommonStructuredDataEnum::SortEntriesByOffset()
|
void CommonStructuredDataEnum::SortEntriesByOffset()
|
||||||
{
|
{
|
||||||
std::sort(m_entries.begin(),
|
std::ranges::sort(m_entries,
|
||||||
m_entries.end(),
|
|
||||||
[](const CommonStructuredDataEnumEntry& e1, const CommonStructuredDataEnumEntry& e2)
|
[](const CommonStructuredDataEnumEntry& e1, const CommonStructuredDataEnumEntry& e2)
|
||||||
{
|
{
|
||||||
return e1.m_value < e2.m_value;
|
return e1.m_value < e2.m_value;
|
||||||
@ -70,8 +69,7 @@ void CommonStructuredDataEnum::SortEntriesByOffset()
|
|||||||
|
|
||||||
void CommonStructuredDataEnum::SortEntriesByName()
|
void CommonStructuredDataEnum::SortEntriesByName()
|
||||||
{
|
{
|
||||||
std::sort(m_entries.begin(),
|
std::ranges::sort(m_entries,
|
||||||
m_entries.end(),
|
|
||||||
[](const CommonStructuredDataEnumEntry& e1, const CommonStructuredDataEnumEntry& e2)
|
[](const CommonStructuredDataEnumEntry& e1, const CommonStructuredDataEnumEntry& e2)
|
||||||
{
|
{
|
||||||
return e1.m_name < e2.m_name;
|
return e1.m_name < e2.m_name;
|
||||||
|
@ -118,8 +118,7 @@ uint32_t CommonStructuredDataStruct::CalculateChecksum(const CommonStructuredDat
|
|||||||
|
|
||||||
void CommonStructuredDataStruct::SortPropertiesByOffset()
|
void CommonStructuredDataStruct::SortPropertiesByOffset()
|
||||||
{
|
{
|
||||||
std::sort(m_properties.begin(),
|
std::ranges::sort(m_properties,
|
||||||
m_properties.end(),
|
|
||||||
[](const CommonStructuredDataStructProperty& e1, const CommonStructuredDataStructProperty& e2)
|
[](const CommonStructuredDataStructProperty& e1, const CommonStructuredDataStructProperty& e2)
|
||||||
{
|
{
|
||||||
return e1.m_offset_in_bits < e2.m_offset_in_bits;
|
return e1.m_offset_in_bits < e2.m_offset_in_bits;
|
||||||
@ -128,8 +127,7 @@ void CommonStructuredDataStruct::SortPropertiesByOffset()
|
|||||||
|
|
||||||
void CommonStructuredDataStruct::SortPropertiesByName()
|
void CommonStructuredDataStruct::SortPropertiesByName()
|
||||||
{
|
{
|
||||||
std::sort(m_properties.begin(),
|
std::ranges::sort(m_properties,
|
||||||
m_properties.end(),
|
|
||||||
[](const CommonStructuredDataStructProperty& e1, const CommonStructuredDataStructProperty& e2)
|
[](const CommonStructuredDataStructProperty& e1, const CommonStructuredDataStructProperty& e2)
|
||||||
{
|
{
|
||||||
return e1.m_name < e2.m_name;
|
return e1.m_name < e2.m_name;
|
||||||
|
@ -54,7 +54,7 @@ bool AssetLoaderGfxImage::LoadFromRaw(
|
|||||||
|
|
||||||
if (texture == nullptr)
|
if (texture == nullptr)
|
||||||
{
|
{
|
||||||
std::cout << "Failed to load dds file for image asset \"" << assetName << "\"" << std::endl;
|
std::cout << "Failed to load dds file for image asset \"" << assetName << "\"\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -844,12 +844,11 @@ namespace IW4
|
|||||||
if (techsetDefinition->GetTechniqueByIndex(i, techniqueName))
|
if (techsetDefinition->GetTechniqueByIndex(i, techniqueName))
|
||||||
{
|
{
|
||||||
const auto stateBitsForTechnique = GetStateBitsForTechnique(techniqueName);
|
const auto stateBitsForTechnique = GetStateBitsForTechnique(techniqueName);
|
||||||
const auto foundStateBits =
|
const auto foundStateBits = std::ranges::find_if(m_state_bits,
|
||||||
std::find_if(m_state_bits.begin(),
|
|
||||||
m_state_bits.end(),
|
|
||||||
[stateBitsForTechnique](const GfxStateBits& s1)
|
[stateBitsForTechnique](const GfxStateBits& s1)
|
||||||
{
|
{
|
||||||
return s1.loadBits[0] == stateBitsForTechnique.loadBits[0] && s1.loadBits[1] == stateBitsForTechnique.loadBits[1];
|
return s1.loadBits[0] == stateBitsForTechnique.loadBits[0]
|
||||||
|
&& s1.loadBits[1] == stateBitsForTechnique.loadBits[1];
|
||||||
});
|
});
|
||||||
|
|
||||||
if (foundStateBits != m_state_bits.end())
|
if (foundStateBits != m_state_bits.end())
|
||||||
|
@ -63,10 +63,10 @@ bool AssetLoaderPhysPreset::LoadFromInfoString(
|
|||||||
const auto presetInfo = std::make_unique<PhysPresetInfo>();
|
const auto presetInfo = std::make_unique<PhysPresetInfo>();
|
||||||
memset(presetInfo.get(), 0, sizeof(PhysPresetInfo));
|
memset(presetInfo.get(), 0, sizeof(PhysPresetInfo));
|
||||||
InfoStringToPhysPresetConverter converter(
|
InfoStringToPhysPresetConverter converter(
|
||||||
infoString, presetInfo.get(), zone->m_script_strings, memory, manager, phys_preset_fields, std::extent<decltype(phys_preset_fields)>::value);
|
infoString, presetInfo.get(), zone->m_script_strings, memory, manager, phys_preset_fields, std::extent_v<decltype(phys_preset_fields)>);
|
||||||
if (!converter.Convert())
|
if (!converter.Convert())
|
||||||
{
|
{
|
||||||
std::cout << "Failed to parse phys preset: \"" << assetName << "\"" << std::endl;
|
std::cout << "Failed to parse phys preset: \"" << assetName << "\"\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ bool AssetLoaderPhysPreset::LoadFromGdt(
|
|||||||
InfoString infoString;
|
InfoString infoString;
|
||||||
if (!infoString.FromGdtProperties(*gdtEntry))
|
if (!infoString.FromGdtProperties(*gdtEntry))
|
||||||
{
|
{
|
||||||
std::cout << "Failed to read phys preset gdt entry: \"" << assetName << "\"" << std::endl;
|
std::cout << "Failed to read phys preset gdt entry: \"" << assetName << "\"\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ bool AssetLoaderPhysPreset::LoadFromRaw(
|
|||||||
InfoString infoString;
|
InfoString infoString;
|
||||||
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_PHYS_PRESET, *file.m_stream))
|
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_PHYS_PRESET, *file.m_stream))
|
||||||
{
|
{
|
||||||
std::cout << "Failed to read phys preset raw file: \"" << fileName << "\"" << std::endl;
|
std::cout << "Failed to read phys preset raw file: \"" << fileName << "\"\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -403,8 +403,7 @@ namespace IW4
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Sort args by their update frequency
|
// Sort args by their update frequency
|
||||||
std::sort(pass.m_arguments.begin(),
|
std::ranges::sort(pass.m_arguments,
|
||||||
pass.m_arguments.end(),
|
|
||||||
[](const PassShaderArgument& arg1, const PassShaderArgument& arg2)
|
[](const PassShaderArgument& arg1, const PassShaderArgument& arg2)
|
||||||
{
|
{
|
||||||
if (arg1.m_update_frequency != arg2.m_update_frequency)
|
if (arg1.m_update_frequency != arg2.m_update_frequency)
|
||||||
@ -600,8 +599,7 @@ namespace IW4
|
|||||||
size_t& registerOffset,
|
size_t& registerOffset,
|
||||||
std::string& errorMessage) const
|
std::string& errorMessage) const
|
||||||
{
|
{
|
||||||
const auto matchingShaderConstant = std::find_if(shaderInfo.m_constants.begin(),
|
const auto matchingShaderConstant = std::ranges::find_if(shaderInfo.m_constants,
|
||||||
shaderInfo.m_constants.end(),
|
|
||||||
[argument](const d3d9::ShaderConstant& constant)
|
[argument](const d3d9::ShaderConstant& constant)
|
||||||
{
|
{
|
||||||
return constant.m_name == argument.m_argument_name;
|
return constant.m_name == argument.m_argument_name;
|
||||||
@ -1013,14 +1011,14 @@ namespace IW4
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto foundDestination = std::find(std::begin(materialStreamDestinationNames), std::end(materialStreamDestinationNames), destination);
|
const auto foundDestination = std::ranges::find(materialStreamDestinationNames, destination);
|
||||||
if (foundDestination == std::end(materialStreamDestinationNames))
|
if (foundDestination == std::end(materialStreamDestinationNames))
|
||||||
{
|
{
|
||||||
errorMessage = "Unknown stream destination";
|
errorMessage = "Unknown stream destination";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto foundSource = std::find(std::begin(materialStreamSourceNames), std::end(materialStreamSourceNames), source);
|
const auto foundSource = std::ranges::find(materialStreamSourceNames, source);
|
||||||
if (foundSource == std::end(materialStreamSourceNames))
|
if (foundSource == std::end(materialStreamSourceNames))
|
||||||
{
|
{
|
||||||
errorMessage = "Unknown stream source";
|
errorMessage = "Unknown stream source";
|
||||||
@ -1187,7 +1185,7 @@ namespace IW4
|
|||||||
assert(arg.m_arg.type == MTL_ARG_CODE_PIXEL_SAMPLER);
|
assert(arg.m_arg.type == MTL_ARG_CODE_PIXEL_SAMPLER);
|
||||||
if (arg.m_arg.type == MTL_ARG_CODE_PIXEL_SAMPLER)
|
if (arg.m_arg.type == MTL_ARG_CODE_PIXEL_SAMPLER)
|
||||||
{
|
{
|
||||||
const auto customSampler = std::find(std::begin(g_customSamplerSrc), std::end(g_customSamplerSrc), arg.m_arg.u.codeSampler);
|
const auto customSampler = std::ranges::find(g_customSamplerSrc, arg.m_arg.u.codeSampler);
|
||||||
assert(customSampler != std::end(g_customSamplerSrc));
|
assert(customSampler != std::end(g_customSamplerSrc));
|
||||||
if (customSampler != std::end(g_customSamplerSrc))
|
if (customSampler != std::end(g_customSamplerSrc))
|
||||||
{
|
{
|
||||||
|
@ -64,16 +64,14 @@ bool AssetLoaderVertexDecl::LoadFromRaw(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto foundSourceAbbreviation =
|
const auto foundSourceAbbreviation = std::ranges::find(materialStreamSourceAbbreviation, sourceAbbreviation);
|
||||||
std::find(std::begin(materialStreamSourceAbbreviation), std::end(materialStreamSourceAbbreviation), sourceAbbreviation);
|
|
||||||
if (foundSourceAbbreviation == std::end(materialStreamSourceAbbreviation))
|
if (foundSourceAbbreviation == std::end(materialStreamSourceAbbreviation))
|
||||||
{
|
{
|
||||||
std::cout << "Unknown vertex decl source abbreviation: " << sourceAbbreviation << "\n";
|
std::cout << "Unknown vertex decl source abbreviation: " << sourceAbbreviation << "\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto foundDestinationAbbreviation =
|
const auto foundDestinationAbbreviation = std::ranges::find(materialStreamDestinationAbbreviation, destinationAbbreviation);
|
||||||
std::find(std::begin(materialStreamDestinationAbbreviation), std::end(materialStreamDestinationAbbreviation), destinationAbbreviation);
|
|
||||||
if (foundDestinationAbbreviation == std::end(materialStreamDestinationAbbreviation))
|
if (foundDestinationAbbreviation == std::end(materialStreamDestinationAbbreviation))
|
||||||
{
|
{
|
||||||
std::cout << "Unknown vertex decl destination abbreviation: " << destinationAbbreviation << "\n";
|
std::cout << "Unknown vertex decl destination abbreviation: " << destinationAbbreviation << "\n";
|
||||||
|
@ -62,7 +62,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
|
|||||||
|
|
||||||
if (fx == nullptr)
|
if (fx == nullptr)
|
||||||
{
|
{
|
||||||
std::cout << "Failed to load fx asset \"" << value << "\"" << std::endl;
|
std::cout << "Failed to load fx asset \"" << value << "\"\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
|
|||||||
|
|
||||||
if (xmodel == nullptr)
|
if (xmodel == nullptr)
|
||||||
{
|
{
|
||||||
std::cout << "Failed to load xmodel asset \"" << value << "\"" << std::endl;
|
std::cout << "Failed to load xmodel asset \"" << value << "\"\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
|
|||||||
|
|
||||||
if (material == nullptr)
|
if (material == nullptr)
|
||||||
{
|
{
|
||||||
std::cout << "Failed to load material asset \"" << value << "\"" << std::endl;
|
std::cout << "Failed to load material asset \"" << value << "\"\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
|
|||||||
|
|
||||||
if (tracer == nullptr)
|
if (tracer == nullptr)
|
||||||
{
|
{
|
||||||
std::cout << "Failed to load tracer asset \"" << value << "\"" << std::endl;
|
std::cout << "Failed to load tracer asset \"" << value << "\"\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
|
|||||||
|
|
||||||
if (endPtr != &value[value.size()])
|
if (endPtr != &value[value.size()])
|
||||||
{
|
{
|
||||||
std::cout << "Failed to parse value \"" << value << "\" as mph" << std::endl;
|
std::cout << "Failed to parse value \"" << value << "\" as mph\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
|
|||||||
|
|
||||||
if (collmap == nullptr)
|
if (collmap == nullptr)
|
||||||
{
|
{
|
||||||
std::cout << "Failed to load collmap asset \"" << value << "\"" << std::endl;
|
std::cout << "Failed to load collmap asset \"" << value << "\"\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
|
|||||||
|
|
||||||
if (sound == nullptr)
|
if (sound == nullptr)
|
||||||
{
|
{
|
||||||
std::cout << "Failed to load sound asset \"" << value << "\"" << std::endl;
|
std::cout << "Failed to load sound asset \"" << value << "\"\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ bool AssetLoaderRawFile::LoadFromRaw(
|
|||||||
|
|
||||||
if (ret != Z_STREAM_END)
|
if (ret != Z_STREAM_END)
|
||||||
{
|
{
|
||||||
std::cout << "Deflate failed for loading rawfile \"" << assetName << "\"" << std::endl;
|
std::cout << "Deflate failed for loading rawfile \"" << assetName << "\"\n";
|
||||||
deflateEnd(&zs);
|
deflateEnd(&zs);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -55,13 +55,13 @@ bool AssetLoaderScriptFile::LoadFromRaw(
|
|||||||
|
|
||||||
if (scriptFile->compressedLen <= 0 || scriptFile->bytecodeLen <= 0)
|
if (scriptFile->compressedLen <= 0 || scriptFile->bytecodeLen <= 0)
|
||||||
{
|
{
|
||||||
std::cerr << "Error: Invalid length of the buffers in " << assetName << " specified" << std::endl;
|
std::cerr << "Error: Invalid length of the buffers in " << assetName << " specified\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset + (scriptFile->compressedLen + scriptFile->bytecodeLen) > file.m_length)
|
if (offset + (scriptFile->compressedLen + scriptFile->bytecodeLen) > file.m_length)
|
||||||
{
|
{
|
||||||
std::cerr << "Error: Specified length in " << assetName << " GSC BIN structure exceeds the actual file size" << std::endl;
|
std::cerr << "Error: Specified length in " << assetName << " GSC BIN structure exceeds the actual file size\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ bool AssetLoaderRawFile::LoadGsc(
|
|||||||
|
|
||||||
if (ret != Z_STREAM_END)
|
if (ret != Z_STREAM_END)
|
||||||
{
|
{
|
||||||
std::cout << "Deflate failed for loading gsc file \"" << assetName << "\"" << std::endl;
|
std::cout << "Deflate failed for loading gsc file \"" << assetName << "\"\n";
|
||||||
deflateEnd(&zs);
|
deflateEnd(&zs);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -48,8 +48,7 @@ void AssetLoaderFontIcon::PreprocessRow(std::vector<std::string>& row)
|
|||||||
|
|
||||||
bool AssetLoaderFontIcon::RowIsEmpty(const std::vector<std::string>& row)
|
bool AssetLoaderFontIcon::RowIsEmpty(const std::vector<std::string>& row)
|
||||||
{
|
{
|
||||||
return std::all_of(row.begin(),
|
return std::ranges::all_of(row,
|
||||||
row.end(),
|
|
||||||
[](const std::string& cell)
|
[](const std::string& cell)
|
||||||
{
|
{
|
||||||
return cell.empty();
|
return cell.empty();
|
||||||
@ -102,26 +101,26 @@ bool AssetLoaderFontIcon::ReadIconRow(const std::vector<std::string>& row,
|
|||||||
{
|
{
|
||||||
if (row.size() < COL_COUNT_ICON)
|
if (row.size() < COL_COUNT_ICON)
|
||||||
{
|
{
|
||||||
std::cout << ErrorPrefix(assetName, rowIndex) << "Column count lower than min column count for entries (" << COL_COUNT_ICON << ")" << std::endl;
|
std::cout << ErrorPrefix(assetName, rowIndex) << "Column count lower than min column count for entries (" << COL_COUNT_ICON << ")\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ParseInt(icon.fontIconSize, row[ROW_ICON_SIZE]))
|
if (!ParseInt(icon.fontIconSize, row[ROW_ICON_SIZE]))
|
||||||
{
|
{
|
||||||
std::cout << ErrorPrefix(assetName, rowIndex) << "Failed to parse size" << std::endl;
|
std::cout << ErrorPrefix(assetName, rowIndex) << "Failed to parse size\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ParseFloat(icon.xScale, row[ROW_ICON_XSCALE]) || !ParseFloat(icon.yScale, row[ROW_ICON_YSCALE]))
|
if (!ParseFloat(icon.xScale, row[ROW_ICON_XSCALE]) || !ParseFloat(icon.yScale, row[ROW_ICON_YSCALE]))
|
||||||
{
|
{
|
||||||
std::cout << ErrorPrefix(assetName, rowIndex) << "Failed to parse scale" << std::endl;
|
std::cout << ErrorPrefix(assetName, rowIndex) << "Failed to parse scale\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* materialDependency = manager->LoadDependency(ASSET_TYPE_MATERIAL, row[ROW_ICON_MATERIAL]);
|
auto* materialDependency = manager->LoadDependency(ASSET_TYPE_MATERIAL, row[ROW_ICON_MATERIAL]);
|
||||||
if (materialDependency == nullptr)
|
if (materialDependency == nullptr)
|
||||||
{
|
{
|
||||||
std::cout << ErrorPrefix(assetName, rowIndex) << "Failed to load material \"" << row[ROW_ICON_MATERIAL] << "\"" << std::endl;
|
std::cout << ErrorPrefix(assetName, rowIndex) << "Failed to load material \"" << row[ROW_ICON_MATERIAL] << "\"\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,19 +140,19 @@ bool AssetLoaderFontIcon::ReadAliasRow(const std::vector<std::string>& row,
|
|||||||
{
|
{
|
||||||
if (row.size() < COL_COUNT_ALIAS)
|
if (row.size() < COL_COUNT_ALIAS)
|
||||||
{
|
{
|
||||||
std::cout << ErrorPrefix(assetName, rowIndex) << "Column count lower than min column count for aliases (" << COL_COUNT_ALIAS << ")" << std::endl;
|
std::cout << ErrorPrefix(assetName, rowIndex) << "Column count lower than min column count for aliases (" << COL_COUNT_ALIAS << ")\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ParseHashStr(alias.aliasHash, row[ROW_ALIAS_NAME]))
|
if (!ParseHashStr(alias.aliasHash, row[ROW_ALIAS_NAME]))
|
||||||
{
|
{
|
||||||
std::cout << ErrorPrefix(assetName, rowIndex) << "Failed to parse alias \"" << row[ROW_ALIAS_NAME] << "\"" << std::endl;
|
std::cout << ErrorPrefix(assetName, rowIndex) << "Failed to parse alias \"" << row[ROW_ALIAS_NAME] << "\"\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ParseHashStr(alias.buttonHash, row[ROW_ALIAS_BUTTON]))
|
if (!ParseHashStr(alias.buttonHash, row[ROW_ALIAS_BUTTON]))
|
||||||
{
|
{
|
||||||
std::cout << ErrorPrefix(assetName, rowIndex) << "Failed to parse button \"" << row[ROW_ALIAS_BUTTON] << "\"" << std::endl;
|
std::cout << ErrorPrefix(assetName, rowIndex) << "Failed to parse button \"" << row[ROW_ALIAS_BUTTON] << "\"\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,14 +186,14 @@ bool AssetLoaderFontIcon::LoadFromRaw(
|
|||||||
|
|
||||||
if (currentRow.size() < COL_COUNT_MIN)
|
if (currentRow.size() < COL_COUNT_MIN)
|
||||||
{
|
{
|
||||||
std::cout << ErrorPrefix(assetName, currentRowIndex) << "Column count lower than min column count (" << COL_COUNT_MIN << ")" << std::endl;
|
std::cout << ErrorPrefix(assetName, currentRowIndex) << "Column count lower than min column count (" << COL_COUNT_MIN << ")\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int index;
|
int index;
|
||||||
if (!ParseInt(index, currentRow[ROW_INDEX]) || index < 0)
|
if (!ParseInt(index, currentRow[ROW_INDEX]) || index < 0)
|
||||||
{
|
{
|
||||||
std::cout << ErrorPrefix(assetName, currentRowIndex) << "Failed to parse index" << std::endl;
|
std::cout << ErrorPrefix(assetName, currentRowIndex) << "Failed to parse index\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,7 +239,7 @@ bool AssetLoaderFontIcon::LoadFromRaw(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << ErrorPrefix(assetName, currentRowIndex) << "Unknown row type \"" << currentRow[ROW_TYPE] << "\"" << std::endl;
|
std::cout << ErrorPrefix(assetName, currentRowIndex) << "Unknown row type \"" << currentRow[ROW_TYPE] << "\"\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ namespace T6
|
|||||||
switch (static_cast<constraintsFieldType_t>(field.iFieldType))
|
switch (static_cast<constraintsFieldType_t>(field.iFieldType))
|
||||||
{
|
{
|
||||||
case CFT_TYPE:
|
case CFT_TYPE:
|
||||||
return ConvertEnumInt(value, field.iOffset, s_constraintTypeNames, std::extent<decltype(s_constraintTypeNames)>::value);
|
return ConvertEnumInt(value, field.iOffset, s_constraintTypeNames, std::extent_v<decltype(s_constraintTypeNames)>);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
assert(false);
|
assert(false);
|
||||||
@ -61,7 +61,7 @@ void AssetLoaderPhysConstraints::CalculatePhysConstraintsFields(PhysConstraints*
|
|||||||
// count
|
// count
|
||||||
{
|
{
|
||||||
auto foundEnd = false;
|
auto foundEnd = false;
|
||||||
for (auto i = 0u; i < std::extent<decltype(PhysConstraints::data)>::value; i++)
|
for (auto i = 0u; i < std::extent_v<decltype(PhysConstraints::data)>; i++)
|
||||||
{
|
{
|
||||||
if (physConstraints->data[i].type == CONSTRAINT_NONE)
|
if (physConstraints->data[i].type == CONSTRAINT_NONE)
|
||||||
{
|
{
|
||||||
@ -72,7 +72,7 @@ void AssetLoaderPhysConstraints::CalculatePhysConstraintsFields(PhysConstraints*
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!foundEnd)
|
if (!foundEnd)
|
||||||
physConstraints->count = std::extent<decltype(PhysConstraints::data)>::value;
|
physConstraints->count = std::extent_v<decltype(PhysConstraints::data)>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,10 +83,10 @@ bool AssetLoaderPhysConstraints::LoadFromInfoString(
|
|||||||
memset(physConstraints, 0, sizeof(PhysConstraints));
|
memset(physConstraints, 0, sizeof(PhysConstraints));
|
||||||
|
|
||||||
InfoStringToPhysConstraintsConverter converter(
|
InfoStringToPhysConstraintsConverter converter(
|
||||||
infoString, physConstraints, zone->m_script_strings, memory, manager, phys_constraints_fields, std::extent<decltype(phys_constraints_fields)>::value);
|
infoString, physConstraints, zone->m_script_strings, memory, manager, phys_constraints_fields, std::extent_v<decltype(phys_constraints_fields)>);
|
||||||
if (!converter.Convert())
|
if (!converter.Convert())
|
||||||
{
|
{
|
||||||
std::cout << "Failed to parse phys constraints: \"" << assetName << "\"" << std::endl;
|
std::cout << "Failed to parse phys constraints: \"" << assetName << "\"\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ bool AssetLoaderPhysConstraints::LoadFromGdt(
|
|||||||
InfoString infoString;
|
InfoString infoString;
|
||||||
if (!infoString.FromGdtProperties(*gdtEntry))
|
if (!infoString.FromGdtProperties(*gdtEntry))
|
||||||
{
|
{
|
||||||
std::cout << "Failed to read phys constraints gdt entry: \"" << assetName << "\"" << std::endl;
|
std::cout << "Failed to read phys constraints gdt entry: \"" << assetName << "\"\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ bool AssetLoaderPhysConstraints::LoadFromRaw(
|
|||||||
InfoString infoString;
|
InfoString infoString;
|
||||||
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_PHYS_CONSTRAINTS, *file.m_stream))
|
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_PHYS_CONSTRAINTS, *file.m_stream))
|
||||||
{
|
{
|
||||||
std::cout << "Failed to read phys constraints raw file: \"" << fileName << "\"" << std::endl;
|
std::cout << "Failed to read phys constraints raw file: \"" << fileName << "\"\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,10 +66,10 @@ bool AssetLoaderPhysPreset::LoadFromInfoString(
|
|||||||
const auto presetInfo = std::make_unique<PhysPresetInfo>();
|
const auto presetInfo = std::make_unique<PhysPresetInfo>();
|
||||||
memset(presetInfo.get(), 0, sizeof(PhysPresetInfo));
|
memset(presetInfo.get(), 0, sizeof(PhysPresetInfo));
|
||||||
InfoStringToPhysPresetConverter converter(
|
InfoStringToPhysPresetConverter converter(
|
||||||
infoString, presetInfo.get(), zone->m_script_strings, memory, manager, phys_preset_fields, std::extent<decltype(phys_preset_fields)>::value);
|
infoString, presetInfo.get(), zone->m_script_strings, memory, manager, phys_preset_fields, std::extent_v<decltype(phys_preset_fields)>);
|
||||||
if (!converter.Convert())
|
if (!converter.Convert())
|
||||||
{
|
{
|
||||||
std::cout << "Failed to parse phys preset: \"" << assetName << "\"" << std::endl;
|
std::cout << "Failed to parse phys preset: \"" << assetName << "\"\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ bool AssetLoaderPhysPreset::LoadFromGdt(
|
|||||||
InfoString infoString;
|
InfoString infoString;
|
||||||
if (!infoString.FromGdtProperties(*gdtEntry))
|
if (!infoString.FromGdtProperties(*gdtEntry))
|
||||||
{
|
{
|
||||||
std::cout << "Failed to read phys preset gdt entry: \"" << assetName << "\"" << std::endl;
|
std::cout << "Failed to read phys preset gdt entry: \"" << assetName << "\"\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ bool AssetLoaderPhysPreset::LoadFromRaw(
|
|||||||
InfoString infoString;
|
InfoString infoString;
|
||||||
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_PHYS_PRESET, *file.m_stream))
|
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_PHYS_PRESET, *file.m_stream))
|
||||||
{
|
{
|
||||||
std::cout << "Failed to read phys preset raw file: \"" << fileName << "\"" << std::endl;
|
std::cout << "Failed to read phys preset raw file: \"" << fileName << "\"\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ bool AssetLoaderRawFile::LoadAnimtree(
|
|||||||
|
|
||||||
if (ret != Z_STREAM_END)
|
if (ret != Z_STREAM_END)
|
||||||
{
|
{
|
||||||
std::cerr << "Deflate failed for loading animtree file \"" << assetName << "\"" << std::endl;
|
std::cerr << "Deflate failed for loading animtree file \"" << assetName << "\"\n";
|
||||||
deflateEnd(&zs);
|
deflateEnd(&zs);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ namespace
|
|||||||
{
|
{
|
||||||
std::string soundFilePath(sndAlias->assetFileName);
|
std::string soundFilePath(sndAlias->assetFileName);
|
||||||
|
|
||||||
std::replace(soundFilePath.begin(), soundFilePath.end(), '\\', '/');
|
std::ranges::replace(soundFilePath, '\\', '/');
|
||||||
for (const auto& droppedPrefix : PREFIXES_TO_DROP)
|
for (const auto& droppedPrefix : PREFIXES_TO_DROP)
|
||||||
{
|
{
|
||||||
if (soundFilePath.rfind(droppedPrefix, 0) != std::string::npos)
|
if (soundFilePath.rfind(droppedPrefix, 0) != std::string::npos)
|
||||||
@ -247,7 +247,7 @@ bool LoadSoundAliasIndexList(MemoryManager* memory, SndBank* sndBank)
|
|||||||
|
|
||||||
if (freeIdx == std::numeric_limits<unsigned short>::max())
|
if (freeIdx == std::numeric_limits<unsigned short>::max())
|
||||||
{
|
{
|
||||||
std::cerr << "Unable to allocate sound bank alias index list" << std::endl;
|
std::cerr << "Unable to allocate sound bank alias index list\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -397,7 +397,7 @@ bool LoadSoundDuckList(ISearchPath* searchPath, MemoryManager* memory, SndBank*
|
|||||||
const auto duckFile = searchPath->Open("soundbank/ducks/" + name + ".duk");
|
const auto duckFile = searchPath->Open("soundbank/ducks/" + name + ".duk");
|
||||||
if (!duckFile.IsOpen())
|
if (!duckFile.IsOpen())
|
||||||
{
|
{
|
||||||
std::cerr << "Unable to find .duk file for " << name << " in ducklist for sound bank " << sndBank->name << std::endl;
|
std::cerr << "Unable to find .duk file for " << name << " in ducklist for sound bank " << sndBank->name << "\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -443,7 +443,7 @@ bool AssetLoaderSoundBank::LoadFromRaw(
|
|||||||
{
|
{
|
||||||
if (assetName.find('.') == std::string::npos)
|
if (assetName.find('.') == std::string::npos)
|
||||||
{
|
{
|
||||||
std::cerr << "A language must be specific in the soundbank asset name! (Ex: mpl_common.all)" << std::endl;
|
std::cerr << "A language must be specific in the soundbank asset name! (Ex: mpl_common.all)\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,7 +470,7 @@ bool AssetLoaderSoundBank::LoadFromRaw(
|
|||||||
{
|
{
|
||||||
if (!LoadSoundRadverbs(memory, sndBank, radverbFile))
|
if (!LoadSoundRadverbs(memory, sndBank, radverbFile))
|
||||||
{
|
{
|
||||||
std::cerr << "Sound Bank reverbs file for " << assetName << " is invalid" << std::endl;
|
std::cerr << "Sound Bank reverbs file for " << assetName << " is invalid\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -481,7 +481,7 @@ bool AssetLoaderSoundBank::LoadFromRaw(
|
|||||||
{
|
{
|
||||||
if (!LoadSoundDuckList(searchPath, memory, sndBank, duckListFile))
|
if (!LoadSoundDuckList(searchPath, memory, sndBank, duckListFile))
|
||||||
{
|
{
|
||||||
std::cerr << "Sound Bank ducklist file for " << assetName << " is invalid" << std::endl;
|
std::cerr << "Sound Bank ducklist file for " << assetName << " is invalid\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -555,7 +555,7 @@ bool AssetLoaderSoundBank::LoadFromRaw(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cerr << "Loaded Sound Bank for " << assetName << " failed to generate. Please check your build files." << std::endl;
|
std::cerr << "Loaded Sound Bank for " << assetName << " failed to generate. Please check your build files.\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -569,7 +569,7 @@ bool AssetLoaderSoundBank::LoadFromRaw(
|
|||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
std::cerr << "Streamed Sound Bank for " << assetName << " failed to generate. Please check your build files." << std::endl;
|
std::cerr << "Streamed Sound Bank for " << assetName << " failed to generate. Please check your build files.\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ namespace T6
|
|||||||
switch (static_cast<tracerFieldType_t>(field.iFieldType))
|
switch (static_cast<tracerFieldType_t>(field.iFieldType))
|
||||||
{
|
{
|
||||||
case TFT_TRACERTYPE:
|
case TFT_TRACERTYPE:
|
||||||
return ConvertEnumInt(value, field.iOffset, tracerTypeNames, std::extent<decltype(tracerTypeNames)>::value);
|
return ConvertEnumInt(value, field.iOffset, tracerTypeNames, std::extent_v<decltype(tracerTypeNames)>);
|
||||||
|
|
||||||
case TFT_NUM_FIELD_TYPES:
|
case TFT_NUM_FIELD_TYPES:
|
||||||
default:
|
default:
|
||||||
@ -52,11 +52,10 @@ bool AssetLoaderTracer::LoadFromInfoString(
|
|||||||
auto* tracer = memory->Create<TracerDef>();
|
auto* tracer = memory->Create<TracerDef>();
|
||||||
memset(tracer, 0, sizeof(TracerDef));
|
memset(tracer, 0, sizeof(TracerDef));
|
||||||
|
|
||||||
InfoStringToTracerConverter converter(
|
InfoStringToTracerConverter converter(infoString, tracer, zone->m_script_strings, memory, manager, tracer_fields, std::extent_v<decltype(tracer_fields)>);
|
||||||
infoString, tracer, zone->m_script_strings, memory, manager, tracer_fields, std::extent<decltype(tracer_fields)>::value);
|
|
||||||
if (!converter.Convert())
|
if (!converter.Convert())
|
||||||
{
|
{
|
||||||
std::cout << "Failed to parse tracer: \"" << assetName << "\"" << std::endl;
|
std::cout << "Failed to parse tracer: \"" << assetName << "\"\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +89,7 @@ bool AssetLoaderTracer::LoadFromGdt(
|
|||||||
InfoString infoString;
|
InfoString infoString;
|
||||||
if (!infoString.FromGdtProperties(*gdtEntry))
|
if (!infoString.FromGdtProperties(*gdtEntry))
|
||||||
{
|
{
|
||||||
std::cout << "Failed to read tracer gdt entry: \"" << assetName << "\"" << std::endl;
|
std::cout << "Failed to read tracer gdt entry: \"" << assetName << "\"\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,7 +112,7 @@ bool AssetLoaderTracer::LoadFromRaw(
|
|||||||
InfoString infoString;
|
InfoString infoString;
|
||||||
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_TRACER, *file.m_stream))
|
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_TRACER, *file.m_stream))
|
||||||
{
|
{
|
||||||
std::cout << "Failed to read tracer raw file: \"" << fileName << "\"" << std::endl;
|
std::cout << "Failed to read tracer raw file: \"" << fileName << "\"\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,13 +23,13 @@ namespace T6
|
|||||||
switch (static_cast<VehicleFieldType>(field.iFieldType))
|
switch (static_cast<VehicleFieldType>(field.iFieldType))
|
||||||
{
|
{
|
||||||
case VFT_TYPE:
|
case VFT_TYPE:
|
||||||
return ConvertEnumInt(value, field.iOffset, s_vehicleClassNames, std::extent<decltype(s_vehicleClassNames)>::value);
|
return ConvertEnumInt(value, field.iOffset, s_vehicleClassNames, std::extent_v<decltype(s_vehicleClassNames)>);
|
||||||
|
|
||||||
case VFT_CAMERAMODE:
|
case VFT_CAMERAMODE:
|
||||||
return ConvertEnumInt(value, field.iOffset, s_vehicleCameraModes, std::extent<decltype(s_vehicleCameraModes)>::value);
|
return ConvertEnumInt(value, field.iOffset, s_vehicleCameraModes, std::extent_v<decltype(s_vehicleCameraModes)>);
|
||||||
|
|
||||||
case VFT_TRACTION_TYPE:
|
case VFT_TRACTION_TYPE:
|
||||||
return ConvertEnumInt(value, field.iOffset, s_tractionTypeNames, std::extent<decltype(s_tractionTypeNames)>::value);
|
return ConvertEnumInt(value, field.iOffset, s_tractionTypeNames, std::extent_v<decltype(s_tractionTypeNames)>);
|
||||||
|
|
||||||
case VFT_MPH_TO_INCHES_PER_SECOND:
|
case VFT_MPH_TO_INCHES_PER_SECOND:
|
||||||
{
|
{
|
||||||
@ -38,7 +38,7 @@ namespace T6
|
|||||||
|
|
||||||
if (endPtr != &value[value.size()])
|
if (endPtr != &value[value.size()])
|
||||||
{
|
{
|
||||||
std::cout << "Failed to parse value \"" << value << "\" as mph" << std::endl;
|
std::cout << "Failed to parse value \"" << value << "\" as mph\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ namespace T6
|
|||||||
|
|
||||||
if (endPtr != &value[value.size()])
|
if (endPtr != &value[value.size()])
|
||||||
{
|
{
|
||||||
std::cout << "Failed to parse value \"" << value << "\" as pounds" << std::endl;
|
std::cout << "Failed to parse value \"" << value << "\" as pounds\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ namespace T6
|
|||||||
}
|
}
|
||||||
|
|
||||||
*reinterpret_cast<int*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset) = TEAM_BAD;
|
*reinterpret_cast<int*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset) = TEAM_BAD;
|
||||||
std::cout << "Failed to parse value \"" << value << "\" as team" << std::endl;
|
std::cout << "Failed to parse value \"" << value << "\" as team\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,10 +115,10 @@ bool AssetLoaderVehicle::LoadFromInfoString(
|
|||||||
memset(vehicleDef, 0, sizeof(VehicleDef));
|
memset(vehicleDef, 0, sizeof(VehicleDef));
|
||||||
|
|
||||||
InfoStringToVehicleConverter converter(
|
InfoStringToVehicleConverter converter(
|
||||||
infoString, vehicleDef, zone->m_script_strings, memory, manager, vehicle_fields, std::extent<decltype(vehicle_fields)>::value);
|
infoString, vehicleDef, zone->m_script_strings, memory, manager, vehicle_fields, std::extent_v<decltype(vehicle_fields)>);
|
||||||
if (!converter.Convert())
|
if (!converter.Convert())
|
||||||
{
|
{
|
||||||
std::cout << "Failed to parse vehicle: \"" << assetName << "\"" << std::endl;
|
std::cout << "Failed to parse vehicle: \"" << assetName << "\"\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ bool AssetLoaderVehicle::LoadFromGdt(
|
|||||||
InfoString infoString;
|
InfoString infoString;
|
||||||
if (!infoString.FromGdtProperties(*gdtEntry))
|
if (!infoString.FromGdtProperties(*gdtEntry))
|
||||||
{
|
{
|
||||||
std::cout << "Failed to read vehicle gdt entry: \"" << assetName << "\"" << std::endl;
|
std::cout << "Failed to read vehicle gdt entry: \"" << assetName << "\"\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ bool AssetLoaderVehicle::LoadFromRaw(
|
|||||||
InfoString infoString;
|
InfoString infoString;
|
||||||
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_VEHICLE, *file.m_stream))
|
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_VEHICLE, *file.m_stream))
|
||||||
{
|
{
|
||||||
std::cout << "Failed to read vehicle raw file: \"" << fileName << "\"" << std::endl;
|
std::cout << "Failed to read vehicle raw file: \"" << fileName << "\"\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ namespace T6
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(std::extent<decltype(bounceSoundSuffixes)>::value == SURF_TYPE_NUM);
|
assert(std::extent_v<decltype(bounceSoundSuffixes)> == SURF_TYPE_NUM);
|
||||||
*bounceSound = static_cast<const char**>(m_memory->Alloc(sizeof(const char*) * SURF_TYPE_NUM));
|
*bounceSound = static_cast<const char**>(m_memory->Alloc(sizeof(const char*) * SURF_TYPE_NUM));
|
||||||
for (auto i = 0u; i < SURF_TYPE_NUM; i++)
|
for (auto i = 0u; i < SURF_TYPE_NUM; i++)
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@ void AssetLoaderZBarrier::CalculateZBarrierFields(ZBarrierDef* zbarrier)
|
|||||||
// numBoardsInBarrier
|
// numBoardsInBarrier
|
||||||
{
|
{
|
||||||
auto foundEnd = false;
|
auto foundEnd = false;
|
||||||
for (auto i = 0u; i < std::extent<decltype(ZBarrierDef::boards)>::value; i++)
|
for (auto i = 0u; i < std::extent_v<decltype(ZBarrierDef::boards)>; i++)
|
||||||
{
|
{
|
||||||
if (zbarrier->boards[i].pBoardModel == nullptr)
|
if (zbarrier->boards[i].pBoardModel == nullptr)
|
||||||
{
|
{
|
||||||
@ -53,7 +53,7 @@ void AssetLoaderZBarrier::CalculateZBarrierFields(ZBarrierDef* zbarrier)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!foundEnd)
|
if (!foundEnd)
|
||||||
zbarrier->numBoardsInBarrier = std::extent<decltype(ZBarrierDef::boards)>::value;
|
zbarrier->numBoardsInBarrier = std::extent_v<decltype(ZBarrierDef::boards)>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,10 +64,10 @@ bool AssetLoaderZBarrier::LoadFromInfoString(
|
|||||||
memset(zbarrier, 0, sizeof(ZBarrierDef));
|
memset(zbarrier, 0, sizeof(ZBarrierDef));
|
||||||
|
|
||||||
InfoStringToZBarrierConverter converter(
|
InfoStringToZBarrierConverter converter(
|
||||||
infoString, zbarrier, zone->m_script_strings, memory, manager, zbarrier_fields, std::extent<decltype(zbarrier_fields)>::value);
|
infoString, zbarrier, zone->m_script_strings, memory, manager, zbarrier_fields, std::extent_v<decltype(zbarrier_fields)>);
|
||||||
if (!converter.Convert())
|
if (!converter.Convert())
|
||||||
{
|
{
|
||||||
std::cout << "Failed to parse zbarrier: \"" << assetName << "\"" << std::endl;
|
std::cout << "Failed to parse zbarrier: \"" << assetName << "\"\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ bool AssetLoaderZBarrier::LoadFromGdt(
|
|||||||
InfoString infoString;
|
InfoString infoString;
|
||||||
if (!infoString.FromGdtProperties(*gdtEntry))
|
if (!infoString.FromGdtProperties(*gdtEntry))
|
||||||
{
|
{
|
||||||
std::cout << "Failed to read zbarrier gdt entry: \"" << assetName << "\"" << std::endl;
|
std::cout << "Failed to read zbarrier gdt entry: \"" << assetName << "\"\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ bool AssetLoaderZBarrier::LoadFromRaw(
|
|||||||
InfoString infoString;
|
InfoString infoString;
|
||||||
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_ZBARRIER, *file.m_stream))
|
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_ZBARRIER, *file.m_stream))
|
||||||
{
|
{
|
||||||
std::cout << "Failed to read zbarrier raw file: \"" << fileName << "\"" << std::endl;
|
std::cout << "Failed to read zbarrier raw file: \"" << fileName << "\"\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
|
|||||||
|
|
||||||
if (fx == nullptr)
|
if (fx == nullptr)
|
||||||
{
|
{
|
||||||
std::cout << "Failed to load fx asset \"" << value << "\"" << std::endl;
|
std::cout << "Failed to load fx asset \"" << value << "\"\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
|
|||||||
|
|
||||||
if (xmodel == nullptr)
|
if (xmodel == nullptr)
|
||||||
{
|
{
|
||||||
std::cout << "Failed to load xmodel asset \"" << value << "\"" << std::endl;
|
std::cout << "Failed to load xmodel asset \"" << value << "\"\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
|
|||||||
|
|
||||||
if (material == nullptr)
|
if (material == nullptr)
|
||||||
{
|
{
|
||||||
std::cout << "Failed to load material asset \"" << value << "\"" << std::endl;
|
std::cout << "Failed to load material asset \"" << value << "\"\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
|
|||||||
|
|
||||||
if (physPreset == nullptr)
|
if (physPreset == nullptr)
|
||||||
{
|
{
|
||||||
std::cout << "Failed to load physpreset asset \"" << value << "\"" << std::endl;
|
std::cout << "Failed to load physpreset asset \"" << value << "\"\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
|
|||||||
|
|
||||||
if (tracer == nullptr)
|
if (tracer == nullptr)
|
||||||
{
|
{
|
||||||
std::cout << "Failed to load tracer asset \"" << value << "\"" << std::endl;
|
std::cout << "Failed to load tracer asset \"" << value << "\"\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
|
|||||||
unsigned int soundAliasHash;
|
unsigned int soundAliasHash;
|
||||||
if (!GetHashValue(value, soundAliasHash))
|
if (!GetHashValue(value, soundAliasHash))
|
||||||
{
|
{
|
||||||
std::cout << "Failed to parse value \"" << value << "\" as hash" << std::endl;
|
std::cout << "Failed to parse value \"" << value << "\" as hash\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,13 +118,13 @@ namespace T6
|
|||||||
SoundBank* ObjLoader::LoadSoundBankForZone(ISearchPath* searchPath, const std::string& soundBankFileName, Zone* zone)
|
SoundBank* ObjLoader::LoadSoundBankForZone(ISearchPath* searchPath, const std::string& soundBankFileName, Zone* zone)
|
||||||
{
|
{
|
||||||
if (ObjLoading::Configuration.Verbose)
|
if (ObjLoading::Configuration.Verbose)
|
||||||
std::cout << "Trying to load sound bank '" << soundBankFileName << "' for zone '" << zone->m_name << "'" << std::endl;
|
std::cout << "Trying to load sound bank '" << soundBankFileName << "' for zone '" << zone->m_name << "'\n";
|
||||||
|
|
||||||
auto* existingSoundBank = SoundBank::Repository.GetContainerByName(soundBankFileName);
|
auto* existingSoundBank = SoundBank::Repository.GetContainerByName(soundBankFileName);
|
||||||
if (existingSoundBank != nullptr)
|
if (existingSoundBank != nullptr)
|
||||||
{
|
{
|
||||||
if (ObjLoading::Configuration.Verbose)
|
if (ObjLoading::Configuration.Verbose)
|
||||||
std::cout << "Referencing loaded sound bank '" << soundBankFileName << "'." << std::endl;
|
std::cout << "Referencing loaded sound bank '" << soundBankFileName << "'.\n";
|
||||||
|
|
||||||
SoundBank::Repository.AddContainerReference(existingSoundBank, zone);
|
SoundBank::Repository.AddContainerReference(existingSoundBank, zone);
|
||||||
return existingSoundBank;
|
return existingSoundBank;
|
||||||
@ -138,19 +138,19 @@ namespace T6
|
|||||||
|
|
||||||
if (!sndBank->Initialize())
|
if (!sndBank->Initialize())
|
||||||
{
|
{
|
||||||
std::cout << "Failed to load sound bank '" << soundBankFileName << "'" << std::endl;
|
std::cout << "Failed to load sound bank '" << soundBankFileName << "'\n";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SoundBank::Repository.AddContainer(std::move(sndBank), zone);
|
SoundBank::Repository.AddContainer(std::move(sndBank), zone);
|
||||||
|
|
||||||
if (ObjLoading::Configuration.Verbose)
|
if (ObjLoading::Configuration.Verbose)
|
||||||
std::cout << "Found and loaded sound bank '" << soundBankFileName << "'" << std::endl;
|
std::cout << "Found and loaded sound bank '" << soundBankFileName << "'\n";
|
||||||
|
|
||||||
return sndBankPtr;
|
return sndBankPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Failed to load sound bank '" << soundBankFileName << "'" << std::endl;
|
std::cout << "Failed to load sound bank '" << soundBankFileName << "'\n";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ namespace T6
|
|||||||
{
|
{
|
||||||
if (!VerifySoundBankChecksum(soundBank, *sndBankLinkedInfo))
|
if (!VerifySoundBankChecksum(soundBank, *sndBankLinkedInfo))
|
||||||
{
|
{
|
||||||
std::cout << "Checksum of sound bank does not match link time checksum for '" << soundBankFileName << "'" << std::endl;
|
std::cout << "Checksum of sound bank does not match link time checksum for '" << soundBankFileName << "'\n";
|
||||||
}
|
}
|
||||||
loadedBanksForZone.emplace(soundBankFileName);
|
loadedBanksForZone.emplace(soundBankFileName);
|
||||||
|
|
||||||
|
@ -26,13 +26,13 @@ class DdsLoaderInternal
|
|||||||
m_stream.read(reinterpret_cast<char*>(&magic), sizeof(magic));
|
m_stream.read(reinterpret_cast<char*>(&magic), sizeof(magic));
|
||||||
if (m_stream.gcount() != sizeof(magic))
|
if (m_stream.gcount() != sizeof(magic))
|
||||||
{
|
{
|
||||||
std::cout << "Failed to read dds data" << std::endl;
|
std::cout << "Failed to read dds data\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (magic != DDS_MAGIC)
|
if (magic != DDS_MAGIC)
|
||||||
{
|
{
|
||||||
std::cout << "Invalid magic for dds" << std::endl;
|
std::cout << "Invalid magic for dds\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ class DdsLoaderInternal
|
|||||||
m_stream.read(reinterpret_cast<char*>(&headerDx10), sizeof(headerDx10));
|
m_stream.read(reinterpret_cast<char*>(&headerDx10), sizeof(headerDx10));
|
||||||
if (m_stream.gcount() != sizeof(headerDx10))
|
if (m_stream.gcount() != sizeof(headerDx10))
|
||||||
{
|
{
|
||||||
std::cout << "Failed to read dds data" << std::endl;
|
std::cout << "Failed to read dds data\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ class DdsLoaderInternal
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Unsupported dds resourceDimension " << headerDx10.resourceDimension << std::endl;
|
std::cout << "Unsupported dds resourceDimension " << headerDx10.resourceDimension << "\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ class DdsLoaderInternal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Unsupported dds dxgi format " << headerDx10.dxgiFormat << std::endl;
|
std::cout << "Unsupported dds dxgi format " << headerDx10.dxgiFormat << "\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ class DdsLoaderInternal
|
|||||||
return ReadDxt10Header();
|
return ReadDxt10Header();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
std::cout << "Unknown dds FourCC " << pf.dwFourCC << std::endl;
|
std::cout << "Unknown dds FourCC " << pf.dwFourCC << "\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,7 +155,7 @@ class DdsLoaderInternal
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Failed to find dds pixel format: R=" << std::hex << pf.dwRBitMask << " G=" << std::hex << pf.dwGBitMask << " B=" << std::hex
|
std::cout << "Failed to find dds pixel format: R=" << std::hex << pf.dwRBitMask << " G=" << std::hex << pf.dwGBitMask << " B=" << std::hex
|
||||||
<< pf.dwBBitMask << " A=" << std::hex << pf.dwABitMask << std::endl;
|
<< pf.dwBBitMask << " A=" << std::hex << pf.dwABitMask << "\n";
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -174,7 +174,7 @@ class DdsLoaderInternal
|
|||||||
m_stream.read(reinterpret_cast<char*>(&header), sizeof(header));
|
m_stream.read(reinterpret_cast<char*>(&header), sizeof(header));
|
||||||
if (m_stream.gcount() != sizeof(header))
|
if (m_stream.gcount() != sizeof(header))
|
||||||
{
|
{
|
||||||
std::cout << "Failed to read dds data" << std::endl;
|
std::cout << "Failed to read dds data\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ class DdsLoaderInternal
|
|||||||
|
|
||||||
if (m_stream.gcount() != mipSize)
|
if (m_stream.gcount() != mipSize)
|
||||||
{
|
{
|
||||||
std::cout << "Failed to read texture data from dds" << std::endl;
|
std::cout << "Failed to read texture data from dds\n";
|
||||||
delete result;
|
delete result;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ Texture* IwiLoader::LoadIwi6(std::istream& stream) const
|
|||||||
const auto sizeOfMipLevel = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount();
|
const auto sizeOfMipLevel = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount();
|
||||||
currentFileSize += sizeOfMipLevel;
|
currentFileSize += sizeOfMipLevel;
|
||||||
|
|
||||||
if (currentMipLevel < static_cast<int>(std::extent<decltype(iwi6::IwiHeader::fileSizeForPicmip)>::value)
|
if (currentMipLevel < static_cast<int>(std::extent_v<decltype(iwi6::IwiHeader::fileSizeForPicmip)>)
|
||||||
&& currentFileSize != header.fileSizeForPicmip[currentMipLevel])
|
&& currentFileSize != header.fileSizeForPicmip[currentMipLevel])
|
||||||
{
|
{
|
||||||
printf("Iwi has invalid file size for picmip %i\n", currentMipLevel);
|
printf("Iwi has invalid file size for picmip %i\n", currentMipLevel);
|
||||||
@ -206,7 +206,7 @@ Texture* IwiLoader::LoadIwi8(std::istream& stream) const
|
|||||||
const auto sizeOfMipLevel = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount();
|
const auto sizeOfMipLevel = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount();
|
||||||
currentFileSize += sizeOfMipLevel;
|
currentFileSize += sizeOfMipLevel;
|
||||||
|
|
||||||
if (currentMipLevel < static_cast<int>(std::extent<decltype(iwi8::IwiHeader::fileSizeForPicmip)>::value)
|
if (currentMipLevel < static_cast<int>(std::extent_v<decltype(iwi8::IwiHeader::fileSizeForPicmip)>)
|
||||||
&& currentFileSize != header.fileSizeForPicmip[currentMipLevel])
|
&& currentFileSize != header.fileSizeForPicmip[currentMipLevel])
|
||||||
{
|
{
|
||||||
printf("Iwi has invalid file size for picmip %i\n", currentMipLevel);
|
printf("Iwi has invalid file size for picmip %i\n", currentMipLevel);
|
||||||
@ -311,7 +311,7 @@ Texture* IwiLoader::LoadIwi13(std::istream& stream) const
|
|||||||
const auto sizeOfMipLevel = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount();
|
const auto sizeOfMipLevel = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount();
|
||||||
currentFileSize += sizeOfMipLevel;
|
currentFileSize += sizeOfMipLevel;
|
||||||
|
|
||||||
if (currentMipLevel < static_cast<int>(std::extent<decltype(iwi13::IwiHeader::fileSizeForPicmip)>::value)
|
if (currentMipLevel < static_cast<int>(std::extent_v<decltype(iwi13::IwiHeader::fileSizeForPicmip)>)
|
||||||
&& currentFileSize != header.fileSizeForPicmip[currentMipLevel])
|
&& currentFileSize != header.fileSizeForPicmip[currentMipLevel])
|
||||||
{
|
{
|
||||||
printf("Iwi has invalid file size for picmip %i\n", currentMipLevel);
|
printf("Iwi has invalid file size for picmip %i\n", currentMipLevel);
|
||||||
@ -418,7 +418,7 @@ Texture* IwiLoader::LoadIwi27(std::istream& stream) const
|
|||||||
const auto sizeOfMipLevel = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount();
|
const auto sizeOfMipLevel = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount();
|
||||||
currentFileSize += sizeOfMipLevel;
|
currentFileSize += sizeOfMipLevel;
|
||||||
|
|
||||||
if (currentMipLevel < static_cast<int>(std::extent<decltype(iwi27::IwiHeader::fileSizeForPicmip)>::value)
|
if (currentMipLevel < static_cast<int>(std::extent_v<decltype(iwi27::IwiHeader::fileSizeForPicmip)>)
|
||||||
&& currentFileSize != header.fileSizeForPicmip[currentMipLevel])
|
&& currentFileSize != header.fileSizeForPicmip[currentMipLevel])
|
||||||
{
|
{
|
||||||
printf("Iwi has invalid file size for picmip %i\n", currentMipLevel);
|
printf("Iwi has invalid file size for picmip %i\n", currentMipLevel);
|
||||||
|
@ -55,7 +55,7 @@ bool InfoStringToStructConverterBase::ParseAsPairs(const std::string& value, std
|
|||||||
|
|
||||||
if (c == '\n' && !isKey)
|
if (c == '\n' && !isKey)
|
||||||
{
|
{
|
||||||
std::cout << "Expected value but got new line" << std::endl;
|
std::cout << "Expected value but got new line\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ bool InfoStringToStructConverterBase::ParseAsPairs(const std::string& value, std
|
|||||||
{
|
{
|
||||||
if (separator == '\n' || separator == EOF)
|
if (separator == '\n' || separator == EOF)
|
||||||
{
|
{
|
||||||
std::cout << "Expected value but got new line" << std::endl;
|
std::cout << "Expected value but got new line\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
key = std::string(value, startPos, ci - startPos);
|
key = std::string(value, startPos, ci - startPos);
|
||||||
@ -122,7 +122,7 @@ bool InfoStringToStructConverterBase::ConvertInt(const std::string& value, const
|
|||||||
|
|
||||||
if (endPtr != &value[value.size()])
|
if (endPtr != &value[value.size()])
|
||||||
{
|
{
|
||||||
std::cout << "Failed to parse value \"" << value << "\" as int" << std::endl;
|
std::cout << "Failed to parse value \"" << value << "\" as int\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ bool InfoStringToStructConverterBase::ConvertUint(const std::string& value, cons
|
|||||||
|
|
||||||
if (endPtr != &value[value.size()])
|
if (endPtr != &value[value.size()])
|
||||||
{
|
{
|
||||||
std::cout << "Failed to parse value \"" << value << "\" as uint" << std::endl;
|
std::cout << "Failed to parse value \"" << value << "\" as uint\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ bool InfoStringToStructConverterBase::ConvertBool(const std::string& value, cons
|
|||||||
*reinterpret_cast<bool*>(reinterpret_cast<uintptr_t>(m_structure) + offset) = intValue != 0;
|
*reinterpret_cast<bool*>(reinterpret_cast<uintptr_t>(m_structure) + offset) = intValue != 0;
|
||||||
if (endPtr != &value[value.size()])
|
if (endPtr != &value[value.size()])
|
||||||
{
|
{
|
||||||
std::cout << "Failed to parse value \"" << value << "\" as bool" << std::endl;
|
std::cout << "Failed to parse value \"" << value << "\" as bool\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ bool InfoStringToStructConverterBase::ConvertQBoolean(const std::string& value,
|
|||||||
*reinterpret_cast<int*>(reinterpret_cast<uintptr_t>(m_structure) + offset) = intValue != 0 ? 1 : 0;
|
*reinterpret_cast<int*>(reinterpret_cast<uintptr_t>(m_structure) + offset) = intValue != 0 ? 1 : 0;
|
||||||
if (endPtr != &value[value.size()])
|
if (endPtr != &value[value.size()])
|
||||||
{
|
{
|
||||||
std::cout << "Failed to parse value \"" << value << "\" as qboolean" << std::endl;
|
std::cout << "Failed to parse value \"" << value << "\" as qboolean\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ bool InfoStringToStructConverterBase::ConvertFloat(const std::string& value, con
|
|||||||
|
|
||||||
if (endPtr != &value[value.size()])
|
if (endPtr != &value[value.size()])
|
||||||
{
|
{
|
||||||
std::cout << "Failed to parse value \"" << value << "\" as float" << std::endl;
|
std::cout << "Failed to parse value \"" << value << "\" as float\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ bool InfoStringToStructConverterBase::ConvertMilliseconds(const std::string& val
|
|||||||
|
|
||||||
if (endPtr != &value[value.size()])
|
if (endPtr != &value[value.size()])
|
||||||
{
|
{
|
||||||
std::cout << "Failed to parse value \"" << value << "\" as milliseconds" << std::endl;
|
std::cout << "Failed to parse value \"" << value << "\" as milliseconds\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +46,6 @@ bool LocalizeFileReader::ReadLocalizeFile(std::vector<CommonLocalizeEntry>& entr
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << "Parsing localization file failed!" << std::endl;
|
std::cerr << "Parsing localization file failed!\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -46,8 +46,8 @@ class IPak::Impl : public ObjContainerReferenceable
|
|||||||
|
|
||||||
for (unsigned itemIndex = 0; itemIndex < m_index_section->itemCount; itemIndex++)
|
for (unsigned itemIndex = 0; itemIndex < m_index_section->itemCount; itemIndex++)
|
||||||
{
|
{
|
||||||
m_stream->read(reinterpret_cast<char*>(&indexEntry), sizeof indexEntry);
|
m_stream->read(reinterpret_cast<char*>(&indexEntry), sizeof(indexEntry));
|
||||||
if (m_stream->gcount() != sizeof indexEntry)
|
if (m_stream->gcount() != sizeof(indexEntry))
|
||||||
{
|
{
|
||||||
printf("Unexpected eof when trying to load index entry %u.\n", itemIndex);
|
printf("Unexpected eof when trying to load index entry %u.\n", itemIndex);
|
||||||
return false;
|
return false;
|
||||||
@ -56,8 +56,7 @@ class IPak::Impl : public ObjContainerReferenceable
|
|||||||
m_index_entries.push_back(indexEntry);
|
m_index_entries.push_back(indexEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::sort(m_index_entries.begin(),
|
std::ranges::sort(m_index_entries,
|
||||||
m_index_entries.end(),
|
|
||||||
[](const IPakIndexEntry& entry1, const IPakIndexEntry& entry2)
|
[](const IPakIndexEntry& entry1, const IPakIndexEntry& entry2)
|
||||||
{
|
{
|
||||||
return entry1.key.combinedKey < entry2.key.combinedKey;
|
return entry1.key.combinedKey < entry2.key.combinedKey;
|
||||||
@ -99,7 +98,7 @@ class IPak::Impl : public ObjContainerReferenceable
|
|||||||
IPakHeader header{};
|
IPakHeader header{};
|
||||||
|
|
||||||
m_stream->read(reinterpret_cast<char*>(&header), sizeof(header));
|
m_stream->read(reinterpret_cast<char*>(&header), sizeof(header));
|
||||||
if (m_stream->gcount() != sizeof header)
|
if (m_stream->gcount() != sizeof(header))
|
||||||
{
|
{
|
||||||
printf("Unexpected eof when trying to load header.\n");
|
printf("Unexpected eof when trying to load header.\n");
|
||||||
return false;
|
return false;
|
||||||
|
@ -71,8 +71,7 @@ public:
|
|||||||
m_stream_mutex.lock();
|
m_stream_mutex.lock();
|
||||||
|
|
||||||
ChunkBuffer* reservedChunkBuffer;
|
ChunkBuffer* reservedChunkBuffer;
|
||||||
const auto freeChunkBuffer = std::find_if(m_chunk_buffers.begin(),
|
const auto freeChunkBuffer = std::ranges::find_if(m_chunk_buffers,
|
||||||
m_chunk_buffers.end(),
|
|
||||||
[](ChunkBuffer* chunkBuffer)
|
[](ChunkBuffer* chunkBuffer)
|
||||||
{
|
{
|
||||||
return chunkBuffer->m_using_stream == nullptr;
|
return chunkBuffer->m_using_stream == nullptr;
|
||||||
@ -111,8 +110,7 @@ public:
|
|||||||
{
|
{
|
||||||
m_stream_mutex.lock();
|
m_stream_mutex.lock();
|
||||||
|
|
||||||
const auto openStreamEntry = std::find_if(m_open_streams.begin(),
|
const auto openStreamEntry = std::ranges::find_if(m_open_streams,
|
||||||
m_open_streams.end(),
|
|
||||||
[stream](const ManagedStream& managedStream)
|
[stream](const ManagedStream& managedStream)
|
||||||
{
|
{
|
||||||
return managedStream.m_stream == stream;
|
return managedStream.m_stream == stream;
|
||||||
@ -127,7 +125,7 @@ public:
|
|||||||
// Only keep previously allocated chunk buffer if we did not get over the limit of idle chunk buffers
|
// Only keep previously allocated chunk buffer if we did not get over the limit of idle chunk buffers
|
||||||
if (m_chunk_buffers.size() > CHUNK_BUFFER_COUNT_IDLE_LIMIT)
|
if (m_chunk_buffers.size() > CHUNK_BUFFER_COUNT_IDLE_LIMIT)
|
||||||
{
|
{
|
||||||
const auto chunkBufferEntry = std::find(m_chunk_buffers.begin(), m_chunk_buffers.end(), chunkBuffer);
|
const auto chunkBufferEntry = std::ranges::find(m_chunk_buffers, chunkBuffer);
|
||||||
|
|
||||||
if (chunkBufferEntry != m_chunk_buffers.end())
|
if (chunkBufferEntry != m_chunk_buffers.end())
|
||||||
{
|
{
|
||||||
|
@ -126,7 +126,7 @@ protected:
|
|||||||
while (skipAmount > 0)
|
while (skipAmount > 0)
|
||||||
{
|
{
|
||||||
char temp[1024];
|
char temp[1024];
|
||||||
const auto toRead = skipAmount > sizeof temp ? sizeof temp : static_cast<size_t>(skipAmount);
|
const auto toRead = skipAmount > sizeof(temp) ? sizeof(temp) : static_cast<size_t>(skipAmount);
|
||||||
unzReadCurrentFile(m_container, temp, toRead);
|
unzReadCurrentFile(m_container, temp, toRead);
|
||||||
skipAmount -= toRead;
|
skipAmount -= toRead;
|
||||||
}
|
}
|
||||||
@ -216,7 +216,7 @@ public:
|
|||||||
{
|
{
|
||||||
unz_file_info64 info;
|
unz_file_info64 info;
|
||||||
char fileNameBuffer[256];
|
char fileNameBuffer[256];
|
||||||
unzGetCurrentFileInfo64(m_unz_file, &info, fileNameBuffer, sizeof fileNameBuffer, nullptr, 0, nullptr, 0);
|
unzGetCurrentFileInfo64(m_unz_file, &info, fileNameBuffer, sizeof(fileNameBuffer), nullptr, 0, nullptr, 0);
|
||||||
|
|
||||||
std::string fileName(fileNameBuffer);
|
std::string fileName(fileNameBuffer);
|
||||||
std::filesystem::path path(fileName);
|
std::filesystem::path path(fileName);
|
||||||
@ -248,7 +248,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto iwdFilename = fileName;
|
auto iwdFilename = fileName;
|
||||||
std::replace(iwdFilename.begin(), iwdFilename.end(), '\\', '/');
|
std::ranges::replace(iwdFilename, '\\', '/');
|
||||||
|
|
||||||
const auto iwdEntry = m_entry_map.find(iwdFilename);
|
const auto iwdEntry = m_entry_map.find(iwdFilename);
|
||||||
|
|
||||||
|
@ -136,44 +136,43 @@ bool SoundBank::ReadHeader()
|
|||||||
|
|
||||||
if (m_header.magic != MAGIC)
|
if (m_header.magic != MAGIC)
|
||||||
{
|
{
|
||||||
std::cout << "Invalid sndbank magic 0x" << std::hex << m_header.magic << std::endl;
|
std::cout << "Invalid sndbank magic 0x" << std::hex << m_header.magic << "\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_header.version != VERSION)
|
if (m_header.version != VERSION)
|
||||||
{
|
{
|
||||||
std::cout << "Unsupported sndbank version " << m_header.version << " (should be " << VERSION << ")" << std::endl;
|
std::cout << "Unsupported sndbank version " << m_header.version << " (should be " << VERSION << ")\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_header.entrySize != sizeof(SoundAssetBankEntry))
|
if (m_header.entrySize != sizeof(SoundAssetBankEntry))
|
||||||
{
|
{
|
||||||
std::cout << "Invalid sndbank entry size 0x" << std::hex << m_header.entrySize << " (should be 0x" << std::hex << sizeof(SoundAssetBankEntry) << ")"
|
std::cout << "Invalid sndbank entry size 0x" << std::hex << m_header.entrySize << " (should be 0x" << std::hex << sizeof(SoundAssetBankEntry) << ")\n";
|
||||||
<< std::endl;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_header.fileSize != m_file_size)
|
if (m_header.fileSize != m_file_size)
|
||||||
{
|
{
|
||||||
std::cout << "Invalid sndbank " << m_file_size << " (header expects " << m_header.fileSize << ")" << std::endl;
|
std::cout << "Invalid sndbank " << m_file_size << " (header expects " << m_header.fileSize << ")\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_header.entryCount && (m_header.entryOffset <= 0 || m_header.entryOffset + sizeof(SoundAssetBankEntry) * m_header.entryCount > m_file_size))
|
if (m_header.entryCount && (m_header.entryOffset <= 0 || m_header.entryOffset + sizeof(SoundAssetBankEntry) * m_header.entryCount > m_file_size))
|
||||||
{
|
{
|
||||||
std::cout << "Invalid sndbank entry offset " << m_header.entryOffset << " (filesize is " << m_file_size << ")" << std::endl;
|
std::cout << "Invalid sndbank entry offset " << m_header.entryOffset << " (filesize is " << m_file_size << ")\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_header.checksumOffset <= 0 || m_header.checksumOffset + sizeof(SoundAssetBankChecksum) * m_header.entryCount > m_file_size)
|
if (m_header.checksumOffset <= 0 || m_header.checksumOffset + sizeof(SoundAssetBankChecksum) * m_header.entryCount > m_file_size)
|
||||||
{
|
{
|
||||||
std::cout << "Invalid sndbank checksum offset " << m_header.checksumOffset << " (filesize is " << m_file_size << ")" << std::endl;
|
std::cout << "Invalid sndbank checksum offset " << m_header.checksumOffset << " (filesize is " << m_file_size << ")\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_header.dependencyCount * m_header.dependencySize > sizeof(SoundAssetBankHeader::dependencies))
|
if (m_header.dependencyCount * m_header.dependencySize > sizeof(SoundAssetBankHeader::dependencies))
|
||||||
{
|
{
|
||||||
std::cout << "Invalid sndbank dependency sizes (count is " << m_header.dependencyCount << "; size is " << m_header.dependencySize << ")" << std::endl;
|
std::cout << "Invalid sndbank dependency sizes (count is " << m_header.dependencyCount << "; size is " << m_header.dependencySize << ")\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,13 +201,13 @@ bool SoundBank::ReadEntries()
|
|||||||
|
|
||||||
if (m_stream->gcount() != sizeof(entry))
|
if (m_stream->gcount() != sizeof(entry))
|
||||||
{
|
{
|
||||||
std::cout << "Failed to read sound bank entry at index " << i << std::endl;
|
std::cout << "Failed to read sound bank entry at index " << i << "\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry.offset == 0 || entry.offset + entry.size >= m_file_size)
|
if (entry.offset == 0 || entry.offset + entry.size >= m_file_size)
|
||||||
{
|
{
|
||||||
std::cout << "Invalid sound bank entry data offset " << entry.offset << " (filesize is " << m_header.fileSize << ")" << std::endl;
|
std::cout << "Invalid sound bank entry data offset " << entry.offset << " (filesize is " << m_header.fileSize << ")\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,7 +229,7 @@ bool SoundBank::ReadChecksums()
|
|||||||
|
|
||||||
if (m_stream->gcount() != sizeof(checksum))
|
if (m_stream->gcount() != sizeof(checksum))
|
||||||
{
|
{
|
||||||
std::cout << "Failed to read sound bank checksum at index " << i << std::endl;
|
std::cout << "Failed to read sound bank checksum at index " << i << "\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,8 +46,7 @@ public:
|
|||||||
|
|
||||||
void AddSound(const std::string& soundFilePath, unsigned int soundId, bool looping, bool streamed) override
|
void AddSound(const std::string& soundFilePath, unsigned int soundId, bool looping, bool streamed) override
|
||||||
{
|
{
|
||||||
auto itr = std::find_if(this->m_sounds.begin(),
|
auto itr = std::ranges::find_if(this->m_sounds,
|
||||||
this->m_sounds.end(),
|
|
||||||
[soundId](SoundBankEntryInfo& entry)
|
[soundId](SoundBankEntryInfo& entry)
|
||||||
{
|
{
|
||||||
return entry.m_sound_id == soundId;
|
return entry.m_sound_id == soundId;
|
||||||
@ -188,13 +187,13 @@ public:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cerr << "Unable to decode .flac file for sound " << soundFilePath << std::endl;
|
std::cerr << "Unable to decode .flac file for sound " << soundFilePath << "\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cerr << "Unable to find a compatible file for sound " << soundFilePath << std::endl;
|
std::cerr << "Unable to find a compatible file for sound " << soundFilePath << "\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -203,7 +202,7 @@ public:
|
|||||||
if (!sound.m_streamed && lastEntry->frameRateIndex != 6)
|
if (!sound.m_streamed && lastEntry->frameRateIndex != 6)
|
||||||
{
|
{
|
||||||
std::cout << "WARNING: Loaded sound \"" << soundFilePath
|
std::cout << "WARNING: Loaded sound \"" << soundFilePath
|
||||||
<< "\" should have a framerate of 48000 but doesn't. This sound may not work on all games!" << std::endl;
|
<< "\" should have a framerate of 48000 but doesn't. This sound may not work on all games!\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate checksum
|
// calculate checksum
|
||||||
@ -255,7 +254,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (!WriteEntries())
|
if (!WriteEntries())
|
||||||
{
|
{
|
||||||
std::cerr << "An error occurred writing the sound bank entries. Please check output." << std::endl;
|
std::cerr << "An error occurred writing the sound bank entries. Please check output.\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,7 +268,7 @@ public:
|
|||||||
|
|
||||||
if (m_current_offset > UINT32_MAX)
|
if (m_current_offset > UINT32_MAX)
|
||||||
{
|
{
|
||||||
std::cerr << "Sound bank files must be under 4GB. Please reduce the number of sounds being written!" << std::endl;
|
std::cerr << "Sound bank files must be under 4GB. Please reduce the number of sounds being written!\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,11 +139,11 @@ std::unique_ptr<ParsingResult> MenuFileReader::ReadMenuFile()
|
|||||||
|
|
||||||
if (!parser->Parse())
|
if (!parser->Parse())
|
||||||
{
|
{
|
||||||
std::cerr << "Parsing menu file failed!" << std::endl;
|
std::cerr << "Parsing menu file failed!\n";
|
||||||
|
|
||||||
const auto* parserEndState = parser->GetState();
|
const auto* parserEndState = parser->GetState();
|
||||||
if (parserEndState->m_current_event_handler_set && !parserEndState->m_permissive_mode)
|
if (parserEndState->m_current_event_handler_set && !parserEndState->m_permissive_mode)
|
||||||
std::cerr << "You can use the --menu-permissive option to try to compile the event handler script anyway." << std::endl;
|
std::cerr << "You can use the --menu-permissive option to try to compile the event handler script anyway.\n";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,8 +179,7 @@ namespace state_map
|
|||||||
const auto tokenValue =
|
const auto tokenValue =
|
||||||
valueToken.m_type == SimpleParserValueType::IDENTIFIER ? valueToken.IdentifierValue() : std::to_string(valueToken.IntegerValue());
|
valueToken.m_type == SimpleParserValueType::IDENTIFIER ? valueToken.IdentifierValue() : std::to_string(valueToken.IntegerValue());
|
||||||
|
|
||||||
const auto referencedValue = std::find_if(var.m_values.begin(),
|
const auto referencedValue = std::ranges::find_if(var.m_values,
|
||||||
var.m_values.end(),
|
|
||||||
[&tokenValue](const StateMapLayoutVarValue& value)
|
[&tokenValue](const StateMapLayoutVarValue& value)
|
||||||
{
|
{
|
||||||
return value.m_name == tokenValue;
|
return value.m_name == tokenValue;
|
||||||
|
@ -40,12 +40,11 @@ void StateMapHandler::ApplyStateMap(const uint32_t* baseStateBits, uint32_t* out
|
|||||||
for (auto entryIndex = 0u; entryIndex < m_state_map.m_state_map_entries.size(); entryIndex++)
|
for (auto entryIndex = 0u; entryIndex < m_state_map.m_state_map_entries.size(); entryIndex++)
|
||||||
{
|
{
|
||||||
const auto& entry = m_state_map.m_state_map_entries[entryIndex];
|
const auto& entry = m_state_map.m_state_map_entries[entryIndex];
|
||||||
const auto matchingRule = std::find_if(entry.m_rules.begin(),
|
const auto matchingRule = std::ranges::find_if(entry.m_rules,
|
||||||
entry.m_rules.end(),
|
|
||||||
[&vars](const std::unique_ptr<StateMapRule>& rule)
|
[&vars](const std::unique_ptr<StateMapRule>& rule)
|
||||||
{
|
{
|
||||||
const auto matchingCondition = std::find_if(rule->m_conditions.begin(),
|
const auto matchingCondition =
|
||||||
rule->m_conditions.end(),
|
std::ranges::find_if(rule->m_conditions,
|
||||||
[&vars](std::unique_ptr<ISimpleExpression>& condition)
|
[&vars](std::unique_ptr<ISimpleExpression>& condition)
|
||||||
{
|
{
|
||||||
return condition->EvaluateNonStatic(&vars).IsTruthy();
|
return condition->EvaluateNonStatic(&vars).IsTruthy();
|
||||||
@ -68,8 +67,7 @@ StateMapVars StateMapHandler::BuildVars(const uint32_t* baseStateBits) const
|
|||||||
for (const auto& var : m_state_map_layout.m_var_layout.m_vars)
|
for (const auto& var : m_state_map_layout.m_var_layout.m_vars)
|
||||||
{
|
{
|
||||||
const auto baseStateBitField = baseStateBits[var.m_state_bits_index];
|
const auto baseStateBitField = baseStateBits[var.m_state_bits_index];
|
||||||
const auto matchingValue = std::find_if(var.m_values.begin(),
|
const auto matchingValue = std::ranges::find_if(var.m_values,
|
||||||
var.m_values.end(),
|
|
||||||
[&baseStateBitField](const StateMapLayoutVarValue& value)
|
[&baseStateBitField](const StateMapLayoutVarValue& value)
|
||||||
{
|
{
|
||||||
return (baseStateBitField & value.m_state_bits_mask) == value.m_state_bits_mask;
|
return (baseStateBitField & value.m_state_bits_mask) == value.m_state_bits_mask;
|
||||||
|
@ -58,6 +58,6 @@ std::vector<std::unique_ptr<CommonStructuredDataDef>> StructuredDataDefReader::R
|
|||||||
if (success)
|
if (success)
|
||||||
return parser->GetDefs();
|
return parser->GetDefs();
|
||||||
|
|
||||||
std::cout << "Parsing structured data def file \"" << m_file_name << "\" failed!" << std::endl;
|
std::cout << "Parsing structured data def file \"" << m_file_name << "\" failed!\n";
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ InfoString AssetDumperPhysPreset::CreateInfoString(XAssetInfo<PhysPreset>* asset
|
|||||||
|
|
||||||
InfoStringFromPhysPresetConverter converter(physPresetInfo,
|
InfoStringFromPhysPresetConverter converter(physPresetInfo,
|
||||||
phys_preset_fields,
|
phys_preset_fields,
|
||||||
std::extent<decltype(phys_preset_fields)>::value,
|
std::extent_v<decltype(phys_preset_fields)>,
|
||||||
[asset](const scr_string_t scrStr) -> std::string
|
[asset](const scr_string_t scrStr) -> std::string
|
||||||
{
|
{
|
||||||
assert(scrStr < asset->m_zone->m_script_strings.Count());
|
assert(scrStr < asset->m_zone->m_script_strings.Count());
|
||||||
|
@ -44,7 +44,7 @@ void AssetDumperRawFile::DumpAsset(AssetDumpingContext& context, XAssetInfo<RawF
|
|||||||
while (zs.avail_in > 0)
|
while (zs.avail_in > 0)
|
||||||
{
|
{
|
||||||
zs.next_out = buffer;
|
zs.next_out = buffer;
|
||||||
zs.avail_out = sizeof buffer;
|
zs.avail_out = sizeof(buffer);
|
||||||
ret = inflate(&zs, Z_SYNC_FLUSH);
|
ret = inflate(&zs, Z_SYNC_FLUSH);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@ -54,7 +54,7 @@ void AssetDumperRawFile::DumpAsset(AssetDumpingContext& context, XAssetInfo<RawF
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream.write(reinterpret_cast<char*>(buffer), sizeof buffer - zs.avail_out);
|
stream.write(reinterpret_cast<char*>(buffer), sizeof(buffer) - zs.avail_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
inflateEnd(&zs);
|
inflateEnd(&zs);
|
||||||
|
@ -126,8 +126,7 @@ namespace IW4
|
|||||||
{
|
{
|
||||||
const auto expectedRegisterSet =
|
const auto expectedRegisterSet =
|
||||||
arg.type == MTL_ARG_CODE_PIXEL_SAMPLER || arg.type == MTL_ARG_MATERIAL_PIXEL_SAMPLER ? d3d9::RegisterSet::SAMPLER : d3d9::RegisterSet::FLOAT_4;
|
arg.type == MTL_ARG_CODE_PIXEL_SAMPLER || arg.type == MTL_ARG_MATERIAL_PIXEL_SAMPLER ? d3d9::RegisterSet::SAMPLER : d3d9::RegisterSet::FLOAT_4;
|
||||||
const auto targetShaderArg = std::find_if(shaderInfo.m_constants.begin(),
|
const auto targetShaderArg = std::ranges::find_if(shaderInfo.m_constants,
|
||||||
shaderInfo.m_constants.end(),
|
|
||||||
[arg, expectedRegisterSet](const d3d9::ShaderConstant& constant)
|
[arg, expectedRegisterSet](const d3d9::ShaderConstant& constant)
|
||||||
{
|
{
|
||||||
return constant.m_register_set == expectedRegisterSet && constant.m_register_index <= arg.dest
|
return constant.m_register_set == expectedRegisterSet && constant.m_register_index <= arg.dest
|
||||||
|
@ -36,7 +36,7 @@ InfoString AssetDumperTracer::CreateInfoString(XAssetInfo<TracerDef>* asset)
|
|||||||
{
|
{
|
||||||
InfoStringFromTracerConverter converter(asset->Asset(),
|
InfoStringFromTracerConverter converter(asset->Asset(),
|
||||||
tracer_fields,
|
tracer_fields,
|
||||||
std::extent<decltype(tracer_fields)>::value,
|
std::extent_v<decltype(tracer_fields)>,
|
||||||
[asset](const scr_string_t scrStr) -> std::string
|
[asset](const scr_string_t scrStr) -> std::string
|
||||||
{
|
{
|
||||||
assert(scrStr < asset->m_zone->m_script_strings.Count());
|
assert(scrStr < asset->m_zone->m_script_strings.Count());
|
||||||
|
@ -22,13 +22,13 @@ namespace IW4
|
|||||||
switch (static_cast<VehicleFieldType>(field.iFieldType))
|
switch (static_cast<VehicleFieldType>(field.iFieldType))
|
||||||
{
|
{
|
||||||
case VFT_TYPE:
|
case VFT_TYPE:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, s_vehicleClassNames, std::extent<decltype(s_vehicleClassNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, s_vehicleClassNames, std::extent_v<decltype(s_vehicleClassNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VFT_AXLE_STEERING:
|
case VFT_AXLE_STEERING:
|
||||||
case VFT_AXLE_POWER:
|
case VFT_AXLE_POWER:
|
||||||
case VFT_AXLE_BRAKING:
|
case VFT_AXLE_BRAKING:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, s_vehicleAxleTypeNames, std::extent<decltype(s_vehicleAxleTypeNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, s_vehicleAxleTypeNames, std::extent_v<decltype(s_vehicleAxleTypeNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VFT_TROPHY_TAGS:
|
case VFT_TROPHY_TAGS:
|
||||||
@ -37,7 +37,7 @@ namespace IW4
|
|||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
for (auto i = 0u; i < std::extent<decltype(VehicleDef::trophyTags)>::value; i++)
|
for (auto i = 0u; i < std::extent_v<decltype(VehicleDef::trophyTags)>; i++)
|
||||||
{
|
{
|
||||||
const auto& str = m_get_scr_string(trophyTags[i]);
|
const auto& str = m_get_scr_string(trophyTags[i]);
|
||||||
if (!str.empty())
|
if (!str.empty())
|
||||||
@ -77,7 +77,7 @@ InfoString AssetDumperVehicle::CreateInfoString(XAssetInfo<VehicleDef>* asset)
|
|||||||
{
|
{
|
||||||
InfoStringFromVehicleConverter converter(asset->Asset(),
|
InfoStringFromVehicleConverter converter(asset->Asset(),
|
||||||
vehicle_fields,
|
vehicle_fields,
|
||||||
std::extent<decltype(vehicle_fields)>::value,
|
std::extent_v<decltype(vehicle_fields)>,
|
||||||
[asset](const scr_string_t scrStr) -> std::string
|
[asset](const scr_string_t scrStr) -> std::string
|
||||||
{
|
{
|
||||||
assert(scrStr < asset->m_zone->m_script_strings.Count());
|
assert(scrStr < asset->m_zone->m_script_strings.Count());
|
||||||
|
@ -23,47 +23,47 @@ namespace IW4
|
|||||||
switch (static_cast<weapFieldType_t>(field.iFieldType))
|
switch (static_cast<weapFieldType_t>(field.iFieldType))
|
||||||
{
|
{
|
||||||
case WFT_WEAPONTYPE:
|
case WFT_WEAPONTYPE:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapTypeNames, std::extent<decltype(szWeapTypeNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapTypeNames, std::extent_v<decltype(szWeapTypeNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WFT_WEAPONCLASS:
|
case WFT_WEAPONCLASS:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapClassNames, std::extent<decltype(szWeapClassNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapClassNames, std::extent_v<decltype(szWeapClassNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WFT_OVERLAYRETICLE:
|
case WFT_OVERLAYRETICLE:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapOverlayReticleNames, std::extent<decltype(szWeapOverlayReticleNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapOverlayReticleNames, std::extent_v<decltype(szWeapOverlayReticleNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WFT_PENETRATE_TYPE:
|
case WFT_PENETRATE_TYPE:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, penetrateTypeNames, std::extent<decltype(penetrateTypeNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, penetrateTypeNames, std::extent_v<decltype(penetrateTypeNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WFT_IMPACT_TYPE:
|
case WFT_IMPACT_TYPE:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, impactTypeNames, std::extent<decltype(impactTypeNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, impactTypeNames, std::extent_v<decltype(impactTypeNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WFT_STANCE:
|
case WFT_STANCE:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapStanceNames, std::extent<decltype(szWeapStanceNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapStanceNames, std::extent_v<decltype(szWeapStanceNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WFT_PROJ_EXPLOSION:
|
case WFT_PROJ_EXPLOSION:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szProjectileExplosionNames, std::extent<decltype(szProjectileExplosionNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, szProjectileExplosionNames, std::extent_v<decltype(szProjectileExplosionNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WFT_OFFHAND_CLASS:
|
case WFT_OFFHAND_CLASS:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, offhandClassNames, std::extent<decltype(offhandClassNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, offhandClassNames, std::extent_v<decltype(offhandClassNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WFT_ANIMTYPE:
|
case WFT_ANIMTYPE:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, playerAnimTypeNames, std::extent<decltype(playerAnimTypeNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, playerAnimTypeNames, std::extent_v<decltype(playerAnimTypeNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WFT_ACTIVE_RETICLE_TYPE:
|
case WFT_ACTIVE_RETICLE_TYPE:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, activeReticleNames, std::extent<decltype(activeReticleNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, activeReticleNames, std::extent_v<decltype(activeReticleNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WFT_GUIDED_MISSILE_TYPE:
|
case WFT_GUIDED_MISSILE_TYPE:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, guidedMissileNames, std::extent<decltype(guidedMissileNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, guidedMissileNames, std::extent_v<decltype(guidedMissileNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WFT_BOUNCE_SOUND:
|
case WFT_BOUNCE_SOUND:
|
||||||
@ -90,23 +90,23 @@ namespace IW4
|
|||||||
}
|
}
|
||||||
|
|
||||||
case WFT_STICKINESS:
|
case WFT_STICKINESS:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, stickinessNames, std::extent<decltype(stickinessNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, stickinessNames, std::extent_v<decltype(stickinessNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WFT_OVERLAYINTERFACE:
|
case WFT_OVERLAYINTERFACE:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, overlayInterfaceNames, std::extent<decltype(overlayInterfaceNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, overlayInterfaceNames, std::extent_v<decltype(overlayInterfaceNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WFT_INVENTORYTYPE:
|
case WFT_INVENTORYTYPE:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapInventoryTypeNames, std::extent<decltype(szWeapInventoryTypeNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapInventoryTypeNames, std::extent_v<decltype(szWeapInventoryTypeNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WFT_FIRETYPE:
|
case WFT_FIRETYPE:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapFireTypeNames, std::extent<decltype(szWeapFireTypeNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapFireTypeNames, std::extent_v<decltype(szWeapFireTypeNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WFT_AMMOCOUNTER_CLIPTYPE:
|
case WFT_AMMOCOUNTER_CLIPTYPE:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, ammoCounterClipNames, std::extent<decltype(ammoCounterClipNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, ammoCounterClipNames, std::extent_v<decltype(ammoCounterClipNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WFT_ICONRATIO_HUD:
|
case WFT_ICONRATIO_HUD:
|
||||||
@ -114,7 +114,7 @@ namespace IW4
|
|||||||
case WFT_ICONRATIO_AMMOCOUNTER:
|
case WFT_ICONRATIO_AMMOCOUNTER:
|
||||||
case WFT_ICONRATIO_KILL:
|
case WFT_ICONRATIO_KILL:
|
||||||
case WFT_ICONRATIO_DPAD:
|
case WFT_ICONRATIO_DPAD:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, weapIconRatioNames, std::extent<decltype(weapIconRatioNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, weapIconRatioNames, std::extent_v<decltype(weapIconRatioNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WFT_HIDETAGS:
|
case WFT_HIDETAGS:
|
||||||
@ -123,7 +123,7 @@ namespace IW4
|
|||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::hideTags)>::value; i++)
|
for (auto i = 0u; i < std::extent_v<decltype(WeaponFullDef::hideTags)>; i++)
|
||||||
{
|
{
|
||||||
const auto& str = m_get_scr_string(hideTags[i]);
|
const auto& str = m_get_scr_string(hideTags[i]);
|
||||||
if (!str.empty())
|
if (!str.empty())
|
||||||
@ -144,11 +144,11 @@ namespace IW4
|
|||||||
case WFT_NOTETRACKSOUNDMAP:
|
case WFT_NOTETRACKSOUNDMAP:
|
||||||
{
|
{
|
||||||
const auto* keys = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
|
const auto* keys = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
|
||||||
const auto* values = &keys[std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value];
|
const auto* values = &keys[std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)>];
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value; i++)
|
for (auto i = 0u; i < std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)>; i++)
|
||||||
{
|
{
|
||||||
const auto& key = m_get_scr_string(keys[i]);
|
const auto& key = m_get_scr_string(keys[i]);
|
||||||
const auto& value = m_get_scr_string(values[i]);
|
const auto& value = m_get_scr_string(values[i]);
|
||||||
@ -173,11 +173,11 @@ namespace IW4
|
|||||||
case WFT_NOTETRACKRUMBLEMAP:
|
case WFT_NOTETRACKRUMBLEMAP:
|
||||||
{
|
{
|
||||||
const auto* keys = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
|
const auto* keys = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
|
||||||
const auto* values = &keys[std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value];
|
const auto* values = &keys[std::extent_v<decltype(WeaponFullDef::notetrackRumbleMapKeys)>];
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value; i++)
|
for (auto i = 0u; i < std::extent_v<decltype(WeaponFullDef::notetrackRumbleMapKeys)>; i++)
|
||||||
{
|
{
|
||||||
const auto& key = m_get_scr_string(keys[i]);
|
const auto& key = m_get_scr_string(keys[i]);
|
||||||
const auto& value = m_get_scr_string(values[i]);
|
const auto& value = m_get_scr_string(values[i]);
|
||||||
@ -229,8 +229,8 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponCompleteDef* weapon, WeaponFul
|
|||||||
|
|
||||||
if (weapon->hideTags)
|
if (weapon->hideTags)
|
||||||
{
|
{
|
||||||
assert(sizeof(WeaponFullDef::hideTags) >= sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::hideTags)>::value);
|
assert(sizeof(WeaponFullDef::hideTags) >= sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::hideTags)>);
|
||||||
memcpy(fullDef->hideTags, weapon->hideTags, sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::hideTags)>::value);
|
memcpy(fullDef->hideTags, weapon->hideTags, sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::hideTags)>);
|
||||||
fullDef->weapCompleteDef.hideTags = fullDef->hideTags;
|
fullDef->weapCompleteDef.hideTags = fullDef->hideTags;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,8 +243,8 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponCompleteDef* weapon, WeaponFul
|
|||||||
|
|
||||||
if (fullDef->weapDef.gunXModel)
|
if (fullDef->weapDef.gunXModel)
|
||||||
{
|
{
|
||||||
assert(sizeof(WeaponFullDef::gunXModel) >= sizeof(void*) * std::extent<decltype(WeaponFullDef::gunXModel)>::value);
|
assert(sizeof(WeaponFullDef::gunXModel) >= sizeof(void*) * std::extent_v<decltype(WeaponFullDef::gunXModel)>);
|
||||||
memcpy(fullDef->gunXModel, fullDef->weapDef.gunXModel, sizeof(void*) * std::extent<decltype(WeaponFullDef::gunXModel)>::value);
|
memcpy(fullDef->gunXModel, fullDef->weapDef.gunXModel, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::gunXModel)>);
|
||||||
fullDef->weapDef.gunXModel = fullDef->gunXModel;
|
fullDef->weapDef.gunXModel = fullDef->gunXModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,69 +264,67 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponCompleteDef* weapon, WeaponFul
|
|||||||
|
|
||||||
if (fullDef->weapDef.notetrackSoundMapKeys)
|
if (fullDef->weapDef.notetrackSoundMapKeys)
|
||||||
{
|
{
|
||||||
assert(sizeof(WeaponFullDef::notetrackSoundMapKeys) >= sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value);
|
assert(sizeof(WeaponFullDef::notetrackSoundMapKeys) >= sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)>);
|
||||||
memcpy(fullDef->notetrackSoundMapKeys,
|
memcpy(fullDef->notetrackSoundMapKeys,
|
||||||
fullDef->weapDef.notetrackSoundMapKeys,
|
fullDef->weapDef.notetrackSoundMapKeys,
|
||||||
sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value);
|
sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)>);
|
||||||
fullDef->weapDef.notetrackSoundMapKeys = fullDef->notetrackSoundMapKeys;
|
fullDef->weapDef.notetrackSoundMapKeys = fullDef->notetrackSoundMapKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fullDef->weapDef.notetrackSoundMapValues)
|
if (fullDef->weapDef.notetrackSoundMapValues)
|
||||||
{
|
{
|
||||||
assert(sizeof(WeaponFullDef::notetrackSoundMapValues) >= sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value);
|
assert(sizeof(WeaponFullDef::notetrackSoundMapValues) >= sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)>);
|
||||||
memcpy(fullDef->notetrackSoundMapValues,
|
memcpy(fullDef->notetrackSoundMapValues,
|
||||||
fullDef->weapDef.notetrackSoundMapValues,
|
fullDef->weapDef.notetrackSoundMapValues,
|
||||||
sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value);
|
sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)>);
|
||||||
fullDef->weapDef.notetrackSoundMapValues = fullDef->notetrackSoundMapValues;
|
fullDef->weapDef.notetrackSoundMapValues = fullDef->notetrackSoundMapValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fullDef->weapDef.notetrackRumbleMapKeys)
|
if (fullDef->weapDef.notetrackRumbleMapKeys)
|
||||||
{
|
{
|
||||||
assert(sizeof(WeaponFullDef::notetrackRumbleMapKeys) >= sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value);
|
assert(sizeof(WeaponFullDef::notetrackRumbleMapKeys) >= sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::notetrackRumbleMapKeys)>);
|
||||||
memcpy(fullDef->notetrackRumbleMapKeys,
|
memcpy(fullDef->notetrackRumbleMapKeys,
|
||||||
fullDef->weapDef.notetrackRumbleMapKeys,
|
fullDef->weapDef.notetrackRumbleMapKeys,
|
||||||
sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value);
|
sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::notetrackRumbleMapKeys)>);
|
||||||
fullDef->weapDef.notetrackRumbleMapKeys = fullDef->notetrackRumbleMapKeys;
|
fullDef->weapDef.notetrackRumbleMapKeys = fullDef->notetrackRumbleMapKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fullDef->weapDef.notetrackRumbleMapValues)
|
if (fullDef->weapDef.notetrackRumbleMapValues)
|
||||||
{
|
{
|
||||||
assert(sizeof(WeaponFullDef::notetrackRumbleMapValues) >= sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value);
|
assert(sizeof(WeaponFullDef::notetrackRumbleMapValues) >= sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::notetrackRumbleMapKeys)>);
|
||||||
memcpy(fullDef->notetrackRumbleMapValues,
|
memcpy(fullDef->notetrackRumbleMapValues,
|
||||||
fullDef->weapDef.notetrackRumbleMapValues,
|
fullDef->weapDef.notetrackRumbleMapValues,
|
||||||
sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value);
|
sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::notetrackRumbleMapKeys)>);
|
||||||
fullDef->weapDef.notetrackRumbleMapValues = fullDef->notetrackRumbleMapValues;
|
fullDef->weapDef.notetrackRumbleMapValues = fullDef->notetrackRumbleMapValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fullDef->weapDef.worldModel)
|
if (fullDef->weapDef.worldModel)
|
||||||
{
|
{
|
||||||
assert(sizeof(WeaponFullDef::worldModel) >= sizeof(void*) * std::extent<decltype(WeaponFullDef::worldModel)>::value);
|
assert(sizeof(WeaponFullDef::worldModel) >= sizeof(void*) * std::extent_v<decltype(WeaponFullDef::worldModel)>);
|
||||||
memcpy(fullDef->worldModel, fullDef->weapDef.worldModel, sizeof(void*) * std::extent<decltype(WeaponFullDef::worldModel)>::value);
|
memcpy(fullDef->worldModel, fullDef->weapDef.worldModel, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::worldModel)>);
|
||||||
fullDef->weapDef.worldModel = fullDef->worldModel;
|
fullDef->weapDef.worldModel = fullDef->worldModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fullDef->weapDef.parallelBounce)
|
if (fullDef->weapDef.parallelBounce)
|
||||||
{
|
{
|
||||||
assert(sizeof(WeaponFullDef::parallelBounce) >= sizeof(float) * std::extent<decltype(WeaponFullDef::parallelBounce)>::value);
|
assert(sizeof(WeaponFullDef::parallelBounce) >= sizeof(float) * std::extent_v<decltype(WeaponFullDef::parallelBounce)>);
|
||||||
memcpy(fullDef->parallelBounce, fullDef->weapDef.parallelBounce, sizeof(float) * std::extent<decltype(WeaponFullDef::parallelBounce)>::value);
|
memcpy(fullDef->parallelBounce, fullDef->weapDef.parallelBounce, sizeof(float) * std::extent_v<decltype(WeaponFullDef::parallelBounce)>);
|
||||||
fullDef->weapDef.parallelBounce = fullDef->parallelBounce;
|
fullDef->weapDef.parallelBounce = fullDef->parallelBounce;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fullDef->weapDef.perpendicularBounce)
|
if (fullDef->weapDef.perpendicularBounce)
|
||||||
{
|
{
|
||||||
assert(sizeof(WeaponFullDef::perpendicularBounce) >= sizeof(float) * std::extent<decltype(WeaponFullDef::perpendicularBounce)>::value);
|
assert(sizeof(WeaponFullDef::perpendicularBounce) >= sizeof(float) * std::extent_v<decltype(WeaponFullDef::perpendicularBounce)>);
|
||||||
memcpy(fullDef->perpendicularBounce,
|
memcpy(fullDef->perpendicularBounce, fullDef->weapDef.perpendicularBounce, sizeof(float) * std::extent_v<decltype(WeaponFullDef::perpendicularBounce)>);
|
||||||
fullDef->weapDef.perpendicularBounce,
|
|
||||||
sizeof(float) * std::extent<decltype(WeaponFullDef::perpendicularBounce)>::value);
|
|
||||||
fullDef->weapDef.perpendicularBounce = fullDef->perpendicularBounce;
|
fullDef->weapDef.perpendicularBounce = fullDef->perpendicularBounce;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fullDef->weapDef.locationDamageMultipliers)
|
if (fullDef->weapDef.locationDamageMultipliers)
|
||||||
{
|
{
|
||||||
assert(sizeof(WeaponFullDef::locationDamageMultipliers) >= sizeof(float) * std::extent<decltype(WeaponFullDef::locationDamageMultipliers)>::value);
|
assert(sizeof(WeaponFullDef::locationDamageMultipliers) >= sizeof(float) * std::extent_v<decltype(WeaponFullDef::locationDamageMultipliers)>);
|
||||||
memcpy(fullDef->locationDamageMultipliers,
|
memcpy(fullDef->locationDamageMultipliers,
|
||||||
fullDef->weapDef.locationDamageMultipliers,
|
fullDef->weapDef.locationDamageMultipliers,
|
||||||
sizeof(float) * std::extent<decltype(WeaponFullDef::locationDamageMultipliers)>::value);
|
sizeof(float) * std::extent_v<decltype(WeaponFullDef::locationDamageMultipliers)>);
|
||||||
fullDef->weapDef.locationDamageMultipliers = fullDef->locationDamageMultipliers;
|
fullDef->weapDef.locationDamageMultipliers = fullDef->locationDamageMultipliers;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -339,7 +337,7 @@ InfoString AssetDumperWeapon::CreateInfoString(XAssetInfo<WeaponCompleteDef>* as
|
|||||||
|
|
||||||
InfoStringFromWeaponConverter converter(fullDef.get(),
|
InfoStringFromWeaponConverter converter(fullDef.get(),
|
||||||
weapon_fields,
|
weapon_fields,
|
||||||
std::extent<decltype(weapon_fields)>::value,
|
std::extent_v<decltype(weapon_fields)>,
|
||||||
[asset](const scr_string_t scrStr) -> std::string
|
[asset](const scr_string_t scrStr) -> std::string
|
||||||
{
|
{
|
||||||
assert(scrStr < asset->m_zone->m_script_strings.Count());
|
assert(scrStr < asset->m_zone->m_script_strings.Count());
|
||||||
|
@ -44,17 +44,17 @@ void AssetDumperRawFile::DumpAsset(AssetDumpingContext& context, XAssetInfo<RawF
|
|||||||
while (zs.avail_in > 0)
|
while (zs.avail_in > 0)
|
||||||
{
|
{
|
||||||
zs.next_out = buffer;
|
zs.next_out = buffer;
|
||||||
zs.avail_out = sizeof buffer;
|
zs.avail_out = sizeof(buffer);
|
||||||
ret = inflate(&zs, Z_SYNC_FLUSH);
|
ret = inflate(&zs, Z_SYNC_FLUSH);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
std::cerr << "Inflate failed when attempting to dump rawfile " << rawFile->name << std::endl;
|
std::cerr << "Inflate failed when attempting to dump rawfile " << rawFile->name << "\n";
|
||||||
inflateEnd(&zs);
|
inflateEnd(&zs);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream.write(reinterpret_cast<char*>(buffer), sizeof buffer - zs.avail_out);
|
stream.write(reinterpret_cast<char*>(buffer), sizeof(buffer) - zs.avail_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
inflateEnd(&zs);
|
inflateEnd(&zs);
|
||||||
|
@ -14,7 +14,7 @@ void AssetDumperRawFile::DumpGsc(AssetDumpingContext& context, XAssetInfo<RawFil
|
|||||||
|
|
||||||
if (rawFile->len <= 8)
|
if (rawFile->len <= 8)
|
||||||
{
|
{
|
||||||
std::cout << "Invalid len of gsc file \"" << rawFile->name << "\"" << std::endl;
|
std::cout << "Invalid len of gsc file \"" << rawFile->name << "\"\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,13 +25,13 @@ void AssetDumperRawFile::DumpGsc(AssetDumpingContext& context, XAssetInfo<RawFil
|
|||||||
|
|
||||||
if (inLen > static_cast<unsigned>(rawFile->len - 8) + 1)
|
if (inLen > static_cast<unsigned>(rawFile->len - 8) + 1)
|
||||||
{
|
{
|
||||||
std::cout << "Invalid compression of gsc file \"" << rawFile->name << "\": " << inLen << std::endl;
|
std::cout << "Invalid compression of gsc file \"" << rawFile->name << "\": " << inLen << "\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outLen > GSC_MAX_SIZE)
|
if (outLen > GSC_MAX_SIZE)
|
||||||
{
|
{
|
||||||
std::cout << "Invalid size of gsc file \"" << rawFile->name << "\": " << outLen << std::endl;
|
std::cout << "Invalid size of gsc file \"" << rawFile->name << "\": " << outLen << "\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,17 +59,17 @@ void AssetDumperRawFile::DumpGsc(AssetDumpingContext& context, XAssetInfo<RawFil
|
|||||||
while (zs.avail_in > 0)
|
while (zs.avail_in > 0)
|
||||||
{
|
{
|
||||||
zs.next_out = buffer;
|
zs.next_out = buffer;
|
||||||
zs.avail_out = sizeof buffer;
|
zs.avail_out = sizeof(buffer);
|
||||||
ret = inflate(&zs, Z_SYNC_FLUSH);
|
ret = inflate(&zs, Z_SYNC_FLUSH);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
std::cout << "Inflate failed for dumping gsc file \"" << rawFile->name << "\"" << std::endl;
|
std::cout << "Inflate failed for dumping gsc file \"" << rawFile->name << "\"\n";
|
||||||
inflateEnd(&zs);
|
inflateEnd(&zs);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto inflateOutSize = sizeof buffer - zs.avail_out;
|
const auto inflateOutSize = sizeof(buffer) - zs.avail_out;
|
||||||
|
|
||||||
if (writtenSize + inflateOutSize >= outLen)
|
if (writtenSize + inflateOutSize >= outLen)
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,7 @@ namespace T6
|
|||||||
switch (static_cast<constraintsFieldType_t>(field.iFieldType))
|
switch (static_cast<constraintsFieldType_t>(field.iFieldType))
|
||||||
{
|
{
|
||||||
case CFT_TYPE:
|
case CFT_TYPE:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, s_constraintTypeNames, std::extent<decltype(s_constraintTypeNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, s_constraintTypeNames, std::extent_v<decltype(s_constraintTypeNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -46,7 +46,7 @@ InfoString AssetDumperPhysConstraints::CreateInfoString(XAssetInfo<PhysConstrain
|
|||||||
|
|
||||||
InfoStringFromPhysConstraintsConverter converter(asset->Asset(),
|
InfoStringFromPhysConstraintsConverter converter(asset->Asset(),
|
||||||
phys_constraints_fields,
|
phys_constraints_fields,
|
||||||
std::extent<decltype(phys_constraints_fields)>::value,
|
std::extent_v<decltype(phys_constraints_fields)>,
|
||||||
[asset](const scr_string_t scrStr) -> std::string
|
[asset](const scr_string_t scrStr) -> std::string
|
||||||
{
|
{
|
||||||
assert(scrStr < asset->m_zone->m_script_strings.Count());
|
assert(scrStr < asset->m_zone->m_script_strings.Count());
|
||||||
|
@ -66,7 +66,7 @@ InfoString AssetDumperPhysPreset::CreateInfoString(XAssetInfo<PhysPreset>* asset
|
|||||||
|
|
||||||
InfoStringFromPhysPresetConverter converter(physPresetInfo,
|
InfoStringFromPhysPresetConverter converter(physPresetInfo,
|
||||||
phys_preset_fields,
|
phys_preset_fields,
|
||||||
std::extent<decltype(phys_preset_fields)>::value,
|
std::extent_v<decltype(phys_preset_fields)>,
|
||||||
[asset](const scr_string_t scrStr) -> std::string
|
[asset](const scr_string_t scrStr) -> std::string
|
||||||
{
|
{
|
||||||
assert(scrStr < asset->m_zone->m_script_strings.Count());
|
assert(scrStr < asset->m_zone->m_script_strings.Count());
|
||||||
|
@ -19,7 +19,7 @@ void AssetDumperRawFile::DumpAnimtree(AssetDumpingContext& context, XAssetInfo<R
|
|||||||
|
|
||||||
if (rawFile->len <= 4)
|
if (rawFile->len <= 4)
|
||||||
{
|
{
|
||||||
std::cerr << "Invalid len of animtree file \"" << rawFile->name << "\"" << std::endl;
|
std::cerr << "Invalid len of animtree file \"" << rawFile->name << "\"\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ void AssetDumperRawFile::DumpAnimtree(AssetDumpingContext& context, XAssetInfo<R
|
|||||||
|
|
||||||
if (outLen > ANIMTREE_MAX_SIZE)
|
if (outLen > ANIMTREE_MAX_SIZE)
|
||||||
{
|
{
|
||||||
std::cerr << "Invalid size of animtree file \"" << rawFile->name << "\": " << outLen << std::endl;
|
std::cerr << "Invalid size of animtree file \"" << rawFile->name << "\": " << outLen << "\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,17 +55,17 @@ void AssetDumperRawFile::DumpAnimtree(AssetDumpingContext& context, XAssetInfo<R
|
|||||||
while (zs.avail_in > 0)
|
while (zs.avail_in > 0)
|
||||||
{
|
{
|
||||||
zs.next_out = buffer;
|
zs.next_out = buffer;
|
||||||
zs.avail_out = sizeof buffer;
|
zs.avail_out = sizeof(buffer);
|
||||||
ret = inflate(&zs, Z_SYNC_FLUSH);
|
ret = inflate(&zs, Z_SYNC_FLUSH);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
std::cerr << "Inflate failed for dumping animtree file \"" << rawFile->name << "\"" << std::endl;
|
std::cerr << "Inflate failed for dumping animtree file \"" << rawFile->name << "\"\n";
|
||||||
inflateEnd(&zs);
|
inflateEnd(&zs);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto inflateOutSize = sizeof buffer - zs.avail_out;
|
const auto inflateOutSize = sizeof(buffer) - zs.avail_out;
|
||||||
|
|
||||||
stream.write(reinterpret_cast<char*>(buffer), inflateOutSize);
|
stream.write(reinterpret_cast<char*>(buffer), inflateOutSize);
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ class AssetDumperSndBank::Internal
|
|||||||
{
|
{
|
||||||
fs::path assetPath(m_context.m_base_path);
|
fs::path assetPath(m_context.m_base_path);
|
||||||
|
|
||||||
std::replace(outputFileName.begin(), outputFileName.end(), '\\', '/');
|
std::ranges::replace(outputFileName, '\\', '/');
|
||||||
for (const auto& droppedPrefix : PREFIXES_TO_DROP)
|
for (const auto& droppedPrefix : PREFIXES_TO_DROP)
|
||||||
{
|
{
|
||||||
if (outputFileName.rfind(droppedPrefix, 0) != std::string::npos)
|
if (outputFileName.rfind(droppedPrefix, 0) != std::string::npos)
|
||||||
@ -638,7 +638,7 @@ class AssetDumperSndBank::Internal
|
|||||||
}
|
}
|
||||||
|
|
||||||
duckObj["values"] = values;
|
duckObj["values"] = values;
|
||||||
*duckFile << duckObj.dump(4) << std::endl;
|
*duckFile << duckObj.dump(4) << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ class AssetDumperSndDriverGlobals::Internal
|
|||||||
auto outputFile = this->m_context.OpenAssetFile(filename);
|
auto outputFile = this->m_context.OpenAssetFile(filename);
|
||||||
if (outputFile == nullptr)
|
if (outputFile == nullptr)
|
||||||
{
|
{
|
||||||
std::cout << "Failed to open sound driver globals output file for: \"" << filename << "\"" << std::endl;
|
std::cout << "Failed to open sound driver globals output file for: \"" << filename << "\"\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
return outputFile;
|
return outputFile;
|
||||||
|
@ -20,7 +20,7 @@ namespace T6
|
|||||||
switch (static_cast<tracerFieldType_t>(field.iFieldType))
|
switch (static_cast<tracerFieldType_t>(field.iFieldType))
|
||||||
{
|
{
|
||||||
case TFT_TRACERTYPE:
|
case TFT_TRACERTYPE:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, tracerTypeNames, std::extent<decltype(tracerTypeNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, tracerTypeNames, std::extent_v<decltype(tracerTypeNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TFT_NUM_FIELD_TYPES:
|
case TFT_NUM_FIELD_TYPES:
|
||||||
@ -45,7 +45,7 @@ InfoString AssetDumperTracer::CreateInfoString(XAssetInfo<TracerDef>* asset)
|
|||||||
{
|
{
|
||||||
InfoStringFromTracerConverter converter(asset->Asset(),
|
InfoStringFromTracerConverter converter(asset->Asset(),
|
||||||
tracer_fields,
|
tracer_fields,
|
||||||
std::extent<decltype(tracer_fields)>::value,
|
std::extent_v<decltype(tracer_fields)>,
|
||||||
[asset](const scr_string_t scrStr) -> std::string
|
[asset](const scr_string_t scrStr) -> std::string
|
||||||
{
|
{
|
||||||
assert(scrStr < asset->m_zone->m_script_strings.Count());
|
assert(scrStr < asset->m_zone->m_script_strings.Count());
|
||||||
|
@ -20,15 +20,15 @@ namespace T6
|
|||||||
switch (static_cast<VehicleFieldType>(field.iFieldType))
|
switch (static_cast<VehicleFieldType>(field.iFieldType))
|
||||||
{
|
{
|
||||||
case VFT_TYPE:
|
case VFT_TYPE:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, s_vehicleClassNames, std::extent<decltype(s_vehicleClassNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, s_vehicleClassNames, std::extent_v<decltype(s_vehicleClassNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VFT_CAMERAMODE:
|
case VFT_CAMERAMODE:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, s_vehicleCameraModes, std::extent<decltype(s_vehicleCameraModes)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, s_vehicleCameraModes, std::extent_v<decltype(s_vehicleCameraModes)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VFT_TRACTION_TYPE:
|
case VFT_TRACTION_TYPE:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, s_tractionTypeNames, std::extent<decltype(s_tractionTypeNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, s_tractionTypeNames, std::extent_v<decltype(s_tractionTypeNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VFT_MPH_TO_INCHES_PER_SECOND:
|
case VFT_MPH_TO_INCHES_PER_SECOND:
|
||||||
@ -95,7 +95,7 @@ InfoString AssetDumperVehicle::CreateInfoString(XAssetInfo<VehicleDef>* asset)
|
|||||||
{
|
{
|
||||||
InfoStringFromVehicleConverter converter(asset->Asset(),
|
InfoStringFromVehicleConverter converter(asset->Asset(),
|
||||||
vehicle_fields,
|
vehicle_fields,
|
||||||
std::extent<decltype(vehicle_fields)>::value,
|
std::extent_v<decltype(vehicle_fields)>,
|
||||||
[asset](const scr_string_t scrStr) -> std::string
|
[asset](const scr_string_t scrStr) -> std::string
|
||||||
{
|
{
|
||||||
assert(scrStr < asset->m_zone->m_script_strings.Count());
|
assert(scrStr < asset->m_zone->m_script_strings.Count());
|
||||||
|
@ -277,21 +277,21 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponVariantDef* weapon, WeaponFull
|
|||||||
|
|
||||||
if (weapon->attachments)
|
if (weapon->attachments)
|
||||||
{
|
{
|
||||||
assert(sizeof(WeaponFullDef::attachments) >= sizeof(void*) * std::extent<decltype(WeaponFullDef::attachments)>::value);
|
assert(sizeof(WeaponFullDef::attachments) >= sizeof(void*) * std::extent_v<decltype(WeaponFullDef::attachments)>);
|
||||||
memcpy(fullDef->attachments, weapon->attachments, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::attachments)>);
|
memcpy(fullDef->attachments, weapon->attachments, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::attachments)>);
|
||||||
fullDef->weapVariantDef.attachments = fullDef->attachments;
|
fullDef->weapVariantDef.attachments = fullDef->attachments;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (weapon->attachmentUniques)
|
if (weapon->attachmentUniques)
|
||||||
{
|
{
|
||||||
assert(sizeof(WeaponFullDef::attachmentUniques) >= sizeof(void*) * std::extent<decltype(WeaponFullDef::attachmentUniques)>::value);
|
assert(sizeof(WeaponFullDef::attachmentUniques) >= sizeof(void*) * std::extent_v<decltype(WeaponFullDef::attachmentUniques)>);
|
||||||
memcpy(fullDef->attachmentUniques, weapon->attachmentUniques, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::attachmentUniques)>);
|
memcpy(fullDef->attachmentUniques, weapon->attachmentUniques, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::attachmentUniques)>);
|
||||||
fullDef->weapVariantDef.attachmentUniques = fullDef->attachmentUniques;
|
fullDef->weapVariantDef.attachmentUniques = fullDef->attachmentUniques;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fullDef->weapDef.gunXModel)
|
if (fullDef->weapDef.gunXModel)
|
||||||
{
|
{
|
||||||
assert(sizeof(WeaponFullDef::gunXModel) >= sizeof(void*) * std::extent<decltype(WeaponFullDef::gunXModel)>::value);
|
assert(sizeof(WeaponFullDef::gunXModel) >= sizeof(void*) * std::extent_v<decltype(WeaponFullDef::gunXModel)>);
|
||||||
memcpy(fullDef->gunXModel, fullDef->weapDef.gunXModel, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::gunXModel)>);
|
memcpy(fullDef->gunXModel, fullDef->weapDef.gunXModel, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::gunXModel)>);
|
||||||
fullDef->weapDef.gunXModel = fullDef->gunXModel;
|
fullDef->weapDef.gunXModel = fullDef->gunXModel;
|
||||||
}
|
}
|
||||||
@ -305,14 +305,14 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponVariantDef* weapon, WeaponFull
|
|||||||
|
|
||||||
if (weapon->hideTags)
|
if (weapon->hideTags)
|
||||||
{
|
{
|
||||||
assert(sizeof(WeaponFullDef::hideTags) >= sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::hideTags)>::value);
|
assert(sizeof(WeaponFullDef::hideTags) >= sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::hideTags)>);
|
||||||
memcpy(fullDef->hideTags, weapon->hideTags, sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::hideTags)>);
|
memcpy(fullDef->hideTags, weapon->hideTags, sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::hideTags)>);
|
||||||
fullDef->weapVariantDef.hideTags = fullDef->hideTags;
|
fullDef->weapVariantDef.hideTags = fullDef->hideTags;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fullDef->weapDef.notetrackSoundMapKeys)
|
if (fullDef->weapDef.notetrackSoundMapKeys)
|
||||||
{
|
{
|
||||||
assert(sizeof(WeaponFullDef::notetrackSoundMapKeys) >= sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value);
|
assert(sizeof(WeaponFullDef::notetrackSoundMapKeys) >= sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)>);
|
||||||
memcpy(fullDef->notetrackSoundMapKeys,
|
memcpy(fullDef->notetrackSoundMapKeys,
|
||||||
fullDef->weapDef.notetrackSoundMapKeys,
|
fullDef->weapDef.notetrackSoundMapKeys,
|
||||||
sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)>);
|
sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)>);
|
||||||
@ -321,7 +321,7 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponVariantDef* weapon, WeaponFull
|
|||||||
|
|
||||||
if (fullDef->weapDef.notetrackSoundMapValues)
|
if (fullDef->weapDef.notetrackSoundMapValues)
|
||||||
{
|
{
|
||||||
assert(sizeof(WeaponFullDef::notetrackSoundMapValues) >= sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackSoundMapValues)>::value);
|
assert(sizeof(WeaponFullDef::notetrackSoundMapValues) >= sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::notetrackSoundMapValues)>);
|
||||||
memcpy(fullDef->notetrackSoundMapValues,
|
memcpy(fullDef->notetrackSoundMapValues,
|
||||||
fullDef->weapDef.notetrackSoundMapValues,
|
fullDef->weapDef.notetrackSoundMapValues,
|
||||||
sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::notetrackSoundMapValues)>);
|
sizeof(scr_string_t) * std::extent_v<decltype(WeaponFullDef::notetrackSoundMapValues)>);
|
||||||
@ -330,35 +330,35 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponVariantDef* weapon, WeaponFull
|
|||||||
|
|
||||||
if (fullDef->weapDef.worldModel)
|
if (fullDef->weapDef.worldModel)
|
||||||
{
|
{
|
||||||
assert(sizeof(WeaponFullDef::worldModel) >= sizeof(void*) * std::extent<decltype(WeaponFullDef::worldModel)>::value);
|
assert(sizeof(WeaponFullDef::worldModel) >= sizeof(void*) * std::extent_v<decltype(WeaponFullDef::worldModel)>);
|
||||||
memcpy(fullDef->worldModel, fullDef->weapDef.worldModel, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::worldModel)>);
|
memcpy(fullDef->worldModel, fullDef->weapDef.worldModel, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::worldModel)>);
|
||||||
fullDef->weapDef.worldModel = fullDef->worldModel;
|
fullDef->weapDef.worldModel = fullDef->worldModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (weapon->attachViewModel)
|
if (weapon->attachViewModel)
|
||||||
{
|
{
|
||||||
assert(sizeof(WeaponFullDef::attachViewModel) >= sizeof(void*) * std::extent<decltype(WeaponFullDef::attachViewModel)>::value);
|
assert(sizeof(WeaponFullDef::attachViewModel) >= sizeof(void*) * std::extent_v<decltype(WeaponFullDef::attachViewModel)>);
|
||||||
memcpy(fullDef->attachViewModel, weapon->attachViewModel, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::attachViewModel)>);
|
memcpy(fullDef->attachViewModel, weapon->attachViewModel, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::attachViewModel)>);
|
||||||
fullDef->weapVariantDef.attachViewModel = fullDef->attachViewModel;
|
fullDef->weapVariantDef.attachViewModel = fullDef->attachViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (weapon->attachWorldModel)
|
if (weapon->attachWorldModel)
|
||||||
{
|
{
|
||||||
assert(sizeof(WeaponFullDef::attachWorldModel) >= sizeof(void*) * std::extent<decltype(WeaponFullDef::attachWorldModel)>::value);
|
assert(sizeof(WeaponFullDef::attachWorldModel) >= sizeof(void*) * std::extent_v<decltype(WeaponFullDef::attachWorldModel)>);
|
||||||
memcpy(fullDef->attachWorldModel, weapon->attachWorldModel, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::attachWorldModel)>);
|
memcpy(fullDef->attachWorldModel, weapon->attachWorldModel, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::attachWorldModel)>);
|
||||||
fullDef->weapVariantDef.attachWorldModel = fullDef->attachWorldModel;
|
fullDef->weapVariantDef.attachWorldModel = fullDef->attachWorldModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (weapon->attachViewModelTag)
|
if (weapon->attachViewModelTag)
|
||||||
{
|
{
|
||||||
assert(sizeof(WeaponFullDef::attachViewModelTag) >= sizeof(void*) * std::extent<decltype(WeaponFullDef::attachViewModelTag)>::value);
|
assert(sizeof(WeaponFullDef::attachViewModelTag) >= sizeof(void*) * std::extent_v<decltype(WeaponFullDef::attachViewModelTag)>);
|
||||||
memcpy(fullDef->attachViewModelTag, weapon->attachViewModelTag, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::attachViewModelTag)>);
|
memcpy(fullDef->attachViewModelTag, weapon->attachViewModelTag, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::attachViewModelTag)>);
|
||||||
fullDef->weapVariantDef.attachViewModelTag = fullDef->attachViewModelTag;
|
fullDef->weapVariantDef.attachViewModelTag = fullDef->attachViewModelTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (weapon->attachWorldModelTag)
|
if (weapon->attachWorldModelTag)
|
||||||
{
|
{
|
||||||
assert(sizeof(WeaponFullDef::attachWorldModelTag) >= sizeof(void*) * std::extent<decltype(WeaponFullDef::attachWorldModelTag)>::value);
|
assert(sizeof(WeaponFullDef::attachWorldModelTag) >= sizeof(void*) * std::extent_v<decltype(WeaponFullDef::attachWorldModelTag)>);
|
||||||
memcpy(fullDef->attachWorldModelTag, weapon->attachWorldModelTag, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::attachWorldModelTag)>);
|
memcpy(fullDef->attachWorldModelTag, weapon->attachWorldModelTag, sizeof(void*) * std::extent_v<decltype(WeaponFullDef::attachWorldModelTag)>);
|
||||||
fullDef->weapVariantDef.attachWorldModelTag = fullDef->attachWorldModelTag;
|
fullDef->weapVariantDef.attachWorldModelTag = fullDef->attachWorldModelTag;
|
||||||
}
|
}
|
||||||
|
@ -20,15 +20,15 @@ namespace T6
|
|||||||
switch (static_cast<attachmentFieldType_t>(field.iFieldType))
|
switch (static_cast<attachmentFieldType_t>(field.iFieldType))
|
||||||
{
|
{
|
||||||
case AFT_ATTACHMENTTYPE:
|
case AFT_ATTACHMENTTYPE:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szAttachmentTypeNames, std::extent<decltype(szAttachmentTypeNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, szAttachmentTypeNames, std::extent_v<decltype(szAttachmentTypeNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AFT_PENETRATE_TYPE:
|
case AFT_PENETRATE_TYPE:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, penetrateTypeNames, std::extent<decltype(penetrateTypeNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, penetrateTypeNames, std::extent_v<decltype(penetrateTypeNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AFT_FIRETYPE:
|
case AFT_FIRETYPE:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapFireTypeNames, std::extent<decltype(szWeapFireTypeNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapFireTypeNames, std::extent_v<decltype(szWeapFireTypeNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -51,7 +51,7 @@ InfoString AssetDumperWeaponAttachment::CreateInfoString(XAssetInfo<WeaponAttach
|
|||||||
{
|
{
|
||||||
InfoStringFromAttachmentConverter converter(asset->Asset(),
|
InfoStringFromAttachmentConverter converter(asset->Asset(),
|
||||||
attachment_fields,
|
attachment_fields,
|
||||||
std::extent<decltype(attachment_fields)>::value,
|
std::extent_v<decltype(attachment_fields)>,
|
||||||
[asset](const scr_string_t scrStr) -> std::string
|
[asset](const scr_string_t scrStr) -> std::string
|
||||||
{
|
{
|
||||||
assert(scrStr < asset->m_zone->m_script_strings.Count());
|
assert(scrStr < asset->m_zone->m_script_strings.Count());
|
||||||
|
@ -22,7 +22,7 @@ namespace T6
|
|||||||
switch (static_cast<attachmentUniqueFieldType_t>(field.iFieldType))
|
switch (static_cast<attachmentUniqueFieldType_t>(field.iFieldType))
|
||||||
{
|
{
|
||||||
case AUFT_ATTACHMENTTYPE:
|
case AUFT_ATTACHMENTTYPE:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szAttachmentTypeNames, std::extent<decltype(szAttachmentTypeNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, szAttachmentTypeNames, std::extent_v<decltype(szAttachmentTypeNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AUFT_HIDETAGS:
|
case AUFT_HIDETAGS:
|
||||||
@ -31,7 +31,7 @@ namespace T6
|
|||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
auto first = true;
|
auto first = true;
|
||||||
|
|
||||||
for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::hideTags)>::value; i++)
|
for (auto i = 0u; i < std::extent_v<decltype(WeaponFullDef::hideTags)>; i++)
|
||||||
{
|
{
|
||||||
const auto& str = m_get_scr_string(hideTags[i]);
|
const auto& str = m_get_scr_string(hideTags[i]);
|
||||||
if (!str.empty())
|
if (!str.empty())
|
||||||
@ -50,7 +50,7 @@ namespace T6
|
|||||||
}
|
}
|
||||||
|
|
||||||
case AUFT_OVERLAYRETICLE:
|
case AUFT_OVERLAYRETICLE:
|
||||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapOverlayReticleNames, std::extent<decltype(szWeapOverlayReticleNames)>::value);
|
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapOverlayReticleNames, std::extent_v<decltype(szWeapOverlayReticleNames)>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AUFT_CAMO:
|
case AUFT_CAMO:
|
||||||
@ -94,8 +94,8 @@ void AssetDumperWeaponAttachmentUnique::CopyToFullDef(const WeaponAttachmentUniq
|
|||||||
|
|
||||||
if (attachment->hideTags)
|
if (attachment->hideTags)
|
||||||
{
|
{
|
||||||
assert(sizeof(WeaponAttachmentUniqueFull::hideTags) >= sizeof(scr_string_t) * std::extent<decltype(WeaponAttachmentUniqueFull::hideTags)>::value);
|
assert(sizeof(WeaponAttachmentUniqueFull::hideTags) >= sizeof(scr_string_t) * std::extent_v<decltype(WeaponAttachmentUniqueFull::hideTags)>);
|
||||||
memcpy(fullDef->hideTags, attachment->hideTags, sizeof(scr_string_t) * std::extent<decltype(WeaponAttachmentUniqueFull::hideTags)>::value);
|
memcpy(fullDef->hideTags, attachment->hideTags, sizeof(scr_string_t) * std::extent_v<decltype(WeaponAttachmentUniqueFull::hideTags)>);
|
||||||
fullDef->attachment.hideTags = fullDef->hideTags;
|
fullDef->attachment.hideTags = fullDef->hideTags;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ InfoString AssetDumperWeaponAttachmentUnique::CreateInfoString(XAssetInfo<Weapon
|
|||||||
|
|
||||||
InfoStringFromWeaponAttachmentUniqueConverter converter(fullDef.get(),
|
InfoStringFromWeaponAttachmentUniqueConverter converter(fullDef.get(),
|
||||||
attachment_unique_fields,
|
attachment_unique_fields,
|
||||||
std::extent<decltype(attachment_unique_fields)>::value,
|
std::extent_v<decltype(attachment_unique_fields)>,
|
||||||
[asset](const scr_string_t scrStr) -> std::string
|
[asset](const scr_string_t scrStr) -> std::string
|
||||||
{
|
{
|
||||||
assert(scrStr < asset->m_zone->m_script_strings.Count());
|
assert(scrStr < asset->m_zone->m_script_strings.Count());
|
||||||
|
@ -34,7 +34,7 @@ InfoString AssetDumperZBarrier::CreateInfoString(XAssetInfo<ZBarrierDef>* asset)
|
|||||||
{
|
{
|
||||||
InfoStringFromZBarrierConverter converter(asset->Asset(),
|
InfoStringFromZBarrierConverter converter(asset->Asset(),
|
||||||
zbarrier_fields,
|
zbarrier_fields,
|
||||||
std::extent<decltype(zbarrier_fields)>::value,
|
std::extent_v<decltype(zbarrier_fields)>,
|
||||||
[asset](const scr_string_t scrStr) -> std::string
|
[asset](const scr_string_t scrStr) -> std::string
|
||||||
{
|
{
|
||||||
assert(scrStr < asset->m_zone->m_script_strings.Count());
|
assert(scrStr < asset->m_zone->m_script_strings.Count());
|
||||||
|
@ -95,7 +95,7 @@ class DdsWriterInternal
|
|||||||
|
|
||||||
void PopulateDdsHeader(DDS_HEADER& header)
|
void PopulateDdsHeader(DDS_HEADER& header)
|
||||||
{
|
{
|
||||||
header.dwSize = sizeof header;
|
header.dwSize = sizeof(header);
|
||||||
header.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT;
|
header.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT;
|
||||||
|
|
||||||
if (m_texture->HasMipMaps())
|
if (m_texture->HasMipMaps())
|
||||||
@ -201,14 +201,14 @@ public:
|
|||||||
|
|
||||||
constexpr auto magic = MakeFourCc('D', 'D', 'S', ' ');
|
constexpr auto magic = MakeFourCc('D', 'D', 'S', ' ');
|
||||||
|
|
||||||
m_stream.write(reinterpret_cast<const char*>(&magic), sizeof magic);
|
m_stream.write(reinterpret_cast<const char*>(&magic), sizeof(magic));
|
||||||
m_stream.write(reinterpret_cast<const char*>(&header), sizeof header);
|
m_stream.write(reinterpret_cast<const char*>(&header), sizeof(header));
|
||||||
|
|
||||||
if (m_use_dx10_extension)
|
if (m_use_dx10_extension)
|
||||||
{
|
{
|
||||||
DDS_HEADER_DXT10 dxt10{};
|
DDS_HEADER_DXT10 dxt10{};
|
||||||
PopulateDxt10Header(dxt10);
|
PopulateDxt10Header(dxt10);
|
||||||
m_stream.write(reinterpret_cast<const char*>(&dxt10), sizeof dxt10);
|
m_stream.write(reinterpret_cast<const char*>(&dxt10), sizeof(dxt10));
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto mipCount = m_texture->HasMipMaps() ? m_texture->GetMipMapCount() : 1;
|
const auto mipCount = m_texture->HasMipMaps() ? m_texture->GetMipMapCount() : 1;
|
||||||
|
@ -112,7 +112,7 @@ void IwiWriter::DumpImage(std::ostream& stream, Texture* texture)
|
|||||||
const auto mipLevelSize = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount();
|
const auto mipLevelSize = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount();
|
||||||
currentFileSize += mipLevelSize;
|
currentFileSize += mipLevelSize;
|
||||||
|
|
||||||
if (currentMipLevel < static_cast<int>(std::extent<decltype(iwi27::IwiHeader::fileSizeForPicmip)>::value))
|
if (currentMipLevel < static_cast<int>(std::extent_v<decltype(iwi27::IwiHeader::fileSizeForPicmip)>))
|
||||||
header.fileSizeForPicmip[currentMipLevel] = currentFileSize;
|
header.fileSizeForPicmip[currentMipLevel] = currentFileSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ void IwiWriter::DumpImage(std::ostream& stream, Texture* texture)
|
|||||||
const auto mipLevelSize = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount();
|
const auto mipLevelSize = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount();
|
||||||
currentFileSize += mipLevelSize;
|
currentFileSize += mipLevelSize;
|
||||||
|
|
||||||
if (currentMipLevel < static_cast<int>(std::extent<decltype(IwiHeader::fileSizeForPicmip)>::value))
|
if (currentMipLevel < static_cast<int>(std::extent_v<decltype(IwiHeader::fileSizeForPicmip)>))
|
||||||
header.fileSizeForPicmip[currentMipLevel] = currentFileSize;
|
header.fileSizeForPicmip[currentMipLevel] = currentFileSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ void IwiWriter::DumpImage(std::ostream& stream, Texture* texture)
|
|||||||
const auto mipLevelSize = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount();
|
const auto mipLevelSize = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount();
|
||||||
currentFileSize += mipLevelSize;
|
currentFileSize += mipLevelSize;
|
||||||
|
|
||||||
if (currentMipLevel < static_cast<int>(std::extent<decltype(IwiHeader::fileSizeForPicmip)>::value))
|
if (currentMipLevel < static_cast<int>(std::extent_v<decltype(IwiHeader::fileSizeForPicmip)>))
|
||||||
header.fileSizeForPicmip[currentMipLevel] = currentFileSize;
|
header.fileSizeForPicmip[currentMipLevel] = currentFileSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,8 +115,7 @@ bool AbstractMenuDumper::DoesTokenNeedQuotationMarks(const std::string& token)
|
|||||||
if (token.empty())
|
if (token.empty())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
const auto hasAlNumCharacter = std::any_of(token.begin(),
|
const auto hasAlNumCharacter = std::ranges::any_of(token,
|
||||||
token.end(),
|
|
||||||
[](const char& c)
|
[](const char& c)
|
||||||
{
|
{
|
||||||
return isalnum(c);
|
return isalnum(c);
|
||||||
@ -125,8 +124,7 @@ bool AbstractMenuDumper::DoesTokenNeedQuotationMarks(const std::string& token)
|
|||||||
if (!hasAlNumCharacter)
|
if (!hasAlNumCharacter)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const auto hasNonIdentifierCharacter = std::any_of(token.begin(),
|
const auto hasNonIdentifierCharacter = std::ranges::any_of(token,
|
||||||
token.end(),
|
|
||||||
[](const char& c)
|
[](const char& c)
|
||||||
{
|
{
|
||||||
return !isalnum(c) && c != '_';
|
return !isalnum(c) && c != '_';
|
||||||
|
@ -291,8 +291,7 @@ public:
|
|||||||
|
|
||||||
m_index_entries.reserve(m_images.size());
|
m_index_entries.reserve(m_images.size());
|
||||||
|
|
||||||
const auto result = std::all_of(m_images.begin(),
|
const auto result = std::ranges::all_of(m_images,
|
||||||
m_images.end(),
|
|
||||||
[this](const std::string& imageName)
|
[this](const std::string& imageName)
|
||||||
{
|
{
|
||||||
return WriteImageData(imageName);
|
return WriteImageData(imageName);
|
||||||
@ -311,7 +310,7 @@ public:
|
|||||||
|
|
||||||
void SortIndexSectionEntries()
|
void SortIndexSectionEntries()
|
||||||
{
|
{
|
||||||
std::sort(m_index_entries.begin(), m_index_entries.end(), CompareIndices);
|
std::ranges::sort(m_index_entries, CompareIndices);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteIndexSection()
|
void WriteIndexSection()
|
||||||
|
@ -64,12 +64,11 @@ public:
|
|||||||
if (!line.IsEof())
|
if (!line.IsEof())
|
||||||
{
|
{
|
||||||
std::cerr << "Error: " << pos.m_filename.get() << " L" << pos.m_line << ':' << pos.m_column << " Could not parse expression:\n"
|
std::cerr << "Error: " << pos.m_filename.get() << " L" << pos.m_line << ':' << pos.m_column << " Could not parse expression:\n"
|
||||||
<< line.m_line.substr(pos.m_column - 1) << std::endl;
|
<< line.m_line.substr(pos.m_column - 1) << "\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cerr << "Error: " << pos.m_filename.get() << " L" << pos.m_line << ':' << pos.m_column << " Could not parse expression."
|
std::cerr << "Error: " << pos.m_filename.get() << " L" << pos.m_line << ':' << pos.m_column << " Could not parse expression.\n";
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -82,11 +81,11 @@ public:
|
|||||||
|
|
||||||
if (!line.IsEof() && line.m_line.size() > static_cast<unsigned>(pos.m_column - 1))
|
if (!line.IsEof() && line.m_line.size() > static_cast<unsigned>(pos.m_column - 1))
|
||||||
{
|
{
|
||||||
std::cerr << "Error: " << e.FullMessage() << "\n" << line.m_line.substr(pos.m_column - 1) << std::endl;
|
std::cerr << "Error: " << e.FullMessage() << "\n" << line.m_line.substr(pos.m_column - 1) << "\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cerr << "Error: " << e.FullMessage() << std::endl;
|
std::cerr << "Error: " << e.FullMessage() << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -981,7 +981,7 @@ void DefinesStreamProxy::ProcessNestedMacros(ParserLine& line, unsigned& linePos
|
|||||||
const Define* nestedMacro = nullptr;
|
const Define* nestedMacro = nullptr;
|
||||||
while (FindNextMacro(input, pos, defineStart, nestedMacro))
|
while (FindNextMacro(input, pos, defineStart, nestedMacro))
|
||||||
{
|
{
|
||||||
if (std::find(callstack.cbegin(), callstack.cend(), nestedMacro) != callstack.cend())
|
if (std::ranges::find(std::as_const(callstack), nestedMacro) != callstack.cend())
|
||||||
{
|
{
|
||||||
// Do not expand recursively
|
// Do not expand recursively
|
||||||
continue;
|
continue;
|
||||||
|
@ -283,14 +283,12 @@ std::unique_ptr<SimpleExpressionMatchers::matcher_t> SimpleExpressionMatchers::P
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto hasAddOperation = std::any_of(enabledBinaryOperations.begin(),
|
const auto hasAddOperation = std::ranges::any_of(enabledBinaryOperations,
|
||||||
enabledBinaryOperations.end(),
|
|
||||||
[](const SimpleExpressionBinaryOperationType* type)
|
[](const SimpleExpressionBinaryOperationType* type)
|
||||||
{
|
{
|
||||||
return type == &SimpleExpressionBinaryOperationType::OPERATION_ADD;
|
return type == &SimpleExpressionBinaryOperationType::OPERATION_ADD;
|
||||||
});
|
});
|
||||||
const auto hasSubtractOperation = std::any_of(enabledBinaryOperations.begin(),
|
const auto hasSubtractOperation = std::ranges::any_of(enabledBinaryOperations,
|
||||||
enabledBinaryOperations.end(),
|
|
||||||
[](const SimpleExpressionBinaryOperationType* type)
|
[](const SimpleExpressionBinaryOperationType* type)
|
||||||
{
|
{
|
||||||
return type == &SimpleExpressionBinaryOperationType::OPERATION_SUBTRACT;
|
return type == &SimpleExpressionBinaryOperationType::OPERATION_SUBTRACT;
|
||||||
|
@ -8,7 +8,7 @@ SimpleMatcherAnyCharacterBesides::SimpleMatcherAnyCharacterBesides(std::vector<c
|
|||||||
MatcherResult<SimpleParserValue> SimpleMatcherAnyCharacterBesides::CanMatch(ILexer<SimpleParserValue>* lexer, const unsigned tokenOffset)
|
MatcherResult<SimpleParserValue> SimpleMatcherAnyCharacterBesides::CanMatch(ILexer<SimpleParserValue>* lexer, const unsigned tokenOffset)
|
||||||
{
|
{
|
||||||
const auto& token = lexer->GetToken(tokenOffset);
|
const auto& token = lexer->GetToken(tokenOffset);
|
||||||
return token.m_type == SimpleParserValueType::CHARACTER && std::find(m_chars.begin(), m_chars.end(), token.CharacterValue()) == m_chars.end()
|
return token.m_type == SimpleParserValueType::CHARACTER && std::ranges::find(m_chars, token.CharacterValue()) == m_chars.end()
|
||||||
? MatcherResult<SimpleParserValue>::Match(1)
|
? MatcherResult<SimpleParserValue>::Match(1)
|
||||||
: MatcherResult<SimpleParserValue>::NoMatch();
|
: MatcherResult<SimpleParserValue>::NoMatch();
|
||||||
}
|
}
|
||||||
|
@ -17,10 +17,8 @@ MatcherResult<SimpleParserValue> SimpleMatcherKeywordIgnoreCase::CanMatch(ILexer
|
|||||||
return MatcherResult<SimpleParserValue>::NoMatch();
|
return MatcherResult<SimpleParserValue>::NoMatch();
|
||||||
|
|
||||||
const auto& identifierValue = token.IdentifierValue();
|
const auto& identifierValue = token.IdentifierValue();
|
||||||
const auto isEqual = std::equal(identifierValue.begin(),
|
const auto isEqual = std::ranges::equal(identifierValue,
|
||||||
identifierValue.end(),
|
m_value,
|
||||||
m_value.begin(),
|
|
||||||
m_value.end(),
|
|
||||||
[](const char a, const char b)
|
[](const char a, const char b)
|
||||||
{
|
{
|
||||||
return tolower(a) == b;
|
return tolower(a) == b;
|
||||||
|
@ -412,7 +412,7 @@ bool Templater::TemplateToDirectory(const std::string& outputDirectory) const
|
|||||||
}
|
}
|
||||||
catch (ParsingException& e)
|
catch (ParsingException& e)
|
||||||
{
|
{
|
||||||
std::cerr << "Error: " << e.FullMessage() << std::endl;
|
std::cerr << "Error: " << e.FullMessage() << "\n";
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -41,11 +41,11 @@ void UsageInformation::Print()
|
|||||||
std::stringstream str;
|
std::stringstream str;
|
||||||
std::map<std::string, std::vector<const CommandLineOption*>> categories;
|
std::map<std::string, std::vector<const CommandLineOption*>> categories;
|
||||||
|
|
||||||
str << "Usage:" << std::endl;
|
str << "Usage:\n";
|
||||||
|
|
||||||
PrintUsageOverview(str);
|
PrintUsageOverview(str);
|
||||||
|
|
||||||
str << "The following options are available:" << std::endl;
|
str << "The following options are available:\n";
|
||||||
|
|
||||||
str.fill(' ');
|
str.fill(' ');
|
||||||
|
|
||||||
@ -78,13 +78,13 @@ void UsageInformation::Print()
|
|||||||
for (auto& category : categories)
|
for (auto& category : categories)
|
||||||
{
|
{
|
||||||
if (!firstCategory)
|
if (!firstCategory)
|
||||||
str << std::endl;
|
str << "\n";
|
||||||
else
|
else
|
||||||
firstCategory = false;
|
firstCategory = false;
|
||||||
|
|
||||||
if (!category.first.empty())
|
if (!category.first.empty())
|
||||||
{
|
{
|
||||||
str << "== " << category.first << " ==" << std::endl;
|
str << "== " << category.first << " ==\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto option : category.second)
|
for (auto option : category.second)
|
||||||
@ -101,11 +101,11 @@ void UsageInformation::Print()
|
|||||||
str << " ";
|
str << " ";
|
||||||
str << std::setw(longestArgumentLength) << GetOptionArgument(option);
|
str << std::setw(longestArgumentLength) << GetOptionArgument(option);
|
||||||
|
|
||||||
str << " " << option->m_description << std::endl;
|
str << " " << option->m_description << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << str.str() << std::endl;
|
std::cout << str.str() << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void UsageInformation::PrintUsageOverview(std::stringstream& str)
|
void UsageInformation::PrintUsageOverview(std::stringstream& str)
|
||||||
@ -126,7 +126,7 @@ void UsageInformation::PrintUsageOverview(std::stringstream& str)
|
|||||||
{
|
{
|
||||||
str << "...";
|
str << "...";
|
||||||
}
|
}
|
||||||
str << std::endl << std::endl;
|
str << "\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string UsageInformation::GetOptionArgument(const CommandLineOption* option)
|
std::string UsageInformation::GetOptionArgument(const CommandLineOption* option)
|
||||||
|
@ -21,8 +21,7 @@ bool MemberComputations::ShouldIgnore() const
|
|||||||
bool MemberComputations::ContainsNonEmbeddedReference() const
|
bool MemberComputations::ContainsNonEmbeddedReference() const
|
||||||
{
|
{
|
||||||
const auto& declarationModifiers = m_info->m_member->m_type_declaration->m_declaration_modifiers;
|
const auto& declarationModifiers = m_info->m_member->m_type_declaration->m_declaration_modifiers;
|
||||||
return std::any_of(declarationModifiers.begin(),
|
return std::ranges::any_of(declarationModifiers,
|
||||||
declarationModifiers.end(),
|
|
||||||
[](const std::unique_ptr<DeclarationModifier>& modifier)
|
[](const std::unique_ptr<DeclarationModifier>& modifier)
|
||||||
{
|
{
|
||||||
return modifier->GetType() == DeclarationModifierType::POINTER;
|
return modifier->GetType() == DeclarationModifierType::POINTER;
|
||||||
@ -136,8 +135,7 @@ bool MemberComputations::IsPointerToArray() const
|
|||||||
if (lastModifier->GetType() != DeclarationModifierType::ARRAY)
|
if (lastModifier->GetType() != DeclarationModifierType::ARRAY)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return std::any_of(declarationModifiers.begin(),
|
return std::ranges::any_of(declarationModifiers,
|
||||||
declarationModifiers.end(),
|
|
||||||
[](const std::unique_ptr<DeclarationModifier>& modifier)
|
[](const std::unique_ptr<DeclarationModifier>& modifier)
|
||||||
{
|
{
|
||||||
return modifier->GetType() == DeclarationModifierType::POINTER;
|
return modifier->GetType() == DeclarationModifierType::POINTER;
|
||||||
@ -207,8 +205,7 @@ bool MemberComputations::HasDynamicArraySize() const
|
|||||||
{
|
{
|
||||||
const auto& declarationModifiers = m_info->m_member->m_type_declaration->m_declaration_modifiers;
|
const auto& declarationModifiers = m_info->m_member->m_type_declaration->m_declaration_modifiers;
|
||||||
|
|
||||||
return std::any_of(declarationModifiers.begin(),
|
return std::ranges::any_of(declarationModifiers,
|
||||||
declarationModifiers.end(),
|
|
||||||
[](const std::unique_ptr<DeclarationModifier>& declarationModifier)
|
[](const std::unique_ptr<DeclarationModifier>& declarationModifier)
|
||||||
{
|
{
|
||||||
return declarationModifier->GetType() == DeclarationModifierType::ARRAY
|
return declarationModifier->GetType() == DeclarationModifierType::ARRAY
|
||||||
|
@ -123,7 +123,7 @@ std::vector<DeclarationModifierComputations> DeclarationModifierComputations::Ge
|
|||||||
for (auto i = 0; i < arraySize; i++)
|
for (auto i = 0; i < arraySize; i++)
|
||||||
{
|
{
|
||||||
std::vector<int> childModifierIndices(m_modifier_indices.size() + 1);
|
std::vector<int> childModifierIndices(m_modifier_indices.size() + 1);
|
||||||
std::copy(m_modifier_indices.begin(), m_modifier_indices.end(), childModifierIndices.begin());
|
std::ranges::copy(m_modifier_indices, childModifierIndices.begin());
|
||||||
childModifierIndices[childModifierIndices.size() - 1] = i;
|
childModifierIndices[childModifierIndices.size() - 1] = i;
|
||||||
arrayEntries.push_back(DeclarationModifierComputations(m_information, std::move(childModifierIndices)));
|
arrayEntries.push_back(DeclarationModifierComputations(m_information, std::move(childModifierIndices)));
|
||||||
}
|
}
|
||||||
@ -140,8 +140,7 @@ bool DeclarationModifierComputations::IsSinglePointer() const
|
|||||||
{
|
{
|
||||||
const auto following = GetFollowingDeclarationModifiers();
|
const auto following = GetFollowingDeclarationModifiers();
|
||||||
|
|
||||||
return !std::any_of(following.begin(),
|
return !std::ranges::any_of(following,
|
||||||
following.end(),
|
|
||||||
[](const DeclarationModifier* modifier)
|
[](const DeclarationModifier* modifier)
|
||||||
{
|
{
|
||||||
return modifier->GetType() == DeclarationModifierType::POINTER;
|
return modifier->GetType() == DeclarationModifierType::POINTER;
|
||||||
@ -160,8 +159,7 @@ bool DeclarationModifierComputations::IsArrayPointer() const
|
|||||||
{
|
{
|
||||||
const auto following = GetFollowingDeclarationModifiers();
|
const auto following = GetFollowingDeclarationModifiers();
|
||||||
|
|
||||||
return !std::any_of(following.begin(),
|
return !std::ranges::any_of(following,
|
||||||
following.end(),
|
|
||||||
[](const DeclarationModifier* modifier)
|
[](const DeclarationModifier* modifier)
|
||||||
{
|
{
|
||||||
return modifier->GetType() == DeclarationModifierType::POINTER;
|
return modifier->GetType() == DeclarationModifierType::POINTER;
|
||||||
@ -247,8 +245,7 @@ unsigned DeclarationModifierComputations::GetAlignment() const
|
|||||||
{
|
{
|
||||||
const auto following = GetFollowingDeclarationModifiers();
|
const auto following = GetFollowingDeclarationModifiers();
|
||||||
|
|
||||||
return std::any_of(following.begin(),
|
return std::ranges::any_of(following,
|
||||||
following.end(),
|
|
||||||
[](const DeclarationModifier* modifier)
|
[](const DeclarationModifier* modifier)
|
||||||
{
|
{
|
||||||
return modifier->GetType() == DeclarationModifierType::POINTER;
|
return modifier->GetType() == DeclarationModifierType::POINTER;
|
||||||
|
@ -44,4 +44,4 @@ const BaseTypeDefinition* const BaseTypeDefinition::UNSIGNED_LONG_LONG = new Bas
|
|||||||
const BaseTypeDefinition* const BaseTypeDefinition::VOID = new BaseTypeDefinition("void", 0);
|
const BaseTypeDefinition* const BaseTypeDefinition::VOID = new BaseTypeDefinition("void", 0);
|
||||||
const BaseTypeDefinition* const BaseTypeDefinition::ALL_BASE_TYPES[]{
|
const BaseTypeDefinition* const BaseTypeDefinition::ALL_BASE_TYPES[]{
|
||||||
FLOAT, DOUBLE, BOOL, CHAR, UNSIGNED_CHAR, SHORT, UNSIGNED_SHORT, INT, UNSIGNED_INT, LONG, UNSIGNED_LONG, LONG_LONG, UNSIGNED_LONG_LONG, VOID};
|
FLOAT, DOUBLE, BOOL, CHAR, UNSIGNED_CHAR, SHORT, UNSIGNED_SHORT, INT, UNSIGNED_INT, LONG, UNSIGNED_LONG, LONG_LONG, UNSIGNED_LONG_LONG, VOID};
|
||||||
const size_t BaseTypeDefinition::ALL_BASE_TYPES_COUNT = std::extent<decltype(ALL_BASE_TYPES)>::value;
|
const size_t BaseTypeDefinition::ALL_BASE_TYPES_COUNT = std::extent_v<decltype(ALL_BASE_TYPES)>;
|
||||||
|
@ -41,7 +41,7 @@ bool CodeGenerator::GenerateCodeForTemplate(RenderingContext* context, ICodeTemp
|
|||||||
|
|
||||||
if (!stream.is_open())
|
if (!stream.is_open())
|
||||||
{
|
{
|
||||||
std::cout << "Failed to open file '" << p.string() << "'" << std::endl;
|
std::cout << "Failed to open file '" << p.string() << "'\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ bool CodeGenerator::GetAssetWithName(IDataRepository* repository, const std::str
|
|||||||
auto* def = repository->GetDataDefinitionByName(name);
|
auto* def = repository->GetDataDefinitionByName(name);
|
||||||
if (def == nullptr)
|
if (def == nullptr)
|
||||||
{
|
{
|
||||||
std::cout << "Could not find type with name '" << name << "'" << std::endl;
|
std::cout << "Could not find type with name '" << name << "'\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,13 +66,13 @@ bool CodeGenerator::GetAssetWithName(IDataRepository* repository, const std::str
|
|||||||
auto* info = defWithMembers != nullptr ? repository->GetInformationFor(defWithMembers) : nullptr;
|
auto* info = defWithMembers != nullptr ? repository->GetInformationFor(defWithMembers) : nullptr;
|
||||||
if (info == nullptr)
|
if (info == nullptr)
|
||||||
{
|
{
|
||||||
std::cout << "Could not find type with name '" << name << "'" << std::endl;
|
std::cout << "Could not find type with name '" << name << "'\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!StructureComputations(info).IsAsset())
|
if (!StructureComputations(info).IsAsset())
|
||||||
{
|
{
|
||||||
std::cout << "Type is not an asset '" << name << "'" << std::endl;
|
std::cout << "Type is not an asset '" << name << "'\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ bool CodeGenerator::GenerateCode(IDataRepository* repository)
|
|||||||
const auto foundTemplate = m_template_mapping.find(templateName);
|
const auto foundTemplate = m_template_mapping.find(templateName);
|
||||||
if (foundTemplate == m_template_mapping.end())
|
if (foundTemplate == m_template_mapping.end())
|
||||||
{
|
{
|
||||||
std::cout << "Unknown template '" << generationTask.m_template_name << "'." << std::endl;
|
std::cout << "Unknown template '" << generationTask.m_template_name << "'.\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ bool CodeGenerator::GenerateCode(IDataRepository* repository)
|
|||||||
const auto end = std::chrono::steady_clock::now();
|
const auto end = std::chrono::steady_clock::now();
|
||||||
if (m_args->m_verbose)
|
if (m_args->m_verbose)
|
||||||
{
|
{
|
||||||
std::cout << "Generating code took " << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() << "ms" << std::endl;
|
std::cout << "Generating code took " << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() << "ms\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -30,7 +30,7 @@ bool CommandsFileReader::OpenBaseStream()
|
|||||||
auto stream = std::make_unique<ParserFilesystemStream>(m_filename);
|
auto stream = std::make_unique<ParserFilesystemStream>(m_filename);
|
||||||
if (!stream->IsOpen())
|
if (!stream->IsOpen())
|
||||||
{
|
{
|
||||||
std::cout << "Could not open commands file" << std::endl;
|
std::cout << "Could not open commands file\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ bool CommandsFileReader::ReadCommandsFile(IDataRepository* repository)
|
|||||||
{
|
{
|
||||||
if (m_args->m_verbose)
|
if (m_args->m_verbose)
|
||||||
{
|
{
|
||||||
std::cout << "Reading commands file: " << m_filename << std::endl;
|
std::cout << "Reading commands file: " << m_filename << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!OpenBaseStream())
|
if (!OpenBaseStream())
|
||||||
@ -85,14 +85,13 @@ bool CommandsFileReader::ReadCommandsFile(IDataRepository* repository)
|
|||||||
|
|
||||||
if (m_args->m_verbose)
|
if (m_args->m_verbose)
|
||||||
{
|
{
|
||||||
std::cout << "Processing commands took " << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() << "ms" << std::endl;
|
std::cout << "Processing commands took " << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() << "ms\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return std::all_of(m_post_processors.begin(),
|
return std::ranges::all_of(m_post_processors,
|
||||||
m_post_processors.end(),
|
|
||||||
[repository](const std::unique_ptr<IPostProcessor>& postProcessor)
|
[repository](const std::unique_ptr<IPostProcessor>& postProcessor)
|
||||||
{
|
{
|
||||||
return postProcessor->PostProcess(repository);
|
return postProcessor->PostProcess(repository);
|
||||||
|
@ -19,7 +19,7 @@ std::unique_ptr<CommandsCommonMatchers::matcher_t> CommandsCommonMatchers::Typen
|
|||||||
"int",
|
"int",
|
||||||
"long",
|
"long",
|
||||||
};
|
};
|
||||||
static_assert(std::extent<decltype(BUILT_IN_TYPE_NAMES)>::value
|
static_assert(std::extent_v<decltype(BUILT_IN_TYPE_NAMES)>
|
||||||
== static_cast<int>(CommandsParserValueType::BUILT_IN_LAST) - static_cast<int>(CommandsParserValueType::BUILT_IN_FIRST) + 1);
|
== static_cast<int>(CommandsParserValueType::BUILT_IN_LAST) - static_cast<int>(CommandsParserValueType::BUILT_IN_FIRST) + 1);
|
||||||
|
|
||||||
const CommandsMatcherFactory create(labelSupplier);
|
const CommandsMatcherFactory create(labelSupplier);
|
||||||
|
@ -45,8 +45,7 @@ void SequenceAssetRef::ProcessMatch(CommandsParserState* state, SequenceResult<C
|
|||||||
if (!hasPointerRef)
|
if (!hasPointerRef)
|
||||||
{
|
{
|
||||||
const auto& modifiers = typeDecl->m_declaration_modifiers;
|
const auto& modifiers = typeDecl->m_declaration_modifiers;
|
||||||
hasPointerRef = std::any_of(modifiers.begin(),
|
hasPointerRef = std::ranges::any_of(modifiers,
|
||||||
modifiers.end(),
|
|
||||||
[](const std::unique_ptr<DeclarationModifier>& modifier)
|
[](const std::unique_ptr<DeclarationModifier>& modifier)
|
||||||
{
|
{
|
||||||
return modifier->GetType() == DeclarationModifierType::POINTER;
|
return modifier->GetType() == DeclarationModifierType::POINTER;
|
||||||
|
@ -39,8 +39,7 @@ void SequenceString::ProcessMatch(CommandsParserState* state, SequenceResult<Com
|
|||||||
if (!hasPointerRef)
|
if (!hasPointerRef)
|
||||||
{
|
{
|
||||||
const auto& modifiers = typeDecl->m_declaration_modifiers;
|
const auto& modifiers = typeDecl->m_declaration_modifiers;
|
||||||
hasPointerRef = std::any_of(modifiers.begin(),
|
hasPointerRef = std::ranges::any_of(modifiers,
|
||||||
modifiers.end(),
|
|
||||||
[](const std::unique_ptr<DeclarationModifier>& modifier)
|
[](const std::unique_ptr<DeclarationModifier>& modifier)
|
||||||
{
|
{
|
||||||
return modifier->GetType() == DeclarationModifierType::POINTER;
|
return modifier->GetType() == DeclarationModifierType::POINTER;
|
||||||
|
@ -29,7 +29,7 @@ bool HeaderFileReader::OpenBaseStream()
|
|||||||
auto stream = std::make_unique<ParserFilesystemStream>(m_filename);
|
auto stream = std::make_unique<ParserFilesystemStream>(m_filename);
|
||||||
if (!stream->IsOpen())
|
if (!stream->IsOpen())
|
||||||
{
|
{
|
||||||
std::cout << "Could not open header file" << std::endl;
|
std::cout << "Could not open header file\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ bool HeaderFileReader::ReadHeaderFile(IDataRepository* repository)
|
|||||||
{
|
{
|
||||||
if (m_args->m_verbose)
|
if (m_args->m_verbose)
|
||||||
{
|
{
|
||||||
std::cout << "Reading header file: " << m_filename << std::endl;
|
std::cout << "Reading header file: " << m_filename << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!OpenBaseStream())
|
if (!OpenBaseStream())
|
||||||
@ -85,14 +85,13 @@ bool HeaderFileReader::ReadHeaderFile(IDataRepository* repository)
|
|||||||
|
|
||||||
if (m_args->m_verbose)
|
if (m_args->m_verbose)
|
||||||
{
|
{
|
||||||
std::cout << "Processing header took " << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() << "ms" << std::endl;
|
std::cout << "Processing header took " << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() << "ms\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return std::all_of(m_post_processors.begin(),
|
return std::ranges::all_of(m_post_processors,
|
||||||
m_post_processors.end(),
|
|
||||||
[repository](const std::unique_ptr<IPostProcessor>& postProcessor)
|
[repository](const std::unique_ptr<IPostProcessor>& postProcessor)
|
||||||
{
|
{
|
||||||
return postProcessor->PostProcess(repository);
|
return postProcessor->PostProcess(repository);
|
||||||
|
@ -96,7 +96,7 @@ bool HeaderParserState::ResolveForwardDeclarations()
|
|||||||
|
|
||||||
if (dataDefinition == nullptr)
|
if (dataDefinition == nullptr)
|
||||||
{
|
{
|
||||||
std::cout << "Forward declaration \"" << forwardDeclaration->GetFullName() << "\" was not defined" << std::endl;
|
std::cout << "Forward declaration \"" << forwardDeclaration->GetFullName() << "\" was not defined\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ std::unique_ptr<HeaderCommonMatchers::matcher_t> HeaderCommonMatchers::ArrayDef(
|
|||||||
std::unique_ptr<HeaderCommonMatchers::matcher_t> HeaderCommonMatchers::Typename(const supplier_t* labelSupplier)
|
std::unique_ptr<HeaderCommonMatchers::matcher_t> HeaderCommonMatchers::Typename(const supplier_t* labelSupplier)
|
||||||
{
|
{
|
||||||
static constexpr const char* BUILT_IN_TYPE_NAMES[]{"unsigned", "char", "short", "int", "long"};
|
static constexpr const char* BUILT_IN_TYPE_NAMES[]{"unsigned", "char", "short", "int", "long"};
|
||||||
static_assert(std::extent<decltype(BUILT_IN_TYPE_NAMES)>::value
|
static_assert(std::extent_v<decltype(BUILT_IN_TYPE_NAMES)>
|
||||||
== static_cast<int>(HeaderParserValueType::BUILT_IN_LAST) - static_cast<int>(HeaderParserValueType::BUILT_IN_FIRST) + 1);
|
== static_cast<int>(HeaderParserValueType::BUILT_IN_LAST) - static_cast<int>(HeaderParserValueType::BUILT_IN_FIRST) + 1);
|
||||||
|
|
||||||
const HeaderMatcherFactory create(labelSupplier);
|
const HeaderMatcherFactory create(labelSupplier);
|
||||||
|
@ -269,7 +269,7 @@ bool CalculateSizeAndAlignPostProcessor::PostProcess(IDataRepository* repository
|
|||||||
{
|
{
|
||||||
if (repository->GetArchitecture() == Architecture::UNKNOWN)
|
if (repository->GetArchitecture() == Architecture::UNKNOWN)
|
||||||
{
|
{
|
||||||
std::cout << "You must set an architecture!" << std::endl;
|
std::cout << "You must set an architecture!\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,7 +277,7 @@ bool CalculateSizeAndAlignPostProcessor::PostProcess(IDataRepository* repository
|
|||||||
{
|
{
|
||||||
if (!CalculateFields(repository, structDefinition))
|
if (!CalculateFields(repository, structDefinition))
|
||||||
{
|
{
|
||||||
std::cout << std::endl;
|
std::cout << "\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -286,7 +286,7 @@ bool CalculateSizeAndAlignPostProcessor::PostProcess(IDataRepository* repository
|
|||||||
{
|
{
|
||||||
if (!CalculateFields(repository, unionDefinition))
|
if (!CalculateFields(repository, unionDefinition))
|
||||||
{
|
{
|
||||||
std::cout << std::endl;
|
std::cout << "\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -295,7 +295,7 @@ bool CalculateSizeAndAlignPostProcessor::PostProcess(IDataRepository* repository
|
|||||||
{
|
{
|
||||||
if (!CalculateFields(repository, typedefDeclaration->m_type_declaration.get()))
|
if (!CalculateFields(repository, typedefDeclaration->m_type_declaration.get()))
|
||||||
{
|
{
|
||||||
std::cout << std::endl;
|
std::cout << "\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,7 @@ bool CreateMemberInformationPostProcessor::PostProcess(IDataRepository* reposito
|
|||||||
{
|
{
|
||||||
const auto& allStructureInformation = repository->GetAllStructureInformation();
|
const auto& allStructureInformation = repository->GetAllStructureInformation();
|
||||||
|
|
||||||
return std::all_of(allStructureInformation.begin(),
|
return std::ranges::all_of(allStructureInformation,
|
||||||
allStructureInformation.end(),
|
|
||||||
[this, repository](StructureInformation* structure)
|
[this, repository](StructureInformation* structure)
|
||||||
{
|
{
|
||||||
return CreateMemberInformationForStructure(repository, structure);
|
return CreateMemberInformationForStructure(repository, structure);
|
||||||
|
@ -21,7 +21,7 @@ bool UnionsPostProcessor::ProcessUnion(StructureInformation* info)
|
|||||||
|
|
||||||
if (entriesWithoutConditionCount > 1 && !info->m_usages.empty() && !info->m_is_leaf)
|
if (entriesWithoutConditionCount > 1 && !info->m_usages.empty() && !info->m_is_leaf)
|
||||||
{
|
{
|
||||||
std::cout << "Union '" << info->m_definition->GetFullName() << "' has more than one entry without a condition!" << std::endl;
|
std::cout << "Union '" << info->m_definition->GetFullName() << "' has more than one entry without a condition!\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,8 +40,7 @@ bool UnionsPostProcessor::PostProcess(IDataRepository* repository)
|
|||||||
{
|
{
|
||||||
const auto& allInfos = repository->GetAllStructureInformation();
|
const auto& allInfos = repository->GetAllStructureInformation();
|
||||||
|
|
||||||
return std::all_of(allInfos.begin(),
|
return std::ranges::all_of(allInfos,
|
||||||
allInfos.end(),
|
|
||||||
[](StructureInformation* info)
|
[](StructureInformation* info)
|
||||||
{
|
{
|
||||||
if (info->m_definition->GetType() != DataDefinitionType::UNION)
|
if (info->m_definition->GetType() != DataDefinitionType::UNION)
|
||||||
|
@ -63,8 +63,7 @@ bool UsagesPostProcessor::PostProcess(IDataRepository* repository)
|
|||||||
{
|
{
|
||||||
const auto& allInfos = repository->GetAllStructureInformation();
|
const auto& allInfos = repository->GetAllStructureInformation();
|
||||||
|
|
||||||
return std::all_of(allInfos.begin(),
|
return std::ranges::all_of(allInfos,
|
||||||
allInfos.end(),
|
|
||||||
[](StructureInformation* info)
|
[](StructureInformation* info)
|
||||||
{
|
{
|
||||||
const StructureComputations computations(info);
|
const StructureComputations computations(info);
|
||||||
|
@ -14,9 +14,7 @@ PrettyPrinter::PrettyPrinter(std::ostream& stream, const IDataRepository* reposi
|
|||||||
|
|
||||||
void PrettyPrinter::PrintSeparator() const
|
void PrettyPrinter::PrintSeparator() const
|
||||||
{
|
{
|
||||||
m_stream << std::endl
|
m_stream << "\n==========================================================================================================\n\n";
|
||||||
<< "==========================================================================================================" << std::endl
|
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrettyPrinter::PrintVariablePointerToArray(Variable* variable) const
|
void PrettyPrinter::PrintVariablePointerToArray(Variable* variable) const
|
||||||
@ -51,7 +49,7 @@ void PrettyPrinter::PrintVariablePointerToArray(Variable* variable) const
|
|||||||
m_stream << variable->m_name << ")";
|
m_stream << variable->m_name << ")";
|
||||||
for (auto size : arraySize)
|
for (auto size : arraySize)
|
||||||
m_stream << '[' << size << ']';
|
m_stream << '[' << size << ']';
|
||||||
m_stream << std::endl;
|
m_stream << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrettyPrinter::PrintVariableArrayOfPointers(Variable* variable) const
|
void PrettyPrinter::PrintVariableArrayOfPointers(Variable* variable) const
|
||||||
@ -86,7 +84,7 @@ void PrettyPrinter::PrintVariableArrayOfPointers(Variable* variable) const
|
|||||||
m_stream << " " << variable->m_name;
|
m_stream << " " << variable->m_name;
|
||||||
for (auto size : arraySize)
|
for (auto size : arraySize)
|
||||||
m_stream << '[' << size << ']';
|
m_stream << '[' << size << ']';
|
||||||
m_stream << std::endl;
|
m_stream << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrettyPrinter::PrintVariable(Variable* variable) const
|
void PrettyPrinter::PrintVariable(Variable* variable) const
|
||||||
@ -94,13 +92,12 @@ void PrettyPrinter::PrintVariable(Variable* variable) const
|
|||||||
const auto& declarationModifiers = variable->m_type_declaration->m_declaration_modifiers;
|
const auto& declarationModifiers = variable->m_type_declaration->m_declaration_modifiers;
|
||||||
if (declarationModifiers.empty())
|
if (declarationModifiers.empty())
|
||||||
{
|
{
|
||||||
std::cout << " " << variable->m_type_declaration->m_type->GetFullName() << " " << variable->m_name << std::endl;
|
std::cout << " " << variable->m_type_declaration->m_type->GetFullName() << " " << variable->m_name << "\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (declarationModifiers[0]->GetType() == DeclarationModifierType::POINTER
|
if (declarationModifiers[0]->GetType() == DeclarationModifierType::POINTER
|
||||||
&& std::any_of(declarationModifiers.begin(),
|
&& std::ranges::any_of(declarationModifiers,
|
||||||
declarationModifiers.end(),
|
|
||||||
[](const std::unique_ptr<DeclarationModifier>& modifier)
|
[](const std::unique_ptr<DeclarationModifier>& modifier)
|
||||||
{
|
{
|
||||||
return modifier->GetType() == DeclarationModifierType::ARRAY;
|
return modifier->GetType() == DeclarationModifierType::ARRAY;
|
||||||
@ -147,7 +144,7 @@ void PrettyPrinter::PrintTypedefPointerToArray(TypedefDefinition* typedefDefinit
|
|||||||
m_stream << typedefDefinition->m_name << ")";
|
m_stream << typedefDefinition->m_name << ")";
|
||||||
for (auto size : arraySize)
|
for (auto size : arraySize)
|
||||||
m_stream << '[' << size << ']';
|
m_stream << '[' << size << ']';
|
||||||
m_stream << std::endl;
|
m_stream << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrettyPrinter::PrintTypedefArrayOfPointers(TypedefDefinition* typedefDefinition) const
|
void PrettyPrinter::PrintTypedefArrayOfPointers(TypedefDefinition* typedefDefinition) const
|
||||||
@ -182,90 +179,89 @@ void PrettyPrinter::PrintTypedefArrayOfPointers(TypedefDefinition* typedefDefini
|
|||||||
m_stream << " " << typedefDefinition->m_name;
|
m_stream << " " << typedefDefinition->m_name;
|
||||||
for (auto size : arraySize)
|
for (auto size : arraySize)
|
||||||
m_stream << '[' << size << ']';
|
m_stream << '[' << size << ']';
|
||||||
m_stream << std::endl;
|
m_stream << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrettyPrinter::PrintEnums() const
|
void PrettyPrinter::PrintEnums() const
|
||||||
{
|
{
|
||||||
const auto& allEnums = m_repository->GetAllEnums();
|
const auto& allEnums = m_repository->GetAllEnums();
|
||||||
m_stream << allEnums.size() << " enums:" << std::endl;
|
m_stream << allEnums.size() << " enums:\n";
|
||||||
|
|
||||||
for (auto* enumDefinition : allEnums)
|
for (auto* enumDefinition : allEnums)
|
||||||
{
|
{
|
||||||
m_stream << " Name: " << enumDefinition->GetFullName() << std::endl;
|
m_stream << " Name: " << enumDefinition->GetFullName() << "\n";
|
||||||
m_stream << " Alignment: " << enumDefinition->GetAlignment() << std::endl;
|
m_stream << " Alignment: " << enumDefinition->GetAlignment() << "\n";
|
||||||
m_stream << " Size: " << enumDefinition->GetSize() << std::endl;
|
m_stream << " Size: " << enumDefinition->GetSize() << "\n";
|
||||||
|
|
||||||
for (const auto& enumMember : enumDefinition->m_members)
|
for (const auto& enumMember : enumDefinition->m_members)
|
||||||
{
|
{
|
||||||
m_stream << " " << enumMember->m_name << " = " << enumMember->m_value << std::endl;
|
m_stream << " " << enumMember->m_name << " = " << enumMember->m_value << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
m_stream << std::endl;
|
m_stream << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrettyPrinter::PrintStructs() const
|
void PrettyPrinter::PrintStructs() const
|
||||||
{
|
{
|
||||||
const auto& allStructs = m_repository->GetAllStructs();
|
const auto& allStructs = m_repository->GetAllStructs();
|
||||||
m_stream << allStructs.size() << " structs:" << std::endl;
|
m_stream << allStructs.size() << " structs:\n";
|
||||||
|
|
||||||
for (auto* structDefinition : allStructs)
|
for (auto* structDefinition : allStructs)
|
||||||
{
|
{
|
||||||
m_stream << " Name: " << structDefinition->GetFullName() << std::endl;
|
m_stream << " Name: " << structDefinition->GetFullName() << "\n";
|
||||||
m_stream << " Alignment: " << structDefinition->GetAlignment() << std::endl;
|
m_stream << " Alignment: " << structDefinition->GetAlignment() << "\n";
|
||||||
m_stream << " Size: " << structDefinition->GetSize() << std::endl;
|
m_stream << " Size: " << structDefinition->GetSize() << "\n";
|
||||||
|
|
||||||
for (const auto& variable : structDefinition->m_members)
|
for (const auto& variable : structDefinition->m_members)
|
||||||
{
|
{
|
||||||
PrintVariable(variable.get());
|
PrintVariable(variable.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_stream << std::endl;
|
m_stream << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrettyPrinter::PrintUnions() const
|
void PrettyPrinter::PrintUnions() const
|
||||||
{
|
{
|
||||||
const auto& allUnions = m_repository->GetAllUnions();
|
const auto& allUnions = m_repository->GetAllUnions();
|
||||||
m_stream << allUnions.size() << " unions:" << std::endl;
|
m_stream << allUnions.size() << " unions:\n";
|
||||||
|
|
||||||
for (auto* unionDefinition : allUnions)
|
for (auto* unionDefinition : allUnions)
|
||||||
{
|
{
|
||||||
m_stream << " Name: " << unionDefinition->GetFullName() << std::endl;
|
m_stream << " Name: " << unionDefinition->GetFullName() << "\n";
|
||||||
m_stream << " Alignment: " << unionDefinition->GetAlignment() << std::endl;
|
m_stream << " Alignment: " << unionDefinition->GetAlignment() << "\n";
|
||||||
m_stream << " Size: " << unionDefinition->GetSize() << std::endl;
|
m_stream << " Size: " << unionDefinition->GetSize() << "\n";
|
||||||
|
|
||||||
for (const auto& variable : unionDefinition->m_members)
|
for (const auto& variable : unionDefinition->m_members)
|
||||||
{
|
{
|
||||||
PrintVariable(variable.get());
|
PrintVariable(variable.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_stream << std::endl;
|
m_stream << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrettyPrinter::PrintTypedefs() const
|
void PrettyPrinter::PrintTypedefs() const
|
||||||
{
|
{
|
||||||
const auto& allTypedefs = m_repository->GetAllTypedefs();
|
const auto& allTypedefs = m_repository->GetAllTypedefs();
|
||||||
m_stream << allTypedefs.size() << " typedefs:" << std::endl;
|
m_stream << allTypedefs.size() << " typedefs:\n";
|
||||||
|
|
||||||
for (auto* typedefDefinition : allTypedefs)
|
for (auto* typedefDefinition : allTypedefs)
|
||||||
{
|
{
|
||||||
m_stream << " Name: " << typedefDefinition->GetFullName() << std::endl;
|
m_stream << " Name: " << typedefDefinition->GetFullName() << "\n";
|
||||||
m_stream << " Alignment: " << typedefDefinition->GetAlignment() << std::endl;
|
m_stream << " Alignment: " << typedefDefinition->GetAlignment() << "\n";
|
||||||
m_stream << " Size: " << typedefDefinition->GetSize() << std::endl;
|
m_stream << " Size: " << typedefDefinition->GetSize() << "\n";
|
||||||
|
|
||||||
const auto& declarationModifiers = typedefDefinition->m_type_declaration->m_declaration_modifiers;
|
const auto& declarationModifiers = typedefDefinition->m_type_declaration->m_declaration_modifiers;
|
||||||
if (declarationModifiers.empty())
|
if (declarationModifiers.empty())
|
||||||
{
|
{
|
||||||
std::cout << " " << typedefDefinition->m_type_declaration->m_type->GetFullName() << std::endl;
|
std::cout << " " << typedefDefinition->m_type_declaration->m_type->GetFullName() << "\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (declarationModifiers[0]->GetType() == DeclarationModifierType::POINTER
|
if (declarationModifiers[0]->GetType() == DeclarationModifierType::POINTER
|
||||||
&& std::any_of(declarationModifiers.begin(),
|
&& std::ranges::any_of(declarationModifiers,
|
||||||
declarationModifiers.end(),
|
|
||||||
[](const std::unique_ptr<DeclarationModifier>& modifier)
|
[](const std::unique_ptr<DeclarationModifier>& modifier)
|
||||||
{
|
{
|
||||||
return modifier->GetType() == DeclarationModifierType::ARRAY;
|
return modifier->GetType() == DeclarationModifierType::ARRAY;
|
||||||
@ -279,7 +275,7 @@ void PrettyPrinter::PrintTypedefs() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_stream << std::endl;
|
m_stream << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ bool ZoneCodeGeneratorArguments::ParseArgs(const int argc, const char** argv, bo
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "At least one header file must be specified via -h / --header." << std::endl;
|
std::cout << "At least one header file must be specified via -h / --header.\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ bool ZoneCodeGeneratorArguments::ParseArgs(const int argc, const char** argv, bo
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "At least one commands file must be specified via -c / --commands-file." << std::endl;
|
std::cout << "At least one commands file must be specified via -c / --commands-file.\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ bool ZoneCodeGeneratorArguments::ParseArgs(const int argc, const char** argv, bo
|
|||||||
|
|
||||||
if (m_task_flags == 0)
|
if (m_task_flags == 0)
|
||||||
{
|
{
|
||||||
std::cout << "There was no output task specified." << std::endl;
|
std::cout << "There was no output task specified.\n";
|
||||||
PrintUsage();
|
PrintUsage();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ std::unique_ptr<ZoneDefinition> ZoneDefinitionInputStream::ReadDefinition()
|
|||||||
{
|
{
|
||||||
if (m_verbose)
|
if (m_verbose)
|
||||||
{
|
{
|
||||||
std::cout << "Reading zone definition file: " << m_file_name << std::endl;
|
std::cout << "Reading zone definition file: " << m_file_name << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto lexer = std::make_unique<ZoneDefinitionLexer>(m_stream);
|
const auto lexer = std::make_unique<ZoneDefinitionLexer>(m_stream);
|
||||||
@ -53,7 +53,7 @@ std::unique_ptr<ZoneDefinition> ZoneDefinitionInputStream::ReadDefinition()
|
|||||||
|
|
||||||
if (m_verbose)
|
if (m_verbose)
|
||||||
{
|
{
|
||||||
std::cout << "Processing zone definition took " << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() << "ms" << std::endl;
|
std::cout << "Processing zone definition took " << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() << "ms\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::move(definition);
|
return std::move(definition);
|
||||||
|
@ -146,7 +146,7 @@ void ContentLoader::Load(Zone* zone, IZoneInputStream* stream)
|
|||||||
m_stream->PushBlock(XFILE_BLOCK_VIRTUAL);
|
m_stream->PushBlock(XFILE_BLOCK_VIRTUAL);
|
||||||
|
|
||||||
XAssetList assetList{};
|
XAssetList assetList{};
|
||||||
m_stream->LoadDataRaw(&assetList, sizeof assetList);
|
m_stream->LoadDataRaw(&assetList, sizeof(assetList));
|
||||||
|
|
||||||
varScriptStringList = &assetList.stringList;
|
varScriptStringList = &assetList.stringList;
|
||||||
LoadScriptStringList(false);
|
LoadScriptStringList(false);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user