diff --git a/UnleashedRecomp/kernel/io/file_system.cpp b/UnleashedRecomp/kernel/io/file_system.cpp index c7e7ebc..8193364 100644 --- a/UnleashedRecomp/kernel/io/file_system.cpp +++ b/UnleashedRecomp/kernel/io/file_system.cpp @@ -1,11 +1,12 @@ -#include #include "file_system.h" +#include #include #include #include -#include -#include #include +#include +#include +#include struct FileHandle : KernelObject { @@ -365,8 +366,14 @@ std::filesystem::path FileSystem::ResolvePath(const std::string_view& path, bool if (checkForMods) { std::filesystem::path resolvedPath = ModLoader::ResolvePath(path); + if (!resolvedPath.empty()) + { + if (ModLoader::s_isLogTypeConsole) + LOGF_IMPL(Utility, "Mod Loader", "Loading file: \"{}\"", reinterpret_cast(resolvedPath.u8string().c_str())); + return resolvedPath; + } } thread_local std::string builtPath; diff --git a/UnleashedRecomp/mod/mod_loader.cpp b/UnleashedRecomp/mod/mod_loader.cpp index ebb275b..7c33b1a 100644 --- a/UnleashedRecomp/mod/mod_loader.cpp +++ b/UnleashedRecomp/mod/mod_loader.cpp @@ -119,7 +119,10 @@ void ModLoader::Init() } if (configIni.getString("CPKREDIR", "LogType", std::string()) == "console") + { os::process::ShowConsole(); + s_isLogTypeConsole = true; + } std::string modsDbIniFilePathU8 = configIni.getString("CPKREDIR", "ModsDbIni", ""); if (modsDbIniFilePathU8.empty()) @@ -239,7 +242,7 @@ void ModLoader::Init() { if (def->GetName() == codes[i]) { - LOGFN("Loaded code: {}", codes[i]); + LOGF_IMPL(Utility, "Mod Loader", "Loading code: \"{}\"", codes[i]); *(bool*)def->GetValue() = true; break; } @@ -375,6 +378,9 @@ PPC_FUNC(sub_82E0D3E8) std::ifstream stream(filePath, std::ios::binary); if (stream.good()) { + if (ModLoader::s_isLogTypeConsole) + LOGF_IMPL(Utility, "Mod Loader", "Loading file: \"{}\"", reinterpret_cast(filePath.u8string().c_str())); + be signature{}; stream.read(reinterpret_cast(&signature), sizeof(signature)); @@ -610,6 +616,9 @@ PPC_FUNC(sub_82E0B500) std::ifstream stream(arFilePath, std::ios::binary); if (stream.good()) { + if (ModLoader::s_isLogTypeConsole) + LOGF_IMPL(Utility, "Mod Loader", "Loading file: \"{}\"", reinterpret_cast(arFilePath.u8string().c_str())); + stream.seekg(0, std::ios::end); size_t arFileSize = stream.tellg(); diff --git a/UnleashedRecomp/mod/mod_loader.h b/UnleashedRecomp/mod/mod_loader.h index 84a5830..96acc28 100644 --- a/UnleashedRecomp/mod/mod_loader.h +++ b/UnleashedRecomp/mod/mod_loader.h @@ -2,6 +2,8 @@ struct ModLoader { + static inline bool s_isLogTypeConsole; + static inline std::filesystem::path s_saveFilePath; static std::filesystem::path ResolvePath(std::string_view path); diff --git a/UnleashedRecomp/user/config.cpp b/UnleashedRecomp/user/config.cpp index c506564..fe8699d 100644 --- a/UnleashedRecomp/user/config.cpp +++ b/UnleashedRecomp/user/config.cpp @@ -758,6 +758,8 @@ void Config::Load() void Config::Save() { + LOGN("Saving configuration..."); + auto userPath = GetUserPath(); if (!std::filesystem::exists(userPath))