aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/hle
diff options
context:
space:
mode:
authorGravatar archshift <admin@archshift.com>2014-08-20 22:03:31 -0700
committerGravatar archshift <admin@archshift.com>2014-08-22 15:45:10 -0700
commit4c4a01bf413eab37394e76683790cebe08d57922 (patch)
tree850d82660ff575580012161f2c1c47403ef20365 /src/core/hle
parent23867647561d9f17b96972b5a44461f7c2ab2a94 (diff)
Added FS functions to Archive and Archive_RomFS
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/kernel/archive.cpp34
1 files changed, 31 insertions, 3 deletions
diff --git a/src/core/hle/kernel/archive.cpp b/src/core/hle/kernel/archive.cpp
index 5079fcb8..1596367c 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;
}