2013-01-08 06:44:57 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2014-01-01 00:50:59 +00:00
|
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
2016-01-10 03:06:50 +00:00
|
|
|
* Copyright (C) 2011-2016 - Daniel De Matteis
|
2013-01-08 06:44:57 +00:00
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2015-07-15 00:09:05 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <sys/process.h>
|
|
|
|
#include <sysutil/sysutil_common.h>
|
|
|
|
#ifdef IS_SALAMANDER
|
|
|
|
#include <netex/net.h>
|
|
|
|
#include <np.h>
|
|
|
|
#include <np/drm.h>
|
|
|
|
#include <cell/sysmodule.h>
|
|
|
|
#endif
|
|
|
|
|
2012-09-16 02:04:25 +00:00
|
|
|
#include <sys/process.h>
|
2012-01-11 00:04:17 +00:00
|
|
|
|
2016-09-08 11:17:14 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "../../config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <compat/strl.h>
|
2016-09-16 15:25:47 +00:00
|
|
|
#include <string/stdstring.h>
|
2015-06-15 20:45:02 +00:00
|
|
|
#include <file/file_path.h>
|
|
|
|
#ifndef IS_SALAMANDER
|
2016-03-20 13:53:54 +00:00
|
|
|
#include <lists/file_list.h>
|
2015-06-15 20:45:02 +00:00
|
|
|
#endif
|
|
|
|
|
2015-11-29 00:58:15 +00:00
|
|
|
#include "../frontend_driver.h"
|
2016-06-20 03:20:14 +00:00
|
|
|
#include "../../file_path_special.h"
|
2015-08-10 21:11:40 +00:00
|
|
|
#include "../../defines/ps3_defines.h"
|
2015-11-29 00:58:15 +00:00
|
|
|
#include "../../defaults.h"
|
2015-11-23 11:03:38 +00:00
|
|
|
#include "../../verbosity.h"
|
2013-01-06 04:22:21 +00:00
|
|
|
|
2012-01-29 22:11:47 +00:00
|
|
|
#define EMULATOR_CONTENT_DIR "SSNE10000"
|
|
|
|
|
2012-09-11 10:33:46 +00:00
|
|
|
#ifndef __PSL1GHT__
|
|
|
|
#define NP_POOL_SIZE (128*1024)
|
2012-02-25 19:11:57 +00:00
|
|
|
static uint8_t np_pool[NP_POOL_SIZE];
|
2012-09-11 10:33:46 +00:00
|
|
|
#endif
|
2012-02-20 06:50:59 +00:00
|
|
|
|
2013-01-08 23:54:46 +00:00
|
|
|
#ifdef IS_SALAMANDER
|
|
|
|
SYS_PROCESS_PARAM(1001, 0x100000)
|
|
|
|
#else
|
2012-06-16 20:03:08 +00:00
|
|
|
SYS_PROCESS_PARAM(1001, 0x200000)
|
2013-01-08 23:54:46 +00:00
|
|
|
#endif
|
2013-03-23 04:17:39 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_MULTIMAN
|
|
|
|
#define MULTIMAN_SELF_FILE "/dev_hdd0/game/BLES80608/USRDIR/RELOAD.SELF"
|
2014-10-02 19:17:32 +00:00
|
|
|
static bool multiman_detected = false;
|
2013-03-23 04:17:39 +00:00
|
|
|
#endif
|
2012-01-05 21:47:34 +00:00
|
|
|
|
2015-07-27 17:28:41 +00:00
|
|
|
#ifndef IS_SALAMANDER
|
2016-02-05 17:40:24 +00:00
|
|
|
static enum frontend_fork ps3_fork_mode = FRONTEND_FORK_NONE;
|
2014-10-02 19:17:32 +00:00
|
|
|
|
2015-07-27 01:44:28 +00:00
|
|
|
static void frontend_ps3_shutdown(bool unused)
|
|
|
|
{
|
|
|
|
sys_process_exit(0);
|
|
|
|
}
|
2015-07-27 17:28:41 +00:00
|
|
|
#endif
|
2013-01-08 23:54:46 +00:00
|
|
|
|
2012-05-25 14:24:28 +00:00
|
|
|
#ifdef HAVE_SYSUTILS
|
2014-09-02 15:42:44 +00:00
|
|
|
static void callback_sysutil_exit(uint64_t status,
|
|
|
|
uint64_t param, void *userdata)
|
2012-02-04 12:29:02 +00:00
|
|
|
{
|
2015-03-21 03:43:18 +00:00
|
|
|
|
2013-01-08 23:54:46 +00:00
|
|
|
(void)param;
|
|
|
|
(void)userdata;
|
|
|
|
(void)status;
|
|
|
|
|
|
|
|
#ifndef IS_SALAMANDER
|
2012-04-11 00:42:27 +00:00
|
|
|
|
|
|
|
switch (status)
|
|
|
|
{
|
|
|
|
case CELL_SYSUTIL_REQUEST_EXITGAME:
|
2015-03-21 03:43:18 +00:00
|
|
|
{
|
2015-07-27 01:44:28 +00:00
|
|
|
frontend_ctx_driver_t *frontend = frontend_get_ptr();
|
2015-06-25 11:46:32 +00:00
|
|
|
|
2015-07-27 01:44:28 +00:00
|
|
|
if (frontend)
|
|
|
|
frontend->shutdown = frontend_ps3_shutdown;
|
2015-12-04 11:44:12 +00:00
|
|
|
|
|
|
|
runloop_ctl(RUNLOOP_CTL_SET_SHUTDOWN, NULL);
|
2015-03-21 03:43:18 +00:00
|
|
|
}
|
2012-11-26 06:03:31 +00:00
|
|
|
break;
|
2012-04-11 00:42:27 +00:00
|
|
|
}
|
2013-01-08 23:54:46 +00:00
|
|
|
#endif
|
2012-02-04 12:29:02 +00:00
|
|
|
}
|
2012-05-25 14:24:28 +00:00
|
|
|
#endif
|
2012-02-04 12:29:02 +00:00
|
|
|
|
2014-06-03 01:35:12 +00:00
|
|
|
static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
|
|
|
|
void *args, void *params_data)
|
2012-01-11 00:04:17 +00:00
|
|
|
{
|
2013-08-10 18:59:10 +00:00
|
|
|
#ifndef IS_SALAMANDER
|
2016-05-31 02:42:04 +00:00
|
|
|
bool original_verbose = verbosity_is_enabled();
|
|
|
|
verbosity_enable();
|
2014-05-31 16:34:06 +00:00
|
|
|
#endif
|
2013-08-10 18:59:10 +00:00
|
|
|
|
2014-05-31 16:34:06 +00:00
|
|
|
(void)args;
|
|
|
|
#ifndef IS_SALAMANDER
|
2013-08-10 18:59:10 +00:00
|
|
|
#if defined(HAVE_LOGGER)
|
|
|
|
logger_init();
|
|
|
|
#elif defined(HAVE_FILE_LOGGER)
|
2015-11-23 14:45:02 +00:00
|
|
|
retro_main_log_file_init("/retroarch-log.txt");
|
2013-08-10 18:59:10 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2012-04-11 00:42:27 +00:00
|
|
|
int ret;
|
|
|
|
unsigned int get_type;
|
|
|
|
unsigned int get_attributes;
|
|
|
|
CellGameContentSize size;
|
2015-06-12 21:38:46 +00:00
|
|
|
char dirName[CELL_GAME_DIRNAME_SIZE] = {0};
|
2012-06-30 11:37:18 +00:00
|
|
|
|
2012-05-30 14:30:25 +00:00
|
|
|
#ifdef HAVE_MULTIMAN
|
2012-08-18 16:25:38 +00:00
|
|
|
/* not launched from external launcher, set default path */
|
2013-04-29 13:19:16 +00:00
|
|
|
// second param is multiMAN SELF file
|
2014-09-02 15:42:44 +00:00
|
|
|
if(path_file_exists(argv[2]) && *argc > 1
|
2016-09-16 15:25:47 +00:00
|
|
|
&& (string_is_equal(argv[2], EMULATOR_CONTENT_DIR)))
|
2012-04-11 00:42:27 +00:00
|
|
|
{
|
2014-10-02 19:17:32 +00:00
|
|
|
multiman_detected = true;
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_LOG("Started from multiMAN, auto-game start enabled.\n");
|
2012-04-11 00:42:27 +00:00
|
|
|
}
|
|
|
|
else
|
2012-05-30 14:30:25 +00:00
|
|
|
#endif
|
2013-01-08 23:54:46 +00:00
|
|
|
#ifndef IS_SALAMANDER
|
2015-12-26 06:45:19 +00:00
|
|
|
if (*argc > 1 && !string_is_empty(argv[1]))
|
2014-06-03 04:37:57 +00:00
|
|
|
{
|
2016-09-08 14:18:30 +00:00
|
|
|
static char path[PATH_MAX_LENGTH] = {0};
|
|
|
|
struct rarch_main_wrap *args = (struct rarch_main_wrap*)params_data;
|
2014-06-03 04:37:57 +00:00
|
|
|
|
|
|
|
if (args)
|
|
|
|
{
|
|
|
|
strlcpy(path, argv[1], sizeof(path));
|
|
|
|
|
|
|
|
args->touched = true;
|
2014-07-28 17:55:28 +00:00
|
|
|
args->no_content = false;
|
2014-06-03 04:37:57 +00:00
|
|
|
args->verbose = false;
|
|
|
|
args->config_path = NULL;
|
|
|
|
args->sram_path = NULL;
|
|
|
|
args->state_path = NULL;
|
2014-07-28 17:55:28 +00:00
|
|
|
args->content_path = path;
|
2014-06-03 04:37:57 +00:00
|
|
|
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]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
RARCH_WARN("Started from Salamander, auto-game start disabled.\n");
|
2013-01-08 23:54:46 +00:00
|
|
|
#endif
|
2012-04-11 00:42:27 +00:00
|
|
|
|
|
|
|
memset(&size, 0x00, sizeof(CellGameContentSize));
|
|
|
|
|
|
|
|
ret = cellGameBootCheck(&get_type, &get_attributes, &size, dirName);
|
|
|
|
if(ret < 0)
|
|
|
|
{
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_ERR("cellGameBootCheck() Error: 0x%x.\n", ret);
|
2012-04-11 00:42:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-09-28 21:00:22 +00:00
|
|
|
char content_info_path[PATH_MAX_LENGTH] = {0};
|
|
|
|
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_LOG("cellGameBootCheck() OK.\n");
|
|
|
|
RARCH_LOG("Directory name: [%s].\n", dirName);
|
2014-09-09 15:25:05 +00:00
|
|
|
RARCH_LOG(" HDD Free Size (in KB) = [%d] Size (in KB) = [%d] System Size (in KB) = [%d].\n",
|
|
|
|
size.hddFreeSizeKB, size.sizeKB, size.sysSizeKB);
|
2012-04-14 03:30:10 +00:00
|
|
|
|
|
|
|
switch(get_type)
|
|
|
|
{
|
|
|
|
case CELL_GAME_GAMETYPE_DISC:
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_LOG("RetroArch was launched on Optical Disc Drive.\n");
|
2012-11-26 06:03:31 +00:00
|
|
|
break;
|
|
|
|
case CELL_GAME_GAMETYPE_HDD:
|
|
|
|
RARCH_LOG("RetroArch was launched on HDD.\n");
|
|
|
|
break;
|
2012-04-14 03:30:10 +00:00
|
|
|
}
|
|
|
|
|
2014-09-02 15:42:44 +00:00
|
|
|
if((get_attributes & CELL_GAME_ATTRIBUTE_APP_HOME)
|
|
|
|
== CELL_GAME_ATTRIBUTE_APP_HOME)
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_LOG("RetroArch was launched from host machine (APP_HOME).\n");
|
2012-04-14 03:30:10 +00:00
|
|
|
|
2015-09-28 21:00:22 +00:00
|
|
|
ret = cellGameContentPermit(content_info_path, g_defaults.dir.port);
|
2012-04-14 03:30:10 +00:00
|
|
|
|
2012-05-30 14:30:25 +00:00
|
|
|
#ifdef HAVE_MULTIMAN
|
2014-10-02 19:17:32 +00:00
|
|
|
if (multiman_detected)
|
2012-04-14 03:30:10 +00:00
|
|
|
{
|
2015-09-28 21:00:22 +00:00
|
|
|
fill_pathname_join(content_info_path, "/dev_hdd0/game/",
|
|
|
|
EMULATOR_CONTENT_DIR, sizeof(content_info_path));
|
|
|
|
fill_pathname_join(g_defaults.dir.port, content_info_path,
|
2015-07-27 15:18:10 +00:00
|
|
|
"USRDIR", sizeof(g_defaults.dir.port));
|
2012-04-14 03:30:10 +00:00
|
|
|
}
|
2012-05-30 14:30:25 +00:00
|
|
|
#endif
|
2012-04-14 03:30:10 +00:00
|
|
|
|
|
|
|
if(ret < 0)
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_ERR("cellGameContentPermit() Error: 0x%x\n", ret);
|
2012-04-14 03:30:10 +00:00
|
|
|
else
|
|
|
|
{
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_LOG("cellGameContentPermit() OK.\n");
|
2015-09-28 21:00:22 +00:00
|
|
|
RARCH_LOG("content_info_path : [%s].\n", content_info_path);
|
2015-07-27 15:18:10 +00:00
|
|
|
RARCH_LOG("usrDirPath : [%s].\n", g_defaults.dir.port);
|
2012-04-14 03:30:10 +00:00
|
|
|
}
|
|
|
|
|
2016-07-22 22:15:37 +00:00
|
|
|
strlcpy(g_defaults.dir.content_history,
|
|
|
|
g_defaults.dir.port, sizeof(g_defaults.dir.content_history));
|
2015-07-27 15:18:10 +00:00
|
|
|
fill_pathname_join(g_defaults.dir.core, g_defaults.dir.port,
|
|
|
|
"cores", sizeof(g_defaults.dir.core));
|
2016-07-30 12:59:24 +00:00
|
|
|
fill_pathname_join(g_defaults.dir.core_info, g_defaults.dir.core,
|
|
|
|
"info", sizeof(g_defaults.dir.core_info));
|
2015-07-27 15:18:10 +00:00
|
|
|
fill_pathname_join(g_defaults.dir.savestate, g_defaults.dir.core,
|
|
|
|
"savestates", sizeof(g_defaults.dir.savestate));
|
|
|
|
fill_pathname_join(g_defaults.dir.sram, g_defaults.dir.core,
|
|
|
|
"savefiles", sizeof(g_defaults.dir.sram));
|
|
|
|
fill_pathname_join(g_defaults.dir.system, g_defaults.dir.core,
|
|
|
|
"system", sizeof(g_defaults.dir.system));
|
|
|
|
fill_pathname_join(g_defaults.dir.shader, g_defaults.dir.core,
|
|
|
|
"shaders_cg", sizeof(g_defaults.dir.shader));
|
|
|
|
fill_pathname_join(g_defaults.path.config, g_defaults.dir.port,
|
2016-06-20 03:20:14 +00:00
|
|
|
file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config));
|
2015-07-27 15:18:10 +00:00
|
|
|
fill_pathname_join(g_defaults.dir.overlay, g_defaults.dir.core,
|
|
|
|
"overlays", sizeof(g_defaults.dir.overlay));
|
|
|
|
fill_pathname_join(g_defaults.dir.assets, g_defaults.dir.core,
|
2015-11-01 10:28:25 +00:00
|
|
|
"assets", sizeof(g_defaults.dir.assets));
|
2016-01-18 14:29:47 +00:00
|
|
|
fill_pathname_join(g_defaults.dir.cursor, g_defaults.dir.core,
|
|
|
|
"database/cursors", sizeof(g_defaults.dir.cursor));
|
2016-01-12 08:01:57 +00:00
|
|
|
fill_pathname_join(g_defaults.dir.database, g_defaults.dir.core,
|
2016-01-18 14:29:47 +00:00
|
|
|
"database/rdb", sizeof(g_defaults.dir.database));
|
2015-07-27 15:18:10 +00:00
|
|
|
fill_pathname_join(g_defaults.dir.playlist, g_defaults.dir.core,
|
|
|
|
"playlists", sizeof(g_defaults.dir.playlist));
|
2012-04-11 00:42:27 +00:00
|
|
|
}
|
2014-05-31 16:34:06 +00:00
|
|
|
|
|
|
|
#ifndef IS_SALAMANDER
|
2016-05-31 02:42:04 +00:00
|
|
|
if (original_verbose)
|
|
|
|
verbosity_enable();
|
|
|
|
else
|
|
|
|
verbosity_disable();
|
2014-05-31 16:34:06 +00:00
|
|
|
#endif
|
2012-02-20 06:50:59 +00:00
|
|
|
}
|
|
|
|
|
2014-05-17 12:56:12 +00:00
|
|
|
static void frontend_ps3_init(void *data)
|
2012-01-05 21:47:34 +00:00
|
|
|
{
|
2013-11-03 15:38:56 +00:00
|
|
|
(void)data;
|
2012-05-25 14:24:28 +00:00
|
|
|
#ifdef HAVE_SYSUTILS
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_LOG("Registering system utility callback...\n");
|
2012-04-11 00:42:27 +00:00
|
|
|
cellSysutilRegisterCallback(0, callback_sysutil_exit, NULL);
|
2012-05-25 14:24:28 +00:00
|
|
|
#endif
|
2012-02-26 14:18:44 +00:00
|
|
|
|
2012-05-25 14:24:28 +00:00
|
|
|
#ifdef HAVE_SYSMODULES
|
2012-09-27 16:16:06 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_FREETYPE
|
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_FONT);
|
2012-09-27 16:19:10 +00:00
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_FREETYPE);
|
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_FONTFT);
|
2012-09-27 16:16:06 +00:00
|
|
|
#endif
|
|
|
|
|
2012-04-11 00:42:27 +00:00
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_IO);
|
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_FS);
|
2012-09-16 02:04:25 +00:00
|
|
|
#ifndef __PSL1GHT__
|
2012-04-11 00:42:27 +00:00
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_GAME);
|
2013-01-08 23:54:46 +00:00
|
|
|
#endif
|
|
|
|
#ifndef IS_SALAMANDER
|
|
|
|
#ifndef __PSL1GHT__
|
2012-04-11 00:42:27 +00:00
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_AVCONF_EXT);
|
2012-09-16 02:04:25 +00:00
|
|
|
#endif
|
2012-04-11 00:42:27 +00:00
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_PNGDEC);
|
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_JPGDEC);
|
2013-01-08 23:54:46 +00:00
|
|
|
#endif
|
2012-04-11 00:42:27 +00:00
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_NET);
|
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_NP);
|
2012-05-25 14:24:28 +00:00
|
|
|
#endif
|
2012-02-25 19:11:57 +00:00
|
|
|
|
2012-09-11 10:33:46 +00:00
|
|
|
#ifndef __PSL1GHT__
|
2012-04-11 00:42:27 +00:00
|
|
|
sys_net_initialize_network();
|
|
|
|
sceNpInit(NP_POOL_SIZE, np_pool);
|
2012-09-11 10:33:46 +00:00
|
|
|
#endif
|
2012-01-11 00:04:17 +00:00
|
|
|
|
2013-04-22 23:55:00 +00:00
|
|
|
#ifndef IS_SALAMANDER
|
2012-09-16 02:04:25 +00:00
|
|
|
#if (CELL_SDK_VERSION > 0x340000) && !defined(__PSL1GHT__)
|
2012-05-25 14:24:28 +00:00
|
|
|
#ifdef HAVE_SYSMODULES
|
2013-04-13 07:09:56 +00:00
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT);
|
2012-05-25 14:24:28 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYSUTILS
|
2013-04-13 07:09:56 +00:00
|
|
|
CellScreenShotSetParam screenshot_param = {0, 0, 0, 0};
|
2012-04-11 00:42:27 +00:00
|
|
|
|
2013-04-13 07:09:56 +00:00
|
|
|
screenshot_param.photo_title = "RetroArch PS3";
|
|
|
|
screenshot_param.game_title = "RetroArch PS3";
|
|
|
|
cellScreenShotSetParameter (&screenshot_param);
|
|
|
|
cellScreenShotEnable();
|
2012-05-25 14:24:28 +00:00
|
|
|
#endif
|
2012-01-16 14:45:55 +00:00
|
|
|
#endif
|
2012-06-19 03:10:42 +00:00
|
|
|
#endif
|
2013-01-08 00:26:18 +00:00
|
|
|
}
|
2012-01-11 21:27:07 +00:00
|
|
|
|
2014-05-17 12:56:12 +00:00
|
|
|
static void frontend_ps3_deinit(void *data)
|
2013-01-08 00:26:18 +00:00
|
|
|
{
|
2013-11-03 15:38:56 +00:00
|
|
|
(void)data;
|
2013-01-08 23:54:46 +00:00
|
|
|
#ifndef IS_SALAMANDER
|
|
|
|
|
2012-09-16 02:04:25 +00:00
|
|
|
#if defined(HAVE_SYSMODULES)
|
2012-09-27 16:16:06 +00:00
|
|
|
#ifdef HAVE_FREETYPE
|
2013-01-07 18:22:35 +00:00
|
|
|
/* Freetype font PRX */
|
2012-09-27 16:19:10 +00:00
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_FONTFT);
|
2012-09-27 16:16:06 +00:00
|
|
|
cellSysmoduleUnloadModule(CELL_SYSMODULE_FREETYPE);
|
|
|
|
cellSysmoduleUnloadModule(CELL_SYSMODULE_FONT);
|
|
|
|
#endif
|
|
|
|
|
2012-09-16 02:04:25 +00:00
|
|
|
#ifndef __PSL1GHT__
|
2013-01-07 18:22:35 +00:00
|
|
|
/* screenshot PRX */
|
2013-04-13 07:09:56 +00:00
|
|
|
cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT);
|
2012-09-16 02:04:25 +00:00
|
|
|
#endif
|
2012-09-27 16:16:06 +00:00
|
|
|
|
2012-04-11 00:42:27 +00:00
|
|
|
cellSysmoduleUnloadModule(CELL_SYSMODULE_JPGDEC);
|
|
|
|
cellSysmoduleUnloadModule(CELL_SYSMODULE_PNGDEC);
|
2012-09-27 16:16:06 +00:00
|
|
|
|
2012-09-16 02:04:25 +00:00
|
|
|
#ifndef __PSL1GHT__
|
2013-01-07 18:22:35 +00:00
|
|
|
/* system game utility PRX */
|
2012-04-11 00:42:27 +00:00
|
|
|
cellSysmoduleUnloadModule(CELL_SYSMODULE_AVCONF_EXT);
|
|
|
|
cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_GAME);
|
2012-05-25 14:24:28 +00:00
|
|
|
#endif
|
2012-09-27 16:16:06 +00:00
|
|
|
|
2012-09-16 02:04:25 +00:00
|
|
|
#endif
|
2012-04-11 00:42:27 +00:00
|
|
|
|
2013-01-08 23:54:46 +00:00
|
|
|
#endif
|
2013-01-08 00:26:18 +00:00
|
|
|
}
|
2012-04-11 00:42:27 +00:00
|
|
|
|
2015-07-27 17:28:41 +00:00
|
|
|
#ifndef IS_SALAMANDER
|
2016-02-04 16:46:50 +00:00
|
|
|
static bool frontend_ps3_set_fork(enum frontend_fork fork_mode)
|
2014-10-02 19:39:29 +00:00
|
|
|
{
|
2016-02-04 16:46:50 +00:00
|
|
|
switch (fork_mode)
|
|
|
|
{
|
|
|
|
case FRONTEND_FORK_CORE:
|
2016-02-05 17:40:24 +00:00
|
|
|
RARCH_LOG("FRONTEND_FORK_CORE\n");
|
|
|
|
ps3_fork_mode = fork_mode;
|
2016-02-04 16:46:50 +00:00
|
|
|
break;
|
|
|
|
case FRONTEND_FORK_CORE_WITH_ARGS:
|
2016-02-05 17:40:24 +00:00
|
|
|
RARCH_LOG("FRONTEND_FORK_CORE_WITH_ARGS\n");
|
|
|
|
ps3_fork_mode = fork_mode;
|
2016-02-04 16:46:50 +00:00
|
|
|
break;
|
2016-02-05 17:57:44 +00:00
|
|
|
case FRONTEND_FORK_RESTART:
|
|
|
|
RARCH_LOG("FRONTEND_FORK_RESTART\n");
|
2016-02-05 17:40:24 +00:00
|
|
|
/* NOTE: We don't implement Salamander, so just turn
|
|
|
|
* this into FRONTEND_FORK_CORE. */
|
|
|
|
ps3_fork_mode = FRONTEND_FORK_CORE;
|
|
|
|
break;
|
2016-02-04 16:46:50 +00:00
|
|
|
case FRONTEND_FORK_NONE:
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
2016-02-04 16:08:09 +00:00
|
|
|
|
|
|
|
return true;
|
2014-10-02 19:39:29 +00:00
|
|
|
}
|
2015-07-27 17:28:41 +00:00
|
|
|
#endif
|
2014-10-02 19:39:29 +00:00
|
|
|
|
2015-07-27 17:28:41 +00:00
|
|
|
static int frontend_ps3_exec_exitspawn(const char *path,
|
|
|
|
char const *argv[], char const *envp[])
|
2013-07-27 01:59:01 +00:00
|
|
|
{
|
2015-07-27 17:28:41 +00:00
|
|
|
int ret;
|
2015-06-12 21:38:46 +00:00
|
|
|
unsigned i;
|
2015-07-27 17:28:41 +00:00
|
|
|
char spawn_data[256];
|
|
|
|
SceNpDrmKey *license_data = NULL;
|
|
|
|
|
|
|
|
for(i = 0; i < sizeof(spawn_data); ++i)
|
|
|
|
spawn_data[i] = i & 0xff;
|
|
|
|
|
2015-07-27 18:12:24 +00:00
|
|
|
ret = sceNpDrmProcessExitSpawn(license_data, path,
|
2015-07-27 17:28:41 +00:00
|
|
|
(const char** const)argv, envp, (sys_addr_t)spawn_data,
|
|
|
|
256, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
|
|
|
|
|
|
|
|
if(ret < 0)
|
|
|
|
{
|
|
|
|
RARCH_WARN("SELF file is not of NPDRM type, trying another approach to boot it...\n");
|
|
|
|
sys_game_process_exitspawn(path, (const char** const)argv,
|
|
|
|
envp, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void frontend_ps3_exec(const char *path, bool should_load_game)
|
|
|
|
{
|
2013-07-28 18:57:49 +00:00
|
|
|
#ifndef IS_SALAMANDER
|
2016-05-31 02:42:04 +00:00
|
|
|
bool original_verbose = verbosity_is_enabled();
|
|
|
|
verbosity_enable();
|
2013-07-28 18:57:49 +00:00
|
|
|
#endif
|
2013-07-27 20:33:57 +00:00
|
|
|
|
2015-09-28 21:00:22 +00:00
|
|
|
(void)should_load_game;
|
|
|
|
|
2014-05-31 16:34:06 +00:00
|
|
|
RARCH_LOG("Attempt to load executable: [%s].\n", path);
|
|
|
|
|
2015-07-27 17:28:41 +00:00
|
|
|
#ifndef IS_SALAMANDER
|
2016-10-03 13:43:03 +00:00
|
|
|
if (should_load_game && !path_is_empty(RARCH_PATH_CONTENT))
|
2014-06-03 04:50:55 +00:00
|
|
|
{
|
2015-07-27 17:28:41 +00:00
|
|
|
char game_path[256];
|
2016-10-03 13:43:03 +00:00
|
|
|
strlcpy(game_path, path_get(RARCH_PATH_CONTENT), sizeof(game_path));
|
2014-06-03 04:50:55 +00:00
|
|
|
|
|
|
|
const char * const spawn_argv[] = {
|
|
|
|
game_path,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2015-09-28 21:00:22 +00:00
|
|
|
frontend_ps3_exec_exitspawn(path,
|
2015-07-27 17:28:41 +00:00
|
|
|
(const char** const)spawn_argv, NULL);
|
2014-06-03 04:50:55 +00:00
|
|
|
}
|
|
|
|
else
|
2015-07-27 17:28:41 +00:00
|
|
|
#endif
|
2014-06-03 04:50:55 +00:00
|
|
|
{
|
2015-09-28 21:00:22 +00:00
|
|
|
frontend_ps3_exec_exitspawn(path,
|
2015-07-27 17:28:41 +00:00
|
|
|
NULL, NULL);
|
2014-06-03 04:50:55 +00:00
|
|
|
}
|
2013-01-08 23:54:46 +00:00
|
|
|
|
2013-07-27 01:59:01 +00:00
|
|
|
sceNpTerm();
|
|
|
|
sys_net_finalize_network();
|
|
|
|
cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_NP);
|
|
|
|
cellSysmoduleUnloadModule(CELL_SYSMODULE_NET);
|
2014-05-31 16:34:06 +00:00
|
|
|
|
|
|
|
#ifndef IS_SALAMANDER
|
2016-05-31 02:42:04 +00:00
|
|
|
if (original_verbose)
|
|
|
|
verbosity_enable();
|
|
|
|
else
|
|
|
|
verbosity_disable();
|
2014-05-31 16:34:06 +00:00
|
|
|
#endif
|
2012-01-05 21:47:34 +00:00
|
|
|
}
|
2013-07-26 18:58:47 +00:00
|
|
|
|
2015-07-27 01:44:28 +00:00
|
|
|
static void frontend_ps3_exitspawn(char *core_path, size_t core_path_size)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_RARCH_EXEC
|
|
|
|
bool should_load_game = false;
|
|
|
|
|
|
|
|
#ifndef IS_SALAMANDER
|
2016-05-31 02:42:04 +00:00
|
|
|
bool original_verbose = verbosity_is_enabled();
|
|
|
|
|
|
|
|
verbosity_enable();
|
2015-07-27 01:44:28 +00:00
|
|
|
|
2016-02-05 17:40:24 +00:00
|
|
|
if (ps3_fork_mode == FRONTEND_FORK_NONE)
|
2015-07-27 01:44:28 +00:00
|
|
|
{
|
|
|
|
frontend_ctx_driver_t *frontend = frontend_get_ptr();
|
|
|
|
|
|
|
|
if (frontend)
|
|
|
|
frontend->shutdown = frontend_ps3_shutdown;
|
|
|
|
return;
|
|
|
|
}
|
2016-02-05 17:40:24 +00:00
|
|
|
|
|
|
|
switch (ps3_fork_mode)
|
|
|
|
{
|
|
|
|
case FRONTEND_FORK_CORE_WITH_ARGS:
|
|
|
|
should_load_game = true;
|
|
|
|
break;
|
|
|
|
case FRONTEND_FORK_NONE:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2015-07-27 01:44:28 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
frontend_ps3_exec(core_path, should_load_game);
|
|
|
|
|
|
|
|
#ifdef IS_SALAMANDER
|
|
|
|
cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_GAME);
|
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_FS);
|
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_IO);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef IS_SALAMANDER
|
2016-05-31 02:42:04 +00:00
|
|
|
if (original_verbose)
|
|
|
|
verbosity_enable();
|
|
|
|
else
|
|
|
|
verbosity_disable();
|
2015-07-27 01:44:28 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2014-05-17 12:56:12 +00:00
|
|
|
static int frontend_ps3_get_rating(void)
|
2014-05-16 20:20:33 +00:00
|
|
|
{
|
|
|
|
return 10;
|
|
|
|
}
|
|
|
|
|
2015-04-18 18:03:59 +00:00
|
|
|
enum frontend_architecture frontend_ps3_get_architecture(void)
|
|
|
|
{
|
|
|
|
return FRONTEND_ARCH_PPC;
|
|
|
|
}
|
|
|
|
|
2015-06-15 20:45:02 +00:00
|
|
|
static int frontend_ps3_parse_drive_list(void *data)
|
|
|
|
{
|
|
|
|
#ifndef IS_SALAMANDER
|
|
|
|
file_list_t *list = (file_list_t*)data;
|
|
|
|
|
2016-07-12 23:17:09 +00:00
|
|
|
menu_entries_append_enum(list,
|
2016-07-25 17:09:17 +00:00
|
|
|
"/app_home/", "", MSG_UNKNOWN, FILE_TYPE_DIRECTORY, 0, 0);
|
2016-07-12 23:17:09 +00:00
|
|
|
menu_entries_append_enum(list,
|
2016-07-25 17:09:17 +00:00
|
|
|
"/dev_hdd0/", "", MSG_UNKNOWN, FILE_TYPE_DIRECTORY, 0, 0);
|
2016-07-12 23:17:09 +00:00
|
|
|
menu_entries_append_enum(list,
|
2016-07-25 17:09:17 +00:00
|
|
|
"/dev_hdd1/", "", MSG_UNKNOWN, FILE_TYPE_DIRECTORY, 0, 0);
|
2016-08-20 19:49:58 +00:00
|
|
|
menu_entries_append_enum(list,
|
|
|
|
"/dev_bdvd/", "", MSG_UNKNOWN, FILE_TYPE_DIRECTORY, 0, 0);
|
2016-07-12 23:17:09 +00:00
|
|
|
menu_entries_append_enum(list,
|
2016-07-25 17:09:17 +00:00
|
|
|
"/host_root/", "", MSG_UNKNOWN, FILE_TYPE_DIRECTORY, 0, 0);
|
2016-07-12 23:17:09 +00:00
|
|
|
menu_entries_append_enum(list,
|
2016-07-25 17:09:17 +00:00
|
|
|
"/dev_usb000/", "", MSG_UNKNOWN, FILE_TYPE_DIRECTORY, 0, 0);
|
2016-07-12 23:17:09 +00:00
|
|
|
menu_entries_append_enum(list,
|
2016-07-25 17:09:17 +00:00
|
|
|
"/dev_usb001/", "", MSG_UNKNOWN, FILE_TYPE_DIRECTORY, 0, 0);
|
2016-07-12 23:17:09 +00:00
|
|
|
menu_entries_append_enum(list,
|
2016-07-25 17:09:17 +00:00
|
|
|
"/dev_usb002/", "", MSG_UNKNOWN, FILE_TYPE_DIRECTORY, 0, 0);
|
2016-07-12 23:17:09 +00:00
|
|
|
menu_entries_append_enum(list,
|
2016-07-25 17:09:17 +00:00
|
|
|
"/dev_usb003/", "", MSG_UNKNOWN, FILE_TYPE_DIRECTORY, 0, 0);
|
2016-07-12 23:17:09 +00:00
|
|
|
menu_entries_append_enum(list,
|
2016-07-25 17:09:17 +00:00
|
|
|
"/dev_usb004/", "", MSG_UNKNOWN, FILE_TYPE_DIRECTORY, 0, 0);
|
2016-07-12 23:17:09 +00:00
|
|
|
menu_entries_append_enum(list,
|
2016-07-25 17:09:17 +00:00
|
|
|
"/dev_usb005/", "", MSG_UNKNOWN, FILE_TYPE_DIRECTORY, 0, 0);
|
2016-07-12 23:17:09 +00:00
|
|
|
menu_entries_append_enum(list,
|
2016-07-25 17:09:17 +00:00
|
|
|
"/dev_usb006/", "", MSG_UNKNOWN, FILE_TYPE_DIRECTORY, 0, 0);
|
2015-06-15 20:45:02 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-07-30 10:49:08 +00:00
|
|
|
static void frontend_ps3_process_args(int *argc, char *argv[])
|
|
|
|
{
|
|
|
|
#ifndef IS_SALAMANDER
|
|
|
|
/* A big hack: sometimes Salamander doesn't save the new core
|
|
|
|
* it loads on first boot, so we make sure
|
|
|
|
* active core path is set here. */
|
|
|
|
|
2016-07-30 14:32:34 +00:00
|
|
|
if (*argc >= 1)
|
2016-07-30 10:49:08 +00:00
|
|
|
{
|
|
|
|
char path[PATH_MAX_LENGTH] = {0};
|
2016-07-30 14:32:34 +00:00
|
|
|
strlcpy(path, argv[0], sizeof(path));
|
2016-07-30 10:49:08 +00:00
|
|
|
if (path_file_exists(path))
|
|
|
|
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, path);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2015-07-27 01:44:28 +00:00
|
|
|
frontend_ctx_driver_t frontend_ctx_ps3 = {
|
2015-04-18 18:03:59 +00:00
|
|
|
frontend_ps3_get_environment_settings,
|
|
|
|
frontend_ps3_init,
|
|
|
|
frontend_ps3_deinit,
|
|
|
|
frontend_ps3_exitspawn,
|
2016-07-30 10:49:08 +00:00
|
|
|
frontend_ps3_process_args,
|
2015-04-18 18:03:59 +00:00
|
|
|
frontend_ps3_exec,
|
2015-07-27 17:28:41 +00:00
|
|
|
#ifdef IS_SALAMANDER
|
|
|
|
NULL,
|
|
|
|
#else
|
2015-04-18 18:03:59 +00:00
|
|
|
frontend_ps3_set_fork,
|
2015-07-27 17:28:41 +00:00
|
|
|
#endif
|
2013-07-27 14:36:55 +00:00
|
|
|
NULL, /* shutdown */
|
2014-06-12 14:26:33 +00:00
|
|
|
NULL, /* get_name */
|
2015-04-07 20:48:46 +00:00
|
|
|
NULL, /* get_os */
|
2015-04-18 18:03:59 +00:00
|
|
|
frontend_ps3_get_rating,
|
2014-10-17 01:55:16 +00:00
|
|
|
NULL, /* load_content */
|
2015-04-18 18:03:59 +00:00
|
|
|
frontend_ps3_get_architecture,
|
2015-04-18 11:56:26 +00:00
|
|
|
NULL, /* get_powerstate */
|
2015-06-15 20:45:02 +00:00
|
|
|
frontend_ps3_parse_drive_list,
|
2016-06-12 00:33:07 +00:00
|
|
|
NULL, /* get_mem_total */
|
2016-06-12 10:44:28 +00:00
|
|
|
NULL, /* get_mem_free */
|
2016-07-08 00:10:40 +00:00
|
|
|
NULL, /* install_signal_handler */
|
2016-07-08 00:20:42 +00:00
|
|
|
NULL, /* get_sighandler_state */
|
2016-07-08 10:48:01 +00:00
|
|
|
NULL, /* set_sighandler_state */
|
2016-07-08 00:24:56 +00:00
|
|
|
NULL, /* destroy_sighandler_state */
|
2016-10-09 15:15:50 +00:00
|
|
|
NULL, /* attach_console */
|
|
|
|
NULL, /* detach_console */
|
2013-07-26 18:58:47 +00:00
|
|
|
"ps3",
|
|
|
|
};
|