mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
commit
22e54dfc6b
@ -869,6 +869,11 @@ ifeq ($(TARGET), retroarch_switch)
|
||||
frontend/drivers/platform_switch.o
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET), retroarch_orbis)
|
||||
OBJ += gfx/drivers_context/orbis_ctx.o \
|
||||
frontend/drivers/platform_orbis.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_WAYLAND), 1)
|
||||
OBJ += gfx/drivers_context/wayland_ctx.o \
|
||||
input/drivers/wayland_input.o \
|
||||
|
170
Makefile.orbis
Normal file
170
Makefile.orbis
Normal file
@ -0,0 +1,170 @@
|
||||
TARGET := retroarch_orbis
|
||||
DEBUG ?= 0
|
||||
GRIFFIN_BUILD = 0
|
||||
WHOLE_ARCHIVE_LINK = 0
|
||||
|
||||
PS4_TITLE_ID := RETROARCH
|
||||
PS4_TITLE_NAME := RetroArch
|
||||
|
||||
PC_DEVELOPMENT_IP_ADDRESS =
|
||||
PC_DEVELOPMENT_UDP_PORT =
|
||||
|
||||
OBJ :=
|
||||
|
||||
DEFINES :=
|
||||
|
||||
ifeq ($(GRIFFIN_BUILD), 1)
|
||||
OBJ += griffin/griffin.o
|
||||
DEFINES += -DHAVE_GRIFFIN=1
|
||||
DEFINES += -DHAVE_MENU -DHAVE_LIBRETRODB
|
||||
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB -DHAVE_CC_RESAMPLER
|
||||
ifeq ($(DEBUG), 1)
|
||||
DEFINES += -DHAVE_NETLOGGER
|
||||
endif
|
||||
else
|
||||
|
||||
HAVE_FILTERS_BUILTIN := 1
|
||||
HAVE_LANGEXTRA := 0
|
||||
HAVE_RPNG := 1
|
||||
HAVE_RJPEG := 1
|
||||
HAVE_RBMP := 1
|
||||
HAVE_RTGA := 1
|
||||
HAVE_ZLIB := 0
|
||||
HAVE_OVERLAY := 1
|
||||
HAVE_7ZIP := 1
|
||||
HAVE_EGL := 1
|
||||
HAVE_OPENGLES := 1
|
||||
HAVE_NETWORKING := 0
|
||||
HAVE_SOCKET_LEGACY := 0
|
||||
HAVE_MENU := 1
|
||||
HAVE_MENU_COMMON := 1
|
||||
HAVE_RGUI := 0
|
||||
HAVE_MATERIALUI := 0
|
||||
HAVE_XMB := 1
|
||||
HAVE_ZARCH := 0
|
||||
HAVE_THREADS := 1
|
||||
HAVE_LIBRETRODB := 1
|
||||
HAVE_CC_RESAMPLER := 1
|
||||
HAVE_CHEEVOS := 1
|
||||
RARCH_CONSOLE := 1
|
||||
HAVE_STATIC_VIDEO_FILTERS = 1
|
||||
HAVE_STATIC_AUDIO_FILTERS = 1
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
HAVE_NETLOGGER = 1
|
||||
endif
|
||||
|
||||
include Makefile.common
|
||||
BLACKLIST :=
|
||||
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
|
||||
|
||||
#OBJ += input/drivers/psp_input.o
|
||||
#OBJ += input/drivers_joypad/psp_joypad.o
|
||||
#OBJ += audio/drivers/psp_audio.o
|
||||
#OBJ += frontend/drivers/platform_orbis.o
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(strip $(PS4SDK)),)
|
||||
$(error "Please set PS4SDK in your environment. export PS4SDK=<path to>ps4sdk")
|
||||
endif
|
||||
|
||||
export PATH := $(PATH):$(PS4SDK)/bin
|
||||
|
||||
PREFIX :=
|
||||
|
||||
CC := $(PREFIX)clang
|
||||
CXX := $(PREFIX)clang
|
||||
AS := $(PREFIX)clang
|
||||
AR := $(PREFIX)ar
|
||||
OBJCOPY := $(PREFIX)objcopy
|
||||
STRIP := $(PREFIX)strip
|
||||
NM := $(PREFIX)nm
|
||||
LD := $(CXX)
|
||||
|
||||
INCDIRS := -I. -Ideps/libz -Ideps/7zip -Ilibretro-common/include -Ideps/stb
|
||||
LIBDIRS := -L.
|
||||
|
||||
ARCHFLAGS := -m64 -DORBIS
|
||||
CFLAGS += $(ARCHFLAGS) -std=c11 -mcmodel=large -ffreestanding -nostdlib -nostdinc -fno-builtin -fno-stack-protector
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -O2 -g
|
||||
else
|
||||
CFLAGS += -O3
|
||||
endif
|
||||
|
||||
ASFLAGS := $(ARCHFLAGS) -I$(PS4SDK)/include -target x86_64-scei-ps4-elf -fPIE
|
||||
LDFLAGS := -O3 -Wall -m64 -nostartfiles -nostdlib -L$(PS4SDK)/lib -pie
|
||||
ARFLAGS := rcs
|
||||
|
||||
CRTFILE ?= $(PS4SDK)/crt0.s
|
||||
|
||||
CFLAGS += -Wall -pedantic -Wno-zero-length-array -Wno-format-pedantic
|
||||
CFLAGS += -D__PS4__ -I$(PS4SDK)/include -I $(PS4SDK)/include/sce
|
||||
CFLAGS += -target x86_64-scei-ps4-elf -fPIE
|
||||
CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE
|
||||
CFLAGS += -DHAVE_FILTERS_BUILTIN $(DEFINES)
|
||||
|
||||
ifneq ($(PC_DEVELOPMENT_IP_ADDRESS),)
|
||||
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS='"$(PC_DEVELOPMENT_IP_ADDRESS)"'
|
||||
endif
|
||||
|
||||
ifneq ($(PC_DEVELOPMENT_UDP_PORT),)
|
||||
CFLAGS += -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
|
||||
endif
|
||||
|
||||
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
|
||||
WHOLE_START := -Wl,--whole-archive
|
||||
WHOLE_END := -Wl,--no-whole-archive
|
||||
endif
|
||||
CXXFLAGS := $(CFLAGS)
|
||||
|
||||
PS4_LIBS := -lps4link -ldebugnet -lorbisFile -lelfloader -lorbisKeyboard -lorbis2d -lpng -lz -lorbisGl -lorbisPad -lorbisAudio -lmod -lorbisAudio -lmod -lorbisFileBrowser -lorbisXbmFont -lSceNet_stub -lScePigletv2VSH_stub -lSceSystemService_stub -lSceUserService_stub -lScePad_stub -lSceAudioOut_stub -lSceIme_stub -lSceSysmodule_stub \
|
||||
-lPs4_extension_kernel_call_standard -lPs4_extension_kernel_execute_dynlib_prepare_dlclose -lPs4_common_kernel -lPs4_common_user -lPs4_common_generic -lPs4LibCInternalAdaptive_stub -lPs4LibKernelAdaptive_stub -lSceLibcInternal_stub -lkernel_stub -lps4Kernel_stub -lPs4_base_stub_resolve_minimal -lPs4_base_kernel_dlsym_standard -lPs4_base_kernel_seek_elf_address_standard -lPs4_base_assembler_register_parameter_standard -lPs4_base_assembler_system_call_standard
|
||||
|
||||
|
||||
LIBS := $(WHOLE_START) -lretro_orbis $(WHOLE_END) $(PS4_LIBS)
|
||||
|
||||
TARGETS := $(TARGET).elf
|
||||
|
||||
DEPFLAGS = -MT $@ -MMD -MP -MF $*.Tdepend
|
||||
POSTCOMPILE = mv -f $*.Tdepend $*.depend
|
||||
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
%.o: %.cpp
|
||||
%.o: %.cpp %.depend
|
||||
$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(POSTCOMPILE)
|
||||
|
||||
%.o: %.c
|
||||
%.o: %.c %.depend
|
||||
$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(POSTCOMPILE)
|
||||
|
||||
|
||||
%.o: %.S
|
||||
%.o: %.S %.depend
|
||||
$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(POSTCOMPILE)
|
||||
|
||||
%.o: %.s
|
||||
%.o: %.s %.depend
|
||||
$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(POSTCOMPILE)
|
||||
|
||||
%.depend: ;
|
||||
|
||||
$(TARGET).elf: $(OBJ) libretro_orbis.a
|
||||
$(LD) $(CRTFILE) $(OBJ) $(LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(TARGET).elf
|
||||
rm -f $(OBJ:.o=.depend)
|
||||
|
||||
.PHONY: clean all
|
||||
.PRECIOUS: %.depend
|
||||
|
||||
-include $(OBJ:.o=.depend)
|
353
frontend/drivers/platform_orbis.c
Normal file
353
frontend/drivers/platform_orbis.c
Normal file
@ -0,0 +1,353 @@
|
||||
/* 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>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../../config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <kernel.h>
|
||||
#include <systemservice.h>
|
||||
#include <orbis2d.h>
|
||||
#include <orbisPad.h>
|
||||
#include <orbisAudio.h>
|
||||
#include <modplayer.h>
|
||||
#include <ps4link.h>
|
||||
#include <orbisKeyboard.h>
|
||||
#include <debugnet.h>
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include <string/stdstring.h>
|
||||
#include <boolean.h>
|
||||
#include <file/file_path.h>
|
||||
#ifndef IS_SALAMANDER
|
||||
#include <lists/file_list.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
#include "../../menu/menu_driver.h"
|
||||
#endif
|
||||
|
||||
#include "../frontend_driver.h"
|
||||
#include "../../defaults.h"
|
||||
#include "../../file_path_special.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../paths.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct OrbisGlobalConf
|
||||
{
|
||||
Orbis2dConfig *conf;
|
||||
OrbisPadConfig *confPad;
|
||||
OrbisAudioConfig *confAudio;
|
||||
OrbisKeyboardConfig *confKeyboard;
|
||||
ps4LinkConfiguration *confLink;
|
||||
int orbisLinkFlag;
|
||||
}OrbisGlobalConf;
|
||||
|
||||
OrbisGlobalConf *myConf;
|
||||
|
||||
char eboot_path[512];
|
||||
char user_path[512];
|
||||
|
||||
static enum frontend_fork orbis_fork_mode = FRONTEND_FORK_NONE;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int ret;
|
||||
|
||||
sceSystemServiceHideSplashScreen();
|
||||
|
||||
|
||||
uintptr_t intptr=0;
|
||||
sscanf(argv[1],"%p",&intptr);
|
||||
myConf=(OrbisGlobalConf *)intptr;
|
||||
ret=ps4LinkInitWithConf(myConf->confLink);
|
||||
if(!ret)
|
||||
{
|
||||
ps4LinkFinish();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return rarch_main(argc, argv, NULL);
|
||||
}
|
||||
|
||||
static void frontend_orbis_get_environment_settings(int *argc, char *argv[],
|
||||
void *args, void *params_data)
|
||||
{
|
||||
unsigned i;
|
||||
struct rarch_main_wrap *params = NULL;
|
||||
|
||||
(void)args;
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
#if defined(HAVE_LOGGER)
|
||||
logger_init();
|
||||
#elif defined(HAVE_FILE_LOGGER)
|
||||
retro_main_log_file_init("host0:/temp/retroarch-log.txt");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
strlcpy(eboot_path, "host0:/", sizeof(eboot_path));
|
||||
strlcpy(g_defaults.dirs[DEFAULT_DIR_PORT], eboot_path, sizeof(g_defaults.dirs[DEFAULT_DIR_PORT]));
|
||||
strlcpy(user_path, "host0:/data/retroarch/", sizeof(user_path));
|
||||
|
||||
RARCH_LOG("port dir: [%s]\n", g_defaults.dirs[DEFAULT_DIR_PORT]);
|
||||
|
||||
/* bundle data*/
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], g_defaults.dirs[DEFAULT_DIR_PORT],
|
||||
"", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], g_defaults.dirs[DEFAULT_DIR_PORT],
|
||||
"info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
|
||||
/* user data*/
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], user_path,
|
||||
"assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_DATABASE], user_path,
|
||||
"database/rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CURSOR], user_path,
|
||||
"database/cursors", sizeof(g_defaults.dirs[DEFAULT_DIR_CURSOR]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS], user_path,
|
||||
"cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], user_path,
|
||||
"config", sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS], user_path,
|
||||
"downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PLAYLIST], user_path,
|
||||
"playlists", sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_REMAP], user_path,
|
||||
"remaps", sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SRAM], user_path,
|
||||
"savefiles", sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SAVESTATE], user_path,
|
||||
"savestates", sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SYSTEM], user_path,
|
||||
"system", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CACHE], user_path,
|
||||
"temp", sizeof(g_defaults.dirs[DEFAULT_DIR_CACHE]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], user_path,
|
||||
"overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS], user_path,
|
||||
"thumbnails", sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS]));
|
||||
strlcpy(g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY],
|
||||
user_path, sizeof(g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY]));
|
||||
fill_pathname_join(g_defaults.path.config, user_path,
|
||||
file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config));
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
params = (struct rarch_main_wrap*)params_data;
|
||||
params->verbose = true;
|
||||
|
||||
if (!string_is_empty(argv[1]))
|
||||
{
|
||||
static char path[PATH_MAX_LENGTH] = {0};
|
||||
struct rarch_main_wrap *args =
|
||||
(struct rarch_main_wrap*)params_data;
|
||||
|
||||
if (args)
|
||||
{
|
||||
strlcpy(path, argv[1], sizeof(path));
|
||||
|
||||
args->touched = true;
|
||||
args->no_content = false;
|
||||
args->verbose = false;
|
||||
args->config_path = NULL;
|
||||
args->sram_path = NULL;
|
||||
args->state_path = NULL;
|
||||
args->content_path = path;
|
||||
args->libretro_path = NULL;
|
||||
|
||||
RARCH_LOG("argv[0]: %s\n", argv[0]);
|
||||
RARCH_LOG("argv[1]: %s\n", argv[1]);
|
||||
RARCH_LOG("argv[2]: %s\n", argv[2]);
|
||||
|
||||
RARCH_LOG("Auto-start game %s.\n", argv[1]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
if (!string_is_empty(dir_path))
|
||||
path_mkdir(dir_path);
|
||||
}
|
||||
}
|
||||
|
||||
static void frontend_orbis_deinit(void *data)
|
||||
{
|
||||
(void)data;
|
||||
#ifndef IS_SALAMANDER
|
||||
verbosity_disable();
|
||||
#ifdef HAVE_FILE_LOGGER
|
||||
command_event(CMD_EVENT_LOG_FILE_DEINIT, NULL);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
ps4LinkFinish();
|
||||
}
|
||||
|
||||
static void frontend_orbis_shutdown(bool unused)
|
||||
{
|
||||
(void)unused;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static void frontend_orbis_init(void *data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void frontend_orbis_exec(const char *path, bool should_load_game)
|
||||
{
|
||||
char argp[512] = {0};
|
||||
int args = 0;
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
if (should_load_game && !path_is_empty(RARCH_PATH_CONTENT))
|
||||
{
|
||||
argp[args] = '\0';
|
||||
strlcat(argp + args, path_get(RARCH_PATH_CONTENT), sizeof(argp) - args);
|
||||
args += strlen(argp + args) + 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
RARCH_LOG("Attempt to load executable: [%s].\n", path);
|
||||
RARCH_LOG("Attempt to load executable: %d [%s].\n", args, argp);
|
||||
//int ret = sceAppMgrLoadExec(path, args==0? NULL : (char * const*)((const char*[]){argp, 0}), NULL);
|
||||
//RARCH_LOG("Attempt to load executable: [%d].\n", ret);
|
||||
|
||||
}
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
static bool frontend_orbis_set_fork(enum frontend_fork fork_mode)
|
||||
{
|
||||
switch (fork_mode)
|
||||
{
|
||||
case FRONTEND_FORK_CORE:
|
||||
RARCH_LOG("FRONTEND_FORK_CORE\n");
|
||||
orbis_fork_mode = fork_mode;
|
||||
break;
|
||||
case FRONTEND_FORK_CORE_WITH_ARGS:
|
||||
RARCH_LOG("FRONTEND_FORK_CORE_WITH_ARGS\n");
|
||||
orbis_fork_mode = fork_mode;
|
||||
break;
|
||||
case FRONTEND_FORK_RESTART:
|
||||
RARCH_LOG("FRONTEND_FORK_RESTART\n");
|
||||
/* NOTE: We don't implement Salamander, so just turn
|
||||
* this into FRONTEND_FORK_CORE. */
|
||||
orbis_fork_mode = FRONTEND_FORK_CORE;
|
||||
break;
|
||||
case FRONTEND_FORK_NONE:
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void frontend_orbis_exitspawn(char *s, size_t len)
|
||||
{
|
||||
bool should_load_game = false;
|
||||
#ifndef IS_SALAMANDER
|
||||
if (orbis_fork_mode == FRONTEND_FORK_NONE)
|
||||
return;
|
||||
|
||||
switch (orbis_fork_mode)
|
||||
{
|
||||
case FRONTEND_FORK_CORE_WITH_ARGS:
|
||||
should_load_game = true;
|
||||
break;
|
||||
case FRONTEND_FORK_NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
frontend_orbis_exec(s, should_load_game);
|
||||
}
|
||||
|
||||
static int frontend_orbis_get_rating(void)
|
||||
{
|
||||
return 6; /* Go with a conservative figure for now. */
|
||||
}
|
||||
|
||||
enum frontend_architecture frontend_orbis_get_architecture(void)
|
||||
{
|
||||
return FRONTEND_ARCH_X86_64;
|
||||
}
|
||||
|
||||
static int frontend_orbis_parse_drive_list(void *data, bool load_content)
|
||||
{
|
||||
#ifndef IS_SALAMANDER
|
||||
file_list_t *list = (file_list_t*)data;
|
||||
enum msg_hash_enums enum_idx = load_content ?
|
||||
MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR :
|
||||
MSG_UNKNOWN;
|
||||
|
||||
menu_entries_append_enum(list,
|
||||
"app0",
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
|
||||
enum_idx,
|
||||
FILE_TYPE_DIRECTORY, 0, 0);
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
frontend_ctx_driver_t frontend_ctx_orbis = {
|
||||
frontend_orbis_get_environment_settings,
|
||||
frontend_orbis_init,
|
||||
frontend_orbis_deinit,
|
||||
frontend_orbis_exitspawn,
|
||||
NULL, /* process_args */
|
||||
frontend_orbis_exec,
|
||||
#ifdef IS_SALAMANDER
|
||||
NULL,
|
||||
#else
|
||||
frontend_orbis_set_fork,
|
||||
#endif
|
||||
frontend_orbis_shutdown,
|
||||
NULL, /* get_name */
|
||||
NULL, /* get_os */
|
||||
frontend_orbis_get_rating,
|
||||
NULL, /* load_content */
|
||||
frontend_orbis_get_architecture,
|
||||
NULL,
|
||||
frontend_orbis_parse_drive_list,
|
||||
NULL, /* get_mem_total */
|
||||
NULL, /* get_mem_free */
|
||||
NULL, /* install_signal_handler */
|
||||
NULL, /* get_sighandler_state */
|
||||
NULL, /* set_sighandler_state */
|
||||
NULL, /* destroy_sighandler_state */
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
NULL, /* watch_path_for_changes */
|
||||
NULL, /* check_for_path_changes */
|
||||
NULL, /* set_sustained_performance_mode */
|
||||
"orbis",
|
||||
};
|
@ -161,6 +161,7 @@ int rarch_main(int argc, char *argv[], void *data)
|
||||
}
|
||||
|
||||
#ifndef HAVE_MAIN
|
||||
#ifndef ORBIS
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
@ -169,3 +170,4 @@ int main(int argc, char *argv[])
|
||||
return rarch_main(argc, argv, NULL);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -54,7 +54,7 @@ void gl_load_texture_image(GLenum target,
|
||||
GLenum type,
|
||||
const GLvoid * data)
|
||||
{
|
||||
#ifndef HAVE_PSGL
|
||||
#if !defined(HAVE_PSGL) && !defined(ORBIS)
|
||||
#ifdef HAVE_OPENGLES2
|
||||
if (gl_check_capability(GL_CAPS_TEX_STORAGE_EXT) && internalFormat != GL_BGRA_EXT)
|
||||
{
|
||||
|
25
gfx/common/orbis_common.h
Normal file
25
gfx/common/orbis_common.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef ORBIS_COMMON_H__
|
||||
#define ORBIS_COMMON_H__
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
#include <piglet.h>
|
||||
#include "../common/egl_common.h"
|
||||
#endif
|
||||
|
||||
#define ATTR_ORBISGL_WIDTH 1920
|
||||
#define ATTR_ORBISGL_HEIGHT 1080
|
||||
|
||||
typedef struct
|
||||
{
|
||||
#ifdef HAVE_EGL
|
||||
egl_ctx_data_t egl;
|
||||
ScePglConfig pgl_config;
|
||||
#endif
|
||||
|
||||
SceWindow native_window;
|
||||
bool resize;
|
||||
unsigned width, height;
|
||||
float refresh_rate;
|
||||
} orbis_ctx_data_t;
|
||||
|
||||
#endif
|
302
gfx/drivers_context/orbis_ctx.c
Normal file
302
gfx/drivers_context/orbis_ctx.c
Normal file
@ -0,0 +1,302 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2018 - M4xw
|
||||
*
|
||||
* 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 <stdlib.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../../config.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include "../common/orbis_common.h"
|
||||
#include "../../frontend/frontend_driver.h"
|
||||
|
||||
static enum gfx_ctx_api ctx_orbis_api = GFX_CTX_OPENGL_API;
|
||||
|
||||
orbis_ctx_data_t *nx_ctx_ptr = NULL;
|
||||
|
||||
extern bool platform_orbis_has_focus;
|
||||
|
||||
void orbis_ctx_destroy(void *data)
|
||||
{
|
||||
orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *)data;
|
||||
|
||||
if (ctx_orbis)
|
||||
{
|
||||
#ifdef HAVE_EGL
|
||||
egl_destroy(&ctx_orbis->egl);
|
||||
#endif
|
||||
ctx_orbis->resize = false;
|
||||
free(ctx_orbis);
|
||||
}
|
||||
}
|
||||
|
||||
static void orbis_ctx_get_video_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
{
|
||||
orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *)data;
|
||||
|
||||
*width = ATTR_ORBISGL_WIDTH;
|
||||
*height = ATTR_ORBISGL_HEIGHT;
|
||||
}
|
||||
|
||||
static void *orbis_ctx_init(video_frame_info_t *video_info, void *video_driver)
|
||||
{
|
||||
#ifdef HAVE_EGL
|
||||
int ret;
|
||||
EGLint n;
|
||||
EGLint major, minor;
|
||||
static const EGLint attribs[] = {
|
||||
EGL_BLUE_SIZE, 8,
|
||||
EGL_GREEN_SIZE, 8,
|
||||
EGL_RED_SIZE, 8,
|
||||
EGL_ALPHA_SIZE, 8,
|
||||
EGL_NONE};
|
||||
#endif
|
||||
|
||||
orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *)calloc(1, sizeof(*ctx_orbis));
|
||||
|
||||
if (!ctx_orbis)
|
||||
return NULL;
|
||||
|
||||
nx_ctx_ptr = ctx_orbis;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
|
||||
memset(&ctx_orbis->pgl_config, 0, sizeof(ctx_orbis->pgl_config));
|
||||
{
|
||||
ctx_orbis->pgl_config.size=sizeof(ctx_orbis->pgl_config);
|
||||
ctx_orbis->pgl_config.flags=SCE_PGL_FLAGS_USE_COMPOSITE_EXT | SCE_PGL_FLAGS_USE_FLEXIBLE_MEMORY | 0x60;
|
||||
ctx_orbis->pgl_config.processOrder=1;
|
||||
ctx_orbis->pgl_config.systemSharedMemorySize=0x200000;
|
||||
ctx_orbis->pgl_config.videoSharedMemorySize=0x2400000;
|
||||
ctx_orbis->pgl_config.maxMappedFlexibleMemory=0xAA00000;
|
||||
ctx_orbis->pgl_config.drawCommandBufferSize=0xC0000;
|
||||
ctx_orbis->pgl_config.lcueResourceBufferSize=0x10000;
|
||||
ctx_orbis->pgl_config.dbgPosCmd_0x40=ATTR_ORBISGL_WIDTH;
|
||||
ctx_orbis->pgl_config.dbgPosCmd_0x44=ATTR_ORBISGL_HEIGHT;
|
||||
ctx_orbis->pgl_config.dbgPosCmd_0x48=0;
|
||||
ctx_orbis->pgl_config.dbgPosCmd_0x4C=0;
|
||||
ctx_orbis->pgl_config.unk_0x5C=2;
|
||||
}
|
||||
ret = scePigletSetConfigurationVSH(&ctx_orbis->pgl_config);
|
||||
if (!ret)
|
||||
{
|
||||
printf("[ORBISGL] scePigletSetConfigurationVSH failed 0x%08X.\n",ret);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!egl_init_context(&ctx_orbis->egl, EGL_NONE, EGL_DEFAULT_DISPLAY,
|
||||
&major, &minor, &n, attribs, NULL))
|
||||
{
|
||||
egl_report_error();
|
||||
printf("[ORBIS]: EGL error: %d.\n", eglGetError());
|
||||
goto error;
|
||||
}
|
||||
#endif
|
||||
|
||||
return ctx_orbis;
|
||||
|
||||
error:
|
||||
orbis_ctx_destroy(video_driver);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void orbis_ctx_check_window(void *data, bool *quit,
|
||||
bool *resize, unsigned *width, unsigned *height, bool is_shutdown)
|
||||
{
|
||||
unsigned new_width, new_height;
|
||||
|
||||
orbis_ctx_get_video_size(data, &new_width, &new_height);
|
||||
|
||||
if (new_width != *width || new_height != *height)
|
||||
{
|
||||
*width = new_width;
|
||||
*height = new_height;
|
||||
*resize = true;
|
||||
}
|
||||
|
||||
*quit = (bool)false;
|
||||
}
|
||||
|
||||
static bool orbis_ctx_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
/* Create an EGL rendering context */
|
||||
static const EGLint contextAttributeList[] =
|
||||
{
|
||||
EGL_CONTEXT_CLIENT_VERSION, 2,
|
||||
EGL_NONE};
|
||||
|
||||
orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *)data;
|
||||
|
||||
ctx_orbis->width = ATTR_ORBISGL_HEIGHT;
|
||||
ctx_orbis->height = ATTR_ORBISGL_WIDTH;
|
||||
|
||||
ctx_orbis->native_window.width = ctx_orbis->width;
|
||||
ctx_orbis->native_window.height = ctx_orbis->height;
|
||||
|
||||
ctx_orbis->refresh_rate = 60;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
if (!egl_create_context(&ctx_orbis->egl, contextAttributeList))
|
||||
{
|
||||
egl_report_error();
|
||||
goto error;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
if (!egl_create_surface(&ctx_orbis->egl, &ctx_orbis->native_window))
|
||||
goto error;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
||||
error:
|
||||
printf("[ctx_orbis]: EGL error: %d.\n", eglGetError());
|
||||
orbis_ctx_destroy(data);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void orbis_ctx_input_driver(void *data,
|
||||
const char *name,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
*input = NULL;
|
||||
*input_data = NULL;
|
||||
}
|
||||
|
||||
static enum gfx_ctx_api orbis_ctx_get_api(void *data)
|
||||
{
|
||||
return ctx_orbis_api;
|
||||
}
|
||||
|
||||
static bool orbis_ctx_bind_api(void *data,
|
||||
enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||
{
|
||||
(void)data;
|
||||
ctx_orbis_api = api;
|
||||
|
||||
if (api == GFX_CTX_OPENGL_ES_API)
|
||||
if (eglBindAPI(EGL_OPENGL_ES_API) != EGL_FALSE)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool orbis_ctx_has_focus(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool orbis_ctx_suppress_screensaver(void *data, bool enable)
|
||||
{
|
||||
(void)data;
|
||||
(void)enable;
|
||||
return false;
|
||||
}
|
||||
|
||||
static void orbis_ctx_set_swap_interval(void *data,
|
||||
int swap_interval)
|
||||
{
|
||||
orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
egl_set_swap_interval(&ctx_orbis->egl, swap_interval);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void orbis_ctx_swap_buffers(void *data, void *data2)
|
||||
{
|
||||
orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
egl_swap_buffers(&ctx_orbis->egl);
|
||||
#endif
|
||||
}
|
||||
|
||||
static gfx_ctx_proc_t orbis_ctx_get_proc_address(const char *symbol)
|
||||
{
|
||||
#ifdef HAVE_EGL
|
||||
return egl_get_proc_address(symbol);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void orbis_ctx_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
egl_bind_hw_render(&ctx_orbis->egl, enable);
|
||||
#endif
|
||||
}
|
||||
|
||||
static uint32_t orbis_ctx_get_flags(void *data)
|
||||
{
|
||||
uint32_t flags = 0;
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_NONE);
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
static void orbis_ctx_set_flags(void *data, uint32_t flags)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static float orbis_ctx_get_refresh_rate(void *data)
|
||||
{
|
||||
orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *)data;
|
||||
|
||||
return ctx_orbis->refresh_rate;
|
||||
}
|
||||
|
||||
const gfx_ctx_driver_t orbis_ctx = {
|
||||
orbis_ctx_init,
|
||||
orbis_ctx_destroy,
|
||||
orbis_ctx_get_api,
|
||||
orbis_ctx_bind_api,
|
||||
orbis_ctx_set_swap_interval,
|
||||
orbis_ctx_set_video_mode,
|
||||
orbis_ctx_get_video_size,
|
||||
orbis_ctx_get_refresh_rate,
|
||||
NULL, /* get_video_output_size */
|
||||
NULL, /* get_video_output_prev */
|
||||
NULL, /* get_video_output_next */
|
||||
NULL, /* get_metrics */
|
||||
NULL,
|
||||
NULL, /* update_title */
|
||||
orbis_ctx_check_window,
|
||||
NULL, /* set_resize */
|
||||
orbis_ctx_has_focus,
|
||||
orbis_ctx_suppress_screensaver,
|
||||
NULL, /* has_windowed */
|
||||
orbis_ctx_swap_buffers,
|
||||
orbis_ctx_input_driver,
|
||||
orbis_ctx_get_proc_address,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"orbis",
|
||||
orbis_ctx_get_flags,
|
||||
orbis_ctx_set_flags,
|
||||
orbis_ctx_bind_hw_render,
|
||||
NULL,
|
||||
NULL};
|
@ -357,6 +357,9 @@ static const video_driver_t *video_drivers[] = {
|
||||
};
|
||||
|
||||
static const gfx_ctx_driver_t *gfx_ctx_drivers[] = {
|
||||
#if defined(ORBIS)
|
||||
&orbis_ctx,
|
||||
#endif
|
||||
#if defined(HAVE_LIBNX) && defined(HAVE_OPENGL)
|
||||
&switch_ctx,
|
||||
#endif
|
||||
|
@ -1299,6 +1299,7 @@ extern const gfx_ctx_driver_t gfx_ctx_khr_display;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_gdi;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_sixel;
|
||||
extern const gfx_ctx_driver_t switch_ctx;
|
||||
extern const gfx_ctx_driver_t orbis_ctx;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_null;
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
/* Common implementation of NTSC filters */
|
||||
|
||||
#include <assert.h>
|
||||
#include <retro_assert.h>
|
||||
#include <math.h>
|
||||
|
||||
/* Copyright (C) 2006 Shay Green. This module is free software; you
|
||||
@ -121,7 +121,7 @@ static void init_filters( init_t* impl, snes_ntsc_setup_t const* setup )
|
||||
{
|
||||
int x = kernel_size * 3 / 2 - kernel_half + i;
|
||||
kernels [x] *= sum;
|
||||
assert( kernels [x] == kernels [x] ); /* catch numerical instability */
|
||||
retro_assert( kernels [x] == kernels [x] ); /* catch numerical instability */
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ static void init_filters( init_t* impl, snes_ntsc_setup_t const* setup )
|
||||
for ( x = i; x < kernel_size; x += 2 )
|
||||
{
|
||||
kernels [x] *= sum;
|
||||
assert( kernels [x] == kernels [x] ); /* catch numerical instability */
|
||||
retro_assert( kernels [x] == kernels [x] ); /* catch numerical instability */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -969,6 +969,8 @@ FRONTEND
|
||||
#include "../frontend/drivers/platform_wiiu.c"
|
||||
#elif defined(PSP) || defined(VITA)
|
||||
#include "../frontend/drivers/platform_psp.c"
|
||||
#elif defined(ORBIS)
|
||||
#include "../frontend/drivers/platform_orbis.c"
|
||||
#elif defined(PS2)
|
||||
#include "../frontend/drivers/platform_ps2.c"
|
||||
#elif defined(_3DS)
|
||||
|
@ -55,6 +55,8 @@
|
||||
|
||||
#ifdef HAVE_DR_MP3
|
||||
#define DR_MP3_IMPLEMENTATION
|
||||
#include <retro_assert.h>
|
||||
#define DRMP3_ASSERT(expression) retro_assert(expression)
|
||||
#include <dr/dr_mp3.h>
|
||||
#endif
|
||||
|
||||
|
@ -419,7 +419,7 @@ static INLINE int rjpeg__jpeg_huff_decode(rjpeg__jpeg *j, rjpeg__huffman *h)
|
||||
|
||||
/* convert the huffman code to the symbol id */
|
||||
c = ((j->code_buffer >> (32 - k)) & rjpeg__bmask[k]) + h->delta[k];
|
||||
assert((((j->code_buffer) >> (32 - h->size[c])) & rjpeg__bmask[h->size[c]]) == h->code[c]);
|
||||
retro_assert((((j->code_buffer) >> (32 - h->size[c])) & rjpeg__bmask[h->size[c]]) == h->code[c]);
|
||||
|
||||
/* convert the id to a symbol */
|
||||
j->code_bits -= k;
|
||||
@ -441,7 +441,7 @@ static INLINE int rjpeg__extend_receive(rjpeg__jpeg *j, int n)
|
||||
|
||||
sgn = (int32_t)j->code_buffer >> 31; /* sign bit is always in MSB */
|
||||
k = rjpeg_lrot(j->code_buffer, n);
|
||||
assert(n >= 0 && n < (int) (sizeof(rjpeg__bmask)/sizeof(*rjpeg__bmask)));
|
||||
retro_assert(n >= 0 && n < (int) (sizeof(rjpeg__bmask)/sizeof(*rjpeg__bmask)));
|
||||
j->code_buffer = k & ~rjpeg__bmask[n];
|
||||
k &= rjpeg__bmask[n];
|
||||
j->code_bits -= n;
|
||||
|
@ -60,7 +60,7 @@
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#if defined(VITA) || defined(BSD)
|
||||
#if defined(VITA) || defined(BSD) || defined(ORBIS)
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
|
@ -24,6 +24,9 @@
|
||||
#include <features/features_cpu.h>
|
||||
|
||||
#define DG_DYNARR_IMPLEMENTATION
|
||||
#include <stdio.h>
|
||||
#include <retro_assert.h>
|
||||
#define DG_DYNARR_ASSERT(cond, msg) (void)0
|
||||
#include <array/dynarray.h>
|
||||
#undef DG_DYNARR_IMPLEMENTATION
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user