From 20aae8a3b7fca996c90e1da189ddb5a214ae9e01 Mon Sep 17 00:00:00 2001 From: Francisco Javier Trujillo Mata Date: Sat, 2 Feb 2019 12:54:05 +0100 Subject: [PATCH 1/3] Use CWD to get the DefaultDir --- frontend/drivers/platform_ps2.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/frontend/drivers/platform_ps2.c b/frontend/drivers/platform_ps2.c index 61fc72bb5a..6596163bd6 100644 --- a/frontend/drivers/platform_ps2.c +++ b/frontend/drivers/platform_ps2.c @@ -193,6 +193,19 @@ static const char *getMountParams(const char *command, char *BlockDevice) static void create_path_names(void) { + char cwd[FILENAME_MAX]; + getcwd(cwd, sizeof(cwd)); + + strcat(cwd, "app"); + 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)); 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], From 0e7d5ed32b1bb975f18db7a86b675c242ab21c67 Mon Sep 17 00:00:00 2001 From: Francisco Javier Trujillo Mata Date: Tue, 26 Feb 2019 21:02:29 +0100 Subject: [PATCH 2/3] Improvements regarding the ps2 font driver --- gfx/drivers/ps2_gfx.c | 4 ++++ gfx/drivers_font/ps2_font.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gfx/drivers/ps2_gfx.c b/gfx/drivers/ps2_gfx.c index 6eae3f35e2..3cf2fc5c4f 100644 --- a/gfx/drivers/ps2_gfx.c +++ b/gfx/drivers/ps2_gfx.c @@ -35,6 +35,7 @@ typedef struct ps2_video GSTEXTURE *menuTexture; GSTEXTURE *coreTexture; bool clearVRAM; + bool clearVRAM_font; /* I need to create this additional field to be used in the font driver*/ struct retro_hw_render_interface_gskit_ps2 iface; /* Palette in the cores */ bool menuVisible; @@ -184,6 +185,7 @@ static void clearVRAMIfNeeded(ps2_video_t *ps2, void *frame, int width, int heig if (ps2->clearVRAM) { gsKit_vram_clear(ps2->gsGlobal); ps2->iface.updatedPalette = true; + ps2->clearVRAM_font = true; /* we need to upload also palette in the font driver */ } } @@ -194,6 +196,8 @@ static void refreshScreen(ps2_video_t *ps2) } gsKit_queue_exec(ps2->gsGlobal); + /* Here we are just puting in false the ps2->clearVRAM field + however, the ps2->clearVRAM_font should be done in the ps2_font driver */ ps2->clearVRAM = false; } diff --git a/gfx/drivers_font/ps2_font.c b/gfx/drivers_font/ps2_font.c index 663b364c0c..a6897adcd4 100644 --- a/gfx/drivers_font/ps2_font.c +++ b/gfx/drivers_font/ps2_font.c @@ -108,8 +108,9 @@ static void ps2_font_render_msg( if (ps2) { int x = FONTM_TEXTURE_LEFT_MARGIN; int y = ps2->ps2_video->gsGlobal->Height - FONTM_TEXTURE_BOTTOM_MARGIN; - if (ps2->ps2_video->clearVRAM) { + if (ps2->ps2_video->clearVRAM_font) { ps2_upload_font(ps2->ps2_video->gsGlobal, ps2->gsFontM); + ps2->ps2_video->clearVRAM_font = false; } gsKit_fontm_print_scaled(ps2->ps2_video->gsGlobal, ps2->gsFontM, x, y, FONTM_TEXTURE_ZPOSITION, FONTM_TEXTURE_SCALED , FONTM_TEXTURE_COLOR, msg); 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 3/3] 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