diff options
Diffstat (limited to 'src/core')
| -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 | ||||
| -rw-r--r-- | src/core/hle/kernel/archive.cpp | 8 |
6 files changed, 49 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 | */ |
diff --git a/src/core/hle/kernel/archive.cpp b/src/core/hle/kernel/archive.cpp index fa4972994..0a66ab29b 100644 --- a/src/core/hle/kernel/archive.cpp +++ b/src/core/hle/kernel/archive.cpp | |||
| @@ -181,6 +181,14 @@ public: | |||
| 181 | break; | 181 | break; |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | case FileCommand::SetSize: | ||
| 185 | { | ||
| 186 | u64 size = cmd_buff[1] | ((u64)cmd_buff[2] << 32); | ||
| 187 | DEBUG_LOG(KERNEL, "SetSize %s %s size=%d", GetTypeName().c_str(), GetName().c_str(), size); | ||
| 188 | backend->SetSize(size); | ||
| 189 | break; | ||
| 190 | } | ||
| 191 | |||
| 184 | case FileCommand::Close: | 192 | case FileCommand::Close: |
| 185 | { | 193 | { |
| 186 | DEBUG_LOG(KERNEL, "Close %s %s", GetTypeName().c_str(), GetName().c_str()); | 194 | DEBUG_LOG(KERNEL, "Close %s %s", GetTypeName().c_str(), GetName().c_str()); |