mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-04 20:06:41 +01:00
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());
|
LOG(WII_IPC_FILEIO, "FileIO: Seek Pos: %i, Mode: %i (Device=%s)", SeekPosition, Mode, GetDeviceName().c_str());
|
||||||
|
|
||||||
switch(Mode)
|
int seek_mode[3] = {SEEK_SET, SEEK_CUR, SEEK_END};
|
||||||
{
|
|
||||||
case 0:
|
if (Mode >= 0 && Mode <= 2) {
|
||||||
if (fseek(m_pFileHandle, SeekPosition, SEEK_SET) == 0) {
|
if (fseek(m_pFileHandle, SeekPosition, seek_mode[Mode]) == 0) {
|
||||||
// Seek always return the seek position for success
|
// Seek always return the seek position for success
|
||||||
|
// Not sure if it's right in all modes though.
|
||||||
ReturnValue = SeekPosition;
|
ReturnValue = SeekPosition;
|
||||||
} else {
|
} else {
|
||||||
LOG(WII_IPC_FILEIO, "FILEIO: Seek failed");
|
LOG(WII_IPC_FILEIO, "FILEIO: Seek failed");
|
||||||
}
|
}
|
||||||
break;
|
} else {
|
||||||
|
PanicAlert("CWII_IPC_HLE_Device_FileIO unsupported seek mode %i", Mode);
|
||||||
case 1: // cur
|
|
||||||
case 2: // end
|
|
||||||
default:
|
|
||||||
PanicAlert("CWII_IPC_HLE_Device_FileIO unsupported seek mode");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Memory::Write_U32(ReturnValue, _CommandAddress + 0x4);
|
Memory::Write_U32(ReturnValue, _CommandAddress + 0x4);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user