add support for all seek modes (wii nand file i/o)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1451 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
9d3d76837e
commit
b3421467ad
|
@ -125,22 +125,18 @@ CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress)
|
|||
|
||||
LOG(WII_IPC_FILEIO, "FileIO: Seek Pos: %i, Mode: %i (Device=%s)", SeekPosition, Mode, GetDeviceName().c_str());
|
||||
|
||||
switch(Mode)
|
||||
{
|
||||
case 0:
|
||||
if (fseek(m_pFileHandle, SeekPosition, SEEK_SET) == 0) {
|
||||
// Seek always return the seek position for success
|
||||
ReturnValue = SeekPosition;
|
||||
} else {
|
||||
LOG(WII_IPC_FILEIO, "FILEIO: Seek failed");
|
||||
}
|
||||
break;
|
||||
int seek_mode[3] = {SEEK_SET, SEEK_CUR, SEEK_END};
|
||||
|
||||
case 1: // cur
|
||||
case 2: // end
|
||||
default:
|
||||
PanicAlert("CWII_IPC_HLE_Device_FileIO unsupported seek mode");
|
||||
break;
|
||||
if (Mode >= 0 && Mode <= 2) {
|
||||
if (fseek(m_pFileHandle, SeekPosition, seek_mode[Mode]) == 0) {
|
||||
// Seek always return the seek position for success
|
||||
// Not sure if it's right in all modes though.
|
||||
ReturnValue = SeekPosition;
|
||||
} else {
|
||||
LOG(WII_IPC_FILEIO, "FILEIO: Seek failed");
|
||||
}
|
||||
} else {
|
||||
PanicAlert("CWII_IPC_HLE_Device_FileIO unsupported seek mode %i", Mode);
|
||||
}
|
||||
|
||||
Memory::Write_U32(ReturnValue, _CommandAddress + 0x4);
|
||||
|
|
Loading…
Reference in New Issue