mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-07-01 16:51:56 +00:00
refactor: fix x64 compilation for ObjLoading
This commit is contained in:
@ -5,9 +5,7 @@
|
||||
#include "Game/T6/T6.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <format>
|
||||
#include <sstream>
|
||||
|
||||
using namespace T6;
|
||||
|
||||
@ -25,8 +23,8 @@ namespace
|
||||
constexpr unsigned ROW_ALIAS_NAME = 2;
|
||||
constexpr unsigned ROW_ALIAS_BUTTON = 3;
|
||||
|
||||
constexpr const char* VALUE_TYPE_ICON = "icon";
|
||||
constexpr const char* VALUE_TYPE_ALIAS = "alias";
|
||||
constexpr auto VALUE_TYPE_ICON = "icon";
|
||||
constexpr auto VALUE_TYPE_ALIAS = "alias";
|
||||
|
||||
constexpr unsigned COL_COUNT_ICON = 7;
|
||||
constexpr unsigned COL_COUNT_ALIAS = 4;
|
||||
@ -125,8 +123,8 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
fontIcon->numEntries = entries.size();
|
||||
fontIcon->numAliasEntries = aliases.size();
|
||||
fontIcon->numEntries = static_cast<unsigned>(entries.size());
|
||||
fontIcon->numAliasEntries = static_cast<unsigned>(aliases.size());
|
||||
|
||||
if (fontIcon->numEntries > 0)
|
||||
{
|
||||
@ -159,7 +157,7 @@ namespace
|
||||
{
|
||||
for (auto& cell : row)
|
||||
{
|
||||
for (auto c : cell)
|
||||
for (const auto c : cell)
|
||||
{
|
||||
if (isspace(c))
|
||||
continue;
|
||||
@ -220,7 +218,7 @@ namespace
|
||||
const std::string& assetName,
|
||||
const unsigned rowIndex,
|
||||
AssetCreationContext& context,
|
||||
AssetRegistration<AssetFontIcon>& registration)
|
||||
AssetRegistration<AssetFontIcon>& registration) const
|
||||
{
|
||||
if (row.size() < COL_COUNT_ICON)
|
||||
{
|
||||
@ -246,6 +244,7 @@ namespace
|
||||
std::cerr << std::format("{} Failed to load material \"{}\"\n", ErrorPrefix(assetName, rowIndex), row[ROW_ICON_MATERIAL]);
|
||||
return false;
|
||||
}
|
||||
registration.AddDependency(materialDependency);
|
||||
|
||||
icon.fontIconMaterialHandle = materialDependency->Asset();
|
||||
icon.fontIconName.string = m_memory.Dup(row[ROW_ICON_NAME].c_str());
|
||||
@ -254,7 +253,7 @@ namespace
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReadAliasRow(
|
||||
static bool ReadAliasRow(
|
||||
const std::vector<std::string>& row, FontIconAlias& alias, const std::string& assetName, const unsigned rowIndex, AssetCreationContext& context)
|
||||
{
|
||||
if (row.size() < COL_COUNT_ALIAS)
|
||||
|
@ -32,8 +32,8 @@ namespace
|
||||
|
||||
const auto fileSize = static_cast<size_t>(file.m_length);
|
||||
const auto fileData = std::make_unique<char[]>(fileSize);
|
||||
file.m_stream->read(fileData.get(), fileSize);
|
||||
const auto dataHash = static_cast<unsigned>(crc32(0u, reinterpret_cast<const Bytef*>(fileData.get()), fileSize));
|
||||
file.m_stream->read(fileData.get(), static_cast<std::streamsize>(fileSize));
|
||||
const auto dataHash = static_cast<unsigned>(crc32(0u, reinterpret_cast<const Bytef*>(fileData.get()), static_cast<unsigned>(fileSize)));
|
||||
|
||||
std::istringstream ss(std::string(fileData.get(), fileSize));
|
||||
const auto texture = iwi::LoadIwi(ss);
|
||||
|
@ -58,7 +58,7 @@ namespace
|
||||
zs.zfree = Z_NULL;
|
||||
zs.opaque = Z_NULL;
|
||||
zs.avail_in = static_cast<uInt>(file.m_length);
|
||||
zs.avail_out = compressionBufferSize;
|
||||
zs.avail_out = static_cast<unsigned>(compressionBufferSize);
|
||||
zs.next_in = reinterpret_cast<const Bytef*>(uncompressedBuffer.get());
|
||||
zs.next_out = reinterpret_cast<Bytef*>(&compressedBuffer[sizeof(uint32_t)]);
|
||||
|
||||
@ -92,7 +92,7 @@ namespace
|
||||
return AssetCreationResult::Success(context.AddAsset<AssetRawFile>(assetName, rawFile));
|
||||
}
|
||||
|
||||
AssetCreationResult LoadDefault(const SearchPathOpenFile& file, const std::string& assetName, AssetCreationContext& context)
|
||||
AssetCreationResult LoadDefault(const SearchPathOpenFile& file, const std::string& assetName, AssetCreationContext& context) const
|
||||
{
|
||||
auto* rawFile = m_memory.Alloc<RawFile>();
|
||||
rawFile->name = m_memory.Dup(assetName.c_str());
|
||||
|
@ -679,7 +679,7 @@ namespace
|
||||
if (!aliasList.empty())
|
||||
aliasLists.emplace_back(CreateAliasList(aliasList, memory));
|
||||
|
||||
sndBank->aliasCount = aliasLists.size();
|
||||
sndBank->aliasCount = static_cast<unsigned>(aliasLists.size());
|
||||
if (sndBank->aliasCount)
|
||||
{
|
||||
sndBank->alias = memory.Alloc<SndAliasList>(sndBank->aliasCount);
|
||||
@ -702,7 +702,7 @@ namespace
|
||||
const auto idx = sndBank->alias[i].id % sndBank->aliasCount;
|
||||
if (sndBank->aliasIndex[idx].value == std::numeric_limits<unsigned short>::max())
|
||||
{
|
||||
sndBank->aliasIndex[idx].value = i;
|
||||
sndBank->aliasIndex[idx].value = static_cast<unsigned short>(i);
|
||||
sndBank->aliasIndex[idx].next = std::numeric_limits<unsigned short>::max();
|
||||
setAliasIndexList[i] = true;
|
||||
}
|
||||
@ -720,14 +720,14 @@ namespace
|
||||
}
|
||||
|
||||
auto offset = 1u;
|
||||
auto freeIdx = std::numeric_limits<unsigned short>::max();
|
||||
unsigned short freeIdx;
|
||||
while (true)
|
||||
{
|
||||
freeIdx = (idx + offset) % sndBank->aliasCount;
|
||||
freeIdx = static_cast<unsigned short>((idx + offset) % sndBank->aliasCount);
|
||||
if (sndBank->aliasIndex[freeIdx].value == std::numeric_limits<unsigned short>::max())
|
||||
break;
|
||||
|
||||
freeIdx = (idx + sndBank->aliasCount - offset) % sndBank->aliasCount;
|
||||
freeIdx = static_cast<unsigned short>((idx + sndBank->aliasCount - offset) % sndBank->aliasCount);
|
||||
if (sndBank->aliasIndex[freeIdx].value == std::numeric_limits<unsigned short>::max())
|
||||
break;
|
||||
|
||||
@ -745,7 +745,7 @@ namespace
|
||||
}
|
||||
|
||||
sndBank->aliasIndex[idx].next = freeIdx;
|
||||
sndBank->aliasIndex[freeIdx].value = i;
|
||||
sndBank->aliasIndex[freeIdx].value = static_cast<unsigned short>(i);
|
||||
sndBank->aliasIndex[freeIdx].next = std::numeric_limits<unsigned short>::max();
|
||||
setAliasIndexList[i] = true;
|
||||
}
|
||||
@ -849,7 +849,7 @@ namespace
|
||||
radverbs.emplace_back(radverb);
|
||||
}
|
||||
|
||||
sndBank->radverbCount = radverbs.size();
|
||||
sndBank->radverbCount = static_cast<unsigned>(radverbs.size());
|
||||
if (sndBank->radverbCount)
|
||||
{
|
||||
sndBank->radverbs = memory.Alloc<SndRadverb>(sndBank->radverbCount);
|
||||
@ -912,7 +912,7 @@ namespace
|
||||
|
||||
for (auto& valueJson : duckJson["values"])
|
||||
{
|
||||
auto index = GetValueIndex(valueJson["duckGroup"].get<std::string>(), SOUND_DUCK_GROUPS, std::extent_v<decltype(SOUND_DUCK_GROUPS)>);
|
||||
const auto index = GetValueIndex(valueJson["duckGroup"].get<std::string>(), SOUND_DUCK_GROUPS, std::extent_v<decltype(SOUND_DUCK_GROUPS)>);
|
||||
|
||||
duck.attenuation[index] = valueJson["attenuation"].get<float>();
|
||||
duck.filter[index] = valueJson["filter"].get<float>();
|
||||
@ -921,7 +921,7 @@ namespace
|
||||
ducks.emplace_back(duck);
|
||||
}
|
||||
|
||||
sndBank->duckCount = ducks.size();
|
||||
sndBank->duckCount = static_cast<unsigned>(ducks.size());
|
||||
if (sndBank->duckCount)
|
||||
{
|
||||
sndBank->ducks = memory.Alloc<SndDuck>(sndBank->duckCount);
|
||||
@ -1046,7 +1046,7 @@ namespace
|
||||
|
||||
if (result)
|
||||
{
|
||||
sndBank->loadedAssets.dataSize = dataSize;
|
||||
sndBank->loadedAssets.dataSize = static_cast<unsigned>(dataSize);
|
||||
sndBank->loadedAssets.data = m_memory.Alloc<SndChar2048>(dataSize);
|
||||
}
|
||||
else
|
||||
|
@ -574,12 +574,12 @@ namespace
|
||||
{
|
||||
if (lastSibling == nullptr)
|
||||
{
|
||||
attachmentUnique.childLink = attachmentUniqueIndex;
|
||||
attachmentUnique.childLink = static_cast<int>(attachmentUniqueIndex);
|
||||
lastSibling = weapon.attachmentUniques[attachmentUniqueIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
lastSibling->siblingLink = attachmentUniqueIndex;
|
||||
lastSibling->siblingLink = static_cast<int>(attachmentUniqueIndex);
|
||||
lastSibling = weapon.attachmentUniques[attachmentUniqueIndex];
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ namespace
|
||||
{
|
||||
if (!jWeaponCamoMaterialSet.materials.empty())
|
||||
{
|
||||
weaponCamoMaterialSet.numMaterials = jWeaponCamoMaterialSet.materials.size();
|
||||
weaponCamoMaterialSet.numMaterials = static_cast<unsigned>(jWeaponCamoMaterialSet.materials.size());
|
||||
weaponCamoMaterialSet.materials = m_memory.Alloc<WeaponCamoMaterial>(weaponCamoMaterialSet.numMaterials);
|
||||
|
||||
for (auto i = 0u; i < weaponCamoMaterialSet.numMaterials; i++)
|
||||
@ -197,7 +197,7 @@ namespace
|
||||
|
||||
if (!jWeaponCamo.camoSets.empty())
|
||||
{
|
||||
weaponCamo.numCamoSets = jWeaponCamo.camoSets.size();
|
||||
weaponCamo.numCamoSets = static_cast<unsigned>(jWeaponCamo.camoSets.size());
|
||||
weaponCamo.camoSets = m_memory.Alloc<WeaponCamoSet>(weaponCamo.numCamoSets);
|
||||
|
||||
for (auto i = 0u; i < weaponCamo.numCamoSets; i++)
|
||||
@ -214,7 +214,7 @@ namespace
|
||||
|
||||
if (!jWeaponCamo.camoMaterials.empty())
|
||||
{
|
||||
weaponCamo.numCamoMaterials = jWeaponCamo.camoMaterials.size();
|
||||
weaponCamo.numCamoMaterials = static_cast<unsigned>(jWeaponCamo.camoMaterials.size());
|
||||
weaponCamo.camoMaterials = m_memory.Alloc<WeaponCamoMaterialSet>(weaponCamo.numCamoMaterials);
|
||||
|
||||
for (auto i = 0u; i < weaponCamo.numCamoMaterials; i++)
|
||||
|
Reference in New Issue
Block a user