citra-emu
/
citra-canary
Archived
1
0
Fork 0

service/fs: Migrate logging macros (#3866)

* service/fs: Migrate logging macros

* service/fs: Fix clang format
This commit is contained in:
NarcolepticK 2018-06-22 06:33:30 -04:00 committed by Weiyi Wang
parent 1449f8e725
commit a42287587e
2 changed files with 108 additions and 107 deletions

View File

@ -73,13 +73,12 @@ void File::Read(Kernel::HLERequestContext& ctx) {
u64 offset = rp.Pop<u64>(); u64 offset = rp.Pop<u64>();
u32 length = rp.Pop<u32>(); u32 length = rp.Pop<u32>();
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
LOG_TRACE(Service_FS, "Read %s: offset=0x%" PRIx64 " length=0x%08X", GetName().c_str(), offset, NGLOG_TRACE(Service_FS, "Read {}: offset=0x{:x} length=0x{:08X}", GetName(), offset, length);
length);
const FileSessionSlot* file = GetSessionData(ctx.Session()); const FileSessionSlot* file = GetSessionData(ctx.Session());
if (file->subfile && length > file->size) { if (file->subfile && length > file->size) {
LOG_WARNING(Service_FS, "Trying to read beyond the subfile size, truncating"); NGLOG_WARNING(Service_FS, "Trying to read beyond the subfile size, truncating");
length = file->size; length = file->size;
} }
@ -87,9 +86,8 @@ void File::Read(Kernel::HLERequestContext& ctx) {
offset += file->offset; offset += file->offset;
if (offset + length > backend->GetSize()) { if (offset + length > backend->GetSize()) {
LOG_ERROR(Service_FS, NGLOG_ERROR(Service_FS,
"Reading from out of bounds offset=0x%" PRIx64 "Reading from out of bounds offset=0x{:x} length=0x{:08X} file_size=0x{:x}",
" length=0x%08X file_size=0x%" PRIx64,
offset, length, backend->GetSize()); offset, length, backend->GetSize());
} }
@ -121,8 +119,8 @@ void File::Write(Kernel::HLERequestContext& ctx) {
u32 length = rp.Pop<u32>(); u32 length = rp.Pop<u32>();
u32 flush = rp.Pop<u32>(); u32 flush = rp.Pop<u32>();
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
LOG_TRACE(Service_FS, "Write %s: offset=0x%" PRIx64 " length=%d, flush=0x%x", GetName().c_str(), NGLOG_TRACE(Service_FS, "Write {}: offset=0x{:x} length={}, flush=0x{:x}", GetName(), offset,
offset, length, flush); length, flush);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
@ -183,7 +181,7 @@ void File::Close(Kernel::HLERequestContext& ctx) {
// TODO(Subv): Only close the backend if this client is the only one left. // TODO(Subv): Only close the backend if this client is the only one left.
if (connected_sessions.size() > 1) if (connected_sessions.size() > 1)
LOG_WARNING(Service_FS, "Closing File backend but %zu clients still connected", NGLOG_WARNING(Service_FS, "Closing File backend but {} clients still connected",
connected_sessions.size()); connected_sessions.size());
backend->Close(); backend->Close();
@ -228,7 +226,7 @@ void File::GetPriority(Kernel::HLERequestContext& ctx) {
} }
void File::OpenLinkFile(Kernel::HLERequestContext& ctx) { void File::OpenLinkFile(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_FS, "(STUBBED) File command OpenLinkFile %s", GetName().c_str()); NGLOG_WARNING(Service_FS, "(STUBBED) File command OpenLinkFile {}", GetName());
using Kernel::ClientSession; using Kernel::ClientSession;
using Kernel::ServerSession; using Kernel::ServerSession;
using Kernel::SharedPtr; using Kernel::SharedPtr;
@ -329,7 +327,7 @@ void Directory::Read(Kernel::HLERequestContext& ctx) {
u32 count = rp.Pop<u32>(); u32 count = rp.Pop<u32>();
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
std::vector<FileSys::Entry> entries(count); std::vector<FileSys::Entry> entries(count);
LOG_TRACE(Service_FS, "Read %s: count=%u", GetName().c_str(), count); NGLOG_TRACE(Service_FS, "Read {}: count={}", GetName(), count);
// Number of entries actually read // Number of entries actually read
u32 read = backend->Read(static_cast<u32>(entries.size()), entries.data()); u32 read = backend->Read(static_cast<u32>(entries.size()), entries.data());
buffer.Write(entries.data(), 0, read * sizeof(FileSys::Entry)); buffer.Write(entries.data(), 0, read * sizeof(FileSys::Entry));
@ -342,7 +340,7 @@ void Directory::Read(Kernel::HLERequestContext& ctx) {
void Directory::Close(Kernel::HLERequestContext& ctx) { void Directory::Close(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x0802, 0, 0); IPC::RequestParser rp(ctx, 0x0802, 0, 0);
LOG_TRACE(Service_FS, "Close %s", GetName().c_str()); NGLOG_TRACE(Service_FS, "Close {}", GetName());
backend->Close(); backend->Close();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
@ -372,7 +370,7 @@ static ArchiveBackend* GetArchive(ArchiveHandle handle) {
} }
ResultVal<ArchiveHandle> OpenArchive(ArchiveIdCode id_code, FileSys::Path& archive_path) { ResultVal<ArchiveHandle> OpenArchive(ArchiveIdCode id_code, FileSys::Path& archive_path) {
LOG_TRACE(Service_FS, "Opening archive with id code 0x%08X", id_code); NGLOG_TRACE(Service_FS, "Opening archive with id code 0x{:08X}", id_code);
auto itr = id_code_map.find(id_code); auto itr = id_code_map.find(id_code);
if (itr == id_code_map.end()) { if (itr == id_code_map.end()) {
@ -406,7 +404,7 @@ ResultCode RegisterArchiveType(std::unique_ptr<FileSys::ArchiveFactory>&& factor
ASSERT_MSG(inserted, "Tried to register more than one archive with same id code"); ASSERT_MSG(inserted, "Tried to register more than one archive with same id code");
auto& archive = result.first->second; auto& archive = result.first->second;
LOG_DEBUG(Service_FS, "Registered archive %s with id code 0x%08X", archive->GetName().c_str(), NGLOG_DEBUG(Service_FS, "Registered archive {} with id code 0x{:08X}", archive->GetName(),
static_cast<u32>(id_code)); static_cast<u32>(id_code));
return RESULT_SUCCESS; return RESULT_SUCCESS;
} }
@ -578,7 +576,7 @@ ResultCode DeleteExtSaveData(MediaType media_type, u32 high, u32 low) {
} else if (media_type == MediaType::SDMC) { } else if (media_type == MediaType::SDMC) {
media_type_directory = FileUtil::GetUserPath(D_SDMC_IDX); media_type_directory = FileUtil::GetUserPath(D_SDMC_IDX);
} else { } else {
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));
return ResultCode(-1); // TODO(Subv): Find the right error code return ResultCode(-1); // TODO(Subv): Find the right error code
} }
@ -625,15 +623,14 @@ void RegisterArchiveTypes() {
if (sdmc_factory->Initialize()) if (sdmc_factory->Initialize())
RegisterArchiveType(std::move(sdmc_factory), ArchiveIdCode::SDMC); RegisterArchiveType(std::move(sdmc_factory), ArchiveIdCode::SDMC);
else else
LOG_ERROR(Service_FS, "Can't instantiate SDMC archive with path %s", NGLOG_ERROR(Service_FS, "Can't instantiate SDMC archive with path {}", sdmc_directory);
sdmc_directory.c_str());
auto sdmcwo_factory = std::make_unique<FileSys::ArchiveFactory_SDMCWriteOnly>(sdmc_directory); auto sdmcwo_factory = std::make_unique<FileSys::ArchiveFactory_SDMCWriteOnly>(sdmc_directory);
if (sdmcwo_factory->Initialize()) if (sdmcwo_factory->Initialize())
RegisterArchiveType(std::move(sdmcwo_factory), ArchiveIdCode::SDMCWriteOnly); RegisterArchiveType(std::move(sdmcwo_factory), ArchiveIdCode::SDMCWriteOnly);
else else
LOG_ERROR(Service_FS, "Can't instantiate SDMCWriteOnly archive with path %s", NGLOG_ERROR(Service_FS, "Can't instantiate SDMCWriteOnly archive with path {}",
sdmc_directory.c_str()); sdmc_directory);
// Create the SaveData archive // Create the SaveData archive
auto sd_savedata_source = std::make_shared<FileSys::ArchiveSource_SDSaveData>(sdmc_directory); auto sd_savedata_source = std::make_shared<FileSys::ArchiveSource_SDSaveData>(sdmc_directory);
@ -653,16 +650,16 @@ void RegisterArchiveTypes() {
if (extsavedata_factory->Initialize()) if (extsavedata_factory->Initialize())
RegisterArchiveType(std::move(extsavedata_factory), ArchiveIdCode::ExtSaveData); RegisterArchiveType(std::move(extsavedata_factory), ArchiveIdCode::ExtSaveData);
else else
LOG_ERROR(Service_FS, "Can't instantiate ExtSaveData archive with path %s", NGLOG_ERROR(Service_FS, "Can't instantiate ExtSaveData archive with path {}",
extsavedata_factory->GetMountPoint().c_str()); extsavedata_factory->GetMountPoint());
auto sharedextsavedata_factory = auto sharedextsavedata_factory =
std::make_unique<FileSys::ArchiveFactory_ExtSaveData>(nand_directory, true); std::make_unique<FileSys::ArchiveFactory_ExtSaveData>(nand_directory, true);
if (sharedextsavedata_factory->Initialize()) if (sharedextsavedata_factory->Initialize())
RegisterArchiveType(std::move(sharedextsavedata_factory), ArchiveIdCode::SharedExtSaveData); RegisterArchiveType(std::move(sharedextsavedata_factory), ArchiveIdCode::SharedExtSaveData);
else else
LOG_ERROR(Service_FS, "Can't instantiate SharedExtSaveData archive with path %s", NGLOG_ERROR(Service_FS, "Can't instantiate SharedExtSaveData archive with path {}",
sharedextsavedata_factory->GetMountPoint().c_str()); sharedextsavedata_factory->GetMountPoint());
// Create the NCCH archive, basically a small variation of the RomFS archive // Create the NCCH archive, basically a small variation of the RomFS archive
auto savedatacheck_factory = std::make_unique<FileSys::ArchiveFactory_NCCH>(); auto savedatacheck_factory = std::make_unique<FileSys::ArchiveFactory_NCCH>();
@ -679,7 +676,8 @@ void RegisterArchiveTypes() {
void RegisterSelfNCCH(Loader::AppLoader& app_loader) { void RegisterSelfNCCH(Loader::AppLoader& app_loader) {
auto itr = id_code_map.find(ArchiveIdCode::SelfNCCH); auto itr = id_code_map.find(ArchiveIdCode::SelfNCCH);
if (itr == id_code_map.end()) { if (itr == id_code_map.end()) {
LOG_ERROR(Service_FS, NGLOG_ERROR(
Service_FS,
"Could not register a new NCCH because the SelfNCCH archive hasn't been created"); "Could not register a new NCCH because the SelfNCCH archive hasn't been created");
return; return;
} }

View File

@ -54,7 +54,7 @@ void FS_USER::OpenFile(Kernel::HLERequestContext& ctx) {
ASSERT(filename.size() == filename_size); ASSERT(filename.size() == filename_size);
FileSys::Path file_path(filename_type, filename); FileSys::Path file_path(filename_type, filename);
LOG_DEBUG(Service_FS, "path=%s, mode=%u attrs=%u", file_path.DebugStr().c_str(), mode.hex, NGLOG_DEBUG(Service_FS, "path={}, mode={} attrs={}", file_path.DebugStr(), mode.hex,
attributes); attributes);
ResultVal<std::shared_ptr<File>> file_res = ResultVal<std::shared_ptr<File>> file_res =
@ -66,7 +66,7 @@ void FS_USER::OpenFile(Kernel::HLERequestContext& ctx) {
rb.PushMoveObjects(file->Connect()); rb.PushMoveObjects(file->Connect());
} else { } else {
rb.PushMoveObjects<Kernel::Object>(nullptr); rb.PushMoveObjects<Kernel::Object>(nullptr);
LOG_ERROR(Service_FS, "failed to get a handle for file %s", file_path.DebugStr().c_str()); NGLOG_ERROR(Service_FS, "failed to get a handle for file {}", file_path.DebugStr());
} }
} }
@ -88,17 +88,18 @@ void FS_USER::OpenFileDirectly(Kernel::HLERequestContext& ctx) {
FileSys::Path archive_path(archivename_type, archivename); FileSys::Path archive_path(archivename_type, archivename);
FileSys::Path file_path(filename_type, filename); FileSys::Path file_path(filename_type, filename);
LOG_DEBUG(Service_FS, "archive_id=0x%08X archive_path=%s file_path=%s, mode=%u attributes=%u", NGLOG_DEBUG(Service_FS,
static_cast<u32>(archive_id), archive_path.DebugStr().c_str(), "archive_id=0x{:08X} archive_path={} file_path={}, mode={} attributes={}",
file_path.DebugStr().c_str(), mode.hex, attributes); static_cast<u32>(archive_id), archive_path.DebugStr(), file_path.DebugStr(),
mode.hex, attributes);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
ResultVal<ArchiveHandle> archive_handle = Service::FS::OpenArchive(archive_id, archive_path); ResultVal<ArchiveHandle> archive_handle = Service::FS::OpenArchive(archive_id, archive_path);
if (archive_handle.Failed()) { if (archive_handle.Failed()) {
LOG_ERROR(Service_FS, NGLOG_ERROR(Service_FS,
"Failed to get a handle for archive archive_id=0x%08X archive_path=%s", "Failed to get a handle for archive archive_id=0x{:08X} archive_path={}",
static_cast<u32>(archive_id), archive_path.DebugStr().c_str()); static_cast<u32>(archive_id), archive_path.DebugStr());
rb.Push(archive_handle.Code()); rb.Push(archive_handle.Code());
rb.PushMoveObjects<Kernel::Object>(nullptr); rb.PushMoveObjects<Kernel::Object>(nullptr);
return; return;
@ -113,8 +114,8 @@ void FS_USER::OpenFileDirectly(Kernel::HLERequestContext& ctx) {
rb.PushMoveObjects(file->Connect()); rb.PushMoveObjects(file->Connect());
} else { } else {
rb.PushMoveObjects<Kernel::Object>(nullptr); rb.PushMoveObjects<Kernel::Object>(nullptr);
LOG_ERROR(Service_FS, "failed to get a handle for file %s mode=%u attributes=%u", NGLOG_ERROR(Service_FS, "failed to get a handle for file {} mode={} attributes={}",
file_path.DebugStr().c_str(), mode.hex, attributes); file_path.DebugStr(), mode.hex, attributes);
} }
} }
@ -129,8 +130,8 @@ void FS_USER::DeleteFile(Kernel::HLERequestContext& ctx) {
FileSys::Path file_path(filename_type, filename); FileSys::Path file_path(filename_type, filename);
LOG_DEBUG(Service_FS, "type=%u size=%u data=%s", static_cast<u32>(filename_type), filename_size, NGLOG_DEBUG(Service_FS, "type={} size={} data={}", static_cast<u32>(filename_type),
file_path.DebugStr().c_str()); filename_size, file_path.DebugStr());
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(DeleteFileFromArchive(archive_handle, file_path)); rb.Push(DeleteFileFromArchive(archive_handle, file_path));
@ -154,11 +155,10 @@ void FS_USER::RenameFile(Kernel::HLERequestContext& ctx) {
FileSys::Path src_file_path(src_filename_type, src_filename); FileSys::Path src_file_path(src_filename_type, src_filename);
FileSys::Path dest_file_path(dest_filename_type, dest_filename); FileSys::Path dest_file_path(dest_filename_type, dest_filename);
LOG_DEBUG(Service_FS, NGLOG_DEBUG(
"src_type=%u src_size=%u src_data=%s dest_type=%u dest_size=%u dest_data=%s", Service_FS, "src_type={} src_size={} src_data={} dest_type={} dest_size={} dest_data={}",
static_cast<u32>(src_filename_type), src_filename_size, static_cast<u32>(src_filename_type), src_filename_size, src_file_path.DebugStr(),
src_file_path.DebugStr().c_str(), static_cast<u32>(dest_filename_type), static_cast<u32>(dest_filename_type), dest_filename_size, dest_file_path.DebugStr());
dest_filename_size, dest_file_path.DebugStr().c_str());
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RenameFileBetweenArchives(src_archive_handle, src_file_path, dest_archive_handle, rb.Push(RenameFileBetweenArchives(src_archive_handle, src_file_path, dest_archive_handle,
@ -177,8 +177,8 @@ void FS_USER::DeleteDirectory(Kernel::HLERequestContext& ctx) {
FileSys::Path dir_path(dirname_type, dirname); FileSys::Path dir_path(dirname_type, dirname);
LOG_DEBUG(Service_FS, "type=%u size=%u data=%s", static_cast<u32>(dirname_type), dirname_size, NGLOG_DEBUG(Service_FS, "type={} size={} data={}", static_cast<u32>(dirname_type), dirname_size,
dir_path.DebugStr().c_str()); dir_path.DebugStr());
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(DeleteDirectoryFromArchive(archive_handle, dir_path)); rb.Push(DeleteDirectoryFromArchive(archive_handle, dir_path));
@ -196,8 +196,8 @@ void FS_USER::DeleteDirectoryRecursively(Kernel::HLERequestContext& ctx) {
FileSys::Path dir_path(dirname_type, dirname); FileSys::Path dir_path(dirname_type, dirname);
LOG_DEBUG(Service_FS, "type=%u size=%u data=%s", static_cast<u32>(dirname_type), dirname_size, NGLOG_DEBUG(Service_FS, "type={} size={} data={}", static_cast<u32>(dirname_type), dirname_size,
dir_path.DebugStr().c_str()); dir_path.DebugStr());
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(DeleteDirectoryRecursivelyFromArchive(archive_handle, dir_path)); rb.Push(DeleteDirectoryRecursivelyFromArchive(archive_handle, dir_path));
@ -217,8 +217,8 @@ void FS_USER::CreateFile(Kernel::HLERequestContext& ctx) {
FileSys::Path file_path(filename_type, filename); FileSys::Path file_path(filename_type, filename);
LOG_DEBUG(Service_FS, "type=%u attributes=%u size=%" PRIx64 " data=%s", NGLOG_DEBUG(Service_FS, "type={} attributes={} size={:x} data={}",
static_cast<u32>(filename_type), attributes, file_size, file_path.DebugStr().c_str()); static_cast<u32>(filename_type), attributes, file_size, file_path.DebugStr());
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(CreateFileInArchive(archive_handle, file_path, file_size)); rb.Push(CreateFileInArchive(archive_handle, file_path, file_size));
@ -235,8 +235,8 @@ void FS_USER::CreateDirectory(Kernel::HLERequestContext& ctx) {
ASSERT(dirname.size() == dirname_size); ASSERT(dirname.size() == dirname_size);
FileSys::Path dir_path(dirname_type, dirname); FileSys::Path dir_path(dirname_type, dirname);
LOG_DEBUG(Service_FS, "type=%u size=%u data=%s", static_cast<u32>(dirname_type), dirname_size, NGLOG_DEBUG(Service_FS, "type={} size={} data={}", static_cast<u32>(dirname_type), dirname_size,
dir_path.DebugStr().c_str()); dir_path.DebugStr());
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(CreateDirectoryFromArchive(archive_handle, dir_path)); rb.Push(CreateDirectoryFromArchive(archive_handle, dir_path));
@ -259,10 +259,10 @@ void FS_USER::RenameDirectory(Kernel::HLERequestContext& ctx) {
FileSys::Path src_dir_path(src_dirname_type, src_dirname); FileSys::Path src_dir_path(src_dirname_type, src_dirname);
FileSys::Path dest_dir_path(dest_dirname_type, dest_dirname); FileSys::Path dest_dir_path(dest_dirname_type, dest_dirname);
LOG_DEBUG( NGLOG_DEBUG(Service_FS,
Service_FS, "src_type=%u src_size=%u src_data=%s dest_type=%u dest_size=%u dest_data=%s", "src_type={} src_size={} src_data={} dest_type={} dest_size={} dest_data={}",
static_cast<u32>(src_dirname_type), src_dirname_size, src_dir_path.DebugStr().c_str(), static_cast<u32>(src_dirname_type), src_dirname_size, src_dir_path.DebugStr(),
static_cast<u32>(dest_dirname_type), dest_dirname_size, dest_dir_path.DebugStr().c_str()); static_cast<u32>(dest_dirname_type), dest_dirname_size, dest_dir_path.DebugStr());
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RenameDirectoryBetweenArchives(src_archive_handle, src_dir_path, dest_archive_handle, rb.Push(RenameDirectoryBetweenArchives(src_archive_handle, src_dir_path, dest_archive_handle,
@ -279,8 +279,8 @@ void FS_USER::OpenDirectory(Kernel::HLERequestContext& ctx) {
FileSys::Path dir_path(dirname_type, dirname); FileSys::Path dir_path(dirname_type, dirname);
LOG_DEBUG(Service_FS, "type=%u size=%u data=%s", static_cast<u32>(dirname_type), dirname_size, NGLOG_DEBUG(Service_FS, "type={} size={} data={}", static_cast<u32>(dirname_type), dirname_size,
dir_path.DebugStr().c_str()); dir_path.DebugStr());
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
ResultVal<std::shared_ptr<Directory>> dir_res = ResultVal<std::shared_ptr<Directory>> dir_res =
@ -292,8 +292,8 @@ void FS_USER::OpenDirectory(Kernel::HLERequestContext& ctx) {
directory->ClientConnected(std::get<SharedPtr<ServerSession>>(sessions)); directory->ClientConnected(std::get<SharedPtr<ServerSession>>(sessions));
rb.PushMoveObjects(std::get<SharedPtr<ClientSession>>(sessions)); rb.PushMoveObjects(std::get<SharedPtr<ClientSession>>(sessions));
} else { } else {
LOG_ERROR(Service_FS, "failed to get a handle for directory type=%u size=%u data=%s", NGLOG_ERROR(Service_FS, "failed to get a handle for directory type={} size={} data={}",
static_cast<u32>(dirname_type), dirname_size, dir_path.DebugStr().c_str()); static_cast<u32>(dirname_type), dirname_size, dir_path.DebugStr());
rb.PushMoveObjects<Kernel::Object>(nullptr); rb.PushMoveObjects<Kernel::Object>(nullptr);
} }
} }
@ -307,8 +307,8 @@ void FS_USER::OpenArchive(Kernel::HLERequestContext& ctx) {
ASSERT(archivename.size() == archivename_size); ASSERT(archivename.size() == archivename_size);
FileSys::Path archive_path(archivename_type, archivename); FileSys::Path archive_path(archivename_type, archivename);
LOG_DEBUG(Service_FS, "archive_id=0x%08X archive_path=%s", static_cast<u32>(archive_id), NGLOG_DEBUG(Service_FS, "archive_id=0x{:08X} archive_path={}", static_cast<u32>(archive_id),
archive_path.DebugStr().c_str()); archive_path.DebugStr());
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0); IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
ResultVal<ArchiveHandle> handle = Service::FS::OpenArchive(archive_id, archive_path); ResultVal<ArchiveHandle> handle = Service::FS::OpenArchive(archive_id, archive_path);
@ -317,9 +317,9 @@ void FS_USER::OpenArchive(Kernel::HLERequestContext& ctx) {
rb.PushRaw(*handle); rb.PushRaw(*handle);
} else { } else {
rb.Push<u64>(0); rb.Push<u64>(0);
LOG_ERROR(Service_FS, NGLOG_ERROR(Service_FS,
"failed to get a handle for archive archive_id=0x%08X archive_path=%s", "failed to get a handle for archive archive_id=0x{:08X} archive_path={}",
static_cast<u32>(archive_id), archive_path.DebugStr().c_str()); static_cast<u32>(archive_id), archive_path.DebugStr());
} }
} }
@ -344,11 +344,11 @@ void FS_USER::IsSdmcWriteable(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
// If the SD isn't enabled, it can't be writeable...else, stubbed true // If the SD isn't enabled, it can't be writeable...else, stubbed true
rb.Push(Settings::values.use_virtual_sd); rb.Push(Settings::values.use_virtual_sd);
LOG_DEBUG(Service_FS, " (STUBBED)"); NGLOG_DEBUG(Service_FS, " (STUBBED)");
} }
void FS_USER::FormatSaveData(Kernel::HLERequestContext& ctx) { void FS_USER::FormatSaveData(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_FS, "(STUBBED)"); NGLOG_WARNING(Service_FS, "(STUBBED)");
IPC::RequestParser rp(ctx, 0x84C, 9, 2); IPC::RequestParser rp(ctx, 0x84C, 9, 2);
auto archive_id = rp.PopEnum<FS::ArchiveIdCode>(); auto archive_id = rp.PopEnum<FS::ArchiveIdCode>();
@ -364,11 +364,11 @@ void FS_USER::FormatSaveData(Kernel::HLERequestContext& ctx) {
ASSERT(archivename.size() == archivename_size); ASSERT(archivename.size() == archivename_size);
FileSys::Path archive_path(archivename_type, archivename); FileSys::Path archive_path(archivename_type, archivename);
LOG_DEBUG(Service_FS, "archive_path=%s", archive_path.DebugStr().c_str()); NGLOG_DEBUG(Service_FS, "archive_path={}", archive_path.DebugStr());
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
if (archive_id != FS::ArchiveIdCode::SaveData) { if (archive_id != FS::ArchiveIdCode::SaveData) {
LOG_ERROR(Service_FS, "tried to format an archive different than SaveData, %u", NGLOG_ERROR(Service_FS, "tried to format an archive different than SaveData, {}",
static_cast<u32>(archive_id)); static_cast<u32>(archive_id));
rb.Push(FileSys::ERROR_INVALID_PATH); rb.Push(FileSys::ERROR_INVALID_PATH);
return; return;
@ -376,7 +376,7 @@ void FS_USER::FormatSaveData(Kernel::HLERequestContext& ctx) {
if (archive_path.GetType() != FileSys::LowPathType::Empty) { if (archive_path.GetType() != FileSys::LowPathType::Empty) {
// TODO(Subv): Implement formatting the SaveData of other games // TODO(Subv): Implement formatting the SaveData of other games
LOG_ERROR(Service_FS, "archive LowPath type other than empty is currently unsupported"); NGLOG_ERROR(Service_FS, "archive LowPath type other than empty is currently unsupported");
rb.Push(UnimplementedFunction(ErrorModule::FS)); rb.Push(UnimplementedFunction(ErrorModule::FS));
return; return;
} }
@ -408,7 +408,7 @@ void FS_USER::FormatThisUserSaveData(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(FormatArchive(ArchiveIdCode::SaveData, format_info)); rb.Push(FormatArchive(ArchiveIdCode::SaveData, format_info));
LOG_TRACE(Service_FS, "called"); NGLOG_TRACE(Service_FS, "called");
} }
void FS_USER::GetFreeBytes(Kernel::HLERequestContext& ctx) { void FS_USER::GetFreeBytes(Kernel::HLERequestContext& ctx) {
@ -438,9 +438,9 @@ void FS_USER::CreateExtSaveData(Kernel::HLERequestContext& ctx) {
u32 icon_size = rp.Pop<u32>(); u32 icon_size = rp.Pop<u32>();
auto icon_buffer = rp.PopMappedBuffer(); auto icon_buffer = rp.PopMappedBuffer();
LOG_WARNING(Service_FS, NGLOG_WARNING(Service_FS,
"(STUBBED) savedata_high=%08X savedata_low=%08X unknown=%08X " "(STUBBED) savedata_high={:08X} savedata_low={:08X} unknown={:08X} "
"files=%08X directories=%08X size_limit=%016" PRIx64 " icon_size=%08X", "files={:08X} directories={:08X} size_limit={:016x} icon_size={:08X}",
save_high, save_low, unknown, directories, files, size_limit, icon_size); save_high, save_low, unknown, directories, files, size_limit, icon_size);
std::vector<u8> icon(icon_size); std::vector<u8> icon(icon_size);
@ -464,7 +464,8 @@ void FS_USER::DeleteExtSaveData(Kernel::HLERequestContext& ctx) {
u32 save_high = rp.Pop<u32>(); u32 save_high = rp.Pop<u32>();
u32 unknown = rp.Pop<u32>(); // TODO(Subv): Figure out what this is u32 unknown = rp.Pop<u32>(); // TODO(Subv): Figure out what this is
LOG_WARNING(Service_FS, "(STUBBED) save_low=%08X save_high=%08X media_type=%08X unknown=%08X", NGLOG_WARNING(Service_FS,
"(STUBBED) save_low={:08X} save_high={:08X} media_type={:08X} unknown={:08X}",
save_low, save_high, static_cast<u32>(media_type), unknown); save_low, save_high, static_cast<u32>(media_type), unknown);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
@ -476,7 +477,7 @@ void FS_USER::CardSlotIsInserted(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(false); rb.Push(false);
LOG_WARNING(Service_FS, "(STUBBED) called"); NGLOG_WARNING(Service_FS, "(STUBBED) called");
} }
void FS_USER::DeleteSystemSaveData(Kernel::HLERequestContext& ctx) { void FS_USER::DeleteSystemSaveData(Kernel::HLERequestContext& ctx) {
@ -500,11 +501,12 @@ void FS_USER::CreateSystemSaveData(Kernel::HLERequestContext& ctx) {
u32 file_buckets = rp.Pop<u32>(); u32 file_buckets = rp.Pop<u32>();
bool duplicate = rp.Pop<bool>(); bool duplicate = rp.Pop<bool>();
LOG_WARNING(Service_FS, NGLOG_WARNING(
"(STUBBED) savedata_high=%08X savedata_low=%08X total_size=%08X block_size=%08X " Service_FS,
"directories=%u files=%u directory_buckets=%u file_buckets=%u duplicate=%d", "(STUBBED) savedata_high={:08X} savedata_low={:08X} total_size={:08X} block_size={:08X} "
savedata_high, savedata_low, total_size, block_size, directories, files, "directories={} files={} directory_buckets={} file_buckets={} duplicate={}",
directory_buckets, file_buckets, duplicate); savedata_high, savedata_low, total_size, block_size, directories, files, directory_buckets,
file_buckets, duplicate);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(Service::FS::CreateSystemSaveData(savedata_high, savedata_low)); rb.Push(Service::FS::CreateSystemSaveData(savedata_high, savedata_low));
@ -521,9 +523,9 @@ void FS_USER::CreateLegacySystemSaveData(Kernel::HLERequestContext& ctx) {
u32 file_buckets = rp.Pop<u32>(); u32 file_buckets = rp.Pop<u32>();
bool duplicate = rp.Pop<bool>(); bool duplicate = rp.Pop<bool>();
LOG_WARNING(Service_FS, NGLOG_WARNING(Service_FS,
"(STUBBED) savedata_id=%08X total_size=%08X block_size=%08X directories=%u " "(STUBBED) savedata_id={:08X} total_size={:08X} block_size={:08X} directories={} "
"files=%u directory_buckets=%u file_buckets=%u duplicate=%d", "files={} directory_buckets={} file_buckets={} duplicate={}",
savedata_id, total_size, block_size, directories, files, directory_buckets, savedata_id, total_size, block_size, directories, files, directory_buckets,
file_buckets, duplicate); file_buckets, duplicate);
@ -537,7 +539,7 @@ void FS_USER::InitializeWithSdkVersion(Kernel::HLERequestContext& ctx) {
const u32 version = rp.Pop<u32>(); const u32 version = rp.Pop<u32>();
rp.PopPID(); rp.PopPID();
LOG_WARNING(Service_FS, "(STUBBED) called, version: 0x%08X", version); NGLOG_WARNING(Service_FS, "(STUBBED) called, version: 0x{:08X}", version);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -551,28 +553,28 @@ void FS_USER::SetPriority(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
LOG_DEBUG(Service_FS, "called priority=0x%X", priority); NGLOG_DEBUG(Service_FS, "called priority=0x{:X}", priority);
} }
void FS_USER::GetPriority(Kernel::HLERequestContext& ctx) { void FS_USER::GetPriority(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x863, 0, 0); IPC::RequestParser rp(ctx, 0x863, 0, 0);
if (priority == -1) { if (priority == -1) {
LOG_INFO(Service_FS, "priority was not set, priority=0x%X", priority); NGLOG_INFO(Service_FS, "priority was not set, priority=0x{:X}", priority);
} }
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(priority); rb.Push(priority);
LOG_DEBUG(Service_FS, "called priority=0x%X", priority); NGLOG_DEBUG(Service_FS, "called priority=0x{:X}", priority);
} }
void FS_USER::GetArchiveResource(Kernel::HLERequestContext& ctx) { void FS_USER::GetArchiveResource(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x849, 1, 0); IPC::RequestParser rp(ctx, 0x849, 1, 0);
u32 system_media_type = rp.Pop<u32>(); u32 system_media_type = rp.Pop<u32>();
LOG_WARNING(Service_FS, "(STUBBED) called Media type=0x%08X", system_media_type); NGLOG_WARNING(Service_FS, "(STUBBED) called Media type=0x{:08X}", system_media_type);
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0); IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -592,14 +594,14 @@ void FS_USER::GetFormatInfo(Kernel::HLERequestContext& ctx) {
FileSys::Path archive_path(archivename_type, archivename); FileSys::Path archive_path(archivename_type, archivename);
LOG_DEBUG(Service_FS, "archive_path=%s", archive_path.DebugStr().c_str()); NGLOG_DEBUG(Service_FS, "archive_path={}", archive_path.DebugStr());
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0); IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
auto format_info = GetArchiveFormatInfo(archive_id, archive_path); auto format_info = GetArchiveFormatInfo(archive_id, archive_path);
rb.Push(format_info.Code()); rb.Push(format_info.Code());
if (format_info.Failed()) { if (format_info.Failed()) {
LOG_ERROR(Service_FS, "Failed to retrieve the format info"); NGLOG_ERROR(Service_FS, "Failed to retrieve the format info");
rb.Skip(4, true); rb.Skip(4, true);
return; return;
} }
@ -615,7 +617,7 @@ void FS_USER::GetProgramLaunchInfo(Kernel::HLERequestContext& ctx) {
u32 process_id = rp.Pop<u32>(); u32 process_id = rp.Pop<u32>();
LOG_DEBUG(Service_FS, "process_id=%u", process_id); NGLOG_DEBUG(Service_FS, "process_id={}", process_id);
// TODO(Subv): The real FS service manages its own process list and only checks the processes // TODO(Subv): The real FS service manages its own process list and only checks the processes
// that were registered with the 'fs:REG' service. // that were registered with the 'fs:REG' service.
@ -647,7 +649,7 @@ void FS_USER::GetProgramLaunchInfo(Kernel::HLERequestContext& ctx) {
void FS_USER::GetNumSeeds(Kernel::HLERequestContext& ctx) { void FS_USER::GetNumSeeds(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x87D, 0, 0); IPC::RequestParser rp(ctx, 0x87D, 0, 0);
LOG_WARNING(Service_FS, "(STUBBED) called"); NGLOG_WARNING(Service_FS, "(STUBBED) called");
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
@ -664,9 +666,9 @@ void FS_USER::SetSaveDataSecureValue(Kernel::HLERequestContext& ctx) {
// TODO: Generate and Save the Secure Value // TODO: Generate and Save the Secure Value
LOG_WARNING(Service_FS, NGLOG_WARNING(Service_FS,
"(STUBBED) called, value=0x%016" PRIx64 " secure_value_slot=0x%08X " "(STUBBED) called, value=0x{:016x} secure_value_slot=0x{:08X} "
"unqiue_id=0x%08X title_variation=0x%02X", "unqiue_id=0x{:08X} title_variation=0x{:02X}",
value, secure_value_slot, unique_id, title_variation); value, secure_value_slot, unique_id, title_variation);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
@ -681,8 +683,9 @@ void FS_USER::GetSaveDataSecureValue(Kernel::HLERequestContext& ctx) {
u32 unique_id = rp.Pop<u32>(); u32 unique_id = rp.Pop<u32>();
u8 title_variation = rp.Pop<u8>(); u8 title_variation = rp.Pop<u8>();
LOG_WARNING(Service_FS, NGLOG_WARNING(
"(STUBBED) called secure_value_slot=0x%08X unqiue_id=0x%08X title_variation=0x%02X", Service_FS,
"(STUBBED) called secure_value_slot=0x{:08X} unqiue_id=0x{:08X} title_variation=0x{:02X}",
secure_value_slot, unique_id, title_variation); secure_value_slot, unique_id, title_variation);
IPC::RequestBuilder rb = rp.MakeBuilder(4, 0); IPC::RequestBuilder rb = rp.MakeBuilder(4, 0);