2012-04-21 21:13:50 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2012-01-29 22:16:39 +00:00
|
|
|
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
|
|
|
* Copyright (C) 2011-2012 - Daniel De Matteis
|
|
|
|
*
|
2012-04-21 21:13:50 +00:00
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
2012-01-29 22:16:39 +00:00
|
|
|
* 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.
|
|
|
|
*
|
2012-04-21 21:13:50 +00:00
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
2012-01-29 22:16:39 +00:00
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
2012-04-21 21:31:57 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
2012-01-29 22:16:39 +00:00
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2012-01-05 21:47:34 +00:00
|
|
|
|
2012-01-10 22:33:44 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stddef.h>
|
2012-01-11 00:04:17 +00:00
|
|
|
#include <string.h>
|
2012-01-10 22:33:44 +00:00
|
|
|
|
2012-03-03 16:23:00 +00:00
|
|
|
#include <sdk_version.h>
|
2012-01-05 21:47:34 +00:00
|
|
|
#include <sys/process.h>
|
2012-05-25 14:24:28 +00:00
|
|
|
#ifdef HAVE_SYSUTILS
|
2012-01-16 14:45:55 +00:00
|
|
|
#include <sysutil/sysutil_screenshot.h>
|
2012-01-05 21:47:34 +00:00
|
|
|
#include <sysutil/sysutil_common.h>
|
2012-01-11 00:04:17 +00:00
|
|
|
#include <sysutil/sysutil_gamecontent.h>
|
2012-03-06 20:03:43 +00:00
|
|
|
#include <sysutil/sysutil_syscache.h>
|
2012-05-25 14:24:28 +00:00
|
|
|
#endif
|
2012-02-25 19:11:57 +00:00
|
|
|
|
2012-03-03 16:23:00 +00:00
|
|
|
#if(CELL_SDK_VERSION > 0x340000)
|
|
|
|
#include <sysutil/sysutil_bgmplayback.h>
|
|
|
|
#endif
|
|
|
|
|
2012-05-25 14:24:28 +00:00
|
|
|
#ifdef HAVE_SYSMODULES
|
2012-02-25 19:11:57 +00:00
|
|
|
#include <cell/sysmodule.h>
|
2012-05-25 14:24:28 +00:00
|
|
|
#endif
|
2012-02-25 19:11:57 +00:00
|
|
|
#include <netex/net.h>
|
|
|
|
#include <np.h>
|
|
|
|
#include <np/drm.h>
|
2012-01-11 00:04:17 +00:00
|
|
|
|
2012-01-11 21:55:07 +00:00
|
|
|
#include "ps3_input.h"
|
2012-01-11 22:48:48 +00:00
|
|
|
#include "ps3_video_psgl.h"
|
2012-01-11 21:55:07 +00:00
|
|
|
|
2012-03-06 13:12:28 +00:00
|
|
|
#include "../console/console_ext.h"
|
2012-01-11 00:04:17 +00:00
|
|
|
#include "../conf/config_file.h"
|
2012-01-30 12:45:37 +00:00
|
|
|
#include "../conf/config_file_macros.h"
|
2012-01-11 00:04:17 +00:00
|
|
|
#include "../general.h"
|
2012-01-30 19:05:36 +00:00
|
|
|
#include "../file.h"
|
2012-01-12 23:01:52 +00:00
|
|
|
|
|
|
|
#include "shared.h"
|
|
|
|
|
2012-01-11 21:27:07 +00:00
|
|
|
#include "menu.h"
|
2012-01-11 00:04:17 +00:00
|
|
|
|
2012-01-29 22:11:47 +00:00
|
|
|
#define EMULATOR_CONTENT_DIR "SSNE10000"
|
2012-02-28 11:07:55 +00:00
|
|
|
#define EMULATOR_CORE_DIR "cores"
|
2012-01-29 22:11:47 +00:00
|
|
|
|
2012-03-06 20:03:43 +00:00
|
|
|
#define CACHE_ID "ABCD12345"
|
2012-02-25 19:11:57 +00:00
|
|
|
#define NP_POOL_SIZE (128*1024)
|
|
|
|
|
|
|
|
static uint8_t np_pool[NP_POOL_SIZE];
|
2012-05-28 15:34:58 +00:00
|
|
|
char contentInfoPath[PATH_MAX];
|
|
|
|
char usrDirPath[PATH_MAX];
|
|
|
|
char DEFAULT_PRESET_FILE[PATH_MAX];
|
|
|
|
char DEFAULT_BORDER_FILE[PATH_MAX];
|
|
|
|
char DEFAULT_MENU_BORDER_FILE[PATH_MAX];
|
|
|
|
char PRESETS_DIR_PATH[PATH_MAX];
|
|
|
|
char INPUT_PRESETS_DIR_PATH[PATH_MAX];
|
|
|
|
char BORDERS_DIR_PATH[PATH_MAX];
|
|
|
|
char SHADERS_DIR_PATH[PATH_MAX];
|
|
|
|
char LIBRETRO_DIR_PATH[PATH_MAX];
|
|
|
|
char DEFAULT_SHADER_FILE[PATH_MAX];
|
|
|
|
char DEFAULT_MENU_SHADER_FILE[PATH_MAX];
|
|
|
|
char SYS_CONFIG_FILE[PATH_MAX];
|
|
|
|
char EMULATOR_CORE_SELF[PATH_MAX];
|
|
|
|
char MULTIMAN_EXECUTABLE[PATH_MAX];
|
2012-02-20 06:50:59 +00:00
|
|
|
|
2012-04-21 21:25:32 +00:00
|
|
|
int rarch_main(int argc, char *argv[]);
|
2012-01-05 21:47:34 +00:00
|
|
|
|
|
|
|
SYS_PROCESS_PARAM(1001, 0x100000)
|
|
|
|
|
|
|
|
#undef main
|
2012-01-11 00:04:17 +00:00
|
|
|
|
2012-01-30 12:45:37 +00:00
|
|
|
static void set_default_settings(void)
|
|
|
|
{
|
2012-04-11 00:42:27 +00:00
|
|
|
// g_settings
|
|
|
|
strlcpy(g_settings.cheat_database, usrDirPath, sizeof(g_settings.cheat_database));
|
|
|
|
g_settings.rewind_enable = false;
|
|
|
|
strlcpy(g_settings.video.cg_shader_path, DEFAULT_SHADER_FILE, sizeof(g_settings.video.cg_shader_path));
|
|
|
|
g_settings.video.fbo_scale_x = 2.0f;
|
|
|
|
g_settings.video.fbo_scale_y = 2.0f;
|
2012-05-28 13:53:04 +00:00
|
|
|
g_settings.video.render_to_texture = true;
|
2012-04-11 00:42:27 +00:00
|
|
|
strlcpy(g_settings.video.second_pass_shader, DEFAULT_SHADER_FILE, sizeof(g_settings.video.second_pass_shader));
|
|
|
|
g_settings.video.second_pass_smooth = true;
|
|
|
|
g_settings.video.smooth = true;
|
|
|
|
g_settings.video.vsync = true;
|
|
|
|
strlcpy(g_settings.cheat_database, usrDirPath, sizeof(g_settings.cheat_database));
|
|
|
|
g_settings.video.msg_pos_x = 0.05f;
|
|
|
|
g_settings.video.msg_pos_y = 0.90f;
|
|
|
|
g_settings.video.aspect_ratio = -1.0f;
|
|
|
|
|
2012-04-21 21:25:32 +00:00
|
|
|
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_B] = platform_keys[PS3_DEVICE_ID_JOYPAD_CROSS].joykey;
|
|
|
|
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_Y] = platform_keys[PS3_DEVICE_ID_JOYPAD_SQUARE].joykey;
|
|
|
|
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_SELECT] = platform_keys[PS3_DEVICE_ID_JOYPAD_SELECT].joykey;
|
|
|
|
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_START] = platform_keys[PS3_DEVICE_ID_JOYPAD_START].joykey;
|
|
|
|
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_UP] = platform_keys[PS3_DEVICE_ID_JOYPAD_UP].joykey;
|
|
|
|
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_DOWN] = platform_keys[PS3_DEVICE_ID_JOYPAD_DOWN].joykey;
|
|
|
|
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_LEFT] = platform_keys[PS3_DEVICE_ID_JOYPAD_LEFT].joykey;
|
|
|
|
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_RIGHT] = platform_keys[PS3_DEVICE_ID_JOYPAD_RIGHT].joykey;
|
|
|
|
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_A] = platform_keys[PS3_DEVICE_ID_JOYPAD_CIRCLE].joykey;
|
|
|
|
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_X] = platform_keys[PS3_DEVICE_ID_JOYPAD_TRIANGLE].joykey;
|
|
|
|
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L] = platform_keys[PS3_DEVICE_ID_JOYPAD_L1].joykey;
|
|
|
|
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R] = platform_keys[PS3_DEVICE_ID_JOYPAD_R1].joykey;
|
2012-05-07 20:25:56 +00:00
|
|
|
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R2] = platform_keys[PS3_DEVICE_ID_JOYPAD_R2].joykey;
|
|
|
|
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R3] = platform_keys[PS3_DEVICE_ID_JOYPAD_R3].joykey;
|
|
|
|
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L2] = platform_keys[PS3_DEVICE_ID_JOYPAD_L2].joykey;
|
|
|
|
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L3] = platform_keys[PS3_DEVICE_ID_JOYPAD_L3].joykey;
|
2012-04-11 00:42:27 +00:00
|
|
|
|
|
|
|
for(uint32_t x = 0; x < MAX_PLAYERS; x++)
|
2012-04-21 21:25:32 +00:00
|
|
|
rarch_input_set_default_keybinds(x);
|
2012-04-11 00:42:27 +00:00
|
|
|
|
|
|
|
// g_console
|
|
|
|
g_console.block_config_read = true;
|
|
|
|
g_console.frame_advance_enable = false;
|
|
|
|
g_console.emulator_initialized = 0;
|
|
|
|
g_console.screenshots_enable = true;
|
|
|
|
g_console.throttle_enable = true;
|
2012-04-21 21:25:32 +00:00
|
|
|
g_console.initialize_rarch_enable = false;
|
2012-04-11 00:42:27 +00:00
|
|
|
g_console.triple_buffering_enable = true;
|
|
|
|
g_console.default_savestate_dir_enable = false;
|
|
|
|
g_console.default_sram_dir_enable = false;
|
2012-05-06 18:05:13 +00:00
|
|
|
g_console.fbo_enabled = true;
|
2012-04-11 00:42:27 +00:00
|
|
|
g_console.mode_switch = MODE_MENU;
|
|
|
|
g_console.screen_orientation = ORIENTATION_NORMAL;
|
|
|
|
g_console.current_resolution_id = CELL_VIDEO_OUT_RESOLUTION_UNDEFINED;
|
|
|
|
strlcpy(g_console.default_rom_startup_dir, "/", sizeof(g_console.default_rom_startup_dir));
|
|
|
|
strlcpy(g_console.default_savestate_dir, usrDirPath, sizeof(g_console.default_savestate_dir));
|
|
|
|
strlcpy(g_console.default_sram_dir, usrDirPath, sizeof(g_console.default_sram_dir));
|
|
|
|
g_console.aspect_ratio_index = 0;
|
|
|
|
g_console.menu_font_size = 1.0f;
|
|
|
|
g_console.overscan_enable = false;
|
|
|
|
g_console.overscan_amount = 0.0f;
|
|
|
|
g_console.sound_mode = SOUND_MODE_NORMAL;
|
2012-05-22 00:32:32 +00:00
|
|
|
g_console.viewports.custom_vp.width = 0;
|
|
|
|
g_console.viewports.custom_vp.height = 0;
|
|
|
|
g_console.viewports.custom_vp.x = 0;
|
|
|
|
g_console.viewports.custom_vp.y = 0;
|
2012-04-11 00:42:27 +00:00
|
|
|
g_console.custom_bgm_enable = true;
|
|
|
|
|
|
|
|
// g_extern
|
|
|
|
g_extern.state_slot = 0;
|
|
|
|
g_extern.audio_data.mute = 0;
|
|
|
|
g_extern.verbose = true;
|
2012-01-30 12:45:37 +00:00
|
|
|
}
|
|
|
|
|
2012-04-09 23:00:25 +00:00
|
|
|
static void init_settings(bool load_libretro_path)
|
2012-01-29 22:11:47 +00:00
|
|
|
{
|
2012-04-11 00:42:27 +00:00
|
|
|
if(!path_file_exists(SYS_CONFIG_FILE))
|
2012-05-28 15:49:31 +00:00
|
|
|
rarch_config_create_default(SYS_CONFIG_FILE);
|
2012-04-11 00:42:27 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
config_file_t * conf = config_file_new(SYS_CONFIG_FILE);
|
|
|
|
|
|
|
|
// g_settings
|
|
|
|
|
2012-05-28 16:25:01 +00:00
|
|
|
#ifdef HAVE_LIBRETRO_MANAGEMENT
|
2012-04-11 00:42:27 +00:00
|
|
|
if(load_libretro_path)
|
2012-05-28 16:33:25 +00:00
|
|
|
{
|
|
|
|
CONFIG_GET_STRING(libretro, "libretro_path");
|
|
|
|
|
|
|
|
if(!strcmp(g_settings.libretro, ""))
|
2012-05-28 17:39:31 +00:00
|
|
|
{
|
|
|
|
const char *first_file = rarch_manage_libretro_set_first_file(LIBRETRO_DIR_PATH, ".SELF");
|
|
|
|
if(first_file != NULL)
|
|
|
|
strlcpy(g_settings.libretro, first_file, sizeof(g_settings.libretro));
|
|
|
|
}
|
2012-05-28 16:33:25 +00:00
|
|
|
}
|
2012-05-28 16:25:01 +00:00
|
|
|
#endif
|
2012-01-30 08:53:16 +00:00
|
|
|
|
2012-04-11 00:42:27 +00:00
|
|
|
CONFIG_GET_STRING(cheat_database, "cheat_database");
|
|
|
|
CONFIG_GET_BOOL(rewind_enable, "rewind_enable");
|
|
|
|
CONFIG_GET_STRING(video.cg_shader_path, "video_cg_shader");
|
|
|
|
CONFIG_GET_STRING(video.second_pass_shader, "video_second_pass_shader");
|
|
|
|
CONFIG_GET_FLOAT(video.fbo_scale_x, "video_fbo_scale_x");
|
|
|
|
CONFIG_GET_FLOAT(video.fbo_scale_y, "video_fbo_scale_y");
|
|
|
|
CONFIG_GET_BOOL(video.render_to_texture, "video_render_to_texture");
|
|
|
|
CONFIG_GET_BOOL(video.second_pass_smooth, "video_second_pass_smooth");
|
|
|
|
CONFIG_GET_BOOL(video.smooth, "video_smooth");
|
|
|
|
CONFIG_GET_BOOL(video.vsync, "video_vsync");
|
|
|
|
CONFIG_GET_FLOAT(video.aspect_ratio, "video_aspect_ratio");
|
2012-05-07 21:52:15 +00:00
|
|
|
CONFIG_GET_STRING(audio.device, "audio_device");
|
2012-02-26 14:18:44 +00:00
|
|
|
|
2012-03-03 23:36:28 +00:00
|
|
|
for (unsigned i = 0; i < 7; i++)
|
|
|
|
{
|
|
|
|
char cfg[64];
|
2012-04-11 00:42:27 +00:00
|
|
|
snprintf(cfg, sizeof(cfg), "input_dpad_emulation_p%u", i + 1);
|
|
|
|
CONFIG_GET_INT(input.dpad_emulation[i], cfg);
|
2012-03-03 23:36:28 +00:00
|
|
|
}
|
2012-03-03 13:57:28 +00:00
|
|
|
|
2012-04-11 00:42:27 +00:00
|
|
|
// g_console
|
|
|
|
|
2012-05-06 18:05:13 +00:00
|
|
|
CONFIG_GET_BOOL_CONSOLE(fbo_enabled, "fbo_enabled");
|
2012-04-11 00:42:27 +00:00
|
|
|
CONFIG_GET_BOOL_CONSOLE(custom_bgm_enable, "custom_bgm_enable");
|
|
|
|
CONFIG_GET_BOOL_CONSOLE(overscan_enable, "overscan_enable");
|
|
|
|
CONFIG_GET_BOOL_CONSOLE(screenshots_enable, "screenshots_enable");
|
|
|
|
CONFIG_GET_BOOL_CONSOLE(throttle_enable, "throttle_enable");
|
|
|
|
CONFIG_GET_BOOL_CONSOLE(triple_buffering_enable, "triple_buffering_enable");
|
|
|
|
CONFIG_GET_INT_CONSOLE(aspect_ratio_index, "aspect_ratio_index");
|
|
|
|
CONFIG_GET_INT_CONSOLE(current_resolution_id, "current_resolution_id");
|
2012-05-22 00:32:32 +00:00
|
|
|
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.x, "custom_viewport_x");
|
|
|
|
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.y, "custom_viewport_y");
|
|
|
|
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.width, "custom_viewport_width");
|
|
|
|
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.height, "custom_viewport_height");
|
2012-04-11 00:42:27 +00:00
|
|
|
CONFIG_GET_INT_CONSOLE(screen_orientation, "screen_orientation");
|
|
|
|
CONFIG_GET_INT_CONSOLE(sound_mode, "sound_mode");
|
|
|
|
CONFIG_GET_STRING_CONSOLE(default_rom_startup_dir, "default_rom_startup_dir");
|
|
|
|
CONFIG_GET_FLOAT_CONSOLE(menu_font_size, "menu_font_size");
|
|
|
|
CONFIG_GET_FLOAT_CONSOLE(overscan_amount, "overscan_amount");
|
|
|
|
|
|
|
|
// g_extern
|
|
|
|
CONFIG_GET_INT_EXTERN(state_slot, "state_slot");
|
|
|
|
CONFIG_GET_INT_EXTERN(audio_data.mute, "audio_mute");
|
|
|
|
}
|
2012-01-30 14:59:15 +00:00
|
|
|
}
|
|
|
|
|
2012-05-25 14:24:28 +00:00
|
|
|
#ifdef HAVE_SYSUTILS
|
2012-02-04 12:29:02 +00:00
|
|
|
static void callback_sysutil_exit(uint64_t status, uint64_t param, void *userdata)
|
|
|
|
{
|
2012-04-11 00:42:27 +00:00
|
|
|
(void) param;
|
|
|
|
(void) userdata;
|
2012-05-26 14:44:02 +00:00
|
|
|
gl_t *gl = driver.video_data;
|
2012-04-11 00:42:27 +00:00
|
|
|
|
|
|
|
switch (status)
|
|
|
|
{
|
|
|
|
case CELL_SYSUTIL_REQUEST_EXITGAME:
|
|
|
|
g_console.menu_enable = false;
|
2012-05-26 14:44:02 +00:00
|
|
|
gl->quitting = true;
|
2012-04-11 00:42:27 +00:00
|
|
|
g_console.ingame_menu_enable = false;
|
|
|
|
g_console.mode_switch = MODE_EXIT;
|
|
|
|
break;
|
|
|
|
case CELL_SYSUTIL_OSKDIALOG_FINISHED:
|
|
|
|
oskutil_close(&g_console.oskutil_handle);
|
|
|
|
oskutil_finished(&g_console.oskutil_handle);
|
|
|
|
break;
|
|
|
|
case CELL_SYSUTIL_OSKDIALOG_UNLOADED:
|
|
|
|
oskutil_unload(&g_console.oskutil_handle);
|
|
|
|
break;
|
|
|
|
}
|
2012-02-04 12:29:02 +00:00
|
|
|
}
|
2012-05-25 14:24:28 +00:00
|
|
|
#endif
|
2012-02-04 12:29:02 +00:00
|
|
|
|
2012-02-28 13:42:29 +00:00
|
|
|
static void get_environment_settings(int argc, char *argv[])
|
2012-01-11 00:04:17 +00:00
|
|
|
{
|
2012-04-11 00:42:27 +00:00
|
|
|
g_extern.verbose = true;
|
|
|
|
|
|
|
|
int ret;
|
|
|
|
unsigned int get_type;
|
|
|
|
unsigned int get_attributes;
|
|
|
|
CellGameContentSize size;
|
|
|
|
char dirName[CELL_GAME_DIRNAME_SIZE];
|
|
|
|
CellSysCacheParam param;
|
|
|
|
memset(¶m, 0x00, sizeof(CellSysCacheParam));
|
2012-05-28 15:28:29 +00:00
|
|
|
strlcpy(param.cacheId,CACHE_ID, sizeof(CellSysCacheParam));
|
2012-04-11 00:42:27 +00:00
|
|
|
|
|
|
|
ret = cellSysCacheMount(¶m);
|
|
|
|
if(ret != CELL_SYSCACHE_RET_OK_CLEARED)
|
|
|
|
{
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_ERR("System cache partition could not be mounted, it might be already mounted.\n");
|
2012-04-11 00:42:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(argc > 1)
|
|
|
|
{
|
|
|
|
/* launched from external launcher */
|
2012-05-28 15:28:29 +00:00
|
|
|
strlcpy(MULTIMAN_EXECUTABLE, argv[2], sizeof(MULTIMAN_EXECUTABLE));
|
2012-04-11 00:42:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* not launched from external launcher, set default path */
|
2012-05-28 15:28:29 +00:00
|
|
|
strlcpy(MULTIMAN_EXECUTABLE, "/dev_hdd0/game/BLES80608/USRDIR/RELOAD.SELF",
|
2012-04-14 03:30:10 +00:00
|
|
|
sizeof(MULTIMAN_EXECUTABLE));
|
2012-04-11 00:42:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(path_file_exists(MULTIMAN_EXECUTABLE) && argc > 1 && path_file_exists(argv[1]))
|
|
|
|
{
|
2012-04-14 03:30:10 +00:00
|
|
|
g_console.external_launcher_support = EXTERN_LAUNCHER_MULTIMAN;
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_LOG("Started from multiMAN, auto-game start enabled.\n");
|
2012-04-11 00:42:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-04-14 03:30:10 +00:00
|
|
|
g_console.external_launcher_support = EXTERN_LAUNCHER_SALAMANDER;
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_WARN("Not started from multiMAN, auto-game start disabled.\n");
|
2012-04-11 00:42:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
memset(&size, 0x00, sizeof(CellGameContentSize));
|
|
|
|
|
|
|
|
ret = cellGameBootCheck(&get_type, &get_attributes, &size, dirName);
|
|
|
|
if(ret < 0)
|
|
|
|
{
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_ERR("cellGameBootCheck() Error: 0x%x.\n", ret);
|
2012-04-11 00:42:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_LOG("cellGameBootCheck() OK.\n");
|
|
|
|
RARCH_LOG("Directory name: [%s].\n", dirName);
|
|
|
|
RARCH_LOG(" HDD Free Size (in KB) = [%d] Size (in KB) = [%d] System Size (in KB) = [%d].\n", size.hddFreeSizeKB, size.sizeKB, size.sysSizeKB);
|
2012-04-14 03:30:10 +00:00
|
|
|
|
|
|
|
switch(get_type)
|
|
|
|
{
|
|
|
|
case CELL_GAME_GAMETYPE_DISC:
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_LOG("RetroArch was launched on Optical Disc Drive.\n");
|
2012-04-14 03:30:10 +00:00
|
|
|
break;
|
|
|
|
case CELL_GAME_GAMETYPE_HDD:
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_LOG("RetroArch was launched on HDD.\n");
|
2012-04-14 03:30:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if((get_attributes & CELL_GAME_ATTRIBUTE_APP_HOME) == CELL_GAME_ATTRIBUTE_APP_HOME)
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_LOG("RetroArch was launched from host machine (APP_HOME).\n");
|
2012-04-14 03:30:10 +00:00
|
|
|
|
|
|
|
ret = cellGameContentPermit(contentInfoPath, usrDirPath);
|
|
|
|
|
|
|
|
if(g_console.external_launcher_support == EXTERN_LAUNCHER_MULTIMAN)
|
|
|
|
{
|
|
|
|
snprintf(contentInfoPath, sizeof(contentInfoPath), "/dev_hdd0/game/%s", EMULATOR_CONTENT_DIR);
|
|
|
|
snprintf(usrDirPath, sizeof(usrDirPath), "/dev_hdd0/game/%s/USRDIR", EMULATOR_CONTENT_DIR);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(ret < 0)
|
|
|
|
{
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_ERR("cellGameContentPermit() Error: 0x%x\n", ret);
|
2012-04-14 03:30:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_LOG("cellGameContentPermit() OK.\n");
|
|
|
|
RARCH_LOG("contentInfoPath : [%s].\n", contentInfoPath);
|
|
|
|
RARCH_LOG("usrDirPath : [%s].\n", usrDirPath);
|
2012-04-14 03:30:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* now we fill in all the variables */
|
|
|
|
snprintf(DEFAULT_PRESET_FILE, sizeof(DEFAULT_PRESET_FILE), "%s/%s/presets/stock.conf", usrDirPath, EMULATOR_CORE_DIR);
|
|
|
|
snprintf(DEFAULT_BORDER_FILE, sizeof(DEFAULT_BORDER_FILE), "%s/%s/borders/Centered-1080p/mega-man-2.png", usrDirPath, EMULATOR_CORE_DIR);
|
|
|
|
snprintf(DEFAULT_MENU_BORDER_FILE, sizeof(DEFAULT_MENU_BORDER_FILE), "%s/%s/borders/Menu/main-menu.png", usrDirPath, EMULATOR_CORE_DIR);
|
|
|
|
snprintf(PRESETS_DIR_PATH, sizeof(PRESETS_DIR_PATH), "%s/%s/presets", usrDirPath, EMULATOR_CORE_DIR);
|
|
|
|
snprintf(INPUT_PRESETS_DIR_PATH, sizeof(INPUT_PRESETS_DIR_PATH), "%s/input", PRESETS_DIR_PATH);
|
2012-04-21 23:45:55 +00:00
|
|
|
snprintf(LIBRETRO_DIR_PATH, sizeof(LIBRETRO_DIR_PATH), "%s/%s", usrDirPath, EMULATOR_CORE_DIR);
|
2012-04-14 03:30:10 +00:00
|
|
|
snprintf(BORDERS_DIR_PATH, sizeof(BORDERS_DIR_PATH), "%s/%s/borders", usrDirPath, EMULATOR_CORE_DIR);
|
|
|
|
snprintf(SHADERS_DIR_PATH, sizeof(SHADERS_DIR_PATH), "%s/%s/shaders", usrDirPath, EMULATOR_CORE_DIR);
|
|
|
|
snprintf(DEFAULT_SHADER_FILE, sizeof(DEFAULT_SHADER_FILE), "%s/%s/shaders/stock.cg", usrDirPath, EMULATOR_CORE_DIR);
|
2012-04-21 23:45:55 +00:00
|
|
|
snprintf(DEFAULT_MENU_SHADER_FILE, sizeof(DEFAULT_MENU_SHADER_FILE), "%s/%s/shaders/Borders/Menu/border-only-rarch.cg", usrDirPath, EMULATOR_CORE_DIR);
|
|
|
|
snprintf(SYS_CONFIG_FILE, sizeof(SYS_CONFIG_FILE), "%s/retroarch.cfg", usrDirPath);
|
2012-04-11 00:42:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_extern.verbose = false;
|
2012-02-20 06:50:59 +00:00
|
|
|
}
|
|
|
|
|
2012-01-05 21:47:34 +00:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2012-05-25 14:24:28 +00:00
|
|
|
#ifdef HAVE_SYSUTILS
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_LOG("Registering system utility callback...\n");
|
2012-04-11 00:42:27 +00:00
|
|
|
cellSysutilRegisterCallback(0, callback_sysutil_exit, NULL);
|
2012-05-25 14:24:28 +00:00
|
|
|
#endif
|
2012-02-26 14:18:44 +00:00
|
|
|
|
2012-05-25 14:24:28 +00:00
|
|
|
#ifdef HAVE_SYSMODULES
|
2012-04-11 00:42:27 +00:00
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_IO);
|
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_FS);
|
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_GAME);
|
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_AVCONF_EXT);
|
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_PNGDEC);
|
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_JPGDEC);
|
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_NET);
|
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_NP);
|
2012-05-25 14:24:28 +00:00
|
|
|
#endif
|
2012-02-25 19:11:57 +00:00
|
|
|
|
2012-04-11 00:42:27 +00:00
|
|
|
sys_net_initialize_network();
|
2012-02-25 19:11:57 +00:00
|
|
|
|
2012-02-27 19:07:24 +00:00
|
|
|
#ifdef HAVE_LOGGER
|
2012-04-11 00:42:27 +00:00
|
|
|
logger_init();
|
2012-02-27 19:07:24 +00:00
|
|
|
#endif
|
|
|
|
|
2012-04-11 00:42:27 +00:00
|
|
|
sceNpInit(NP_POOL_SIZE, np_pool);
|
2012-01-11 00:04:17 +00:00
|
|
|
|
2012-04-21 21:25:32 +00:00
|
|
|
rarch_main_clear_state();
|
2012-04-11 00:42:27 +00:00
|
|
|
get_environment_settings(argc, argv);
|
2012-01-16 03:07:02 +00:00
|
|
|
|
2012-04-11 00:42:27 +00:00
|
|
|
config_set_defaults();
|
2012-01-21 16:24:25 +00:00
|
|
|
|
2012-05-22 02:14:28 +00:00
|
|
|
rarch_assert(g_extern.msg_queue = msg_queue_new(8));
|
|
|
|
|
2012-04-13 13:57:59 +00:00
|
|
|
char full_path[1024], tmp_path[1024];
|
|
|
|
snprintf(full_path, sizeof(full_path), "%s/%s/CORE.SELF", usrDirPath, EMULATOR_CORE_DIR);
|
|
|
|
snprintf(tmp_path, sizeof(tmp_path), "%s/%s/", usrDirPath, EMULATOR_CORE_DIR);
|
2012-05-28 18:07:08 +00:00
|
|
|
|
|
|
|
g_extern.verbose = true;
|
|
|
|
|
|
|
|
const char *libretro_core_installed = rarch_manage_libretro_install(full_path, tmp_path, ".SELF");
|
|
|
|
|
|
|
|
g_extern.verbose = false;
|
|
|
|
|
|
|
|
bool find_libretro_file = false;
|
|
|
|
|
|
|
|
if(libretro_core_installed != NULL)
|
|
|
|
strlcpy(g_settings.libretro, libretro_core_installed, sizeof(g_settings.libretro));
|
|
|
|
else
|
|
|
|
find_libretro_file = true;
|
2012-02-26 14:18:44 +00:00
|
|
|
|
2012-04-11 00:42:27 +00:00
|
|
|
set_default_settings();
|
2012-05-28 18:07:08 +00:00
|
|
|
init_settings(find_libretro_file);
|
2012-04-11 00:42:27 +00:00
|
|
|
init_libretro_sym();
|
2012-01-11 00:04:17 +00:00
|
|
|
|
2012-01-16 14:45:55 +00:00
|
|
|
#if(CELL_SDK_VERSION > 0x340000)
|
2012-04-11 00:42:27 +00:00
|
|
|
if (g_console.screenshots_enable)
|
|
|
|
{
|
2012-05-25 14:24:28 +00:00
|
|
|
#ifdef HAVE_SYSMODULES
|
2012-04-11 00:42:27 +00:00
|
|
|
cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT);
|
2012-05-25 14:24:28 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYSUTILS
|
2012-04-11 00:42:27 +00:00
|
|
|
CellScreenShotSetParam screenshot_param = {0, 0, 0, 0};
|
|
|
|
|
2012-04-21 01:28:32 +00:00
|
|
|
screenshot_param.photo_title = "RetroArch PS3";
|
|
|
|
screenshot_param.game_title = "RetroArch PS3";
|
2012-04-11 00:42:27 +00:00
|
|
|
cellScreenShotSetParameter (&screenshot_param);
|
|
|
|
cellScreenShotEnable();
|
2012-05-25 14:24:28 +00:00
|
|
|
#endif
|
2012-04-11 00:42:27 +00:00
|
|
|
}
|
2012-05-25 14:24:28 +00:00
|
|
|
#ifdef HAVE_SYSUTILS
|
2012-04-11 00:42:27 +00:00
|
|
|
if (g_console.custom_bgm_enable)
|
|
|
|
cellSysutilEnableBgmPlayback();
|
2012-05-25 14:24:28 +00:00
|
|
|
#endif
|
2012-01-16 14:45:55 +00:00
|
|
|
#endif
|
|
|
|
|
2012-05-27 17:29:10 +00:00
|
|
|
video_gl.start();
|
|
|
|
|
2012-05-28 03:06:25 +00:00
|
|
|
input_ps3.init();
|
|
|
|
|
2012-04-11 00:42:27 +00:00
|
|
|
oskutil_init(&g_console.oskutil_handle, 0);
|
2012-01-11 21:27:07 +00:00
|
|
|
|
2012-04-21 21:25:32 +00:00
|
|
|
rarch_input_set_default_keybind_names_for_emulator();
|
2012-03-06 15:06:47 +00:00
|
|
|
|
2012-04-11 00:42:27 +00:00
|
|
|
menu_init();
|
2012-01-16 03:07:02 +00:00
|
|
|
|
2012-04-11 00:42:27 +00:00
|
|
|
switch(g_console.external_launcher_support)
|
|
|
|
{
|
|
|
|
case EXTERN_LAUNCHER_SALAMANDER:
|
|
|
|
g_console.mode_switch = MODE_MENU;
|
|
|
|
break;
|
|
|
|
case EXTERN_LAUNCHER_MULTIMAN:
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_LOG("Started from multiMAN, will auto-start game.\n");
|
2012-05-28 15:28:29 +00:00
|
|
|
strlcpy(g_console.rom_path, argv[1], sizeof(g_console.rom_path));
|
2012-04-21 21:25:32 +00:00
|
|
|
g_console.initialize_rarch_enable = 1;
|
2012-04-11 00:42:27 +00:00
|
|
|
g_console.mode_switch = MODE_EMULATION;
|
2012-04-21 21:25:32 +00:00
|
|
|
rarch_startup(SYS_CONFIG_FILE);
|
2012-04-11 00:42:27 +00:00
|
|
|
break;
|
|
|
|
}
|
2012-02-20 06:50:59 +00:00
|
|
|
|
2012-01-20 17:00:33 +00:00
|
|
|
begin_loop:
|
2012-04-11 00:42:27 +00:00
|
|
|
if(g_console.mode_switch == MODE_EMULATION)
|
|
|
|
{
|
|
|
|
bool repeat = false;
|
|
|
|
|
|
|
|
input_ps3.poll(NULL);
|
|
|
|
|
2012-05-22 16:23:58 +00:00
|
|
|
rarch_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height);
|
|
|
|
|
2012-04-11 00:42:27 +00:00
|
|
|
do{
|
2012-04-21 21:25:32 +00:00
|
|
|
repeat = rarch_main_iterate();
|
2012-04-11 00:42:27 +00:00
|
|
|
}while(repeat && !g_console.frame_advance_enable);
|
|
|
|
}
|
|
|
|
else if(g_console.mode_switch == MODE_MENU)
|
|
|
|
{
|
|
|
|
menu_loop();
|
2012-04-21 21:25:32 +00:00
|
|
|
rarch_startup(SYS_CONFIG_FILE);
|
2012-04-11 00:42:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
goto begin_shutdown;
|
|
|
|
|
|
|
|
goto begin_loop;
|
2012-01-11 21:27:07 +00:00
|
|
|
|
2012-01-20 17:00:33 +00:00
|
|
|
begin_shutdown:
|
2012-04-11 00:42:27 +00:00
|
|
|
if(path_file_exists(SYS_CONFIG_FILE))
|
2012-05-28 15:49:31 +00:00
|
|
|
rarch_config_save(SYS_CONFIG_FILE);
|
|
|
|
|
2012-04-11 00:42:27 +00:00
|
|
|
if(g_console.emulator_initialized)
|
2012-04-21 21:25:32 +00:00
|
|
|
rarch_main_deinit();
|
2012-05-28 15:49:31 +00:00
|
|
|
|
2012-05-28 03:06:25 +00:00
|
|
|
input_ps3.free(NULL);
|
2012-05-27 17:29:10 +00:00
|
|
|
|
|
|
|
video_gl.stop();
|
|
|
|
|
2012-04-11 00:42:27 +00:00
|
|
|
if(g_console.oskutil_handle.is_running)
|
|
|
|
oskutil_unload(&g_console.oskutil_handle);
|
2012-02-27 19:07:24 +00:00
|
|
|
#ifdef HAVE_LOGGER
|
2012-04-11 00:42:27 +00:00
|
|
|
logger_shutdown();
|
2012-02-27 19:07:24 +00:00
|
|
|
#endif
|
|
|
|
|
2012-05-25 14:24:28 +00:00
|
|
|
#ifdef HAVE_SYSMODULES
|
2012-04-11 00:42:27 +00:00
|
|
|
if(g_console.screenshots_enable)
|
|
|
|
cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT);
|
|
|
|
cellSysmoduleUnloadModule(CELL_SYSMODULE_JPGDEC);
|
|
|
|
cellSysmoduleUnloadModule(CELL_SYSMODULE_PNGDEC);
|
|
|
|
cellSysmoduleUnloadModule(CELL_SYSMODULE_AVCONF_EXT);
|
|
|
|
cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_GAME);
|
2012-05-25 14:24:28 +00:00
|
|
|
#endif
|
2012-04-11 00:42:27 +00:00
|
|
|
|
|
|
|
int ret = cellSysCacheClear();
|
|
|
|
|
|
|
|
if(ret != CELL_SYSCACHE_RET_OK_CLEARED)
|
|
|
|
{
|
2012-04-21 21:25:32 +00:00
|
|
|
RARCH_ERR("System cache partition could not be cleared on exit.\n");
|
2012-04-11 00:42:27 +00:00
|
|
|
}
|
|
|
|
|
2012-04-21 21:25:32 +00:00
|
|
|
rarch_exec();
|
2012-04-13 19:01:04 +00:00
|
|
|
|
2012-04-11 00:42:27 +00:00
|
|
|
return 1;
|
2012-01-05 21:47:34 +00:00
|
|
|
}
|