diff --git a/pcsx2-qt/QtHost.cpp b/pcsx2-qt/QtHost.cpp index 554ff7167b..1621bc98fa 100644 --- a/pcsx2-qt/QtHost.cpp +++ b/pcsx2-qt/QtHost.cpp @@ -1362,6 +1362,16 @@ std::optional Host::ReadResourceFileToString(const char* filename) return ret; } +std::optional Host::GetResourceFileTimestamp(const char* filename) +{ + const std::string path(Path::Combine(EmuFolders::Resources, filename)); + FILESYSTEM_STAT_DATA sd; + if (!FileSystem::StatFile(filename, &sd)) + return std::nullopt; + + return sd.ModificationTime; +} + void Host::ReportErrorAsync(const std::string_view& title, const std::string_view& message) { if (!title.empty() && !message.empty()) diff --git a/pcsx2/Host.h b/pcsx2/Host.h index ab2660c749..e18770207c 100644 --- a/pcsx2/Host.h +++ b/pcsx2/Host.h @@ -17,6 +17,7 @@ #include "common/Pcsx2Defs.h" +#include #include #include #include @@ -52,6 +53,9 @@ namespace Host /// Reads a resource file file from the resources directory as a string. std::optional ReadResourceFileToString(const char* filename); + /// Returns the modified time of a resource. + std::optional GetResourceFileTimestamp(const char* filename); + /// Adds OSD messages, duration is in seconds. void AddOSDMessage(std::string message, float duration = 2.0f); void AddKeyedOSDMessage(std::string key, std::string message, float duration = 2.0f); diff --git a/pcsx2/gui/AppHost.cpp b/pcsx2/gui/AppHost.cpp index 44c68ead6d..a8b1ce6fbb 100644 --- a/pcsx2/gui/AppHost.cpp +++ b/pcsx2/gui/AppHost.cpp @@ -84,6 +84,16 @@ std::optional Host::ReadResourceFileToString(const char* filename) return ret; } +std::optional Host::GetResourceFileTimestamp(const char* filename) +{ + const std::string path(Path::Combine(EmuFolders::Resources, filename)); + FILESYSTEM_STAT_DATA sd; + if (!FileSystem::StatFile(filename, &sd)) + return std::nullopt; + + return sd.ModificationTime; +} + bool Host::GetBoolSettingValue(const char* section, const char* key, bool default_value /* = false */) { return default_value;