diff options
| author | 2014-12-21 01:45:00 -0500 | |
|---|---|---|
| committer | 2014-12-21 01:45:00 -0500 | |
| commit | 572ce043c291f46f50d97f68f4df4f6f93e72035 (patch) | |
| tree | 79a59fa757424e053b029b6162937551a03d1e25 /src/core/hle | |
| parent | Merge pull request #323 from lioncash/saddsub (diff) | |
| parent | Added CreateFile to the FS_USER service (diff) | |
| download | yuzu-572ce043c291f46f50d97f68f4df4f6f93e72035.tar.gz yuzu-572ce043c291f46f50d97f68f4df4f6f93e72035.tar.xz yuzu-572ce043c291f46f50d97f68f4df4f6f93e72035.zip | |
Merge pull request #271 from archshift/createf
Added CreateFile to the FS_USER service
Diffstat (limited to 'src/core/hle')
| -rw-r--r-- | src/core/hle/service/fs/archive.cpp | 8 | ||||
| -rw-r--r-- | src/core/hle/service/fs/archive.h | 9 | ||||
| -rw-r--r-- | src/core/hle/service/fs/fs_user.cpp | 31 |
3 files changed, 47 insertions, 1 deletions
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index 510d7320c..b7f97495c 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp | |||
| @@ -330,6 +330,14 @@ ResultCode DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSy | |||
| 330 | ErrorSummary::Canceled, ErrorLevel::Status); | 330 | ErrorSummary::Canceled, ErrorLevel::Status); |
| 331 | } | 331 | } |
| 332 | 332 | ||
| 333 | ResultCode CreateFileInArchive(Handle archive_handle, const FileSys::Path& path, u32 file_size) { | ||
| 334 | Archive* archive = GetArchive(archive_handle); | ||
| 335 | if (archive == nullptr) | ||
| 336 | return InvalidHandle(ErrorModule::FS); | ||
| 337 | |||
| 338 | return archive->backend->CreateFile(path, file_size); | ||
| 339 | } | ||
| 340 | |||
| 333 | ResultCode CreateDirectoryFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path) { | 341 | ResultCode CreateDirectoryFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path) { |
| 334 | Archive* archive = GetArchive(archive_handle); | 342 | Archive* archive = GetArchive(archive_handle); |
| 335 | if (archive == nullptr) | 343 | if (archive == nullptr) |
diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h index a128276b6..0fd3aaa0c 100644 --- a/src/core/hle/service/fs/archive.h +++ b/src/core/hle/service/fs/archive.h | |||
| @@ -83,6 +83,15 @@ ResultCode RenameFileBetweenArchives(ArchiveHandle src_archive_handle, const Fil | |||
| 83 | ResultCode DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path); | 83 | ResultCode DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path); |
| 84 | 84 | ||
| 85 | /** | 85 | /** |
| 86 | * Create a File in an Archive | ||
| 87 | * @param archive_handle Handle to an open Archive object | ||
| 88 | * @param path Path to the File inside of the Archive | ||
| 89 | * @param file_size The size of the new file, filled with zeroes | ||
| 90 | * @return File creation result code | ||
| 91 | */ | ||
| 92 | ResultCode CreateFileInArchive(Handle archive_handle, const FileSys::Path& path, u32 file_size); | ||
| 93 | |||
| 94 | /** | ||
| 86 | * Create a Directory from an Archive | 95 | * Create a Directory from an Archive |
| 87 | * @param archive_handle Handle to an open Archive object | 96 | * @param archive_handle Handle to an open Archive object |
| 88 | * @param path Path to the Directory inside of the Archive | 97 | * @param path Path to the Directory inside of the Archive |
diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp index 8b908d691..1402abe83 100644 --- a/src/core/hle/service/fs/fs_user.cpp +++ b/src/core/hle/service/fs/fs_user.cpp | |||
| @@ -226,6 +226,35 @@ static void DeleteDirectory(Service::Interface* self) { | |||
| 226 | } | 226 | } |
| 227 | 227 | ||
| 228 | /* | 228 | /* |
| 229 | * FS_User::CreateFile service function | ||
| 230 | * Inputs: | ||
| 231 | * 0 : Command header 0x08080202 | ||
| 232 | * 2 : Archive handle lower word | ||
| 233 | * 3 : Archive handle upper word | ||
| 234 | * 4 : File path string type | ||
| 235 | * 5 : File path string size | ||
| 236 | * 7 : File size (filled with zeroes) | ||
| 237 | * 10: File path string data | ||
| 238 | * Outputs: | ||
| 239 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 240 | */ | ||
| 241 | static void CreateFile(Service::Interface* self) { | ||
| 242 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 243 | |||
| 244 | ArchiveHandle archive_handle = MakeArchiveHandle(cmd_buff[2], cmd_buff[3]); | ||
| 245 | auto filename_type = static_cast<FileSys::LowPathType>(cmd_buff[4]); | ||
| 246 | u32 filename_size = cmd_buff[5]; | ||
| 247 | u32 file_size = cmd_buff[7]; | ||
| 248 | u32 filename_ptr = cmd_buff[10]; | ||
| 249 | |||
| 250 | FileSys::Path file_path(filename_type, filename_size, filename_ptr); | ||
| 251 | |||
| 252 | LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", filename_type, filename_size, file_path.DebugStr().c_str()); | ||
| 253 | |||
| 254 | cmd_buff[1] = CreateFileInArchive(archive_handle, file_path, file_size).raw; | ||
| 255 | } | ||
| 256 | |||
| 257 | /* | ||
| 229 | * FS_User::CreateDirectory service function | 258 | * FS_User::CreateDirectory service function |
| 230 | * Inputs: | 259 | * Inputs: |
| 231 | * 2 : Archive handle lower word | 260 | * 2 : Archive handle lower word |
| @@ -465,7 +494,7 @@ const FSUserInterface::FunctionInfo FunctionTable[] = { | |||
| 465 | {0x08050244, RenameFile, "RenameFile"}, | 494 | {0x08050244, RenameFile, "RenameFile"}, |
| 466 | {0x08060142, DeleteDirectory, "DeleteDirectory"}, | 495 | {0x08060142, DeleteDirectory, "DeleteDirectory"}, |
| 467 | {0x08070142, nullptr, "DeleteDirectoryRecursively"}, | 496 | {0x08070142, nullptr, "DeleteDirectoryRecursively"}, |
| 468 | {0x08080202, nullptr, "CreateFile"}, | 497 | {0x08080202, CreateFile, "CreateFile"}, |
| 469 | {0x08090182, CreateDirectory, "CreateDirectory"}, | 498 | {0x08090182, CreateDirectory, "CreateDirectory"}, |
| 470 | {0x080A0244, RenameDirectory, "RenameDirectory"}, | 499 | {0x080A0244, RenameDirectory, "RenameDirectory"}, |
| 471 | {0x080B0102, OpenDirectory, "OpenDirectory"}, | 500 | {0x080B0102, OpenDirectory, "OpenDirectory"}, |