Added Write() function to Archive and Archive_RomFS

This commit is contained in:
archshift
2014-08-20 22:03:31 -07:00
parent 2386764756
commit 4b94f103dc
4 changed files with 45 additions and 2 deletions

View File

@@ -48,8 +48,8 @@ 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:
{
@@ -59,12 +59,22 @@ public:
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 address = cmd_buff[5];
cmd_buff[2] = backend->Write(offset, length, Memory::GetPointer(address));
break;
}
// Unknown command...
default:
{
ERROR_LOG(KERNEL, "Unknown command=0x%08X!", cmd);
return -1;
}
}
cmd_buff[1] = 0; // No error
return 0;
}