(RARCH_CONSOLE) Refactored external_launch

This commit is contained in:
twinaphex 2013-01-11 08:15:23 +01:00
parent 33a2816681
commit 67ab39e6be
7 changed files with 28 additions and 49 deletions

View File

@ -32,17 +32,6 @@
#define EXT_CGP_PRESETS "cgp|CGP" #define EXT_CGP_PRESETS "cgp|CGP"
#define EXT_INPUT_PRESETS "cfg|CFG" #define EXT_INPUT_PRESETS "cfg|CFG"
enum
{
EXTERN_LAUNCHER_SALAMANDER,
#ifdef HAVE_MULTIMAN
EXTERN_LAUNCHER_MULTIMAN,
#endif
#ifdef GEKKO
EXTERN_LAUNCHER_CHANNEL,
#endif
};
enum { enum {
MENU_ITEM_LOAD_STATE = 0, MENU_ITEM_LOAD_STATE = 0,
MENU_ITEM_SAVE_STATE, MENU_ITEM_SAVE_STATE,

View File

@ -760,11 +760,11 @@ static int rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
if (action == RGUI_ACTION_OK) if (action == RGUI_ACTION_OK)
{ {
#ifdef GEKKO #ifdef GEKKO
snprintf(g_extern.console.external_launch.launch_app, sizeof(g_extern.console.external_launch.launch_app), "%s/boot.dol", default_paths.core_dir); snprintf(g_extern.fullpath, sizeof(g_extern.fullpath), "%s/boot.dol", default_paths.core_dir);
#endif #endif
g_extern.console.external_launch.enable = true;
g_extern.lifecycle_menu_state &= ~(1 << MODE_EMULATION); g_extern.lifecycle_menu_state &= ~(1 << MODE_EMULATION);
g_extern.lifecycle_menu_state |= (1 << MODE_EXIT); g_extern.lifecycle_menu_state |= (1 << MODE_EXIT);
g_extern.lifecycle_menu_state |= (1 << MODE_EXITSPAWN);
return -1; return -1;
} }
break; break;

View File

@ -716,10 +716,10 @@ int select_file(void *data, void *state)
if(set_libretro_core_as_launch) if(set_libretro_core_as_launch)
{ {
strlcpy(g_extern.console.external_launch.launch_app, path, sizeof(g_extern.console.external_launch.launch_app)); strlcpy(g_extern.fullpath, path, sizeof(g_extern.fullpath));
set_libretro_core_as_launch = false; set_libretro_core_as_launch = false;
g_extern.console.external_launch.enable = true;
g_extern.lifecycle_menu_state |= (1 << MODE_EXIT); g_extern.lifecycle_menu_state |= (1 << MODE_EXIT);
g_extern.lifecycle_menu_state |= (1 << MODE_EXITSPAWN);
return -1; return -1;
} }
else else
@ -2237,11 +2237,10 @@ int ingame_menu(void *data, void *state)
if(input & (1ULL << RMENU_DEVICE_NAV_B)) if(input & (1ULL << RMENU_DEVICE_NAV_B))
{ {
RARCH_LOG("Boot Multiman: %s.\n", default_paths.multiman_self_file); RARCH_LOG("Boot Multiman: %s.\n", default_paths.multiman_self_file);
strlcpy(g_extern.console.external_launch.launch_app, default_paths.multiman_self_file, strlcpy(g_extern.fullpath, default_paths.multiman_self_file, sizeof(g_extern.fullpath));
sizeof(g_extern.console.external_launch.launch_app));
g_extern.console.external_launch.enable = true;
g_extern.lifecycle_menu_state &= ~(1 << MODE_EMULATION); g_extern.lifecycle_menu_state &= ~(1 << MODE_EMULATION);
g_extern.lifecycle_menu_state |= (1 << MODE_EXIT); g_extern.lifecycle_menu_state |= (1 << MODE_EXIT);
g_extern.lifecycle_menu_state |= (1 << MODE_EXITSPAWN);
return -1; return -1;
} }
snprintf(strw_buffer, sizeof(strw_buffer), "Press [%s] to quit RetroArch and return to multiMAN.", rarch_input_find_platform_key_label(1ULL << RETRO_DEVICE_ID_JOYPAD_B)); snprintf(strw_buffer, sizeof(strw_buffer), "Press [%s] to quit RetroArch and return to multiMAN.", rarch_input_find_platform_key_label(1ULL << RETRO_DEVICE_ID_JOYPAD_B));

View File

@ -972,9 +972,9 @@ HRESULT CRetroArchCoreBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandle
convert_wchar_to_char(str_buffer, (const wchar_t *)m_romlist.GetText(index), sizeof(str_buffer)); convert_wchar_to_char(str_buffer, (const wchar_t *)m_romlist.GetText(index), sizeof(str_buffer));
if(path_file_exists(tmp_browser->current_dir.list->elems[index].data)) if(path_file_exists(tmp_browser->current_dir.list->elems[index].data))
{ {
snprintf(g_extern.console.external_launch.launch_app, sizeof(g_extern.console.external_launch.launch_app), "%s\\%s", filebrowser_get_current_dir(tmp_browser), str_buffer); snprintf(g_extern.fullpath, sizeof(g_extern.fullpath), "%s\\%s", filebrowser_get_current_dir(tmp_browser), str_buffer);
g_extern.console.external_launch.enable = true;
g_extern.lifecycle_menu_state |= (1 << MODE_EXIT); g_extern.lifecycle_menu_state |= (1 << MODE_EXIT);
g_extern.lifecycle_menu_state |= (1 << MODE_EXITSPAWN);
process_input_ret = -1; process_input_ret = -1;
} }
else if(tmp_browser->current_dir.list->elems[index].attr.b) else if(tmp_browser->current_dir.list->elems[index].attr.b)

View File

@ -339,7 +339,7 @@ static void system_exitspawn(void)
#ifdef IS_SALAMANDER #ifdef IS_SALAMANDER
rarch_console_exec(default_paths.libretro_path); rarch_console_exec(default_paths.libretro_path);
#else #else
if(g_extern.console.external_launch.enable) if (g_extern.lifecycle_menu_state & (1 << MODE_EXITSPAWN))
rarch_console_exec(g_settings.libretro); rarch_console_exec(g_settings.libretro);
#endif #endif
} }
@ -372,7 +372,7 @@ static void system_process_args(int argc, char *argv[])
if (argc > 2 && argv[1] != NULL && argv[2] != NULL) if (argc > 2 && argv[1] != NULL && argv[2] != NULL)
{ {
char rom[PATH_MAX]; char rom[PATH_MAX];
g_extern.console.external_launch.support = EXTERN_LAUNCHER_CHANNEL; g_extern.lifecycle_menu_state |= (1 << MODE_EXTLAUNCH_CHANNEL);
snprintf(rom, sizeof(rom), "%s%s", argv[1], argv[2]); snprintf(rom, sizeof(rom), "%s%s", argv[1], argv[2]);
g_extern.file_state.zip_extract_mode = ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE; g_extern.file_state.zip_extract_mode = ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE;
rarch_console_load_game_wrap(rom, g_extern.file_state.zip_extract_mode); rarch_console_load_game_wrap(rom, g_extern.file_state.zip_extract_mode);
@ -385,7 +385,7 @@ static void system_process_args(int argc, char *argv[])
g_extern.lifecycle_menu_state |= (1 << MODE_INIT); g_extern.lifecycle_menu_state |= (1 << MODE_INIT);
} }
else else
g_extern.console.external_launch.support = EXTERN_LAUNCHER_SALAMANDER; g_extern.lifecycle_menu_state |= (1 << MODE_EXTLAUNCH_SALAMANDER);
} }
#endif #endif

View File

@ -218,15 +218,15 @@ static void get_environment_settings(int argc, char *argv[])
if(path_file_exists(default_paths.multiman_self_file) && argc > 1 && path_file_exists(argv[1])) if(path_file_exists(default_paths.multiman_self_file) && argc > 1 && path_file_exists(argv[1]))
{ {
g_extern.console.external_launch.support = EXTERN_LAUNCHER_MULTIMAN; g_extern.lifecycle_menu_state |= (1 << MODE_EXTLAUNCH_MULTIMAN);
RARCH_LOG("Started from multiMAN, auto-game start enabled.\n"); RARCH_LOG("Started from multiMAN, auto-game start enabled.\n");
} }
else else
#endif #endif
#ifndef IS_SALAMANDER #ifndef IS_SALAMANDER
{ {
g_extern.console.external_launch.support = EXTERN_LAUNCHER_SALAMANDER; g_extern.lifecycle_menu_state |= (1 << MODE_EXTLAUNCH_SALAMANDER);
RARCH_WARN("Not started from multiMAN, auto-game start disabled.\n"); RARCH_WARN("Started from Salamander, auto-game start disabled.\n");
} }
#endif #endif
@ -259,7 +259,7 @@ static void get_environment_settings(int argc, char *argv[])
ret = cellGameContentPermit(contentInfoPath, default_paths.port_dir); ret = cellGameContentPermit(contentInfoPath, default_paths.port_dir);
#ifdef HAVE_MULTIMAN #ifdef HAVE_MULTIMAN
if(g_extern.console.external_launch.support == EXTERN_LAUNCHER_MULTIMAN) if (g_extern.lifecycle_menu_state & (1 << MODE_EXTLAUNCH_MULTIMAN))
{ {
snprintf(contentInfoPath, sizeof(contentInfoPath), "/dev_hdd0/game/%s", EMULATOR_CONTENT_DIR); snprintf(contentInfoPath, sizeof(contentInfoPath), "/dev_hdd0/game/%s", EMULATOR_CONTENT_DIR);
snprintf(default_paths.port_dir, sizeof(default_paths.port_dir), "/dev_hdd0/game/%s/USRDIR", EMULATOR_CONTENT_DIR); snprintf(default_paths.port_dir, sizeof(default_paths.port_dir), "/dev_hdd0/game/%s/USRDIR", EMULATOR_CONTENT_DIR);
@ -385,21 +385,15 @@ static void system_post_init(void)
static void system_process_args(int argc, char *argv[]) static void system_process_args(int argc, char *argv[])
{ {
switch(g_extern.console.external_launch.support)
{
case EXTERN_LAUNCHER_SALAMANDER:
break;
#ifdef HAVE_MULTIMAN #ifdef HAVE_MULTIMAN
case EXTERN_LAUNCHER_MULTIMAN: if (g_extern.lifecycle_menu_state & (1 << MODE_EXTLAUNCH_MULTIMAN))
RARCH_LOG("Started from multiMAN, will auto-start game.\n"); {
strlcpy(g_extern.fullpath, argv[1], sizeof(g_extern.fullpath)); RARCH_LOG("Started from multiMAN, will auto-start game.\n");
g_extern.lifecycle_menu_state &= ~(1 << MODE_MENU); strlcpy(g_extern.fullpath, argv[1], sizeof(g_extern.fullpath));
g_extern.lifecycle_menu_state |= (1 << MODE_INIT); g_extern.lifecycle_menu_state &= ~(1 << MODE_MENU);
break; g_extern.lifecycle_menu_state |= (1 << MODE_INIT);
#endif
default:
break;
} }
#endif
} }
static void system_deinit(void) static void system_deinit(void)
@ -470,8 +464,8 @@ static void system_exitspawn(void)
cellSysmoduleLoadModule(CELL_SYSMODULE_FS); cellSysmoduleLoadModule(CELL_SYSMODULE_FS);
cellSysmoduleLoadModule(CELL_SYSMODULE_IO); cellSysmoduleLoadModule(CELL_SYSMODULE_IO);
#else #else
if(g_extern.console.external_launch.enable) if (g_extern.lifecycle_menu_state & (1 << MODE_EXITSPAWN))
rarch_console_exec(g_extern.console.external_launch.launch_app); rarch_console_exec(g_extern.fullpath);
#endif #endif
#endif #endif

View File

@ -111,7 +111,11 @@ enum menu_enums
MODE_MENU_DRAW, MODE_MENU_DRAW,
MODE_INFO_DRAW, MODE_INFO_DRAW,
MODE_FPS_DRAW, MODE_FPS_DRAW,
MODE_EXTLAUNCH_SALAMANDER,
MODE_EXTLAUNCH_CHANNEL,
MODE_EXTLAUNCH_MULTIMAN,
MODE_EXIT, MODE_EXIT,
MODE_EXITSPAWN,
MODE_LOAD_FIRST_SHADER, MODE_LOAD_FIRST_SHADER,
MODE_LOAD_SECOND_SHADER, MODE_LOAD_SECOND_SHADER,
}; };
@ -503,13 +507,6 @@ struct global
} state; } state;
} rmenu; } rmenu;
struct
{
bool enable;
char launch_app[PATH_MAX];
unsigned support;
} external_launch;
struct struct
{ {
struct struct