From d9b2bde2f66ae1007db5d35d003162891f56b161 Mon Sep 17 00:00:00 2001 From: Ivan Epifanov Date: Mon, 7 Dec 2020 18:40:41 +0300 Subject: [PATCH] Fallback to app0: --- src/file/SDL_rwops.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c index 6328e78c3..2d5bcc992 100644 --- a/src/file/SDL_rwops.c +++ b/src/file/SDL_rwops.c @@ -589,7 +589,21 @@ SDL_RWFromFile(const char *file, const char *mode) rwops->write = windows_file_write; rwops->close = windows_file_close; rwops->type = SDL_RWOPS_WINFILE; - +#elif defined(__VITA__) + /* Try to open the file on the filesystem first */ + FILE *fp = fopen(file, mode); + if (fp) { + return SDL_RWFromFP(fp, 1); + } else { + /* Try opening it from app0:/ container if it's a relative path */ + char path[4096]; + SDL_snprintf(path, 4096, "app0:/%s", file); + fp = fopen(path, mode); + if (fp) { + return SDL_RWFromFP(fp, 1); + } + } + SDL_SetError("Couldn't open %s", file); #elif HAVE_STDIO_H { #ifdef __APPLE__