Unverified Commit de0d520d authored by Libretro-Admin's avatar Libretro-Admin Committed by GitHub
Browse files

Merge pull request #61 from crystalct/master

PS3/PSL1GHT build fix
parents 26d94696 3fe6dc4b
Pipeline #111469 passed with stages
in 7 minutes and 43 seconds
......@@ -159,13 +159,20 @@ else ifeq ($(platform), qnx)
CXX = QCC -Vgcc_ntoarmv7le_cpp
AR = QCC -Vgcc_ntoarmv7le
FLAGS += -D__BLACKBERRY_QNX__ -marm -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp
else ifeq ($(platform), psl1ght)
# Lightweight PS3 Homebrew SDK
else ifneq (,$(filter $(platform), ps3 psl1ght))
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
CXX = $(PS3DEV)/ppu/bin/ppu-g++$(EXE_EXT)
AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT)
CC = $(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)
ENDIANNESS_DEFINES := -DMSB_FIRST
STATIC_LINKING = 1
FLAGS += -D__PS3__ -DARCH_POWERPC_ALTIVEC
OLD_GCC := 1
ifeq ($(platform), psl1ght)
FLAGS += -D__PSL1GHT__
endif
# PS2
else ifeq ($(platform), ps2)
......
......@@ -84,7 +84,11 @@
#define FIO_S_ISDIR SCE_S_ISDIR
#endif
#if defined(__QNX__) || defined(PSP)
#if defined(__PS3__)
#include <cell/cell_fs.h>
#endif
#if defined(__QNX__) || defined(PSP) || defined(__PS3__)
#include <unistd.h> /* stat() is defined here */
#endif
......
......@@ -69,7 +69,7 @@ extern "C" {
# endif
# endif
# else
# if defined(__GNUC__) && __GNUC__ >= 4
# if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__PS3__)
# define RETRO_API RETRO_CALLCONV __attribute__((__visibility__("default")))
# else
# define RETRO_API RETRO_CALLCONV
......
......@@ -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__)
/* No mman available */
#elif defined(_WIN32) && !defined(_XBOX)
#include <windows.h>
......
......@@ -49,6 +49,10 @@
#include <compat/msvc.h>
#endif
#if defined(__PS3__) && !defined(__PSL1GHT__)
#include <sys/fs_external.h>
#endif
static INLINE void bits_or_bits(uint32_t *a, uint32_t *b, uint32_t count)
{
uint32_t i;
......@@ -77,6 +81,8 @@ static INLINE bool bits_any_set(uint32_t* ptr, uint32_t count)
#ifndef PATH_MAX_LENGTH
#if defined(_XBOX1) || defined(_3DS) || defined(PSP) || defined(PS2) || defined(GEKKO)|| defined(WIIU) || defined(ORBIS)
#define PATH_MAX_LENGTH 512
#elif defined(__PS3__)
#define PATH_MAX_LENGTH 1024
#else
#define PATH_MAX_LENGTH 4096
#endif
......
......@@ -64,7 +64,16 @@
# endif
#endif
#if defined (__PS3__) && !defined(__PSL1GHT__)
#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
#else
#include <fcntl.h>
#endif
/* TODO: Some things are duplicated but I'm really afraid of breaking other platforms by touching this */
#if defined(VITA)
......@@ -86,7 +95,7 @@
# include <unistd.h>
#endif
#if defined(__QNX__) || defined(PSP)
#if defined(__QNX__) || defined(PSP) || defined(__PS3__)
#include <unistd.h> /* stat() is defined here */
#endif
......@@ -909,6 +918,18 @@ int retro_vfs_stat_impl(const char *path, int32_t *size)
orbisDclose(dir_ret);
is_character_special = S_ISCHR(buf.st_mode);
#elif defined(__PS3__) && !defined(__PSL1GHT__)
CellFsStat buf;
if (!path || !*path)
return 0;
if (cellFsStat(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 +1102,10 @@ struct libretro_vfs_implementation_dir
#elif defined(VITA) || defined(PSP)
SceUID directory;
SceIoDirent entry;
#elif defined(__PS3__) && !defined(__PSL1GHT__)
CellFsErrno error;
int directory;
CellFsDirent entry;
#elif defined(ORBIS)
int directory;
struct dirent entry;
......@@ -1096,6 +1121,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(__PS3__) && !defined(__PSL1GHT__)
return (rdir->error != CELL_FS_SUCCEEDED);
#else
return !(rdir->directory);
#endif
......@@ -1156,6 +1183,8 @@ libretro_vfs_implementation_dir *retro_vfs_opendir_impl(
#elif defined(VITA) || defined(PSP)
rdir->directory = sceIoDopen(name);
#elif defined(__PS3__) && !defined(__PSL1GHT__)
rdir->error = cellFsOpendir(name, &rdir->directory);
#elif defined(_3DS)
rdir->directory = !string_is_empty(name) ? opendir(name) : NULL;
rdir->entry = NULL;
......@@ -1194,6 +1223,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(__PS3__) && !defined(__PSL1GHT__)
uint64_t nread;
rdir->error = cellFsReaddir(rdir->directory, &rdir->entry, &nread);
return (nread != 0);
#elif defined(ORBIS)
return (orbisDread(rdir->directory, &rdir->entry) > 0);
#else
......@@ -1214,7 +1247,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(__PS3__)
return rdir->entry.d_name;
#else
if (!rdir || !rdir->entry)
......@@ -1235,6 +1268,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(__PS3__) && !defined(__PSL1GHT__)
CellFsDirent *entry = (CellFsDirent*)&rdir->entry;
return (entry->d_type == CELL_FS_TYPE_DIRECTORY);
#elif defined(ORBIS)
const struct dirent *entry = &rdir->entry;
if (entry->d_type == DT_DIR)
......@@ -1271,6 +1307,8 @@ int retro_vfs_closedir_impl(libretro_vfs_implementation_dir *rdir)
FindClose(rdir->directory);
#elif defined(VITA) || defined(PSP)
sceIoDclose(rdir->directory);
#elif defined(__PS3__) && !defined(__PSL1GHT__)
rdir->error = cellFsClosedir(rdir->directory);
#elif defined(ORBIS)
orbisDclose(rdir->directory);
#else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment