Merge pull request #10370 from phcoder/psl1ght_s2

PSL1GHT port
This commit is contained in:
Autechre 2020-03-30 08:42:21 +02:00 committed by GitHub
commit 411ff301c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 1450 additions and 187 deletions

View File

@ -1,29 +1,39 @@
#-------------------------------------------------------------------------------
# Clear the implicit built in rules
#-------------------------------------------------------------------------------
.SUFFIXES:
#-------------------------------------------------------------------------------
ifeq ($(strip $(PSL1GHT)),)
$(error "Please set PSL1GHT in your environment. export PSL1GHT=<path>")
endif
include $(PSL1GHT)/ppu_rules
include version.all
DEBUG = 0
HAVE_LOGGER = 0
HAVE_FILE_LOGGER = 0
HAVE_FILE_LOGGER = 1
PC_DEVELOPMENT_IP_ADDRESS = "192.168.1.7"
PC_DEVELOPMENT_UDP_PORT = 3490
CC = $(PS3DEV)/ppu/bin/ppu-gcc
CXX = $(PS3DEV)/ppu/bin/ppu-g++
LD = $(PS3DEV)/ppu/bin/ppu-ld
CONTENT_ID_FULL = UP0001-SSNE10000_00-0000000000000001
CONTENTID = UP0001-SSNE10001_00-0000000000000001
APPID = SSNE10001
TITLE = Retroarch PSL1GHT
PACKAGE_BASENAME := retroarch_psl1ght
ELF_TARGET := retroarch_psl1ght.elf
EBOOT_PATH = pkg/ps3/USRDIR/EBOOT.BIN
CORE_PATH = pkg/ps3/USRDIR/cores/CORE.SELF
SELF_TARGET := $(ELF_TARGET:.elf=.self)
CORE_PATH = pkg/psl1ght/pkg/USRDIR/cores/CORE.SELF
INCLUDE := -I. -I$(PS3DEV)/ppu/include -Ips3/gcmgl/include/export -Ips3/include -Ideps -Ideps/stb -Ilibretro-common/include/compat/zlib
LIBDIRS := -L$(PS3DEV)/ppu/lib -L$(PS3DEV)/portlibs/ppu/lib -L.
INCLUDE += -I. -Ips3/gcmgl/include/export -Ips3/include -Ideps -Ideps/stb -Ilibretro-common/include/compat/zlib -Ilibretro-common/include $(LIBPSL1GHT_INC) -Iinclude
LIBDIRS += -L.
MACHDEP := -D__CELLOS_LV2__ -D__PSL1GHT__
MACHDEP := -D__CELLOS_LV2__ -D__PSL1GHT__ -mcpu=cell
CFLAGS += -Wall $(MACHDEP) $(INCLUDE)
LDFLAGS := $(MACHDEP)
LIBS := -lrgl_ps3 -lretro_psl1ght -laudio -lrsx -lgcm_sys -lnet -lio -lsysutil -lsysmodule -lm -ljpgdec -lpngdec -llv2 -lnet -lnetctl
LIBS := -lretro_psl1ght -laudio -lrsx -lgcm_sys -lnet -lio -lsysutil -lsysmodule -lm -ljpgdec -lpngdec -llv2 -lnet -lnetctl
# system platform
system_platform = unix
@ -38,46 +48,10 @@ endif
PKG_SCRIPT = tools/ps3/ps3py/pkg.py
ifeq ($(shell uname), Linux)
PKG_FINALIZE = package_finalize
MAKE_SELF_WC = make_self_wc
MAKE_SELF = make_self_npdrm
PYTHON2 = python2
GIT = git
else
PKG_FINALIZE = package_finalize.exe
MAKE_SELF_WC = make_self_wc.exe
MAKE_SELF = make_self_npdrm.exe
PYTHON2 = python2.exe
GIT = git.exe
endif
# system platform
system_platform = unix
ifeq ($(shell uname -a),)
EXE_EXT = .exe
system_platform = win
else ifneq ($(findstring Darwin,$(shell uname -a)),)
system_platform = osx
else ifneq ($(findstring MINGW,$(shell uname -a)),)
system_platform = win
endif
PKG_SCRIPT = tools/ps3/ps3py/pkg.py
ifeq ($(shell uname), Linux)
PKG_FINALIZE = package_finalize
MAKE_SELF_WC = make_self_wc
MAKE_SELF = make_self_npdrm
PYTHON2 = python2
GIT = git
else
PKG_FINALIZE = package_finalize.exe
MAKE_SELF_WC = make_self_wc.exe
MAKE_SELF = make_self_npdrm.exe
PYTHON2 = python2.exe
GIT = git.exe
endif
MAKE_FSELF_NPDRM = $(CELL_SDK)/host-win32/bin/make_fself_npdrm.exe
MAKE_PACKAGE_NPDRM = $(CELL_SDK)/host-win32/bin/make_package_npdrm.exe
OBJ = griffin/griffin.o
@ -92,7 +66,7 @@ endif
SHARED_FLAGS :=
SHARED_FLAGS += -DHAVE_VIDEO_LAYOUT
SHARED_FLAGS += -DHAVE_MENU -DHAVE_CONFIGFILE -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_GCMGL -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_MOUSE -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_GRIFFIN=1 -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -Wno-char-subscripts -DHAVE_CC_RESAMPLER
SHARED_FLAGS += -DHAVE_MENU -DHAVE_CONFIGFILE -DRARCH_CONSOLE -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_GCMGL -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_MOUSE -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_GRIFFIN=1 -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -Wno-char-subscripts -DHAVE_CC_RESAMPLER -DRARCH_INTERNAL -DHAVE_MULTIMAN -DHAVE_RGUI
CFLAGS += -std=gnu99 $(SHARED_FLAGS)
CXXFLAGS += $(SHARED_FLAGS)
@ -103,28 +77,18 @@ else
CXXFLAGS += -03 -g
endif
all: $(ELF_TARGET)
all: $(SELF_TARGET)
$(ELF_TARGET): $(OBJ)
$(CXX) -o $@ $(LDFLAGS) $(LIBDIRS) $(OBJ) $(LIBS)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
create-core: $(SELF_TARGET)
cp $(SELF_TARGET) $(CORE_PATH)
%.o: %.cpp
$(CXX) $(CFLAGS) -c -o $@ $<
create-npdrm-core:
$(MAKE_FSELF_NPDRM) $(ELF_TARGET) $(CORE_PATH)
create-core:
$(MAKE_SELF_WC) $(ELF_TARGET) $(CORE_PATH)
pkg: $(ELF_TARGET) create-npdrm-core
$(MAKE_PACKAGE_NPDRM) pkg/ps3/package.conf ps3/pkg
pkg-signed: $(ELF_TARGET) create-core
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
pkg: create-core
$(PKG) --contentid $(CONTENTID) pkg/psl1ght/pkg/ $(PACKAGE_BASENAME).pkg
# cp $(PACKAGE_BASENAME).pkg $(PACKAGE_BASENAME).gnpdrm.pkg
# $(PACKAGE_FINALIZE) $(PACKAGE_BASENAME).gnpdrm.pkg
clean:
rm -f $(ELF_TARGET)

119
Makefile.psl1ght.salamander Normal file
View File

@ -0,0 +1,119 @@
#-------------------------------------------------------------------------------
# Clear the implicit built in rules
#-------------------------------------------------------------------------------
.SUFFIXES:
#-------------------------------------------------------------------------------
ifeq ($(strip $(PSL1GHT)),)
$(error "Please set PSL1GHT in your environment. export PSL1GHT=<path>")
endif
include $(PSL1GHT)/ppu_rules
include version.all
DEBUG = 0
HAVE_LOGGER = 0
HAVE_FILE_LOGGER = 1
PC_DEVELOPMENT_IP_ADDRESS = "192.168.1.7"
PC_DEVELOPMENT_UDP_PORT = 3490
CONTENTID = UP0001-SSNE10001_00-0000000000000001
APPID = SSNE10001
TITLE = Retroarch PSL1GHT
PACKAGE_BASENAME := retroarch_psl1ght
ELF_TARGET := retroarch_psl1ght_salamander.elf
ELF_TARGET_NONSTRIPPED := retroarch_psl1ght_salamander_nonstripped.elf
EBOOT_PATH = pkg/psl1ght/pkg/USRDIR/EBOOT.BIN
INCLUDE += -I. -Ips3/gcmgl/include/export -Ips3/include -Ideps -Ideps/stb -Ilibretro-common/include/compat/zlib -Ilibretro-common/include $(LIBPSL1GHT_INC) -Iinclude
LIBDIRS += -L.
MACHDEP := -D__CELLOS_LV2__ -D__PSL1GHT__ -mcpu=cell -mhard-float -fmodulo-sched -ffunction-sections -fdata-sections
CFLAGS += -Wall $(MACHDEP) $(INCLUDE)
LDFLAGS := $(MACHDEP)
LIBS := -lgcm_sys -lrsx -lsysutil -lio -lnet -lsysmodule -lrt -llv2 -lm
# system platform
system_platform = unix
ifeq ($(shell uname -a),)
EXE_EXT = .exe
system_platform = win
else ifneq ($(findstring Darwin,$(shell uname -a)),)
system_platform = osx
else ifneq ($(findstring MINGW,$(shell uname -a)),)
system_platform = win
endif
PKG_SCRIPT = tools/ps3/ps3py/pkg.py
ifeq ($(shell uname), Linux)
GIT = git
else
GIT = git.exe
endif
OBJ = frontend/frontend_salamander.o \
frontend/frontend_driver.o \
frontend/drivers/platform_ps3.o \
libretro-common/file/file_path.o \
libretro-common/file/file_path_io.o \
libretro-common/lists/dir_list.o \
libretro-common/lists/string_list.o \
libretro-common/file/retro_dirent.o \
libretro-common/hash/rhash.o \
libretro-common/string/stdstring.o \
libretro-common/encodings/encoding_utf.o \
libretro-common/compat/compat_strl.o \
libretro-common/compat/compat_strcasestr.o \
libretro-common/compat/fopen_utf8.o \
libretro-common/streams/file_stream.o \
libretro-common/vfs/vfs_implementation.o \
libretro-common/file/config_file.o \
file_path_str.o \
verbosity.o
ifeq ($(HAVE_LOGGER), 1)
CFLAGS += -DHAVE_LOGGER
endif
ifeq ($(HAVE_FILE_LOGGER), 1)
CFLAGS += -DHAVE_FILE_LOGGER
endif
SHARED_FLAGS :=
SHARED_FLAGS += -DHAVE_VIDEO_LAYOUT
SHARED_FLAGS += -DHAVE_MENU -DHAVE_CONFIGFILE -DRARCH_CONSOLE -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_GCMGL -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_MOUSE -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_GRIFFIN=1 -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -Wno-char-subscripts -DHAVE_CC_RESAMPLER -DHAVE_MULTIMAN -DHAVE_RGUI -DIS_SALAMANDER
CFLAGS += -std=gnu99 $(SHARED_FLAGS)
CXXFLAGS += $(SHARED_FLAGS)
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -g
else
CFLAGS += -O3 -g
CXXFLAGS += -03 -g
endif
all: create-salamander
$(ELF_TARGET_NONSTRIPPED): $(OBJ)
$(CXX) -o $@ $(LDFLAGS) $(LIBDIRS) $(OBJ) $(LIBS)
$(ELF_TARGET): $(ELF_TARGET_NONSTRIPPED)
$(STRIP) $< -o $@
$(SPRX) $@
create-salamander: $(ELF_TARGET)
$(SELF_NPDRM) $(ELF_TARGET) $(EBOOT_PATH) $(CONTENTID)
pkg: create-salamander
$(PKG) --contentid $(CONTENTID) pkg/psl1ght/pkg/ $(PACKAGE_BASENAME).pkg
# cp $(PACKAGE_BASENAME).pkg $(PACKAGE_BASENAME).gnpdrm.pkg
# $(PACKAGE_FINALIZE) $(PACKAGE_BASENAME).gnpdrm.pkg
clean:
rm -f $(ELF_TARGET)
rm -f $(OBJ)
.PHONY: clean

View File

@ -17,8 +17,6 @@
#ifndef _PS3_DEFINES_H
#define _PS3_DEFINES_H
#include <sdk_version.h>
/*============================================================
AUDIO PROTOTYPES
============================================================ */
@ -71,6 +69,7 @@ extern int audioAddData(uint32_t portNum, float *data, uint32_t frames, float vo
#define sys_semaphore_t sys_sem_t
#else
#include <sdk_version.h>
#include <cell/audio.h>
#include <sys/event.h>
#include <sys/synchronization.h>
@ -330,6 +329,11 @@ extern int audioAddData(uint32_t portNum, float *data, uint32_t frames, float vo
#define sys_ppu_thread_join sysThreadJoin
#define sys_ppu_thread_exit sysThreadExit
#define sys_process_exit sysProcessExit
#define sys_game_process_exitspawn sysProcessExitSpawn2
#define SYS_PROCESS_PRIMARY_STACK_SIZE_1M SYS_PROCESS_SPAWN_STACK_SIZE_1M
#define SYS_PPU_THREAD_CREATE_JOINABLE 0 /* FIXME - not sure if this is correct */
#elif defined(__CELLOS_LV2__)
#include <sys/ppu_thread.h>
@ -572,6 +576,7 @@ extern int audioAddData(uint32_t portNum, float *data, uint32_t frames, float vo
#define socketclose close
#define sys_net_initialize_network netInitialize
#define sys_net_finalize_network netFinalizeNetwork
#else
#include <netex/net.h>
#include <np.h>

View File

@ -80,6 +80,13 @@ platform=ngc
MAKEFILE_GRIFFIN=yes
EXT=a
# PSL1GHT
elif [ $PLATFORM = "psl1ght" ] ; then
platform=psl1ght
SALAMANDER=yes
EXT=a
ps3appid=SSNE10001
# DEX PS3
elif [ $PLATFORM = "dex-ps3" ] ; then
platform=ps3
@ -250,7 +257,13 @@ for f in `ls -v *_${platform}.${EXT}`; do
fi
# Move executable files
if [ $platform = "ps3" ] ; then
if [ $platform = "psl1ght" ] ; then
mv -fv ../retroarch_psl1ght.self ../pkg/psl1ght/pkg/USRDIR/cores/"${name}_libretro_${platform}.SELF"
if [ -d ../../dist/info ]; then
mkdir -p ../pkg/psl1ght/USRDIR/cores/info
cp -fv ../../dist/info/"${name}_libretro.info" ../pkg/psl1ght/USRDIR/pkg/cores/info/"${name}_libretro.info"
fi
elif [ $platform = "ps3" ] ; then
if [ $PLATFORM = "ode-ps3" ] ; then
mv -fv ../CORE.SELF ../pkg/${platform}_iso/PS3_GAME/USRDIR/cores/"${name}_libretro_${platform}.SELF"
if [ -d ../../dist/info ]; then
@ -299,7 +312,9 @@ for f in `ls -v *_${platform}.${EXT}`; do
fi
# Remove executable files
if [ $platform = "ps3" ] ; then
if [ $platform = "psl1ght" ] ; then
rm -f ../retroarch_${platform}.elf ../retroarch_${platform}.self ../CORE.SELF
elif [ $platform = "ps3" ] ; then
rm -f ../retroarch_${platform}.elf ../retroarch_${platform}.self ../CORE.SELF
elif [ $PLATFORM = "ps2" ] ; then
rm -f ../retroarchps2.elf
@ -340,7 +355,7 @@ for f in `ls -v *_${platform}.${EXT}`; do
done
# Additional build step
if [ $platform = "ps3" ] ; then
if [ $platform = "ps3" ] || [ $platform = "psl1ght" ] ; then
if [ $PLATFORM = "ode-ps3" ] ; then
echo Deploy : Assets...
if [ -d ../media/assets ]; then
@ -367,29 +382,33 @@ if [ $platform = "ps3" ] ; then
cp -r ../media/shaders_cg/* ../pkg/${platform}_iso/PS3_GAME/USRDIR/cores/shaders_cg
fi
else
ps3pkgdir=pkg/ps3/SSNE10000
if [ $platform = psl1ght ]; then
ps3pkgdir=pkg/psl1ght/pkg
fi
echo Deploy : Assets...
if [ -d ../media/assets ]; then
mkdir -p ../pkg/${platform}/SSNE10000/USRDIR/cores/assets
cp -r ../media/assets/* ../pkg/${platform}/SSNE10000/USRDIR/cores/assets
mkdir -p ../${ps3pkgdir}/USRDIR/cores/assets
cp -r ../media/assets/* ../${ps3pkgdir}/USRDIR/cores/assets
fi
echo Deploy : Databases...
if [ -d ../media/libretrodb/rdb ]; then
mkdir -p ../pkg/${platform}/SSNE10000/USRDIR/cores/database/rdb
cp -r ../media/libretrodb/rdb/* ../pkg/${platform}/SSNE10000/USRDIR/cores/database/rdb
mkdir -p ../${ps3pkgdir}/USRDIR/cores/database/rdb
cp -r ../media/libretrodb/rdb/* ../${ps3pkgdir}/USRDIR/cores/database/rdb
fi
if [ -d ../media/libretrodb/cursors ]; then
mkdir -p ../pkg/${platform}/SSNE10000/USRDIR/cores/database/cursors
cp -r ../media/libretrodb/cursors/* ../pkg/${platform}/SSNE10000/USRDIR/cores/database/cursors
mkdir -p ../${ps3pkgdir}/USRDIR/cores/database/cursors
cp -r ../media/libretrodb/cursors/* ../${ps3pkgdir}/USRDIR/cores/database/cursors
fi
echo Deploy : Overlays...
if [ -d ../media/overlays ]; then
mkdir -p ../pkg/${platform}/SSNE10000/USRDIR/cores/overlays
cp -r ../media/overlays/* ../pkg/${platform}/SSNE10000/USRDIR/cores/overlays
mkdir -p ../${ps3pkgdir}/USRDIR/cores/overlays
cp -r ../media/overlays/* ../${ps3pkgdir}/USRDIR/cores/overlays
fi
echo Deploy : Shaders...
if [ -d ../media/shaders_cg ]; then
mkdir -p ../pkg/${platform}/SSNE10000/USRDIR/cores/shaders_cg
cp -r ../media/shaders_cg/* ../pkg/${platform}/SSNE10000/USRDIR/cores/shaders_cg
mkdir -p ../${ps3pkgdir}/USRDIR/cores/shaders_cg
cp -r ../media/shaders_cg/* ../${ps3pkgdir}/USRDIR/cores/shaders_cg
fi
fi
fi
@ -408,6 +427,8 @@ elif [ $PLATFORM = "cex-ps3" ] ; then
(cd ../tools/ps3/ps3py && python2 setup.py build)
find ../tools/ps3/ps3py/build -name '*.dll' -exec cp {} ../tools/ps3/ps3py \;
../tools/ps3/ps3py/pkg.py --contentid UP0001-SSNE10000_00-0000000000000001 ../pkg/${platform}/SSNE10000/ ../pkg/${platform}/RetroArch.PS3.CEX.PS3.pkg
elif [ $PLATFORM = "psl1ght" ] ; then
pkg.py --contentid UP0001-SSNE10001_00-0000000000000001 ../pkg/psl1ght/pkg/ ../pkg/psl1ght/RetroArch.PSL1GHT.pkg
elif [ $PLATFORM = "ode-ps3" ] ; then
rsync -av ../pkg/${platform}_iso/PS3_GAME/USRDIR/cores/*.SELF ../pkg/${platform}/${PLATFORM}/
$SCETOOL_PATH $SCETOOL_FLAGS_ODE ../retroarch-salamander_${platform}.elf ../pkg/${platform}_iso/PS3_GAME/USRDIR/EBOOT.BIN

View File

@ -17,14 +17,17 @@
#include <stdio.h>
#include <sys/process.h>
#if !defined(__PSL1GHT__)
#include <sysutil/sysutil_common.h>
#ifdef IS_SALAMANDER
#endif
#if defined (IS_SALAMANDER) && !defined(__PSL1GHT__)
#include <netex/net.h>
#include <np.h>
#include <np/drm.h>
#include <cell/sysmodule.h>
#endif
#include <lv2/process.h>
#include <sys/process.h>
#ifdef HAVE_CONFIG_H
@ -45,7 +48,11 @@
#include "../../defaults.h"
#include "../../verbosity.h"
#ifdef __PSL1GHT__
#define EMULATOR_CONTENT_DIR "SSNE10001"
#else
#define EMULATOR_CONTENT_DIR "SSNE10000"
#endif
#ifndef __PSL1GHT__
#define NP_POOL_SIZE (128*1024)
@ -100,6 +107,108 @@ static void callback_sysutil_exit(uint64_t status,
}
#endif
static void fill_derived_paths()
{
strlcpy(g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY],
g_defaults.dirs[DEFAULT_DIR_PORT],
sizeof(g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE],
g_defaults.dirs[DEFAULT_DIR_PORT],
"cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO],
g_defaults.dirs[DEFAULT_DIR_CORE],
"info",
sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SAVESTATE],
g_defaults.dirs[DEFAULT_DIR_CORE],
"savestates", sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SRAM],
g_defaults.dirs[DEFAULT_DIR_CORE],
"savefiles", sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SYSTEM],
g_defaults.dirs[DEFAULT_DIR_CORE],
"system", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SHADER],
g_defaults.dirs[DEFAULT_DIR_CORE],
"shaders_cg", sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER]));
fill_pathname_join(g_defaults.path.config, g_defaults.dirs[DEFAULT_DIR_PORT],
file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY],
g_defaults.dirs[DEFAULT_DIR_CORE],
"overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
#ifdef HAVE_VIDEO_LAYOUT
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT],
g_defaults.dirs[DEFAULT_DIR_CORE],
"layouts", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT]));
#endif
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS],
g_defaults.dirs[DEFAULT_DIR_CORE],
"assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CURSOR],
g_defaults.dirs[DEFAULT_DIR_CORE],
"database/cursors", sizeof(g_defaults.dirs[DEFAULT_DIR_CURSOR]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_DATABASE],
g_defaults.dirs[DEFAULT_DIR_CORE],
"database/rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PLAYLIST],
g_defaults.dirs[DEFAULT_DIR_CORE],
"playlists", sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS],
g_defaults.dirs[DEFAULT_DIR_CORE],
"downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS],
g_defaults.dirs[DEFAULT_DIR_CORE], "cheats",
sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG],
g_defaults.dirs[DEFAULT_DIR_CORE],
"autoconfig", sizeof(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_LOGS],
g_defaults.dirs[DEFAULT_DIR_CORE],
"logs", sizeof(g_defaults.dirs[DEFAULT_DIR_LOGS]));
}
static void use_app_path(char *content_info_path)
{
fill_pathname_join(content_info_path, "/dev_hdd0/game/",
EMULATOR_CONTENT_DIR, PATH_MAX_LENGTH);
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PORT], content_info_path,
"USRDIR", sizeof(g_defaults.dirs[DEFAULT_DIR_PORT]));
}
#ifdef __PSL1GHT__
static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
void *args, void *params_data)
{
#ifndef IS_SALAMANDER
bool original_verbose = verbosity_is_enabled();
verbosity_enable();
#endif
(void)args;
#if defined(HAVE_LOGGER) && !defined(IS_SALAMANDER)
logger_init();
#elif defined(HAVE_FILE_LOGGER)
#ifndef IS_SALAMANDER
retro_main_log_file_init("/dev_hdd0/game/" EMULATOR_CONTENT_DIR "/USRDIR/retroarch-log.txt", false);
#else
retro_main_log_file_init("/dev_hdd0/game/" EMULATOR_CONTENT_DIR "/USRDIR/retroarch-log-salamander.txt", false);
#endif
#endif
char content_info_path[PATH_MAX_LENGTH] = {0};
use_app_path(content_info_path);
fill_derived_paths();
#ifndef IS_SALAMANDER
if (original_verbose)
verbosity_enable();
else
verbosity_disable();
#endif
}
#else
static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
void *args, void *params_data)
{
@ -113,7 +222,7 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
#if defined(HAVE_LOGGER)
logger_init();
#elif defined(HAVE_FILE_LOGGER)
retro_main_log_file_init("/retroarch-log.txt");
retro_main_log_file_init("/dev_hdd0/retroarch-log.txt", false);
#endif
#endif
@ -199,10 +308,7 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
#ifdef HAVE_MULTIMAN
if (multiman_detected)
{
fill_pathname_join(content_info_path, "/dev_hdd0/game/",
EMULATOR_CONTENT_DIR, sizeof(content_info_path));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PORT], content_info_path,
"USRDIR", sizeof(g_defaults.dirs[DEFAULT_DIR_PORT]));
use_app_path(content_info_path);
}
#endif
@ -215,62 +321,7 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
RARCH_LOG("usrDirPath : [%s].\n", g_defaults.dirs[DEFAULT_DIR_PORT]);
}
strlcpy(g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY],
g_defaults.dirs[DEFAULT_DIR_PORT],
sizeof(g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE],
g_defaults.dirs[DEFAULT_DIR_PORT],
"cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO],
g_defaults.dirs[DEFAULT_DIR_CORE],
"info",
sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SAVESTATE],
g_defaults.dirs[DEFAULT_DIR_CORE],
"savestates", sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SRAM],
g_defaults.dirs[DEFAULT_DIR_CORE],
"savefiles", sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SYSTEM],
g_defaults.dirs[DEFAULT_DIR_CORE],
"system", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SHADER],
g_defaults.dirs[DEFAULT_DIR_CORE],
"shaders_cg", sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER]));
fill_pathname_join(g_defaults.path.config, g_defaults.dirs[DEFAULT_DIR_PORT],
file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY],
g_defaults.dirs[DEFAULT_DIR_CORE],
"overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
#ifdef HAVE_VIDEO_LAYOUT
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT],
g_defaults.dirs[DEFAULT_DIR_CORE],
"layouts", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT]));
#endif
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS],
g_defaults.dirs[DEFAULT_DIR_CORE],
"assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CURSOR],
g_defaults.dirs[DEFAULT_DIR_CORE],
"database/cursors", sizeof(g_defaults.dirs[DEFAULT_DIR_CURSOR]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_DATABASE],
g_defaults.dirs[DEFAULT_DIR_CORE],
"database/rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PLAYLIST],
g_defaults.dirs[DEFAULT_DIR_CORE],
"playlists", sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS],
g_defaults.dirs[DEFAULT_DIR_CORE],
"downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS],
g_defaults.dirs[DEFAULT_DIR_CORE], "cheats",
sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG],
g_defaults.dirs[DEFAULT_DIR_CORE],
"autoconfig", sizeof(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_LOGS],
g_defaults.dirs[DEFAULT_DIR_CORE],
"logs", sizeof(g_defaults.dirs[DEFAULT_DIR_LOGS]));
fill_derived_paths();
}
#ifndef IS_SALAMANDER
@ -280,6 +331,7 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
verbosity_disable();
#endif
}
#endif
static void frontend_ps3_init(void *data)
{
@ -401,15 +453,21 @@ static int frontend_ps3_exec_exitspawn(const char *path,
int ret;
unsigned i;
char spawn_data[256];
#ifndef __PSL1GHT__
SceNpDrmKey *license_data = NULL;
#endif
for(i = 0; i < sizeof(spawn_data); ++i)
spawn_data[i] = i & 0xff;
#ifndef __PSL1GHT__
ret = sceNpDrmProcessExitSpawn(license_data, path,
(const char** const)argv, envp, (sys_addr_t)spawn_data,
256, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
#else
ret = -1;
#endif
if(ret < 0)
{
RARCH_WARN("SELF file is not of NPDRM type, trying another approach to boot it...\n");
@ -452,7 +510,9 @@ static void frontend_ps3_exec(const char *path, bool should_load_game)
NULL, NULL);
}
#ifndef __PSL1GHT__
sceNpTerm();
#endif
sys_net_finalize_network();
cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_NP);
cellSysmoduleUnloadModule(CELL_SYSMODULE_NET);
@ -498,7 +558,9 @@ static void frontend_ps3_exitspawn(char *s, size_t len, char *args)
frontend_ps3_exec(s, should_load_game);
#ifdef IS_SALAMANDER
#ifndef __PSL1GHT__
cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_GAME);
#endif
cellSysmoduleLoadModule(CELL_SYSMODULE_FS);
cellSysmoduleLoadModule(CELL_SYSMODULE_IO);
#endif

692
gfx/drivers/gcm_gfx.c Normal file
View File

@ -0,0 +1,692 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2020 Google
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <string.h>
#include <malloc.h>
#include <retro_inline.h>
#include <retro_math.h>
#include <formats/image.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
#ifdef HAVE_MENU
#include "../../menu/menu_driver.h"
#endif
#include "../font_driver.h"
#include "../../configuration.h"
#include "../../command.h"
#include "../../driver.h"
#include "../../retroarch.h"
#include "../../verbosity.h"
#ifndef HAVE_THREADS
#include "../../tasks/tasks_internal.h"
#endif
#include "../../defines/ps3_defines.h"
#include <rsx/rsx.h>
#include <ppu-types.h>
#define CB_SIZE 0x100000
#define HOST_SIZE (32*1024*1024)
#include <ppu-lv2.h>
#include <stdio.h>
#include <malloc.h>
#include <string.h>
#include <unistd.h>
#include <sysutil/video.h>
#include <rsx/gcm_sys.h>
#include <rsx/rsx.h>
#include <io/pad.h>
#include <time.h>
#include <math.h>
#define MAX_BUFFERS 2
typedef struct
{
int height;
int width;
int id;
uint32_t *ptr;
// Internal stuff
uint32_t offset;
} rsxBuffer;
typedef struct
{
float v;
float u;
float y;
float x;
} gcm_scale_vector_t;
typedef struct
{
s16 x0, y0, x1, y1;
s16 u0, v0, u1, v1;
} gcm_vertex_t;
typedef struct gcm_video
{
video_viewport_t vp;
rsxBuffer buffers[MAX_BUFFERS];
rsxBuffer menuBuffers[MAX_BUFFERS];
int currentBuffer, menuBuffer;
gcmContextData *context;
u16 width;
u16 height;
bool menu_frame_enable;
bool rgb32;
bool vsync;
u32 depth_pitch;
u32 depth_offset;
u32 *depth_buffer;
bool smooth;
unsigned rotation;
bool keep_aspect;
bool should_resize;
bool msg_rendering_enabled;
} gcm_video_t;
#ifndef HAVE_THREADS
static bool gcm_tasks_finder(retro_task_t *task,void *userdata)
{
return task;
}
task_finder_data_t gcm_tasks_finder_data = {gcm_tasks_finder, NULL};
#endif
static int
makeBuffer (rsxBuffer * buffer, u16 width, u16 height, int id)
{
int depth = sizeof(u32);
int pitch = depth * width;
int size = depth * width * height;
buffer->ptr = (uint32_t*) rsxMemalign (64, size);
if (buffer->ptr == NULL)
goto error;
if (rsxAddressToOffset (buffer->ptr, &buffer->offset) != 0)
goto error;
/* Register the display buffer with the RSX */
if (gcmSetDisplayBuffer (id, buffer->offset, pitch, width, height) != 0)
goto error;
buffer->width = width;
buffer->height = height;
buffer->id = id;
return TRUE;
error:
if (buffer->ptr != NULL)
rsxFree (buffer->ptr);
return FALSE;
}
static int
flip (gcmContextData *context, s32 buffer)
{
if (gcmSetFlip (context, buffer) == 0) {
rsxFlushBuffer (context);
// Prevent the RSX from continuing until the flip has finished.
gcmSetWaitFlip (context);
return TRUE;
}
return FALSE;
}
#define GCM_LABEL_INDEX 255
static void waitRSXIdle(gcmContextData *context);
static void
waitFlip ()
{
while (gcmGetFlipStatus () != 0)
usleep (200); /* Sleep, to not stress the cpu. */
gcmResetFlipStatus ();
}
static gcmContextData *
initScreen (gcm_video_t* gcm)
{
gcmContextData *context = NULL; /* Context to keep track of the RSX buffer. */
static gcmContextData *saved_context = NULL;
videoState state;
videoConfiguration vconfig;
videoResolution res; /* Screen Resolution */
if (!saved_context) {
/* Allocate a 1Mb buffer, alligned to a 1Mb boundary
* to be our shared IO memory with the RSX. */
void *host_addr = memalign (1024*1024, HOST_SIZE);
if (host_addr == NULL)
goto error;
/* Initilise Reality, which sets up the command buffer and shared IO memory */
context = rsxInit (CB_SIZE, HOST_SIZE, host_addr);
if (context == NULL)
goto error;
saved_context = context;
} else {
context = saved_context;
}
/* Get the state of the display */
if (videoGetState (0, 0, &state) != 0)
goto error;
/* Make sure display is enabled */
if (state.state != 0)
goto error;
/* Get the current resolution */
if (videoGetResolution (state.displayMode.resolution, &res) != 0)
goto error;
/* Configure the buffer format to xRGB */
memset (&vconfig, 0, sizeof(videoConfiguration));
vconfig.resolution = state.displayMode.resolution;
vconfig.format = VIDEO_BUFFER_FORMAT_XRGB;
vconfig.pitch = res.width * sizeof(u32);
vconfig.aspect = state.displayMode.aspect;
gcm->width = res.width;
gcm->height = res.height;
waitRSXIdle(context);
if (videoConfigure (0, &vconfig, NULL, 0) != 0)
goto error;
if (videoGetState (0, 0, &state) != 0)
goto error;
gcmSetFlipMode (GCM_FLIP_VSYNC); // Wait for VSYNC to flip
gcm->depth_pitch = res.width * sizeof(u32);
gcm->depth_buffer = (u32 *) rsxMemalign (64, (res.height * gcm->depth_pitch)* 2);
rsxAddressToOffset (gcm->depth_buffer, &gcm->depth_offset);
gcmResetFlipStatus();
return context;
error:
// if (context)
// rsxFinish (context, 0);
// if (gcm->host_addr)
// free (gcm->host_addr);
return NULL;
}
static void
waitFinish(gcmContextData *context, u32 sLabelVal)
{
rsxSetWriteBackendLabel (context, GCM_LABEL_INDEX, sLabelVal);
rsxFlushBuffer (context);
while(*(vu32 *) gcmGetLabelAddress (GCM_LABEL_INDEX) != sLabelVal)
usleep(30);
sLabelVal++;
}
static void
waitRSXIdle(gcmContextData *context)
{
u32 sLabelVal = 1;
rsxSetWriteBackendLabel (context, GCM_LABEL_INDEX, sLabelVal);
rsxSetWaitLabel (context, GCM_LABEL_INDEX, sLabelVal);
sLabelVal++;
waitFinish(context, sLabelVal);
}
static void* gcm_init(const video_info_t* video,
input_driver_t** input, void** input_data)
{
RARCH_LOG("Reached gcm_init\n");
gcm_video_t* gcm = malloc(sizeof(gcm_video_t));
if (!gcm)
return NULL;
memset(gcm, 0, sizeof(gcm_video_t));
int i;
gcm->context = initScreen (gcm);
for (i = 0; i < MAX_BUFFERS; i++)
makeBuffer( &gcm->buffers[i], gcm->width, gcm->height, i);
for (i = 0; i < MAX_BUFFERS; i++)
makeBuffer( &gcm->menuBuffers[i], gcm->width, gcm->height, i + MAX_BUFFERS);
flip(gcm->context, MAX_BUFFERS - 1);
gcm->vp.x = 0;
gcm->vp.y = 0;
gcm->vp.width = gcm->width;
gcm->vp.height = gcm->height;
gcm->vp.full_width = gcm->width;
gcm->vp.full_height = gcm->height;
gcm->rgb32 = video->rgb32;
video_driver_set_size(gcm->vp.width, gcm->vp.height);
if (input && input_data)
{
void *ps3input = input_ps3.init(ps3_joypad.ident);
*input = ps3input ? &input_ps3 : NULL;
*input_data = ps3input;
}
RARCH_LOG("gcm_init done\n");
return gcm;
}
static void black (uint32_t *dst, uint32_t *dst_end, size_t sz)
{
if (sz > dst_end - dst)
sz = dst_end - dst;
memset (dst, 0, sz * 4);
}
static void blitBuffer(rsxBuffer *buffer, const void *frame, unsigned width,
unsigned height, unsigned pitch, int rgb32, bool do_scaling)
{
if (width > buffer->width)
width = buffer->width;
if (height > buffer->height)
height = buffer->height;
int scale = 1, xofs = 0, yofs = 0;
if (do_scaling) {
scale = buffer->width / width;
if (scale > buffer->height / height)
scale = buffer->height / height;
if (scale >= 10)
scale = 10;
if (scale >= 1) {
xofs = (buffer->width - width * scale) / 2;
yofs = (buffer->height - height * scale) / 2;
} else
scale = 1;
}
// TODO: let rsx do the copy
int i;
int pre_clean = xofs + buffer->width * yofs;
uint32_t *dst = buffer->ptr;
uint32_t *dst_end = buffer->ptr + buffer->width * buffer->height;
memset (dst, 0, pre_clean * 4);
dst += pre_clean;
if (scale == 1) {
if (rgb32) {
const uint8_t *src = frame;
for (i = 0; i < height; i++)
{
memcpy(dst, src, width * 4);
black(dst + width, dst_end, buffer->width - width);
dst += buffer->width;
src += pitch;
}
} else {
const uint16_t *src = frame;
for (i = 0; i < height; i++)
{
for (int j = 0; j < width; j++, src++, dst++) {
u16 rgb565 = *src;
u8 r = ((rgb565 >> 8) & 0xf8);
u8 g = ((rgb565 >> 3) & 0xfc);
u8 b = ((rgb565 << 3) & 0xfc);
*dst = (r<<16) | (g<<8) | b;
}
black(dst, dst_end, buffer->width - width);
dst += buffer->width - width;
src += pitch / 2 - width;
}
}
} else {
if (rgb32) {
const uint32_t *src = frame;
for (i = 0; i < height; i++)
{
for (int j = 0; j < width; j++, src++) {
u32 c = *src;
for (int k = 0; k < scale; k++, dst++)
for (int l = 0; l < scale; l++)
dst[l * buffer->width] = c;
}
for (int l = 0; l < scale; l++)
black(dst + l * buffer->width, dst_end, buffer->width - width * scale);
dst += buffer->width * scale - width * scale;
src += pitch / 4 - width;
}
} else {
const uint16_t *src = frame;
for (i = 0; i < height; i++)
{
for (int j = 0; j < width; j++, src++) {
u16 rgb565 = *src;
u8 r = ((rgb565 >> 8) & 0xf8);
u8 g = ((rgb565 >> 3) & 0xfc);
u8 b = ((rgb565 << 3) & 0xfc);
u32 c = (r<<16) | (g<<8) | b;
for (int k = 0; k < scale; k++, dst++)
for (int l = 0; l < scale; l++)
dst[l * buffer->width] = c;
}
for (int l = 0; l < scale; l++)
black(dst + l * buffer->width, dst_end, buffer->width - width * scale);
dst += buffer->width * scale - width * scale;
src += pitch / 2 - width;
}
}
}
if (dst < dst_end)
memset(dst, 0, 4 * (dst_end - dst));
}
static void gcm_update_screen(gcm_video_t *gcm) {
rsxBuffer *buffer = gcm->menu_frame_enable
? &gcm->menuBuffers[gcm->menuBuffer]
: &gcm->buffers[gcm->currentBuffer];
flip(gcm->context, buffer->id);
if (gcm->vsync)
waitFlip();
#ifdef HAVE_SYSUTILS
cellSysutilCheckCallback();
#endif
}
static bool gcm_frame(void* data, const void* frame,
unsigned width, unsigned height,
uint64_t frame_count,
unsigned pitch, const char* msg, video_frame_info_t *video_info)
{
gcm_video_t *gcm = (gcm_video_t*)data;
if(frame && width && height)
{
gcm->currentBuffer++;
if (gcm->currentBuffer >= MAX_BUFFERS)
gcm->currentBuffer = 0;
blitBuffer(&gcm->buffers[gcm->currentBuffer], frame, width, height, pitch,
gcm->rgb32, true);
}
// TODO: translucid menu
gcm_update_screen(gcm);
return true;
#ifdef HAVE_MENU
if (video_info->statistics_show)
{
struct font_params *osd_params = (struct font_params*)
&video_info->osd_stat_params;
if (osd_params)
{
font_driver_render_msg(gcm, video_info->stat_text,
(const struct font_params*)&video_info->osd_stat_params, NULL);
}
}
#endif
if (msg)
font_driver_render_msg(gcm, msg, NULL, NULL);
return true;
}
static void gcm_set_nonblock_state(void* data, bool toggle,
bool a, unsigned b)
{
gcm_video_t* gcm = (gcm_video_t*)data;
if (gcm)
gcm->vsync = !toggle;
}
static bool gcm_alive(void* data)
{
(void)data;
return true;
}
static bool gcm_focus(void* data)
{
(void)data;
return true;
}
static bool gcm_suppress_screensaver(void* data, bool enable)
{
(void)data;
(void)enable;
return false;
}
static void gcm_free(void* data)
{
gcm_video_t* gcm = (gcm_video_t*)data;
if (!gcm)
return;
gcmSetWaitFlip(gcm->context);
for (int i = 0; i < MAX_BUFFERS; i++)
rsxFree(gcm->buffers[i].ptr);
for (int i = 0; i < MAX_BUFFERS; i++)
rsxFree(gcm->menuBuffers[i].ptr);
//rsxFinish(gcm->context, 1);
// free(gcm->host_addr);
free (gcm);
}
static void gcm_set_texture_frame(void* data, const void* frame, bool rgb32,
unsigned width, unsigned height, float alpha)
{
gcm_video_t* gcm = (gcm_video_t*)data;
int newBuffer = gcm->menuBuffer + 1;
if (newBuffer >= MAX_BUFFERS)
newBuffer = 0;
// TODO: respect alpha
blitBuffer(&gcm->menuBuffers[newBuffer], frame, width, height,
width * (rgb32 ? 4 : 2), rgb32, true);
gcm->menuBuffer = newBuffer;
gcm_update_screen(gcm);
}
static void gcm_set_texture_enable(void* data, bool state, bool full_screen)
{
(void) full_screen;
gcm_video_t* gcm = (gcm_video_t*)data;
if (!gcm)
return;
gcm->menu_frame_enable = state;
gcm_update_screen(gcm);
}
static void gcm_set_rotation(void* data, unsigned rotation)
{
gcm_video_t* gcm = (gcm_video_t*)data;
if (!gcm)
return;
gcm->rotation = rotation;
gcm->should_resize = true;
}
static void gcm_set_filtering(void* data, unsigned index, bool smooth)
{
gcm_video_t* gcm = (gcm_video_t*)data;
if (gcm)
gcm->smooth = smooth;
}
static void gcm_set_aspect_ratio(void* data, unsigned aspect_ratio_idx)
{
gcm_video_t *gcm = (gcm_video_t*)data;
if(!gcm)
return;
gcm->keep_aspect = true;
gcm->should_resize = true;
}
static void gcm_apply_state_changes(void* data)
{
gcm_video_t* gcm = (gcm_video_t*)data;
if (gcm)
gcm->should_resize = true;
}
static void gcm_viewport_info(void* data, struct video_viewport* vp)
{
gcm_video_t* gcm = (gcm_video_t*)data;
if (gcm)
*vp = gcm->vp;
}
static void gcm_set_osd_msg(void *data,
video_frame_info_t *video_info,
const char *msg,
const void *params, void *font)
{
gcm_video_t* gcm = (gcm_video_t*)data;
if (gcm && gcm->msg_rendering_enabled)
font_driver_render_msg(data, msg, params, font);
}
static uint32_t gcm_get_flags(void *data)
{
uint32_t flags = 0;
return flags;
}
static const video_poke_interface_t gcm_poke_interface = {
gcm_get_flags,
NULL, /* load_texture */
NULL, /* unload_texture */
NULL,
NULL,
gcm_set_filtering,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
NULL, /* get_current_framebuffer */
NULL,
gcm_set_aspect_ratio,
gcm_apply_state_changes,
gcm_set_texture_frame,
gcm_set_texture_enable,
gcm_set_osd_msg,
NULL, /* show_mouse */
NULL, /* grab_mouse_toggle */
NULL, /* get_current_shader */
NULL, /* get_current_software_framebuffer */
NULL /* get_hw_render_interface */
};
static void gcm_get_poke_interface(void* data,
const video_poke_interface_t** iface)
{
(void)data;
*iface = &gcm_poke_interface;
}
static bool gcm_set_shader(void* data,
enum rarch_shader_type type, const char* path)
{
(void)data;
(void)type;
(void)path;
return false;
}
video_driver_t video_gcm =
{
gcm_init,
gcm_frame,
gcm_set_nonblock_state,
gcm_alive,
gcm_focus,
gcm_suppress_screensaver,
NULL, /* has_windowed */
gcm_set_shader,
gcm_free,
"gcm",
NULL, /* set_viewport */
gcm_set_rotation,
gcm_viewport_info,
NULL, /* read_viewport */
NULL, /* read_frame_raw */
#ifdef HAVE_OVERLAY
NULL,
#endif
#ifdef HAVE_VIDEO_LAYOUT
NULL,
#endif
gcm_get_poke_interface
};

View File

@ -20,9 +20,7 @@
#include "config.h"
#endif
#ifndef __PSL1GHT__
#include <sys/spu_initialize.h>
#endif
#include <compat/strl.h>

View File

@ -240,7 +240,7 @@ VIDEO CONTEXT
#endif
#if defined(__CELLOS_LV2__)
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
#include "../gfx/drivers_context/ps3_ctx.c"
#elif defined(ANDROID)
#include "../gfx/drivers_context/android_ctx.c"
@ -488,7 +488,9 @@ VIDEO DRIVER
#include "../gfx/drivers/xvideo.c"
#endif
#if defined(GEKKO)
#if defined(__PSL1GHT__)
#include "../gfx/drivers/gcm_gfx.c"
#elif defined(GEKKO)
#include "../gfx/drivers/gx_gfx.c"
#elif defined(PSP)
#include "../gfx/drivers/psp1_gfx.c"
@ -648,8 +650,12 @@ INPUT
#include "../input/input_autodetect_builtin.c"
#if defined(__CELLOS_LV2__)
#ifdef __PSL1GHT__
#include "../input/drivers/psl1ght_input.c"
#else
#include "../input/drivers/ps3_input.c"
#include "../input/drivers_joypad/ps3_joypad.c"
#endif
#elif defined(SN_TARGET_PSP2) || defined(PSP) || defined(VITA)
#include "../input/drivers/psp_input.c"
#include "../input/drivers_joypad/psp_joypad.c"

View File

@ -31,10 +31,8 @@
#include "../input_driver.h"
#ifdef HAVE_MOUSE
#ifndef __PSL1GHT__
#define MAX_MICE 7
#endif
#endif
/* TODO/FIXME -
* fix game focus toggle */

View File

@ -0,0 +1,407 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - Daniel De Matteis
* Copyright (C) 2020 Google
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <stdlib.h>
#include <boolean.h>
#include <libretro.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
#include "../../defines/ps3_defines.h"
#include "../input_driver.h"
#include <retro_inline.h>
#include "../../config.def.h"
#include "../../tasks/tasks_internal.h"
#ifdef HAVE_MOUSE
#define MAX_MICE 7
#endif
/* TODO/FIXME -
* fix game focus toggle */
typedef struct
{
float x;
float y;
float z;
} sensor_t;
typedef struct ps3_input
{
#ifdef HAVE_MOUSE
unsigned mice_connected;
#endif
const input_device_driver_t *joypad;
} ps3_input_t;
static void ps3_input_poll(void *data)
{
ps3_input_t *ps3 = (ps3_input_t*)data;
if (ps3 && ps3->joypad)
ps3->joypad->poll();
}
#ifdef HAVE_MOUSE
static int16_t ps3_mouse_device_state(ps3_input_t *ps3,
unsigned user, unsigned id)
{
RARCH_LOG("alive " __FILE__ ":%d\n", __LINE__);
}
#endif
static int16_t ps3_input_state(void *data,
rarch_joypad_info_t *joypad_info,
const struct retro_keybind **binds,
unsigned port, unsigned device,
unsigned idx, unsigned id)
{
ps3_input_t *ps3 = (ps3_input_t*)data;
if (!ps3)
return 0;
switch (device)
{
case RETRO_DEVICE_JOYPAD:
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
unsigned i;
int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
/* Auto-binds are per joypad, not per user. */
const uint64_t joykey = (binds[port][i].joykey != NO_BTN)
? binds[port][i].joykey : joypad_info->auto_binds[i].joykey;
const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE)
? binds[port][i].joyaxis : joypad_info->auto_binds[i].joyaxis;
if ((uint16_t)joykey != NO_BTN && ps3->joypad->button(
joypad_info->joy_idx, (uint16_t)joykey))
{
ret |= (1 << i);
continue;
}
else if (((float)abs(ps3->joypad->axis(
joypad_info->joy_idx, joyaxis)) / 0x8000) > joypad_info->axis_threshold)
{
ret |= (1 << i);
continue;
}
}
return ret;
}
else
{
/* Auto-binds are per joypad, not per user. */
const uint64_t joykey = (binds[port][id].joykey != NO_BTN)
? binds[port][id].joykey : joypad_info->auto_binds[id].joykey;
const uint32_t joyaxis = (binds[port][id].joyaxis != AXIS_NONE)
? binds[port][id].joyaxis : joypad_info->auto_binds[id].joyaxis;
if ((uint16_t)joykey != NO_BTN && ps3->joypad->button(
joypad_info->joy_idx, (uint16_t)joykey))
return true;
if (((float)abs(ps3->joypad->axis(joypad_info->joy_idx, joyaxis)) / 0x8000) > joypad_info->axis_threshold)
return true;
}
break;
case RETRO_DEVICE_ANALOG:
if (binds[port])
return input_joypad_analog(ps3->joypad, joypad_info, port, idx, id, binds[port]);
break;
}
return 0;
}
static void ps3_input_free_input(void *data)
{
RARCH_LOG("alive " __FILE__ ":%d\n", __LINE__);
}
static void* ps3_input_init(const char *joypad_driver)
{
ps3_input_t *ps3 = (ps3_input_t*)calloc(1, sizeof(*ps3));
if (!ps3)
return NULL;
ps3->joypad = input_joypad_init_driver(joypad_driver, ps3);
if (ps3->joypad)
ps3->joypad->init(ps3);
return ps3;
}
static uint64_t ps3_input_get_capabilities(void *data)
{
(void)data;
return
#ifdef HAVE_MOUSE
(1 << RETRO_DEVICE_MOUSE) |
#endif
(1 << RETRO_DEVICE_JOYPAD) |
(1 << RETRO_DEVICE_ANALOG);
}
static bool ps3_input_set_sensor_state(void *data, unsigned port,
enum retro_sensor_action action, unsigned event_rate)
{
RARCH_LOG("alive " __FILE__ ":%d\n", __LINE__);
return false;
}
static bool ps3_input_set_rumble(void *data, unsigned port,
enum retro_rumble_effect effect, uint16_t strength)
{
RARCH_LOG("alive " __FILE__ ":%d\n", __LINE__);
return false;
}
static const input_device_driver_t *ps3_input_get_joypad_driver(void *data)
{
ps3_input_t *ps3 = (ps3_input_t*)data;
if (ps3)
return ps3->joypad;
return NULL;
}
static void ps3_input_grab_mouse(void *data, bool state)
{
(void)data;
(void)state;
}
input_driver_t input_ps3 = {
ps3_input_init,
ps3_input_poll,
ps3_input_state,
ps3_input_free_input,
ps3_input_set_sensor_state,
NULL,
ps3_input_get_capabilities,
"ps3",
ps3_input_grab_mouse,
NULL,
ps3_input_set_rumble,
ps3_input_get_joypad_driver,
NULL,
false
};
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
static padData pad_state[MAX_PADS];
static bool pads_connected[MAX_PADS];
static INLINE int16_t convert_u8_to_s16(uint8_t val)
{
if (val == 0)
return -0x7fff;
return val * 0x0101 - 0x8000;
}
static const char *ps3_joypad_name(unsigned pad)
{
return "SixAxis Controller";
}
static void ps3_joypad_autodetect_add(unsigned autoconf_pad)
{
input_autoconfigure_connect(
ps3_joypad_name(autoconf_pad),
NULL,
ps3_joypad.ident,
autoconf_pad,
0,
0
);
}
static bool ps3_joypad_init(void *data)
{
(void)data;
ioPadInit(7);
return true;
}
static u16 transform_buttons(const padData *data) {
return (
(data->BTN_CROSS << RETRO_DEVICE_ID_JOYPAD_B)
| (data->BTN_SQUARE << RETRO_DEVICE_ID_JOYPAD_Y)
| (data->BTN_SELECT << RETRO_DEVICE_ID_JOYPAD_SELECT)
| (data->BTN_START << RETRO_DEVICE_ID_JOYPAD_START)
| (data->BTN_UP << RETRO_DEVICE_ID_JOYPAD_UP)
| (data->BTN_DOWN << RETRO_DEVICE_ID_JOYPAD_DOWN)
| (data->BTN_LEFT << RETRO_DEVICE_ID_JOYPAD_LEFT)
| (data->BTN_RIGHT << RETRO_DEVICE_ID_JOYPAD_RIGHT)
| (data->BTN_CIRCLE << RETRO_DEVICE_ID_JOYPAD_A)
| (data->BTN_TRIANGLE << RETRO_DEVICE_ID_JOYPAD_X)
| (data->BTN_L1 << RETRO_DEVICE_ID_JOYPAD_L)
| (data->BTN_R1 << RETRO_DEVICE_ID_JOYPAD_R)
| (data->BTN_L2 << RETRO_DEVICE_ID_JOYPAD_L2)
| (data->BTN_R2 << RETRO_DEVICE_ID_JOYPAD_R2)
| (data->BTN_L3 << RETRO_DEVICE_ID_JOYPAD_L3)
| (data->BTN_R3 << RETRO_DEVICE_ID_JOYPAD_R3)
);
}
static bool ps3_joypad_button(unsigned port_num, uint16_t joykey)
{
if (port_num >= MAX_PADS)
return false;
return !!(transform_buttons(&pad_state[port_num]) & (UINT64_C(1) << joykey));
}
static void ps3_joypad_get_buttons(unsigned port_num, input_bits_t *state)
{
if (port_num < MAX_PADS)
{
u16 v = transform_buttons(&pad_state[port_num]);
BITS_COPY16_PTR( state, v);
}
else
BIT256_CLEAR_ALL_PTR(state);
}
static int16_t ps3_joypad_axis(unsigned port_num, uint32_t joyaxis)
{
int val = 0x80;
int axis = -1;
bool is_neg = false;
bool is_pos = false;
if (joyaxis == AXIS_NONE || port_num >= DEFAULT_MAX_PADS)
return 0;
if (AXIS_NEG_GET(joyaxis) < 4)
{
axis = AXIS_NEG_GET(joyaxis);
is_neg = true;
}
else if (AXIS_POS_GET(joyaxis) < 4)
{
axis = AXIS_POS_GET(joyaxis);
is_pos = true;
}
switch (axis)
{
case 0:
val = pad_state[port_num].ANA_L_H;
break;
case 1:
val = pad_state[port_num].ANA_L_V;
break;
case 2:
val = pad_state[port_num].ANA_R_H;
break;
case 3:
val = pad_state[port_num].ANA_R_V;
break;
}
val = (val - 0x7f) * 0xff;
if (is_neg && val > 0)
val = 0;
else if (is_pos && val < 0)
val = 0;
return val;
}
static void ps3_joypad_poll(void)
{
padInfo padinfo;
ioPadGetInfo(&padinfo);
for(int port=0; port<MAX_PADS; port++){
if(padinfo.status[port]){
ioPadGetData(port, &pad_state[port]);
}
if (!pads_connected[port] && padinfo.status[port]) {
ps3_joypad_autodetect_add(port);
pads_connected[port] = 1;
} else
{
input_autoconfigure_disconnect(port, ps3_joypad.ident);
pads_connected[port] = 0;
}
pads_connected[port] = padinfo.status[port];
}
}
static bool ps3_joypad_query_pad(unsigned pad)
{
return pad < MAX_USERS && transform_buttons(&pad_state[pad]);
}
static bool ps3_joypad_rumble(unsigned pad,
enum retro_rumble_effect effect, uint16_t strength)
{
RARCH_LOG("alive " __FILE__ ":%d\n", __LINE__);
return true;
}
static void ps3_joypad_destroy(void)
{
RARCH_LOG("alive " __FILE__ ":%d\n", __LINE__);
}
input_device_driver_t ps3_joypad = {
ps3_joypad_init,
ps3_joypad_query_pad,
ps3_joypad_destroy,
ps3_joypad_button,
ps3_joypad_get_buttons,
ps3_joypad_axis,
ps3_joypad_poll,
ps3_joypad_rumble,
ps3_joypad_name,
"ps3",
};

View File

@ -158,24 +158,6 @@ static void ps3_joypad_poll(void)
{
uint64_t *state_cur = &pad_state[port];
*state_cur = 0;
#ifdef __PSL1GHT__
*state_cur |= (state_tmp.BTN_LEFT) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_LEFT) : 0;
*state_cur |= (state_tmp.BTN_DOWN) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_DOWN) : 0;
*state_cur |= (state_tmp.BTN_RIGHT) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_RIGHT) : 0;
*state_cur |= (state_tmp.BTN_UP) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_UP) : 0;
*state_cur |= (state_tmp.BTN_START) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_START) : 0;
*state_cur |= (state_tmp.BTN_R3) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_R3) : 0;
*state_cur |= (state_tmp.BTN_L3) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_L3) : 0;
*state_cur |= (state_tmp.BTN_SELECT) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_SELECT) : 0;
*state_cur |= (state_tmp.BTN_TRIANGLE) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_X) : 0;
*state_cur |= (state_tmp.BTN_SQUARE) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_Y) : 0;
*state_cur |= (state_tmp.BTN_CROSS) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_B) : 0;
*state_cur |= (state_tmp.BTN_CIRCLE) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_A) : 0;
*state_cur |= (state_tmp.BTN_R1) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_R) : 0;
*state_cur |= (state_tmp.BTN_L1) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_L) : 0;
*state_cur |= (state_tmp.BTN_R2) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_R2) : 0;
*state_cur |= (state_tmp.BTN_L2) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_L2) : 0;
#else
*state_cur |= (state_tmp.button[CELL_PAD_BTN_OFFSET_DIGITAL1] & CELL_PAD_CTRL_LEFT) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_LEFT) : 0;
*state_cur |= (state_tmp.button[CELL_PAD_BTN_OFFSET_DIGITAL1] & CELL_PAD_CTRL_DOWN) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_DOWN) : 0;
*state_cur |= (state_tmp.button[CELL_PAD_BTN_OFFSET_DIGITAL1] & CELL_PAD_CTRL_RIGHT) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_RIGHT) : 0;
@ -222,7 +204,6 @@ static void ps3_joypad_poll(void)
accelerometer_state[port].x = state_tmp.button[CELL_PAD_BTN_OFFSET_SENSOR_X];
accelerometer_state[port].y = state_tmp.button[CELL_PAD_BTN_OFFSET_SENSOR_Y];
accelerometer_state[port].z = state_tmp.button[CELL_PAD_BTN_OFFSET_SENSOR_Z];
#endif
#endif
}

View File

@ -39,6 +39,10 @@
#include <windows.h>
#endif
#ifdef __PSL1GHT__
#include <lv2/systime.h>
#endif
#if defined(__CELLOS_LV2__) || ( defined(__OpenBSD__) && defined(__powerpc__) )
#ifndef _PPU_INTRINSICS_H
#include <ppu_intrinsics.h>
@ -226,6 +230,8 @@ retro_time_t cpu_features_get_time_usec(void)
if (!QueryPerformanceCounter(&count))
return 0;
return (count.QuadPart / freq.QuadPart * 1000000) + (count.QuadPart % freq.QuadPart * 1000000 / freq.QuadPart);
#elif defined(__PSL1GHT__)
return sysGetSystemTime();
#elif defined(__CELLOS_LV2__)
return sys_time_get_system_time();
#elif defined(GEKKO)
@ -234,7 +240,7 @@ retro_time_t cpu_features_get_time_usec(void)
return ticks_to_us(OSGetSystemTime());
#elif defined(SWITCH) || defined(HAVE_LIBNX)
return (svcGetSystemTick() * 10) / 192;
#elif defined(_POSIX_MONOTONIC_CLOCK) || defined(__QNX__) || defined(ANDROID) || defined(__MACH__)
#elif defined(_POSIX_MONOTONIC_CLOCK) || defined(__QNX__) || defined(ANDROID) || defined(__MACH__) || defined(__PSL1GHT__)
struct timespec tv = {0};
if (ra_clock_gettime(CLOCK_MONOTONIC, &tv) < 0)
return 0;
@ -492,7 +498,7 @@ unsigned cpu_features_get_core_amount(void)
return sysinfo.dwNumberOfProcessors;
#elif defined(GEKKO)
return 1;
#elif defined(PSP) || defined(PS2)
#elif defined(PSP) || defined(PS2) || defined(__CELLOS_LV2__)
return 1;
#elif defined(VITA)
return 4;

View File

@ -85,7 +85,7 @@
#include <fileXio.h>
#endif
#if defined(__CELLOS_LV2__)
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
#include <cell/cell_fs.h>
#endif

View File

@ -87,7 +87,7 @@
#include <fileXio.h>
#endif
#if defined(__CELLOS_LV2__)
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
#include <cell/cell_fs.h>
#endif

View File

@ -39,7 +39,7 @@
#include <Xtl.h>
#endif
#if defined(__CELLOS_LV2__)
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
#include <sys/fs_external.h>
#endif
@ -75,7 +75,7 @@ static INLINE bool bits_any_set(uint32_t* ptr, uint32_t count)
}
#ifndef PATH_MAX_LENGTH
#if defined(__CELLOS_LV2__)
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
#define PATH_MAX_LENGTH CELL_FS_MAX_FS_PATH_LENGTH
#elif defined(_XBOX1) || defined(_3DS) || defined(PSP) || defined(PS2) || defined(GEKKO)|| defined(WIIU) || defined(ORBIS)
#define PATH_MAX_LENGTH 512

View File

@ -68,7 +68,7 @@
# endif
#endif
#ifdef __CELLOS_LV2__
#if defined (__CELLOS_LV2__) && !defined(__PSL1GHT__)
#include <cell/cell_fs.h>
#define O_RDONLY CELL_FS_O_RDONLY
#define O_WRONLY CELL_FS_O_WRONLY
@ -151,7 +151,7 @@
#include <fileXio.h>
#endif
#if defined(__CELLOS_LV2__)
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
#include <cell/cell_fs.h>
#endif
@ -949,7 +949,7 @@ int retro_vfs_stat_impl(const char *path, int32_t *size)
return RETRO_VFS_STAT_IS_VALID | (is_dir ? RETRO_VFS_STAT_IS_DIRECTORY : 0) | (is_character_special ? RETRO_VFS_STAT_IS_CHARACTER_SPECIAL : 0);
#elif defined(__CELLOS_LV2__)
#elif defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
/* CellOS Lv2 */
bool is_dir;
bool is_character_special = false;
@ -1095,7 +1095,7 @@ struct libretro_vfs_implementation_dir
#elif defined(PS2)
int directory;
iox_dirent_t entry;
#elif defined(__CELLOS_LV2__)
#elif defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
CellFsErrno error;
int directory;
CellFsDirent entry;
@ -1114,7 +1114,7 @@ static bool dirent_check_error(libretro_vfs_implementation_dir *rdir)
return (rdir->directory == INVALID_HANDLE_VALUE);
#elif defined(VITA) || defined(PSP) || defined(PS2) || defined(ORBIS)
return (rdir->directory < 0);
#elif defined(__CELLOS_LV2__)
#elif defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
return (rdir->error != CELL_FS_SUCCEEDED);
#else
return !(rdir->directory);
@ -1181,7 +1181,7 @@ 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(__CELLOS_LV2__)
#elif defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
rdir->error = cellFsOpendir(name, &rdir->directory);
#elif defined(ORBIS)
rdir->directory = orbisDopen(name);
@ -1223,7 +1223,7 @@ bool retro_vfs_readdir_impl(libretro_vfs_implementation_dir *rdir)
int ret = ps2fileXioDread(rdir->directory, &record);
rdir->entry = record;
return ( ret > 0);
#elif defined(__CELLOS_LV2__)
#elif defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
uint64_t nread;
rdir->error = cellFsReaddir(rdir->directory, &rdir->entry, &nread);
return (nread != 0);
@ -1257,7 +1257,7 @@ const char *retro_vfs_dirent_get_name_impl(libretro_vfs_implementation_dir *rdir
}
#endif
return (char*)rdir->entry.cFileName;
#elif defined(VITA) || defined(PSP) || defined(__CELLOS_LV2__) || defined(ORBIS)
#elif defined(VITA) || defined(PSP) || defined(__CELLOS_LV2__) && !defined(__PSL1GHT__) || defined(ORBIS)
return rdir->entry.d_name;
#elif defined(PS2)
return rdir->entry.name;
@ -1283,7 +1283,7 @@ bool retro_vfs_dirent_is_dir_impl(libretro_vfs_implementation_dir *rdir)
#elif defined(PS2)
const iox_dirent_t *entry = (const iox_dirent_t*)&rdir->entry;
return FIO_S_ISDIR(entry->stat.mode);
#elif defined(__CELLOS_LV2__)
#elif defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
CellFsDirent *entry = (CellFsDirent*)&rdir->entry;
return (entry->d_type == CELL_FS_TYPE_DIRECTORY);
#elif defined(ORBIS)
@ -1324,7 +1324,7 @@ int retro_vfs_closedir_impl(libretro_vfs_implementation_dir *rdir)
sceIoDclose(rdir->directory);
#elif defined(PS2)
ps2fileXioDclose(rdir->directory);
#elif defined(__CELLOS_LV2__)
#elif defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
rdir->error = cellFsClosedir(rdir->directory);
#elif defined(ORBIS)
orbisDclose(rdir->directory);

View File

@ -43,7 +43,7 @@
#include "../config.def.h"
#include "../config.def.keybinds.h"
#if defined(__CELLOS_LV2__)
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
#include <sdk_version.h>
#if (CELL_SDK_VERSION > 0x340000)

BIN
pkg/psl1ght/pkg/ICON0.PNG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
pkg/psl1ght/pkg/PARAM.SFO Normal file

Binary file not shown.

View File

View File

View File

View File

@ -435,6 +435,9 @@ static video_driver_t video_null = {
};
static const video_driver_t *video_drivers[] = {
#ifdef __PSL1GHT__
&video_gcm,
#endif
#ifdef HAVE_VITA2D
&video_vita2d,
#endif
@ -559,7 +562,7 @@ static const gfx_ctx_driver_t *gfx_ctx_drivers[] = {
#if defined(HAVE_LIBNX) && defined(HAVE_OPENGL)
&switch_ctx,
#endif
#if defined(__CELLOS_LV2__)
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
&gfx_ctx_ps3,
#endif
#if defined(HAVE_VIDEOCORE)

View File

@ -1862,6 +1862,7 @@ extern video_driver_t video_psp1;
extern video_driver_t video_vita2d;
extern video_driver_t video_ps2;
extern video_driver_t video_ctr;
extern video_driver_t video_gcm;
extern video_driver_t video_switch;
extern video_driver_t video_d3d8;
extern video_driver_t video_d3d9;