aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYotam Barnoy2010-08-25 13:26:30 +0000
committerYotam Barnoy2010-08-25 13:26:30 +0000
commit89b34faa5aa85f8e7f7e5ec54f14246e639c9e6f (patch)
tree91f80abead17f9218f04a4c13356d79204d4c651
parent4135dc7a7c7584f38404d8f859a3258fa08e0475 (diff)
downloadscummvm-rg350-89b34faa5aa85f8e7f7e5ec54f14246e639c9e6f.tar.gz
scummvm-rg350-89b34faa5aa85f8e7f7e5ec54f14246e639c9e6f.tar.bz2
scummvm-rg350-89b34faa5aa85f8e7f7e5ec54f14246e639c9e6f.zip
PSP: fixed flag to open()
I was missing a flag (PSP_O_TRUNC) causing the config file to be opened on top of the old file, causing file corruption. svn-id: r52387
-rw-r--r--backends/fs/psp/psp-stream.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/backends/fs/psp/psp-stream.cpp b/backends/fs/psp/psp-stream.cpp
index 74d631a2f7..3b0737ba63 100644
--- a/backends/fs/psp/psp-stream.cpp
+++ b/backends/fs/psp/psp-stream.cpp
@@ -93,7 +93,7 @@ void *PspIoStream::open() {
PSP_DEBUG_PRINT_FUNC("suspended\n");
}
- _handle = sceIoOpen(_path.c_str(), _writeMode ? PSP_O_RDWR | PSP_O_CREAT : PSP_O_RDONLY, 0777);
+ _handle = sceIoOpen(_path.c_str(), _writeMode ? PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC : PSP_O_RDONLY, 0777);
if (!_handle) {
_error = true;
_handle = NULL;
@@ -228,8 +228,7 @@ uint32 PspIoStream::read(void *ptr, uint32 len) {
uint32 PspIoStream::write(const void *ptr, uint32 len) {
DEBUG_ENTER_FUNC();
- PSP_DEBUG_PRINT_FUNC("filename[%s], len[0x%x], ptr[%p], _pos[%x], _physPos[%x] buf[%x %x %x %x..%x %x]\n", _path.c_str(), len, ptr, _pos, _physicalPos, ((byte *)ptr)[0], ((byte *)ptr)[1], ((byte *)ptr)[2], ((byte *)ptr)[3], ((byte *)ptr)[len - 2],
- ((byte *)ptr)[len - 1]);
+ PSP_DEBUG_PRINT_FUNC("filename[%s], len[0x%x], ptr[%p], _pos[%x], _physPos[%x]\n", _path.c_str(), len, ptr, _pos, _physicalPos);
if (!len || _error) // we actually get some calls with len == 0!
return 0;