(RARCH_CONSOLE) Split up HAVE_EXEC functions into new file rarch_console_exec.c

This commit is contained in:
Twinaphex 2012-07-28 16:35:07 +02:00
parent c77b49b19a
commit a5beb54ad4
7 changed files with 127 additions and 88 deletions

View File

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

View File

@ -28,55 +28,6 @@
default_paths_t default_paths;
#ifdef HAVE_RARCH_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 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)
{

View File

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

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#if defined(__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>
#elif defined(_XBOX)
#include <xtl.h>
#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
}
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef RARCH_CONSOLE_EXEC_H__
#define RARCH_CONSOLE_EXEC_H__
void rarch_console_exec (void);
#endif

View File

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

View File

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