From 8f406826ef317d8a60360980bdcfc54ac0e272ff Mon Sep 17 00:00:00 2001 From: smea Date: Thu, 23 Jan 2014 23:15:41 +0100 Subject: [PATCH] FS : fixed FSFILE_Write (oops) --- libctru/source/FS.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libctru/source/FS.c b/libctru/source/FS.c index 06df443..e025a6f 100644 --- a/libctru/source/FS.c +++ b/libctru/source/FS.c @@ -74,8 +74,9 @@ Result FSFILE_Read(Handle handle, u32 *bytesRead, u64 offset, u32 *buffer, u32 s return cmdbuf[1]; } -//WARNING : using wrong flushFlags CAN corrupt the archive you're writing to -Result FSFILE_Write(Handle handle, u32 *bytesWritten, u64 offset, u32 *buffer, u32 size, u32 flushFlags) +//WARNING : using wrong flushFlags CAN corrupt the archive you're writing to. +//another warning : data should *not* be in RO memory +Result FSFILE_Write(Handle handle, u32 *bytesWritten, u64 offset, u32 *data, u32 size, u32 flushFlags) { u32 *cmdbuf=getThreadCommandBuffer(); @@ -84,8 +85,8 @@ Result FSFILE_Write(Handle handle, u32 *bytesWritten, u64 offset, u32 *buffer, u cmdbuf[2]=(u32)(offset>>32); cmdbuf[3]=size; cmdbuf[4]=flushFlags; - cmdbuf[5]=(size<<4)|12; - cmdbuf[6]=(u32)buffer; + cmdbuf[5]=(size<<4)|10; + cmdbuf[6]=(u32)data; Result ret=0; if((ret=svc_sendSyncRequest(handle)))return ret;