[PSP] Update Retroarch to latest PSPDev status (#13544)

* Added newlib changes

* Add action to launch PPSSPP simulator

* Remove legacy config for the stack and heap

* Add pthread

* Simplify kernel_functions and improve references to HAVE_KERNEL_PRX

* Add some flags

* Improve audio init/deinit

* Improve exit by clicking home

* Add CI for PSP1

* Update PSP.yml
This commit is contained in:
Francisco Javier Trujillo Mata 2022-01-25 03:50:18 +01:00 committed by GitHub
parent 17362e3692
commit 86b47b4859
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 117 additions and 140 deletions

44
.github/workflows/PSP.yml vendored Normal file
View File

@ -0,0 +1,44 @@
name: CI PSP
on:
push:
pull_request:
repository_dispatch:
types: [run_build]
jobs:
build:
runs-on: ubuntu-latest
container:
image: git.libretro.com:5050/libretro-infrastructure/libretro-build-psp:latest
options: --user root
steps:
- uses: actions/checkout@v2
- name: Compile bootstrap
run: |
cd bootstrap/psp1/kernel_functions_prx
make -j$(getconf _NPROCESSORS_ONLN) clean
make -j$(getconf _NPROCESSORS_ONLN)
- name: Compile Salamander
run: |
make -f Makefile.psp1.salamander -j$(getconf _NPROCESSORS_ONLN) clean
make -f Makefile.psp1.salamander -j$(getconf _NPROCESSORS_ONLN)
- name: Compile RA
run: |
make -f Makefile.psp1 -j$(getconf _NPROCESSORS_ONLN) clean
make -f Makefile.psp1 -j$(getconf _NPROCESSORS_ONLN) HAVE_STATIC_DUMMY=1
- name: Get short SHA
id: slug
run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"
- uses: actions/upload-artifact@v2
with:
name: RA-PSP-dummy-${{ steps.slug.outputs.sha8 }}
path: |
kernel_functions.prx
EBOOT.PBP

View File

@ -4,8 +4,8 @@ DEBUG ?= 0
HAVE_KERNEL_PRX ?= 1 HAVE_KERNEL_PRX ?= 1
HAVE_THREADS ?= 1 HAVE_THREADS ?= 1
BIG_STACK ?= 0 BIG_STACK ?= 0
WHOLE_ARCHIVE_LINK ?= 0
LOAD_WITHOUT_CORE_INFO ?= 0 LOAD_WITHOUT_CORE_INFO ?= 0
HAVE_STATIC_DUMMY ?= 0
TARGET = retroarchpsp TARGET = retroarchpsp
@ -15,13 +15,8 @@ else
OPTIMIZE_LV := -O3 OPTIMIZE_LV := -O3
endif endif
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
WHOLE_START := -Wl,--whole-archive
WHOLE_END := -Wl,--no-whole-archive
endif
INCDIR = deps deps/stb deps/7zip libretro-common/include libretro-common/include/compat/zlib INCDIR = deps deps/stb deps/7zip libretro-common/include libretro-common/include/compat/zlib
CFLAGS = $(OPTIMIZE_LV) -G0 -std=gnu99 -ffast-math -fsingle-precision-constant CFLAGS = $(OPTIMIZE_LV) -ffast-math -fsingle-precision-constant
ASFLAGS = $(CFLAGS) ASFLAGS = $(CFLAGS)
RARCH_DEFINES = -DPSP \ RARCH_DEFINES = -DPSP \
@ -51,14 +46,21 @@ RARCH_DEFINES = -DPSP \
-DHAVE_CORE_INFO_CACHE -DHAVE_CORE_INFO_CACHE
LIBDIR = LIBDIR =
LDFLAGS = LDFLAGS = -L$(shell psp-config --psp-prefix)
LIBS = $(WHOLE_START) -lretro_psp1 $(WHOLE_END) -lstdc++ -lpspgu -lpspgum -lm -lpspaudio -lpspfpu -lpsppower -lpsprtc -lpthread-psp
ifeq ($(HAVE_STATIC_DUMMY),1)
RARCH_DEFINES += -DHAVE_STATIC_DUMMY
else
LIBS += -lretro_psp1
endif
LIBS += -lstdc++ -lpspgu -lpspgum -lpspaudio -lpspfpu -lpsppower -lpsprtc -lpthread
ifeq ($(HAVE_THREADS), 1) ifeq ($(HAVE_THREADS), 1)
RARCH_DEFINES += -DHAVE_THREADS RARCH_DEFINES += -DHAVE_THREADS
endif endif
ifeq ($(HAVE_KERNEL_PRX), 1) ifeq ($(HAVE_KERNEL_PRX), 1)
OBJS += bootstrap/psp1/kernel_functions.o
CFLAGS += -DHAVE_KERNEL_PRX CFLAGS += -DHAVE_KERNEL_PRX
endif endif
@ -75,9 +77,7 @@ CFLAGS += $(RARCH_DEFINES)
EXTRA_TARGETS = EBOOT.PBP EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = RetroArch PSP1 PSP_EBOOT_TITLE = RetroArch PSP1
PSP_OBJECTS = griffin/griffin.o bootstrap/psp1/kernel_functions.o OBJS += griffin/griffin.o
OBJS = $(PSP_OBJECTS)
PSPSDK=$(shell psp-config --pspsdk-path) PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak include $(PSPSDK)/lib/build.mak
@ -96,3 +96,6 @@ pspsh-run:
debug: clean all pspsh-debug debug: clean all pspsh-debug
run: clean all pspsh-run run: clean all pspsh-run
sim:
/Applications/PPSSPPSDL.app/Contents/MacOS/PPSSPPSDL $(shell pwd)/EBOOT.PBP

View File

@ -1,5 +1,6 @@
BUILD_PRX = 0 BUILD_PRX = 0
PSP_LARGE_MEMORY = 1 PSP_LARGE_MEMORY = 1
HAVE_KERNEL_PRX = 1
DEBUG = 0 DEBUG = 0
TARGET = retroarchpsp_salamander TARGET = retroarchpsp_salamander
@ -7,18 +8,18 @@ TARGET = retroarchpsp_salamander
ifeq ($(DEBUG), 1) ifeq ($(DEBUG), 1)
OPTIMIZE_LV := -O0 -g OPTIMIZE_LV := -O0 -g
else else
OPTIMIZE_LV := -O2 OPTIMIZE_LV := -O3
endif endif
INCDIR = $(PSPPATH)/include libretro-common/include INCDIR = $(PSPPATH)/include libretro-common/include
CFLAGS = $(OPTIMIZE_LV) -G0 -std=gnu99 -ffast-math CFLAGS = $(OPTIMIZE_LV) -ffast-math -fsingle-precision-constant
ASFLAGS = $(CFLAGS) ASFLAGS = $(CFLAGS)
RARCH_DEFINES = -DPSP -DIS_SALAMANDER -DRARCH_CONSOLE RARCH_DEFINES = -DPSP -DIS_SALAMANDER -DRARCH_CONSOLE
LIBDIR = LIBDIR =
LDFLAGS = LDFLAGS =
LIBS = -lstdc++ -lm -lpsppower LIBS = -lstdc++ -lpsppower
CFLAGS += $(RARCH_DEFINES) CFLAGS += $(RARCH_DEFINES)
@ -45,8 +46,12 @@ OBJS = frontend/frontend_salamander.o \
libretro-common/vfs/vfs_implementation.o \ libretro-common/vfs/vfs_implementation.o \
libretro-common/hash/lrc_hash.o \ libretro-common/hash/lrc_hash.o \
libretro-common/time/rtime.o \ libretro-common/time/rtime.o \
verbosity.o \ verbosity.o
bootstrap/psp1/kernel_functions.o
ifeq ($(HAVE_KERNEL_PRX), 1)
OBJS += bootstrap/psp1/kernel_functions.o
CFLAGS += -DHAVE_KERNEL_PRX
endif
PSPSDK=$(shell psp-config --pspsdk-path) PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak include $(PSPSDK)/lib/build.mak

View File

@ -54,7 +54,7 @@ typedef struct psp_audio
SceUID thread; SceUID thread;
int rate; int port;
volatile uint16_t read_pos; volatile uint16_t read_pos;
volatile uint16_t write_pos; volatile uint16_t write_pos;
@ -67,22 +67,27 @@ typedef struct psp_audio
#define AUDIO_BUFFER_SIZE (1u<<13u) #define AUDIO_BUFFER_SIZE (1u<<13u)
#define AUDIO_BUFFER_SIZE_MASK (AUDIO_BUFFER_SIZE-1) #define AUDIO_BUFFER_SIZE_MASK (AUDIO_BUFFER_SIZE-1)
/* Return port used */
static int configureAudio(unsigned rate) {
int port;
#if defined(VITA)
port = sceAudioOutOpenPort(
SCE_AUDIO_OUT_PORT_TYPE_MAIN, AUDIO_OUT_COUNT,
rate, SCE_AUDIO_OUT_MODE_STEREO);
#elif defined(ORBIS)
port = sceAudioOutOpen(0xff,
SCE_AUDIO_OUT_PORT_TYPE_MAIN, 0, AUDIO_OUT_COUNT,
rate, SCE_AUDIO_OUT_MODE_STEREO);
#else
port = sceAudioSRCChReserve(AUDIO_OUT_COUNT, rate, 2);
#endif
return port;
}
static void audioMainLoop(void *data) static void audioMainLoop(void *data)
{ {
psp_audio_t* psp = (psp_audio_t*)data; psp_audio_t* psp = (psp_audio_t*)data;
#if defined(VITA)
int port = sceAudioOutOpenPort(
SCE_AUDIO_OUT_PORT_TYPE_MAIN, AUDIO_OUT_COUNT,
psp->rate, SCE_AUDIO_OUT_MODE_STEREO);
#elif defined(ORBIS)
int port = sceAudioOutOpen(0xff,
SCE_AUDIO_OUT_PORT_TYPE_MAIN, 0, AUDIO_OUT_COUNT,
psp->rate, SCE_AUDIO_OUT_MODE_STEREO);
#else
sceAudioSRCChReserve(AUDIO_OUT_COUNT, psp->rate, 2);
#endif
while (psp->running) while (psp->running)
{ {
bool cond = false; bool cond = false;
@ -107,7 +112,7 @@ static void audioMainLoop(void *data)
slock_unlock(psp->cond_lock); slock_unlock(psp->cond_lock);
#if defined(VITA) || defined(ORBIS) #if defined(VITA) || defined(ORBIS)
sceAudioOutOutput(port, sceAudioOutOutput(psp->port,
cond ? (psp->zeroBuffer) cond ? (psp->zeroBuffer)
: (psp->buffer + read_pos_2)); : (psp->buffer + read_pos_2));
#else #else
@ -116,14 +121,6 @@ static void audioMainLoop(void *data)
#endif #endif
} }
#if defined(VITA)
sceAudioOutReleasePort(port);
#elif defined(ORBIS)
sceAudioOutClose(port);
#else
sceAudioSRCChRelease();
#endif
return; return;
} }
@ -137,8 +134,9 @@ static void *psp_audio_init(const char *device,
if (!psp) if (!psp)
return NULL; return NULL;
(void)device; int port = configureAudio(rate);
(void)latency; if (port < 0)
return NULL;
#ifdef ORBIS #ifdef ORBIS
psp->buffer = (uint32_t*) psp->buffer = (uint32_t*)
@ -161,7 +159,7 @@ static void *psp_audio_init(const char *device,
psp->read_pos = 0; psp->read_pos = 0;
psp->write_pos = 0; psp->write_pos = 0;
psp->rate = rate; psp->port = port;
psp->fifo_lock = slock_new(); psp->fifo_lock = slock_new();
psp->cond_lock = slock_new(); psp->cond_lock = slock_new();
@ -197,7 +195,17 @@ static void psp_audio_free(void *data)
free(psp->buffer); free(psp->buffer);
psp->worker_thread = NULL; psp->worker_thread = NULL;
free(psp->zeroBuffer); free(psp->zeroBuffer);
#if defined(VITA)
sceAudioOutReleasePort(psp->port);
#elif defined(ORBIS)
sceAudioOutClose(psp->port);
#else
sceAudioSRCChRelease();
#endif
free(psp); free(psp);
} }
static ssize_t psp_audio_write(void *data, const void *buf, size_t size) static ssize_t psp_audio_write(void *data, const void *buf, size_t size)

View File

@ -9,7 +9,6 @@ PSP_EXPORT_VAR_HASH(module_info)
PSP_EXPORT_END PSP_EXPORT_END
PSP_EXPORT_START(kernel_functions, 0, 0x4001) PSP_EXPORT_START(kernel_functions, 0, 0x4001)
PSP_EXPORT_FUNC(read_system_buttons)
PSP_EXPORT_FUNC(exitspawn_kernel) PSP_EXPORT_FUNC(exitspawn_kernel)
PSP_EXPORT_END PSP_EXPORT_END

View File

@ -1,49 +1,17 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <pspdebug.h>
#include <pspsdk.h> #include <pspsdk.h>
#include <pspctrl.h>
#include <psploadexec_kernel.h> #include <psploadexec_kernel.h>
#include <pspthreadman_kernel.h>
PSP_MODULE_INFO("kernel_functions", PSP_MODULE_KERNEL, 0, 0); PSP_MODULE_INFO("kernel_functions", PSP_MODULE_KERNEL, 0, 0);
PSP_MAIN_THREAD_ATTR(0); PSP_MAIN_THREAD_ATTR(0);
static volatile int thread_active;
static unsigned int buttons;
static SceUID main_thread_id;
static int main_thread(SceSize args, void *argp)
{
SceCtrlData paddata;
thread_active = 1;
while (thread_active)
{
sceCtrlPeekBufferPositive(&paddata, 1);
buttons = paddata.Buttons;
sceKernelDelayThread(1000000/60);
}
sceKernelExitThread(0);
return 0;
}
unsigned int read_system_buttons(void)
{
return buttons;
}
void exitspawn_kernel(const char *fileName, SceSize args, void *argp) void exitspawn_kernel(const char *fileName, SceSize args, void *argp)
{ {
int k1; int k1;
struct SceKernelLoadExecVSHParam game_param; struct SceKernelLoadExecVSHParam game_param;
thread_active = 0;
memset(&game_param,0,sizeof(game_param)); memset(&game_param,0,sizeof(game_param));
game_param.size = sizeof(game_param); game_param.size = sizeof(game_param);
@ -57,34 +25,16 @@ void exitspawn_kernel(const char *fileName, SceSize args, void *argp)
game_param.unk5 = 0x10000; game_param.unk5 = 0x10000;
k1 = pspSdkSetK1(0); k1 = pspSdkSetK1(0);
#if 0
sceKernelSuspendAllUserThreads();
#endif
sceKernelLoadExecVSHMs2(fileName, &game_param); sceKernelLoadExecVSHMs2(fileName, &game_param);
pspSdkSetK1(k1); pspSdkSetK1(k1);
} }
int module_start(SceSize args, void *argp) int module_start(SceSize args, void *argp)
{ {
(void)args;
(void)argp;
buttons = 0;
thread_active = 0;
main_thread_id = sceKernelCreateThread("main Thread", main_thread, 0x11, 0x200, 0, NULL);
if (main_thread >= 0)
sceKernelStartThread(main_thread_id, 0, 0);
return 0; return 0;
} }
int module_stop(void) int module_stop(void)
{ {
if (main_thread_id >= 0)
{
thread_active = 0;
sceKernelWaitThreadEnd(main_thread_id, NULL);
}
return 0; return 0;
} }

View File

@ -60,11 +60,9 @@
#include "../../paths.h" #include "../../paths.h"
#include "../../verbosity.h" #include "../../verbosity.h"
#if defined(HAVE_KERNEL_PRX) || defined(IS_SALAMANDER) #if defined(PSP) && defined(HAVE_KERNEL_PRX)
#ifndef VITA
#include "../../bootstrap/psp1/kernel_functions.h" #include "../../bootstrap/psp1/kernel_functions.h"
#endif #endif
#endif
#if defined(HAVE_VITAGLES) #if defined(HAVE_VITAGLES)
#include "../../deps/Pigs-In-A-Blanket/include/pib.h" #include "../../deps/Pigs-In-A-Blanket/include/pib.h"
@ -73,10 +71,6 @@
#ifndef VITA #ifndef VITA
PSP_MODULE_INFO("RetroArch", 0, 1, 1); PSP_MODULE_INFO("RetroArch", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER|THREAD_ATTR_VFPU); PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER|THREAD_ATTR_VFPU);
#ifdef BIG_STACK
PSP_MAIN_THREAD_STACK_SIZE_KB(4*1024);
#endif
PSP_HEAP_SIZE_MAX();
#endif #endif
#ifdef SCE_LIBC_SIZE #ifdef SCE_LIBC_SIZE
@ -241,7 +235,7 @@ static void frontend_psp_shutdown(bool unused)
//sceKernelExitProcess(0); //sceKernelExitProcess(0);
return; return;
#else #else
sceKernelExitGame(); exit(0);
#endif #endif
} }
@ -309,16 +303,13 @@ static void frontend_psp_init(void *data)
#endif #endif
#if defined(HAVE_KERNEL_PRX) || defined(IS_SALAMANDER) #if defined(PSP) && defined(HAVE_KERNEL_PRX)
#ifndef VITA
pspSdkLoadStartModule("kernel_functions.prx", PSP_MEMORY_PARTITION_KERNEL); pspSdkLoadStartModule("kernel_functions.prx", PSP_MEMORY_PARTITION_KERNEL);
#endif #endif
#endif
} }
static void frontend_psp_exec(const char *path, bool should_load_game) static void frontend_psp_exec(const char *path, bool should_load_game)
{ {
#if defined(HAVE_KERNEL_PRX) || defined(IS_SALAMANDER) || defined(VITA)
#ifdef IS_SALAMANDER #ifdef IS_SALAMANDER
char boot_params[1024]; char boot_params[1024];
char core_name[256]; char core_name[256];
@ -326,7 +317,7 @@ static void frontend_psp_exec(const char *path, bool should_load_game)
char argp[512] = {0}; char argp[512] = {0};
SceSize args = 0; SceSize args = 0;
#if !defined(VITA) #if defined(PSP)
strlcpy(argp, eboot_path, sizeof(argp)); strlcpy(argp, eboot_path, sizeof(argp));
args = strlen(argp) + 1; args = strlen(argp) + 1;
#endif #endif
@ -392,10 +383,9 @@ static void frontend_psp_exec(const char *path, bool should_load_game)
int ret = sceAppMgrLoadExec(path, args == 0 ? NULL : (char * const*)((const char*[]){argp, 0}), NULL); int ret = sceAppMgrLoadExec(path, args == 0 ? NULL : (char * const*)((const char*[]){argp, 0}), NULL);
RARCH_LOG("Attempt to load executable: [%d].\n", ret); RARCH_LOG("Attempt to load executable: [%d].\n", ret);
} }
#else #elif defined(PSP) && defined(HAVE_KERNEL_PRX)
exitspawn_kernel(path, args, argp); exitspawn_kernel(path, args, argp);
#endif #endif
#endif
} }
#ifndef IS_SALAMANDER #ifndef IS_SALAMANDER

View File

@ -43,10 +43,6 @@
#include <libretro.h> #include <libretro.h>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#ifdef HAVE_KERNEL_PRX
#include "../../bootstrap/psp1/kernel_functions.h"
#endif
#include <defines/psp_defines.h> #include <defines/psp_defines.h>
#include "../input_driver.h" #include "../input_driver.h"

View File

@ -322,10 +322,6 @@ static void psp_joypad_poll(void)
} }
} }
#endif #endif
#ifdef HAVE_KERNEL_PRX
state_tmp.Buttons = (state_tmp.Buttons & 0x0000FFFF)
| (read_system_buttons() & 0xFFFF0000);
#endif
pad_state[i] |= (STATE_BUTTON(state_tmp) & PSP_CTRL_LEFT) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_LEFT) : 0; pad_state[i] |= (STATE_BUTTON(state_tmp) & PSP_CTRL_LEFT) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_LEFT) : 0;
pad_state[i] |= (STATE_BUTTON(state_tmp) & PSP_CTRL_DOWN) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_DOWN) : 0; pad_state[i] |= (STATE_BUTTON(state_tmp) & PSP_CTRL_DOWN) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_DOWN) : 0;
@ -352,12 +348,6 @@ static void psp_joypad_poll(void)
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_RIGHT][RETRO_DEVICE_ID_ANALOG_X] = (int16_t)(STATE_ANALOGRX(state_tmp)-128) * 256; analog_state[i][RETRO_DEVICE_INDEX_ANALOG_RIGHT][RETRO_DEVICE_ID_ANALOG_X] = (int16_t)(STATE_ANALOGRX(state_tmp)-128) * 256;
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_RIGHT][RETRO_DEVICE_ID_ANALOG_Y] = (int16_t)(STATE_ANALOGRY(state_tmp)-128) * 256; analog_state[i][RETRO_DEVICE_INDEX_ANALOG_RIGHT][RETRO_DEVICE_ID_ANALOG_Y] = (int16_t)(STATE_ANALOGRY(state_tmp)-128) * 256;
#endif #endif
#ifdef HAVE_KERNEL_PRX
if (STATE_BUTTON(state_tmp) & PSP_CTRL_NOTE)
BIT64_SET(lifecycle_state, RARCH_MENU_TOGGLE);
#endif
for (j = 0; j < 2; j++) for (j = 0; j < 2; j++)
for (k = 0; k < 2; k++) for (k = 0; k < 2; k++)
if (analog_state[i][j][k] == -0x8000) if (analog_state[i][j][k] == -0x8000)

View File

@ -1350,11 +1350,8 @@ bool config_file_write(config_file_t *conf, const char *path, bool sort)
if (!file) if (!file)
return false; return false;
/* TODO: this is only useful for a few platforms, find which and add ifdef */
#if !defined(PSP)
buf = calloc(1, 0x4000); buf = calloc(1, 0x4000);
setvbuf(file, (char*)buf, _IOFBF, 0x4000); setvbuf(file, (char*)buf, _IOFBF, 0x4000);
#endif
config_file_dump(conf, file, sort); config_file_dump(conf, file, sort);

View File

@ -83,7 +83,7 @@ static int nanosleepDOS(const struct timespec *rqtp, struct timespec *rmtp)
* *
* Sleeps for a specified amount of milliseconds (@msec). * Sleeps for a specified amount of milliseconds (@msec).
**/ **/
#if defined(PSP) || defined(VITA) #if defined(VITA)
#define retro_sleep(msec) (sceKernelDelayThread(1000 * (msec))) #define retro_sleep(msec) (sceKernelDelayThread(1000 * (msec)))
#elif defined(_3DS) #elif defined(_3DS)
#define retro_sleep(msec) (svcSleepThread(1000000 * (s64)(msec))) #define retro_sleep(msec) (svcSleepThread(1000000 * (s64)(msec)))

View File

@ -460,7 +460,6 @@ libretro_vfs_implementation_file *retro_vfs_file_open_impl(
if (stream->fp) if (stream->fp)
setvbuf(stream->fp, stream->buf, _IOFBF, bufsize); setvbuf(stream->fp, stream->buf, _IOFBF, bufsize);
} }
#elif !defined(PSP)
if (stream->scheme != VFS_SCHEME_CDROM) if (stream->scheme != VFS_SCHEME_CDROM)
{ {
stream->buf = (char*)calloc(1, 0x4000); stream->buf = (char*)calloc(1, 0x4000);
@ -890,7 +889,7 @@ int retro_vfs_stat_impl(const char *path, int32_t *size)
{ {
bool is_dir = false; bool is_dir = false;
bool is_character_special = false; bool is_character_special = false;
#if defined(VITA) || defined(PSP) #if defined(VITA)
/* Vita / PSP */ /* Vita / PSP */
SceIoStat buf; SceIoStat buf;
int dir_ret; int dir_ret;
@ -1058,7 +1057,7 @@ int retro_vfs_mkdir_impl(const char *dir)
#endif #endif
#elif defined(IOS) #elif defined(IOS)
int ret = mkdir(dir, 0755); int ret = mkdir(dir, 0755);
#elif defined(VITA) || defined(PSP) #elif defined(VITA)
int ret = sceIoMkdir(dir, 0777); int ret = sceIoMkdir(dir, 0777);
#elif defined(ORBIS) #elif defined(ORBIS)
int ret = orbisMkdir(dir, 0755); int ret = orbisMkdir(dir, 0755);
@ -1111,7 +1110,7 @@ struct libretro_vfs_implementation_dir
HANDLE directory; HANDLE directory;
bool next; bool next;
char path[PATH_MAX_LENGTH]; char path[PATH_MAX_LENGTH];
#elif defined(VITA) || defined(PSP) #elif defined(VITA)
SceUID directory; SceUID directory;
SceIoDirent entry; SceIoDirent entry;
#elif defined(__PSL1GHT__) || defined(__PS3__) #elif defined(__PSL1GHT__) || defined(__PS3__)
@ -1131,7 +1130,7 @@ static bool dirent_check_error(libretro_vfs_implementation_dir *rdir)
{ {
#if defined(_WIN32) #if defined(_WIN32)
return (rdir->directory == INVALID_HANDLE_VALUE); return (rdir->directory == INVALID_HANDLE_VALUE);
#elif defined(VITA) || defined(PSP) || defined(ORBIS) #elif defined(VITA) || defined(ORBIS)
return (rdir->directory < 0); return (rdir->directory < 0);
#elif defined(__PSL1GHT__) || defined(__PS3__) #elif defined(__PSL1GHT__) || defined(__PS3__)
return (rdir->error != FS_SUCCEEDED); return (rdir->error != FS_SUCCEEDED);
@ -1193,7 +1192,7 @@ libretro_vfs_implementation_dir *retro_vfs_opendir_impl(
free(path_wide); free(path_wide);
#endif #endif
#elif defined(VITA) || defined(PSP) #elif defined(VITA)
rdir->directory = sceIoDopen(name); rdir->directory = sceIoDopen(name);
#elif defined(_3DS) #elif defined(_3DS)
rdir->directory = !string_is_empty(name) ? opendir(name) : NULL; rdir->directory = !string_is_empty(name) ? opendir(name) : NULL;
@ -1233,7 +1232,7 @@ bool retro_vfs_readdir_impl(libretro_vfs_implementation_dir *rdir)
rdir->next = true; rdir->next = true;
return (rdir->directory != INVALID_HANDLE_VALUE); return (rdir->directory != INVALID_HANDLE_VALUE);
#elif defined(VITA) || defined(PSP) #elif defined(VITA)
return (sceIoDread(rdir->directory, &rdir->entry) > 0); return (sceIoDread(rdir->directory, &rdir->entry) > 0);
#elif defined(__PSL1GHT__) || defined(__PS3__) #elif defined(__PSL1GHT__) || defined(__PS3__)
uint64_t nread; uint64_t nread;
@ -1259,7 +1258,7 @@ const char *retro_vfs_dirent_get_name_impl(libretro_vfs_implementation_dir *rdir
if (name) if (name)
free(name); free(name);
return (char*)rdir->entry.cFileName; return (char*)rdir->entry.cFileName;
#elif defined(VITA) || defined(PSP) || defined(ORBIS) || defined(__PSL1GHT__) || defined(__PS3__) #elif defined(VITA) || defined(ORBIS) || defined(__PSL1GHT__) || defined(__PS3__)
return rdir->entry.d_name; return rdir->entry.d_name;
#else #else
if (!rdir || !rdir->entry) if (!rdir || !rdir->entry)
@ -1273,13 +1272,9 @@ bool retro_vfs_dirent_is_dir_impl(libretro_vfs_implementation_dir *rdir)
#if defined(_WIN32) #if defined(_WIN32)
const WIN32_FIND_DATA *entry = (const WIN32_FIND_DATA*)&rdir->entry; const WIN32_FIND_DATA *entry = (const WIN32_FIND_DATA*)&rdir->entry;
return entry->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY; return entry->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
#elif defined(PSP) || defined(VITA)
const SceIoDirent *entry = (const SceIoDirent*)&rdir->entry;
#if defined(PSP)
return (entry->d_stat.st_attr & FIO_SO_IFDIR) == FIO_SO_IFDIR;
#elif defined(VITA) #elif defined(VITA)
const SceIoDirent *entry = (const SceIoDirent*)&rdir->entry;
return SCE_S_ISDIR(entry->d_stat.st_mode); return SCE_S_ISDIR(entry->d_stat.st_mode);
#endif
#elif defined(__PSL1GHT__) || defined(__PS3__) #elif defined(__PSL1GHT__) || defined(__PS3__)
sysFSDirent *entry = (sysFSDirent*)&rdir->entry; sysFSDirent *entry = (sysFSDirent*)&rdir->entry;
return (entry->d_type == FS_TYPE_DIR); return (entry->d_type == FS_TYPE_DIR);
@ -1317,7 +1312,7 @@ int retro_vfs_closedir_impl(libretro_vfs_implementation_dir *rdir)
#if defined(_WIN32) #if defined(_WIN32)
if (rdir->directory != INVALID_HANDLE_VALUE) if (rdir->directory != INVALID_HANDLE_VALUE)
FindClose(rdir->directory); FindClose(rdir->directory);
#elif defined(VITA) || defined(PSP) #elif defined(VITA)
sceIoDclose(rdir->directory); sceIoDclose(rdir->directory);
#elif defined(__PSL1GHT__) || defined(__PS3__) #elif defined(__PSL1GHT__) || defined(__PS3__)
rdir->error = sysFsClosedir(rdir->directory); rdir->error = sysFsClosedir(rdir->directory);