From 37bec598ea28662462dcaab65d5abd6db8372dbc Mon Sep 17 00:00:00 2001 From: TheKoopaKingdom Date: Wed, 8 Mar 2017 20:21:31 -0500 Subject: Made some changes from review comments: - Made LoadKernelSystemMode return a pair consisting of a system mode and a result code (Could use review). - Deleted ErrorOpenGL error code in favor of just having ErrorVideoCore. - Made dialog messages more clear. - Compared archive ID in fs_user.cpp to ArchiveIdCode::NCCH as opposed to hex magic. - Cleaned up some other stuff. --- src/core/file_sys/archive_ncch.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/core/file_sys') diff --git a/src/core/file_sys/archive_ncch.cpp b/src/core/file_sys/archive_ncch.cpp index 89455e39c..bf4e0916b 100644 --- a/src/core/file_sys/archive_ncch.cpp +++ b/src/core/file_sys/archive_ncch.cpp @@ -37,7 +37,8 @@ ResultVal> ArchiveFactory_NCCH::Open(const Path& auto file = std::make_shared(file_path, "rb"); if (!file->IsOpen()) { - return ResultCode(-1); // TODO(Subv): Find the right error code + return ResultCode(ErrorDescription::FS_NotFound, ErrorModule::FS, ErrorSummary::NotFound, + ErrorLevel::Status); } auto size = file->GetSize(); -- cgit v1.2.3 From cea19fd659496bcdf09a12b163ce490c1fa71ff7 Mon Sep 17 00:00:00 2001 From: TheKoopaKingdom Date: Tue, 23 May 2017 19:46:30 -0400 Subject: Moved whitelist checks from FS_User to the Archive_NCCH handler. --- src/core/file_sys/archive_ncch.cpp | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'src/core/file_sys') diff --git a/src/core/file_sys/archive_ncch.cpp b/src/core/file_sys/archive_ncch.cpp index bf4e0916b..84950f871 100644 --- a/src/core/file_sys/archive_ncch.cpp +++ b/src/core/file_sys/archive_ncch.cpp @@ -9,6 +9,7 @@ #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/ivfc_archive.h" #include "core/hle/service/fs/archive.h" @@ -33,10 +34,43 @@ ArchiveFactory_NCCH::ArchiveFactory_NCCH(const std::string& nand_directory) ResultVal> ArchiveFactory_NCCH::Open(const Path& path) { auto vec = path.AsBinary(); const u32* data = reinterpret_cast(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(file_path, "rb"); if (!file->IsOpen()) { + // High Title ID of the archive: The category (https://3dbrew.org/wiki/Title_list). + const u32 shared_data_archive = 0x0004009B; + const u32 system_data_archive = 0x000400DB; + + // Low Title IDs. + const u32 mii_data = 0x00010202; + const u32 region_manifest = 0x00010402; + const 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 manifes"); + 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 ResultCode(ErrorDescription::FS_NotFound, ErrorModule::FS, ErrorSummary::NotFound, ErrorLevel::Status); } -- cgit v1.2.3 From 59de38b96525d1230df07de3d6cda422421fd883 Mon Sep 17 00:00:00 2001 From: TheKoopaKingdom Date: Wed, 24 May 2017 19:51:31 -0400 Subject: Switched to the ERROR_NOT_FOUND constant from errors.h. --- src/core/file_sys/archive_ncch.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/file_sys') diff --git a/src/core/file_sys/archive_ncch.cpp b/src/core/file_sys/archive_ncch.cpp index 84950f871..ad59c053e 100644 --- a/src/core/file_sys/archive_ncch.cpp +++ b/src/core/file_sys/archive_ncch.cpp @@ -11,6 +11,7 @@ #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" @@ -71,8 +72,7 @@ ResultVal> ArchiveFactory_NCCH::Open(const Path& "NG bad word list"); } } - return ResultCode(ErrorDescription::FS_NotFound, ErrorModule::FS, ErrorSummary::NotFound, - ErrorLevel::Status); + return ERROR_NOT_FOUND; } auto size = file->GetSize(); -- cgit v1.2.3 From f008b22e3b2baa7720ea65c320fe49929a53bad7 Mon Sep 17 00:00:00 2001 From: TheKoopaKingdom Date: Fri, 2 Jun 2017 17:03:38 -0400 Subject: Addressed Bunnei's review comments, and made some other tweaks: - Deleted GetStatus() because it wasn't used anywhere outside of Core::System. - Fixed design flaw where the message bar status could be set despite the game being stopped. --- src/core/file_sys/archive_ncch.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/core/file_sys') diff --git a/src/core/file_sys/archive_ncch.cpp b/src/core/file_sys/archive_ncch.cpp index ad59c053e..6d9007731 100644 --- a/src/core/file_sys/archive_ncch.cpp +++ b/src/core/file_sys/archive_ncch.cpp @@ -42,13 +42,13 @@ ResultVal> ArchiveFactory_NCCH::Open(const Path& if (!file->IsOpen()) { // High Title ID of the archive: The category (https://3dbrew.org/wiki/Title_list). - const u32 shared_data_archive = 0x0004009B; - const u32 system_data_archive = 0x000400DB; + constexpr u32 shared_data_archive = 0x0004009B; + constexpr u32 system_data_archive = 0x000400DB; // Low Title IDs. - const u32 mii_data = 0x00010202; - const u32 region_manifest = 0x00010402; - const u32 ng_word_list = 0x00010302; + 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); @@ -60,7 +60,7 @@ ResultVal> ArchiveFactory_NCCH::Open(const Path& "Mii data"); } else if (low == region_manifest) { LOG_ERROR(Service_FS, - "Failed to get a handle for shared data archive: region manifes"); + "Failed to get a handle for shared data archive: region manifest."); Core::System::GetInstance().SetStatus(Core::System::ResultStatus::ErrorSystemFiles, "Region manifest"); } -- cgit v1.2.3