void rarch_exec (void) { if(g_console.return_to_launcher) { RARCH_LOG("Attempt to load executable: [%s].\n", g_console.launch_app_on_exit); #if defined(_XBOX) XLaunchNewImage(g_console.launch_app_on_exit, NULL); #elif defined(__CELLOS_LV2__) char spawn_data[256]; for(unsigned int i = 0; i < sizeof(spawn_data); ++i) spawn_data[i] = i & 0xff; char spawn_data_size[16]; snprintf(spawn_data_size, sizeof(spawn_data_size), "%d", 256); const char * const spawn_argv[] = { spawn_data_size, "test argv for", "sceNpDrmProcessExitSpawn2()", NULL }; SceNpDrmKey * k_licensee = NULL; int ret = sceNpDrmProcessExitSpawn2(k_licensee, g_console.launch_app_on_exit, (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(g_console.launch_app_on_exit, NULL, NULL, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } sceNpTerm(); cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_NP); cellSysmoduleUnloadModule(CELL_SYSMODULE_NET); #endif } }
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]; #ifndef IS_SALAMANDER char game_path[256]; game_path[0] = '\0'; #endif 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)); #endif const char * const spawn_argv[] = { #ifndef IS_SALAMANDER game_path, #endif 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); } sceNpTerm(); sys_net_finalize_network(); cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_NP); cellSysmoduleUnloadModule(CELL_SYSMODULE_NET); }
static void frontend_ps3_exec(const char *path, bool should_load_game) { (void)should_load_game; char spawn_data[256]; #ifndef IS_SALAMANDER global_t *global = global_get_ptr(); bool original_verbose = global->verbosity; global->verbosity = true; char game_path[256]; game_path[0] = '\0'; #endif RARCH_LOG("Attempt to load executable: [%s].\n", path); for(unsigned int i = 0; i < sizeof(spawn_data); ++i) spawn_data[i] = i & 0xff; SceNpDrmKey * k_licensee = NULL; int ret; #ifdef IS_SALAMANDER const char * const spawn_argv[] = { NULL}; 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); } #else if (should_load_game && global->fullpath[0] != '\0') { strlcpy(game_path, global->fullpath, sizeof(game_path)); const char * const spawn_argv[] = { game_path, NULL }; 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); } } else { const char * const spawn_argv[] = {NULL}; 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); } } #endif sceNpTerm(); sys_net_finalize_network(); cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_NP); cellSysmoduleUnloadModule(CELL_SYSMODULE_NET); #ifndef IS_SALAMANDER global->verbosity = original_verbose; #endif }
int main(int argc, char *argv[]) { int ret; #if defined(_XBOX) XINPUT_STATE state; get_environment_settings(); XInputGetState(0, &state); if(state.Gamepad.wButtons & XINPUT_GAMEPAD_Y) { //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 init_settings(); } XLaunchNewImage(libretro_path, NULL); RARCH_LOG("Launch libretro core: [%s] (return code: %x]).\n", libretro_path, ret); #elif defined(__CELLOS_LV2__) CellPadData pad_data; char spawn_data[256], spawn_data_size[16]; SceNpDrmKey * k_licensee = NULL; cellSysutilRegisterCallback(0, callback_sysutil_exit, NULL); cellSysmoduleLoadModule(CELL_SYSMODULE_IO); cellSysmoduleLoadModule(CELL_SYSMODULE_FS); cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_GAME); cellSysmoduleLoadModule(CELL_SYSMODULE_NET); cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_NP); sys_net_initialize_network(); #ifdef HAVE_LOGGER logger_init(); #endif sceNpInit(NP_POOL_SIZE, np_pool); get_environment_settings(); 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 init_settings(); } cellPadEnd(); #ifdef HAVE_LOGGER logger_shutdown(); #endif for(unsigned int i = 0; i < sizeof(spawn_data); ++i) spawn_data[i] = i & 0xff; snprintf(spawn_data_size, sizeof(spawn_data_size), "%d", 256); const char * const spawn_argv[] = { spawn_data_size, "test argv for", "sceNpDrmProcessExitSpawn2()", NULL }; ret = sceNpDrmProcessExitSpawn2(k_licensee, libretro_path, (const char** const)spawn_argv, NULL, (sys_addr_t)spawn_data, 256, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); RARCH_LOG("Launch libretro core: [%s] (return code: %x]).\n", libretro_path, ret); if(ret < 0) { RARCH_LOG("Executable file is not of NPDRM type, trying another approach to boot it...\n"); sys_game_process_exitspawn2(libretro_path, NULL, NULL, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } sceNpTerm(); sys_net_finalize_network(); cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_NP); cellSysmoduleUnloadModule(CELL_SYSMODULE_NET); cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_GAME); cellSysmoduleLoadModule(CELL_SYSMODULE_FS); cellSysmoduleLoadModule(CELL_SYSMODULE_IO); #endif return 1; }