core/file_sys: Replace logging macros
This commit is contained in:
parent
bef6c6d174
commit
d81cacfb9e
|
@ -70,7 +70,7 @@ std::string Path::AsString() const {
|
|||
case LowPathType::Binary:
|
||||
default:
|
||||
// TODO(yuriks): Add assert
|
||||
LOG_ERROR(Service_FS, "LowPathType cannot be converted to string!");
|
||||
NGLOG_ERROR(Service_FS, "LowPathType cannot be converted to string!");
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ std::u16string Path::AsU16Str() const {
|
|||
case LowPathType::Invalid:
|
||||
case LowPathType::Binary:
|
||||
// TODO(yuriks): Add assert
|
||||
LOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!");
|
||||
NGLOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!");
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ std::vector<u8> Path::AsBinary() const {
|
|||
case LowPathType::Invalid:
|
||||
default:
|
||||
// TODO(yuriks): Add assert
|
||||
LOG_ERROR(Service_FS, "LowPathType cannot be converted to binary!");
|
||||
NGLOG_ERROR(Service_FS, "LowPathType cannot be converted to binary!");
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,22 +87,22 @@ public:
|
|||
|
||||
ResultVal<std::unique_ptr<FileBackend>> OpenFile(const Path& path,
|
||||
const Mode& mode) const override {
|
||||
LOG_DEBUG(Service_FS, "called path=%s mode=%01X", path.DebugStr().c_str(), mode.hex);
|
||||
NGLOG_DEBUG(Service_FS, "called path={} mode={:01X}", path.DebugStr(), mode.hex);
|
||||
|
||||
const PathParser path_parser(path);
|
||||
|
||||
if (!path_parser.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path %s", path.DebugStr().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
if (mode.hex == 0) {
|
||||
LOG_ERROR(Service_FS, "Empty open mode");
|
||||
NGLOG_ERROR(Service_FS, "Empty open mode");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
}
|
||||
|
||||
if (mode.create_flag) {
|
||||
LOG_ERROR(Service_FS, "Create flag is not supported");
|
||||
NGLOG_ERROR(Service_FS, "Create flag is not supported");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
}
|
||||
|
||||
|
@ -110,17 +110,17 @@ public:
|
|||
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point %s", mount_point.c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
case PathParser::PathNotFound:
|
||||
LOG_ERROR(Service_FS, "Path not found %s", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||
return ERROR_PATH_NOT_FOUND;
|
||||
case PathParser::FileInPath:
|
||||
case PathParser::DirectoryFound:
|
||||
LOG_ERROR(Service_FS, "Unexpected file or directory in %s", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Unexpected file or directory in {}", full_path);
|
||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY;
|
||||
case PathParser::NotFound:
|
||||
LOG_ERROR(Service_FS, "%s not found", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "{} not found", full_path);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
case PathParser::FileFound:
|
||||
break; // Expected 'success' case
|
||||
|
@ -128,7 +128,7 @@ public:
|
|||
|
||||
FileUtil::IOFile file(full_path, "r+b");
|
||||
if (!file.IsOpen()) {
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error opening %s", full_path.c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Unknown error opening {}", full_path);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ public:
|
|||
|
||||
ResultCode CreateFile(const Path& path, u64 size) const override {
|
||||
if (size == 0) {
|
||||
LOG_ERROR(Service_FS, "Zero-size file is not supported");
|
||||
NGLOG_ERROR(Service_FS, "Zero-size file is not supported");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
}
|
||||
return SaveDataArchive::CreateFile(path, size);
|
||||
|
@ -192,12 +192,12 @@ Path ConstructExtDataBinaryPath(u32 media_type, u32 high, u32 low) {
|
|||
ArchiveFactory_ExtSaveData::ArchiveFactory_ExtSaveData(const std::string& mount_location,
|
||||
bool shared)
|
||||
: shared(shared), mount_point(GetExtDataContainerPath(mount_location, shared)) {
|
||||
LOG_DEBUG(Service_FS, "Directory %s set as base for ExtSaveData.", mount_point.c_str());
|
||||
NGLOG_DEBUG(Service_FS, "Directory {} set as base for ExtSaveData.", mount_point);
|
||||
}
|
||||
|
||||
bool ArchiveFactory_ExtSaveData::Initialize() {
|
||||
if (!FileUtil::CreateFullPath(mount_point)) {
|
||||
LOG_ERROR(Service_FS, "Unable to create ExtSaveData base path.");
|
||||
NGLOG_ERROR(Service_FS, "Unable to create ExtSaveData base path.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -266,7 +266,7 @@ ResultVal<ArchiveFormatInfo> ArchiveFactory_ExtSaveData::GetFormatInfo(const Pat
|
|||
FileUtil::IOFile file(metadata_path, "rb");
|
||||
|
||||
if (!file.IsOpen()) {
|
||||
LOG_ERROR(Service_FS, "Could not open metadata information for archive");
|
||||
NGLOG_ERROR(Service_FS, "Could not open metadata information for archive");
|
||||
// TODO(Subv): Verify error code
|
||||
return ERR_NOT_FORMATTED;
|
||||
}
|
||||
|
|
|
@ -49,13 +49,13 @@ static_assert(sizeof(NCCHFilePath) == 0x14, "NCCHFilePath has wrong size!");
|
|||
ResultVal<std::unique_ptr<FileBackend>> NCCHArchive::OpenFile(const Path& path,
|
||||
const Mode& mode) const {
|
||||
if (path.GetType() != LowPathType::Binary) {
|
||||
LOG_ERROR(Service_FS, "Path need to be Binary");
|
||||
NGLOG_ERROR(Service_FS, "Path need to be Binary");
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
std::vector<u8> binary = path.AsBinary();
|
||||
if (binary.size() != sizeof(NCCHFilePath)) {
|
||||
LOG_ERROR(Service_FS, "Wrong path size %zu", binary.size());
|
||||
NGLOG_ERROR(Service_FS, "Wrong path size {}", binary.size());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ ResultVal<std::unique_ptr<FileBackend>> NCCHArchive::OpenFile(const Path& path,
|
|||
std::unique_ptr<DelayGenerator> delay_generator = std::make_unique<ExeFSDelayGenerator>();
|
||||
file = std::make_unique<NCCHFile>(std::move(buffer), std::move(delay_generator));
|
||||
} else {
|
||||
LOG_ERROR(Service_FS, "Unknown NCCH archive type %u!", openfile_path.filepath_type);
|
||||
NGLOG_ERROR(Service_FS, "Unknown NCCH archive type {}!", openfile_path.filepath_type);
|
||||
result = Loader::ResultStatus::Error;
|
||||
}
|
||||
|
||||
|
@ -106,8 +106,8 @@ ResultVal<std::unique_ptr<FileBackend>> NCCHArchive::OpenFile(const Path& path,
|
|||
u32 high = static_cast<u32>(title_id >> 32);
|
||||
u32 low = static_cast<u32>(title_id & 0xFFFFFFFF);
|
||||
|
||||
LOG_DEBUG(Service_FS, "Full Path: %s. Category: 0x%X. Path: 0x%X.", path.DebugStr().c_str(),
|
||||
high, low);
|
||||
NGLOG_DEBUG(Service_FS, "Full Path: {}. Category: 0x{:X}. Path: 0x{:X}.", path.DebugStr(),
|
||||
high, low);
|
||||
|
||||
std::string archive_name;
|
||||
if (high == shared_data_archive) {
|
||||
|
@ -121,8 +121,8 @@ ResultVal<std::unique_ptr<FileBackend>> NCCHArchive::OpenFile(const Path& path,
|
|||
}
|
||||
|
||||
if (!archive_name.empty()) {
|
||||
LOG_ERROR(Service_FS, "Failed to get a handle for shared data archive: %s. ",
|
||||
archive_name.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Failed to get a handle for shared data archive: {}. ",
|
||||
archive_name);
|
||||
Core::System::GetInstance().SetStatus(Core::System::ResultStatus::ErrorSystemFiles,
|
||||
archive_name.c_str());
|
||||
}
|
||||
|
@ -133,65 +133,63 @@ ResultVal<std::unique_ptr<FileBackend>> NCCHArchive::OpenFile(const Path& path,
|
|||
}
|
||||
|
||||
ResultCode NCCHArchive::DeleteFile(const Path& path) const {
|
||||
LOG_CRITICAL(Service_FS, "Attempted to delete a file from an NCCH archive (%s).",
|
||||
GetName().c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "Attempted to delete a file from an NCCH archive ({}).", GetName());
|
||||
// TODO(Subv): Verify error code
|
||||
return ResultCode(ErrorDescription::NoData, ErrorModule::FS, ErrorSummary::Canceled,
|
||||
ErrorLevel::Status);
|
||||
}
|
||||
|
||||
ResultCode NCCHArchive::RenameFile(const Path& src_path, const Path& dest_path) const {
|
||||
LOG_CRITICAL(Service_FS, "Attempted to rename a file within an NCCH archive (%s).",
|
||||
GetName().c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "Attempted to rename a file within an NCCH archive ({}).",
|
||||
GetName());
|
||||
// TODO(wwylele): Use correct error code
|
||||
return ResultCode(-1);
|
||||
}
|
||||
|
||||
ResultCode NCCHArchive::DeleteDirectory(const Path& path) const {
|
||||
LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an NCCH archive (%s).",
|
||||
GetName().c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "Attempted to delete a directory from an NCCH archive ({}).",
|
||||
GetName());
|
||||
// TODO(wwylele): Use correct error code
|
||||
return ResultCode(-1);
|
||||
}
|
||||
|
||||
ResultCode NCCHArchive::DeleteDirectoryRecursively(const Path& path) const {
|
||||
LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an NCCH archive (%s).",
|
||||
GetName().c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "Attempted to delete a directory from an NCCH archive ({}).",
|
||||
GetName());
|
||||
// TODO(wwylele): Use correct error code
|
||||
return ResultCode(-1);
|
||||
}
|
||||
|
||||
ResultCode NCCHArchive::CreateFile(const Path& path, u64 size) const {
|
||||
LOG_CRITICAL(Service_FS, "Attempted to create a file in an NCCH archive (%s).",
|
||||
GetName().c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "Attempted to create a file in an NCCH archive ({}).", GetName());
|
||||
// TODO: Verify error code
|
||||
return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported,
|
||||
ErrorLevel::Permanent);
|
||||
}
|
||||
|
||||
ResultCode NCCHArchive::CreateDirectory(const Path& path) const {
|
||||
LOG_CRITICAL(Service_FS, "Attempted to create a directory in an NCCH archive (%s).",
|
||||
GetName().c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "Attempted to create a directory in an NCCH archive ({}).",
|
||||
GetName());
|
||||
// TODO(wwylele): Use correct error code
|
||||
return ResultCode(-1);
|
||||
}
|
||||
|
||||
ResultCode NCCHArchive::RenameDirectory(const Path& src_path, const Path& dest_path) const {
|
||||
LOG_CRITICAL(Service_FS, "Attempted to rename a file within an NCCH archive (%s).",
|
||||
GetName().c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "Attempted to rename a file within an NCCH archive ({}).",
|
||||
GetName());
|
||||
// TODO(wwylele): Use correct error code
|
||||
return ResultCode(-1);
|
||||
}
|
||||
|
||||
ResultVal<std::unique_ptr<DirectoryBackend>> NCCHArchive::OpenDirectory(const Path& path) const {
|
||||
LOG_CRITICAL(Service_FS, "Attempted to open a directory within an NCCH archive (%s).",
|
||||
GetName().c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "Attempted to open a directory within an NCCH archive ({}).",
|
||||
GetName().c_str());
|
||||
// TODO(shinyquagsire23): Use correct error code
|
||||
return ResultCode(-1);
|
||||
}
|
||||
|
||||
u64 NCCHArchive::GetFreeBytes() const {
|
||||
LOG_WARNING(Service_FS, "Attempted to get the free space in an NCCH archive");
|
||||
NGLOG_WARNING(Service_FS, "Attempted to get the free space in an NCCH archive");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -203,7 +201,7 @@ NCCHFile::NCCHFile(std::vector<u8> buffer, std::unique_ptr<DelayGenerator> delay
|
|||
}
|
||||
|
||||
ResultVal<size_t> NCCHFile::Read(const u64 offset, const size_t length, u8* buffer) const {
|
||||
LOG_TRACE(Service_FS, "called offset=%" PRIu64 ", length=%zu", offset, length);
|
||||
NGLOG_TRACE(Service_FS, "called offset={}, length={}", offset, length);
|
||||
size_t length_left = static_cast<size_t>(data_size - offset);
|
||||
size_t read_length = static_cast<size_t>(std::min(length, length_left));
|
||||
|
||||
|
@ -216,7 +214,7 @@ ResultVal<size_t> NCCHFile::Read(const u64 offset, const size_t length, u8* buff
|
|||
|
||||
ResultVal<size_t> NCCHFile::Write(const u64 offset, const size_t length, const bool flush,
|
||||
const u8* buffer) {
|
||||
LOG_ERROR(Service_FS, "Attempted to write to NCCH file");
|
||||
NGLOG_ERROR(Service_FS, "Attempted to write to NCCH file");
|
||||
// TODO(shinyquagsire23): Find error code
|
||||
return MakeResult<size_t>(0);
|
||||
}
|
||||
|
@ -226,7 +224,7 @@ u64 NCCHFile::GetSize() const {
|
|||
}
|
||||
|
||||
bool NCCHFile::SetSize(const u64 size) const {
|
||||
LOG_ERROR(Service_FS, "Attempted to set the size of an NCCH file");
|
||||
NGLOG_ERROR(Service_FS, "Attempted to set the size of an NCCH file");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -236,13 +234,13 @@ ArchiveFactory_NCCH::ArchiveFactory_NCCH() {}
|
|||
|
||||
ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_NCCH::Open(const Path& path) {
|
||||
if (path.GetType() != LowPathType::Binary) {
|
||||
LOG_ERROR(Service_FS, "Path need to be Binary");
|
||||
NGLOG_ERROR(Service_FS, "Path need to be Binary");
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
std::vector<u8> binary = path.AsBinary();
|
||||
if (binary.size() != sizeof(NCCHArchivePath)) {
|
||||
LOG_ERROR(Service_FS, "Wrong path size %zu", binary.size());
|
||||
NGLOG_ERROR(Service_FS, "Wrong path size {}", binary.size());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
|
@ -256,7 +254,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_NCCH::Open(const Path&
|
|||
|
||||
ResultCode ArchiveFactory_NCCH::Format(const Path& path,
|
||||
const FileSys::ArchiveFormatInfo& format_info) {
|
||||
LOG_ERROR(Service_FS, "Attempted to format a NCCH archive.");
|
||||
NGLOG_ERROR(Service_FS, "Attempted to format a NCCH archive.");
|
||||
// TODO: Verify error code
|
||||
return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported,
|
||||
ErrorLevel::Permanent);
|
||||
|
@ -264,7 +262,7 @@ ResultCode ArchiveFactory_NCCH::Format(const Path& path,
|
|||
|
||||
ResultVal<ArchiveFormatInfo> ArchiveFactory_NCCH::GetFormatInfo(const Path& path) const {
|
||||
// TODO(Subv): Implement
|
||||
LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive %s", GetName().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
|
||||
return ResultCode(-1);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,14 +23,14 @@ namespace {
|
|||
template <typename T>
|
||||
ResultVal<std::tuple<MediaType, u64>> ParsePath(const Path& path, T program_id_reader) {
|
||||
if (path.GetType() != LowPathType::Binary) {
|
||||
LOG_ERROR(Service_FS, "Wrong path type %d", static_cast<int>(path.GetType()));
|
||||
NGLOG_ERROR(Service_FS, "Wrong path type {}", static_cast<int>(path.GetType()));
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
std::vector<u8> vec_data = path.AsBinary();
|
||||
|
||||
if (vec_data.size() != 12) {
|
||||
LOG_ERROR(Service_FS, "Wrong path length %zu", vec_data.size());
|
||||
NGLOG_ERROR(Service_FS, "Wrong path length {}", vec_data.size());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ ResultVal<std::tuple<MediaType, u64>> ParsePath(const Path& path, T program_id_r
|
|||
auto media_type = static_cast<MediaType>(data[0]);
|
||||
|
||||
if (media_type != MediaType::SDMC && media_type != MediaType::GameCard) {
|
||||
LOG_ERROR(Service_FS, "Unsupported media type %u", static_cast<u32>(media_type));
|
||||
NGLOG_ERROR(Service_FS, "Unsupported media type {}", static_cast<u32>(media_type));
|
||||
|
||||
// Note: this is strange, but the error code was verified with a real 3DS
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
|
@ -70,7 +70,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_OtherSaveDataPermitted
|
|||
CASCADE_RESULT(std::tie(media_type, program_id), ParsePathPermitted(path));
|
||||
|
||||
if (media_type == MediaType::GameCard) {
|
||||
LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
||||
NGLOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
||||
return ERROR_GAMECARD_NOT_INSERTED;
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_OtherSaveDataPermitted
|
|||
|
||||
ResultCode ArchiveFactory_OtherSaveDataPermitted::Format(
|
||||
const Path& path, const FileSys::ArchiveFormatInfo& format_info) {
|
||||
LOG_ERROR(Service_FS, "Attempted to format a OtherSaveDataPermitted archive.");
|
||||
NGLOG_ERROR(Service_FS, "Attempted to format a OtherSaveDataPermitted archive.");
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ ResultVal<ArchiveFormatInfo> ArchiveFactory_OtherSaveDataPermitted::GetFormatInf
|
|||
CASCADE_RESULT(std::tie(media_type, program_id), ParsePathPermitted(path));
|
||||
|
||||
if (media_type == MediaType::GameCard) {
|
||||
LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
||||
NGLOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
||||
return ERROR_GAMECARD_NOT_INSERTED;
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_OtherSaveDataGeneral::
|
|||
CASCADE_RESULT(std::tie(media_type, program_id), ParsePathGeneral(path));
|
||||
|
||||
if (media_type == MediaType::GameCard) {
|
||||
LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
||||
NGLOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
||||
return ERROR_GAMECARD_NOT_INSERTED;
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ ResultCode ArchiveFactory_OtherSaveDataGeneral::Format(
|
|||
CASCADE_RESULT(std::tie(media_type, program_id), ParsePathGeneral(path));
|
||||
|
||||
if (media_type == MediaType::GameCard) {
|
||||
LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
||||
NGLOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
||||
return ERROR_GAMECARD_NOT_INSERTED;
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ ResultVal<ArchiveFormatInfo> ArchiveFactory_OtherSaveDataGeneral::GetFormatInfo(
|
|||
CASCADE_RESULT(std::tie(media_type, program_id), ParsePathGeneral(path));
|
||||
|
||||
if (media_type == MediaType::GameCard) {
|
||||
LOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
||||
NGLOG_WARNING(Service_FS, "(stubbed) Unimplemented media type GameCard");
|
||||
return ERROR_GAMECARD_NOT_INSERTED;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,22 +44,22 @@ ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFile(const Path& path,
|
|||
|
||||
ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFileBase(const Path& path,
|
||||
const Mode& mode) const {
|
||||
LOG_DEBUG(Service_FS, "called path=%s mode=%01X", path.DebugStr().c_str(), mode.hex);
|
||||
NGLOG_DEBUG(Service_FS, "called path={} mode={:01X}", path.DebugStr(), mode.hex);
|
||||
|
||||
const PathParser path_parser(path);
|
||||
|
||||
if (!path_parser.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path %s", path.DebugStr().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
if (mode.hex == 0) {
|
||||
LOG_ERROR(Service_FS, "Empty open mode");
|
||||
NGLOG_ERROR(Service_FS, "Empty open mode");
|
||||
return ERROR_INVALID_OPEN_FLAGS;
|
||||
}
|
||||
|
||||
if (mode.create_flag && !mode.write_flag) {
|
||||
LOG_ERROR(Service_FS, "Create flag set but write flag not set");
|
||||
NGLOG_ERROR(Service_FS, "Create flag set but write flag not set");
|
||||
return ERROR_INVALID_OPEN_FLAGS;
|
||||
}
|
||||
|
||||
|
@ -67,19 +67,19 @@ ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFileBase(const Path& pa
|
|||
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point %s", mount_point.c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_NOT_FOUND;
|
||||
case PathParser::PathNotFound:
|
||||
case PathParser::FileInPath:
|
||||
LOG_ERROR(Service_FS, "Path not found %s", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||
return ERROR_NOT_FOUND;
|
||||
case PathParser::DirectoryFound:
|
||||
LOG_ERROR(Service_FS, "%s is not a file", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "{} is not a file", full_path);
|
||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
|
||||
case PathParser::NotFound:
|
||||
if (!mode.create_flag) {
|
||||
LOG_ERROR(Service_FS, "Non-existing file %s can't be open without mode create.",
|
||||
full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Non-existing file {} can't be open without mode create.",
|
||||
full_path);
|
||||
return ERROR_NOT_FOUND;
|
||||
} else {
|
||||
// Create the file
|
||||
|
@ -92,7 +92,7 @@ ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFileBase(const Path& pa
|
|||
|
||||
FileUtil::IOFile file(full_path, mode.write_flag ? "r+b" : "rb");
|
||||
if (!file.IsOpen()) {
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error opening %s", full_path.c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Unknown error opening {}", full_path);
|
||||
return ERROR_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ ResultCode SDMCArchive::DeleteFile(const Path& path) const {
|
|||
const PathParser path_parser(path);
|
||||
|
||||
if (!path_parser.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path %s", path.DebugStr().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
|
@ -113,15 +113,15 @@ ResultCode SDMCArchive::DeleteFile(const Path& path) const {
|
|||
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point %s", mount_point.c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_NOT_FOUND;
|
||||
case PathParser::PathNotFound:
|
||||
case PathParser::FileInPath:
|
||||
case PathParser::NotFound:
|
||||
LOG_ERROR(Service_FS, "%s not found", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "{} not found", full_path);
|
||||
return ERROR_NOT_FOUND;
|
||||
case PathParser::DirectoryFound:
|
||||
LOG_ERROR(Service_FS, "%s is not a file", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "{} is not a file", full_path);
|
||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
|
||||
case PathParser::FileFound:
|
||||
break; // Expected 'success' case
|
||||
|
@ -131,7 +131,7 @@ ResultCode SDMCArchive::DeleteFile(const Path& path) const {
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error deleting %s", full_path.c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Unknown error deleting {}", full_path);
|
||||
return ERROR_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
@ -140,14 +140,14 @@ ResultCode SDMCArchive::RenameFile(const Path& src_path, const Path& dest_path)
|
|||
|
||||
// TODO: Verify these return codes with HW
|
||||
if (!path_parser_src.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid src path %s", src_path.DebugStr().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Invalid src path {}", src_path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
const PathParser path_parser_dest(dest_path);
|
||||
|
||||
if (!path_parser_dest.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid dest path %s", dest_path.DebugStr().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Invalid dest path {}", dest_path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ static ResultCode DeleteDirectoryHelper(const Path& path, const std::string& mou
|
|||
const PathParser path_parser(path);
|
||||
|
||||
if (!path_parser.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path %s", path.DebugStr().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
|
@ -181,15 +181,15 @@ static ResultCode DeleteDirectoryHelper(const Path& path, const std::string& mou
|
|||
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point %s", mount_point.c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_NOT_FOUND;
|
||||
case PathParser::PathNotFound:
|
||||
case PathParser::NotFound:
|
||||
LOG_ERROR(Service_FS, "Path not found %s", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||
return ERROR_NOT_FOUND;
|
||||
case PathParser::FileInPath:
|
||||
case PathParser::FileFound:
|
||||
LOG_ERROR(Service_FS, "Unexpected file in path %s", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
|
||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
|
||||
case PathParser::DirectoryFound:
|
||||
break; // Expected 'success' case
|
||||
|
@ -199,7 +199,7 @@ static ResultCode DeleteDirectoryHelper(const Path& path, const std::string& mou
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
LOG_ERROR(Service_FS, "Directory not empty %s", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Directory not empty {}", full_path);
|
||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ ResultCode SDMCArchive::CreateFile(const FileSys::Path& path, u64 size) const {
|
|||
const PathParser path_parser(path);
|
||||
|
||||
if (!path_parser.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path %s", path.DebugStr().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
|
@ -224,17 +224,17 @@ ResultCode SDMCArchive::CreateFile(const FileSys::Path& path, u64 size) const {
|
|||
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point %s", mount_point.c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_NOT_FOUND;
|
||||
case PathParser::PathNotFound:
|
||||
case PathParser::FileInPath:
|
||||
LOG_ERROR(Service_FS, "Path not found %s", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||
return ERROR_NOT_FOUND;
|
||||
case PathParser::DirectoryFound:
|
||||
LOG_ERROR(Service_FS, "%s already exists", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "{} already exists", full_path);
|
||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
|
||||
case PathParser::FileFound:
|
||||
LOG_ERROR(Service_FS, "%s already exists", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "{} already exists", full_path);
|
||||
return ERROR_ALREADY_EXISTS;
|
||||
case PathParser::NotFound:
|
||||
break; // Expected 'success' case
|
||||
|
@ -252,7 +252,7 @@ ResultCode SDMCArchive::CreateFile(const FileSys::Path& path, u64 size) const {
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
LOG_ERROR(Service_FS, "Too large file");
|
||||
NGLOG_ERROR(Service_FS, "Too large file");
|
||||
return ResultCode(ErrorDescription::TooLarge, ErrorModule::FS, ErrorSummary::OutOfResource,
|
||||
ErrorLevel::Info);
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ ResultCode SDMCArchive::CreateDirectory(const Path& path) const {
|
|||
const PathParser path_parser(path);
|
||||
|
||||
if (!path_parser.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path %s", path.DebugStr().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
|
@ -269,15 +269,15 @@ ResultCode SDMCArchive::CreateDirectory(const Path& path) const {
|
|||
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point %s", mount_point.c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_NOT_FOUND;
|
||||
case PathParser::PathNotFound:
|
||||
case PathParser::FileInPath:
|
||||
LOG_ERROR(Service_FS, "Path not found %s", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||
return ERROR_NOT_FOUND;
|
||||
case PathParser::DirectoryFound:
|
||||
case PathParser::FileFound:
|
||||
LOG_ERROR(Service_FS, "%s already exists", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "{} already exists", full_path);
|
||||
return ERROR_ALREADY_EXISTS;
|
||||
case PathParser::NotFound:
|
||||
break; // Expected 'success' case
|
||||
|
@ -287,7 +287,7 @@ ResultCode SDMCArchive::CreateDirectory(const Path& path) const {
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating %s", mount_point.c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating {}", mount_point);
|
||||
return ResultCode(ErrorDescription::NoData, ErrorModule::FS, ErrorSummary::Canceled,
|
||||
ErrorLevel::Status);
|
||||
}
|
||||
|
@ -297,14 +297,14 @@ ResultCode SDMCArchive::RenameDirectory(const Path& src_path, const Path& dest_p
|
|||
|
||||
// TODO: Verify these return codes with HW
|
||||
if (!path_parser_src.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid src path %s", src_path.DebugStr().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Invalid src path {}", src_path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
const PathParser path_parser_dest(dest_path);
|
||||
|
||||
if (!path_parser_dest.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid dest path %s", dest_path.DebugStr().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Invalid dest path {}", dest_path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
|
@ -325,7 +325,7 @@ ResultVal<std::unique_ptr<DirectoryBackend>> SDMCArchive::OpenDirectory(const Pa
|
|||
const PathParser path_parser(path);
|
||||
|
||||
if (!path_parser.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path %s", path.DebugStr().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
|
@ -333,15 +333,15 @@ ResultVal<std::unique_ptr<DirectoryBackend>> SDMCArchive::OpenDirectory(const Pa
|
|||
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point %s", mount_point.c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_NOT_FOUND;
|
||||
case PathParser::PathNotFound:
|
||||
case PathParser::NotFound:
|
||||
case PathParser::FileFound:
|
||||
LOG_ERROR(Service_FS, "%s not found", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "{} not found", full_path);
|
||||
return ERROR_NOT_FOUND;
|
||||
case PathParser::FileInPath:
|
||||
LOG_ERROR(Service_FS, "Unexpected file in path %s", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
|
||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY_SDMC;
|
||||
case PathParser::DirectoryFound:
|
||||
break; // Expected 'success' case
|
||||
|
@ -359,17 +359,17 @@ u64 SDMCArchive::GetFreeBytes() const {
|
|||
ArchiveFactory_SDMC::ArchiveFactory_SDMC(const std::string& sdmc_directory)
|
||||
: sdmc_directory(sdmc_directory) {
|
||||
|
||||
LOG_DEBUG(Service_FS, "Directory %s set as SDMC.", sdmc_directory.c_str());
|
||||
NGLOG_DEBUG(Service_FS, "Directory {} set as SDMC.", sdmc_directory);
|
||||
}
|
||||
|
||||
bool ArchiveFactory_SDMC::Initialize() {
|
||||
if (!Settings::values.use_virtual_sd) {
|
||||
LOG_WARNING(Service_FS, "SDMC disabled by config.");
|
||||
NGLOG_WARNING(Service_FS, "SDMC disabled by config.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!FileUtil::CreateFullPath(sdmc_directory)) {
|
||||
LOG_ERROR(Service_FS, "Unable to create SDMC path.");
|
||||
NGLOG_ERROR(Service_FS, "Unable to create SDMC path.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -389,7 +389,7 @@ ResultCode ArchiveFactory_SDMC::Format(const Path& path,
|
|||
|
||||
ResultVal<ArchiveFormatInfo> ArchiveFactory_SDMC::GetFormatInfo(const Path& path) const {
|
||||
// TODO(Subv): Implement
|
||||
LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive %s", GetName().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
|
||||
return ResultCode(-1);
|
||||
}
|
||||
} // namespace FileSys
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace FileSys {
|
|||
ResultVal<std::unique_ptr<FileBackend>> SDMCWriteOnlyArchive::OpenFile(const Path& path,
|
||||
const Mode& mode) const {
|
||||
if (mode.read_flag) {
|
||||
LOG_ERROR(Service_FS, "Read flag is not supported");
|
||||
NGLOG_ERROR(Service_FS, "Read flag is not supported");
|
||||
return ERROR_INVALID_READ_FLAG;
|
||||
}
|
||||
return SDMCArchive::OpenFileBase(path, mode);
|
||||
|
@ -26,23 +26,23 @@ ResultVal<std::unique_ptr<FileBackend>> SDMCWriteOnlyArchive::OpenFile(const Pat
|
|||
|
||||
ResultVal<std::unique_ptr<DirectoryBackend>> SDMCWriteOnlyArchive::OpenDirectory(
|
||||
const Path& path) const {
|
||||
LOG_ERROR(Service_FS, "Not supported");
|
||||
NGLOG_ERROR(Service_FS, "Not supported");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
}
|
||||
|
||||
ArchiveFactory_SDMCWriteOnly::ArchiveFactory_SDMCWriteOnly(const std::string& mount_point)
|
||||
: sdmc_directory(mount_point) {
|
||||
LOG_DEBUG(Service_FS, "Directory %s set as SDMCWriteOnly.", sdmc_directory.c_str());
|
||||
NGLOG_DEBUG(Service_FS, "Directory {} set as SDMCWriteOnly.", sdmc_directory);
|
||||
}
|
||||
|
||||
bool ArchiveFactory_SDMCWriteOnly::Initialize() {
|
||||
if (!Settings::values.use_virtual_sd) {
|
||||
LOG_WARNING(Service_FS, "SDMC disabled by config.");
|
||||
NGLOG_WARNING(Service_FS, "SDMC disabled by config.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!FileUtil::CreateFullPath(sdmc_directory)) {
|
||||
LOG_ERROR(Service_FS, "Unable to create SDMC path.");
|
||||
NGLOG_ERROR(Service_FS, "Unable to create SDMC path.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -57,13 +57,13 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SDMCWriteOnly::Open(co
|
|||
ResultCode ArchiveFactory_SDMCWriteOnly::Format(const Path& path,
|
||||
const FileSys::ArchiveFormatInfo& format_info) {
|
||||
// TODO(wwylele): hwtest this
|
||||
LOG_ERROR(Service_FS, "Attempted to format a SDMC write-only archive.");
|
||||
NGLOG_ERROR(Service_FS, "Attempted to format a SDMC write-only archive.");
|
||||
return ResultCode(-1);
|
||||
}
|
||||
|
||||
ResultVal<ArchiveFormatInfo> ArchiveFactory_SDMCWriteOnly::GetFormatInfo(const Path& path) const {
|
||||
// TODO(Subv): Implement
|
||||
LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive %s", GetName().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
|
||||
return ResultCode(-1);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,12 +38,12 @@ public:
|
|||
|
||||
ResultVal<size_t> Read(u64 offset, size_t length, u8* buffer) const override {
|
||||
if (offset != 0) {
|
||||
LOG_ERROR(Service_FS, "offset must be zero!");
|
||||
NGLOG_ERROR(Service_FS, "offset must be zero!");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
}
|
||||
|
||||
if (length != data->size()) {
|
||||
LOG_ERROR(Service_FS, "size must match the file size!");
|
||||
NGLOG_ERROR(Service_FS, "size must match the file size!");
|
||||
return ERROR_INCORRECT_EXEFS_READ_SIZE;
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ public:
|
|||
}
|
||||
|
||||
ResultVal<size_t> Write(u64 offset, size_t length, bool flush, const u8* buffer) override {
|
||||
LOG_ERROR(Service_FS, "The file is read-only!");
|
||||
NGLOG_ERROR(Service_FS, "The file is read-only!");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
}
|
||||
|
||||
|
@ -88,13 +88,13 @@ public:
|
|||
// Note: SelfNCCHArchive doesn't check the open mode.
|
||||
|
||||
if (path.GetType() != LowPathType::Binary) {
|
||||
LOG_ERROR(Service_FS, "Path need to be Binary");
|
||||
NGLOG_ERROR(Service_FS, "Path need to be Binary");
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
std::vector<u8> binary = path.AsBinary();
|
||||
if (binary.size() != sizeof(SelfNCCHFilePath)) {
|
||||
LOG_ERROR(Service_FS, "Wrong path size %zu", binary.size());
|
||||
NGLOG_ERROR(Service_FS, "Wrong path size {}", binary.size());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ public:
|
|||
return OpenRomFS();
|
||||
|
||||
case SelfNCCHFilePathType::Code:
|
||||
LOG_ERROR(Service_FS, "Reading the code section is not supported!");
|
||||
NGLOG_ERROR(Service_FS, "Reading the code section is not supported!");
|
||||
return ERROR_COMMAND_NOT_ALLOWED;
|
||||
|
||||
case SelfNCCHFilePathType::ExeFS: {
|
||||
|
@ -119,48 +119,48 @@ public:
|
|||
return OpenExeFS(filename);
|
||||
}
|
||||
default:
|
||||
LOG_ERROR(Service_FS, "Unknown file type %u!", static_cast<u32>(file_path.type));
|
||||
NGLOG_ERROR(Service_FS, "Unknown file type {}!", static_cast<u32>(file_path.type));
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
}
|
||||
|
||||
ResultCode DeleteFile(const Path& path) const override {
|
||||
LOG_ERROR(Service_FS, "Unsupported");
|
||||
NGLOG_ERROR(Service_FS, "Unsupported");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
}
|
||||
|
||||
ResultCode RenameFile(const Path& src_path, const Path& dest_path) const override {
|
||||
LOG_ERROR(Service_FS, "Unsupported");
|
||||
NGLOG_ERROR(Service_FS, "Unsupported");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
}
|
||||
|
||||
ResultCode DeleteDirectory(const Path& path) const override {
|
||||
LOG_ERROR(Service_FS, "Unsupported");
|
||||
NGLOG_ERROR(Service_FS, "Unsupported");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
}
|
||||
|
||||
ResultCode DeleteDirectoryRecursively(const Path& path) const override {
|
||||
LOG_ERROR(Service_FS, "Unsupported");
|
||||
NGLOG_ERROR(Service_FS, "Unsupported");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
}
|
||||
|
||||
ResultCode CreateFile(const Path& path, u64 size) const override {
|
||||
LOG_ERROR(Service_FS, "Unsupported");
|
||||
NGLOG_ERROR(Service_FS, "Unsupported");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
}
|
||||
|
||||
ResultCode CreateDirectory(const Path& path) const override {
|
||||
LOG_ERROR(Service_FS, "Unsupported");
|
||||
NGLOG_ERROR(Service_FS, "Unsupported");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
}
|
||||
|
||||
ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const override {
|
||||
LOG_ERROR(Service_FS, "Unsupported");
|
||||
NGLOG_ERROR(Service_FS, "Unsupported");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
}
|
||||
|
||||
ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(const Path& path) const override {
|
||||
LOG_ERROR(Service_FS, "Unsupported");
|
||||
NGLOG_ERROR(Service_FS, "Unsupported");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ private:
|
|||
std::make_unique<IVFCFile>(ncch_data.romfs_file, ncch_data.romfs_offset,
|
||||
ncch_data.romfs_size, std::move(delay_generator)));
|
||||
} else {
|
||||
LOG_INFO(Service_FS, "Unable to read RomFS");
|
||||
NGLOG_INFO(Service_FS, "Unable to read RomFS");
|
||||
return ERROR_ROMFS_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ private:
|
|||
ncch_data.update_romfs_file, ncch_data.update_romfs_offset,
|
||||
ncch_data.update_romfs_size, std::move(delay_generator)));
|
||||
} else {
|
||||
LOG_INFO(Service_FS, "Unable to read update RomFS");
|
||||
NGLOG_INFO(Service_FS, "Unable to read update RomFS");
|
||||
return ERROR_ROMFS_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ private:
|
|||
std::make_unique<ExeFSSectionFile>(ncch_data.icon));
|
||||
}
|
||||
|
||||
LOG_WARNING(Service_FS, "Unable to read icon");
|
||||
NGLOG_WARNING(Service_FS, "Unable to read icon");
|
||||
return ERROR_EXEFS_SECTION_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ private:
|
|||
std::make_unique<ExeFSSectionFile>(ncch_data.logo));
|
||||
}
|
||||
|
||||
LOG_WARNING(Service_FS, "Unable to read logo");
|
||||
NGLOG_WARNING(Service_FS, "Unable to read logo");
|
||||
return ERROR_EXEFS_SECTION_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
@ -222,11 +222,11 @@ private:
|
|||
std::make_unique<ExeFSSectionFile>(ncch_data.banner));
|
||||
}
|
||||
|
||||
LOG_WARNING(Service_FS, "Unable to read banner");
|
||||
NGLOG_WARNING(Service_FS, "Unable to read banner");
|
||||
return ERROR_EXEFS_SECTION_NOT_FOUND;
|
||||
}
|
||||
|
||||
LOG_ERROR(Service_FS, "Unknown ExeFS section %s!", filename.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Unknown ExeFS section {}!", filename);
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
|
@ -236,19 +236,17 @@ private:
|
|||
void ArchiveFactory_SelfNCCH::Register(Loader::AppLoader& app_loader) {
|
||||
u64 program_id = 0;
|
||||
if (app_loader.ReadProgramId(program_id) != Loader::ResultStatus::Success) {
|
||||
LOG_WARNING(
|
||||
NGLOG_WARNING(
|
||||
Service_FS,
|
||||
"Could not read program id when registering with SelfNCCH, this might be a 3dsx file");
|
||||
}
|
||||
|
||||
LOG_DEBUG(Service_FS, "Registering program %016" PRIX64 " with the SelfNCCH archive factory",
|
||||
program_id);
|
||||
NGLOG_DEBUG(Service_FS, "Registering program {} with the SelfNCCH archive factory", program_id);
|
||||
|
||||
if (ncch_data.find(program_id) != ncch_data.end()) {
|
||||
LOG_WARNING(Service_FS,
|
||||
"Registering program %016" PRIX64
|
||||
" with SelfNCCH will override existing mapping",
|
||||
program_id);
|
||||
NGLOG_WARNING(Service_FS,
|
||||
"Registering program {} with SelfNCCH will override existing mapping",
|
||||
program_id);
|
||||
}
|
||||
|
||||
NCCHData& data = ncch_data[program_id];
|
||||
|
@ -289,12 +287,12 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SelfNCCH::Open(const P
|
|||
}
|
||||
|
||||
ResultCode ArchiveFactory_SelfNCCH::Format(const Path&, const FileSys::ArchiveFormatInfo&) {
|
||||
LOG_ERROR(Service_FS, "Attempted to format a SelfNCCH archive.");
|
||||
NGLOG_ERROR(Service_FS, "Attempted to format a SelfNCCH archive.");
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
ResultVal<ArchiveFormatInfo> ArchiveFactory_SelfNCCH::GetFormatInfo(const Path&) const {
|
||||
LOG_ERROR(Service_FS, "Attempted to get format info of a SelfNCCH archive");
|
||||
NGLOG_ERROR(Service_FS, "Attempted to get format info of a SelfNCCH archive");
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ std::string GetSaveDataMetadataPath(const std::string& mount_location, u64 progr
|
|||
|
||||
ArchiveSource_SDSaveData::ArchiveSource_SDSaveData(const std::string& sdmc_directory)
|
||||
: mount_point(GetSaveDataContainerPath(sdmc_directory)) {
|
||||
LOG_DEBUG(Service_FS, "Directory %s set as SaveData.", mount_point.c_str());
|
||||
NGLOG_DEBUG(Service_FS, "Directory {} set as SaveData.", mount_point);
|
||||
}
|
||||
|
||||
ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveSource_SDSaveData::Open(u64 program_id) {
|
||||
|
@ -79,7 +79,7 @@ ResultVal<ArchiveFormatInfo> ArchiveSource_SDSaveData::GetFormatInfo(u64 program
|
|||
FileUtil::IOFile file(metadata_path, "rb");
|
||||
|
||||
if (!file.IsOpen()) {
|
||||
LOG_ERROR(Service_FS, "Could not open metadata information for archive");
|
||||
NGLOG_ERROR(Service_FS, "Could not open metadata information for archive");
|
||||
// TODO(Subv): Verify error code
|
||||
return ERR_NOT_FORMATTED;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ ResultCode ArchiveFactory_SystemSaveData::Format(const Path& path,
|
|||
|
||||
ResultVal<ArchiveFormatInfo> ArchiveFactory_SystemSaveData::GetFormatInfo(const Path& path) const {
|
||||
// TODO(Subv): Implement
|
||||
LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive %s", GetName().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
|
||||
return ResultCode(-1);
|
||||
}
|
||||
|
||||
|
|
|
@ -208,21 +208,21 @@ u64 CIAContainer::GetContentSize(u16 index) const {
|
|||
}
|
||||
|
||||
void CIAContainer::Print() const {
|
||||
LOG_DEBUG(Service_FS, "Type: %u", static_cast<u32>(cia_header.type));
|
||||
LOG_DEBUG(Service_FS, "Version: %u\n", static_cast<u32>(cia_header.version));
|
||||
NGLOG_DEBUG(Service_FS, "Type: {}", static_cast<u32>(cia_header.type));
|
||||
NGLOG_DEBUG(Service_FS, "Version: {}\n", static_cast<u32>(cia_header.version));
|
||||
|
||||
LOG_DEBUG(Service_FS, "Certificate Size: 0x%08x bytes", GetCertificateSize());
|
||||
LOG_DEBUG(Service_FS, "Ticket Size: 0x%08x bytes", GetTicketSize());
|
||||
LOG_DEBUG(Service_FS, "TMD Size: 0x%08x bytes", GetTitleMetadataSize());
|
||||
LOG_DEBUG(Service_FS, "Meta Size: 0x%08x bytes", GetMetadataSize());
|
||||
LOG_DEBUG(Service_FS, "Content Size: 0x%08" PRIx64 " bytes\n", GetTotalContentSize());
|
||||
NGLOG_DEBUG(Service_FS, "Certificate Size: 0x{:08x} bytes", GetCertificateSize());
|
||||
NGLOG_DEBUG(Service_FS, "Ticket Size: 0x{:08x} bytes", GetTicketSize());
|
||||
NGLOG_DEBUG(Service_FS, "TMD Size: 0x{:08x} bytes", GetTitleMetadataSize());
|
||||
NGLOG_DEBUG(Service_FS, "Meta Size: 0x{:08x} bytes", GetMetadataSize());
|
||||
NGLOG_DEBUG(Service_FS, "Content Size: 0x{:08x} bytes\n", GetTotalContentSize());
|
||||
|
||||
LOG_DEBUG(Service_FS, "Certificate Offset: 0x%08" PRIx64 " bytes", GetCertificateOffset());
|
||||
LOG_DEBUG(Service_FS, "Ticket Offset: 0x%08" PRIx64 " bytes", GetTicketOffset());
|
||||
LOG_DEBUG(Service_FS, "TMD Offset: 0x%08" PRIx64 " bytes", GetTitleMetadataOffset());
|
||||
LOG_DEBUG(Service_FS, "Meta Offset: 0x%08" PRIx64 " bytes", GetMetadataOffset());
|
||||
NGLOG_DEBUG(Service_FS, "Certificate Offset: 0x{:08x} bytes", GetCertificateOffset());
|
||||
NGLOG_DEBUG(Service_FS, "Ticket Offset: 0x{:08x} bytes", GetTicketOffset());
|
||||
NGLOG_DEBUG(Service_FS, "TMD Offset: 0x{:08x} bytes", GetTitleMetadataOffset());
|
||||
NGLOG_DEBUG(Service_FS, "Meta Offset: 0x{:08x} bytes", GetMetadataOffset());
|
||||
for (u16 i = 0; i < cia_tmd.GetContentCount(); i++) {
|
||||
LOG_DEBUG(Service_FS, "Content %x Offset: 0x%08" PRIx64 " bytes", i, GetContentOffset(i));
|
||||
NGLOG_DEBUG(Service_FS, "Content {:x} Offset: 0x{:08x} bytes", i, GetContentOffset(i));
|
||||
}
|
||||
}
|
||||
} // namespace FileSys
|
||||
|
|
|
@ -67,8 +67,7 @@ u32 DiskDirectory::Read(const u32 count, Entry* entries) {
|
|||
const std::string& filename = file.virtualName;
|
||||
Entry& entry = entries[entries_read];
|
||||
|
||||
LOG_TRACE(Service_FS, "File %s: size=%llu dir=%d", filename.c_str(), file.size,
|
||||
file.isDirectory);
|
||||
NGLOG_TRACE(Service_FS, "File {}: size={} dir={}", filename, file.size, file.isDirectory);
|
||||
|
||||
// TODO(Link Mauve): use a proper conversion to UTF-16.
|
||||
for (size_t j = 0; j < FILENAME_LENGTH; ++j) {
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
if (delay_generator != nullptr) {
|
||||
return delay_generator->GetReadDelayNs(length);
|
||||
}
|
||||
LOG_ERROR(Service_FS, "Delay generator was not initalized. Using default");
|
||||
NGLOG_ERROR(Service_FS, "Delay generator was not initalized. Using default");
|
||||
delay_generator = std::make_unique<DefaultDelayGenerator>();
|
||||
return delay_generator->GetReadDelayNs(length);
|
||||
}
|
||||
|
|
|
@ -29,52 +29,50 @@ ResultVal<std::unique_ptr<FileBackend>> IVFCArchive::OpenFile(const Path& path,
|
|||
}
|
||||
|
||||
ResultCode IVFCArchive::DeleteFile(const Path& path) const {
|
||||
LOG_CRITICAL(Service_FS, "Attempted to delete a file from an IVFC archive (%s).",
|
||||
GetName().c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "Attempted to delete a file from an IVFC archive ({}).", GetName());
|
||||
// TODO(Subv): Verify error code
|
||||
return ResultCode(ErrorDescription::NoData, ErrorModule::FS, ErrorSummary::Canceled,
|
||||
ErrorLevel::Status);
|
||||
}
|
||||
|
||||
ResultCode IVFCArchive::RenameFile(const Path& src_path, const Path& dest_path) const {
|
||||
LOG_CRITICAL(Service_FS, "Attempted to rename a file within an IVFC archive (%s).",
|
||||
GetName().c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "Attempted to rename a file within an IVFC archive ({}).",
|
||||
GetName());
|
||||
// TODO(wwylele): Use correct error code
|
||||
return ResultCode(-1);
|
||||
}
|
||||
|
||||
ResultCode IVFCArchive::DeleteDirectory(const Path& path) const {
|
||||
LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an IVFC archive (%s).",
|
||||
GetName().c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "Attempted to delete a directory from an IVFC archive ({}).",
|
||||
GetName());
|
||||
// TODO(wwylele): Use correct error code
|
||||
return ResultCode(-1);
|
||||
}
|
||||
|
||||
ResultCode IVFCArchive::DeleteDirectoryRecursively(const Path& path) const {
|
||||
LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an IVFC archive (%s).",
|
||||
GetName().c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "Attempted to delete a directory from an IVFC archive ({}).",
|
||||
GetName());
|
||||
// TODO(wwylele): Use correct error code
|
||||
return ResultCode(-1);
|
||||
}
|
||||
|
||||
ResultCode IVFCArchive::CreateFile(const Path& path, u64 size) const {
|
||||
LOG_CRITICAL(Service_FS, "Attempted to create a file in an IVFC archive (%s).",
|
||||
GetName().c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "Attempted to create a file in an IVFC archive ({}).", GetName());
|
||||
// TODO: Verify error code
|
||||
return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported,
|
||||
ErrorLevel::Permanent);
|
||||
}
|
||||
|
||||
ResultCode IVFCArchive::CreateDirectory(const Path& path) const {
|
||||
LOG_CRITICAL(Service_FS, "Attempted to create a directory in an IVFC archive (%s).",
|
||||
GetName().c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "Attempted to create a directory in an IVFC archive ({}).",
|
||||
GetName());
|
||||
// TODO(wwylele): Use correct error code
|
||||
return ResultCode(-1);
|
||||
}
|
||||
|
||||
ResultCode IVFCArchive::RenameDirectory(const Path& src_path, const Path& dest_path) const {
|
||||
LOG_CRITICAL(Service_FS, "Attempted to rename a file within an IVFC archive (%s).",
|
||||
GetName().c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "Attempted to rename a file within an IVFC archive ({}).",
|
||||
GetName());
|
||||
// TODO(wwylele): Use correct error code
|
||||
return ResultCode(-1);
|
||||
}
|
||||
|
@ -84,7 +82,7 @@ ResultVal<std::unique_ptr<DirectoryBackend>> IVFCArchive::OpenDirectory(const Pa
|
|||
}
|
||||
|
||||
u64 IVFCArchive::GetFreeBytes() const {
|
||||
LOG_WARNING(Service_FS, "Attempted to get the free space in an IVFC archive");
|
||||
NGLOG_WARNING(Service_FS, "Attempted to get the free space in an IVFC archive");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -97,7 +95,7 @@ IVFCFile::IVFCFile(std::shared_ptr<FileUtil::IOFile> file, u64 offset, u64 size,
|
|||
}
|
||||
|
||||
ResultVal<size_t> IVFCFile::Read(const u64 offset, const size_t length, u8* buffer) const {
|
||||
LOG_TRACE(Service_FS, "called offset=%llu, length=%zu", offset, length);
|
||||
NGLOG_TRACE(Service_FS, "called offset={}, length={}", offset, length);
|
||||
romfs_file->Seek(data_offset + offset, SEEK_SET);
|
||||
size_t read_length = (size_t)std::min((u64)length, data_size - offset);
|
||||
|
||||
|
@ -106,7 +104,7 @@ ResultVal<size_t> IVFCFile::Read(const u64 offset, const size_t length, u8* buff
|
|||
|
||||
ResultVal<size_t> IVFCFile::Write(const u64 offset, const size_t length, const bool flush,
|
||||
const u8* buffer) {
|
||||
LOG_ERROR(Service_FS, "Attempted to write to IVFC file");
|
||||
NGLOG_ERROR(Service_FS, "Attempted to write to IVFC file");
|
||||
// TODO(Subv): Find error code
|
||||
return MakeResult<size_t>(0);
|
||||
}
|
||||
|
@ -116,7 +114,7 @@ u64 IVFCFile::GetSize() const {
|
|||
}
|
||||
|
||||
bool IVFCFile::SetSize(const u64 size) const {
|
||||
LOG_ERROR(Service_FS, "Attempted to set the size of an IVFC file");
|
||||
NGLOG_ERROR(Service_FS, "Attempted to set the size of an IVFC file");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -110,11 +110,11 @@ Loader::ResultStatus NCCHContainer::OpenFile(const std::string& filepath, u32 nc
|
|||
file = FileUtil::IOFile(filepath, "rb");
|
||||
|
||||
if (!file.IsOpen()) {
|
||||
LOG_WARNING(Service_FS, "Failed to open %s", filepath.c_str());
|
||||
NGLOG_WARNING(Service_FS, "Failed to open {}", filepath);
|
||||
return Loader::ResultStatus::Error;
|
||||
}
|
||||
|
||||
LOG_DEBUG(Service_FS, "Opened %s", filepath.c_str());
|
||||
NGLOG_DEBUG(Service_FS, "Opened {}", filepath);
|
||||
return Loader::ResultStatus::Success;
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ Loader::ResultStatus NCCHContainer::Load() {
|
|||
|
||||
// Skip NCSD header and load first NCCH (NCSD is just a container of NCCH files)...
|
||||
if (Loader::MakeMagic('N', 'C', 'S', 'D') == ncch_header.magic) {
|
||||
LOG_DEBUG(Service_FS, "Only loading the first (bootable) NCCH within the NCSD file!");
|
||||
NGLOG_DEBUG(Service_FS, "Only loading the first (bootable) NCCH within the NCSD file!");
|
||||
ncch_offset += 0x4000;
|
||||
file.Seek(ncch_offset, SEEK_SET);
|
||||
file.ReadBytes(&ncch_header, sizeof(NCCH_Header));
|
||||
|
@ -159,24 +159,24 @@ Loader::ResultStatus NCCHContainer::Load() {
|
|||
u8 resource_limit_category =
|
||||
exheader_header.arm11_system_local_caps.resource_limit_category;
|
||||
|
||||
LOG_DEBUG(Service_FS, "Name: %s",
|
||||
exheader_header.codeset_info.name);
|
||||
LOG_DEBUG(Service_FS, "Program ID: %016" PRIX64,
|
||||
ncch_header.program_id);
|
||||
LOG_DEBUG(Service_FS, "Code compressed: %s", is_compressed ? "yes" : "no");
|
||||
LOG_DEBUG(Service_FS, "Entry point: 0x%08X", entry_point);
|
||||
LOG_DEBUG(Service_FS, "Code size: 0x%08X", code_size);
|
||||
LOG_DEBUG(Service_FS, "Stack size: 0x%08X", stack_size);
|
||||
LOG_DEBUG(Service_FS, "Bss size: 0x%08X", bss_size);
|
||||
LOG_DEBUG(Service_FS, "Core version: %d", core_version);
|
||||
LOG_DEBUG(Service_FS, "Thread priority: 0x%X", priority);
|
||||
LOG_DEBUG(Service_FS, "Resource limit category: %d", resource_limit_category);
|
||||
LOG_DEBUG(Service_FS, "System Mode: %d",
|
||||
static_cast<int>(exheader_header.arm11_system_local_caps.system_mode));
|
||||
NGLOG_DEBUG(Service_FS, "Name: {}",
|
||||
exheader_header.codeset_info.name);
|
||||
NGLOG_DEBUG(Service_FS, "Program ID: {:016X}", ncch_header.program_id);
|
||||
NGLOG_DEBUG(Service_FS, "Code compressed: {}",
|
||||
is_compressed ? "yes" : "no");
|
||||
NGLOG_DEBUG(Service_FS, "Entry point: 0x{:08X}", entry_point);
|
||||
NGLOG_DEBUG(Service_FS, "Code size: 0x{:08X}", code_size);
|
||||
NGLOG_DEBUG(Service_FS, "Stack size: 0x{:08X}", stack_size);
|
||||
NGLOG_DEBUG(Service_FS, "Bss size: 0x{:08X}", bss_size);
|
||||
NGLOG_DEBUG(Service_FS, "Core version: {}", core_version);
|
||||
NGLOG_DEBUG(Service_FS, "Thread priority: 0x{:X}", priority);
|
||||
NGLOG_DEBUG(Service_FS, "Resource limit category: {}", resource_limit_category);
|
||||
NGLOG_DEBUG(Service_FS, "System Mode: {}",
|
||||
static_cast<int>(exheader_header.arm11_system_local_caps.system_mode));
|
||||
|
||||
if (exheader_header.system_info.jump_id != ncch_header.program_id) {
|
||||
LOG_ERROR(Service_FS,
|
||||
"ExHeader Program ID mismatch: the ROM is probably encrypted.");
|
||||
NGLOG_ERROR(Service_FS,
|
||||
"ExHeader Program ID mismatch: the ROM is probably encrypted.");
|
||||
return Loader::ResultStatus::ErrorEncrypted;
|
||||
}
|
||||
|
||||
|
@ -188,8 +188,8 @@ Loader::ResultStatus NCCHContainer::Load() {
|
|||
exefs_offset = ncch_header.exefs_offset * kBlockSize;
|
||||
u32 exefs_size = ncch_header.exefs_size * kBlockSize;
|
||||
|
||||
LOG_DEBUG(Service_FS, "ExeFS offset: 0x%08X", exefs_offset);
|
||||
LOG_DEBUG(Service_FS, "ExeFS size: 0x%08X", exefs_size);
|
||||
NGLOG_DEBUG(Service_FS, "ExeFS offset: 0x{:08X}", exefs_offset);
|
||||
NGLOG_DEBUG(Service_FS, "ExeFS size: 0x{:08X}", exefs_size);
|
||||
|
||||
file.Seek(exefs_offset + ncch_offset, SEEK_SET);
|
||||
if (file.ReadBytes(&exefs_header, sizeof(ExeFs_Header)) != sizeof(ExeFs_Header))
|
||||
|
@ -227,7 +227,7 @@ Loader::ResultStatus NCCHContainer::LoadOverrides() {
|
|||
exefs_file = FileUtil::IOFile(exefs_override, "rb");
|
||||
|
||||
if (exefs_file.ReadBytes(&exefs_header, sizeof(ExeFs_Header)) == sizeof(ExeFs_Header)) {
|
||||
LOG_DEBUG(Service_FS, "Loading ExeFS section from %s", exefs_override.c_str());
|
||||
NGLOG_DEBUG(Service_FS, "Loading ExeFS section from {}", exefs_override);
|
||||
exefs_offset = 0;
|
||||
is_tainted = true;
|
||||
has_exefs = true;
|
||||
|
@ -239,9 +239,9 @@ Loader::ResultStatus NCCHContainer::LoadOverrides() {
|
|||
}
|
||||
|
||||
if (is_tainted)
|
||||
LOG_WARNING(Service_FS,
|
||||
"Loaded NCCH %s is tainted, application behavior may not be as expected!",
|
||||
filepath.c_str());
|
||||
NGLOG_WARNING(Service_FS,
|
||||
"Loaded NCCH {} is tainted, application behavior may not be as expected!",
|
||||
filepath);
|
||||
|
||||
return Loader::ResultStatus::Success;
|
||||
}
|
||||
|
@ -267,12 +267,12 @@ Loader::ResultStatus NCCHContainer::LoadSectionExeFS(const char* name, std::vect
|
|||
file.Seek(ncch_offset + logo_offset, SEEK_SET);
|
||||
|
||||
if (file.ReadBytes(buffer.data(), logo_size) != logo_size) {
|
||||
LOG_ERROR(Service_FS, "Could not read NCCH logo");
|
||||
NGLOG_ERROR(Service_FS, "Could not read NCCH logo");
|
||||
return Loader::ResultStatus::Error;
|
||||
}
|
||||
return Loader::ResultStatus::Success;
|
||||
} else {
|
||||
LOG_INFO(Service_FS, "Attempting to load logo from the ExeFS");
|
||||
NGLOG_INFO(Service_FS, "Attempting to load logo from the ExeFS");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -280,15 +280,15 @@ Loader::ResultStatus NCCHContainer::LoadSectionExeFS(const char* name, std::vect
|
|||
if (!exefs_file.IsOpen())
|
||||
return Loader::ResultStatus::Error;
|
||||
|
||||
LOG_DEBUG(Service_FS, "%d sections:", kMaxSections);
|
||||
NGLOG_DEBUG(Service_FS, "{} sections:", kMaxSections);
|
||||
// Iterate through the ExeFs archive until we find a section with the specified name...
|
||||
for (unsigned section_number = 0; section_number < kMaxSections; section_number++) {
|
||||
const auto& section = exefs_header.section[section_number];
|
||||
|
||||
// Load the specified section...
|
||||
if (strcmp(section.name, name) == 0) {
|
||||
LOG_DEBUG(Service_FS, "%d - offset: 0x%08X, size: 0x%08X, name: %s", section_number,
|
||||
section.offset, section.size, section.name);
|
||||
NGLOG_DEBUG(Service_FS, "{} - offset: 0x{:08X}, size: 0x{:08X}, name: {}",
|
||||
section_number, section.offset, section.size, section.name);
|
||||
|
||||
s64 section_offset =
|
||||
(section.offset + exefs_offset + sizeof(ExeFs_Header) + ncch_offset);
|
||||
|
@ -348,8 +348,7 @@ Loader::ResultStatus NCCHContainer::LoadOverrideExeFSSection(const char* name,
|
|||
|
||||
section_file.Seek(0, SEEK_SET);
|
||||
if (section_file.ReadBytes(&buffer[0], section_size) == section_size) {
|
||||
LOG_WARNING(Service_FS, "File %s overriding built-in ExeFS file",
|
||||
section_override.c_str());
|
||||
NGLOG_WARNING(Service_FS, "File {} overriding built-in ExeFS file", section_override);
|
||||
return Loader::ResultStatus::Success;
|
||||
}
|
||||
}
|
||||
|
@ -366,7 +365,7 @@ Loader::ResultStatus NCCHContainer::ReadRomFS(std::shared_ptr<FileUtil::IOFile>&
|
|||
return Loader::ResultStatus::Success;
|
||||
|
||||
if (!has_romfs) {
|
||||
LOG_DEBUG(Service_FS, "RomFS requested from NCCH which has no RomFS");
|
||||
NGLOG_DEBUG(Service_FS, "RomFS requested from NCCH which has no RomFS");
|
||||
return Loader::ResultStatus::ErrorNotUsed;
|
||||
}
|
||||
|
||||
|
@ -376,8 +375,8 @@ Loader::ResultStatus NCCHContainer::ReadRomFS(std::shared_ptr<FileUtil::IOFile>&
|
|||
u32 romfs_offset = ncch_offset + (ncch_header.romfs_offset * kBlockSize) + 0x1000;
|
||||
u32 romfs_size = (ncch_header.romfs_size * kBlockSize) - 0x1000;
|
||||
|
||||
LOG_DEBUG(Service_FS, "RomFS offset: 0x%08X", romfs_offset);
|
||||
LOG_DEBUG(Service_FS, "RomFS size: 0x%08X", romfs_size);
|
||||
NGLOG_DEBUG(Service_FS, "RomFS offset: 0x{:08X}", romfs_offset);
|
||||
NGLOG_DEBUG(Service_FS, "RomFS size: 0x{:08X}", romfs_size);
|
||||
|
||||
if (file.GetSize() < romfs_offset + romfs_size)
|
||||
return Loader::ResultStatus::Error;
|
||||
|
@ -400,7 +399,7 @@ Loader::ResultStatus NCCHContainer::ReadOverrideRomFS(std::shared_ptr<FileUtil::
|
|||
if (FileUtil::Exists(split_filepath)) {
|
||||
romfs_file = std::make_shared<FileUtil::IOFile>(split_filepath, "rb");
|
||||
if (romfs_file->IsOpen()) {
|
||||
LOG_WARNING(Service_FS, "File %s overriding built-in RomFS", split_filepath.c_str());
|
||||
NGLOG_WARNING(Service_FS, "File {} overriding built-in RomFS", split_filepath);
|
||||
offset = 0;
|
||||
size = romfs_file->GetSize();
|
||||
return Loader::ResultStatus::Success;
|
||||
|
|
|
@ -29,22 +29,22 @@ public:
|
|||
|
||||
ResultVal<std::unique_ptr<FileBackend>> SaveDataArchive::OpenFile(const Path& path,
|
||||
const Mode& mode) const {
|
||||
LOG_DEBUG(Service_FS, "called path=%s mode=%01X", path.DebugStr().c_str(), mode.hex);
|
||||
NGLOG_DEBUG(Service_FS, "called path={} mode={:01X}", path.DebugStr(), mode.hex);
|
||||
|
||||
const PathParser path_parser(path);
|
||||
|
||||
if (!path_parser.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path %s", path.DebugStr().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
if (mode.hex == 0) {
|
||||
LOG_ERROR(Service_FS, "Empty open mode");
|
||||
NGLOG_ERROR(Service_FS, "Empty open mode");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
}
|
||||
|
||||
if (mode.create_flag && !mode.write_flag) {
|
||||
LOG_ERROR(Service_FS, "Create flag set but write flag not set");
|
||||
NGLOG_ERROR(Service_FS, "Create flag set but write flag not set");
|
||||
return ERROR_UNSUPPORTED_OPEN_FLAGS;
|
||||
}
|
||||
|
||||
|
@ -52,19 +52,19 @@ ResultVal<std::unique_ptr<FileBackend>> SaveDataArchive::OpenFile(const Path& pa
|
|||
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point %s", mount_point.c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
case PathParser::PathNotFound:
|
||||
LOG_ERROR(Service_FS, "Path not found %s", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||
return ERROR_PATH_NOT_FOUND;
|
||||
case PathParser::FileInPath:
|
||||
case PathParser::DirectoryFound:
|
||||
LOG_ERROR(Service_FS, "Unexpected file or directory in %s", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Unexpected file or directory in {}", full_path);
|
||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY;
|
||||
case PathParser::NotFound:
|
||||
if (!mode.create_flag) {
|
||||
LOG_ERROR(Service_FS, "Non-existing file %s can't be open without mode create.",
|
||||
full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Non-existing file {} can't be open without mode create.",
|
||||
full_path);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
} else {
|
||||
// Create the file
|
||||
|
@ -77,7 +77,7 @@ ResultVal<std::unique_ptr<FileBackend>> SaveDataArchive::OpenFile(const Path& pa
|
|||
|
||||
FileUtil::IOFile file(full_path, mode.write_flag ? "r+b" : "rb");
|
||||
if (!file.IsOpen()) {
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error opening %s", full_path.c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Unknown error opening {}", full_path);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ ResultCode SaveDataArchive::DeleteFile(const Path& path) const {
|
|||
const PathParser path_parser(path);
|
||||
|
||||
if (!path_parser.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path %s", path.DebugStr().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
|
@ -98,15 +98,15 @@ ResultCode SaveDataArchive::DeleteFile(const Path& path) const {
|
|||
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point %s", mount_point.c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
case PathParser::PathNotFound:
|
||||
LOG_ERROR(Service_FS, "Path not found %s", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||
return ERROR_PATH_NOT_FOUND;
|
||||
case PathParser::FileInPath:
|
||||
case PathParser::DirectoryFound:
|
||||
case PathParser::NotFound:
|
||||
LOG_ERROR(Service_FS, "File not found %s", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "File not found {}", full_path);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
case PathParser::FileFound:
|
||||
break; // Expected 'success' case
|
||||
|
@ -116,7 +116,7 @@ ResultCode SaveDataArchive::DeleteFile(const Path& path) const {
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error deleting %s", full_path.c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Unknown error deleting {}", full_path);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
@ -125,14 +125,14 @@ ResultCode SaveDataArchive::RenameFile(const Path& src_path, const Path& dest_pa
|
|||
|
||||
// TODO: Verify these return codes with HW
|
||||
if (!path_parser_src.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid src path %s", src_path.DebugStr().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Invalid src path {}", src_path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
const PathParser path_parser_dest(dest_path);
|
||||
|
||||
if (!path_parser_dest.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid dest path %s", dest_path.DebugStr().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Invalid dest path {}", dest_path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ static ResultCode DeleteDirectoryHelper(const Path& path, const std::string& mou
|
|||
const PathParser path_parser(path);
|
||||
|
||||
if (!path_parser.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path %s", path.DebugStr().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
|
@ -166,15 +166,15 @@ static ResultCode DeleteDirectoryHelper(const Path& path, const std::string& mou
|
|||
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point %s", mount_point.c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_PATH_NOT_FOUND;
|
||||
case PathParser::PathNotFound:
|
||||
case PathParser::NotFound:
|
||||
LOG_ERROR(Service_FS, "Path not found %s", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||
return ERROR_PATH_NOT_FOUND;
|
||||
case PathParser::FileInPath:
|
||||
case PathParser::FileFound:
|
||||
LOG_ERROR(Service_FS, "Unexpected file or directory %s", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Unexpected file or directory {}", full_path);
|
||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY;
|
||||
case PathParser::DirectoryFound:
|
||||
break; // Expected 'success' case
|
||||
|
@ -184,7 +184,7 @@ static ResultCode DeleteDirectoryHelper(const Path& path, const std::string& mou
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
LOG_ERROR(Service_FS, "Directory not empty %s", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Directory not empty {}", full_path);
|
||||
return ERROR_DIRECTORY_NOT_EMPTY;
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ ResultCode SaveDataArchive::CreateFile(const FileSys::Path& path, u64 size) cons
|
|||
const PathParser path_parser(path);
|
||||
|
||||
if (!path_parser.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path %s", path.DebugStr().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
|
@ -209,17 +209,17 @@ ResultCode SaveDataArchive::CreateFile(const FileSys::Path& path, u64 size) cons
|
|||
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point %s", mount_point.c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
case PathParser::PathNotFound:
|
||||
LOG_ERROR(Service_FS, "Path not found %s", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||
return ERROR_PATH_NOT_FOUND;
|
||||
case PathParser::FileInPath:
|
||||
LOG_ERROR(Service_FS, "Unexpected file in path %s", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
|
||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY;
|
||||
case PathParser::DirectoryFound:
|
||||
case PathParser::FileFound:
|
||||
LOG_ERROR(Service_FS, "%s already exists", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "{} already exists", full_path);
|
||||
return ERROR_FILE_ALREADY_EXISTS;
|
||||
case PathParser::NotFound:
|
||||
break; // Expected 'success' case
|
||||
|
@ -237,7 +237,7 @@ ResultCode SaveDataArchive::CreateFile(const FileSys::Path& path, u64 size) cons
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
LOG_ERROR(Service_FS, "Too large file");
|
||||
NGLOG_ERROR(Service_FS, "Too large file");
|
||||
return ResultCode(ErrorDescription::TooLarge, ErrorModule::FS, ErrorSummary::OutOfResource,
|
||||
ErrorLevel::Info);
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ ResultCode SaveDataArchive::CreateDirectory(const Path& path) const {
|
|||
const PathParser path_parser(path);
|
||||
|
||||
if (!path_parser.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path %s", path.DebugStr().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
|
@ -254,17 +254,17 @@ ResultCode SaveDataArchive::CreateDirectory(const Path& path) const {
|
|||
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point %s", mount_point.c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
case PathParser::PathNotFound:
|
||||
LOG_ERROR(Service_FS, "Path not found %s", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||
return ERROR_PATH_NOT_FOUND;
|
||||
case PathParser::FileInPath:
|
||||
LOG_ERROR(Service_FS, "Unexpected file in path %s", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
|
||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY;
|
||||
case PathParser::DirectoryFound:
|
||||
case PathParser::FileFound:
|
||||
LOG_ERROR(Service_FS, "%s already exists", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "{} already exists", full_path);
|
||||
return ERROR_DIRECTORY_ALREADY_EXISTS;
|
||||
case PathParser::NotFound:
|
||||
break; // Expected 'success' case
|
||||
|
@ -274,7 +274,7 @@ ResultCode SaveDataArchive::CreateDirectory(const Path& path) const {
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating %s", mount_point.c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating {}", mount_point);
|
||||
return ResultCode(ErrorDescription::NoData, ErrorModule::FS, ErrorSummary::Canceled,
|
||||
ErrorLevel::Status);
|
||||
}
|
||||
|
@ -284,14 +284,14 @@ ResultCode SaveDataArchive::RenameDirectory(const Path& src_path, const Path& de
|
|||
|
||||
// TODO: Verify these return codes with HW
|
||||
if (!path_parser_src.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid src path %s", src_path.DebugStr().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Invalid src path {}", src_path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
const PathParser path_parser_dest(dest_path);
|
||||
|
||||
if (!path_parser_dest.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid dest path %s", dest_path.DebugStr().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Invalid dest path {}", dest_path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
|
@ -313,7 +313,7 @@ ResultVal<std::unique_ptr<DirectoryBackend>> SaveDataArchive::OpenDirectory(
|
|||
const PathParser path_parser(path);
|
||||
|
||||
if (!path_parser.IsValid()) {
|
||||
LOG_ERROR(Service_FS, "Invalid path %s", path.DebugStr().c_str());
|
||||
NGLOG_ERROR(Service_FS, "Invalid path {}", path.DebugStr());
|
||||
return ERROR_INVALID_PATH;
|
||||
}
|
||||
|
||||
|
@ -321,15 +321,15 @@ ResultVal<std::unique_ptr<DirectoryBackend>> SaveDataArchive::OpenDirectory(
|
|||
|
||||
switch (path_parser.GetHostStatus(mount_point)) {
|
||||
case PathParser::InvalidMountPoint:
|
||||
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point %s", mount_point.c_str());
|
||||
NGLOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
case PathParser::PathNotFound:
|
||||
case PathParser::NotFound:
|
||||
LOG_ERROR(Service_FS, "Path not found %s", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Path not found {}", full_path);
|
||||
return ERROR_PATH_NOT_FOUND;
|
||||
case PathParser::FileInPath:
|
||||
case PathParser::FileFound:
|
||||
LOG_ERROR(Service_FS, "Unexpected file in path %s", full_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Unexpected file in path {}", full_path);
|
||||
return ERROR_UNEXPECTED_FILE_OR_DIRECTORY;
|
||||
case PathParser::DirectoryFound:
|
||||
break; // Expected 'success' case
|
||||
|
|
|
@ -45,7 +45,7 @@ Loader::ResultStatus TitleMetadata::Load(const std::string& file_path) {
|
|||
|
||||
Loader::ResultStatus result = Load(file_data);
|
||||
if (result != Loader::ResultStatus::Success)
|
||||
LOG_ERROR(Service_FS, "Failed to load TMD from file %s!", file_path.c_str());
|
||||
NGLOG_ERROR(Service_FS, "Failed to load TMD from file {}!", file_path);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -75,8 +75,8 @@ Loader::ResultStatus TitleMetadata::Load(const std::vector<u8> file_data, size_t
|
|||
size_t expected_size =
|
||||
body_start + sizeof(Body) + tmd_body.content_count * sizeof(ContentChunk);
|
||||
if (total_size < expected_size) {
|
||||
LOG_ERROR(Service_FS, "Malformed TMD, expected size 0x%zx, got 0x%zx!", expected_size,
|
||||
total_size);
|
||||
NGLOG_ERROR(Service_FS, "Malformed TMD, expected size 0x{:x}, got 0x{:x}!", expected_size,
|
||||
total_size);
|
||||
return Loader::ResultStatus::ErrorInvalidFormat;
|
||||
}
|
||||
|
||||
|
@ -209,17 +209,17 @@ void TitleMetadata::AddContentChunk(const ContentChunk& chunk) {
|
|||
}
|
||||
|
||||
void TitleMetadata::Print() const {
|
||||
LOG_DEBUG(Service_FS, "%u chunks", static_cast<u32>(tmd_body.content_count));
|
||||
NGLOG_DEBUG(Service_FS, "{} chunks", static_cast<u32>(tmd_body.content_count));
|
||||
|
||||
// Content info describes ranges of content chunks
|
||||
LOG_DEBUG(Service_FS, "Content info:");
|
||||
NGLOG_DEBUG(Service_FS, "Content info:");
|
||||
for (size_t i = 0; i < tmd_body.contentinfo.size(); i++) {
|
||||
if (tmd_body.contentinfo[i].command_count == 0)
|
||||
break;
|
||||
|
||||
LOG_DEBUG(Service_FS, " Index %04X, Command Count %04X",
|
||||
static_cast<u32>(tmd_body.contentinfo[i].index),
|
||||
static_cast<u32>(tmd_body.contentinfo[i].command_count));
|
||||
NGLOG_DEBUG(Service_FS, " Index {:04X}, Command Count {:04X}",
|
||||
static_cast<u32>(tmd_body.contentinfo[i].index),
|
||||
static_cast<u32>(tmd_body.contentinfo[i].command_count));
|
||||
}
|
||||
|
||||
// For each content info, print their content chunk range
|
||||
|
@ -230,16 +230,16 @@ void TitleMetadata::Print() const {
|
|||
if (count == 0)
|
||||
continue;
|
||||
|
||||
LOG_DEBUG(Service_FS, "Content chunks for content info index %zu:", i);
|
||||
NGLOG_DEBUG(Service_FS, "Content chunks for content info index {}:", i);
|
||||
for (u16 j = index; j < index + count; j++) {
|
||||
// Don't attempt to print content we don't have
|
||||
if (j > tmd_body.content_count)
|
||||
break;
|
||||
|
||||
const ContentChunk& chunk = tmd_chunks[j];
|
||||
LOG_DEBUG(Service_FS, " ID %08X, Index %04X, Type %04x, Size %016" PRIX64,
|
||||
static_cast<u32>(chunk.id), static_cast<u32>(chunk.index),
|
||||
static_cast<u32>(chunk.type), static_cast<u64>(chunk.size));
|
||||
NGLOG_DEBUG(Service_FS, " ID {:08X}, Index {:04X}, Type {:04x}, Size {:016X}",
|
||||
static_cast<u32>(chunk.id), static_cast<u32>(chunk.index),
|
||||
static_cast<u32>(chunk.type), static_cast<u64>(chunk.size));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue