diff --git a/frontend/drivers/platform_ps2.c b/frontend/drivers/platform_ps2.c index 09ac87c187..9e0a5722b3 100644 --- a/frontend/drivers/platform_ps2.c +++ b/frontend/drivers/platform_ps2.c @@ -225,7 +225,7 @@ static void frontend_ps2_init(void *data) waitUntilDeviceIsReady(bootDeviceID); #if defined(HAVE_FILE_LOGGER) - retro_main_log_file_init("retroarch.log"); + retro_main_log_file_init("retroarch.log", false); verbosity_enable(); #endif } diff --git a/libretro-common/vfs/vfs_implementation.c b/libretro-common/vfs/vfs_implementation.c index ed7f362855..ebe5228c1d 100644 --- a/libretro-common/vfs/vfs_implementation.c +++ b/libretro-common/vfs/vfs_implementation.c @@ -938,7 +938,9 @@ int retro_vfs_stat_impl(const char *path, int32_t *size) /* if fileXioGetStat fails */ int dir_ret = fileXioDopen(path); is_dir = dir_ret > 0; - fileXioDclose(dir_ret); + if (is_dir) { + fileXioDclose(dir_ret); + } } else is_dir = FIO_S_ISDIR(buf.mode); diff --git a/ps2/compat_files/compat_ctype.c b/ps2/compat_files/compat_ctype.c index a03606a900..3e139a83d9 100644 --- a/ps2/compat_files/compat_ctype.c +++ b/ps2/compat_files/compat_ctype.c @@ -442,7 +442,6 @@ float strtof(const char* str, char** endptr) { return (float) strtod(str, endptr); } -//unsigned long strtoul(const char *s, char **endptr, int base); FJTRUJY MISSING int link(const char *oldpath, const char *newpath) { @@ -453,3 +452,8 @@ int unlink(const char *path) { return fileXioRemove(path); } + +int rename(const char *source, const char *dest) +{ + return fileXioRename(source, dest); +} diff --git a/ps2/compat_files/fileXio_cdvd.c b/ps2/compat_files/fileXio_cdvd.c index 5c61840568..e82b66f10d 100644 --- a/ps2/compat_files/fileXio_cdvd.c +++ b/ps2/compat_files/fileXio_cdvd.c @@ -191,9 +191,12 @@ int ps2fileXioDread(int fd, iox_dirent_t *dirent) int ps2fileXioDclose(int fd) { + int ret = -19; if (is_fd_valid(fd)) { - return __ps2_release_descriptor(fd); - } else { - return fileXioDclose(fd); + ret = __ps2_release_descriptor(fd); + } else if (fd > 0) { + ret = fileXioDclose(fd); } + + return ret; } diff --git a/ps2/compat_files/ps2_descriptor.c b/ps2/compat_files/ps2_descriptor.c index c46be16c9b..7048acf182 100644 --- a/ps2/compat_files/ps2_descriptor.c +++ b/ps2/compat_files/ps2_descriptor.c @@ -62,7 +62,6 @@ int is_fd_valid(int fd) } void _init_ps2_io(void) { - int ret; ee_sema_t sp; memset(__ps2_fdmap, 0, sizeof(__ps2_fdmap)); @@ -72,7 +71,6 @@ void _init_ps2_io(void) { sp.max_count = 1; sp.option = 0; _lock_sema_id = CreateSema(&sp); - } void _free_ps2_io(void) { diff --git a/ps2/compat_files/ps2_devices.c b/ps2/compat_files/ps2_devices.c index 63a6eeadd6..2c9c1bf6f5 100644 --- a/ps2/compat_files/ps2_devices.c +++ b/ps2/compat_files/ps2_devices.c @@ -179,8 +179,9 @@ bool waitUntilDeviceIsReady(enum BootDeviceIDs device_id) retries--; }; - - fileXioDclose(openFile); + if (openFile > 0) { + fileXioDclose(openFile); + } return openFile >= 0; } diff --git a/ps2/compat_files/time.c b/ps2/compat_files/time.c index da7598f421..dff8185edf 100644 --- a/ps2/compat_files/time.c +++ b/ps2/compat_files/time.c @@ -107,8 +107,31 @@ clock_t clock(void) return SDL_GetTicks(); } -time_t time(time_t *t) { +time_t time(time_t *t) +{ time_t tim = -1; /* TODO: This function need to be implemented again because the SDK one is not working fine */ - return time; + return tim; } + +time_t mktime(struct tm *timeptr) +{ + time_t tim = -1; + /* TODO: This function need to be implemented again because the SDK one is not working fine */ + return tim; +} + +struct tm *localtime(const time_t *timep) +{ + return NULL; +} + +size_t strftime(char *s, size_t max, const char *format, const struct tm *tm) +{ + return -1; +} + +char *setlocale(int category, const char *locale) +{ + return NULL; +} \ No newline at end of file diff --git a/ps2/include/inttypes.h b/ps2/include/inttypes.h index 3234974612..a41fb2c406 100644 --- a/ps2/include/inttypes.h +++ b/ps2/include/inttypes.h @@ -15,8 +15,8 @@ #ifndef INTTYPES_H #define INTTYPES_H -#define PRId64 "ld" -#define PRIu64 "lu" -#define PRIuPTR "lu" +#define PRId64 "lld" +#define PRIu64 "llu" +#define PRIuPTR "llu" #endif /* INTTYPES_H */ diff --git a/ps2/include/math.h b/ps2/include/math.h index fd8341ec23..71f0f858fb 100644 --- a/ps2/include/math.h +++ b/ps2/include/math.h @@ -33,4 +33,6 @@ #define exp(a) ((double)expf((float)a)) #define log(a) ((double)logf((float)a)) +#define fmod(a, b) (a - b * floor(a / b)); + #endif //MATH_H diff --git a/ps2/include/ps2_descriptor.h b/ps2/include/ps2_descriptor.h index f0e17cc53f..b54c8def7f 100644 --- a/ps2/include/ps2_descriptor.h +++ b/ps2/include/ps2_descriptor.h @@ -34,8 +34,6 @@ typedef struct entries *FileEntry; } DescriptorTranslation; -extern DescriptorTranslation *__ps2_fdmap[]; - void _init_ps2_io(void); void _free_ps2_io(void); int is_fd_valid(int fd);