diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/time/time_zone_content_manager.cpp | 17 | ||||
| -rw-r--r-- | src/core/hle/service/time/time_zone_content_manager.h | 2 |
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 @@ | |||
| 3 | 3 | ||
| 4 | #include <chrono> | 4 | #include <chrono> |
| 5 | #include <sstream> | 5 | #include <sstream> |
| 6 | #include <utility> | ||
| 6 | 7 | ||
| 7 | #include "common/logging/log.h" | 8 | #include "common/logging/log.h" |
| 8 | #include "common/settings.h" | 9 | #include "common/settings.h" |
| @@ -46,14 +47,14 @@ static FileSys::VirtualDir GetTimeZoneBinary(Core::System& system) { | |||
| 46 | return FileSys::ExtractRomFS(romfs); | 47 | return FileSys::ExtractRomFS(romfs); |
| 47 | } | 48 | } |
| 48 | 49 | ||
| 49 | static std::vector<std::string> BuildLocationNameCache(Core::System& system) { | 50 | static std::vector<std::string> BuildLocationNameCache( |
| 50 | const FileSys::VirtualDir extracted_romfs{GetTimeZoneBinary(system)}; | 51 | const FileSys::VirtualDir& time_zone_binary) { |
| 51 | if (!extracted_romfs) { | 52 | if (!time_zone_binary) { |
| 52 | LOG_ERROR(Service_Time, "Failed to extract RomFS for {:016X}!", time_zone_binary_titleid); | 53 | LOG_ERROR(Service_Time, "Failed to extract RomFS for {:016X}!", time_zone_binary_titleid); |
| 53 | return {}; | 54 | return {}; |
| 54 | } | 55 | } |
| 55 | 56 | ||
| 56 | const FileSys::VirtualFile binary_list{extracted_romfs->GetFile("binaryList.txt")}; | 57 | const FileSys::VirtualFile binary_list{time_zone_binary->GetFile("binaryList.txt")}; |
| 57 | if (!binary_list) { | 58 | if (!binary_list) { |
| 58 | LOG_ERROR(Service_Time, "{:016X} has no file binaryList.txt!", time_zone_binary_titleid); | 59 | LOG_ERROR(Service_Time, "{:016X} has no file binaryList.txt!", time_zone_binary_titleid); |
| 59 | return {}; | 60 | return {}; |
| @@ -73,7 +74,8 @@ static std::vector<std::string> BuildLocationNameCache(Core::System& system) { | |||
| 73 | } | 74 | } |
| 74 | 75 | ||
| 75 | TimeZoneContentManager::TimeZoneContentManager(Core::System& system_) | 76 | TimeZoneContentManager::TimeZoneContentManager(Core::System& system_) |
| 76 | : system{system_}, location_name_cache{BuildLocationNameCache(system)} {} | 77 | : system{system_}, time_zone_binary{GetTimeZoneBinary(system)}, |
| 78 | location_name_cache{BuildLocationNameCache(time_zone_binary)} {} | ||
| 77 | 79 | ||
| 78 | void TimeZoneContentManager::Initialize(TimeManager& time_manager) { | 80 | void TimeZoneContentManager::Initialize(TimeManager& time_manager) { |
| 79 | const auto timezone_setting = Settings::GetTimeZoneString(); | 81 | const auto timezone_setting = Settings::GetTimeZoneString(); |
| @@ -111,13 +113,12 @@ Result TimeZoneContentManager::GetTimeZoneInfoFile(const std::string& location_n | |||
| 111 | return ERROR_TIME_NOT_FOUND; | 113 | return ERROR_TIME_NOT_FOUND; |
| 112 | } | 114 | } |
| 113 | 115 | ||
| 114 | const FileSys::VirtualDir extracted_romfs{GetTimeZoneBinary(system)}; | 116 | if (!time_zone_binary) { |
| 115 | if (!extracted_romfs) { | ||
| 116 | LOG_ERROR(Service_Time, "Failed to extract RomFS for {:016X}!", time_zone_binary_titleid); | 117 | LOG_ERROR(Service_Time, "Failed to extract RomFS for {:016X}!", time_zone_binary_titleid); |
| 117 | return ERROR_TIME_NOT_FOUND; | 118 | return ERROR_TIME_NOT_FOUND; |
| 118 | } | 119 | } |
| 119 | 120 | ||
| 120 | const FileSys::VirtualDir zoneinfo_dir{extracted_romfs->GetSubdirectory("zoneinfo")}; | 121 | const FileSys::VirtualDir zoneinfo_dir{time_zone_binary->GetSubdirectory("zoneinfo")}; |
| 121 | if (!zoneinfo_dir) { | 122 | if (!zoneinfo_dir) { |
| 122 | LOG_ERROR(Service_Time, "{:016X} has no directory zoneinfo!", time_zone_binary_titleid); | 123 | LOG_ERROR(Service_Time, "{:016X} has no directory zoneinfo!", time_zone_binary_titleid); |
| 123 | return ERROR_TIME_NOT_FOUND; | 124 | 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 @@ | |||
| 6 | #include <string> | 6 | #include <string> |
| 7 | #include <vector> | 7 | #include <vector> |
| 8 | 8 | ||
| 9 | #include "core/file_sys/vfs_types.h" | ||
| 9 | #include "core/hle/service/time/time_zone_manager.h" | 10 | #include "core/hle/service/time/time_zone_manager.h" |
| 10 | 11 | ||
| 11 | namespace Core { | 12 | namespace Core { |
| @@ -41,6 +42,7 @@ private: | |||
| 41 | 42 | ||
| 42 | Core::System& system; | 43 | Core::System& system; |
| 43 | TimeZoneManager time_zone_manager; | 44 | TimeZoneManager time_zone_manager; |
| 45 | const FileSys::VirtualDir time_zone_binary; | ||
| 44 | const std::vector<std::string> location_name_cache; | 46 | const std::vector<std::string> location_name_cache; |
| 45 | }; | 47 | }; |
| 46 | 48 | ||