diff options
author | archshift <admin@archshift.com> | 2014-12-20 16:43:50 +0100 |
---|---|---|
committer | archshift <admin@archshift.com> | 2014-12-21 06:21:49 +0100 |
commit | 0625dd09eaf9158696a9255cb6c6b2bd73122301 (patch) | |
tree | 752f0e9bd60403c1cbb0c3a1ba25f60c9a6925f2 /src/core/hle | |
parent | Merge pull request #317 from yuriks/make_unique (diff) | |
download | yuzu-0625dd09eaf9158696a9255cb6c6b2bd73122301.tar yuzu-0625dd09eaf9158696a9255cb6c6b2bd73122301.tar.gz yuzu-0625dd09eaf9158696a9255cb6c6b2bd73122301.tar.bz2 yuzu-0625dd09eaf9158696a9255cb6c6b2bd73122301.tar.lz yuzu-0625dd09eaf9158696a9255cb6c6b2bd73122301.tar.xz yuzu-0625dd09eaf9158696a9255cb6c6b2bd73122301.tar.zst yuzu-0625dd09eaf9158696a9255cb6c6b2bd73122301.zip |
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 ErrorSummary::Canceled, ErrorLevel::Status); } +ResultCode CreateFileInArchive(Handle archive_handle, const FileSys::Path& path, u32 file_size) { + Archive* archive = GetArchive(archive_handle); + if (archive == nullptr) + return InvalidHandle(ErrorModule::FS); + + return archive->backend->CreateFile(path, file_size); +} + ResultCode CreateDirectoryFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path) { Archive* archive = GetArchive(archive_handle); 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 ResultCode DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path); /** + * Create a File in an Archive + * @param archive_handle Handle to an open Archive object + * @param path Path to the File inside of the Archive + * @param file_size The size of the new file, filled with zeroes + * @return File creation result code + */ +ResultCode CreateFileInArchive(Handle archive_handle, const FileSys::Path& path, u32 file_size); + +/** * Create a Directory from an Archive * @param archive_handle Handle to an open Archive object * @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) { } /* + * FS_User::CreateFile service function + * Inputs: + * 0 : Command header 0x08080202 + * 2 : Archive handle lower word + * 3 : Archive handle upper word + * 4 : File path string type + * 5 : File path string size + * 7 : File size (filled with zeroes) + * 10: File path string data + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ +static void CreateFile(Service::Interface* self) { + u32* cmd_buff = Kernel::GetCommandBuffer(); + + ArchiveHandle archive_handle = MakeArchiveHandle(cmd_buff[2], cmd_buff[3]); + auto filename_type = static_cast<FileSys::LowPathType>(cmd_buff[4]); + u32 filename_size = cmd_buff[5]; + u32 file_size = cmd_buff[7]; + u32 filename_ptr = cmd_buff[10]; + + FileSys::Path file_path(filename_type, filename_size, filename_ptr); + + LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", filename_type, filename_size, file_path.DebugStr().c_str()); + + cmd_buff[1] = CreateFileInArchive(archive_handle, file_path, file_size).raw; +} + +/* * FS_User::CreateDirectory service function * Inputs: * 2 : Archive handle lower word @@ -465,7 +494,7 @@ const FSUserInterface::FunctionInfo FunctionTable[] = { {0x08050244, RenameFile, "RenameFile"}, {0x08060142, DeleteDirectory, "DeleteDirectory"}, {0x08070142, nullptr, "DeleteDirectoryRecursively"}, - {0x08080202, nullptr, "CreateFile"}, + {0x08080202, CreateFile, "CreateFile"}, {0x08090182, CreateDirectory, "CreateDirectory"}, {0x080A0244, RenameDirectory, "RenameDirectory"}, {0x080B0102, OpenDirectory, "OpenDirectory"}, |