2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-06-29 15:51:57 +00:00

Replace FileAPI with c++ streams and std::filesystem

This commit is contained in:
Jan
2021-03-03 14:04:35 +01:00
parent b6b0a57232
commit 1cd06668e0
96 changed files with 1355 additions and 1061 deletions

View File

@ -43,15 +43,14 @@ namespace IW4
Texture* loadedTexture = nullptr;
IwiLoader loader(zone->GetMemory());
const std::string imageFileName = "images/" + std::string(image->name) + ".iwi";
auto* filePathImage = searchPath->Open(imageFileName);
const auto imageFileName = "images/" + std::string(image->name) + ".iwi";
if (filePathImage != nullptr)
{
loadedTexture = loader.LoadIwi(filePathImage);
filePathImage->Close();
delete filePathImage;
const auto filePathImage = searchPath->Open(imageFileName);
if (filePathImage != nullptr)
{
loadedTexture = loader.LoadIwi(*filePathImage);
}
}
if (loadedTexture != nullptr)
@ -59,8 +58,8 @@ namespace IW4
image->texture.texture = loadedTexture;
image->cardMemory.platform[0] = 0;
const int textureMipCount = loadedTexture->GetMipMapCount();
for (int mipLevel = 0; mipLevel < textureMipCount; mipLevel++)
const auto textureMipCount = loadedTexture->GetMipMapCount();
for (auto mipLevel = 0; mipLevel < textureMipCount; mipLevel++)
image->cardMemory.platform[0] += static_cast<int>(loadedTexture->GetSizeOfMipLevel(mipLevel) * loadedTexture->GetFaceCount());
}
else