summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorJohn Peterson <jpeterson57@gmail.com>2009-01-06 05:35:02 +0000
committerJohn Peterson <jpeterson57@gmail.com>2009-01-06 05:35:02 +0000
commitf8fbb5e2c00817713b7e9f4f2ebe233e9d57cb62 (patch)
tree3853b2dc16f93ff82360a5bc0567f7560a4dae05 /Source/Core
parenta146629b2ba9b3cfbe695d4cf5109ab5eed98733 (diff)
Wii IOS: Zelda - TP save file fix
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1805 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp18
1 files changed, 15 insertions, 3 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 02b28054a9..33d688f63d 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
@@ -123,15 +123,27 @@ CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress)
u32 SeekPosition = Memory::Read_U32(_CommandAddress + 0xC);
u32 Mode = Memory::Read_U32(_CommandAddress +0x10);
- LOG(WII_IPC_FILEIO, "FileIO: Seek Pos: %i, Mode: %i (Device=%s)", SeekPosition, Mode, GetDeviceName().c_str());
-
+ /* Zelda - TP Fix: It doesn't make much sense but it works in Zelda - TP and
+ it's probably better than trying to read outside the file (it seeks to 0x6000 instead
+ of the correct 0x2000 for the second half of the file). Could this be right
+ or has it misunderstood the filesize somehow? My guess is that the filesize is
+ hardcoded in to the game, and it never checks the filesize, so I don't know.
+ Maybe it's wrong to return the seekposition when it's zero? Perhaps it wants
+ the filesize then? - No, that didn't work either, it seeks to 0x6000 even if I return
+ 0x4000 from the first seek. */
+ if (SeekPosition > m_FileLength && Mode == 0)
+ SeekPosition = SeekPosition % m_FileLength;
+
+ LOG(WII_IPC_FILEIO, "FileIO: Seek Pos: 0x%04x, Mode: %i (Device=%s)", SeekPosition, Mode, GetDeviceName().c_str());
+
+ // Set seek mode
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;
+ ReturnValue = SeekPosition;
} else {
LOG(WII_IPC_FILEIO, "FILEIO: Seek failed");
}