summaryrefslogtreecommitdiff
path: root/src/core/hle
diff options
context:
space:
mode:
authorGravatar TheKoopaKingdom2017-04-13 01:18:54 -0400
committerGravatar TheKoopaKingdom2017-06-02 18:28:14 -0400
commita8aef599e02e336f9ecb8d5cfc50aa856ea0a1c7 (patch)
tree37a7edc6a27eff75c96117203f48c9f1ec640b97 /src/core/hle
parentOptimized messages that were repetitive and added ability for core errors to ... (diff)
downloadyuzu-a8aef599e02e336f9ecb8d5cfc50aa856ea0a1c7.tar.gz
yuzu-a8aef599e02e336f9ecb8d5cfc50aa856ea0a1c7.tar.xz
yuzu-a8aef599e02e336f9ecb8d5cfc50aa856ea0a1c7.zip
Created a whitelist of system archives to prevent false positives creating dialogs.
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/service/apt/apt.cpp5
-rw-r--r--src/core/hle/service/fs/fs_user.cpp55
2 files changed, 53 insertions, 7 deletions
diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp
index a92abb58f..4c587e3c8 100644
--- a/src/core/hle/service/apt/apt.cpp
+++ b/src/core/hle/service/apt/apt.cpp
@@ -281,9 +281,8 @@ void CancelParameter(Service::Interface* self) {
281 rb.Push(RESULT_SUCCESS); // No error 281 rb.Push(RESULT_SUCCESS); // No error
282 rb.Push(true); // Set to Success 282 rb.Push(true); // Set to Success
283 283
284 LOG_WARNING(Service_APT, 284 LOG_WARNING(Service_APT, "(STUBBED) called check_sender=0x%08X, sender_appid=0x%08X, "
285 "(STUBBED) called check_sender=0x%08X, sender_appid=0x%08X, " 285 "check_receiver=0x%08X, receiver_appid=0x%08X",
286 "check_receiver=0x%08X, receiver_appid=0x%08X",
287 check_sender, sender_appid, check_receiver, receiver_appid); 286 check_sender, sender_appid, check_receiver, receiver_appid);
288} 287}
289 288
diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp
index 0538ffc9c..c65d46238 100644
--- a/src/core/hle/service/fs/fs_user.cpp
+++ b/src/core/hle/service/fs/fs_user.cpp
@@ -130,14 +130,61 @@ static void OpenFileDirectly(Service::Interface* self) {
130 130
131 ResultVal<ArchiveHandle> archive_handle = OpenArchive(archive_id, archive_path); 131 ResultVal<ArchiveHandle> archive_handle = OpenArchive(archive_id, archive_path);
132 if (archive_handle.Failed()) { 132 if (archive_handle.Failed()) {
133 LOG_ERROR(Service_FS,
134 "failed to get a handle for archive archive_id=0x%08X archive_path=%s",
135 static_cast<u32>(archive_id), archive_path.DebugStr().c_str());
136 cmd_buff[1] = archive_handle.Code().raw; 133 cmd_buff[1] = archive_handle.Code().raw;
137 cmd_buff[3] = 0; 134 cmd_buff[3] = 0;
135
138 if (static_cast<FS::ArchiveIdCode>(archive_id) == ArchiveIdCode::NCCH) { 136 if (static_cast<FS::ArchiveIdCode>(archive_id) == ArchiveIdCode::NCCH) {
139 Core::System::GetInstance().SetStatus(Core::System::ResultStatus::ErrorSystemFiles); 137 // High Title ID of the archive: The category (https://3dbrew.org/wiki/Title_list).
138 // (Note: The values there are big endian, these must be little endian.)
139 const std::vector<u8> shared_data_archive = {0x9B, 0x00, 0x04, 0x00};
140 const std::vector<u8> system_data_archive = {0xDB, 0x00, 0x04, 0x00};
141
142 // Low Title IDs.
143 const std::vector<u8> mii_data = {0x02, 0x02, 0x01, 0x00};
144 const std::vector<u8> region_manifest = {0x02, 0x04, 0x01, 0x00};
145 const std::vector<u8> ng_word_list = {0x02, 0x03, 0x01, 0x00};
146
147 // Make a copy of the binary path because reusing AsBinary() for creating category
148 // results in bad_alloc being thrown.
149 std::vector<u8> binary_archive_path = archive_path.AsBinary();
150 std::vector<u8> category(binary_archive_path.begin() + 4,
151 binary_archive_path.begin() + 8);
152 std::vector<u8> path(binary_archive_path.begin(), binary_archive_path.begin() + 4);
153
154 if (category == shared_data_archive) {
155 if (path == mii_data) {
156 LOG_ERROR(Service_FS,
157 "Failed to get a handle for shared data archive: Mii data. "
158 "Archive ID=0x%08X Archive Path=%s",
159 static_cast<u32>(archive_id), archive_path.DebugStr().c_str());
160 Core::System::GetInstance().SetStatus(
161 Core::System::ResultStatus::ErrorSystemFiles, "Mii data");
162 return;
163 } else if (path == region_manifest) {
164 LOG_ERROR(Service_FS,
165 "Failed to get a handle for shared data archive: region manifest. "
166 "Archive ID=0x%08X Archive Path=%s",
167 static_cast<u32>(archive_id), archive_path.DebugStr().c_str());
168 Core::System::GetInstance().SetStatus(
169 Core::System::ResultStatus::ErrorSystemFiles, "Region manifest");
170 return;
171 }
172 } else if (category == system_data_archive) {
173 if (path == ng_word_list) {
174 LOG_ERROR(Service_FS,
175 "Failed to get a handle for system data archive: NG bad word list. "
176 "Archive ID=0x%08X Archive Path=%s",
177 static_cast<u32>(archive_id), archive_path.DebugStr().c_str());
178 Core::System::GetInstance().SetStatus(
179 Core::System::ResultStatus::ErrorSystemFiles, "NG bad word list");
180 return;
181 }
182 }
140 } 183 }
184
185 LOG_ERROR(Service_FS,
186 "Failed to get a handle for archive archive_id=0x%08X archive_path=%s",
187 static_cast<u32>(archive_id), archive_path.DebugStr().c_str());
141 return; 188 return;
142 } 189 }
143 SCOPE_EXIT({ CloseArchive(*archive_handle); }); 190 SCOPE_EXIT({ CloseArchive(*archive_handle); });