2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-07-04 23:00:04 +00:00

chore: add possibility to provide loading progress callback when loading zones

This commit is contained in:
Jan Laupetin
2025-10-14 16:48:20 +01:00
parent fa7fd26db6
commit 5b3664ad8c
22 changed files with 451 additions and 246 deletions
+3 -3
View File
@@ -7,11 +7,11 @@
#include <filesystem>
#include <format>
#include <fstream>
#include <iostream>
namespace fs = std::filesystem;
result::Expected<std::unique_ptr<Zone>, std::string> ZoneLoading::LoadZone(const std::string& path)
result::Expected<std::unique_ptr<Zone>, std::string> ZoneLoading::LoadZone(const std::string& path,
std::optional<std::unique_ptr<ProgressCallback>> progressCallback)
{
auto zoneName = fs::path(path).filename().replace_extension().string();
std::ifstream file(path, std::fstream::in | std::fstream::binary);
@@ -28,7 +28,7 @@ result::Expected<std::unique_ptr<Zone>, std::string> ZoneLoading::LoadZone(const
for (auto game = 0u; game < static_cast<unsigned>(GameId::COUNT); game++)
{
const auto* factory = IZoneLoaderFactory::GetZoneLoaderFactoryForGame(static_cast<GameId>(game));
zoneLoader = factory->CreateLoaderForHeader(header, zoneName);
zoneLoader = factory->CreateLoaderForHeader(header, zoneName, std::move(progressCallback));
if (zoneLoader)
break;