(PS3) Added Multiman hooks

This commit is contained in:
TwinAphex51224 2012-02-28 14:42:29 +01:00
parent 11720b8113
commit ffc6fc5e24
4 changed files with 47 additions and 44 deletions

View File

@ -173,11 +173,9 @@ struct settings
#ifdef SSNES_CONSOLE #ifdef SSNES_CONSOLE
struct console_settings struct console_settings
{ {
bool autostart_game;
bool block_config_read; bool block_config_read;
bool default_sram_dir_enable; bool default_sram_dir_enable;
bool default_savestate_dir_enable; bool default_savestate_dir_enable;
bool external_launcher_support;
bool frame_advance_enable; bool frame_advance_enable;
bool initialize_ssnes_enable; bool initialize_ssnes_enable;
bool ingame_menu_enable; bool ingame_menu_enable;
@ -190,6 +188,7 @@ struct console_settings
float overscan_amount; float overscan_amount;
uint32_t aspect_ratio_index; uint32_t aspect_ratio_index;
uint32_t emulator_initialized; uint32_t emulator_initialized;
uint32_t external_launcher_support;
uint32_t screen_orientation; uint32_t screen_orientation;
uint32_t current_resolution_index; uint32_t current_resolution_index;
uint32_t current_resolution_id; uint32_t current_resolution_id;
@ -209,6 +208,7 @@ struct console_settings
char default_rom_startup_dir[PATH_MAX]; char default_rom_startup_dir[PATH_MAX];
char default_savestate_dir[PATH_MAX]; char default_savestate_dir[PATH_MAX];
char default_sram_dir[PATH_MAX]; char default_sram_dir[PATH_MAX];
char launch_app_on_exit[PATH_MAX];
float menu_font_size; float menu_font_size;
}; };
#endif #endif

View File

@ -70,8 +70,7 @@ char DEFAULT_SHADER_FILE[MAX_PATH_LENGTH];
char DEFAULT_MENU_SHADER_FILE[MAX_PATH_LENGTH]; char DEFAULT_MENU_SHADER_FILE[MAX_PATH_LENGTH];
char SYS_CONFIG_FILE[MAX_PATH_LENGTH]; char SYS_CONFIG_FILE[MAX_PATH_LENGTH];
char EMULATOR_CORE_SELF[MAX_PATH_LENGTH]; char EMULATOR_CORE_SELF[MAX_PATH_LENGTH];
char MULTIMAN_EXECUTABLE[MAX_PATH_LENGTH];
const char * MULTIMAN_EXECUTABLE = "/dev_hdd0/game/BLES80608/USRDIR/RELOAD.SELF";
int ssnes_main(int argc, char *argv[]); int ssnes_main(int argc, char *argv[]);
@ -318,7 +317,7 @@ static void callback_sysutil_exit(uint64_t status, uint64_t param, void *userdat
} }
} }
static void get_environment_settings(int argc) static void get_environment_settings(int argc, char *argv[])
{ {
g_extern.verbose = true; g_extern.verbose = true;
@ -327,27 +326,28 @@ static void get_environment_settings(int argc)
CellGameContentSize size; CellGameContentSize size;
char dirName[CELL_GAME_DIRNAME_SIZE]; char dirName[CELL_GAME_DIRNAME_SIZE];
if(argc >= 2)
if(path_file_exists(MULTIMAN_EXECUTABLE))
{ {
g_console.external_launcher_support = true; /* launched from external launcher */
SSNES_LOG("multiMAN found, support enabled.\n"); strncpy(MULTIMAN_EXECUTABLE, argv[1], sizeof(MULTIMAN_EXECUTABLE));
} }
else else
{ {
g_console.external_launcher_support = false; /* not launched from external launcher, set default path */
SSNES_WARN("multiMAN not found, support disabled.\n"); strncpy(MULTIMAN_EXECUTABLE, "/dev_hdd0/game/BLES80608/USRDIR/RELOAD.SELF",
sizeof(MULTIMAN_EXECUTABLE));
} }
#if 0 if(path_file_exists(MULTIMAN_EXECUTABLE) && (strcmp(argv[2],"") != 0))
if(argc > 1)
{ {
g_console.autostart_game = true; g_console.external_launcher_support = EXTERN_LAUNCHER_MULTIMAN;
SSNES_LOG("Started from multiMAN, will auto-start game.\n"); SSNES_LOG("Started from multiMAN, auto-game start enabled.\n");
} }
else else
g_console.autostart_game = false; {
#endif g_console.external_launcher_support = EXTERN_LAUNCHER_SALAMANDER;
SSNES_WARN("Not started from multiMAN, auto-game start disabled.\n");
}
memset(&size, 0x00, sizeof(CellGameContentSize)); memset(&size, 0x00, sizeof(CellGameContentSize));
@ -377,7 +377,7 @@ static void get_environment_settings(int argc)
ret = cellGameContentPermit(contentInfoPath, usrDirPath); ret = cellGameContentPermit(contentInfoPath, usrDirPath);
if(g_console.external_launcher_support) if(g_console.external_launcher_support == EXTERN_LAUNCHER_MULTIMAN)
{ {
snprintf(contentInfoPath, sizeof(contentInfoPath), "/dev_hdd0/game/%s", EMULATOR_CONTENT_DIR); snprintf(contentInfoPath, sizeof(contentInfoPath), "/dev_hdd0/game/%s", EMULATOR_CONTENT_DIR);
snprintf(usrDirPath, sizeof(usrDirPath), "/dev_hdd0/game/%s/USRDIR", EMULATOR_CONTENT_DIR); snprintf(usrDirPath, sizeof(usrDirPath), "/dev_hdd0/game/%s/USRDIR", EMULATOR_CONTENT_DIR);
@ -528,7 +528,7 @@ int main(int argc, char *argv[])
sceNpInit(NP_POOL_SIZE, np_pool); sceNpInit(NP_POOL_SIZE, np_pool);
get_environment_settings(argc); get_environment_settings(argc, argv);
ssnes_main_clear_state(); ssnes_main_clear_state();
@ -558,12 +558,17 @@ int main(int argc, char *argv[])
menu_init(); menu_init();
g_console.mode_switch = MODE_MENU; g_console.mode_switch = MODE_MENU;
if(g_console.autostart_game) switch(g_console.external_launcher_support)
{ {
strncpy(g_console.rom_path, argv[1], sizeof(g_console.rom_path)); case EXTERN_LAUNCHER_SALAMANDER:
g_console.initialize_ssnes_enable = 1; break;
g_console.mode_switch = MODE_EMULATION; case EXTERN_LAUNCHER_MULTIMAN:
startup_ssnes(); SSNES_LOG("Started from multiMAN, will auto-start game.\n");
strncpy(g_console.rom_path, argv[1], sizeof(g_console.rom_path));
g_console.initialize_ssnes_enable = 1;
g_console.mode_switch = MODE_EMULATION;
startup_ssnes();
break;
} }
begin_loop: begin_loop:
@ -628,12 +633,12 @@ begin_shutdown:
}; };
SceNpDrmKey * k_licensee = NULL; SceNpDrmKey * k_licensee = NULL;
int ret = sceNpDrmProcessExitSpawn2(k_licensee, g_settings.libsnes, (const char** const)spawn_argv, NULL, (sys_addr_t)spawn_data, 256, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); 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_settings.libsnes, ret); SSNES_LOG("Attempt to load SELF: [%s] (return code: [%x]).\n", g_console.launch_app_on_exit, ret);
if(ret < 0) if(ret < 0)
{ {
SSNES_LOG("SELF file is not of NPDRM type, trying another approach to boot it...\n"); SSNES_LOG("SELF file is not of NPDRM type, trying another approach to boot it...\n");
sys_game_process_exitspawn(g_settings.libsnes, NULL, NULL, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); sys_game_process_exitspawn(g_console.launch_app_on_exit, NULL, NULL, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
} }
sceNpTerm(); sceNpTerm();

View File

@ -810,7 +810,7 @@ static void select_file(uint32_t menu_id)
break; break;
case LIBSNES_CHOICE: case LIBSNES_CHOICE:
strncpy(dir_path, LIBSNES_DIR_PATH, sizeof(dir_path)); strncpy(dir_path, LIBSNES_DIR_PATH, sizeof(dir_path));
strncpy(extensions, "self|SELF", sizeof(extensions)); strncpy(extensions, "self|SELF|bin|BIN", sizeof(extensions));
strncpy(title, "LIBSNES CORE SELECTION", sizeof(title)); strncpy(title, "LIBSNES CORE SELECTION", sizeof(title));
strncpy(object, "Libsnes", sizeof(object)); strncpy(object, "Libsnes", sizeof(object));
strncpy(object, "Libsnes core file", sizeof(object)); strncpy(object, "Libsnes core file", sizeof(object));
@ -880,7 +880,8 @@ static void select_file(uint32_t menu_id)
case BORDER_CHOICE: case BORDER_CHOICE:
break; break;
case LIBSNES_CHOICE: case LIBSNES_CHOICE:
strlcpy(g_settings.libsnes, path, sizeof(g_settings.libsnes)); strlcpy(g_console.launch_app_on_exit, path,
sizeof(g_console.launch_app_on_exit));
g_console.return_to_launcher = true; g_console.return_to_launcher = true;
g_console.menu_enable = false; g_console.menu_enable = false;
g_console.mode_switch = MODE_EXIT; g_console.mode_switch = MODE_EXIT;
@ -1972,24 +1973,20 @@ static void ingame_menu(uint32_t menu_id)
} }
strcpy(comment, "Press 'CROSS' to choose a different emulator core."); strcpy(comment, "Press 'CROSS' to choose a different emulator core.");
break; break;
#ifdef MULTIMAN_SUPPORT
case MENU_ITEM_RETURN_TO_MULTIMAN: case MENU_ITEM_RETURN_TO_MULTIMAN:
if(CTRL_CROSS(state)) if(CTRL_CROSS(state) && path_file_exists(MULTIMAN_EXECUTABLE))
{ {
strlcpy(g_console.launch_app_on_exit, MULTIMAN_EXECUTABLE,
sizeof(g_console.launch_app_on_exit));
g_console.return_to_launcher = true; g_console.return_to_launcher = true;
g_console.menu_enable = false; g_console.menu_enable = false;
g_console.mode_switch = MODE_EXIT; g_console.mode_switch = MODE_EXIT;
} }
strcpy(comment, "Press 'CROSS' to quit the emulator and return to multiMAN."); strcpy(comment, "Press 'CROSS' to quit the emulator and return to multiMAN.");
break; break;
#endif
case MENU_ITEM_RETURN_TO_XMB: case MENU_ITEM_RETURN_TO_XMB:
if(CTRL_CROSS(state)) if(CTRL_CROSS(state))
{ {
#ifdef MULTIMAN_SUPPORT
return_to_MM = false;
#endif
g_console.menu_enable = false; g_console.menu_enable = false;
g_console.mode_switch = MODE_EXIT; g_console.mode_switch = MODE_EXIT;
} }
@ -2071,15 +2068,15 @@ static void ingame_menu(uint32_t menu_id)
cellDbgFontPuts(x_position, (ypos+(ypos_increment*MENU_ITEM_RESET)), font_size, MENU_ITEM_SELECTED(MENU_ITEM_RESET), "Reset"); cellDbgFontPuts(x_position, (ypos+(ypos_increment*MENU_ITEM_RESET)), font_size, MENU_ITEM_SELECTED(MENU_ITEM_RESET), "Reset");
cellDbgFontPuts(x_position, (ypos+(ypos_increment*MENU_ITEM_RETURN_TO_GAME)), font_size, MENU_ITEM_SELECTED(MENU_ITEM_RETURN_TO_GAME), "Return to Game"); cellDbgFontPuts(x_position, (ypos+(ypos_increment*MENU_ITEM_RETURN_TO_GAME)), font_size, MENU_ITEM_SELECTED(MENU_ITEM_RETURN_TO_GAME), "Return to Game");
cellDbgFontDraw();
cellDbgFontPuts(x_position, (ypos+(ypos_increment*MENU_ITEM_RETURN_TO_MENU)), font_size, MENU_ITEM_SELECTED(MENU_ITEM_RETURN_TO_MENU), "Return to Menu"); cellDbgFontPuts(x_position, (ypos+(ypos_increment*MENU_ITEM_RETURN_TO_MENU)), font_size, MENU_ITEM_SELECTED(MENU_ITEM_RETURN_TO_MENU), "Return to Menu");
cellDbgFontDraw(); cellDbgFontDraw();
cellDbgFontPuts(x_position, (ypos+(ypos_increment*MENU_ITEM_CHANGE_LIBSNES)), font_size, MENU_ITEM_SELECTED(MENU_ITEM_CHANGE_LIBSNES), "Change libsnes core"); cellDbgFontPuts(x_position, (ypos+(ypos_increment*MENU_ITEM_CHANGE_LIBSNES)), font_size, MENU_ITEM_SELECTED(MENU_ITEM_CHANGE_LIBSNES), "Change libsnes core");
cellDbgFontDraw(); cellDbgFontDraw();
#ifdef MULTIMAN_SUPPORT
cellDbgFontPuts(x_position, (ypos+(ypos_increment*MENU_ITEM_RETURN_TO_MULTIMAN)), font_size, MENU_ITEM_SELECTED(MENU_ITEM_RETURN_TO_MULTIMAN), "Return to multiMAN"); cellDbgFontPuts(x_position, (ypos+(ypos_increment*MENU_ITEM_RETURN_TO_MULTIMAN)), font_size, MENU_ITEM_SELECTED(MENU_ITEM_RETURN_TO_MULTIMAN), "Return to multiMAN");
#endif
cellDbgFontPuts(x_position, (ypos+(ypos_increment*MENU_ITEM_RETURN_TO_XMB)), font_size, MENU_ITEM_SELECTED(MENU_ITEM_RETURN_TO_XMB), "Return to XMB"); cellDbgFontPuts(x_position, (ypos+(ypos_increment*MENU_ITEM_RETURN_TO_XMB)), font_size, MENU_ITEM_SELECTED(MENU_ITEM_RETURN_TO_XMB), "Return to XMB");
cellDbgFontDraw(); cellDbgFontDraw();

View File

@ -32,13 +32,16 @@
#define LIGHTBLUE 0xFFFFE0E0U #define LIGHTBLUE 0xFFFFE0E0U
#define LIGHTORANGE 0xFFE0EEFFu #define LIGHTORANGE 0xFFE0EEFFu
enum
{
EXTERN_LAUNCHER_SALAMANDER,
EXTERN_LAUNCHER_MULTIMAN
};
enum enum
{ {
MODE_EMULATION, MODE_EMULATION,
MODE_MENU, MODE_MENU,
#ifdef MULTIMAN_SUPPORT
MODE_MULTIMAN_STARTUP,
#endif
MODE_EXIT MODE_EXIT
}; };
@ -64,9 +67,7 @@ enum {
MENU_ITEM_RETURN_TO_GAME, MENU_ITEM_RETURN_TO_GAME,
MENU_ITEM_RETURN_TO_MENU, MENU_ITEM_RETURN_TO_MENU,
MENU_ITEM_CHANGE_LIBSNES, MENU_ITEM_CHANGE_LIBSNES,
#ifdef MULTIMAN_SUPPORT
MENU_ITEM_RETURN_TO_MULTIMAN, MENU_ITEM_RETURN_TO_MULTIMAN,
#endif
MENU_ITEM_RETURN_TO_XMB MENU_ITEM_RETURN_TO_XMB
}; };
@ -88,4 +89,4 @@ extern char DEFAULT_SHADER_FILE[MAX_PATH_LENGTH];
extern char DEFAULT_MENU_SHADER_FILE[MAX_PATH_LENGTH]; extern char DEFAULT_MENU_SHADER_FILE[MAX_PATH_LENGTH];
extern char LIBSNES_DIR_PATH[MAX_PATH_LENGTH]; extern char LIBSNES_DIR_PATH[MAX_PATH_LENGTH];
extern char SYS_CONFIG_FILE[MAX_PATH_LENGTH]; extern char SYS_CONFIG_FILE[MAX_PATH_LENGTH];
extern char MULTIMAN_GAME_TO_BOOT[MAX_PATH_LENGTH]; extern char MULTIMAN_EXECUTABLE[MAX_PATH_LENGTH];