From 3ec2ec2e119749bc9917a2b400a90fa6fd4dd843 Mon Sep 17 00:00:00 2001 From: Francisco Javier Trujillo Mata Date: Tue, 26 Feb 2019 22:11:56 +0100 Subject: [PATCH] Fix load state issue --- frontend/drivers/platform_ps2.c | 16 +++++++--------- libretro-common/vfs/vfs_implementation.c | 11 ++++++++--- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/frontend/drivers/platform_ps2.c b/frontend/drivers/platform_ps2.c index 6596163bd6..9b5b27a816 100644 --- a/frontend/drivers/platform_ps2.c +++ b/frontend/drivers/platform_ps2.c @@ -195,17 +195,15 @@ static void create_path_names(void) { char cwd[FILENAME_MAX]; getcwd(cwd, sizeof(cwd)); - - strcat(cwd, "app"); + if (strncmp(cwd, "mc0:", 4) || strncmp(cwd, "mc1:", 4)) { + /* For now the save and load states just working in MCs */ + strlcpy(cwd, "mc0:/", sizeof(cwd)); + } + strcat(cwd, "RETROARCH"); + strlcpy(eboot_path, cwd, sizeof(eboot_path)); strlcpy(g_defaults.dirs[DEFAULT_DIR_PORT], eboot_path, sizeof(g_defaults.dirs[DEFAULT_DIR_PORT])); - - strcat(cwd, "/data/retroarch"); - strlcpy(user_path, cwd, sizeof(user_path)); - - // strlcpy(eboot_path, "mc0:/RETROARCH", sizeof(eboot_path)); - // strlcpy(g_defaults.dirs[DEFAULT_DIR_PORT], eboot_path, sizeof(g_defaults.dirs[DEFAULT_DIR_PORT])); - // strlcpy(user_path, "mc0:/RETROARCH/data/retroarch", sizeof(user_path)); + strlcpy(user_path, eboot_path, sizeof(user_path)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], g_defaults.dirs[DEFAULT_DIR_PORT], "CORES", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], g_defaults.dirs[DEFAULT_DIR_PORT], diff --git a/libretro-common/vfs/vfs_implementation.c b/libretro-common/vfs/vfs_implementation.c index 658d66fe36..97eb04c086 100644 --- a/libretro-common/vfs/vfs_implementation.c +++ b/libretro-common/vfs/vfs_implementation.c @@ -222,7 +222,12 @@ int64_t retro_vfs_file_seek_internal(libretro_vfs_implementation_file *stream, i #elif defined(__CELLOS_LV2__) || defined(_MSC_VER) && _MSC_VER <= 1310 return fseek(stream->fp, (long)offset, whence); #elif defined(PS2) - return fioLseek(fileno(stream->fp), (off_t)offset, whence); + int64_t ret = fioLseek(fileno(stream->fp), (off_t)offset, whence); + /* fioLseek could return positive numbers */ + if (ret > 0) { + ret = 0; + } + return ret; #elif defined(ORBIS) int ret = orbisLseek(stream->fd, offset, whence); if (ret < 0) @@ -924,9 +929,9 @@ int retro_vfs_mkdir_impl(const char *dir) #elif defined(VITA) || defined(PSP) int ret = sceIoMkdir(dir, 0777); #elif defined(PS2) - int ret =fileXioMkdir(dir, 0777); + int ret = fileXioMkdir(dir, 0777); #elif defined(ORBIS) - int ret =orbisMkdir(dir, 0755); + int ret = orbisMkdir(dir, 0755); #elif defined(__QNX__) int ret = mkdir(dir, 0777); #else