|
|
|
@ -35,7 +35,7 @@ private:
|
|
|
|
|
const s64 offset = rp.Pop<s64>();
|
|
|
|
|
const s64 length = rp.Pop<s64>();
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_FS, "called, offset=0x%ld, length=0x%ld", offset, length);
|
|
|
|
|
NGLOG_DEBUG(Service_FS, "called, offset={:#X}, length={}", offset, length);
|
|
|
|
|
|
|
|
|
|
// Error checking
|
|
|
|
|
if (length < 0) {
|
|
|
|
@ -87,7 +87,7 @@ private:
|
|
|
|
|
const s64 offset = rp.Pop<s64>();
|
|
|
|
|
const s64 length = rp.Pop<s64>();
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_FS, "called, offset=0x%ld, length=0x%ld", offset, length);
|
|
|
|
|
NGLOG_DEBUG(Service_FS, "called, offset={:#X}, length={}", offset, length);
|
|
|
|
|
|
|
|
|
|
// Error checking
|
|
|
|
|
if (length < 0) {
|
|
|
|
@ -124,7 +124,7 @@ private:
|
|
|
|
|
const s64 offset = rp.Pop<s64>();
|
|
|
|
|
const s64 length = rp.Pop<s64>();
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_FS, "called, offset=0x%ld, length=0x%ld", offset, length);
|
|
|
|
|
NGLOG_DEBUG(Service_FS, "called, offset={:#X}, length={}", offset, length);
|
|
|
|
|
|
|
|
|
|
// Error checking
|
|
|
|
|
if (length < 0) {
|
|
|
|
@ -152,7 +152,7 @@ private:
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Flush(Kernel::HLERequestContext& ctx) {
|
|
|
|
|
LOG_DEBUG(Service_FS, "called");
|
|
|
|
|
NGLOG_DEBUG(Service_FS, "called");
|
|
|
|
|
backend->Flush();
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
@ -163,7 +163,7 @@ private:
|
|
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
|
const u64 size = rp.Pop<u64>();
|
|
|
|
|
backend->SetSize(size);
|
|
|
|
|
LOG_DEBUG(Service_FS, "called, size=%" PRIu64, size);
|
|
|
|
|
NGLOG_DEBUG(Service_FS, "called, size={}", size);
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
@ -171,7 +171,7 @@ private:
|
|
|
|
|
|
|
|
|
|
void GetSize(Kernel::HLERequestContext& ctx) {
|
|
|
|
|
const u64 size = backend->GetSize();
|
|
|
|
|
LOG_DEBUG(Service_FS, "called, size=%" PRIu64, size);
|
|
|
|
|
NGLOG_DEBUG(Service_FS, "called, size={}", size);
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 4};
|
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
@ -197,7 +197,7 @@ private:
|
|
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
|
const u64 unk = rp.Pop<u64>();
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_FS, "called, unk=0x%llx", unk);
|
|
|
|
|
NGLOG_DEBUG(Service_FS, "called, unk={:#X}", unk);
|
|
|
|
|
|
|
|
|
|
// Calculate how many entries we can fit in the output buffer
|
|
|
|
|
u64 count_entries = ctx.GetWriteBufferSize() / sizeof(FileSys::Entry);
|
|
|
|
@ -219,7 +219,7 @@ private:
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GetEntryCount(Kernel::HLERequestContext& ctx) {
|
|
|
|
|
LOG_DEBUG(Service_FS, "called");
|
|
|
|
|
NGLOG_DEBUG(Service_FS, "called");
|
|
|
|
|
|
|
|
|
|
u64 count = backend->GetEntryCount();
|
|
|
|
|
|
|
|
|
@ -265,8 +265,7 @@ public:
|
|
|
|
|
u64 mode = rp.Pop<u64>();
|
|
|
|
|
u32 size = rp.Pop<u32>();
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_FS, "called file %s mode 0x%" PRIX64 " size 0x%08X", name.c_str(), mode,
|
|
|
|
|
size);
|
|
|
|
|
NGLOG_DEBUG(Service_FS, "called file {} mode {:#X} size {:#010X}", name, mode, size);
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
|
rb.Push(backend->CreateFile(name, size));
|
|
|
|
@ -280,7 +279,7 @@ public:
|
|
|
|
|
|
|
|
|
|
std::string name(file_buffer.begin(), end);
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_FS, "called file %s", name.c_str());
|
|
|
|
|
NGLOG_DEBUG(Service_FS, "called file {}", name);
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
|
rb.Push(backend->DeleteFile(name));
|
|
|
|
@ -294,7 +293,7 @@ public:
|
|
|
|
|
|
|
|
|
|
std::string name(file_buffer.begin(), end);
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_FS, "called directory %s", name.c_str());
|
|
|
|
|
NGLOG_DEBUG(Service_FS, "called directory {}", name);
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
|
rb.Push(backend->CreateDirectory(name));
|
|
|
|
@ -314,7 +313,7 @@ public:
|
|
|
|
|
end = std::find(buffer.begin(), buffer.end(), '\0');
|
|
|
|
|
std::string dst_name(buffer.begin(), end);
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_FS, "called file '%s' to file '%s'", src_name.c_str(), dst_name.c_str());
|
|
|
|
|
NGLOG_DEBUG(Service_FS, "called file '{}' to file '{}'", src_name, dst_name);
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
|
rb.Push(backend->RenameFile(src_name, dst_name));
|
|
|
|
@ -330,7 +329,7 @@ public:
|
|
|
|
|
|
|
|
|
|
auto mode = static_cast<FileSys::Mode>(rp.Pop<u32>());
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_FS, "called file %s mode %u", name.c_str(), static_cast<u32>(mode));
|
|
|
|
|
NGLOG_DEBUG(Service_FS, "called file {} mode {}", name, static_cast<u32>(mode));
|
|
|
|
|
|
|
|
|
|
auto result = backend->OpenFile(name, mode);
|
|
|
|
|
if (result.Failed()) {
|
|
|
|
@ -357,7 +356,7 @@ public:
|
|
|
|
|
// TODO(Subv): Implement this filter.
|
|
|
|
|
u32 filter_flags = rp.Pop<u32>();
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_FS, "called directory %s filter %u", name.c_str(), filter_flags);
|
|
|
|
|
NGLOG_DEBUG(Service_FS, "called directory {} filter {}", name, filter_flags);
|
|
|
|
|
|
|
|
|
|
auto result = backend->OpenDirectory(name);
|
|
|
|
|
if (result.Failed()) {
|
|
|
|
@ -381,7 +380,7 @@ public:
|
|
|
|
|
|
|
|
|
|
std::string name(file_buffer.begin(), end);
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_FS, "called file %s", name.c_str());
|
|
|
|
|
NGLOG_DEBUG(Service_FS, "called file {}", name);
|
|
|
|
|
|
|
|
|
|
auto result = backend->GetEntryType(name);
|
|
|
|
|
if (result.Failed()) {
|
|
|
|
@ -396,7 +395,7 @@ public:
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Commit(Kernel::HLERequestContext& ctx) {
|
|
|
|
|
LOG_WARNING(Service_FS, "(STUBBED) called");
|
|
|
|
|
NGLOG_WARNING(Service_FS, "(STUBBED) called");
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
@ -512,14 +511,14 @@ void FSP_SRV::TryLoadRomFS() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FSP_SRV::Initialize(Kernel::HLERequestContext& ctx) {
|
|
|
|
|
LOG_WARNING(Service_FS, "(STUBBED) called");
|
|
|
|
|
NGLOG_WARNING(Service_FS, "(STUBBED) called");
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FSP_SRV::MountSdCard(Kernel::HLERequestContext& ctx) {
|
|
|
|
|
LOG_DEBUG(Service_FS, "called");
|
|
|
|
|
NGLOG_DEBUG(Service_FS, "called");
|
|
|
|
|
|
|
|
|
|
FileSys::Path unused;
|
|
|
|
|
auto filesystem = OpenFileSystem(Type::SDMC, unused).Unwrap();
|
|
|
|
@ -536,14 +535,14 @@ void FSP_SRV::CreateSaveData(Kernel::HLERequestContext& ctx) {
|
|
|
|
|
auto save_create_struct = rp.PopRaw<std::array<u8, 0x40>>();
|
|
|
|
|
u128 uid = rp.PopRaw<u128>();
|
|
|
|
|
|
|
|
|
|
LOG_WARNING(Service_FS, "(STUBBED) called uid = %016" PRIX64 "%016" PRIX64, uid[1], uid[0]);
|
|
|
|
|
NGLOG_WARNING(Service_FS, "(STUBBED) called uid = {:016X}{:016X}", uid[1], uid[0]);
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FSP_SRV::MountSaveData(Kernel::HLERequestContext& ctx) {
|
|
|
|
|
LOG_WARNING(Service_FS, "(STUBBED) called");
|
|
|
|
|
NGLOG_WARNING(Service_FS, "(STUBBED) called");
|
|
|
|
|
|
|
|
|
|
FileSys::Path unused;
|
|
|
|
|
auto filesystem = OpenFileSystem(Type::SaveData, unused).Unwrap();
|
|
|
|
@ -554,7 +553,7 @@ void FSP_SRV::MountSaveData(Kernel::HLERequestContext& ctx) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FSP_SRV::GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) {
|
|
|
|
|
LOG_WARNING(Service_FS, "(STUBBED) called");
|
|
|
|
|
NGLOG_WARNING(Service_FS, "(STUBBED) called");
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 3};
|
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
@ -562,12 +561,12 @@ void FSP_SRV::GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
|
|
|
|
|
LOG_DEBUG(Service_FS, "called");
|
|
|
|
|
NGLOG_DEBUG(Service_FS, "called");
|
|
|
|
|
|
|
|
|
|
TryLoadRomFS();
|
|
|
|
|
if (!romfs) {
|
|
|
|
|
// TODO (bunnei): Find the right error code to use here
|
|
|
|
|
LOG_CRITICAL(Service_FS, "no file system interface available!");
|
|
|
|
|
NGLOG_CRITICAL(Service_FS, "no file system interface available!");
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
|
rb.Push(ResultCode(-1));
|
|
|
|
|
return;
|
|
|
|
@ -576,7 +575,7 @@ void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
|
|
|
|
|
// Attempt to open a StorageBackend interface to the RomFS
|
|
|
|
|
auto storage = romfs->OpenFile({}, {});
|
|
|
|
|
if (storage.Failed()) {
|
|
|
|
|
LOG_CRITICAL(Service_FS, "no storage interface available!");
|
|
|
|
|
NGLOG_CRITICAL(Service_FS, "no storage interface available!");
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
|
rb.Push(storage.Code());
|
|
|
|
|
return;
|
|
|
|
@ -588,7 +587,7 @@ void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FSP_SRV::OpenRomStorage(Kernel::HLERequestContext& ctx) {
|
|
|
|
|
LOG_WARNING(Service_FS, "(STUBBED) called, using OpenDataStorageByCurrentProcess");
|
|
|
|
|
NGLOG_WARNING(Service_FS, "(STUBBED) called, using OpenDataStorageByCurrentProcess");
|
|
|
|
|
OpenDataStorageByCurrentProcess(ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|