mirror of
https://github.com/libretro/RetroArch
synced 2025-02-02 14:54:10 +00:00
[ORBIS] Remove legacy implementation and compile with Werror
This commit is contained in:
parent
50d8982943
commit
6366fcf8e3
@ -306,10 +306,6 @@ else ifneq ($(findstring Darwin,$(OS)),)
|
||||
OBJ += $(LIBRETRO_COMM_DIR)/file/nbio/nbio_unixmmap.o
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET), retroarch_orbis)
|
||||
OBJ += $(LIBRETRO_COMM_DIR)/file/nbio/nbio_orbis.o
|
||||
endif
|
||||
|
||||
OBJ += \
|
||||
$(LIBRETRO_COMM_DIR)/file/nbio/nbio_intf.o \
|
||||
$(LIBRETRO_COMM_DIR)/file/file_path.o \
|
||||
|
@ -16,9 +16,6 @@ PC_DEVELOPMENT_UDP_PORT = 18194
|
||||
DEBUG=1
|
||||
AUTH_INFO = 000000000000000000000000001C004000FF000000000080000000000000000000000000000000000000008000400040000000000000008000000000000000080040FFFF000000F000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
|
||||
OBJ :=
|
||||
DEFINES :=
|
||||
|
||||
# OBJ += memory/ps4/user_mem.o \
|
||||
# memory/ps4/user_new.o \
|
||||
# input/drivers/ps4_input.o \
|
||||
@ -102,7 +99,6 @@ else
|
||||
|
||||
include Makefile.common
|
||||
CFLAGS += $(DEF_FLAGS)
|
||||
BLACKLIST := libretro-common/file/nbio/nbio_orbis.o
|
||||
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
|
||||
endif
|
||||
|
||||
@ -133,10 +129,13 @@ LIBDIRS += -L. -Lcores -Lmemory/ps4 -Lbuild
|
||||
INCDIRS += -I. -Idefines -Imemory/ps4 -Ideps -Ideps/7zip -Ideps/libz -Ilibretro-common/include -Ideps/stb \
|
||||
-Ilibretro-common/include/compat/zlib -Ideps/rcheevos/include -I$(ORBISDEV)/usr/include -I$(ORBISDEV)/usr/include/c++/v1 -I$(ORBISDEV)/usr/include/orbis
|
||||
|
||||
ARCHFLAGS += -DORBIS -D__ORBIS__
|
||||
ARCHFLAGS += -DORBIS -D__PS4__ -D_BSD_SOURCE
|
||||
DEFINES += -DRARCH_INTERNAL -DRARCH_CONSOLE -DHAVE_FILTERS_BUILTIN \
|
||||
-DHAVE_XMB -DHAVE_RGUI -DHAVE_OZONE \
|
||||
-DHAVE_ONLINE_UPDATER -DHAVE_UPDATE_CORES -DHAVE_UPDATE_ASSETS -D__PS4__ -D_BSD_SOURCE
|
||||
-DHAVE_ONLINE_UPDATER -DHAVE_UPDATE_CORES -DHAVE_UPDATE_ASSETS \
|
||||
|
||||
# Compiling with -Werror and disabling some warnings
|
||||
DEFINES += -Werror -Wno-macro-redefined -Wno-non-literal-null-conversion -Wno-void-pointer-to-int-cast -Wno-format
|
||||
|
||||
ifeq ($(HAVE_KEYBOARD), 1)
|
||||
DEFINES += -DHAVE_KEYBOARD
|
||||
@ -166,8 +165,12 @@ PS4_LIBS += -lkernel_stub -lSceLibcInternal_stub -lSceSysmodule_stub -lSceSyst
|
||||
-lScePigletv2VSH_stub -lSceVideoOut_stub -lSceGnmDriver_stub -lorbisGl2 -lorbis -lScePad_stub -lSceAudioOut_stub \
|
||||
-lSceIme_stub -lSceNetCtl_stub
|
||||
|
||||
# LIBS := $(WHOLE_START) -lretro_ps4 $(WHOLE_END) $(PS4_LIBS)
|
||||
LIBS := $(WHOLE_START) $(WHOLE_END) $(PS4_LIBS)
|
||||
ifeq ($(HAVE_STATIC_DUMMY),1)
|
||||
LIBS := $(PS4_LIBS)
|
||||
else
|
||||
LIBS := $(WHOLE_START) -lretro_ps4 $(WHOLE_END) $(PS4_LIBS)
|
||||
endif
|
||||
|
||||
|
||||
CFLAGS := -cc1 -triple x86_64-scei-ps4-elf -munwind-tables -mcmodel=large -Wno-zero-length-array -Wno-format-pedantic -emit-obj -std=c11 $(ARCHFLAGS) $(INCDIRS) $(DEFINES)
|
||||
CXXFLAGS := -cc1 -triple x86_64-scei-ps4-elf -munwind-tables -Wall -pedantic -mcmodel=large -Wno-zero-length-array -Wno-format-pedantic -emit-obj -std=c++11 $(ARCHFLAGS) $(INCDIRS) $(DEFINES)
|
||||
|
@ -25,15 +25,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(HAVE_OOSDK)
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <signal.h>
|
||||
#include <orbis/libkernel.h>
|
||||
#include <orbis/SystemService.h>
|
||||
#include <orbis/UserService.h>
|
||||
#include <orbis/Sysmodule.h>
|
||||
#elif defined(HAVE_LIBORBIS)
|
||||
#if defined(HAVE_LIBORBIS)
|
||||
#include <kernel.h>
|
||||
#include <systemservice.h>
|
||||
#include <orbis2d.h>
|
||||
@ -52,6 +44,7 @@
|
||||
#include <libSceUserService.h>
|
||||
#include <libSceSystemService.h>
|
||||
#include <libSceSysmodule.h>
|
||||
#include <libSceLibcInternal.h>
|
||||
#include <defines/ps4_defines.h>
|
||||
|
||||
// #include "user_mem.h"
|
||||
@ -76,14 +69,6 @@
|
||||
#include "../../paths.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#if defined(HAVE_LIBORBIS)
|
||||
#define CONTENT_PATH_ARG_INDEX 2
|
||||
#define EBOOT_PATH "host0:app"
|
||||
#define USER_PATH "host0:app/data/retroarch/"
|
||||
#define CORE_PATH EBOOT_PATH
|
||||
#define CORE_DIR ""
|
||||
#define CORE_INFO_PATH EBOOT_PATH
|
||||
#else
|
||||
#define CONTENT_PATH_ARG_INDEX 1
|
||||
#define EBOOT_PATH "/app0/"
|
||||
#define USER_PATH "/data/retroarch/"
|
||||
@ -94,27 +79,9 @@
|
||||
#else
|
||||
#define CORE_PATH "/data/self/retroarch/"
|
||||
#endif
|
||||
#endif
|
||||
#define MODULE_PATH "/data/self/system/common/lib/"
|
||||
#define MODULE_PATH_EXT "/app0/sce_module/"
|
||||
|
||||
#if defined(HAVE_LIBORBIS)
|
||||
typedef struct OrbisGlobalConf
|
||||
{
|
||||
Orbis2dConfig *conf;
|
||||
OrbisPadConfig *confPad;
|
||||
OrbisAudioConfig *confAudio;
|
||||
OrbisKeyboardConfig *confKeyboard;
|
||||
ps4LinkConfiguration *confLink;
|
||||
int orbisLinkFlag;
|
||||
}OrbisGlobalConf;
|
||||
|
||||
OrbisGlobalConf *myConf;
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_OOSDK)
|
||||
FILE _Stdin, _Stderr, _Stdout;
|
||||
#endif
|
||||
char eboot_path[512];
|
||||
char user_path[512];
|
||||
SceKernelModule s_piglet_module;
|
||||
@ -125,14 +92,8 @@ static enum frontend_fork orbis_fork_mode = FRONTEND_FORK_NONE;
|
||||
#define MEM_SIZE (3UL * 1024 * 1024 * 1024) /* 2600 MiB */
|
||||
#define MEM_ALIGN (16UL * 1024)
|
||||
|
||||
const char *sceKernelGetFsSandboxRandomWord();
|
||||
int sceKernelReserveVirtualRange(void **, size_t, int, size_t);
|
||||
int sceKernelMapNamedSystemFlexibleMemory(void** addrInOut, size_t len, int prot, int flags, const char* name);
|
||||
typedef void* OrbisMspace;
|
||||
|
||||
OrbisMspace sceLibcMspaceCreate(char *, void *, size_t, void *);
|
||||
void * sceLibcMspaceMalloc(OrbisMspace, size_t size);
|
||||
void sceLibcMspaceFree(OrbisMspace, void *);
|
||||
/* TODO: INCLUDING <orbislink.h> produces duplication errors */
|
||||
int initOrbisLinkAppVanillaGl(void);
|
||||
|
||||
|
||||
static OrbisMspace s_mspace = 0;
|
||||
@ -149,7 +110,7 @@ static int max_malloc(size_t initial_value, int increment, const char *desc)
|
||||
sceLibcMspaceFree(s_mspace,p_block);
|
||||
}
|
||||
chunk--;
|
||||
printf("Maximum possible %s we can allocate is %i\n", desc, chunk);
|
||||
printf("Maximum possible %s we can allocate is %zu\n", desc, chunk);
|
||||
|
||||
return chunk;
|
||||
}
|
||||
@ -172,12 +133,6 @@ static void frontend_orbis_get_env(int *argc, char *argv[],
|
||||
#ifndef IS_SALAMANDER
|
||||
#if defined(HAVE_LOGGER)
|
||||
logger_init();
|
||||
#elif defined(HAVE_FILE_LOGGER)
|
||||
#if defined(HAVE_LIBORBIS)
|
||||
retro_main_log_file_init("host0:app/temp/retroarch-log.txt");
|
||||
#else
|
||||
retro_main_log_file_init("/data/retroarch/temp/retroarch-log.txt");
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -185,27 +140,6 @@ static void frontend_orbis_get_env(int *argc, char *argv[],
|
||||
|
||||
sceSystemServiceHideSplashScreen();
|
||||
|
||||
#if defined(HAVE_LIBORBIS)
|
||||
uintptr_t intptr=0;
|
||||
sscanf(argv[1],"%p",&intptr);
|
||||
argv[1] = NULL;
|
||||
myConf=(OrbisGlobalConf *)intptr;
|
||||
ret=ps4LinkInitWithConf(myConf->confLink);
|
||||
if(!ret)
|
||||
{
|
||||
ps4LinkFinish();
|
||||
return;
|
||||
}
|
||||
orbisFileInit();
|
||||
orbisPadInitWithConf(myConf->confPad);
|
||||
scePadClose(myConf->confPad->padHandle);
|
||||
#else
|
||||
// SceUserServiceInitializeParams param;
|
||||
// memset(¶m, 0, sizeof(param));
|
||||
// param.priority = SCE_KERNEL_PRIO_FIFO_DEFAULT;
|
||||
// sceUserServiceInitialize(¶m);
|
||||
#endif
|
||||
|
||||
strlcpy(eboot_path, EBOOT_PATH, sizeof(eboot_path));
|
||||
strlcpy(g_defaults.dirs[DEFAULT_DIR_PORT], eboot_path, sizeof(g_defaults.dirs[DEFAULT_DIR_PORT]));
|
||||
strlcpy(user_path, USER_PATH, sizeof(user_path));
|
||||
@ -299,9 +233,6 @@ static void frontend_orbis_get_env(int *argc, char *argv[],
|
||||
static void frontend_orbis_deinit(void *data)
|
||||
{
|
||||
(void)data;
|
||||
#if defined(HAVE_LIBORBIS)
|
||||
ps4LinkFinish();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_orbis_shutdown(bool unused)
|
||||
@ -464,13 +395,6 @@ static int frontend_orbis_parse_drive_list(void *data, bool load_content)
|
||||
MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR :
|
||||
MENU_ENUM_LABEL_FILE_BROWSER_DIRECTORY;
|
||||
|
||||
#if defined(HAVE_LIBORBIS)
|
||||
menu_entries_append_enum(list,
|
||||
"host0:app",
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
|
||||
enum_idx,
|
||||
FILE_TYPE_DIRECTORY, 0, 0);
|
||||
#else
|
||||
menu_entries_append_enum(list,
|
||||
"/",
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
|
||||
@ -488,7 +412,6 @@ static int frontend_orbis_parse_drive_list(void *data, bool load_content)
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
|
||||
enum_idx,
|
||||
FILE_TYPE_DIRECTORY, 0, 0);
|
||||
#endif
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <compat/strl.h>
|
||||
#include <piglet.h>
|
||||
#include <orbis/libkernel.h>
|
||||
#include <EGL/egl.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../../config.h"
|
||||
|
@ -1133,9 +1133,6 @@ FILE
|
||||
#if defined(HAVE_MMAP_WIN32)
|
||||
#include "../libretro-common/file/nbio/nbio_windowsmmap.c"
|
||||
#endif
|
||||
#if defined(ORBIS)
|
||||
#include "../libretro-common/file/nbio/nbio_orbis.c"
|
||||
#endif
|
||||
#include "../libretro-common/file/nbio/nbio_intf.c"
|
||||
|
||||
/*============================================================
|
||||
|
@ -34,11 +34,14 @@ typedef struct ps4_input
|
||||
{
|
||||
const input_device_driver_t *joypad;
|
||||
} ps4_input_t;
|
||||
static int16_t ps4_input_state(void *data,
|
||||
rarch_joypad_info_t *joypad_info,
|
||||
const struct retro_keybind **binds,
|
||||
unsigned port, unsigned device,
|
||||
unsigned idx, unsigned id)
|
||||
|
||||
int16_t ps4_input_state(void *data,
|
||||
const input_device_driver_t *joypad_data,
|
||||
const input_device_driver_t *sec_joypad_data,
|
||||
rarch_joypad_info_t *joypad_info,
|
||||
const retro_keybind_set *retro_keybinds,
|
||||
bool keyboard_mapping_blocked,
|
||||
unsigned port, unsigned device, unsigned index, unsigned id)
|
||||
{
|
||||
ps4_input_t *ps4 = (ps4_input_t*)data;
|
||||
|
||||
@ -52,10 +55,10 @@ static int16_t ps4_input_state(void *data,
|
||||
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;
|
||||
const uint64_t joykey = (retro_keybinds[port][i].joykey != NO_BTN)
|
||||
? retro_keybinds[port][i].joykey : joypad_info->auto_binds[i].joykey;
|
||||
const uint32_t joyaxis = (retro_keybinds[port][i].joyaxis != AXIS_NONE)
|
||||
? retro_keybinds[port][i].joyaxis : joypad_info->auto_binds[i].joyaxis;
|
||||
|
||||
if ((uint16_t)joykey != NO_BTN && ps4->joypad->button(
|
||||
joypad_info->joy_idx, (uint16_t)joykey))
|
||||
@ -75,10 +78,10 @@ static int16_t ps4_input_state(void *data,
|
||||
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;
|
||||
const uint64_t joykey = (retro_keybinds[port][id].joykey != NO_BTN)
|
||||
? retro_keybinds[port][id].joykey : joypad_info->auto_binds[id].joykey;
|
||||
const uint32_t joyaxis = (retro_keybinds[port][id].joyaxis != AXIS_NONE)
|
||||
? retro_keybinds[port][id].joyaxis : joypad_info->auto_binds[id].joyaxis;
|
||||
|
||||
if ((uint16_t)joykey != NO_BTN && ps4->joypad->button(
|
||||
joypad_info->joy_idx, (uint16_t)joykey))
|
||||
@ -88,8 +91,8 @@ static int16_t ps4_input_state(void *data,
|
||||
}
|
||||
break;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
// if (binds[port])
|
||||
// return input_joypad_analog(ps4->joypad, joypad_info, port, idx, id, binds[port]);
|
||||
// if (retro_keybinds[port])
|
||||
// return input_joypad_analog(ps4->joypad, joypad_info, port, idx, id, retro_keybinds[port]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#define LERP(p, f, t) ((((p * 10) * (t * 10)) / (f * 10)) / 10)
|
||||
|
||||
#if defined(HAVE_LIBORBIS) || defined(ORBIS)
|
||||
#if defined(ORBIS)
|
||||
#include <orbis/orbisPad.h>
|
||||
|
||||
OrbisPadConfig *confPad;
|
||||
|
@ -77,7 +77,6 @@
|
||||
|
||||
#if defined(ORBIS)
|
||||
#include <orbis/libkernel.h>
|
||||
// #include <orbis/Rtc.h>
|
||||
#endif
|
||||
|
||||
#if defined(PS2)
|
||||
|
@ -26,12 +26,6 @@
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef ORBIS
|
||||
#include <sys/fcntl.h>
|
||||
#if defined(HAVE_LIBORBIS)
|
||||
#include <orbisFile.h>
|
||||
#endif
|
||||
#endif
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <compat/strl.h>
|
||||
#include <compat/posix_string.h>
|
||||
|
@ -32,9 +32,6 @@
|
||||
extern nbio_intf_t nbio_linux;
|
||||
extern nbio_intf_t nbio_mmap_unix;
|
||||
extern nbio_intf_t nbio_mmap_win32;
|
||||
#if defined(ORBIS) && defined(HAVE_LIBORBIS)
|
||||
extern nbio_intf_t nbio_orbis;
|
||||
#endif
|
||||
extern nbio_intf_t nbio_stdio;
|
||||
|
||||
#ifndef _XBOX
|
||||
@ -61,8 +58,6 @@ static nbio_intf_t *internal_nbio = &nbio_linux;
|
||||
static nbio_intf_t *internal_nbio = &nbio_mmap_unix;
|
||||
#elif defined(HAVE_MMAP_WIN32)
|
||||
static nbio_intf_t *internal_nbio = &nbio_mmap_win32;
|
||||
#elif defined(ORBIS) && defined(HAVE_LIBORBIS)
|
||||
static nbio_intf_t *internal_nbio = &nbio_orbis;
|
||||
#else
|
||||
static nbio_intf_t *internal_nbio = &nbio_stdio;
|
||||
#endif
|
||||
|
@ -1,231 +0,0 @@
|
||||
/* Copyright (C) 2010-2020 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (nbio_orbis.c).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <file/nbio.h>
|
||||
|
||||
#if defined(ORBIS)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
// #include <orbisFile.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/fcntl.h>
|
||||
|
||||
struct nbio_orbis_t
|
||||
{
|
||||
void* data;
|
||||
size_t progress;
|
||||
size_t len;
|
||||
int fd;
|
||||
unsigned int mode;
|
||||
/*
|
||||
* possible values:
|
||||
* NBIO_READ, NBIO_WRITE - obvious
|
||||
* -1 - currently doing nothing
|
||||
* -2 - the pointer was reallocated since the last operation
|
||||
*/
|
||||
signed char op;
|
||||
};
|
||||
|
||||
static void *nbio_orbis_open(const char * filename, unsigned int mode)
|
||||
{
|
||||
static const int o_flags[] = { O_RDONLY, O_RDWR | O_CREAT | O_TRUNC,
|
||||
O_RDWR, O_RDONLY, O_RDWR | O_CREAT | O_TRUNC };
|
||||
void *buf = NULL;
|
||||
struct nbio_orbis_t* handle = NULL;
|
||||
size_t len = 0;
|
||||
int fd = orbisOpen(filename, o_flags[mode], 0644);
|
||||
|
||||
if (fd < 0)
|
||||
return NULL;
|
||||
handle = (struct nbio_orbis_t*)malloc(sizeof(struct nbio_orbis_t));
|
||||
|
||||
if (!handle)
|
||||
goto error;
|
||||
|
||||
handle->fd = fd;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case NBIO_WRITE:
|
||||
case BIO_WRITE:
|
||||
break;
|
||||
default:
|
||||
len=orbisLseek(handle->fd, 0, SEEK_END);
|
||||
orbisLseek(handle->fd, 0, SEEK_SET);
|
||||
break;
|
||||
}
|
||||
|
||||
handle->mode = mode;
|
||||
|
||||
if (len)
|
||||
buf = malloc(len);
|
||||
|
||||
if (len && !buf)
|
||||
goto error;
|
||||
|
||||
handle->data = buf;
|
||||
handle->len = len;
|
||||
handle->progress = handle->len;
|
||||
handle->op = -2;
|
||||
|
||||
return handle;
|
||||
|
||||
error:
|
||||
if (handle)
|
||||
free(handle);
|
||||
orbisClose(fd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void nbio_orbis_begin_read(void *data)
|
||||
{
|
||||
|
||||
struct nbio_orbis_t *handle = (struct nbio_orbis_t*)data;
|
||||
if (!handle)
|
||||
return;
|
||||
|
||||
if (handle->op >= 0)
|
||||
return;
|
||||
|
||||
orbisLseek(handle->fd, 0, SEEK_SET);
|
||||
|
||||
handle->op = NBIO_READ;
|
||||
handle->progress = 0;
|
||||
}
|
||||
|
||||
static void nbio_orbis_begin_write(void *data)
|
||||
{
|
||||
struct nbio_orbis_t *handle = (struct nbio_orbis_t*)data;
|
||||
if (!handle)
|
||||
return;
|
||||
|
||||
if (handle->op >= 0)
|
||||
return;
|
||||
|
||||
orbisLseek(handle->fd, 0, SEEK_SET);
|
||||
handle->op = NBIO_WRITE;
|
||||
handle->progress = 0;
|
||||
}
|
||||
|
||||
static bool nbio_orbis_iterate(void *data)
|
||||
{
|
||||
size_t amount = 65536;
|
||||
struct nbio_orbis_t *handle = (struct nbio_orbis_t*)data;
|
||||
|
||||
if (!handle)
|
||||
return false;
|
||||
|
||||
if (amount > handle->len - handle->progress)
|
||||
amount = handle->len - handle->progress;
|
||||
|
||||
switch (handle->op)
|
||||
{
|
||||
case NBIO_READ:
|
||||
if (handle->mode == BIO_READ)
|
||||
amount = handle->len;
|
||||
break;
|
||||
case NBIO_WRITE:
|
||||
if (handle->mode == BIO_WRITE)
|
||||
{
|
||||
size_t written = 0;
|
||||
amount = handle->len;
|
||||
written = orbisWrite(handle->fd, (char*)handle->data, amount);
|
||||
|
||||
if (written != amount)
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
handle->progress += amount;
|
||||
|
||||
if (handle->progress == handle->len)
|
||||
handle->op = -1;
|
||||
return (handle->op < 0);
|
||||
}
|
||||
|
||||
static void nbio_orbis_resize(void *data, size_t len)
|
||||
{
|
||||
struct nbio_orbis_t *handle = (struct nbio_orbis_t*)data;
|
||||
if (!handle)
|
||||
return;
|
||||
|
||||
if (handle->op >= 0)
|
||||
return;
|
||||
if (len < handle->len)
|
||||
return;
|
||||
|
||||
handle->len = len;
|
||||
handle->data = realloc(handle->data, handle->len);
|
||||
handle->op = -1;
|
||||
handle->progress = handle->len;
|
||||
}
|
||||
|
||||
static void *nbio_orbis_get_ptr(void *data, size_t* len)
|
||||
{
|
||||
struct nbio_orbis_t *handle = (struct nbio_orbis_t*)data;
|
||||
if (!handle)
|
||||
return NULL;
|
||||
if (len)
|
||||
*len = handle->len;
|
||||
if (handle->op == -1)
|
||||
return handle->data;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void nbio_orbis_cancel(void *data)
|
||||
{
|
||||
struct nbio_orbis_t *handle = (struct nbio_orbis_t*)data;
|
||||
if (!handle)
|
||||
return;
|
||||
handle->op = -1;
|
||||
handle->progress = handle->len;
|
||||
}
|
||||
|
||||
static void nbio_orbis_free(void *data)
|
||||
{
|
||||
struct nbio_orbis_t *handle = (struct nbio_orbis_t*)data;
|
||||
if (!handle)
|
||||
return;
|
||||
|
||||
if (handle->op >= 0)
|
||||
return;
|
||||
|
||||
orbisClose(handle->fd);
|
||||
free(handle->data);
|
||||
|
||||
handle->data = NULL;
|
||||
free(handle);
|
||||
}
|
||||
|
||||
nbio_intf_t nbio_orbis = {
|
||||
nbio_orbis_open,
|
||||
nbio_orbis_begin_read,
|
||||
nbio_orbis_begin_write,
|
||||
nbio_orbis_iterate,
|
||||
nbio_orbis_resize,
|
||||
nbio_orbis_get_ptr,
|
||||
nbio_orbis_cancel,
|
||||
nbio_orbis_free,
|
||||
"nbio_orbis",
|
||||
};
|
||||
#endif
|
@ -75,7 +75,7 @@ static INLINE bool bits_any_set(uint32_t* ptr, uint32_t count)
|
||||
}
|
||||
|
||||
#ifndef PATH_MAX_LENGTH
|
||||
#if defined(_XBOX1) || defined(_3DS) || defined(PSP) || defined(PS2) || defined(GEKKO)|| defined(WIIU) || defined(ORBIS) || defined(__PSL1GHT__) || defined(__PS3__)
|
||||
#if defined(_XBOX1) || defined(_3DS) || defined(PSP) || defined(PS2) || defined(GEKKO)|| defined(WIIU) || defined(__PSL1GHT__) || defined(__PS3__)
|
||||
#define PATH_MAX_LENGTH 512
|
||||
#else
|
||||
#define PATH_MAX_LENGTH 4096
|
||||
|
@ -422,7 +422,7 @@ void network_deinit(void)
|
||||
|
||||
uint16_t inet_htons(uint16_t hostshort)
|
||||
{
|
||||
#if defined(VITA) || defined(__ORBIS__)
|
||||
#if defined(VITA)
|
||||
return sceNetHtons(hostshort);
|
||||
#else
|
||||
return htons(hostshort);
|
||||
@ -432,7 +432,7 @@ uint16_t inet_htons(uint16_t hostshort)
|
||||
|
||||
int inet_ptrton(int af, const char *src, void *dst)
|
||||
{
|
||||
#if defined(VITA) || defined(__ORBIS__)
|
||||
#if defined(VITA)
|
||||
return sceNetInetPton(af, src, dst);
|
||||
#elif defined(GEKKO) || defined(_WIN32)
|
||||
/* TODO/FIXME - should use InetPton on Vista and later */
|
||||
@ -597,7 +597,7 @@ static const char *isockaddr_ntop(int af,
|
||||
|
||||
const char *inet_ntop_compat(int af, const void *src, char *dst, socklen_t cnt)
|
||||
{
|
||||
#if defined(VITA) || defined(__ORBIS__)
|
||||
#if defined(VITA)
|
||||
return sceNetInetNtop(af,src,dst,cnt);
|
||||
#elif defined(WIIU)
|
||||
return inet_ntop(af, src, dst, cnt);
|
||||
|
@ -1,12 +1,7 @@
|
||||
#include <stdlib.h>
|
||||
#if defined(HAVE_OOSDK)
|
||||
#include <orbis/libkernel.h>
|
||||
#include <orbis/LibcInternal.h>
|
||||
#else
|
||||
#include <kernel.h>
|
||||
#include <mspace.h>
|
||||
#endif
|
||||
#include "../../defines/ps4_defines.h"
|
||||
#include <defines/ps4_defines.h>
|
||||
#include "user_mem.h"
|
||||
|
||||
static OrbisMspace s_mspace = 0;
|
||||
|
@ -4,20 +4,6 @@
|
||||
#define MEM_SIZE (0xA0000000) /* 2600 MiB */
|
||||
#define MEM_ALIGN (16UL * 1024)
|
||||
|
||||
#if defined(HAVE_OOSDK)
|
||||
typedef void* OrbisMspace;
|
||||
|
||||
typedef struct OrbisMallocManagedSize {
|
||||
unsigned short sz;
|
||||
unsigned short ver;
|
||||
unsigned int reserv;
|
||||
size_t maxSysSz;
|
||||
size_t curSysSz;
|
||||
size_t maxUseSz;
|
||||
size_t curUseSz;
|
||||
} OrbisMallocManagedSize;
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include "../../defines/ps4_defines.h"
|
||||
#include <defines/ps4_defines.h>
|
||||
#include "user_mem.h"
|
||||
|
||||
void *user_new(std::size_t size) throw(std::bad_alloc)
|
||||
|
Loading…
x
Reference in New Issue
Block a user