diff options
author | archshift <admin@archshift.com> | 2014-08-21 07:03:31 +0200 |
---|---|---|
committer | archshift <admin@archshift.com> | 2014-08-23 00:45:10 +0200 |
commit | 4c4a01bf413eab37394e76683790cebe08d57922 (patch) | |
tree | 850d82660ff575580012161f2c1c47403ef20365 /src/core/hle/kernel/archive.cpp | |
parent | Merge pull request #62 from archshift/revert-49-redundantloop (diff) | |
download | yuzu-4c4a01bf413eab37394e76683790cebe08d57922.tar yuzu-4c4a01bf413eab37394e76683790cebe08d57922.tar.gz yuzu-4c4a01bf413eab37394e76683790cebe08d57922.tar.bz2 yuzu-4c4a01bf413eab37394e76683790cebe08d57922.tar.lz yuzu-4c4a01bf413eab37394e76683790cebe08d57922.tar.xz yuzu-4c4a01bf413eab37394e76683790cebe08d57922.tar.zst yuzu-4c4a01bf413eab37394e76683790cebe08d57922.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/archive.cpp | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/src/core/hle/kernel/archive.cpp b/src/core/hle/kernel/archive.cpp index 5079fcb84..1596367c3 100644 --- a/src/core/hle/kernel/archive.cpp +++ b/src/core/hle/kernel/archive.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include "common/common_types.h" +#include "common/math_util.h" #include "core/file_sys/archive.h" #include "core/hle/service/service.h" @@ -48,23 +49,50 @@ public: Result SyncRequest(bool* wait) { u32* cmd_buff = Service::GetCommandBuffer(); FileCommand cmd = static_cast<FileCommand>(cmd_buff[0]); + switch (cmd) { - // Read from archive... case FileCommand::Read: { - u64 offset = cmd_buff[1] | ((u64) cmd_buff[2]) << 32; + u64 offset = cmd_buff[1] | ((u64)cmd_buff[2] << 32); u32 length = cmd_buff[3]; u32 address = cmd_buff[5]; + + // Number of bytes read cmd_buff[2] = backend->Read(offset, length, Memory::GetPointer(address)); break; } + // Write to archive... + case FileCommand::Write: + { + u64 offset = cmd_buff[1] | ((u64)cmd_buff[2] << 32); + u32 length = cmd_buff[3]; + u32 flush = cmd_buff[4]; + u32 address = cmd_buff[6]; + // Number of bytes written + cmd_buff[2] = backend->Write(offset, length, flush, Memory::GetPointer(address)); + break; + } + case FileCommand::GetSize: + { + u64 filesize = (u64) backend->GetSize(); + cmd_buff[2] = (u32) filesize; // Lower word + cmd_buff[3] = (u32) (filesize >> 32); // Upper word + break; + } + case FileCommand::SetSize: + { + backend->SetSize(cmd_buff[1] | ((u64)cmd_buff[2] << 32)); + break; + } // Unknown command... default: + { ERROR_LOG(KERNEL, "Unknown command=0x%08X!", cmd); return -1; } + } cmd_buff[1] = 0; // No error return 0; } @@ -140,7 +168,7 @@ Archive* CreateArchive(Handle& handle, FileSys::Archive* backend, const std::str */ Handle CreateArchive(FileSys::Archive* backend, const std::string& name) { Handle handle; - Archive* archive = CreateArchive(handle, backend, name); + CreateArchive(handle, backend, name); return handle; } |