mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-29 14:57:41 -05:00
HLE/FS: FS::CreateFile takes an u64 for the file size.
This commit is contained in:
parent
784c5539ea
commit
381a5c053f
8 changed files with 10 additions and 10 deletions
|
@ -108,7 +108,7 @@ public:
|
||||||
* @param size The size of the new file, filled with zeroes
|
* @param size The size of the new file, filled with zeroes
|
||||||
* @return File creation result code
|
* @return File creation result code
|
||||||
*/
|
*/
|
||||||
virtual ResultCode CreateFile(const Path& path, u32 size) const = 0;
|
virtual ResultCode CreateFile(const Path& path, u64 size) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a directory specified by its path
|
* Create a directory specified by its path
|
||||||
|
|
|
@ -37,7 +37,7 @@ bool DiskArchive::DeleteDirectory(const Path& path) const {
|
||||||
return FileUtil::DeleteDir(mount_point + path.AsString());
|
return FileUtil::DeleteDir(mount_point + path.AsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode DiskArchive::CreateFile(const FileSys::Path& path, u32 size) const {
|
ResultCode DiskArchive::CreateFile(const FileSys::Path& path, u64 size) const {
|
||||||
std::string full_path = mount_point + path.AsString();
|
std::string full_path = mount_point + path.AsString();
|
||||||
|
|
||||||
if (FileUtil::Exists(full_path))
|
if (FileUtil::Exists(full_path))
|
||||||
|
|
|
@ -37,7 +37,7 @@ public:
|
||||||
bool DeleteFile(const Path& path) const override;
|
bool DeleteFile(const Path& path) const override;
|
||||||
bool RenameFile(const Path& src_path, const Path& dest_path) const override;
|
bool RenameFile(const Path& src_path, const Path& dest_path) const override;
|
||||||
bool DeleteDirectory(const Path& path) const override;
|
bool DeleteDirectory(const Path& path) const override;
|
||||||
ResultCode CreateFile(const Path& path, u32 size) const override;
|
ResultCode CreateFile(const Path& path, u64 size) const override;
|
||||||
bool CreateDirectory(const Path& path) const override;
|
bool CreateDirectory(const Path& path) const override;
|
||||||
bool RenameDirectory(const Path& src_path, const Path& dest_path) const override;
|
bool RenameDirectory(const Path& src_path, const Path& dest_path) const override;
|
||||||
std::unique_ptr<DirectoryBackend> OpenDirectory(const Path& path) const override;
|
std::unique_ptr<DirectoryBackend> OpenDirectory(const Path& path) const override;
|
||||||
|
|
|
@ -39,7 +39,7 @@ bool IVFCArchive::DeleteDirectory(const Path& path) const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode IVFCArchive::CreateFile(const Path& path, u32 size) const {
|
ResultCode IVFCArchive::CreateFile(const Path& path, u64 size) const {
|
||||||
LOG_CRITICAL(Service_FS, "Attempted to create a file in an IVFC archive (%s).", GetName().c_str());
|
LOG_CRITICAL(Service_FS, "Attempted to create a file in an IVFC archive (%s).", GetName().c_str());
|
||||||
// TODO: Verify error code
|
// TODO: Verify error code
|
||||||
return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported, ErrorLevel::Permanent);
|
return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported, ErrorLevel::Permanent);
|
||||||
|
|
|
@ -38,7 +38,7 @@ public:
|
||||||
bool DeleteFile(const Path& path) const override;
|
bool DeleteFile(const Path& path) const override;
|
||||||
bool RenameFile(const Path& src_path, const Path& dest_path) const override;
|
bool RenameFile(const Path& src_path, const Path& dest_path) const override;
|
||||||
bool DeleteDirectory(const Path& path) const override;
|
bool DeleteDirectory(const Path& path) const override;
|
||||||
ResultCode CreateFile(const Path& path, u32 size) const override;
|
ResultCode CreateFile(const Path& path, u64 size) const override;
|
||||||
bool CreateDirectory(const Path& path) const override;
|
bool CreateDirectory(const Path& path) const override;
|
||||||
bool RenameDirectory(const Path& src_path, const Path& dest_path) const override;
|
bool RenameDirectory(const Path& src_path, const Path& dest_path) const override;
|
||||||
std::unique_ptr<DirectoryBackend> OpenDirectory(const Path& path) const override;
|
std::unique_ptr<DirectoryBackend> OpenDirectory(const Path& path) const override;
|
||||||
|
|
|
@ -347,7 +347,7 @@ ResultCode DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSy
|
||||||
ErrorSummary::Canceled, ErrorLevel::Status);
|
ErrorSummary::Canceled, ErrorLevel::Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode CreateFileInArchive(ArchiveHandle archive_handle, const FileSys::Path& path, u32 file_size) {
|
ResultCode CreateFileInArchive(ArchiveHandle archive_handle, const FileSys::Path& path, u64 file_size) {
|
||||||
ArchiveBackend* archive = GetArchive(archive_handle);
|
ArchiveBackend* archive = GetArchive(archive_handle);
|
||||||
if (archive == nullptr)
|
if (archive == nullptr)
|
||||||
return ERR_INVALID_HANDLE;
|
return ERR_INVALID_HANDLE;
|
||||||
|
|
|
@ -136,7 +136,7 @@ ResultCode DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSy
|
||||||
* @param file_size The size of the new file, filled with zeroes
|
* @param file_size The size of the new file, filled with zeroes
|
||||||
* @return File creation result code
|
* @return File creation result code
|
||||||
*/
|
*/
|
||||||
ResultCode CreateFileInArchive(ArchiveHandle archive_handle, const FileSys::Path& path, u32 file_size);
|
ResultCode CreateFileInArchive(ArchiveHandle archive_handle, const FileSys::Path& path, u64 file_size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Directory from an Archive
|
* Create a Directory from an Archive
|
||||||
|
|
|
@ -234,7 +234,7 @@ static void DeleteDirectory(Service::Interface* self) {
|
||||||
* 3 : Archive handle upper word
|
* 3 : Archive handle upper word
|
||||||
* 4 : File path string type
|
* 4 : File path string type
|
||||||
* 5 : File path string size
|
* 5 : File path string size
|
||||||
* 7 : File size (filled with zeroes)
|
* 7-8 : File size
|
||||||
* 10: File path string data
|
* 10: File path string data
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
|
@ -245,12 +245,12 @@ static void CreateFile(Service::Interface* self) {
|
||||||
ArchiveHandle archive_handle = MakeArchiveHandle(cmd_buff[2], cmd_buff[3]);
|
ArchiveHandle archive_handle = MakeArchiveHandle(cmd_buff[2], cmd_buff[3]);
|
||||||
auto filename_type = static_cast<FileSys::LowPathType>(cmd_buff[4]);
|
auto filename_type = static_cast<FileSys::LowPathType>(cmd_buff[4]);
|
||||||
u32 filename_size = cmd_buff[5];
|
u32 filename_size = cmd_buff[5];
|
||||||
u32 file_size = cmd_buff[7];
|
u64 file_size = ((u64)cmd_buff[8] << 32) | cmd_buff[7];
|
||||||
u32 filename_ptr = cmd_buff[10];
|
u32 filename_ptr = cmd_buff[10];
|
||||||
|
|
||||||
FileSys::Path file_path(filename_type, filename_size, filename_ptr);
|
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());
|
LOG_DEBUG(Service_FS, "type=%d size=%lld data=%s", filename_type, filename_size, file_path.DebugStr().c_str());
|
||||||
|
|
||||||
cmd_buff[1] = CreateFileInArchive(archive_handle, file_path, file_size).raw;
|
cmd_buff[1] = CreateFileInArchive(archive_handle, file_path, file_size).raw;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue