summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorhrydgard <hrydgard@gmail.com>2008-12-08 22:02:06 +0000
committerhrydgard <hrydgard@gmail.com>2008-12-08 22:02:06 +0000
commitb3421467add98086223304ca6344d62b15fb5ce3 (patch)
tree0d7130390ae83ed9b659567d90e9f445f37fa7e7 /Source/Core
parent9d3d76837e948fb025ad0afdd5f25fe46ea679cd (diff)
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
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp28
1 files changed, 12 insertions, 16 deletions
diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp
index 196b08ea64..02b28054a9 100644
--- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp
+++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp
@@ -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;
-
- case 1: // cur
- case 2: // end
- default:
- PanicAlert("CWII_IPC_HLE_Device_FileIO unsupported seek mode");
- break;
+ int seek_mode[3] = {SEEK_SET, SEEK_CUR, SEEK_END};
+
+ 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);