2013-01-08 06:44:57 +00:00
|
|
|
/* 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/>.
|
|
|
|
*/
|
|
|
|
|
2012-09-16 02:04:25 +00:00
|
|
|
#include <sys/process.h>
|
2012-01-11 00:04:17 +00:00
|
|
|
|
2013-01-08 06:44:57 +00:00
|
|
|
#include "../../ps3/sdk_defines.h"
|
|
|
|
#include "../../ps3/ps3_input.h"
|
2012-01-11 21:55:07 +00:00
|
|
|
|
2013-01-08 23:54:46 +00:00
|
|
|
#include "../../console/rarch_console.h"
|
2013-01-08 06:44:57 +00:00
|
|
|
#include "../../conf/config_file.h"
|
|
|
|
#include "../../general.h"
|
|
|
|
#include "../../file.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
|
|
|
//TODO - not sure if stack size needs to be lower for Salamander
|
|
|
|
#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"
|
|
|
|
#endif
|
2012-01-05 21:47:34 +00:00
|
|
|
|
2013-01-08 23:54:46 +00:00
|
|
|
#ifdef IS_SALAMANDER
|
|
|
|
#include <netex/net.h>
|
|
|
|
#include <np.h>
|
|
|
|
#include <np/drm.h>
|
|
|
|
#include <cell/pad.h>
|
|
|
|
#include <cell/sysmodule.h>
|
|
|
|
|
|
|
|
static void find_and_set_first_file(void)
|
|
|
|
{
|
|
|
|
//Last fallback - we'll need to start the first executable file
|
|
|
|
// we can find in the RetroArch cores directory
|
|
|
|
|
|
|
|
char first_file[PATH_MAX];
|
2013-01-09 06:59:24 +00:00
|
|
|
find_first_libretro_core(first_file, sizeof(first_file), default_paths.core_dir, "SELF");
|
2013-01-08 23:54:46 +00:00
|
|
|
|
|
|
|
if(first_file)
|
|
|
|
{
|
2013-11-03 16:39:12 +00:00
|
|
|
fill_pathname_join(default_paths.libretro_path, default_paths.core_dir, first_file, sizeof(default_paths.libretro_path));
|
2013-01-08 23:54:46 +00:00
|
|
|
RARCH_LOG("libretro_path now set to: %s.\n", default_paths.libretro_path);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
RARCH_ERR("Failed last fallback - RetroArch Salamander will exit.\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void salamander_init_settings(void)
|
|
|
|
{
|
|
|
|
CellPadData pad_data;
|
|
|
|
cellPadInit(7);
|
|
|
|
|
|
|
|
cellPadGetData(0, &pad_data);
|
|
|
|
|
|
|
|
if(pad_data.button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_TRIANGLE)
|
|
|
|
{
|
|
|
|
//override path, boot first executable in cores directory
|
|
|
|
RARCH_LOG("Fallback - Will boot first executable in RetroArch cores/ directory.\n");
|
|
|
|
find_and_set_first_file();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//normal executable loading path
|
|
|
|
char tmp_str[PATH_MAX];
|
|
|
|
bool config_file_exists = false;
|
|
|
|
|
2013-05-05 22:05:41 +00:00
|
|
|
if (path_file_exists(default_paths.config_path))
|
2013-01-08 23:54:46 +00:00
|
|
|
config_file_exists = true;
|
|
|
|
|
|
|
|
//try to find CORE executable
|
|
|
|
char core_executable[1024];
|
2013-11-03 16:39:12 +00:00
|
|
|
fill_pathname_join(core_executable, default_paths.core_dir, "CORE.SELF", sizeof(core_executable));
|
2013-01-08 23:54:46 +00:00
|
|
|
|
|
|
|
if(path_file_exists(core_executable))
|
|
|
|
{
|
|
|
|
//Start CORE executable
|
2013-11-03 16:39:12 +00:00
|
|
|
strlcpy(default_paths.libretro_path, core_executable, sizeof(default_paths.libretro_path));
|
2013-01-08 23:54:46 +00:00
|
|
|
RARCH_LOG("Start [%s].\n", default_paths.libretro_path);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-05 22:05:41 +00:00
|
|
|
if (config_file_exists)
|
2013-01-08 23:54:46 +00:00
|
|
|
{
|
|
|
|
config_file_t * conf = config_file_new(default_paths.config_path);
|
|
|
|
config_get_array(conf, "libretro_path", tmp_str, sizeof(tmp_str));
|
|
|
|
config_file_free(conf);
|
2013-11-03 16:39:12 +00:00
|
|
|
strlcpy(default_paths.libretro_path, tmp_str, sizeof(default_paths.libretro_path));
|
2013-01-08 23:54:46 +00:00
|
|
|
}
|
|
|
|
|
2013-05-05 22:05:41 +00:00
|
|
|
if (!config_file_exists || !strcmp(default_paths.libretro_path, ""))
|
2013-01-08 23:54:46 +00:00
|
|
|
find_and_set_first_file();
|
|
|
|
else
|
|
|
|
RARCH_LOG("Start [%s] found in retroarch.cfg.\n", default_paths.libretro_path);
|
|
|
|
|
|
|
|
if (!config_file_exists)
|
|
|
|
{
|
|
|
|
config_file_t *new_conf = config_file_new(NULL);
|
|
|
|
config_set_string(new_conf, "libretro_path", default_paths.libretro_path);
|
|
|
|
config_file_write(new_conf, default_paths.config_path);
|
|
|
|
config_file_free(new_conf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
cellPadEnd();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2012-05-25 14:24:28 +00:00
|
|
|
#ifdef HAVE_SYSUTILS
|
2012-02-04 12:29:02 +00:00
|
|
|
static void callback_sysutil_exit(uint64_t status, uint64_t param, void *userdata)
|
|
|
|
{
|
2013-01-08 23:54:46 +00:00
|
|
|
(void)param;
|
|
|
|
(void)userdata;
|
|
|
|
(void)status;
|
|
|
|
|
|
|
|
#ifndef IS_SALAMANDER
|
2012-09-11 10:33:46 +00:00
|
|
|
#ifdef HAVE_OSKUTIL
|
2013-05-05 14:12:06 +00:00
|
|
|
oskutil_params *osk = &rgui->oskutil_handle;
|
2012-09-11 10:33:46 +00:00
|
|
|
#endif
|
2012-05-26 14:44:02 +00:00
|
|
|
gl_t *gl = driver.video_data;
|
2012-04-11 00:42:27 +00:00
|
|
|
|
|
|
|
switch (status)
|
|
|
|
{
|
|
|
|
case CELL_SYSUTIL_REQUEST_EXITGAME:
|
2012-11-26 06:03:31 +00:00
|
|
|
gl->quitting = true;
|
2013-05-05 13:20:45 +00:00
|
|
|
g_extern.lifecycle_mode_state &= ~((1ULL << MODE_MENU) | (1ULL << MODE_GAME));
|
2012-11-26 06:03:31 +00:00
|
|
|
break;
|
2012-06-19 03:10:42 +00:00
|
|
|
#ifdef HAVE_OSKUTIL
|
2013-01-17 09:40:35 +00:00
|
|
|
case CELL_SYSUTIL_OSKDIALOG_LOADED:
|
|
|
|
break;
|
|
|
|
case CELL_SYSUTIL_OSKDIALOG_INPUT_CANCELED:
|
|
|
|
RARCH_LOG("CELL_SYSUTIL_OSKDIALOG_INPUT_CANCELED.\n");
|
|
|
|
pOskAbort(); //fall-through
|
2012-04-11 00:42:27 +00:00
|
|
|
case CELL_SYSUTIL_OSKDIALOG_FINISHED:
|
2013-01-17 09:40:35 +00:00
|
|
|
if (status == CELL_SYSUTIL_OSKDIALOG_FINISHED)
|
|
|
|
RARCH_LOG("CELL_SYSUTIL_OSKDIALOG_FINISHED.\n");
|
|
|
|
|
|
|
|
pOskUnloadAsync(&osk->outputInfo);
|
|
|
|
|
|
|
|
if (osk->outputInfo.result == CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK)
|
|
|
|
{
|
|
|
|
RARCH_LOG("Setting MODE_OSK_ENTRY_SUCCESS.\n");
|
|
|
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_OSK_ENTRY_SUCCESS);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RARCH_LOG("Setting MODE_OSK_ENTRY_FAIL.\n");
|
|
|
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_OSK_ENTRY_FAIL);
|
|
|
|
}
|
|
|
|
|
|
|
|
osk->flags &= ~OSK_IN_USE;
|
2012-11-26 06:03:31 +00:00
|
|
|
break;
|
2012-04-11 00:42:27 +00:00
|
|
|
case CELL_SYSUTIL_OSKDIALOG_UNLOADED:
|
2013-01-17 09:40:35 +00:00
|
|
|
RARCH_LOG("CELL_SYSUTIL_OSKDIALOG_UNLOADED.\n");
|
2013-05-05 14:12:06 +00:00
|
|
|
sys_memory_container_destroy(osk->containerid);
|
2012-11-26 06:03:31 +00:00
|
|
|
break;
|
2012-06-19 03:10:42 +00:00
|
|
|
#endif
|
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
|
|
|
|
2013-08-11 13:21:23 +00:00
|
|
|
static void get_environment_settings(int argc, char *argv[], void *args)
|
2012-01-11 00:04:17 +00:00
|
|
|
{
|
2013-08-11 13:21:23 +00:00
|
|
|
(void)args;
|
2013-08-10 18:59:10 +00:00
|
|
|
#ifndef IS_SALAMANDER
|
|
|
|
g_extern.verbose = true;
|
|
|
|
|
|
|
|
#if defined(HAVE_LOGGER)
|
|
|
|
logger_init();
|
|
|
|
#elif defined(HAVE_FILE_LOGGER)
|
|
|
|
g_extern.log_file = fopen("/retroarch-log.txt", "w");
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2012-04-11 00:42:27 +00:00
|
|
|
int ret;
|
|
|
|
unsigned int get_type;
|
|
|
|
unsigned int get_attributes;
|
|
|
|
CellGameContentSize size;
|
|
|
|
char dirName[CELL_GAME_DIRNAME_SIZE];
|
2012-06-23 20:36:35 +00:00
|
|
|
char contentInfoPath[PATH_MAX];
|
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
|
|
|
|
if(path_file_exists(argv[2]) && argc > 1 && (strcmp(argv[2], EMULATOR_CONTENT_DIR) == 0))
|
2012-04-11 00:42:27 +00:00
|
|
|
{
|
2013-01-12 02:13:03 +00:00
|
|
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_EXTLAUNCH_MULTIMAN);
|
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
|
2013-01-11 07:15:23 +00:00
|
|
|
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
|
|
|
|
{
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_LOG("cellGameBootCheck() OK.\n");
|
|
|
|
RARCH_LOG("Directory name: [%s].\n", dirName);
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
2012-07-23 16:17:50 +00:00
|
|
|
ret = cellGameContentPermit(contentInfoPath, default_paths.port_dir);
|
2012-04-14 03:30:10 +00:00
|
|
|
|
2012-05-30 14:30:25 +00:00
|
|
|
#ifdef HAVE_MULTIMAN
|
2013-01-12 02:13:03 +00:00
|
|
|
if (g_extern.lifecycle_mode_state & (1ULL << MODE_EXTLAUNCH_MULTIMAN))
|
2012-04-14 03:30:10 +00:00
|
|
|
{
|
2013-11-03 16:39:12 +00:00
|
|
|
fill_pathname_join(contentInfoPath, "/dev_hdd0/game/", EMULATOR_CONTENT_DIR, sizeof(contentInfoPath));
|
2012-11-26 06:03:31 +00:00
|
|
|
snprintf(default_paths.port_dir, sizeof(default_paths.port_dir), "/dev_hdd0/game/%s/USRDIR", EMULATOR_CONTENT_DIR);
|
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");
|
2012-11-26 06:03:31 +00:00
|
|
|
RARCH_LOG("contentInfoPath : [%s].\n", contentInfoPath);
|
|
|
|
RARCH_LOG("usrDirPath : [%s].\n", default_paths.port_dir);
|
2012-04-14 03:30:10 +00:00
|
|
|
}
|
|
|
|
|
2013-11-03 16:39:12 +00:00
|
|
|
fill_pathname_join(default_paths.core_dir, default_paths.port_dir, "cores", sizeof(default_paths.core_dir));
|
|
|
|
fill_pathname_join(default_paths.savestate_dir, default_paths.core_dir, "savestates", sizeof(default_paths.savestate_dir));
|
|
|
|
strlcpy(default_paths.filesystem_root_dir, "/", sizeof(default_paths.filesystem_root_dir));
|
|
|
|
strlcpy(default_paths.filebrowser_startup_dir, default_paths.filesystem_root_dir, sizeof(default_paths.filebrowser_startup_dir));
|
|
|
|
fill_pathname_join(default_paths.sram_dir, default_paths.core_dir, "savefiles", sizeof(default_paths.sram_dir));
|
|
|
|
fill_pathname_join(default_paths.system_dir, default_paths.core_dir, "system", sizeof(default_paths.system_dir));
|
2012-07-10 02:00:04 +00:00
|
|
|
|
2012-04-14 03:30:10 +00:00
|
|
|
/* now we fill in all the variables */
|
2013-11-03 16:39:12 +00:00
|
|
|
fill_pathname_join(default_paths.menu_border_file, default_paths.core_dir, "borders/Menu/main-menu_1080p.png", sizeof(default_paths.menu_border_file));
|
|
|
|
fill_pathname_join(default_paths.border_dir, default_paths.core_dir, "borders", sizeof(default_paths.border_dir));
|
2012-09-11 07:17:25 +00:00
|
|
|
#if defined(HAVE_CG) || defined(HAVE_GLSL)
|
2013-11-03 16:39:12 +00:00
|
|
|
fill_pathname_join(g_settings.video.shader_dir, default_paths.core_dir, "shaders", sizeof(g_settings.video.shader_dir));
|
2012-09-11 07:17:25 +00:00
|
|
|
#endif
|
2013-01-08 23:54:46 +00:00
|
|
|
|
|
|
|
#ifdef IS_SALAMANDER
|
2013-11-03 16:39:12 +00:00
|
|
|
fill_pathname_join(default_paths.config_path, default_paths.port_dir, "retroarch.cfg", sizeof(default_paths.config_path));
|
2013-01-08 23:54:46 +00:00
|
|
|
#else
|
2013-11-03 16:39:12 +00:00
|
|
|
fill_pathname_join(g_extern.config_path, default_paths.port_dir, "retroarch.cfg", sizeof(g_extern.config_path));
|
2013-01-08 23:54:46 +00:00
|
|
|
#endif
|
2012-04-11 00:42:27 +00:00
|
|
|
}
|
2012-02-20 06:50:59 +00:00
|
|
|
}
|
|
|
|
|
2013-11-03 15:38:56 +00:00
|
|
|
static void system_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
|
|
|
|
#ifdef HAVE_SYSUTILS
|
2013-04-22 23:55:00 +00:00
|
|
|
//if (g_extern.lifecycle_mode_state & (1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE))
|
|
|
|
cellSysutilEnableBgmPlayback();
|
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
|
|
|
|
2013-08-10 19:31:11 +00:00
|
|
|
static int system_process_args(int argc, char *argv[], void *args)
|
2013-01-08 00:26:18 +00:00
|
|
|
{
|
2013-07-26 18:58:47 +00:00
|
|
|
#ifndef IS_SALAMANDER
|
2013-04-29 13:19:16 +00:00
|
|
|
if (argc > 1)
|
2013-01-11 07:15:23 +00:00
|
|
|
{
|
2013-04-29 13:19:16 +00:00
|
|
|
RARCH_LOG("Auto-start game %s.\n", argv[1]);
|
2013-01-11 07:15:23 +00:00
|
|
|
strlcpy(g_extern.fullpath, argv[1], sizeof(g_extern.fullpath));
|
2013-04-29 13:19:16 +00:00
|
|
|
return 1;
|
2012-04-11 00:42:27 +00:00
|
|
|
}
|
2013-07-26 18:58:47 +00:00
|
|
|
#endif
|
2013-04-28 03:18:56 +00:00
|
|
|
|
2013-04-29 13:19:16 +00:00
|
|
|
return 0;
|
2013-01-08 00:26:18 +00:00
|
|
|
}
|
2012-02-20 06:50:59 +00:00
|
|
|
|
2013-11-03 15:38:56 +00:00
|
|
|
static void system_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
|
|
|
|
2013-07-27 01:59:01 +00:00
|
|
|
static void system_exec(const char *path, bool should_load_game);
|
|
|
|
|
2013-01-08 00:26:18 +00:00
|
|
|
static void system_exitspawn(void)
|
|
|
|
{
|
2012-09-14 03:07:33 +00:00
|
|
|
#ifdef HAVE_RARCH_EXEC
|
2013-01-08 23:54:46 +00:00
|
|
|
|
|
|
|
#ifdef IS_SALAMANDER
|
2013-07-27 01:59:01 +00:00
|
|
|
system_exec(default_paths.libretro_path, false);
|
2013-01-08 23:54:46 +00:00
|
|
|
|
|
|
|
cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_GAME);
|
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_FS);
|
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_IO);
|
|
|
|
#else
|
2013-05-26 20:40:52 +00:00
|
|
|
char core_launch[256];
|
|
|
|
#ifdef HAVE_MULTIMAN
|
|
|
|
if (g_extern.lifecycle_mode_state & (1ULL << MODE_EXITSPAWN_MULTIMAN))
|
|
|
|
{
|
|
|
|
RARCH_LOG("Boot Multiman: %s.\n", MULTIMAN_SELF_FILE);
|
|
|
|
strlcpy(core_launch, MULTIMAN_SELF_FILE, sizeof(core_launch));
|
|
|
|
}
|
2013-05-28 20:15:21 +00:00
|
|
|
else
|
2013-05-26 20:40:52 +00:00
|
|
|
#endif
|
2013-05-28 20:15:21 +00:00
|
|
|
strlcpy(core_launch, g_settings.libretro, sizeof(core_launch));
|
2013-04-29 01:05:46 +00:00
|
|
|
bool should_load_game = false;
|
|
|
|
if (g_extern.lifecycle_mode_state & (1ULL << MODE_EXITSPAWN_START_GAME))
|
|
|
|
should_load_game = true;
|
|
|
|
|
2013-07-27 01:59:01 +00:00
|
|
|
system_exec(core_launch, should_load_game);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <cell/sysmodule.h>
|
|
|
|
#include <sys/process.h>
|
|
|
|
#include <sysutil/sysutil_common.h>
|
|
|
|
#include <netex/net.h>
|
|
|
|
#include <np.h>
|
|
|
|
#include <np/drm.h>
|
|
|
|
|
|
|
|
#include "../../retroarch_logger.h"
|
|
|
|
|
|
|
|
static void system_exec(const char *path, bool should_load_game)
|
|
|
|
{
|
|
|
|
(void)should_load_game;
|
|
|
|
|
|
|
|
RARCH_LOG("Attempt to load executable: [%s].\n", path);
|
|
|
|
char spawn_data[256];
|
2013-07-28 18:57:49 +00:00
|
|
|
#ifndef IS_SALAMANDER
|
2013-07-27 01:59:01 +00:00
|
|
|
char game_path[256];
|
2013-07-27 20:33:57 +00:00
|
|
|
game_path[0] = '\0';
|
2013-07-28 18:57:49 +00:00
|
|
|
#endif
|
2013-07-27 20:33:57 +00:00
|
|
|
|
2013-07-27 01:59:01 +00:00
|
|
|
for(unsigned int i = 0; i < sizeof(spawn_data); ++i)
|
|
|
|
spawn_data[i] = i & 0xff;
|
|
|
|
|
|
|
|
#ifndef IS_SALAMANDER
|
|
|
|
if (should_load_game)
|
|
|
|
strlcpy(game_path, g_extern.fullpath, sizeof(game_path));
|
2012-09-14 03:07:33 +00:00
|
|
|
#endif
|
2013-01-08 23:54:46 +00:00
|
|
|
|
2013-07-27 01:59:01 +00:00
|
|
|
const char * const spawn_argv[] = {
|
|
|
|
#ifndef IS_SALAMANDER
|
|
|
|
game_path,
|
2013-01-08 23:54:46 +00:00
|
|
|
#endif
|
2013-07-27 01:59:01 +00:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
SceNpDrmKey * k_licensee = NULL;
|
|
|
|
int ret = sceNpDrmProcessExitSpawn2(k_licensee, path, (const char** const)spawn_argv, NULL, (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)spawn_argv, NULL, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
|
|
|
|
}
|
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);
|
2012-01-05 21:47:34 +00:00
|
|
|
}
|
2013-07-26 18:58:47 +00:00
|
|
|
|
|
|
|
const frontend_ctx_driver_t frontend_ctx_ps3 = {
|
2013-07-27 14:36:55 +00:00
|
|
|
get_environment_settings, /* get_environment_settings */
|
|
|
|
system_init, /* init */
|
|
|
|
system_deinit, /* deinit */
|
|
|
|
system_exitspawn, /* exitspawn */
|
|
|
|
system_process_args, /* process_args */
|
2013-07-27 15:42:09 +00:00
|
|
|
NULL, /* process_events */
|
2013-07-27 14:36:55 +00:00
|
|
|
system_exec, /* exec */
|
|
|
|
NULL, /* shutdown */
|
2013-07-26 18:58:47 +00:00
|
|
|
"ps3",
|
|
|
|
};
|