summaryrefslogtreecommitdiff
path: root/src/core/file_sys
diff options
context:
space:
mode:
authorGravatar bunnei2017-06-02 22:24:29 -0400
committerGravatar GitHub2017-06-02 22:24:29 -0400
commit81449f025a190cd9f931d73cf959ddbfebff497a (patch)
tree24a15888dd6ebc515a09eaf00623fa23e2d4665d /src/core/file_sys
parentMerge pull request #2722 from wwylele/cam-ipc-helper (diff)
parentAddressed Bunnei's review comments, and made some other tweaks: (diff)
downloadyuzu-81449f025a190cd9f931d73cf959ddbfebff497a.tar.gz
yuzu-81449f025a190cd9f931d73cf959ddbfebff497a.tar.xz
yuzu-81449f025a190cd9f931d73cf959ddbfebff497a.zip
Merge pull request #2611 from TheKoopaKingdom/missing-file-dialogs
Display QMessageBox Dialogs For Errors
Diffstat (limited to 'src/core/file_sys')
-rw-r--r--src/core/file_sys/archive_ncch.cpp39
1 files changed, 37 insertions, 2 deletions
diff --git a/src/core/file_sys/archive_ncch.cpp b/src/core/file_sys/archive_ncch.cpp
index 89455e39c..6d9007731 100644
--- a/src/core/file_sys/archive_ncch.cpp
+++ b/src/core/file_sys/archive_ncch.cpp
@@ -9,7 +9,9 @@
9#include "common/file_util.h" 9#include "common/file_util.h"
10#include "common/logging/log.h" 10#include "common/logging/log.h"
11#include "common/string_util.h" 11#include "common/string_util.h"
12#include "core/core.h"
12#include "core/file_sys/archive_ncch.h" 13#include "core/file_sys/archive_ncch.h"
14#include "core/file_sys/errors.h"
13#include "core/file_sys/ivfc_archive.h" 15#include "core/file_sys/ivfc_archive.h"
14#include "core/hle/service/fs/archive.h" 16#include "core/hle/service/fs/archive.h"
15 17
@@ -33,11 +35,44 @@ ArchiveFactory_NCCH::ArchiveFactory_NCCH(const std::string& nand_directory)
33ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_NCCH::Open(const Path& path) { 35ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_NCCH::Open(const Path& path) {
34 auto vec = path.AsBinary(); 36 auto vec = path.AsBinary();
35 const u32* data = reinterpret_cast<u32*>(vec.data()); 37 const u32* data = reinterpret_cast<u32*>(vec.data());
36 std::string file_path = GetNCCHPath(mount_point, data[1], data[0]); 38 u32 high = data[1];
39 u32 low = data[0];
40 std::string file_path = GetNCCHPath(mount_point, high, low);
37 auto file = std::make_shared<FileUtil::IOFile>(file_path, "rb"); 41 auto file = std::make_shared<FileUtil::IOFile>(file_path, "rb");
38 42
39 if (!file->IsOpen()) { 43 if (!file->IsOpen()) {
40 return ResultCode(-1); // TODO(Subv): Find the right error code 44 // High Title ID of the archive: The category (https://3dbrew.org/wiki/Title_list).
45 constexpr u32 shared_data_archive = 0x0004009B;
46 constexpr u32 system_data_archive = 0x000400DB;
47
48 // Low Title IDs.
49 constexpr u32 mii_data = 0x00010202;
50 constexpr u32 region_manifest = 0x00010402;
51 constexpr u32 ng_word_list = 0x00010302;
52
53 LOG_DEBUG(Service_FS, "Full Path: %s. Category: 0x%X. Path: 0x%X.", path.DebugStr().c_str(),
54 high, low);
55
56 if (high == shared_data_archive) {
57 if (low == mii_data) {
58 LOG_ERROR(Service_FS, "Failed to get a handle for shared data archive: Mii data. ");
59 Core::System::GetInstance().SetStatus(Core::System::ResultStatus::ErrorSystemFiles,
60 "Mii data");
61 } else if (low == region_manifest) {
62 LOG_ERROR(Service_FS,
63 "Failed to get a handle for shared data archive: region manifest.");
64 Core::System::GetInstance().SetStatus(Core::System::ResultStatus::ErrorSystemFiles,
65 "Region manifest");
66 }
67 } else if (high == system_data_archive) {
68 if (low == ng_word_list) {
69 LOG_ERROR(Service_FS,
70 "Failed to get a handle for system data archive: NG bad word list.");
71 Core::System::GetInstance().SetStatus(Core::System::ResultStatus::ErrorSystemFiles,
72 "NG bad word list");
73 }
74 }
75 return ERROR_NOT_FOUND;
41 } 76 }
42 auto size = file->GetSize(); 77 auto size = file->GetSize();
43 78