Add load argument to unlinker to load zones before trying to unlink specified zones

this allows to make sure certain ipaks are loaded before dumping
This commit is contained in:
Jan
2021-03-27 16:45:30 +01:00
parent 7d4029b21f
commit 4f995751ce
10 changed files with 158 additions and 81 deletions

View File

@ -159,12 +159,13 @@ public:
return nullptr;
// Create new zone
auto* zone = new Zone(fileName, 0, &g_GameIW4);
zone->m_pools = std::make_unique<GameAssetPoolIW4>(zone, 0);
auto zone = std::make_unique<Zone>(fileName, 0, &g_GameIW4);
auto* zonePtr = zone.get();
zone->m_pools = std::make_unique<GameAssetPoolIW4>(zonePtr, 0);
zone->m_language = GetZoneLanguage(fileName);
// File is supported. Now setup all required steps for loading this file.
auto* zoneLoader = new ZoneLoader(zone);
auto* zoneLoader = new ZoneLoader(std::move(zone));
SetupBlock(zoneLoader);
@ -185,7 +186,7 @@ public:
zoneLoader->AddLoadingStep(std::make_unique<StepAllocXBlocks>());
// Start of the zone content
zoneLoader->AddLoadingStep(std::make_unique<StepLoadZoneContent>(std::make_unique<ContentLoader>(), zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK));
zoneLoader->AddLoadingStep(std::make_unique<StepLoadZoneContent>(std::make_unique<ContentLoader>(), zonePtr, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK));
// Return the fully setup zoneloader
return zoneLoader;

View File

@ -2,6 +2,7 @@
#include <cassert>
#include <cstring>
#include <memory>
#include "Game/T6/T6.h"
#include "Game/T6/ZoneConstantsT6.h"
@ -178,12 +179,13 @@ public:
return nullptr;
// Create new zone
auto* zone = new Zone(fileName, 0, &g_GameT6);
zone->m_pools = std::make_unique<GameAssetPoolT6>(zone, 0);
auto zone = std::make_unique<Zone>(fileName, 0, &g_GameT6);
auto* zonePtr = zone.get();
zone->m_pools = std::make_unique<GameAssetPoolT6>(zonePtr, 0);
zone->m_language = GetZoneLanguage(fileName);
// File is supported. Now setup all required steps for loading this file.
auto* zoneLoader = new ZoneLoader(zone);
auto* zoneLoader = new ZoneLoader(std::move(zone));
SetupBlock(zoneLoader);
@ -201,7 +203,7 @@ public:
zoneLoader->AddLoadingStep(std::make_unique<StepAllocXBlocks>());
// Start of the zone content
zoneLoader->AddLoadingStep(std::make_unique<StepLoadZoneContent>(std::make_unique<ContentLoader>(), zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK));
zoneLoader->AddLoadingStep(std::make_unique<StepLoadZoneContent>(std::make_unique<ContentLoader>(), zonePtr, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK));
if (isSecure)
{