[ZoneBuilder] Rough concept for external data

This commit is contained in:
momo5502 2016-11-20 20:41:38 +01:00
parent 6a51d280ae
commit b0f13911ca
3 changed files with 19 additions and 4 deletions

View File

@ -112,12 +112,19 @@ namespace Assets
buffer->align(Utils::Stream::ALIGN_4); buffer->align(Utils::Stream::ALIGN_4);
Game::GfxImageLoadDef* destTexture = buffer->dest<Game::GfxImageLoadDef>(); Game::GfxImageLoadDef* destTexture = buffer->dest<Game::GfxImageLoadDef>();
buffer->save(asset->texture, 16); buffer->save(asset->loadDef, 16);
builder->incrementExternalSize(asset->loadDef->dataSize);
// Zero the size! // Zero the size!
destTexture->dataSize = 0; destTexture->dataSize = 0;
Utils::Stream::ClearPointer(&dest->texture); if (destTexture->dataSize > 0)
{
buffer->save(asset->loadDef->data, asset->loadDef->dataSize);
}
Utils::Stream::ClearPointer(&dest->loadDef);
} }
buffer->popBlock(); buffer->popBlock();

View File

@ -5,7 +5,7 @@ namespace Components
std::string ZoneBuilder::TraceZone; std::string ZoneBuilder::TraceZone;
std::vector<std::pair<Game::XAssetType, std::string>> ZoneBuilder::TraceAssets; std::vector<std::pair<Game::XAssetType, std::string>> ZoneBuilder::TraceAssets;
ZoneBuilder::Zone::Zone(std::string name) : dataMap("zone_source/" + name + ".csv"), zoneName(name), indexStart(0), branding { 0 }, ZoneBuilder::Zone::Zone(std::string name) : dataMap("zone_source/" + name + ".csv"), zoneName(name), indexStart(0), externalSize(0), branding { 0 },
// Reserve 100MB by default. // Reserve 100MB by default.
// That's totally fine, as the dedi doesn't load images and therefore doesn't need much memory. // That's totally fine, as the dedi doesn't load images and therefore doesn't need much memory.
@ -316,7 +316,7 @@ namespace Components
this->buffer.enterCriticalSection(); this->buffer.enterCriticalSection();
Game::XFile* header = reinterpret_cast<Game::XFile*>(this->buffer.data()); Game::XFile* header = reinterpret_cast<Game::XFile*>(this->buffer.data());
header->size = this->buffer.length() - sizeof(Game::XFile); // Write correct data size header->size = this->buffer.length() - sizeof(Game::XFile); // Write correct data size
header->externalSize = 0; // ? header->externalSize = this->externalSize; // This actually stores how much external data has to be loaded. It's used to calculate the loadscreen progress
// Write stream sizes // Write stream sizes
for (int i = 0; i < Game::MAX_XFILE_COUNT; ++i) for (int i = 0; i < Game::MAX_XFILE_COUNT; ++i)
@ -459,6 +459,11 @@ namespace Components
} }
} }
void ZoneBuilder::Zone::incrementExternalSize(unsigned int size)
{
this->externalSize += size;
}
bool ZoneBuilder::IsEnabled() bool ZoneBuilder::IsEnabled()
{ {
return (Flags::HasFlag("zonebuilder") && !Dedicated::IsEnabled()); return (Flags::HasFlag("zonebuilder") && !Dedicated::IsEnabled());

View File

@ -41,6 +41,8 @@ namespace Components
void store(Game::XAssetHeader header); void store(Game::XAssetHeader header);
void incrementExternalSize(unsigned int size);
private: private:
void loadFastFiles(); void loadFastFiles();
@ -55,6 +57,7 @@ namespace Components
uint32_t safeGetPointer(const void* pointer); uint32_t safeGetPointer(const void* pointer);
int indexStart; int indexStart;
unsigned int externalSize;
Utils::Stream buffer; Utils::Stream buffer;
std::string zoneName; std::string zoneName;