summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2018-03-31 16:02:21 -0400
committerGravatar bunnei2018-03-31 16:06:45 -0400
commit88582b84a5851338618050e62bdd8b6a1753b5b7 (patch)
treec97bc552cb5d4c32a7e345882334acbf693f1cd2 /src
parentmemory: Fix stack region. (diff)
downloadyuzu-88582b84a5851338618050e62bdd8b6a1753b5b7.tar.gz
yuzu-88582b84a5851338618050e62bdd8b6a1753b5b7.tar.xz
yuzu-88582b84a5851338618050e62bdd8b6a1753b5b7.zip
fsp_srv: Implement GetSize and SetSize.
Diffstat (limited to 'src')
-rw-r--r--src/core/file_sys/disk_filesystem.cpp5
-rw-r--r--src/core/hle/service/filesystem/fsp_srv.cpp23
2 files changed, 24 insertions, 4 deletions
diff --git a/src/core/file_sys/disk_filesystem.cpp b/src/core/file_sys/disk_filesystem.cpp
index 3a4b45721..4235f3935 100644
--- a/src/core/file_sys/disk_filesystem.cpp
+++ b/src/core/file_sys/disk_filesystem.cpp
@@ -174,8 +174,9 @@ u64 Disk_Storage::GetSize() const {
174} 174}
175 175
176bool Disk_Storage::SetSize(const u64 size) const { 176bool Disk_Storage::SetSize(const u64 size) const {
177 LOG_WARNING(Service_FS, "(STUBBED) called"); 177 file->Resize(size);
178 return false; 178 file->Flush();
179 return true;
179} 180}
180 181
181Disk_Directory::Disk_Directory(const std::string& path) : directory() { 182Disk_Directory::Disk_Directory(const std::string& path) : directory() {
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp
index 41b8cbfd2..92b3d07b4 100644
--- a/src/core/hle/service/filesystem/fsp_srv.cpp
+++ b/src/core/hle/service/filesystem/fsp_srv.cpp
@@ -72,8 +72,8 @@ public:
72 explicit IFile(std::unique_ptr<FileSys::StorageBackend>&& backend) 72 explicit IFile(std::unique_ptr<FileSys::StorageBackend>&& backend)
73 : ServiceFramework("IFile"), backend(std::move(backend)) { 73 : ServiceFramework("IFile"), backend(std::move(backend)) {
74 static const FunctionInfo functions[] = { 74 static const FunctionInfo functions[] = {
75 {0, &IFile::Read, "Read"}, {1, &IFile::Write, "Write"}, {2, nullptr, "Flush"}, 75 {0, &IFile::Read, "Read"}, {1, &IFile::Write, "Write"}, {2, nullptr, "Flush"},
76 {3, nullptr, "SetSize"}, {4, nullptr, "GetSize"}, 76 {3, &IFile::SetSize, "SetSize"}, {4, &IFile::GetSize, "GetSize"},
77 }; 77 };
78 RegisterHandlers(functions); 78 RegisterHandlers(functions);
79 } 79 }
@@ -150,6 +150,25 @@ private:
150 IPC::ResponseBuilder rb{ctx, 2}; 150 IPC::ResponseBuilder rb{ctx, 2};
151 rb.Push(RESULT_SUCCESS); 151 rb.Push(RESULT_SUCCESS);
152 } 152 }
153
154 void SetSize(Kernel::HLERequestContext& ctx) {
155 IPC::RequestParser rp{ctx};
156 const u64 size = rp.Pop<u64>();
157 backend->SetSize(size);
158 LOG_DEBUG(Service_FS, "called, size=0x%ld, length=0x%ld", size);
159
160 IPC::ResponseBuilder rb{ctx, 2};
161 rb.Push(RESULT_SUCCESS);
162 }
163
164 void GetSize(Kernel::HLERequestContext& ctx) {
165 const u64 size = backend->GetSize();
166 LOG_DEBUG(Service_FS, "called, size=0x%ld", size);
167
168 IPC::ResponseBuilder rb{ctx, 4};
169 rb.Push(RESULT_SUCCESS);
170 rb.Push<u64>(size);
171 }
153}; 172};
154 173
155class IDirectory final : public ServiceFramework<IDirectory> { 174class IDirectory final : public ServiceFramework<IDirectory> {