From 9c6e090b80a7ea6fd4bf41f3b5fefb5de5c4e61b Mon Sep 17 00:00:00 2001 From: KiritoDv Date: Sun, 24 Sep 2023 14:06:18 -0600 Subject: Added optimizations and a cute pattern --- src/Companion.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/Companion.cpp') diff --git a/src/Companion.cpp b/src/Companion.cpp index e5f5cdd..40fd975 100644 --- a/src/Companion.cpp +++ b/src/Companion.cpp @@ -15,11 +15,13 @@ #include "factories/sm64/SDialogFactory.h" #include "spdlog/spdlog.h" +#include #include #include #include namespace fs = std::filesystem; +using namespace std::chrono; void Companion::Init() { @@ -47,6 +49,8 @@ void Companion::Init() { void Companion::Process() { + auto start = duration_cast(system_clock::now().time_since_epoch()); + std::ifstream input( this->gRomPath, std::ios::binary ); this->gRomData = std::vector( std::istreambuf_iterator( input ), {} ); input.close(); @@ -65,6 +69,8 @@ void Companion::Process() { auto path = cfg["path"].as(); auto otr = cfg["output"].as(); + SPDLOG_INFO("------------------------------------------------"); + spdlog::set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%l] > %v"); SPDLOG_INFO("Starting CubeOS..."); SPDLOG_INFO("Game: {}", cartridge->GetGameTitle()); @@ -89,8 +95,10 @@ void Companion::Process() { LUS::BinaryWriter write = LUS::BinaryWriter(); RawFactory* factory = this->GetFactory(type); + spdlog::set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%l] %v"); SPDLOG_INFO("------------------------------------------------"); - SPDLOG_INFO("Processing {} [{}] from {}", asset->first.as(), type); + spdlog::set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%l] > %v"); + SPDLOG_INFO("Processing {} [{}]", asset->first.as(), type); SPDLOG_INFO("Root: {}", entry.path().string()); if(!factory->process(&write, asset->second, this->gRomData)){ @@ -122,10 +130,16 @@ void Companion::Process() { } } + spdlog::set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%l] %v"); SPDLOG_INFO("------------------------------------------------"); + spdlog::set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%l] > %v"); SPDLOG_INFO("Writing version file"); wrapper.CreateFile("version", vWriter.ToVector()); vWriter.Close(); + auto end = duration_cast(system_clock::now().time_since_epoch()); + SPDLOG_INFO("Done! Took {}ms", end.count() - start.count()); + SPDLOG_INFO("Exported to {}", otr); + spdlog::set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%l] %v"); SPDLOG_INFO("------------------------------------------------"); MIO0Decoder::ClearCache(); -- cgit v1.2.3