(SSNES_CONSOLE) Introduce HAVE_SSNES_EXEC define

This commit is contained in:
Twinaphex 2012-04-13 21:01:04 +02:00
parent 79737aecf3
commit 10be750aa6
6 changed files with 63 additions and 40 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -658,3 +658,52 @@ void ssnes_startup (const char * config_path)
}
#endif
#ifdef HAVE_SSNES_EXEC
#ifdef __CELLOS_LV2__
#include <cell/sysmodule.h>
#include <sys/process.h>
#include <sysutil/sysutil_common.h>
#include <netex/net.h>
#include <np.h>
#include <np/drm.h>
#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

View File

@ -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

View File

@ -112,7 +112,7 @@
<MinimalRebuild>true</MinimalRebuild>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>_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</PreprocessorDefinitions>
<PreprocessorDefinitions>_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</PreprocessorDefinitions>
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
</ClCompile>
<Link>
@ -150,7 +150,7 @@
<PREfast>AnalyzeOnly</PREfast>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>_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</PreprocessorDefinitions>
<PreprocessorDefinitions>_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</PreprocessorDefinitions>
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
</ClCompile>
<Link>
@ -189,7 +189,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>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</PreprocessorDefinitions>
<PreprocessorDefinitions>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</PreprocessorDefinitions>
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
</ClCompile>
<Link>
@ -233,7 +233,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>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</PreprocessorDefinitions>
<PreprocessorDefinitions>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</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -274,7 +274,7 @@
<ExceptionHandling>false</ExceptionHandling>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>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</PreprocessorDefinitions>
<PreprocessorDefinitions>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</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -315,7 +315,7 @@
<ExceptionHandling>false</ExceptionHandling>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>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</PreprocessorDefinitions>
<PreprocessorDefinitions>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</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>

View File

@ -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;
}