summaryrefslogtreecommitdiff
path: root/src/core/hle
diff options
context:
space:
mode:
authorGravatar bunnei2021-09-15 20:13:26 -0700
committerGravatar GitHub2021-09-15 20:13:26 -0700
commitf6d5444293d263c1a9afc0416e24a8b9262b519f (patch)
tree5bd81eb2caf3b094382bcc34388ac73af1165aa5 /src/core/hle
parentMerge pull request #7014 from Morph1984/log-pipeline-count (diff)
parentvfs: Partially implement GetFileTimeStampRaw (diff)
downloadyuzu-f6d5444293d263c1a9afc0416e24a8b9262b519f.tar.gz
yuzu-f6d5444293d263c1a9afc0416e24a8b9262b519f.tar.xz
yuzu-f6d5444293d263c1a9afc0416e24a8b9262b519f.zip
Merge pull request #7010 from Morph1984/fs-timestamp
vfs: Partially implement GetFileTimeStampRaw
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/service/filesystem/filesystem.cpp12
-rw-r--r--src/core/hle/service/filesystem/filesystem.h6
-rw-r--r--src/core/hle/service/filesystem/fsp_srv.cpp20
3 files changed, 37 insertions, 1 deletions
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp
index c8d65f328..f8f9e32f7 100644
--- a/src/core/hle/service/filesystem/filesystem.cpp
+++ b/src/core/hle/service/filesystem/filesystem.cpp
@@ -261,6 +261,18 @@ ResultVal<FileSys::EntryType> VfsDirectoryServiceWrapper::GetEntryType(
261 return FileSys::ERROR_PATH_NOT_FOUND; 261 return FileSys::ERROR_PATH_NOT_FOUND;
262} 262}
263 263
264ResultVal<FileSys::FileTimeStampRaw> VfsDirectoryServiceWrapper::GetFileTimeStampRaw(
265 const std::string& path) const {
266 auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path));
267 if (dir == nullptr) {
268 return FileSys::ERROR_PATH_NOT_FOUND;
269 }
270 if (GetEntryType(path).Failed()) {
271 return FileSys::ERROR_PATH_NOT_FOUND;
272 }
273 return MakeResult(dir->GetFileTimeStamp(Common::FS::GetFilename(path)));
274}
275
264FileSystemController::FileSystemController(Core::System& system_) : system{system_} {} 276FileSystemController::FileSystemController(Core::System& system_) : system{system_} {}
265 277
266FileSystemController::~FileSystemController() = default; 278FileSystemController::~FileSystemController() = default;
diff --git a/src/core/hle/service/filesystem/filesystem.h b/src/core/hle/service/filesystem/filesystem.h
index d387af3cb..b155e0811 100644
--- a/src/core/hle/service/filesystem/filesystem.h
+++ b/src/core/hle/service/filesystem/filesystem.h
@@ -240,6 +240,12 @@ public:
240 */ 240 */
241 ResultVal<FileSys::EntryType> GetEntryType(const std::string& path) const; 241 ResultVal<FileSys::EntryType> GetEntryType(const std::string& path) const;
242 242
243 /**
244 * Get the timestamp of the specified path
245 * @return The timestamp of the specified path or error code
246 */
247 ResultVal<FileSys::FileTimeStampRaw> GetFileTimeStampRaw(const std::string& path) const;
248
243private: 249private:
244 FileSys::VirtualDir backing; 250 FileSys::VirtualDir backing;
245}; 251};
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp
index db4d44c12..50c788dd6 100644
--- a/src/core/hle/service/filesystem/fsp_srv.cpp
+++ b/src/core/hle/service/filesystem/fsp_srv.cpp
@@ -326,7 +326,7 @@ public:
326 {11, &IFileSystem::GetFreeSpaceSize, "GetFreeSpaceSize"}, 326 {11, &IFileSystem::GetFreeSpaceSize, "GetFreeSpaceSize"},
327 {12, &IFileSystem::GetTotalSpaceSize, "GetTotalSpaceSize"}, 327 {12, &IFileSystem::GetTotalSpaceSize, "GetTotalSpaceSize"},
328 {13, &IFileSystem::CleanDirectoryRecursively, "CleanDirectoryRecursively"}, 328 {13, &IFileSystem::CleanDirectoryRecursively, "CleanDirectoryRecursively"},
329 {14, nullptr, "GetFileTimeStampRaw"}, 329 {14, &IFileSystem::GetFileTimeStampRaw, "GetFileTimeStampRaw"},
330 {15, nullptr, "QueryEntry"}, 330 {15, nullptr, "QueryEntry"},
331 }; 331 };
332 RegisterHandlers(functions); 332 RegisterHandlers(functions);
@@ -501,6 +501,24 @@ public:
501 rb.Push(size.get_total_size()); 501 rb.Push(size.get_total_size());
502 } 502 }
503 503
504 void GetFileTimeStampRaw(Kernel::HLERequestContext& ctx) {
505 const auto file_buffer = ctx.ReadBuffer();
506 const std::string name = Common::StringFromBuffer(file_buffer);
507
508 LOG_WARNING(Service_FS, "(Partial Implementation) called. file={}", name);
509
510 auto result = backend.GetFileTimeStampRaw(name);
511 if (result.Failed()) {
512 IPC::ResponseBuilder rb{ctx, 2};
513 rb.Push(result.Code());
514 return;
515 }
516
517 IPC::ResponseBuilder rb{ctx, 10};
518 rb.Push(ResultSuccess);
519 rb.PushRaw(*result);
520 }
521
504private: 522private:
505 VfsDirectoryServiceWrapper backend; 523 VfsDirectoryServiceWrapper backend;
506 SizeGetter size; 524 SizeGetter size;