Advertisement
Guest User

Untitled

a guest
Jul 17th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. Index: Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp
  2. ===================================================================
  3. --- Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp (revision 6634)
  4. +++ Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp (working copy)
  5. @@ -25,6 +25,10 @@
  6. #include <algorithm>
  7. #include <fstream>
  8.  
  9. +#include <sys/types.h>
  10. +#include <sys/stat.h>
  11. +#include <fcntl.h>
  12. +
  13. typedef std::pair<char, std::string> replace_t;
  14. typedef std::vector<replace_t> replace_v;
  15. static replace_v replacements;
  16. @@ -146,9 +150,16 @@
  17. switch(_Mode)
  18. {
  19. case ISFS_OPEN_READ: m_pFileHandle = fopen(m_Filename.c_str(), "rb"); break;
  20. - case ISFS_OPEN_WRITE: m_pFileHandle = fopen(m_Filename.c_str(), "r+b"); break;
  21. + case ISFS_OPEN_WRITE: /* m_pFileHandle = fopen(m_Filename.c_str(), "r+b"); break; */
  22. // MK Wii gets here corrupting its saves, however using rb+ mode works fine
  23. // TODO : figure it properly...
  24. + {
  25. + int fd = open(m_Filename.c_str(), O_WRONLY);
  26. + if (fd != -1) m_pFileHandle = fdopen(fd, "wb");
  27. + // fd is not duplicated, thus will be closed
  28. + // when fclose is called on m_pFileHandle
  29. + }
  30. + break;
  31. case ISFS_OPEN_RW: m_pFileHandle = fopen(m_Filename.c_str(), "r+b"); break;
  32. default: PanicAlert("FileIO: Unknown open mode : 0x%02x", _Mode); break;
  33. }
  34. @@ -182,7 +193,7 @@
  35. s32 SeekPosition = Memory::Read_U32(_CommandAddress + 0xC);
  36. s32 Mode = Memory::Read_U32(_CommandAddress + 0x10);
  37.  
  38. - INFO_LOG(WII_IPC_FILEIO, "FileIO: Seek Pos: 0x%08x, Mode: %i (%s, Length=0x%08x)", SeekPosition, Mode, m_Name.c_str(), m_FileLength);
  39. + INFO_LOG(WII_IPC_FILEIO, "FileIO: Seek Pos: 0x%08x, Mode: %i (%s)", SeekPosition, Mode, m_Name.c_str());
  40.  
  41. /* TODO: Check if the new changes and the removed hack
  42. "magically" fixes Zelda - Twilight Princess as well */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement