Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions audio/softsynth/mt32/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
#include "File.h"
#include "sha1/sha1.h"

#ifdef __PS3__
using namespace std;
#endif

namespace MT32Emu {

AbstractFile::AbstractFile() : sha1DigestCalculated(false) {
Expand Down
4 changes: 4 additions & 0 deletions audio/softsynth/mt32/ROMInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

#include "ROMInfo.h"

#ifdef __PS3__
using namespace std;
#endif

namespace MT32Emu {

static const ROMInfo *getKnownROMInfoFromList(Bit32u index) {
Expand Down
4 changes: 4 additions & 0 deletions audio/softsynth/mt32/Synth.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
#include "Types.h"
#include "Enumerations.h"

#ifdef __PS3__
using namespace std;
#endif

namespace MT32Emu {

class Analog;
Expand Down
4 changes: 4 additions & 0 deletions audio/softsynth/mt32/mmath.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

#include <cmath>

#ifdef __PS3__
using namespace std;
#endif

namespace MT32Emu {

// Mathematical constants
Expand Down
12 changes: 11 additions & 1 deletion backends/fs/libretro/libretro-fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
#endif
#include <unistd.h>

#ifdef PLAYSTATION3
#if defined(__PS3__) && !defined(__PSL1GHT__)
#include <cell/cell_fs.h>
#include <sys/stat.h>
#define FORBIDDEN_SYMBOL_ALLOW_ALL
#define F_OK 0 /* test for existence of file */
#define W_OK 0x02 /* test for write permission */
Expand Down Expand Up @@ -88,7 +90,15 @@ class LibRetroFilesystemNode : public AbstractFSNode {
*/
LibRetroFilesystemNode(const Common::String &path);

#if defined(__PS3__) && !defined(__PSL1GHT__)
virtual bool exists() const {
CellFsStat entry;
cellFsStat(_path.c_str(), &entry);
return access(_path.c_str(), F_OK) == 0 || (entry.st_mode & S_IFDIR) != 0;
}
#else
virtual bool exists() const { return access(_path.c_str(), F_OK) == 0; }
#endif
virtual Common::String getDisplayName() const { return _displayName; }
virtual Common::String getName() const { return _displayName; }
virtual Common::String getPath() const { return _path; }
Expand Down
32 changes: 25 additions & 7 deletions backends/platform/libretro/build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,22 @@ else ifeq ($(platform), genode)
AR = $(shell pkg-config genode-base --variable=ar) rcs
RANLIB = genode-x86-ranlib

# PS3
else ifeq ($(platform), ps3)
# Lightweight PS3 Homebrew SDK
else ifneq (,$(filter $(platform), ps3 psl1ght))
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
CXX = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-g++.exe
AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe rcs
DEFINES += -DPLAYSTATION3
STATIC_LINKING=1
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) rcs
AR_NOPAR = $(PS3DEV)/ppu/bin/ppu-$(COMMONLV)ar$(EXE_EXT)
DEFINES += -DPLAYSTATION3 -DWORDS_BIGENDIAN=1 -DMSB_FIRST -D__ppc__ -DNO_GETENV -D__PS3__
STATIC_LINKING=1
ifeq ($(platform), psl1ght)
PLATFORM_DEFINES += -D__PSL1GHT__
endif
ifneq (,$(findstring MINGW32,$(shell uname -a)))
PS3MINGW32 := 1
endif
LITE := 1

# Nintendo Wii
else ifeq ($(platform), wii)
Expand Down Expand Up @@ -561,6 +569,16 @@ $(TARGET): $(OBJS) libdeps.a
$(MKDIR) libtemp
cp $+ libtemp/
$(AR) -M < ctr.mri
else ifeq ($(PS3MINGW32), 1)
$(TARGET): $(OBJS) libdeps.a
$(HIDE)echo Linking $@...
$(HIDE)$(AR) $@ $(shell find ../ -maxdepth 1 -mindepth 1 -name '*.o')
$(HIDE)$(AR_NOPAR) q $@ $(shell find ../ -maxdepth 2 -mindepth 2 -name '*.o')
$(HIDE)$(AR_NOPAR) q $@ $(shell find ../ -maxdepth 3 -mindepth 3 -name '*.o')
$(HIDE)$(AR_NOPAR) q $@ $(shell find ../ -maxdepth 4 -mindepth 4 -name '*.o')
$(HIDE)$(AR_NOPAR) q $@ $(shell find ../ -maxdepth 5 -mindepth 5 -name '*.o')
$(HIDE)$(AR_NOPAR) q $@ $(shell find ../ -maxdepth 6 -mindepth 6 -name '*.o')
$(HIDE)$(AR_NOPAR) q $@ $(shell find ../ -maxdepth 7 -mindepth 7 -name '*.o')
else ifeq ($(STATIC_LINKING), 1)
$(TARGET): $(OBJS) libdeps.a
@echo Linking $@...
Expand Down
3 changes: 3 additions & 0 deletions backends/platform/libretro/deps/freetype/src/base/ftinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
#include FT_MODULE_H
#include "basepic.h"

#ifdef __PS3__
#define getenv(x) NULL
#endif

/*************************************************************************/
/* */
Expand Down
2 changes: 2 additions & 0 deletions backends/platform/libretro/deps/libfaad/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@
#undef HAVE_STRCHR

/* Define to 1 if you have the <strings.h> header file. */
#ifndef __PS3__
#define HAVE_STRINGS_H 1
#endif

/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
Expand Down
16 changes: 8 additions & 8 deletions backends/platform/libretro/libretro-common/file/retro_dirent.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
# include <unistd.h>
#endif

#ifdef __CELLOS_LV2__
#if defined(__PS3__) && !defined(__PSL1GHT__)
#include <cell/cell_fs.h>
#endif

Expand All @@ -65,7 +65,7 @@ struct RDIR
#elif defined(VITA) || defined(PSP)
SceUID directory;
SceIoDirent entry;
#elif defined(__CELLOS_LV2__)
#elif defined(__PS3__) && !defined(__PSL1GHT__)
CellFsErrno error;
int directory;
CellFsDirent entry;
Expand All @@ -90,7 +90,7 @@ struct RDIR *retro_opendir(const char *name)
rdir->directory = FindFirstFile(path_buf, &rdir->entry);
#elif defined(VITA) || defined(PSP)
rdir->directory = sceIoDopen(name);
#elif defined(__CELLOS_LV2__)
#elif defined(__PS3__) && !defined(__PSL1GHT__)
rdir->error = cellFsOpendir(name, &rdir->directory);
#else
rdir->directory = opendir(name);
Expand All @@ -107,7 +107,7 @@ bool retro_dirent_error(struct RDIR *rdir)
return (rdir->directory == INVALID_HANDLE_VALUE);
#elif defined(VITA) || defined(PSP)
return (rdir->directory < 0);
#elif defined(__CELLOS_LV2__)
#elif defined(__PS3__) && !defined(__PSL1GHT__)
return (rdir->error != CELL_FS_SUCCEEDED);
#else
return !(rdir->directory);
Expand All @@ -120,7 +120,7 @@ int retro_readdir(struct RDIR *rdir)
return (FindNextFile(rdir->directory, &rdir->entry) != 0);
#elif defined(VITA) || defined(PSP)
return (sceIoDread(rdir->directory, &rdir->entry) > 0);
#elif defined(__CELLOS_LV2__)
#elif defined(__PS3__) && !defined(__PSL1GHT__)
uint64_t nread;
rdir->error = cellFsReaddir(rdir->directory, &rdir->entry, &nread);
return (nread != 0);
Expand All @@ -133,7 +133,7 @@ const char *retro_dirent_get_name(struct RDIR *rdir)
{
#if defined(_WIN32)
return rdir->entry.cFileName;
#elif defined(VITA) || defined(PSP) || defined(__CELLOS_LV2__)
#elif defined(VITA) || defined(PSP) || defined(__PS3__)
return rdir->entry.d_name;
#else
return rdir->entry->d_name;
Expand Down Expand Up @@ -163,7 +163,7 @@ bool retro_dirent_is_dir(struct RDIR *rdir, const char *path)
#elif defined(VITA)
return PSP2_S_ISDIR(entry->d_stat.st_mode);
#endif
#elif defined(__CELLOS_LV2__)
#elif defined(__PS3__) && !defined(__PSL1GHT__)
CellFsDirent *entry = (CellFsDirent*)&rdir->entry;
return (entry->d_type == CELL_FS_TYPE_DIRECTORY);
#elif defined(DT_DIR)
Expand All @@ -190,7 +190,7 @@ void retro_closedir(struct RDIR *rdir)
FindClose(rdir->directory);
#elif defined(VITA) || defined(PSP)
sceIoDclose(rdir->directory);
#elif defined(__CELLOS_LV2__)
#elif defined(__PS3__) && !defined(__PSL1GHT__)
rdir->error = cellFsClosedir(rdir->directory);
#else
if (rdir->directory)
Expand Down
12 changes: 6 additions & 6 deletions backends/platform/libretro/libretro-common/file/retro_stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@
#include <kernel/image.h>
#endif

#if defined(__CELLOS_LV2__)
#if defined(__PS3__) && !defined(__PSL1GHT__)
#include <cell/cell_fs.h>
#endif

#if defined(VITA)
#define FIO_S_ISDIR PSP2_S_ISDIR
#endif

#if (defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)) || defined(__QNX__) || defined(PSP)
#if (defined(__PS3__) && !defined(__PSL1GHT__)) || defined(__QNX__) || defined(PSP)
#include <unistd.h> /* stat() is defined here */
#endif

Expand Down Expand Up @@ -95,7 +95,7 @@ static bool path_stat(const char *path, enum stat_mode mode, int32_t *size)
}
free(tmp);

#elif defined(__CELLOS_LV2__)
#elif defined(__PS3__) && !defined(__PSL1GHT__)
CellFsStat buf;
if (cellFsStat(path, &buf) < 0)
return false;
Expand Down Expand Up @@ -124,15 +124,15 @@ static bool path_stat(const char *path, enum stat_mode mode, int32_t *size)
case IS_DIRECTORY:
#if defined(VITA) || defined(PSP)
return FIO_S_ISDIR(buf.st_mode);
#elif defined(__CELLOS_LV2__)
#elif defined(__PS3__) && !defined(__PSL1GHT__)
return ((buf.st_mode & S_IFMT) == S_IFDIR);
#elif defined(_WIN32)
return (file_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
#else
return S_ISDIR(buf.st_mode);
#endif
case IS_CHARACTER_SPECIAL:
#if defined(VITA) || defined(PSP) || defined(__CELLOS_LV2__) || defined(_WIN32)
#if defined(VITA) || defined(PSP) || defined(__PS3__) || defined(_WIN32)
return false;
#else
return S_ISCHR(buf.st_mode);
Expand All @@ -144,7 +144,7 @@ static bool path_stat(const char *path, enum stat_mode mode, int32_t *size)
return false;
}

#if !defined(WIIU) && !defined(_3DS)
#if !defined(WIIU) && !defined(_3DS) && !defined(__PS3__)
/**
* path_is_directory:
* @path : path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
#include <stdint.h>
#include <math.h>

#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
#if defined(__PS3__) && !defined(__PSL1GHT__)
#include <sys/timer.h>
#define fseeko fseek
#define ftello ftell
#elif defined(XENON)
#include <time/time.h>
#elif(defined(GEKKO) && !defined(WIIU)) || defined(__PSL1GHT__) || defined(__QNX__)
Expand Down Expand Up @@ -92,7 +94,7 @@
**/
static INLINE void retro_sleep(unsigned msec)
{
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
#if defined(__PS3__) && !defined(__PSL1GHT__)
sys_timer_usleep(1000 * msec);
#elif defined(PSP) || defined(VITA)
sceKernelDelayThread(1000 * msec);
Expand Down
21 changes: 19 additions & 2 deletions backends/platform/libretro/libretro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#else
#include <unistd.h>
#endif
#ifndef _MSC_VER
#if !defined(_MSC_VER) && !defined(__PS3__)
/**
* Include libgen.h for basename() and dirname().
* @see http://linux.die.net/man/3/basename
Expand All @@ -21,6 +21,23 @@
#endif
#include <string.h>

#ifdef __PS3__
char *dirname (char *path)
{
if (path == NULL) return "/";
char loc[512];
strcpy(loc, path);
int l = strlen(loc);
loc[l - 1] = 0;
if (strrchr(loc, '/') == NULL) return "/";
int slash = strrchr(loc, '/') - loc;
if (slash == 0) return "/";
char* temp = (char*)malloc(slash);
memcpy(temp, loc, slash);
return temp;
}
#endif

/**
* Include base/internal_version.h to allow access to SCUMMVM_VERSION.
* @see retro_get_system_info()
Expand Down Expand Up @@ -531,7 +548,7 @@ void retro_cheat_set(unsigned unused, bool unused1, const char* unused2) { }

unsigned retro_get_region (void) { return RETRO_REGION_NTSC; }

#if (defined(GEKKO) && !defined(WIIU)) || defined(__CELLOS_LV2__)
#if (defined(GEKKO) && !defined(WIIU)) || (defined(__PS3__) && !defined(__PSL1GHT__))
int access(const char *path, int amode)
{
FILE *f;
Expand Down
2 changes: 1 addition & 1 deletion backends/platform/libretro/libretro.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ extern "C" {
# endif
# endif
# else
# if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__CELLOS_LV2__)
# if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__PS3__)
# define RETRO_API RETRO_CALLCONV __attribute__((__visibility__("default")))
# else
# define RETRO_API RETRO_CALLCONV
Expand Down
5 changes: 3 additions & 2 deletions backends/platform/libretro/libretro_os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@
#else
#include <windows.h>
#endif
#elif defined(__CELLOS_LV2__)
#elif defined(__PS3__) && !defined(__PSL1GHT__)
#include <sys/sys_time.h>
#define usleep sys_timer_usleep
#elif (defined(GEKKO) && !defined(WIIU))
#include <ogc/lwp_watchdog.h>
#else
Expand Down Expand Up @@ -642,7 +643,7 @@ class OSystem_RETRO : public EventsBaseBackend, public PaletteManager {
return (ticks_to_microsecs(gettime()) / 1000.0) - _startTime;
#elif defined(WIIU)
return ((cpu_features_get_time_usec())/1000) - _startTime;
#elif defined(__CELLOS_LV2__)
#elif defined(__PS3__) && !defined(__PSL1GHT__)
return (sys_time_get_system_time() / 1000.0) - _startTime;
#else
struct timeval t;
Expand Down
2 changes: 1 addition & 1 deletion backends/platform/libretro/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
extern char cmd_params[20][200];
extern char cmd_params_num;

#if (defined(GEKKO) && !defined(WIIU)) || defined(__CELLOS_LV2__)
#if (defined(GEKKO) && !defined(WIIU)) || (defined(__PS3__) && !defined(__PSL1GHT__))
extern int access(const char *path, int amode);
#endif

Expand Down
2 changes: 1 addition & 1 deletion common/scummsys.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
defined(__SYMBIAN32__) || \
defined(__LIBRETRO__)

#if defined(WIIU) || defined(__CELLOS_LV2__) || defined(GEKKO)
#if defined(WIIU) || defined(__PS3__) || defined(GEKKO)
#undef SCUMM_LITTLE_ENDIAN
#define SCUMM_BIG_ENDIAN
#define SCUMM_NEED_ALIGNMENT
Expand Down
8 changes: 8 additions & 0 deletions engines/bladerunner/ui/vk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,11 @@ void VK::drawNeedle(Graphics::Surface &surface) {
}

int needleOffset = abs(38 - _needleValue);
#ifndef __PS3__
int y = 345 - sqrt(72 * 72 - needleOffset * needleOffset);
#else
int y = 345 - sqrt((double)72 * 72 - needleOffset * needleOffset);
#endif

float colorIntensity = MIN(78.0f, _needleValue + 39.0f) / 78.0f;

Expand Down Expand Up @@ -935,7 +939,11 @@ void VK::animateAdjustment(int target) {
void VK::setAdjustment(int x) {
_adjustment = CLIP(x - 4, 154, 246);
int offset = abs(199 - _adjustment);
#ifndef __PS3__
int y = sqrt(88 * 88 - offset * offset);
#else
int y = sqrt((double)88 * 88 - offset * offset);
#endif
_buttons->setImageLeft(1, _adjustment);
_buttons->setImageTop(1, 345 - y);
}
Expand Down
Loading