summaryrefslogtreecommitdiff
path: root/src/core/file_sys
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2017-06-02 22:24:29 -0400
committerGitHub <noreply@github.com>2017-06-02 22:24:29 -0400
commit81449f025a190cd9f931d73cf959ddbfebff497a (patch)
tree24a15888dd6ebc515a09eaf00623fa23e2d4665d /src/core/file_sys
parent4857eb441bbe7ba1637838c9e5158f0801f40730 (diff)
parentf008b22e3b2baa7720ea65c320fe49929a53bad7 (diff)
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 @@
#include "common/file_util.h"
#include "common/logging/log.h"
#include "common/string_util.h"
+#include "core/core.h"
#include "core/file_sys/archive_ncch.h"
+#include "core/file_sys/errors.h"
#include "core/file_sys/ivfc_archive.h"
#include "core/hle/service/fs/archive.h"
@@ -33,11 +35,44 @@ ArchiveFactory_NCCH::ArchiveFactory_NCCH(const std::string& nand_directory)
ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_NCCH::Open(const Path& path) {
auto vec = path.AsBinary();
const u32* data = reinterpret_cast<u32*>(vec.data());
- std::string file_path = GetNCCHPath(mount_point, data[1], data[0]);
+ u32 high = data[1];
+ u32 low = data[0];
+ std::string file_path = GetNCCHPath(mount_point, high, low);
auto file = std::make_shared<FileUtil::IOFile>(file_path, "rb");
if (!file->IsOpen()) {
- return ResultCode(-1); // TODO(Subv): Find the right error code
+ // High Title ID of the archive: The category (https://3dbrew.org/wiki/Title_list).
+ constexpr u32 shared_data_archive = 0x0004009B;
+ constexpr u32 system_data_archive = 0x000400DB;
+
+ // Low Title IDs.
+ constexpr u32 mii_data = 0x00010202;
+ constexpr u32 region_manifest = 0x00010402;
+ constexpr u32 ng_word_list = 0x00010302;
+
+ LOG_DEBUG(Service_FS, "Full Path: %s. Category: 0x%X. Path: 0x%X.", path.DebugStr().c_str(),
+ high, low);
+
+ if (high == shared_data_archive) {
+ if (low == mii_data) {
+ LOG_ERROR(Service_FS, "Failed to get a handle for shared data archive: Mii data. ");
+ Core::System::GetInstance().SetStatus(Core::System::ResultStatus::ErrorSystemFiles,
+ "Mii data");
+ } else if (low == region_manifest) {
+ LOG_ERROR(Service_FS,
+ "Failed to get a handle for shared data archive: region manifest.");
+ Core::System::GetInstance().SetStatus(Core::System::ResultStatus::ErrorSystemFiles,
+ "Region manifest");
+ }
+ } else if (high == system_data_archive) {
+ if (low == ng_word_list) {
+ LOG_ERROR(Service_FS,
+ "Failed to get a handle for system data archive: NG bad word list.");
+ Core::System::GetInstance().SetStatus(Core::System::ResultStatus::ErrorSystemFiles,
+ "NG bad word list");
+ }
+ }
+ return ERROR_NOT_FOUND;
}
auto size = file->GetSize();