Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Shows the progress of loading HD pack #81

Merged
merged 2 commits into from
Mar 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Core/HdPackLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ bool HdPackLoader::CheckFile(string filename)
bool HdPackLoader::LoadFile(string filename, vector<uint8_t> &fileData)
{
fileData.clear();

MessageManager::DisplayMessage("Pack Loader", "Loading " + filename);
if(_loadFromZip) {
if(_reader.ExtractFile(filename, fileData)) {
return true;
Expand All @@ -134,6 +134,8 @@ bool HdPackLoader::LoadFile(string filename, vector<uint8_t> &fileData)
bool HdPackLoader::LoadPack()
{
string currentLine;
uint32_t lineCnt;

try {
vector<uint8_t> hdDefinition;
if(!LoadFile("hires.txt", hdDefinition)) {
Expand All @@ -142,7 +144,13 @@ bool HdPackLoader::LoadPack()

InitializeGlobalConditions();

MessageManager::DisplayMessage("Pack Loader", "Processing hires.txt");
lineCnt = 1;
for(string lineContent : StringUtilities::Split(string(hdDefinition.data(), hdDefinition.data() + hdDefinition.size()), '\n')) {
if (lineCnt % 1000 == 0) {
MessageManager::DisplayMessage("Pack Loader", std::to_string(lineCnt) + " lines processed");
}
lineCnt++;
if(lineContent.empty()) {
continue;
}
Expand Down Expand Up @@ -206,9 +214,11 @@ bool HdPackLoader::LoadPack()
ProcessSfxTag(tokens);
}
}
MessageManager::DisplayMessage("Pack Loader", std::to_string(lineCnt) + " lines processed in total");

LoadCustomPalette();
InitializeHdPack();
MessageManager::DisplayMessage("Pack Loader", "Completed");

return true;
} catch(std::exception &ex) {
Expand Down