diff --git a/src/spice2x/overlay/windows/patch_manager.cpp b/src/spice2x/overlay/windows/patch_manager.cpp index bf8b8cb..017d24b 100644 --- a/src/spice2x/overlay/windows/patch_manager.cpp +++ b/src/spice2x/overlay/windows/patch_manager.cpp @@ -1,11 +1,13 @@ #include "patch_manager.h" +#include #include #include #include #include #include #include +#include "external/fmt/include/fmt/chrono.h" #include "external/rapidjson/document.h" #include "external/rapidjson/prettywriter.h" #include "external/rapidjson/stringbuffer.h" @@ -1150,7 +1152,7 @@ namespace overlay::windows { } } - std::string get_game_identifier(const std::filesystem::path& dll_path) { + std::string get_game_identifier(const std::filesystem::path& dll_path, bool print_info) { uint32_t time_date_stamp = 0; uint32_t address_of_entry_point = 0; @@ -1159,7 +1161,7 @@ namespace overlay::windows { if (!result) { return ""; } - + // concatenate TimeDateStamp and AddressOfEntryPoint std::string identifier = fmt::format( @@ -1168,6 +1170,16 @@ namespace overlay::windows { time_date_stamp, address_of_entry_point); + if (print_info) { + const auto time = std::chrono::system_clock::from_time_t(time_date_stamp); + log_info( + "patchmanager", + "file: {}, patch id: {}, build timestamp of dll: {:%Y-%m-%d %H:%M}", + dll_path.has_filename() ? dll_path.filename().string() : dll_path.string(), + identifier, + time); + } + return identifier; } @@ -1657,14 +1669,12 @@ namespace overlay::windows { ACTIVE_JSON_FILE = ""; std::string firstDll = avs::game::DLL_NAME; - std::string first_id = get_game_identifier(MODULE_PATH / firstDll); + std::string first_id = get_game_identifier(MODULE_PATH / firstDll, true); std::filesystem::path firstPath = fmt::format("patches/{}.json", first_id); - log_misc("patchmanager", "patch identifier of {}: {}", firstDll, first_id); - auto extraDlls = getExtraDlls(firstDll); std::erase_if(extraDlls, [](const std::string& dll) { - auto identifier = get_game_identifier(MODULE_PATH / dll); + auto identifier = get_game_identifier(MODULE_PATH / dll, true); return identifier.empty() || !fileutils::file_exists(fmt::format("patches/{}.json", identifier)); }); diff --git a/src/spice2x/overlay/windows/patch_manager.h b/src/spice2x/overlay/windows/patch_manager.h index 105f199..1c407ce 100644 --- a/src/spice2x/overlay/windows/patch_manager.h +++ b/src/spice2x/overlay/windows/patch_manager.h @@ -97,7 +97,7 @@ namespace overlay::windows { extern std::optional PATCH_MANAGER_CFG_PATH_OVERRIDE; - std::string get_game_identifier(const std::filesystem::path& dll_path); + std::string get_game_identifier(const std::filesystem::path& dll_path, bool print_info=false); class PatchManager : public Window { public: