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

Commit

Permalink
Merge pull request #81 from mkwong98/Sync2
Browse files Browse the repository at this point in the history
Shows the progress of loading HD pack
  • Loading branch information
NovaSquirrel authored Mar 21, 2022
2 parents af63ef0 + 0bdc2e1 commit 911fc8b
Showing 1 changed file with 11 additions and 1 deletion.
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

0 comments on commit 911fc8b

Please sign in to comment.