summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
authorlat9nq <22451773+lat9nq@users.noreply.github.com>2023-07-30 18:55:19 +0200
committerlat9nq <22451773+lat9nq@users.noreply.github.com>2023-07-30 18:55:19 +0200
commiteaf2ab5289f62a0540c03d6aa1a8f558d473c6cf (patch)
tree80f4730073eb217cba1929bc341b2853623ff8c2 /src/core/hle
parentMerge pull request #11155 from liamwhite/memory3 (diff)
downloadyuzu-eaf2ab5289f62a0540c03d6aa1a8f558d473c6cf.tar
yuzu-eaf2ab5289f62a0540c03d6aa1a8f558d473c6cf.tar.gz
yuzu-eaf2ab5289f62a0540c03d6aa1a8f558d473c6cf.tar.bz2
yuzu-eaf2ab5289f62a0540c03d6aa1a8f558d473c6cf.tar.lz
yuzu-eaf2ab5289f62a0540c03d6aa1a8f558d473c6cf.tar.xz
yuzu-eaf2ab5289f62a0540c03d6aa1a8f558d473c6cf.tar.zst
yuzu-eaf2ab5289f62a0540c03d6aa1a8f558d473c6cf.zip
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/service/time/time_zone_content_manager.cpp17
-rw-r--r--src/core/hle/service/time/time_zone_content_manager.h2
2 files changed, 11 insertions, 8 deletions
diff --git a/src/core/hle/service/time/time_zone_content_manager.cpp b/src/core/hle/service/time/time_zone_content_manager.cpp
index 5d60be67a..3b6047ad0 100644
--- a/src/core/hle/service/time/time_zone_content_manager.cpp
+++ b/src/core/hle/service/time/time_zone_content_manager.cpp
@@ -3,6 +3,7 @@
#include <chrono>
#include <sstream>
+#include <utility>
#include "common/logging/log.h"
#include "common/settings.h"
@@ -46,14 +47,14 @@ static FileSys::VirtualDir GetTimeZoneBinary(Core::System& system) {
return FileSys::ExtractRomFS(romfs);
}
-static std::vector<std::string> BuildLocationNameCache(Core::System& system) {
- const FileSys::VirtualDir extracted_romfs{GetTimeZoneBinary(system)};
- if (!extracted_romfs) {
+static std::vector<std::string> BuildLocationNameCache(
+ const FileSys::VirtualDir& time_zone_binary) {
+ if (!time_zone_binary) {
LOG_ERROR(Service_Time, "Failed to extract RomFS for {:016X}!", time_zone_binary_titleid);
return {};
}
- const FileSys::VirtualFile binary_list{extracted_romfs->GetFile("binaryList.txt")};
+ const FileSys::VirtualFile binary_list{time_zone_binary->GetFile("binaryList.txt")};
if (!binary_list) {
LOG_ERROR(Service_Time, "{:016X} has no file binaryList.txt!", time_zone_binary_titleid);
return {};
@@ -73,7 +74,8 @@ static std::vector<std::string> BuildLocationNameCache(Core::System& system) {
}
TimeZoneContentManager::TimeZoneContentManager(Core::System& system_)
- : system{system_}, location_name_cache{BuildLocationNameCache(system)} {}
+ : system{system_}, time_zone_binary{GetTimeZoneBinary(system)},
+ location_name_cache{BuildLocationNameCache(time_zone_binary)} {}
void TimeZoneContentManager::Initialize(TimeManager& time_manager) {
const auto timezone_setting = Settings::GetTimeZoneString();
@@ -111,13 +113,12 @@ Result TimeZoneContentManager::GetTimeZoneInfoFile(const std::string& location_n
return ERROR_TIME_NOT_FOUND;
}
- const FileSys::VirtualDir extracted_romfs{GetTimeZoneBinary(system)};
- if (!extracted_romfs) {
+ if (!time_zone_binary) {
LOG_ERROR(Service_Time, "Failed to extract RomFS for {:016X}!", time_zone_binary_titleid);
return ERROR_TIME_NOT_FOUND;
}
- const FileSys::VirtualDir zoneinfo_dir{extracted_romfs->GetSubdirectory("zoneinfo")};
+ const FileSys::VirtualDir zoneinfo_dir{time_zone_binary->GetSubdirectory("zoneinfo")};
if (!zoneinfo_dir) {
LOG_ERROR(Service_Time, "{:016X} has no directory zoneinfo!", time_zone_binary_titleid);
return ERROR_TIME_NOT_FOUND;
diff --git a/src/core/hle/service/time/time_zone_content_manager.h b/src/core/hle/service/time/time_zone_content_manager.h
index 3d94b6428..a6f9698bc 100644
--- a/src/core/hle/service/time/time_zone_content_manager.h
+++ b/src/core/hle/service/time/time_zone_content_manager.h
@@ -6,6 +6,7 @@
#include <string>
#include <vector>
+#include "core/file_sys/vfs_types.h"
#include "core/hle/service/time/time_zone_manager.h"
namespace Core {
@@ -41,6 +42,7 @@ private:
Core::System& system;
TimeZoneManager time_zone_manager;
+ const FileSys::VirtualDir time_zone_binary;
const std::vector<std::string> location_name_cache;
};