summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/CMakeLists.txt4
-rw-r--r--src/core/file_sys/archive_ncch.cpp (renamed from src/core/file_sys/archive_savedatacheck.cpp)22
-rw-r--r--src/core/file_sys/archive_ncch.h (renamed from src/core/file_sys/archive_savedatacheck.h)8
-rw-r--r--src/core/hle/service/fs/archive.cpp9
-rw-r--r--src/core/hle/service/fs/archive.h2
5 files changed, 22 insertions, 23 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 1ecd1c431..299f1f261 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -17,9 +17,9 @@ set(SRCS
17 core_timing.cpp 17 core_timing.cpp
18 file_sys/archive_backend.cpp 18 file_sys/archive_backend.cpp
19 file_sys/archive_extsavedata.cpp 19 file_sys/archive_extsavedata.cpp
20 file_sys/archive_ncch.cpp
20 file_sys/archive_romfs.cpp 21 file_sys/archive_romfs.cpp
21 file_sys/archive_savedata.cpp 22 file_sys/archive_savedata.cpp
22 file_sys/archive_savedatacheck.cpp
23 file_sys/archive_sdmc.cpp 23 file_sys/archive_sdmc.cpp
24 file_sys/archive_sdmcwriteonly.cpp 24 file_sys/archive_sdmcwriteonly.cpp
25 file_sys/archive_systemsavedata.cpp 25 file_sys/archive_systemsavedata.cpp
@@ -162,9 +162,9 @@ set(HEADERS
162 core_timing.h 162 core_timing.h
163 file_sys/archive_backend.h 163 file_sys/archive_backend.h
164 file_sys/archive_extsavedata.h 164 file_sys/archive_extsavedata.h
165 file_sys/archive_ncch.h
165 file_sys/archive_romfs.h 166 file_sys/archive_romfs.h
166 file_sys/archive_savedata.h 167 file_sys/archive_savedata.h
167 file_sys/archive_savedatacheck.h
168 file_sys/archive_sdmc.h 168 file_sys/archive_sdmc.h
169 file_sys/archive_sdmcwriteonly.h 169 file_sys/archive_sdmcwriteonly.h
170 file_sys/archive_systemsavedata.h 170 file_sys/archive_systemsavedata.h
diff --git a/src/core/file_sys/archive_savedatacheck.cpp b/src/core/file_sys/archive_ncch.cpp
index 6c4542b7d..6f1aadfc3 100644
--- a/src/core/file_sys/archive_savedatacheck.cpp
+++ b/src/core/file_sys/archive_ncch.cpp
@@ -9,7 +9,7 @@
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/file_sys/archive_savedatacheck.h" 12#include "core/file_sys/archive_ncch.h"
13#include "core/file_sys/ivfc_archive.h" 13#include "core/file_sys/ivfc_archive.h"
14#include "core/hle/service/fs/archive.h" 14#include "core/hle/service/fs/archive.h"
15 15
@@ -18,22 +18,22 @@
18 18
19namespace FileSys { 19namespace FileSys {
20 20
21static std::string GetSaveDataCheckContainerPath(const std::string& nand_directory) { 21static std::string GetNCCHContainerPath(const std::string& nand_directory) {
22 return Common::StringFromFormat("%s%s/title/", nand_directory.c_str(), SYSTEM_ID.c_str()); 22 return Common::StringFromFormat("%s%s/title/", nand_directory.c_str(), SYSTEM_ID.c_str());
23} 23}
24 24
25static std::string GetSaveDataCheckPath(const std::string& mount_point, u32 high, u32 low) { 25static std::string GetNCCHPath(const std::string& mount_point, u32 high, u32 low) {
26 return Common::StringFromFormat("%s%08x/%08x/content/00000000.app.romfs", mount_point.c_str(), 26 return Common::StringFromFormat("%s%08x/%08x/content/00000000.app.romfs", mount_point.c_str(),
27 high, low); 27 high, low);
28} 28}
29 29
30ArchiveFactory_SaveDataCheck::ArchiveFactory_SaveDataCheck(const std::string& nand_directory) 30ArchiveFactory_NCCH::ArchiveFactory_NCCH(const std::string& nand_directory)
31 : mount_point(GetSaveDataCheckContainerPath(nand_directory)) {} 31 : mount_point(GetNCCHContainerPath(nand_directory)) {}
32 32
33ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SaveDataCheck::Open(const Path& path) { 33ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_NCCH::Open(const Path& path) {
34 auto vec = path.AsBinary(); 34 auto vec = path.AsBinary();
35 const u32* data = reinterpret_cast<u32*>(vec.data()); 35 const u32* data = reinterpret_cast<u32*>(vec.data());
36 std::string file_path = GetSaveDataCheckPath(mount_point, data[1], data[0]); 36 std::string file_path = GetNCCHPath(mount_point, data[1], data[0]);
37 auto file = std::make_shared<FileUtil::IOFile>(file_path, "rb"); 37 auto file = std::make_shared<FileUtil::IOFile>(file_path, "rb");
38 38
39 if (!file->IsOpen()) { 39 if (!file->IsOpen()) {
@@ -45,15 +45,15 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SaveDataCheck::Open(co
45 return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive)); 45 return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive));
46} 46}
47 47
48ResultCode ArchiveFactory_SaveDataCheck::Format(const Path& path, 48ResultCode ArchiveFactory_NCCH::Format(const Path& path,
49 const FileSys::ArchiveFormatInfo& format_info) { 49 const FileSys::ArchiveFormatInfo& format_info) {
50 LOG_ERROR(Service_FS, "Attempted to format a SaveDataCheck archive."); 50 LOG_ERROR(Service_FS, "Attempted to format a NCCH archive.");
51 // TODO: Verify error code 51 // TODO: Verify error code
52 return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported, 52 return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported,
53 ErrorLevel::Permanent); 53 ErrorLevel::Permanent);
54} 54}
55 55
56ResultVal<ArchiveFormatInfo> ArchiveFactory_SaveDataCheck::GetFormatInfo(const Path& path) const { 56ResultVal<ArchiveFormatInfo> ArchiveFactory_NCCH::GetFormatInfo(const Path& path) const {
57 // TODO(Subv): Implement 57 // TODO(Subv): Implement
58 LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive %s", GetName().c_str()); 58 LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive %s", GetName().c_str());
59 return ResultCode(-1); 59 return ResultCode(-1);
diff --git a/src/core/file_sys/archive_savedatacheck.h b/src/core/file_sys/archive_ncch.h
index e9cafbed9..66b8ce75d 100644
--- a/src/core/file_sys/archive_savedatacheck.h
+++ b/src/core/file_sys/archive_ncch.h
@@ -14,13 +14,13 @@
14 14
15namespace FileSys { 15namespace FileSys {
16 16
17/// File system interface to the SaveDataCheck archive 17/// File system interface to the NCCH archive
18class ArchiveFactory_SaveDataCheck final : public ArchiveFactory { 18class ArchiveFactory_NCCH final : public ArchiveFactory {
19public: 19public:
20 ArchiveFactory_SaveDataCheck(const std::string& mount_point); 20 ArchiveFactory_NCCH(const std::string& mount_point);
21 21
22 std::string GetName() const override { 22 std::string GetName() const override {
23 return "SaveDataCheck"; 23 return "NCCH";
24 } 24 }
25 25
26 ResultVal<std::unique_ptr<ArchiveBackend>> Open(const Path& path) override; 26 ResultVal<std::unique_ptr<ArchiveBackend>> Open(const Path& path) override;
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index 62cf2c249..4c29784e8 100644
--- a/src/core/hle/service/fs/archive.cpp
+++ b/src/core/hle/service/fs/archive.cpp
@@ -15,8 +15,8 @@
15#include "common/logging/log.h" 15#include "common/logging/log.h"
16#include "core/file_sys/archive_backend.h" 16#include "core/file_sys/archive_backend.h"
17#include "core/file_sys/archive_extsavedata.h" 17#include "core/file_sys/archive_extsavedata.h"
18#include "core/file_sys/archive_ncch.h"
18#include "core/file_sys/archive_savedata.h" 19#include "core/file_sys/archive_savedata.h"
19#include "core/file_sys/archive_savedatacheck.h"
20#include "core/file_sys/archive_sdmc.h" 20#include "core/file_sys/archive_sdmc.h"
21#include "core/file_sys/archive_sdmcwriteonly.h" 21#include "core/file_sys/archive_sdmcwriteonly.h"
22#include "core/file_sys/archive_systemsavedata.h" 22#include "core/file_sys/archive_systemsavedata.h"
@@ -554,10 +554,9 @@ void RegisterArchiveTypes() {
554 LOG_ERROR(Service_FS, "Can't instantiate SharedExtSaveData archive with path %s", 554 LOG_ERROR(Service_FS, "Can't instantiate SharedExtSaveData archive with path %s",
555 sharedextsavedata_factory->GetMountPoint().c_str()); 555 sharedextsavedata_factory->GetMountPoint().c_str());
556 556
557 // Create the SaveDataCheck archive, basically a small variation of the RomFS archive 557 // Create the NCCH archive, basically a small variation of the RomFS archive
558 auto savedatacheck_factory = 558 auto savedatacheck_factory = std::make_unique<FileSys::ArchiveFactory_NCCH>(nand_directory);
559 std::make_unique<FileSys::ArchiveFactory_SaveDataCheck>(nand_directory); 559 RegisterArchiveType(std::move(savedatacheck_factory), ArchiveIdCode::NCCH);
560 RegisterArchiveType(std::move(savedatacheck_factory), ArchiveIdCode::SaveDataCheck);
561 560
562 auto systemsavedata_factory = 561 auto systemsavedata_factory =
563 std::make_unique<FileSys::ArchiveFactory_SystemSaveData>(nand_directory); 562 std::make_unique<FileSys::ArchiveFactory_SystemSaveData>(nand_directory);
diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h
index 41a76285c..21ed9717b 100644
--- a/src/core/hle/service/fs/archive.h
+++ b/src/core/hle/service/fs/archive.h
@@ -33,7 +33,7 @@ enum class ArchiveIdCode : u32 {
33 SystemSaveData = 0x00000008, 33 SystemSaveData = 0x00000008,
34 SDMC = 0x00000009, 34 SDMC = 0x00000009,
35 SDMCWriteOnly = 0x0000000A, 35 SDMCWriteOnly = 0x0000000A,
36 SaveDataCheck = 0x2345678A, 36 NCCH = 0x2345678A,
37}; 37};
38 38
39/// Media types for the archives 39/// Media types for the archives