FileIO: update m_FileLength upon writes, so that MKWii doesn't end up seeking in rksys.dat at incredibly huge offsets.

MKWii still fails to create a new save file.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4704 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
luigi2us 2009-12-17 19:11:40 +00:00
parent f255f08a99
commit 734daf362b
1 changed files with 5 additions and 1 deletions

View File

@ -208,6 +208,10 @@ bool CWII_IPC_HLE_Device_FileIO::Write(u32 _CommandAddress)
size_t Result = fwrite(Memory::GetPointer(Address), Size, 1, m_pFileHandle); size_t Result = fwrite(Memory::GetPointer(Address), Size, 1, m_pFileHandle);
_dbg_assert_msg_(WII_IPC_FILEIO, Result == 1, "fwrite failed"); _dbg_assert_msg_(WII_IPC_FILEIO, Result == 1, "fwrite failed");
ReturnValue = Size; ReturnValue = Size;
u32 NewPosition = (u32)ftell(m_pFileHandle);
if (NewPosition > m_FileLength) // Oops, we made the file longer... let's update m_FileLength then
m_FileLength = NewPosition;
} }
Memory::Write_U32(ReturnValue, _CommandAddress + 0x4); Memory::Write_U32(ReturnValue, _CommandAddress + 0x4);