diff options
| author | 2014-09-27 19:16:51 +0000 | |
|---|---|---|
| committer | 2014-10-06 19:58:37 +0200 | |
| commit | 23c2fbfc7a900ae3c9f8791a87c5ad672f5778fe (patch) | |
| tree | f5535cf4b4bde9054f0e1098eb1fd817b5ff1599 /src/core/file_sys | |
| parent | FileSys: Add forgotten docstrings. (diff) | |
| download | yuzu-23c2fbfc7a900ae3c9f8791a87c5ad672f5778fe.tar.gz yuzu-23c2fbfc7a900ae3c9f8791a87c5ad672f5778fe.tar.xz yuzu-23c2fbfc7a900ae3c9f8791a87c5ad672f5778fe.zip | |
FileSys/Kernel: Implement SetSize service call for File objects.
Diffstat (limited to 'src/core/file_sys')
| -rw-r--r-- | src/core/file_sys/file.h | 7 | ||||
| -rw-r--r-- | src/core/file_sys/file_romfs.cpp | 9 | ||||
| -rw-r--r-- | src/core/file_sys/file_romfs.h | 7 | ||||
| -rw-r--r-- | src/core/file_sys/file_sdmc.cpp | 11 | ||||
| -rw-r--r-- | src/core/file_sys/file_sdmc.h | 7 |
5 files changed, 41 insertions, 0 deletions
diff --git a/src/core/file_sys/file.h b/src/core/file_sys/file.h index 3749e4fcf..443e65319 100644 --- a/src/core/file_sys/file.h +++ b/src/core/file_sys/file.h | |||
| @@ -44,6 +44,13 @@ public: | |||
| 44 | virtual size_t GetSize() const = 0; | 44 | virtual size_t GetSize() const = 0; |
| 45 | 45 | ||
| 46 | /** | 46 | /** |
| 47 | * Set the size of the file in bytes | ||
| 48 | * @param size New size of the file | ||
| 49 | * @return true if successful | ||
| 50 | */ | ||
| 51 | virtual bool SetSize(const u64 size) const = 0; | ||
| 52 | |||
| 53 | /** | ||
| 47 | * Close the file | 54 | * Close the file |
| 48 | * @return true if the file closed correctly | 55 | * @return true if the file closed correctly |
| 49 | */ | 56 | */ |
diff --git a/src/core/file_sys/file_romfs.cpp b/src/core/file_sys/file_romfs.cpp index 0709e98f0..3ef616e08 100644 --- a/src/core/file_sys/file_romfs.cpp +++ b/src/core/file_sys/file_romfs.cpp | |||
| @@ -49,6 +49,15 @@ size_t File_RomFS::GetSize() const { | |||
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | /** | 51 | /** |
| 52 | * Set the size of the file in bytes | ||
| 53 | * @param size New size of the file | ||
| 54 | * @return true if successful | ||
| 55 | */ | ||
| 56 | bool File_RomFS::SetSize(const u64 size) const { | ||
| 57 | return false; | ||
| 58 | } | ||
| 59 | |||
| 60 | /** | ||
| 52 | * Close the file | 61 | * Close the file |
| 53 | * @return true if the file closed correctly | 62 | * @return true if the file closed correctly |
| 54 | */ | 63 | */ |
diff --git a/src/core/file_sys/file_romfs.h b/src/core/file_sys/file_romfs.h index 28b4f1158..06973eb93 100644 --- a/src/core/file_sys/file_romfs.h +++ b/src/core/file_sys/file_romfs.h | |||
| @@ -45,6 +45,13 @@ public: | |||
| 45 | size_t GetSize() const override; | 45 | size_t GetSize() const override; |
| 46 | 46 | ||
| 47 | /** | 47 | /** |
| 48 | * Set the size of the file in bytes | ||
| 49 | * @param size New size of the file | ||
| 50 | * @return true if successful | ||
| 51 | */ | ||
| 52 | bool SetSize(const u64 size) const override; | ||
| 53 | |||
| 54 | /** | ||
| 48 | * Close the file | 55 | * Close the file |
| 49 | * @return true if the file closed correctly | 56 | * @return true if the file closed correctly |
| 50 | */ | 57 | */ |
diff --git a/src/core/file_sys/file_sdmc.cpp b/src/core/file_sys/file_sdmc.cpp index 76e7f5d3d..3ef2b0c0e 100644 --- a/src/core/file_sys/file_sdmc.cpp +++ b/src/core/file_sys/file_sdmc.cpp | |||
| @@ -76,6 +76,17 @@ size_t File_SDMC::GetSize() const { | |||
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | /** | 78 | /** |
| 79 | * Set the size of the file in bytes | ||
| 80 | * @param size New size of the file | ||
| 81 | * @return true if successful | ||
| 82 | */ | ||
| 83 | bool File_SDMC::SetSize(const u64 size) const { | ||
| 84 | file->Resize(size); | ||
| 85 | file->Flush(); | ||
| 86 | return true; | ||
| 87 | } | ||
| 88 | |||
| 89 | /** | ||
| 79 | * Close the file | 90 | * Close the file |
| 80 | * @return true if the file closed correctly | 91 | * @return true if the file closed correctly |
| 81 | */ | 92 | */ |
diff --git a/src/core/file_sys/file_sdmc.h b/src/core/file_sys/file_sdmc.h index d23020494..6b3a1f3a5 100644 --- a/src/core/file_sys/file_sdmc.h +++ b/src/core/file_sys/file_sdmc.h | |||
| @@ -48,6 +48,13 @@ public: | |||
| 48 | size_t GetSize() const override; | 48 | size_t GetSize() const override; |
| 49 | 49 | ||
| 50 | /** | 50 | /** |
| 51 | * Set the size of the file in bytes | ||
| 52 | * @param size New size of the file | ||
| 53 | * @return true if successful | ||
| 54 | */ | ||
| 55 | bool SetSize(const u64 size) const override; | ||
| 56 | |||
| 57 | /** | ||
| 51 | * Close the file | 58 | * Close the file |
| 52 | * @return true if the file closed correctly | 59 | * @return true if the file closed correctly |
| 53 | */ | 60 | */ |