summaryrefslogtreecommitdiff
path: root/src/Companion.cpp
diff options
context:
space:
mode:
authorKiritoDv <kiritodev01@gmail.com>2023-09-24 14:06:18 -0600
committerKiritoDv <kiritodev01@gmail.com>2023-09-24 14:06:18 -0600
commit9c6e090b80a7ea6fd4bf41f3b5fefb5de5c4e61b (patch)
tree16da7fa61f622c9d9d3edf8fdf700b330e670d49 /src/Companion.cpp
parentdea6dd369d60c09da6b5c1780010d7a5eb6cc11e (diff)
Added optimizations and a cute pattern
Diffstat (limited to 'src/Companion.cpp')
-rw-r--r--src/Companion.cpp16
1 files changed, 15 insertions, 1 deletions
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 <chrono>
#include <fstream>
#include <iostream>
#include <filesystem>
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<milliseconds>(system_clock::now().time_since_epoch());
+
std::ifstream input( this->gRomPath, std::ios::binary );
this->gRomData = std::vector<uint8_t>( std::istreambuf_iterator<char>( input ), {} );
input.close();
@@ -65,6 +69,8 @@ void Companion::Process() {
auto path = cfg["path"].as<std::string>();
auto otr = cfg["output"].as<std::string>();
+ 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<std::string>(), type);
+ spdlog::set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%l] > %v");
+ SPDLOG_INFO("Processing {} [{}]", asset->first.as<std::string>(), 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<milliseconds>(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();