diff --git a/console/griffin/griffin.c b/console/griffin/griffin.c index 9bce970bc5..855c8c81a6 100644 --- a/console/griffin/griffin.c +++ b/console/griffin/griffin.c @@ -29,6 +29,10 @@ CONSOLE EXTENSIONS #include "../rarch_console_main_wrap.c" #endif +#ifdef HAVE_RARCH_EXEC +#include "../rarch_console_exec.c" +#endif + #include "../rarch_console.c" #ifdef HAVE_CONFIGFILE diff --git a/console/rarch_console.c b/console/rarch_console.c index c513c5658b..e3a1f4f662 100644 --- a/console/rarch_console.c +++ b/console/rarch_console.c @@ -28,55 +28,6 @@ default_paths_t default_paths; -#ifdef HAVE_RARCH_EXEC - -#ifdef __CELLOS_LV2__ -#include -#include -#include -#include -#include -#include -#endif - -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 - } -} - -#endif - #ifdef HAVE_RSOUND bool rarch_console_rsound_start(const char *ip) { diff --git a/console/rarch_console.h b/console/rarch_console.h index 9b3424290d..71835986e4 100644 --- a/console/rarch_console.h +++ b/console/rarch_console.h @@ -34,6 +34,35 @@ enum #endif }; +enum { + MENU_ITEM_LOAD_STATE = 0, + MENU_ITEM_SAVE_STATE, + MENU_ITEM_KEEP_ASPECT_RATIO, + MENU_ITEM_OVERSCAN_AMOUNT, + MENU_ITEM_ORIENTATION, +#ifdef __CELLOS_LV2__ + MENU_ITEM_SCALE_FACTOR, +#endif + MENU_ITEM_RESIZE_MODE, + MENU_ITEM_FRAME_ADVANCE, + MENU_ITEM_SCREENSHOT_MODE, + MENU_ITEM_RESET, + MENU_ITEM_RETURN_TO_GAME, +#ifdef __CELLOS_LV2__ + MENU_ITEM_RETURN_TO_MENU, + MENU_ITEM_CHANGE_LIBRETRO, + MENU_ITEM_RETURN_TO_MULTIMAN, +#endif + MENU_ITEM_RETURN_TO_DASHBOARD +}; + +enum +{ + MODE_EMULATION = 0, + MODE_MENU, + MODE_EXIT +}; + typedef struct { char menu_border_file[PATH_MAX]; @@ -64,38 +93,8 @@ typedef struct extern default_paths_t default_paths; -/*============================================================ - RetroArch - ============================================================ */ - -enum { - MENU_ITEM_LOAD_STATE = 0, - MENU_ITEM_SAVE_STATE, - MENU_ITEM_KEEP_ASPECT_RATIO, - MENU_ITEM_OVERSCAN_AMOUNT, - MENU_ITEM_ORIENTATION, -#ifdef __CELLOS_LV2__ - MENU_ITEM_SCALE_FACTOR, -#endif - MENU_ITEM_RESIZE_MODE, - MENU_ITEM_FRAME_ADVANCE, - MENU_ITEM_SCREENSHOT_MODE, - MENU_ITEM_RESET, - MENU_ITEM_RETURN_TO_GAME, -#ifdef __CELLOS_LV2__ - MENU_ITEM_RETURN_TO_MENU, - MENU_ITEM_CHANGE_LIBRETRO, - MENU_ITEM_RETURN_TO_MULTIMAN, -#endif - MENU_ITEM_RETURN_TO_DASHBOARD -}; - #define MENU_ITEM_LAST MENU_ITEM_RETURN_TO_DASHBOARD+1 -#ifdef HAVE_RARCH_EXEC -void rarch_exec (void); -#endif - #ifdef HAVE_RSOUND bool rarch_console_rsound_start(const char *ip); void rarch_console_rsound_stop(void); @@ -105,11 +104,4 @@ void rarch_convert_char_to_wchar(wchar_t *buf, const char * str, size_t size); const char * rarch_convert_wchar_to_const_char(const wchar_t * wstr); void rarch_extract_directory(char *buf, const char *path, size_t size); -enum -{ - MODE_EMULATION = 0, - MODE_MENU, - MODE_EXIT -}; - #endif diff --git a/console/rarch_console_exec.c b/console/rarch_console_exec.c new file mode 100644 index 0000000000..716e7f35b7 --- /dev/null +++ b/console/rarch_console_exec.c @@ -0,0 +1,68 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2012 - Hans-Kristian Arntzen + * Copyright (C) 2011-2012 - 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 . + */ + +#include + +#if defined(__CELLOS_LV2__) +#include +#include +#include +#include +#include +#include +#elif defined(_XBOX) +#include +#endif + +#include "rarch_console_exec.h" + +void rarch_console_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); +#else + RARCH_WARN("External loading of executables is not supported for this platform.\n"); +#endif + } +} diff --git a/console/rarch_console_exec.h b/console/rarch_console_exec.h new file mode 100644 index 0000000000..279dcec77c --- /dev/null +++ b/console/rarch_console_exec.h @@ -0,0 +1,22 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2012 - Hans-Kristian Arntzen + * Copyright (C) 2011-2012 - 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 . + */ + +#ifndef RARCH_CONSOLE_EXEC_H__ +#define RARCH_CONSOLE_EXEC_H__ + +void rarch_console_exec (void); + +#endif diff --git a/ps3/frontend/main.c b/ps3/frontend/main.c index c36b3691c6..e0bc5e23f7 100644 --- a/ps3/frontend/main.c +++ b/ps3/frontend/main.c @@ -46,6 +46,7 @@ #include "../../gfx/gl_common.h" #include "../../console/rarch_console.h" +#include "../../console/rarch_console_exec.h" #include "../../console/rarch_console_input.h" #include "../../console/rarch_console_config.h" #include "../../console/rarch_console_settings.h" @@ -366,7 +367,7 @@ begin_shutdown: } #endif - rarch_exec(); + rarch_console_exec(); return 1; } diff --git a/xdk/frontend/main.c b/xdk/frontend/main.c index 696ab33454..b8aed10d2b 100644 --- a/xdk/frontend/main.c +++ b/xdk/frontend/main.c @@ -38,6 +38,7 @@ #endif #include "../../console/rarch_console.h" +#include "../../console/rarch_console_exec.h" #include "../../console/rarch_console_config.h" #include "../../console/rarch_console_main_wrap.h" #include "../../conf/config_file.h" @@ -175,7 +176,7 @@ begin_shutdown: video_null.stop(); #endif input_xinput.free(NULL); - rarch_exec(); + rarch_console_exec(); return 0; }