Fixed PS3/Psl1ght build (#72)

This commit is contained in:
crystalct
2021-05-29 09:38:27 +02:00
committed by GitHub
parent c39dc2ab03
commit b59fb7e925
10 changed files with 102 additions and 10 deletions
+11 -7
View File
@@ -171,13 +171,17 @@ else ifeq ($(platform), qnx)
PLATFORM_DEFINES := -D__BLACKBERRY_QNX__ -fexceptions -marm -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp
# Lightweight PS3 Homebrew SDK
else ifeq ($(platform), psl1ght)
TARGET := $(TARGET_NAME)_libretro_psl1ght.a
CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
CC_AS = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
CXX = $(PS3DEV)/ppu/bin/ppu-g++$(EXE_EXT)
AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT)
PLATFORM_DEFINES :=
else ifneq (,$(filter $(platform), ps3 psl1ght))
ifeq ($(platform), psl1ght)
PLATFORM_DEFINES := -D__PS3__ -D__PSLIGHT__
else
PLATFORM_DEFINES := -D__PS3__
endif
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(PS3DEV)/ppu/bin/ppu-$(COMMONLV)gcc$(EXE_EXT)
CC_AS = $(PS3DEV)/ppu/bin/ppu-$(COMMONLV)gcc$(EXE_EXT)
CXX = $(PS3DEV)/ppu/bin/ppu-$(COMMONLV)g++$(EXE_EXT)
AR = $(PS3DEV)/ppu/bin/ppu-$(COMMONLV)ar$(EXE_EXT)
STATIC_LINKING = 1
HAVE_COMPAT = 1
+2
View File
@@ -443,7 +443,9 @@ int Atari800_Initialise(int *argc, char *argv[])
#if defined(__LIBRETRO__)
SYSROM_FindInDir(retro_system_directory, TRUE);
#endif
#if !defined(__PS3__) && !defined(__PSL1GHT__)
SYSROM_FindInDir(".", TRUE); /* current directory */
#endif
#if defined(unix) || defined(__unix__) || defined(__linux__)
SYSROM_FindInDir("/usr/share/atari800", TRUE);
#endif
+12
View File
@@ -64,6 +64,9 @@
#endif
int CFG_save_on_exit = FALSE;
#if defined(__LIBRETRO__)
extern const char *retro_system_directory;
#endif
/* If another default path config path is defined use it
otherwise use the default one */
@@ -75,6 +78,10 @@ int CFG_save_on_exit = FALSE;
#define SYSTEM_WIDE_CFG_FILE "/etc/atari800.cfg"
#endif
#if defined (__PS3__) || defined(__PSL1GHT__)
#define DEFAULT_CFG_NAME "/atari800.cfg"
#endif
#ifdef WIIU
#define DEFAULT_CFG_NAME "sd:/retroarch/cores/system/atari800.cfg"
#define SYSTEM_WIDE_CFG_FILE "sd:/retroarch/cores/system/atari800.cfg"
@@ -101,11 +108,16 @@ int CFG_LoadConfig(const char *alternate_config_filename)
}
/* else use the default config name under the HOME folder */
else {
#if !defined(__PS3__) && !defined(__PSL1GHT__)
char *home = getenv("HOME");
if (home != NULL)
Util_catpath(rtconfig_filename, home, DEFAULT_CFG_NAME);
else
strcpy(rtconfig_filename, DEFAULT_CFG_NAME);
#else
strcpy(rtconfig_filename, retro_system_directory);
strcat(rtconfig_filename, DEFAULT_CFG_NAME);
#endif
}
fp = fopen(fname, "r");
+6
View File
@@ -4,6 +4,12 @@
#include <stdio.h> /* FILENAME_MAX */
#include "atari.h" /* UWORD */
#if defined(__PS3__) && !defined(__PSL1GHT__)
#define S_IREAD S_IRUSR
#define S_IWRITE S_IWUSR
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
#endif
int Devices_Initialise(int *argc, char *argv[]);
void Devices_Exit(void);
int Devices_PatchOS(void);
+1 -1
View File
@@ -81,7 +81,7 @@
# define fseeko _fseek
# define ftello _ftell
# define PRId64 "lld"
#elif defined (__DJGPP__)
#elif defined (__DJGPP__) || defined(__PS3__) && !defined(__PSL1GHT__)
# define fseeko fseek
# define ftello ftell
# define PRId64 "lld"
+3
View File
@@ -44,6 +44,9 @@
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
#if defined(__PS3__) && !defined(__PSL1GHT__)
#include "devices.h"
#endif
#include "antic.h"
#include "atari.h"
+5
View File
@@ -57,6 +57,11 @@
#include <pspthreadman.h>
#endif
#if defined(__PS3__) && !defined(__PSL1GHT__)
#include <sys/timer.h>
#define usleep sys_timer_usleep
#endif
#include "atari.h"
#include "platform.h"
#include "util.h"
+30
View File
@@ -583,3 +583,33 @@
#undef HAVE_NANOSLEEP
#endif
#if defined(__PS3__) && !defined(__PSL1GHT__)
#undef HAVE_FSEEKO
#undef HAVE_GETCWD
#undef HAVE_NANOSLEEP
#undef HAVE_MKSTEMP
#undef HAVE_MKTEMP
#undef HAVE_SIGNAL
#undef HAVE_SIGNAL_H
#undef HAVE_SYSTEM
#undef HAVE_TMPFILE
#undef HAVE_TMPNAM
#undef HAVE_STRINGS_H
#include <cell/cell_fs.h>
#define O_RDONLY CELL_FS_O_RDONLY
#define O_WRONLY CELL_FS_O_WRONLY
#define O_CREAT CELL_FS_O_CREAT
#define O_TRUNC CELL_FS_O_TRUNC
#define O_RDWR CELL_FS_O_RDWR
#define sysFsStat cellFsStat
#define sysFSStat CellFsStat
#define sysFSDirent CellFsDirent
#define sysFsOpendir cellFsOpendir
#define sysFsReaddir cellFsReaddir
#define sysFSDirent CellFsDirent
#define sysFsClosedir cellFsClosedir
#define WORDS_BIGENDIAN 1
#define FS_SUCCEEDED 0
#define FS_TYPE_DIR 1
#endif
+1 -1
View File
@@ -26,7 +26,7 @@
#include <stdio.h>
#include <stdint.h>
#if defined(PSP) || defined(PS2) || defined(GEKKO) || defined(VITA) || defined(_XBOX) || defined(_3DS) || defined(WIIU) || defined(SWITCH) || defined(HAVE_LIBNX)
#if defined(PSP) || defined(PS2) || defined(GEKKO) || defined(VITA) || defined(_XBOX) || defined(_3DS) || defined(WIIU) || defined(SWITCH) || defined(HAVE_LIBNX) || defined(__PS3__) || defined(__PSL1GHT__)
/* No mman available */
#elif defined(_WIN32) && !defined(_XBOX)
#include <windows.h>
@@ -909,6 +909,19 @@ int retro_vfs_stat_impl(const char *path, int32_t *size)
orbisDclose(dir_ret);
is_character_special = S_ISCHR(buf.st_mode);
#elif defined(__PSL1GHT__) || defined(__PS3__)
/* Lowlevel Lv2 */
sysFSStat buf;
if (!path || !*path)
return 0;
if (sysFsStat(path, &buf) < 0)
return 0;
if (size)
*size = (int32_t)buf.st_size;
is_dir = ((buf.st_mode & S_IFMT) == S_IFDIR);
#elif defined(_WIN32)
/* Windows */
DWORD file_info;
@@ -1081,6 +1094,10 @@ struct libretro_vfs_implementation_dir
#elif defined(VITA) || defined(PSP)
SceUID directory;
SceIoDirent entry;
#elif defined(__PSL1GHT__) || defined(__PS3__)
int error;
int directory;
sysFSDirent entry;
#elif defined(ORBIS)
int directory;
struct dirent entry;
@@ -1096,6 +1113,8 @@ static bool dirent_check_error(libretro_vfs_implementation_dir *rdir)
return (rdir->directory == INVALID_HANDLE_VALUE);
#elif defined(VITA) || defined(PSP) || defined(ORBIS)
return (rdir->directory < 0);
#elif defined(__PSL1GHT__) || defined(__PS3__)
return (rdir->error != FS_SUCCEEDED);
#else
return !(rdir->directory);
#endif
@@ -1159,6 +1178,8 @@ libretro_vfs_implementation_dir *retro_vfs_opendir_impl(
#elif defined(_3DS)
rdir->directory = !string_is_empty(name) ? opendir(name) : NULL;
rdir->entry = NULL;
#elif defined(__PSL1GHT__) || defined(__PS3__)
rdir->error = sysFsOpendir(name, &rdir->directory);
#elif defined(ORBIS)
rdir->directory = orbisDopen(name);
#else
@@ -1194,6 +1215,10 @@ bool retro_vfs_readdir_impl(libretro_vfs_implementation_dir *rdir)
return (rdir->directory != INVALID_HANDLE_VALUE);
#elif defined(VITA) || defined(PSP)
return (sceIoDread(rdir->directory, &rdir->entry) > 0);
#elif defined(__PSL1GHT__) || defined(__PS3__)
uint64_t nread;
rdir->error = sysFsReaddir(rdir->directory, &rdir->entry, &nread);
return (nread != 0);
#elif defined(ORBIS)
return (orbisDread(rdir->directory, &rdir->entry) > 0);
#else
@@ -1214,7 +1239,7 @@ const char *retro_vfs_dirent_get_name_impl(libretro_vfs_implementation_dir *rdir
if (name)
free(name);
return (char*)rdir->entry.cFileName;
#elif defined(VITA) || defined(PSP) || defined(ORBIS)
#elif defined(VITA) || defined(PSP) || defined(ORBIS) || defined(__PSL1GHT__) || defined(__PS3__)
return rdir->entry.d_name;
#else
if (!rdir || !rdir->entry)
@@ -1235,6 +1260,9 @@ bool retro_vfs_dirent_is_dir_impl(libretro_vfs_implementation_dir *rdir)
#elif defined(VITA)
return SCE_S_ISDIR(entry->d_stat.st_mode);
#endif
#elif defined(__PSL1GHT__) || defined(__PS3__)
sysFSDirent* entry = (sysFSDirent*)&rdir->entry;
return (entry->d_type == FS_TYPE_DIR);
#elif defined(ORBIS)
const struct dirent *entry = &rdir->entry;
if (entry->d_type == DT_DIR)
@@ -1271,6 +1299,8 @@ int retro_vfs_closedir_impl(libretro_vfs_implementation_dir *rdir)
FindClose(rdir->directory);
#elif defined(VITA) || defined(PSP)
sceIoDclose(rdir->directory);
#elif defined(__PSL1GHT__) || defined(__PS3__)
rdir->error = sysFsClosedir(rdir->directory);
#elif defined(ORBIS)
orbisDclose(rdir->directory);
#else