From 94391749edc0af692f410d18bb6e87554e109ffc Mon Sep 17 00:00:00 2001 From: mkwong98 Date: Mon, 21 Mar 2022 09:06:38 +0800 Subject: [PATCH] Shows the progress of loading HD pack Display messages every 1000 lines processed and each file loaded from the HD pack --- Core/HdPackLoader.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Core/HdPackLoader.cpp b/Core/HdPackLoader.cpp index cddfaa5e9..aee916c66 100644 --- a/Core/HdPackLoader.cpp +++ b/Core/HdPackLoader.cpp @@ -109,7 +109,7 @@ bool HdPackLoader::CheckFile(string filename) bool HdPackLoader::LoadFile(string filename, vector &fileData) { fileData.clear(); - + MessageManager::DisplayMessage("Pack Loader", "Loading " + filename); if(_loadFromZip) { if(_reader.ExtractFile(filename, fileData)) { return true; @@ -134,6 +134,8 @@ bool HdPackLoader::LoadFile(string filename, vector &fileData) bool HdPackLoader::LoadPack() { string currentLine; + uint32_t lineCnt; + try { vector hdDefinition; if(!LoadFile("hires.txt", hdDefinition)) { @@ -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; } @@ -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) {