FileSys: rename SaveDataCheck archive to NCCH archive
According to the observation from game and 3dbrew "Used for accessing general NCCH data"
This commit is contained in:
parent
f775a3781b
commit
d7d6975af0
5 changed files with 22 additions and 23 deletions
|
@ -17,9 +17,9 @@ set(SRCS
|
||||||
core_timing.cpp
|
core_timing.cpp
|
||||||
file_sys/archive_backend.cpp
|
file_sys/archive_backend.cpp
|
||||||
file_sys/archive_extsavedata.cpp
|
file_sys/archive_extsavedata.cpp
|
||||||
|
file_sys/archive_ncch.cpp
|
||||||
file_sys/archive_romfs.cpp
|
file_sys/archive_romfs.cpp
|
||||||
file_sys/archive_savedata.cpp
|
file_sys/archive_savedata.cpp
|
||||||
file_sys/archive_savedatacheck.cpp
|
|
||||||
file_sys/archive_sdmc.cpp
|
file_sys/archive_sdmc.cpp
|
||||||
file_sys/archive_sdmcwriteonly.cpp
|
file_sys/archive_sdmcwriteonly.cpp
|
||||||
file_sys/archive_systemsavedata.cpp
|
file_sys/archive_systemsavedata.cpp
|
||||||
|
@ -162,9 +162,9 @@ set(HEADERS
|
||||||
core_timing.h
|
core_timing.h
|
||||||
file_sys/archive_backend.h
|
file_sys/archive_backend.h
|
||||||
file_sys/archive_extsavedata.h
|
file_sys/archive_extsavedata.h
|
||||||
|
file_sys/archive_ncch.h
|
||||||
file_sys/archive_romfs.h
|
file_sys/archive_romfs.h
|
||||||
file_sys/archive_savedata.h
|
file_sys/archive_savedata.h
|
||||||
file_sys/archive_savedatacheck.h
|
|
||||||
file_sys/archive_sdmc.h
|
file_sys/archive_sdmc.h
|
||||||
file_sys/archive_sdmcwriteonly.h
|
file_sys/archive_sdmcwriteonly.h
|
||||||
file_sys/archive_systemsavedata.h
|
file_sys/archive_systemsavedata.h
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include "common/file_util.h"
|
#include "common/file_util.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
#include "core/file_sys/archive_savedatacheck.h"
|
#include "core/file_sys/archive_ncch.h"
|
||||||
#include "core/file_sys/ivfc_archive.h"
|
#include "core/file_sys/ivfc_archive.h"
|
||||||
#include "core/hle/service/fs/archive.h"
|
#include "core/hle/service/fs/archive.h"
|
||||||
|
|
||||||
|
@ -18,22 +18,22 @@
|
||||||
|
|
||||||
namespace FileSys {
|
namespace FileSys {
|
||||||
|
|
||||||
static std::string GetSaveDataCheckContainerPath(const std::string& nand_directory) {
|
static std::string GetNCCHContainerPath(const std::string& nand_directory) {
|
||||||
return Common::StringFromFormat("%s%s/title/", nand_directory.c_str(), SYSTEM_ID.c_str());
|
return Common::StringFromFormat("%s%s/title/", nand_directory.c_str(), SYSTEM_ID.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string GetSaveDataCheckPath(const std::string& mount_point, u32 high, u32 low) {
|
static std::string GetNCCHPath(const std::string& mount_point, u32 high, u32 low) {
|
||||||
return Common::StringFromFormat("%s%08x/%08x/content/00000000.app.romfs", mount_point.c_str(),
|
return Common::StringFromFormat("%s%08x/%08x/content/00000000.app.romfs", mount_point.c_str(),
|
||||||
high, low);
|
high, low);
|
||||||
}
|
}
|
||||||
|
|
||||||
ArchiveFactory_SaveDataCheck::ArchiveFactory_SaveDataCheck(const std::string& nand_directory)
|
ArchiveFactory_NCCH::ArchiveFactory_NCCH(const std::string& nand_directory)
|
||||||
: mount_point(GetSaveDataCheckContainerPath(nand_directory)) {}
|
: mount_point(GetNCCHContainerPath(nand_directory)) {}
|
||||||
|
|
||||||
ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SaveDataCheck::Open(const Path& path) {
|
ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_NCCH::Open(const Path& path) {
|
||||||
auto vec = path.AsBinary();
|
auto vec = path.AsBinary();
|
||||||
const u32* data = reinterpret_cast<u32*>(vec.data());
|
const u32* data = reinterpret_cast<u32*>(vec.data());
|
||||||
std::string file_path = GetSaveDataCheckPath(mount_point, data[1], data[0]);
|
std::string file_path = GetNCCHPath(mount_point, data[1], data[0]);
|
||||||
auto file = std::make_shared<FileUtil::IOFile>(file_path, "rb");
|
auto file = std::make_shared<FileUtil::IOFile>(file_path, "rb");
|
||||||
|
|
||||||
if (!file->IsOpen()) {
|
if (!file->IsOpen()) {
|
||||||
|
@ -45,15 +45,15 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SaveDataCheck::Open(co
|
||||||
return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive));
|
return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive));
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode ArchiveFactory_SaveDataCheck::Format(const Path& path,
|
ResultCode ArchiveFactory_NCCH::Format(const Path& path,
|
||||||
const FileSys::ArchiveFormatInfo& format_info) {
|
const FileSys::ArchiveFormatInfo& format_info) {
|
||||||
LOG_ERROR(Service_FS, "Attempted to format a SaveDataCheck archive.");
|
LOG_ERROR(Service_FS, "Attempted to format a NCCH archive.");
|
||||||
// TODO: Verify error code
|
// TODO: Verify error code
|
||||||
return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported,
|
return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported,
|
||||||
ErrorLevel::Permanent);
|
ErrorLevel::Permanent);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultVal<ArchiveFormatInfo> ArchiveFactory_SaveDataCheck::GetFormatInfo(const Path& path) const {
|
ResultVal<ArchiveFormatInfo> ArchiveFactory_NCCH::GetFormatInfo(const Path& path) const {
|
||||||
// TODO(Subv): Implement
|
// TODO(Subv): Implement
|
||||||
LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive %s", GetName().c_str());
|
LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive %s", GetName().c_str());
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
|
@ -14,13 +14,13 @@
|
||||||
|
|
||||||
namespace FileSys {
|
namespace FileSys {
|
||||||
|
|
||||||
/// File system interface to the SaveDataCheck archive
|
/// File system interface to the NCCH archive
|
||||||
class ArchiveFactory_SaveDataCheck final : public ArchiveFactory {
|
class ArchiveFactory_NCCH final : public ArchiveFactory {
|
||||||
public:
|
public:
|
||||||
ArchiveFactory_SaveDataCheck(const std::string& mount_point);
|
ArchiveFactory_NCCH(const std::string& mount_point);
|
||||||
|
|
||||||
std::string GetName() const override {
|
std::string GetName() const override {
|
||||||
return "SaveDataCheck";
|
return "NCCH";
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultVal<std::unique_ptr<ArchiveBackend>> Open(const Path& path) override;
|
ResultVal<std::unique_ptr<ArchiveBackend>> Open(const Path& path) override;
|
|
@ -15,8 +15,8 @@
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/file_sys/archive_backend.h"
|
#include "core/file_sys/archive_backend.h"
|
||||||
#include "core/file_sys/archive_extsavedata.h"
|
#include "core/file_sys/archive_extsavedata.h"
|
||||||
|
#include "core/file_sys/archive_ncch.h"
|
||||||
#include "core/file_sys/archive_savedata.h"
|
#include "core/file_sys/archive_savedata.h"
|
||||||
#include "core/file_sys/archive_savedatacheck.h"
|
|
||||||
#include "core/file_sys/archive_sdmc.h"
|
#include "core/file_sys/archive_sdmc.h"
|
||||||
#include "core/file_sys/archive_sdmcwriteonly.h"
|
#include "core/file_sys/archive_sdmcwriteonly.h"
|
||||||
#include "core/file_sys/archive_systemsavedata.h"
|
#include "core/file_sys/archive_systemsavedata.h"
|
||||||
|
@ -554,10 +554,9 @@ void RegisterArchiveTypes() {
|
||||||
LOG_ERROR(Service_FS, "Can't instantiate SharedExtSaveData archive with path %s",
|
LOG_ERROR(Service_FS, "Can't instantiate SharedExtSaveData archive with path %s",
|
||||||
sharedextsavedata_factory->GetMountPoint().c_str());
|
sharedextsavedata_factory->GetMountPoint().c_str());
|
||||||
|
|
||||||
// Create the SaveDataCheck archive, basically a small variation of the RomFS archive
|
// Create the NCCH archive, basically a small variation of the RomFS archive
|
||||||
auto savedatacheck_factory =
|
auto savedatacheck_factory = std::make_unique<FileSys::ArchiveFactory_NCCH>(nand_directory);
|
||||||
std::make_unique<FileSys::ArchiveFactory_SaveDataCheck>(nand_directory);
|
RegisterArchiveType(std::move(savedatacheck_factory), ArchiveIdCode::NCCH);
|
||||||
RegisterArchiveType(std::move(savedatacheck_factory), ArchiveIdCode::SaveDataCheck);
|
|
||||||
|
|
||||||
auto systemsavedata_factory =
|
auto systemsavedata_factory =
|
||||||
std::make_unique<FileSys::ArchiveFactory_SystemSaveData>(nand_directory);
|
std::make_unique<FileSys::ArchiveFactory_SystemSaveData>(nand_directory);
|
||||||
|
|
|
@ -33,7 +33,7 @@ enum class ArchiveIdCode : u32 {
|
||||||
SystemSaveData = 0x00000008,
|
SystemSaveData = 0x00000008,
|
||||||
SDMC = 0x00000009,
|
SDMC = 0x00000009,
|
||||||
SDMCWriteOnly = 0x0000000A,
|
SDMCWriteOnly = 0x0000000A,
|
||||||
SaveDataCheck = 0x2345678A,
|
NCCH = 0x2345678A,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Media types for the archives
|
/// Media types for the archives
|
||||||
|
|
Loading…
Reference in a new issue