From 10be750aa63f37728a39d72f2cbf5cad4a1ca478 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Fri, 13 Apr 2012 21:01:04 +0200 Subject: [PATCH] (SSNES_CONSOLE) Introduce HAVE_SSNES_EXEC define --- 360/main.c | 6 +--- Makefile.ps3 | 2 +- console/console_ext.c | 49 ++++++++++++++++++++++++++++ console/console_ext.h | 6 +++- msvc-360/SSNES-360/SSNES-360.vcxproj | 12 +++---- ps3/main.c | 28 +--------------- 6 files changed, 63 insertions(+), 40 deletions(-) diff --git a/360/main.c b/360/main.c index 49ad691a98..c416fb9c39 100644 --- a/360/main.c +++ b/360/main.c @@ -418,12 +418,8 @@ begin_shutdown: save_settings(); xdk360_video_deinit(); + ssnes_exec(); - if(g_console.return_to_launcher) - { - SSNES_LOG("Attempt to load XEX: [%s].\n", g_console.launch_app_on_exit); - XLaunchNewImage(g_console.launch_app_on_exit, NULL); - } return 0; } diff --git a/Makefile.ps3 b/Makefile.ps3 index 81d108561d..d57d8792bc 100644 --- a/Makefile.ps3 +++ b/Makefile.ps3 @@ -68,7 +68,7 @@ endif PPU_LDLIBS = -ldbgfont $(GL_LIBS) -lretro -lcgc -lgcm_cmd -lgcm_sys_stub -lresc_stub -lm -lio_stub -lfs_stub -lsysutil_stub -lsysutil_game_stub -lsysutil_screenshot_stub -lsysutil_np_stub -lpngdec_stub -ljpgdec_stub -lsysmodule_stub -laudio_stub -lnet_stub -lnetctl_stub -lpthread -DEFINES += -DSSNES_CONSOLE -DHAVE_OPENGL -DHAVE_CG -DHAVE_FBO -DHAVE_SSNES_MAIN_WRAP -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RSOUND -DHAVE_ZLIB -D__CELLOS_LV2__ -DHAVE_CONFIGFILE=1 -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_GRIFFIN=1 -DPACKAGE_VERSION=\"$(SSNES_VERSION)\" -Dmain=ssnes_main -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) +DEFINES += -DSSNES_CONSOLE -DHAVE_OPENGL -DHAVE_CG -DHAVE_FBO -DHAVE_SSNES_MAIN_WRAP -DHAVE_SSNES_EXEC -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RSOUND -DHAVE_ZLIB -D__CELLOS_LV2__ -DHAVE_CONFIGFILE=1 -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_GRIFFIN=1 -DPACKAGE_VERSION=\"$(SSNES_VERSION)\" -Dmain=ssnes_main -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) ifeq ($(DEBUG), 1) PPU_OPTIMIZE_LV := -O0 -g diff --git a/console/console_ext.c b/console/console_ext.c index 98df3be649..747dbaa2ed 100644 --- a/console/console_ext.c +++ b/console/console_ext.c @@ -658,3 +658,52 @@ void ssnes_startup (const char * config_path) } #endif + +#ifdef HAVE_SSNES_EXEC + +#ifdef __CELLOS_LV2__ +#include +#include +#include +#include +#include +#include +#endif + +void ssnes_exec (void) +{ + if(g_console.return_to_launcher) + { + SSNES_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]; + sprintf(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) + { + SSNES_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 + } +} + +#endif diff --git a/console/console_ext.h b/console/console_ext.h index 8a4d671ee4..bcf76500aa 100644 --- a/console/console_ext.h +++ b/console/console_ext.h @@ -88,9 +88,13 @@ bool ssnes_manage_libretro_core(const char *full_path, const char *path, const c #endif /*============================================================ - SSNES MAIN WRAP + SSNES ============================================================ */ #ifdef HAVE_SSNES_MAIN_WRAP void ssnes_startup (const char * config_path); #endif + +#ifdef HAVE_SSNES_EXEC +void ssnes_exec (void); +#endif diff --git a/msvc-360/SSNES-360/SSNES-360.vcxproj b/msvc-360/SSNES-360/SSNES-360.vcxproj index 309f7bccd9..a65d5b4430 100644 --- a/msvc-360/SSNES-360/SSNES-360.vcxproj +++ b/msvc-360/SSNES-360/SSNES-360.vcxproj @@ -112,7 +112,7 @@ true false MultiThreadedDebug - _DEBUG;_XBOX;PACKAGE_VERSION="0.9.5";%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;main=ssnes_main;SSNES_CONSOLE;HAVE_CONFIGFILE;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_SSNES_MAIN_WRAP;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN + _DEBUG;_XBOX;PACKAGE_VERSION="0.9.5";%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;main=ssnes_main;SSNES_CONSOLE;HAVE_CONFIGFILE;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_SSNES_MAIN_WRAP;HAVE_SSNES_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN Callcap @@ -150,7 +150,7 @@ AnalyzeOnly false MultiThreadedDebug - _DEBUG;_XBOX;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.5";_CRT_SECURE_NO_WARNINGS;main=ssnes_main;HAVE_CONFIGFILE;SSNES_CONSOLE;HAVE_ZLIB;HAVE_SSNES_MAIN_WRAP;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN + _DEBUG;_XBOX;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.5";_CRT_SECURE_NO_WARNINGS;main=ssnes_main;HAVE_CONFIGFILE;SSNES_CONSOLE;HAVE_ZLIB;HAVE_SSNES_MAIN_WRAP;HAVE_SSNES_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN Callcap @@ -189,7 +189,7 @@ Size false MultiThreaded - NDEBUG;_XBOX;PROFILE;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.5";_CRT_SECURE_NO_WARNINGS;SSNES_CONSOLE;main=ssnes_main;HAVE_CONFIGFILE;HAVE_ZLIB;HAVE_SSNES_MAIN_WRAP;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN + NDEBUG;_XBOX;PROFILE;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.5";_CRT_SECURE_NO_WARNINGS;SSNES_CONSOLE;main=ssnes_main;HAVE_CONFIGFILE;HAVE_ZLIB;HAVE_SSNES_MAIN_WRAP;HAVE_SSNES_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN Callcap @@ -233,7 +233,7 @@ Size false MultiThreaded - NDEBUG;_XBOX;PROFILE;FASTCAP;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.5";_CRT_SECURE_NO_WARNINGS;main=ssnes_main;HAVE_CONFIGFILE;HAVE_ZLIB;HAVE_SSNES_MAIN_WRAP;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN + NDEBUG;_XBOX;PROFILE;FASTCAP;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.5";_CRT_SECURE_NO_WARNINGS;main=ssnes_main;HAVE_CONFIGFILE;HAVE_ZLIB;HAVE_SSNES_MAIN_WRAP;HAVE_SSNES_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN true @@ -274,7 +274,7 @@ false false MultiThreaded - NDEBUG;_XBOX;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.5";_CRT_SECURE_NO_WARNINGS;main=ssnes_main;SSNES_CONSOLE=1;HAVE_CONFIGFILE;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_SSNES_MAIN_WRAP;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN + NDEBUG;_XBOX;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.5";_CRT_SECURE_NO_WARNINGS;main=ssnes_main;SSNES_CONSOLE=1;HAVE_CONFIGFILE;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_SSNES_MAIN_WRAP;HAVE_SSNES_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN true @@ -315,7 +315,7 @@ false false MultiThreaded - NDEBUG;_XBOX;LTCG;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.5";_CRT_SECURE_NO_WARNINGS;SSNES_CONSOLE;main=ssnes_main;HAVE_CONFIGFILE;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_SSNES_MAIN_WRAP;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN + NDEBUG;_XBOX;LTCG;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.5";_CRT_SECURE_NO_WARNINGS;SSNES_CONSOLE;main=ssnes_main;HAVE_CONFIGFILE;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_SSNES_MAIN_WRAP;HAVE_SSNES_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN true diff --git a/ps3/main.c b/ps3/main.c index dc1be0287c..96bc6e25f1 100644 --- a/ps3/main.c +++ b/ps3/main.c @@ -557,33 +557,7 @@ begin_shutdown: SSNES_ERR("System cache partition could not be cleared on exit.\n"); } - if(g_console.return_to_launcher) - { - char spawn_data[256]; - for(unsigned int i = 0; i < sizeof(spawn_data); ++i) - spawn_data[i] = i & 0xff; + ssnes_exec(); - char spawn_data_size[16]; - sprintf(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); - SSNES_LOG("Attempt to load SELF: [%s] (return code: [%x]).\n", g_console.launch_app_on_exit, ret); - if(ret < 0) - { - SSNES_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); - } return 1; }