mirror of
https://git.h3cjp.net/H3cJP/yuzu.git
synced 2024-11-14 12:32:52 +00:00
fsp_srv: Implement GetSize and SetSize.
This commit is contained in:
parent
b27ab46bde
commit
88582b84a5
|
@ -174,8 +174,9 @@ u64 Disk_Storage::GetSize() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Disk_Storage::SetSize(const u64 size) const {
|
bool Disk_Storage::SetSize(const u64 size) const {
|
||||||
LOG_WARNING(Service_FS, "(STUBBED) called");
|
file->Resize(size);
|
||||||
return false;
|
file->Flush();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Disk_Directory::Disk_Directory(const std::string& path) : directory() {
|
Disk_Directory::Disk_Directory(const std::string& path) : directory() {
|
||||||
|
|
|
@ -72,8 +72,8 @@ public:
|
||||||
explicit IFile(std::unique_ptr<FileSys::StorageBackend>&& backend)
|
explicit IFile(std::unique_ptr<FileSys::StorageBackend>&& backend)
|
||||||
: ServiceFramework("IFile"), backend(std::move(backend)) {
|
: ServiceFramework("IFile"), backend(std::move(backend)) {
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &IFile::Read, "Read"}, {1, &IFile::Write, "Write"}, {2, nullptr, "Flush"},
|
{0, &IFile::Read, "Read"}, {1, &IFile::Write, "Write"}, {2, nullptr, "Flush"},
|
||||||
{3, nullptr, "SetSize"}, {4, nullptr, "GetSize"},
|
{3, &IFile::SetSize, "SetSize"}, {4, &IFile::GetSize, "GetSize"},
|
||||||
};
|
};
|
||||||
RegisterHandlers(functions);
|
RegisterHandlers(functions);
|
||||||
}
|
}
|
||||||
|
@ -150,6 +150,25 @@ private:
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetSize(Kernel::HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
const u64 size = rp.Pop<u64>();
|
||||||
|
backend->SetSize(size);
|
||||||
|
LOG_DEBUG(Service_FS, "called, size=0x%ld, length=0x%ld", size);
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetSize(Kernel::HLERequestContext& ctx) {
|
||||||
|
const u64 size = backend->GetSize();
|
||||||
|
LOG_DEBUG(Service_FS, "called, size=0x%ld", size);
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 4};
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
rb.Push<u64>(size);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class IDirectory final : public ServiceFramework<IDirectory> {
|
class IDirectory final : public ServiceFramework<IDirectory> {
|
||||||
|
|
Loading…
Reference in a new issue