mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-02-20 19:40:39 +00:00
Add QNX frontend context file
This commit is contained in:
parent
2c7986f4fc
commit
003635499f
@ -21,9 +21,7 @@
|
||||
#include "frontend_context.h"
|
||||
frontend_ctx_driver_t *frontend_ctx;
|
||||
|
||||
#if defined(__QNX__)
|
||||
#include <bps/bps.h>
|
||||
#elif defined(__APPLE__)
|
||||
#if defined(__APPLE__)
|
||||
#include <dispatch/dispatch.h>
|
||||
#include <pthread.h>
|
||||
#include "../apple/RetroArch/rarch_wrapper.h"
|
||||
@ -76,53 +74,40 @@ static bool libretro_install_core(const char *path_prefix,
|
||||
return true;
|
||||
}
|
||||
|
||||
#define MAKE_DIR(x, name) { \
|
||||
RARCH_LOG("Checking directory name %s [%s]\n", name, x); \
|
||||
if (strlen(x) > 0) \
|
||||
{ \
|
||||
if (!path_is_directory((x)) )\
|
||||
{ \
|
||||
RARCH_WARN("Directory \"%s\" does not exists, creating\n", (x)); \
|
||||
if (mkdir((x), 0777) != 0) \
|
||||
{ \
|
||||
RARCH_ERR("Could not create directory \"%s\"\n", (x)); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
#endif
|
||||
|
||||
#ifdef RARCH_CONSOLE
|
||||
void rarch_make_dir(const char *x, const char *name)
|
||||
{
|
||||
RARCH_LOG("Checking directory name %s [%s]\n", name, x);
|
||||
if (strlen(x) > 0)
|
||||
{
|
||||
if (!path_is_directory(x))
|
||||
{
|
||||
RARCH_WARN("Directory \"%s\" does not exists, creating\n", x);
|
||||
if (mkdir((x), 0777) != 0)
|
||||
RARCH_ERR("Could not create directory \"%s\"\n", x);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void rarch_get_environment(int argc, char *argv[])
|
||||
{
|
||||
#if defined(__QNX__) && !defined(HAVE_BB10)
|
||||
strlcpy(g_settings.libretro, "app/native/lib", sizeof(g_settings.libretro));
|
||||
strlcpy(g_extern.config_path, "app/native/retroarch.cfg", sizeof(g_extern.config_path));
|
||||
strlcpy(g_settings.video.shader_dir, "app/native/shaders_glsl", sizeof(g_settings.video.shader_dir));
|
||||
|
||||
config_load();
|
||||
|
||||
g_extern.verbose = true;
|
||||
#elif defined(RARCH_CONSOLE)
|
||||
|
||||
#if defined(HAVE_LOGGER)
|
||||
g_extern.verbose = true;
|
||||
logger_init();
|
||||
#elif defined(HAVE_FILE_LOGGER)
|
||||
g_extern.verbose = true;
|
||||
g_extern.log_file = fopen("/retroarch-log.txt", "w");
|
||||
#endif
|
||||
g_extern.verbose = true;
|
||||
|
||||
if (frontend_ctx && frontend_ctx->get_environment_settings)
|
||||
frontend_ctx->get_environment_settings(argc, argv);
|
||||
|
||||
MAKE_DIR(default_paths.port_dir, "port_dir");
|
||||
MAKE_DIR(default_paths.system_dir, "system_dir");
|
||||
MAKE_DIR(default_paths.savestate_dir, "savestate_dir");
|
||||
MAKE_DIR(default_paths.sram_dir, "sram_dir");
|
||||
MAKE_DIR(default_paths.input_presets_dir, "input_presets_dir");
|
||||
if (frontend_ctx && frontend_ctx->environment_get)
|
||||
frontend_ctx->environment_get(argc, argv);
|
||||
|
||||
config_load();
|
||||
|
||||
#if defined(RARCH_CONSOLE)
|
||||
init_libretro_sym(false);
|
||||
rarch_init_system_info();
|
||||
|
||||
@ -164,9 +149,10 @@ static void rarch_get_environment(int argc, char *argv[])
|
||||
|
||||
static void system_shutdown(void)
|
||||
{
|
||||
#if defined(__QNX__)
|
||||
bps_shutdown();
|
||||
#elif defined(__APPLE__)
|
||||
if (frontend_ctx && frontend_ctx->shutdown)
|
||||
frontend_ctx->shutdown(true);
|
||||
|
||||
#if defined(__APPLE__)
|
||||
dispatch_async_f(dispatch_get_main_queue(), 0, apple_rarch_exited);
|
||||
#endif
|
||||
}
|
||||
@ -230,11 +216,6 @@ int rarch_main(int argc, char *argv[])
|
||||
if ((frontend_ctx = (frontend_ctx_driver_t*)frontend_ctx_init_first()) == NULL)
|
||||
RARCH_WARN("Could not find valid frontend context.\n");
|
||||
|
||||
#if defined(__QNX__) && !defined(HAVE_BB10)
|
||||
//Initialize BPS libraries
|
||||
bps_initialize();
|
||||
#endif
|
||||
|
||||
if (frontend_ctx && frontend_ctx->init)
|
||||
frontend_ctx->init();
|
||||
|
||||
|
@ -30,6 +30,9 @@ static const frontend_ctx_driver_t *frontend_ctx_drivers[] = {
|
||||
#if defined(GEKKO)
|
||||
&frontend_ctx_gx,
|
||||
#endif
|
||||
#if defined(__QNX__)
|
||||
&frontend_ctx_qnx,
|
||||
#endif
|
||||
};
|
||||
|
||||
const frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident)
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
typedef struct frontend_ctx_driver
|
||||
{
|
||||
void (*get_environment_settings)(int argc, char *argv[]);
|
||||
void (*environment_get)(int argc, char *argv[]);
|
||||
|
||||
void (*init)(void);
|
||||
void (*deinit)(void);
|
||||
@ -49,8 +49,13 @@ typedef struct frontend_ctx_driver
|
||||
extern const frontend_ctx_driver_t frontend_ctx_gx;
|
||||
extern const frontend_ctx_driver_t frontend_ctx_ps3;
|
||||
extern const frontend_ctx_driver_t frontend_ctx_xdk;
|
||||
extern const frontend_ctx_driver_t frontend_ctx_qnx;
|
||||
|
||||
const frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident); // Finds driver with ident. Does not initialize.
|
||||
const frontend_ctx_driver_t *frontend_ctx_init_first(void); // Finds first suitable driver and initializes.
|
||||
|
||||
#ifdef RARCH_CONSOLE
|
||||
extern void rarch_make_dir(const char *x, const char *name);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -265,6 +265,14 @@ static void get_environment_settings(int argc, char *argv[])
|
||||
else
|
||||
gx_rom_path[0] = '\0';
|
||||
#endif
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
rarch_make_dir(default_paths.port_dir, "port_dir");
|
||||
rarch_make_dir(default_paths.system_dir, "system_dir");
|
||||
rarch_make_dir(default_paths.savestate_dir, "savestate_dir");
|
||||
rarch_make_dir(default_paths.sram_dir, "sram_dir");
|
||||
rarch_make_dir(default_paths.input_presets_dir, "input_presets_dir");
|
||||
#endif
|
||||
}
|
||||
|
||||
extern void __exception_setreload(int t);
|
||||
|
@ -277,6 +277,14 @@ static void get_environment_settings(int argc, char *argv[])
|
||||
snprintf(g_extern.config_path, sizeof(g_extern.config_path), "%s/retroarch.cfg", default_paths.port_dir);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
rarch_make_dir(default_paths.port_dir, "port_dir");
|
||||
rarch_make_dir(default_paths.system_dir, "system_dir");
|
||||
rarch_make_dir(default_paths.savestate_dir, "savestate_dir");
|
||||
rarch_make_dir(default_paths.sram_dir, "sram_dir");
|
||||
rarch_make_dir(default_paths.input_presets_dir, "input_presets_dir");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void system_init(void)
|
||||
|
@ -67,6 +67,14 @@ static void get_environment_settings(int argc, char *argv[])
|
||||
snprintf(default_paths.input_presets_dir, sizeof(default_paths.input_presets_dir), "%s/presets", default_paths.core_dir);
|
||||
snprintf(default_paths.border_dir, sizeof(default_paths.border_dir), "%s/borders", default_paths.core_dir);
|
||||
snprintf(g_extern.config_path, sizeof(g_extern.config_path), "%s/retroarch.cfg", default_paths.port_dir);
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
rarch_make_dir(default_paths.port_dir, "port_dir");
|
||||
rarch_make_dir(default_paths.system_dir, "system_dir");
|
||||
rarch_make_dir(default_paths.savestate_dir, "savestate_dir");
|
||||
rarch_make_dir(default_paths.sram_dir, "sram_dir");
|
||||
rarch_make_dir(default_paths.input_presets_dir, "input_presets_dir");
|
||||
#endif
|
||||
}
|
||||
|
||||
int callback_thread(SceSize args, void *argp)
|
||||
@ -97,13 +105,6 @@ static void system_init(void)
|
||||
setup_callback();
|
||||
}
|
||||
|
||||
static int system_process_args(int argc, char *argv[])
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void system_deinit(void)
|
||||
{
|
||||
sceKernelExitGame();
|
||||
@ -114,7 +115,7 @@ const frontend_ctx_driver_t frontend_ctx_xdk = {
|
||||
system_init, /* init */
|
||||
system_deinit, /* deinit */
|
||||
NULL, /* exitspawn */
|
||||
system_process_args, /* process_args */
|
||||
NULL, /* process_args */
|
||||
NULL, /* exec */
|
||||
NULL, /* shutdown */
|
||||
"psp",
|
||||
|
59
frontend/platform/platform_qnx.c
Normal file
59
frontend/platform/platform_qnx.c
Normal file
@ -0,0 +1,59 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2013 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2013 - 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 <bps/bps.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include "../../boolean.h"
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
static void get_environment_settings(int argc, char *argv[])
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
/* FIXME - should this apply for both BB10 and PB? */
|
||||
#if defined(__QNX__) && !defined(HAVE_BB10)
|
||||
strlcpy(g_settings.libretro, "app/native/lib", sizeof(g_settings.libretro));
|
||||
strlcpy(g_extern.config_path, "app/native/retroarch.cfg", sizeof(g_extern.config_path));
|
||||
strlcpy(g_settings.video.shader_dir, "app/native/shaders_glsl", sizeof(g_settings.video.shader_dir));
|
||||
#endif
|
||||
}
|
||||
|
||||
static void system_init(void)
|
||||
{
|
||||
/* FIXME - should this apply for both BB10 and PB? */
|
||||
#if defined(__QNX__) && !defined(HAVE_BB10)
|
||||
bps_initialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void system_shutdown(void)
|
||||
{
|
||||
bps_shutdown();
|
||||
}
|
||||
|
||||
const frontend_ctx_driver_t frontend_ctx_xdk = {
|
||||
get_environment_settings, /* get_environment_settings */
|
||||
system_init, /* init */
|
||||
NULL, /* deinit */
|
||||
NULL, /* exitspawn */
|
||||
NULL, /* process_args */
|
||||
NULL, /* exec */
|
||||
system_shutdown, /* shutdown */
|
||||
"qnx",
|
||||
};
|
@ -247,6 +247,14 @@ static void get_environment_settings(int argc, char *argv[])
|
||||
strlcpy(default_paths.system_dir, "game:\\system", sizeof(default_paths.system_dir));
|
||||
strlcpy(default_paths.filebrowser_startup_dir, "game:", sizeof(default_paths.filebrowser_startup_dir));
|
||||
#endif
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
rarch_make_dir(default_paths.port_dir, "port_dir");
|
||||
rarch_make_dir(default_paths.system_dir, "system_dir");
|
||||
rarch_make_dir(default_paths.savestate_dir, "savestate_dir");
|
||||
rarch_make_dir(default_paths.sram_dir, "sram_dir");
|
||||
rarch_make_dir(default_paths.input_presets_dir, "input_presets_dir");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void system_init(void)
|
||||
|
@ -456,6 +456,8 @@ FRONTEND
|
||||
#include "../frontend/platform/platform_xdk.c"
|
||||
#elif defined(PSP)
|
||||
#include "../frontend/platform/platform_psp.c"
|
||||
#elif defined(__QNX__)
|
||||
#include "../frontend/platform/platform_qnx.c"
|
||||
#endif
|
||||
|
||||
/*============================================================
|
||||
|
Loading…
x
Reference in New Issue
Block a user