This commit is contained in:
Toad King 2012-05-31 10:55:06 -04:00
commit 9340830991
45 changed files with 3194 additions and 2859 deletions

File diff suppressed because it is too large Load Diff

View File

@ -102,17 +102,10 @@ typedef struct
HRESULT xdk360_console_init ( LPCSTR strFontFileName, D3DCOLOR colBackColor, D3DCOLOR colTextColor);
void xdk360_console_deinit (void);
void xdk360_console_format (_In_z_ _Printf_format_string_ LPCSTR strFormat, ... );
void xdk360_console_format (LPCSTR strFormat, ... );
void xdk360_console_draw (void);
HRESULT xdk360_video_font_init(xdk360_video_font_t * font, const char * strFontFileName);
void xdk360_video_font_get_text_width(xdk360_video_font_t * font, const wchar_t * strText, float * pWidth, float * pHeight, int bFirstLineOnly);
void xdk360_video_font_deinit(xdk360_video_font_t * font);
void xdk360_video_font_set_cursor_position(xdk360_video_font_t *font, float fCursorX, float fCursorY );
void xdk360_video_font_begin (xdk360_video_font_t * font);
void xdk360_video_font_end (xdk360_video_font_t * font);
void xdk360_video_font_set_size(float x, float y);
void xdk360_video_font_draw_text(xdk360_video_font_t * font, float fOriginX, float fOriginY, unsigned long dwColor,
const wchar_t * strText, float fMaxPixelWidth );
#endif

View File

@ -29,7 +29,6 @@
#include "../conf/config_file_macros.h"
#include "../file.h"
#include "../general.h"
#include "shared.h"
#define DEVICE_MEMORY_UNIT0 1
#define DEVICE_MEMORY_UNIT1 2
@ -49,8 +48,8 @@ typedef struct _STRING {
char * Buffer;
} STRING;
char DEFAULT_SHADER_FILE[MAX_PATH_LENGTH];
char SYS_CONFIG_FILE[MAX_PATH_LENGTH];
char DEFAULT_SHADER_FILE[PATH_MAX];
char SYS_CONFIG_FILE[PATH_MAX];
extern "C" int __stdcall ObCreateSymbolicLink( STRING*, STRING*);
@ -134,6 +133,8 @@ static void set_default_settings (void)
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;
g_settings.video.render_to_texture = true;
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;
@ -176,6 +177,7 @@ static void set_default_settings (void)
g_console.viewports.custom_vp.x = 0;
g_console.viewports.custom_vp.y = 0;
g_console.color_format = 0;
g_console.info_msg_enable = true;
//g_extern
g_extern.state_slot = 0;
@ -183,149 +185,6 @@ static void set_default_settings (void)
g_extern.verbose = true;
}
static void init_settings (bool load_libretro_path)
{
char fname_tmp[MAX_PATH_LENGTH];
if(!path_file_exists(SYS_CONFIG_FILE))
{
FILE * f;
RARCH_ERR("Config file \"%s\" desn't exist. Creating...\n", "game:\\retroarch.cfg");
f = fopen(SYS_CONFIG_FILE, "w");
fclose(f);
}
config_file_t * conf = config_file_new(SYS_CONFIG_FILE);
if(load_libretro_path)
{
CONFIG_GET_STRING(libretro, "libretro_path");
if(!strcmp(g_settings.libretro, ""))
{
//We need to set libretro to the first entry in the cores
//directory so that it will be saved to the config file
char ** dir_list = dir_list_new("game:\\", ".xex");
if (!dir_list)
{
RARCH_ERR("Couldn't read directory.\n");
return;
}
const char * first_xex = dir_list[0];
if(first_xex)
{
fill_pathname_base(fname_tmp, first_xex, sizeof(fname_tmp));
if(strcmp(fname_tmp, "RetroArch-Salamander.xex") == 0)
{
RARCH_WARN("First entry is RetroArch Salamander itself, increment entry by one and check if it exists.\n");
first_xex = dir_list[1];
fill_pathname_base(fname_tmp, first_xex, sizeof(fname_tmp));
if(!first_xex)
{
//This is very unlikely to happen
RARCH_WARN("There is no second entry - no choice but to set it to RetroArch Salamander\n");
first_xex = dir_list[0];
fill_pathname_base(fname_tmp, first_xex, sizeof(fname_tmp));
}
}
RARCH_LOG("Set first .xex entry in dir: [%s] to libretro path.\n", fname_tmp);
snprintf(g_settings.libretro, sizeof(g_settings.libretro), "game:\\%s", fname_tmp);
}
else
{
RARCH_ERR("Failed to set first .xex entry to libretro path.\n");
}
dir_list_free(dir_list);
}
}
// g_settings
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");
// g_console
CONFIG_GET_BOOL_CONSOLE(fbo_enabled, "fbo_enabled");
CONFIG_GET_BOOL_CONSOLE(throttle_enable, "throttle_enable");
CONFIG_GET_BOOL_CONSOLE(gamma_correction_enable, "gamma_correction_enable");
CONFIG_GET_STRING_CONSOLE(default_rom_startup_dir, "default_rom_startup_dir");
CONFIG_GET_INT_CONSOLE(aspect_ratio_index, "aspect_ratio_index");
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");
CONFIG_GET_INT_CONSOLE(screen_orientation, "screen_orientation");
CONFIG_GET_INT_CONSOLE(color_format, "color_format");
// g_extern
CONFIG_GET_INT_EXTERN(state_slot, "state_slot");
CONFIG_GET_INT_EXTERN(audio_data.mute, "audio_mute");
}
static void save_settings (void)
{
if(!path_file_exists(SYS_CONFIG_FILE))
{
FILE * f;
f = fopen(SYS_CONFIG_FILE, "w");
fclose(f);
}
config_file_t * conf = config_file_new(SYS_CONFIG_FILE);
if(conf == NULL)
conf = config_file_new(NULL);
// g_settings
config_set_string(conf, "libretro_path", g_settings.libretro);
config_set_bool(conf, "rewind_enable", g_settings.rewind_enable);
config_set_string(conf, "video_cg_shader", g_settings.video.cg_shader_path);
config_set_string(conf, "video_second_pass_shader", g_settings.video.second_pass_shader);
config_set_float(conf, "video_aspect_ratio", g_settings.video.aspect_ratio);
config_set_float(conf, "video_fbo_scale_x", g_settings.video.fbo_scale_x);
config_set_float(conf, "video_fbo_scale_y", g_settings.video.fbo_scale_y);
config_set_bool(conf, "video_render_to_texture", g_settings.video.render_to_texture);
config_set_bool(conf, "video_second_pass_smooth", g_settings.video.second_pass_smooth);
config_set_bool(conf, "video_smooth", g_settings.video.smooth);
config_set_bool(conf, "video_vsync", g_settings.video.vsync);
// g_console
config_set_bool(conf, "fbo_enabled", g_console.fbo_enabled);
config_set_string(conf, "default_rom_startup_dir", g_console.default_rom_startup_dir);
config_set_bool(conf, "gamma_correction_enable", g_console.gamma_correction_enable);
config_set_bool(conf, "throttle_enable", g_console.throttle_enable);
config_set_int(conf, "aspect_ratio_index", g_console.aspect_ratio_index);
config_set_int(conf, "custom_viewport_width", g_console.viewports.custom_vp.width);
config_set_int(conf, "custom_viewport_height", g_console.viewports.custom_vp.height);
config_set_int(conf, "custom_viewport_x", g_console.viewports.custom_vp.x);
config_set_int(conf, "custom_viewport_y", g_console.viewports.custom_vp.y);
config_set_int(conf, "screen_orientation", g_console.screen_orientation);
config_set_int(conf, "color_format", g_console.color_format);
// g_extern
config_set_int(conf, "state_slot", g_extern.state_slot);
config_set_int(conf, "audio_mute", g_extern.audio_data.mute);
if (!config_file_write(conf, SYS_CONFIG_FILE))
RARCH_ERR("Failed to write config file to \"%s\". Check permissions.\n", SYS_CONFIG_FILE);
free(conf);
}
static void get_environment_settings (void)
{
DWORD ret;
@ -407,15 +266,24 @@ int main(int argc, char *argv[])
rarch_main_clear_state();
config_set_defaults();
rarch_assert(g_extern.msg_queue = msg_queue_new(8));
char full_path[1024];
snprintf(full_path, sizeof(full_path), "game:\\CORE.xex");
bool load_libretro_path = rarch_manage_libretro_core(full_path, "game:\\", ".xex");
g_extern.verbose = true;
const char *libretro_core_installed = rarch_manage_libretro_install(full_path, "game:\\", ".xex");
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;
set_default_settings();
init_settings(load_libretro_path);
rarch_config_load(SYS_CONFIG_FILE, "game:\\", ".xex", find_libretro_file);
init_libretro_sym();
video_xdk360.start();
@ -450,7 +318,7 @@ begin_loop:
begin_shutdown:
if(path_file_exists(SYS_CONFIG_FILE))
save_settings();
rarch_config_save(SYS_CONFIG_FILE);
menu_deinit();
video_xdk360.stop();

View File

@ -31,6 +31,8 @@
<Height>383.040009</Height>
<Position>44.880005,64.959991,0.000000</Position>
<ItemsText>Rewind:
Info messages:
Menus:
Gamma Correction:
Color Format:
Shader #1:
@ -197,6 +199,18 @@ Custom Scaling Factor:
<InterItemSpacing>0.000000,10.000000,0.000000</InterItemSpacing>
</Properties>
</XuiListItem>
<XuiListItem>
<Properties>
<Id>control_ListItem</Id>
<Width>226.000000</Width>
<Height>45.000000</Height>
<Position>7.000000,22.000000,0.000000</Position>
<Anchor>5</Anchor>
<Show>false</Show>
<Visual>XuiButton</Visual>
<InterItemSpacing>0.000000,10.000000,0.000000</InterItemSpacing>
</Properties>
</XuiListItem>
</XuiCommonList>
<XuiBackButton>
<Properties>

View File

@ -31,6 +31,8 @@
<Height>232.720001</Height>
<Position>44.880005,64.959991,0.000000</Position>
<ItemsText>Rewind:
Info messages:
Menus:
Color Format:
Gamma Correction:
Shader #1:
@ -173,6 +175,18 @@ Cutom Scaling Factor:
<InterItemSpacing>0.000000,10.000000,0.000000</InterItemSpacing>
</Properties>
</XuiListItem>
<XuiListItem>
<Properties>
<Id>control_ListItem</Id>
<Width>226.000000</Width>
<Height>45.000000</Height>
<Position>7.000000,22.000000,0.000000</Position>
<Anchor>5</Anchor>
<Show>false</Show>
<Visual>XuiButton</Visual>
<InterItemSpacing>0.000000,10.000000,0.000000</InterItemSpacing>
</Properties>
</XuiListItem>
</XuiCommonList>
<XuiBackButton>
<Properties>

File diff suppressed because it is too large Load Diff

View File

@ -23,6 +23,8 @@
enum
{
SETTING_EMU_REWIND_ENABLED = 0,
SETTING_EMU_SHOW_INFO_MSG,
SETTING_EMU_MENUS,
SETTING_GAMMA_CORRECTION_ENABLED,
SETTING_COLOR_FORMAT,
SETTING_SHADER,
@ -35,23 +37,23 @@ enum
enum
{
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_B = 0,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_Y,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_SELECT,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_START,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_UP,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_DOWN,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_LEFT,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_RIGHT,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_A,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_X,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_L,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_L2,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R2,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_L3,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R3,
SETTING_CONTROLS_DEFAULT_ALL
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_B = 0,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_Y,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_SELECT,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_START,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_UP,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_DOWN,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_LEFT,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_RIGHT,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_A,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_X,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_L,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_L2,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R2,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_L3,
SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R3,
SETTING_CONTROLS_DEFAULT_ALL
};
enum
@ -62,154 +64,154 @@ enum
class CRetroArch : public CXuiModule
{
public:
HXUIOBJ hMainScene;
HXUIOBJ hControlsMenu;
HXUIOBJ hFileBrowser;
HXUIOBJ hCoreBrowser;
HXUIOBJ hShaderBrowser;
HXUIOBJ hQuickMenu;
HXUIOBJ hRetroArchSettings;
protected:
/* Override so that Cssnes can register classes */
virtual HRESULT RegisterXuiClasses();
/* Override so that Cssnes can unregister classes */
virtual HRESULT UnregisterXuiClasses();
public:
HXUIOBJ hMainScene;
HXUIOBJ hControlsMenu;
HXUIOBJ hFileBrowser;
HXUIOBJ hCoreBrowser;
HXUIOBJ hShaderBrowser;
HXUIOBJ hQuickMenu;
HXUIOBJ hRetroArchSettings;
protected:
virtual HRESULT RegisterXuiClasses();
virtual HRESULT UnregisterXuiClasses();
};
class CRetroArchMain: public CXuiSceneImpl
{
protected:
CXuiControl m_filebrowser;
CXuiControl m_quick_menu;
CXuiControl m_controls;
CXuiControl m_settings;
CXuiControl m_change_libretro_core;
CXuiControl m_quit;
CXuiTextElement m_title;
CXuiTextElement m_core;
public:
HRESULT OnInit( XUIMessageInit* pInitData, int & bHandled );
HRESULT OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled );
protected:
CXuiControl m_filebrowser;
CXuiControl m_quick_menu;
CXuiControl m_controls;
CXuiControl m_settings;
CXuiControl m_change_libretro_core;
CXuiControl m_quit;
CXuiTextElement m_title;
CXuiTextElement m_core;
public:
HRESULT OnInit( XUIMessageInit* pInitData, int & bHandled );
HRESULT OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled );
XUI_BEGIN_MSG_MAP()
XUI_ON_XM_INIT( OnInit)
XUI_ON_XM_NOTIFY_PRESS( OnNotifyPress )
XUI_END_MSG_MAP();
XUI_BEGIN_MSG_MAP()
XUI_ON_XM_INIT( OnInit)
XUI_ON_XM_NOTIFY_PRESS( OnNotifyPress )
XUI_END_MSG_MAP();
XUI_IMPLEMENT_CLASS(CRetroArchMain, L"RetroArchMain", XUI_CLASS_SCENE)
XUI_IMPLEMENT_CLASS(CRetroArchMain, L"RetroArchMain", XUI_CLASS_SCENE)
};
class CRetroArchFileBrowser: public CXuiSceneImpl
{
protected:
CXuiList m_romlist;
CXuiControl m_back;
CXuiControl m_dir_game;
CXuiControl m_dir_cache;
CXuiTextElement m_rompathtitle;
public:
HRESULT OnInit( XUIMessageInit* pInitData, int & bHandled );
HRESULT OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled );
protected:
CXuiList m_romlist;
CXuiControl m_back;
CXuiControl m_dir_game;
CXuiControl m_dir_cache;
CXuiTextElement m_rompathtitle;
public:
HRESULT OnInit( XUIMessageInit* pInitData, int & bHandled );
HRESULT OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled );
XUI_BEGIN_MSG_MAP()
XUI_ON_XM_INIT( OnInit)
XUI_ON_XM_NOTIFY_PRESS( OnNotifyPress )
XUI_END_MSG_MAP();
XUI_BEGIN_MSG_MAP()
XUI_ON_XM_INIT( OnInit)
XUI_ON_XM_NOTIFY_PRESS( OnNotifyPress )
XUI_END_MSG_MAP();
XUI_IMPLEMENT_CLASS(CRetroArchFileBrowser, L"RetroArchFileBrowser", XUI_CLASS_SCENE)
XUI_IMPLEMENT_CLASS(CRetroArchFileBrowser, L"RetroArchFileBrowser", XUI_CLASS_SCENE)
};
class CRetroArchCoreBrowser: public CXuiSceneImpl
{
protected:
CXuiList m_romlist;
CXuiControl m_back;
CXuiTextElement m_rompathtitle;
public:
HRESULT OnInit( XUIMessageInit* pInitData, int & bHandled );
HRESULT OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled );
protected:
CXuiList m_romlist;
CXuiControl m_back;
CXuiTextElement m_rompathtitle;
public:
HRESULT OnInit( XUIMessageInit* pInitData, int & bHandled );
HRESULT OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled );
XUI_BEGIN_MSG_MAP()
XUI_ON_XM_INIT( OnInit)
XUI_ON_XM_NOTIFY_PRESS( OnNotifyPress )
XUI_END_MSG_MAP();
XUI_BEGIN_MSG_MAP()
XUI_ON_XM_INIT( OnInit)
XUI_ON_XM_NOTIFY_PRESS( OnNotifyPress )
XUI_END_MSG_MAP();
XUI_IMPLEMENT_CLASS(CRetroArchCoreBrowser, L"RetroArchCoreBrowser", XUI_CLASS_SCENE)
XUI_IMPLEMENT_CLASS(CRetroArchCoreBrowser, L"RetroArchCoreBrowser", XUI_CLASS_SCENE)
};
class CRetroArchShaderBrowser: public CXuiSceneImpl
{
protected:
CXuiList m_shaderlist;
CXuiControl m_back;
CXuiTextElement m_shaderpathtitle;
public:
HRESULT OnInit( XUIMessageInit* pInitData, int & bHandled );
HRESULT OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled );
protected:
CXuiList m_shaderlist;
CXuiControl m_back;
CXuiTextElement m_shaderpathtitle;
public:
HRESULT OnInit( XUIMessageInit* pInitData, int & bHandled );
HRESULT OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled );
XUI_BEGIN_MSG_MAP()
XUI_ON_XM_INIT( OnInit)
XUI_ON_XM_NOTIFY_PRESS( OnNotifyPress )
XUI_END_MSG_MAP();
XUI_BEGIN_MSG_MAP()
XUI_ON_XM_INIT( OnInit)
XUI_ON_XM_NOTIFY_PRESS( OnNotifyPress )
XUI_END_MSG_MAP();
XUI_IMPLEMENT_CLASS(CRetroArchShaderBrowser, L"RetroArchShaderBrowser", XUI_CLASS_SCENE)
XUI_IMPLEMENT_CLASS(CRetroArchShaderBrowser, L"RetroArchShaderBrowser", XUI_CLASS_SCENE)
};
class CRetroArchQuickMenu: public CXuiSceneImpl
{
protected:
CXuiList m_quickmenulist;
CXuiControl m_back;
public:
HRESULT OnInit( XUIMessageInit* pInitData, int & bHandled );
HRESULT OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled );
protected:
CXuiList m_quickmenulist;
CXuiControl m_back;
public:
HRESULT OnInit( XUIMessageInit* pInitData, int & bHandled );
HRESULT OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled );
HRESULT OnControlNavigate(XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled);
XUI_BEGIN_MSG_MAP()
XUI_ON_XM_INIT( OnInit)
XUI_ON_XM_NOTIFY_PRESS( OnNotifyPress )
XUI_END_MSG_MAP();
XUI_BEGIN_MSG_MAP()
XUI_ON_XM_INIT( OnInit)
XUI_ON_XM_CONTROL_NAVIGATE( OnControlNavigate )
XUI_ON_XM_NOTIFY_PRESS( OnNotifyPress )
XUI_END_MSG_MAP();
XUI_IMPLEMENT_CLASS(CRetroArchQuickMenu, L"RetroArchQuickMenu", XUI_CLASS_SCENE)
XUI_IMPLEMENT_CLASS(CRetroArchQuickMenu, L"RetroArchQuickMenu", XUI_CLASS_SCENE)
};
class CRetroArchSettings: public CXuiSceneImpl
{
protected:
CXuiList m_settingslist;
CXuiControl m_back;
public:
HRESULT OnInit( XUIMessageInit* pInitData, int & bHandled );
HRESULT OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled );
HRESULT OnControlNavigate(XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled);
protected:
CXuiList m_settingslist;
CXuiControl m_back;
public:
HRESULT OnInit( XUIMessageInit* pInitData, int & bHandled );
HRESULT OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled );
HRESULT OnControlNavigate(XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled);
XUI_BEGIN_MSG_MAP()
XUI_ON_XM_INIT( OnInit)
XUI_ON_XM_CONTROL_NAVIGATE( OnControlNavigate )
XUI_ON_XM_NOTIFY_PRESS( OnNotifyPress )
XUI_END_MSG_MAP();
XUI_BEGIN_MSG_MAP()
XUI_ON_XM_INIT( OnInit)
XUI_ON_XM_CONTROL_NAVIGATE( OnControlNavigate )
XUI_ON_XM_NOTIFY_PRESS( OnNotifyPress )
XUI_END_MSG_MAP();
XUI_IMPLEMENT_CLASS(CRetroArchSettings, L"RetroArchSettings", XUI_CLASS_SCENE)
XUI_IMPLEMENT_CLASS(CRetroArchSettings, L"RetroArchSettings", XUI_CLASS_SCENE)
};
class CRetroArchControls: public CXuiSceneImpl
{
protected:
CXuiList m_controlslist;
CXuiControl m_back;
CXuiSlider m_controlnoslider;
public:
HRESULT OnInit( XUIMessageInit* pInitData, int & bHandled );
HRESULT OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled );
HRESULT OnControlNavigate(XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled);
protected:
CXuiList m_controlslist;
CXuiControl m_back;
CXuiSlider m_controlnoslider;
public:
HRESULT OnInit( XUIMessageInit* pInitData, int & bHandled );
HRESULT OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled );
HRESULT OnControlNavigate(XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled);
XUI_BEGIN_MSG_MAP()
XUI_ON_XM_INIT( OnInit)
XUI_ON_XM_CONTROL_NAVIGATE( OnControlNavigate )
XUI_ON_XM_NOTIFY_PRESS( OnNotifyPress )
XUI_END_MSG_MAP();
XUI_BEGIN_MSG_MAP()
XUI_ON_XM_INIT( OnInit)
XUI_ON_XM_CONTROL_NAVIGATE( OnControlNavigate )
XUI_ON_XM_NOTIFY_PRESS( OnNotifyPress )
XUI_END_MSG_MAP();
XUI_IMPLEMENT_CLASS(CRetroArchControls, L"RetroArchControls", XUI_CLASS_SCENE)
XUI_IMPLEMENT_CLASS(CRetroArchControls, L"RetroArchControls", XUI_CLASS_SCENE)
};
int menu_init (void);

View File

@ -22,7 +22,6 @@
#include "../libretro.h"
#include "../console/console_ext.h"
#include "xdk360_input.h"
#include "shared.h"
#include "menu.h"
static uint64_t state[4];

View File

@ -14,7 +14,6 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
// Xbox 360-specific headers
#ifdef _XBOX
#include <xtl.h>
#include <xgraphics.h>
@ -32,82 +31,79 @@
#include "../console/console_ext.h"
#include "../general.h"
#include "../message.h"
#include "shared.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
static bool g_first_msg;
/* Xbox 360 specific code */
const DWORD g_MapLinearToSrgbGpuFormat[] =
{
GPUTEXTUREFORMAT_1_REVERSE,
GPUTEXTUREFORMAT_1,
GPUTEXTUREFORMAT_8,
GPUTEXTUREFORMAT_1_5_5_5,
GPUTEXTUREFORMAT_5_6_5,
GPUTEXTUREFORMAT_6_5_5,
GPUTEXTUREFORMAT_8_8_8_8_AS_16_16_16_16,
GPUTEXTUREFORMAT_2_10_10_10_AS_16_16_16_16,
GPUTEXTUREFORMAT_8_A,
GPUTEXTUREFORMAT_8_B,
GPUTEXTUREFORMAT_8_8,
GPUTEXTUREFORMAT_Cr_Y1_Cb_Y0_REP,
GPUTEXTUREFORMAT_Y1_Cr_Y0_Cb_REP,
GPUTEXTUREFORMAT_16_16_EDRAM,
GPUTEXTUREFORMAT_8_8_8_8_A,
GPUTEXTUREFORMAT_4_4_4_4,
GPUTEXTUREFORMAT_10_11_11_AS_16_16_16_16,
GPUTEXTUREFORMAT_11_11_10_AS_16_16_16_16,
GPUTEXTUREFORMAT_DXT1_AS_16_16_16_16,
GPUTEXTUREFORMAT_DXT2_3_AS_16_16_16_16,
GPUTEXTUREFORMAT_DXT4_5_AS_16_16_16_16,
GPUTEXTUREFORMAT_16_16_16_16_EDRAM,
GPUTEXTUREFORMAT_24_8,
GPUTEXTUREFORMAT_24_8_FLOAT,
GPUTEXTUREFORMAT_16,
GPUTEXTUREFORMAT_16_16,
GPUTEXTUREFORMAT_16_16_16_16,
GPUTEXTUREFORMAT_16_EXPAND,
GPUTEXTUREFORMAT_16_16_EXPAND,
GPUTEXTUREFORMAT_16_16_16_16_EXPAND,
GPUTEXTUREFORMAT_16_FLOAT,
GPUTEXTUREFORMAT_16_16_FLOAT,
GPUTEXTUREFORMAT_16_16_16_16_FLOAT,
GPUTEXTUREFORMAT_32,
GPUTEXTUREFORMAT_32_32,
GPUTEXTUREFORMAT_32_32_32_32,
GPUTEXTUREFORMAT_32_FLOAT,
GPUTEXTUREFORMAT_32_32_FLOAT,
GPUTEXTUREFORMAT_32_32_32_32_FLOAT,
GPUTEXTUREFORMAT_32_AS_8,
GPUTEXTUREFORMAT_32_AS_8_8,
GPUTEXTUREFORMAT_16_MPEG,
GPUTEXTUREFORMAT_16_16_MPEG,
GPUTEXTUREFORMAT_8_INTERLACED,
GPUTEXTUREFORMAT_32_AS_8_INTERLACED,
GPUTEXTUREFORMAT_32_AS_8_8_INTERLACED,
GPUTEXTUREFORMAT_16_INTERLACED,
GPUTEXTUREFORMAT_16_MPEG_INTERLACED,
GPUTEXTUREFORMAT_16_16_MPEG_INTERLACED,
GPUTEXTUREFORMAT_DXN,
GPUTEXTUREFORMAT_8_8_8_8_AS_16_16_16_16,
GPUTEXTUREFORMAT_DXT1_AS_16_16_16_16,
GPUTEXTUREFORMAT_DXT2_3_AS_16_16_16_16,
GPUTEXTUREFORMAT_DXT4_5_AS_16_16_16_16,
GPUTEXTUREFORMAT_2_10_10_10_AS_16_16_16_16,
GPUTEXTUREFORMAT_10_11_11_AS_16_16_16_16,
GPUTEXTUREFORMAT_11_11_10_AS_16_16_16_16,
GPUTEXTUREFORMAT_32_32_32_FLOAT,
GPUTEXTUREFORMAT_DXT3A,
GPUTEXTUREFORMAT_DXT5A,
GPUTEXTUREFORMAT_CTX1,
GPUTEXTUREFORMAT_DXT3A_AS_1_1_1_1,
GPUTEXTUREFORMAT_8_8_8_8_GAMMA_EDRAM,
GPUTEXTUREFORMAT_2_10_10_10_FLOAT_EDRAM,
GPUTEXTUREFORMAT_1_REVERSE,
GPUTEXTUREFORMAT_1,
GPUTEXTUREFORMAT_8,
GPUTEXTUREFORMAT_1_5_5_5,
GPUTEXTUREFORMAT_5_6_5,
GPUTEXTUREFORMAT_6_5_5,
GPUTEXTUREFORMAT_8_8_8_8_AS_16_16_16_16,
GPUTEXTUREFORMAT_2_10_10_10_AS_16_16_16_16,
GPUTEXTUREFORMAT_8_A,
GPUTEXTUREFORMAT_8_B,
GPUTEXTUREFORMAT_8_8,
GPUTEXTUREFORMAT_Cr_Y1_Cb_Y0_REP,
GPUTEXTUREFORMAT_Y1_Cr_Y0_Cb_REP,
GPUTEXTUREFORMAT_16_16_EDRAM,
GPUTEXTUREFORMAT_8_8_8_8_A,
GPUTEXTUREFORMAT_4_4_4_4,
GPUTEXTUREFORMAT_10_11_11_AS_16_16_16_16,
GPUTEXTUREFORMAT_11_11_10_AS_16_16_16_16,
GPUTEXTUREFORMAT_DXT1_AS_16_16_16_16,
GPUTEXTUREFORMAT_DXT2_3_AS_16_16_16_16,
GPUTEXTUREFORMAT_DXT4_5_AS_16_16_16_16,
GPUTEXTUREFORMAT_16_16_16_16_EDRAM,
GPUTEXTUREFORMAT_24_8,
GPUTEXTUREFORMAT_24_8_FLOAT,
GPUTEXTUREFORMAT_16,
GPUTEXTUREFORMAT_16_16,
GPUTEXTUREFORMAT_16_16_16_16,
GPUTEXTUREFORMAT_16_EXPAND,
GPUTEXTUREFORMAT_16_16_EXPAND,
GPUTEXTUREFORMAT_16_16_16_16_EXPAND,
GPUTEXTUREFORMAT_16_FLOAT,
GPUTEXTUREFORMAT_16_16_FLOAT,
GPUTEXTUREFORMAT_16_16_16_16_FLOAT,
GPUTEXTUREFORMAT_32,
GPUTEXTUREFORMAT_32_32,
GPUTEXTUREFORMAT_32_32_32_32,
GPUTEXTUREFORMAT_32_FLOAT,
GPUTEXTUREFORMAT_32_32_FLOAT,
GPUTEXTUREFORMAT_32_32_32_32_FLOAT,
GPUTEXTUREFORMAT_32_AS_8,
GPUTEXTUREFORMAT_32_AS_8_8,
GPUTEXTUREFORMAT_16_MPEG,
GPUTEXTUREFORMAT_16_16_MPEG,
GPUTEXTUREFORMAT_8_INTERLACED,
GPUTEXTUREFORMAT_32_AS_8_INTERLACED,
GPUTEXTUREFORMAT_32_AS_8_8_INTERLACED,
GPUTEXTUREFORMAT_16_INTERLACED,
GPUTEXTUREFORMAT_16_MPEG_INTERLACED,
GPUTEXTUREFORMAT_16_16_MPEG_INTERLACED,
GPUTEXTUREFORMAT_DXN,
GPUTEXTUREFORMAT_8_8_8_8_AS_16_16_16_16,
GPUTEXTUREFORMAT_DXT1_AS_16_16_16_16,
GPUTEXTUREFORMAT_DXT2_3_AS_16_16_16_16,
GPUTEXTUREFORMAT_DXT4_5_AS_16_16_16_16,
GPUTEXTUREFORMAT_2_10_10_10_AS_16_16_16_16,
GPUTEXTUREFORMAT_10_11_11_AS_16_16_16_16,
GPUTEXTUREFORMAT_11_11_10_AS_16_16_16_16,
GPUTEXTUREFORMAT_32_32_32_FLOAT,
GPUTEXTUREFORMAT_DXT3A,
GPUTEXTUREFORMAT_DXT5A,
GPUTEXTUREFORMAT_CTX1,
GPUTEXTUREFORMAT_DXT3A_AS_1_1_1_1,
GPUTEXTUREFORMAT_8_8_8_8_GAMMA_EDRAM,
GPUTEXTUREFORMAT_2_10_10_10_FLOAT_EDRAM,
};
struct XPR_HEADER
@ -151,100 +147,101 @@ void * PackedResource::GetData( const char * strName ) const
HRESULT PackedResource::Create( const char * strFilename )
{
unsigned long dwNumBytesRead;
HANDLE hFile = CreateFile( strFilename, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL );
if( hFile == INVALID_HANDLE_VALUE )
{
RARCH_ERR( "File <%s> not found.\n", strFilename );
return E_FAIL;
}
unsigned long dwNumBytesRead;
void * hFile = CreateFile( strFilename, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL );
// Read in and verify the XPR magic header
XPR_HEADER xprh;
if( !ReadFile( hFile, &xprh, sizeof( XPR_HEADER ), &dwNumBytesRead, NULL ) )
{
RARCH_ERR( "Error reading XPR header in file <%s>.\n", strFilename );
CloseHandle( hFile );
return E_FAIL;
}
if( hFile == INVALID_HANDLE_VALUE )
{
RARCH_ERR( "File <%s> not found.\n", strFilename );
return E_FAIL;
}
if( xprh.dwMagic != XPR2_MAGIC_VALUE )
{
RARCH_ERR( "Invalid Xbox Packed Resource (.xpr) file: Magic = 0x%08lx.\n", xprh.dwMagic );
CloseHandle( hFile );
return E_FAIL;
}
// Read in and verify the XPR magic header
XPR_HEADER xprh;
if( !ReadFile( hFile, &xprh, sizeof( XPR_HEADER ), &dwNumBytesRead, NULL ) )
{
RARCH_ERR( "Error reading XPR header in file <%s>.\n", strFilename );
CloseHandle( hFile );
return E_FAIL;
}
// Compute memory requirements
m_dwSysMemDataSize = xprh.dwHeaderSize;
m_dwVidMemDataSize = xprh.dwDataSize;
if( xprh.dwMagic != XPR2_MAGIC_VALUE )
{
RARCH_ERR( "Invalid Xbox Packed Resource (.xpr) file: Magic = 0x%08lx.\n", xprh.dwMagic );
CloseHandle( hFile );
return E_FAIL;
}
// Allocate memory
m_pSysMemData = (BYTE*)malloc(m_dwSysMemDataSize);
if( m_pSysMemData == NULL )
{
RARCH_ERR( "Could not allocate system memory.\n" );
m_dwSysMemDataSize = 0;
return E_FAIL;
}
m_pVidMemData = ( BYTE* )XMemAlloc( m_dwVidMemDataSize, MAKE_XALLOC_ATTRIBUTES( 0, 0, 0, 0, eXALLOCAllocatorId_GameMax,
XALLOC_PHYSICAL_ALIGNMENT_4K, XALLOC_MEMPROTECT_WRITECOMBINE, 0, XALLOC_MEMTYPE_PHYSICAL ) );
// Compute memory requirements
m_dwSysMemDataSize = xprh.dwHeaderSize;
m_dwVidMemDataSize = xprh.dwDataSize;
if( m_pVidMemData == NULL )
{
RARCH_ERR( "Could not allocate physical memory.\n" );
m_dwSysMemDataSize = 0;
m_dwVidMemDataSize = 0;
free(m_pSysMemData);
m_pSysMemData = NULL;
return E_FAIL;
}
// Allocate memory
m_pSysMemData = (unsigned char*)malloc(m_dwSysMemDataSize);
if( m_pSysMemData == NULL )
{
RARCH_ERR( "Could not allocate system memory.\n" );
m_dwSysMemDataSize = 0;
return E_FAIL;
}
m_pVidMemData = ( unsigned char* )XMemAlloc( m_dwVidMemDataSize, MAKE_XALLOC_ATTRIBUTES( 0, 0, 0, 0, eXALLOCAllocatorId_GameMax,
XALLOC_PHYSICAL_ALIGNMENT_4K, XALLOC_MEMPROTECT_WRITECOMBINE, 0, XALLOC_MEMTYPE_PHYSICAL ) );
// Read in the data from the file
if( !ReadFile( hFile, m_pSysMemData, m_dwSysMemDataSize, &dwNumBytesRead, NULL ) ||
!ReadFile( hFile, m_pVidMemData, m_dwVidMemDataSize, &dwNumBytesRead, NULL ) )
{
RARCH_ERR( "Unable to read Xbox Packed Resource (.xpr) file.\n" );
CloseHandle( hFile );
return E_FAIL;
}
if( m_pVidMemData == NULL )
{
RARCH_ERR( "Could not allocate physical memory.\n" );
m_dwSysMemDataSize = 0;
m_dwVidMemDataSize = 0;
free(m_pSysMemData);
m_pSysMemData = NULL;
return E_FAIL;
}
// Done with the file
CloseHandle( hFile );
// Read in the data from the file
if( !ReadFile( hFile, m_pSysMemData, m_dwSysMemDataSize, &dwNumBytesRead, NULL ) ||
!ReadFile( hFile, m_pVidMemData, m_dwVidMemDataSize, &dwNumBytesRead, NULL ) )
{
RARCH_ERR( "Unable to read Xbox Packed Resource (.xpr) file.\n" );
CloseHandle( hFile );
return E_FAIL;
}
// Extract resource table from the header data
m_dwNumResourceTags = *( unsigned long * )( m_pSysMemData + 0 );
m_pResourceTags = ( RESOURCE* )( m_pSysMemData + 4 );
// Done with the file
CloseHandle( hFile );
// Patch up the resources
for( unsigned long i = 0; i < m_dwNumResourceTags; i++ )
{
m_pResourceTags[i].strName = ( char * )( m_pSysMemData + ( unsigned long )m_pResourceTags[i].strName );
// Extract resource table from the header data
m_dwNumResourceTags = *( unsigned long * )( m_pSysMemData + 0 );
m_pResourceTags = ( RESOURCE* )( m_pSysMemData + 4 );
// Fixup the texture memory
if( ( m_pResourceTags[i].dwType & 0xffff0000 ) == ( RESOURCETYPE_TEXTURE & 0xffff0000 ) )
{
D3DTexture* pTexture = ( D3DTexture* )&m_pSysMemData[m_pResourceTags[i].dwOffset];
// Adjust Base address according to where memory was allocated
XGOffsetBaseTextureAddress( pTexture, m_pVidMemData, m_pVidMemData );
}
}
// Patch up the resources
for( unsigned long i = 0; i < m_dwNumResourceTags; i++ )
{
m_pResourceTags[i].strName = ( char * )( m_pSysMemData + ( unsigned long )m_pResourceTags[i].strName );
m_bInitialized = TRUE;
// Fixup the texture memory
if( ( m_pResourceTags[i].dwType & 0xffff0000 ) == ( RESOURCETYPE_TEXTURE & 0xffff0000 ) )
{
D3DTexture* pTexture = ( D3DTexture* )&m_pSysMemData[m_pResourceTags[i].dwOffset];
// Adjust Base address according to where memory was allocated
XGOffsetBaseTextureAddress( pTexture, m_pVidMemData, m_pVidMemData );
}
}
return S_OK;
m_bInitialized = TRUE;
return 0;
}
void PackedResource::Destroy()
{
delete[] m_pSysMemData;
free(m_pSysMemData);
m_pSysMemData = NULL;
m_dwSysMemDataSize = 0L;
if( m_pVidMemData != NULL )
XMemFree( m_pVidMemData, MAKE_XALLOC_ATTRIBUTES( 0, 0, 0, 0, eXALLOCAllocatorId_GameMax,
0, 0, 0, XALLOC_MEMTYPE_PHYSICAL ) );
XMemFree( m_pVidMemData, MAKE_XALLOC_ATTRIBUTES( 0, 0, 0, 0, eXALLOCAllocatorId_GameMax,
0, 0, 0, XALLOC_MEMTYPE_PHYSICAL ) );
m_pVidMemData = NULL;
m_dwVidMemDataSize = 0L;
@ -297,7 +294,7 @@ static void xdk360_set_viewport(bool force_full)
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
d3d9->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
0xff000000, 1.0f, 0);
0xff000000, 1.0f, 0);
int width = d3d9->video_mode.fIsHiDef ? 1280 : 640;
int height = d3d9->video_mode.fIsHiDef ? 720 : 480;
@ -321,7 +318,7 @@ static void xdk360_set_viewport(bool force_full)
// If the aspect ratios of screen and desired aspect ratio are sufficiently equal (floating point stuff),
if(g_console.aspect_ratio_index == ASPECT_RATIO_CUSTOM)
{
delta = (desired_aspect / device_aspect - 1.0) / 2.0 + 0.5;
delta = (desired_aspect / device_aspect - 1.0) / 2.0 + 0.5;
m_viewport_x_temp = g_console.viewports.custom_vp.x;
m_viewport_y_temp = g_console.viewports.custom_vp.y;
m_viewport_width_temp = g_console.viewports.custom_vp.width;
@ -370,7 +367,7 @@ static void xdk360_set_rotation(void * data, unsigned orientation)
{
case ORIENTATION_NORMAL:
angle = M_PI * 0 / 180;
break;
break;
case ORIENTATION_VERTICAL:
angle = M_PI * 270 / 180;
break;
@ -390,15 +387,15 @@ static void xdk360_set_rotation(void * data, unsigned orientation)
static void xdk360_convert_texture_to_as16_srgb( D3DTexture *pTexture )
{
pTexture->Format.SignX = GPUSIGN_GAMMA;
pTexture->Format.SignY = GPUSIGN_GAMMA;
pTexture->Format.SignZ = GPUSIGN_GAMMA;
pTexture->Format.SignX = GPUSIGN_GAMMA;
pTexture->Format.SignY = GPUSIGN_GAMMA;
pTexture->Format.SignZ = GPUSIGN_GAMMA;
XGTEXTURE_DESC desc;
XGGetTextureDesc( pTexture, 0, &desc );
XGTEXTURE_DESC desc;
XGGetTextureDesc( pTexture, 0, &desc );
//convert to AS_16_16_16_16 format
pTexture->Format.DataFormat = g_MapLinearToSrgbGpuFormat[ (desc.Format & D3DFORMAT_TEXTUREFORMAT_MASK) >> D3DFORMAT_TEXTUREFORMAT_SHIFT ];
//convert to AS_16_16_16_16 format
pTexture->Format.DataFormat = g_MapLinearToSrgbGpuFormat[ (desc.Format & D3DFORMAT_TEXTUREFORMAT_MASK) >> D3DFORMAT_TEXTUREFORMAT_SHIFT ];
}
static void xdk360_init_fbo(xdk360_video_t *d3d9)
@ -456,9 +453,12 @@ static void *xdk360_init(const video_info_t *video, const input_driver_t **input
// unsupported
if(!d3d9->video_mode.fIsWideScreen)
d3d9->d3dpp.Flags |= D3DPRESENTFLAG_NO_LETTERBOX;
g_console.menus_hd_enable = d3d9->video_mode.fIsHiDef;
d3d9->d3dpp.BackBufferWidth = d3d9->video_mode.fIsHiDef ? 1280 : 640;
d3d9->d3dpp.BackBufferHeight = d3d9->video_mode.fIsHiDef ? 720 : 480;
if(g_console.gamma_correction_enable)
{
d3d9->d3dpp.BackBufferFormat = g_console.color_format ? (D3DFORMAT)MAKESRGBFMT(D3DFMT_A8R8G8B8) : (D3DFORMAT)MAKESRGBFMT(D3DFMT_LIN_A1R5G5B5);
@ -646,7 +646,7 @@ static bool xdk360_frame(void *data, const void *frame,
if(d3d9->fbo_enabled)
{
d3d9->d3d_render_device->Resolve(D3DRESOLVE_RENDERTARGET0, NULL, d3d9->lpTexture_ot,
NULL, 0, 0, NULL, 0, 0, NULL);
NULL, 0, 0, NULL, 0, 0, NULL);
d3d9->d3d_render_device->SetRenderTarget(0, pRenderTarget0);
pRenderTarget0->Release();
@ -669,10 +669,9 @@ static bool xdk360_frame(void *data, const void *frame,
/* XBox 360 specific font code */
if (msg && !menu_enabled)
{
if(IS_TIMER_EXPIRED(d3d9) || g_first_msg)
if(IS_TIMER_EXPIRED(d3d9))
{
xdk360_console_format(msg);
g_first_msg = 0;
SET_TIMER_EXPIRATION(d3d9, 30);
}
@ -709,11 +708,6 @@ static bool xdk360_focus(void *data)
return gfx_ctx_window_has_focus();
}
// 360 needs a working graphics stack before RetroArch even starts.
// To deal with this main.c,
// the top level module owns the instance, and is created beforehand.
// When RetroArch gets around to init it, it is already allocated.
// When RetroArch wants to free it, it is ignored.
static void xdk360_start(void)
{
video_info_t video_info = {0};
@ -730,13 +724,11 @@ static void xdk360_start(void)
gfx_ctx_set_swap_interval(d3d9->vsync ? 1 : 0, false);
g_first_msg = true;
/* XBox 360 specific font code */
HRESULT hr = xdk360_console_init("game:\\media\\Arial_12.xpr",
0xff000000, 0xffffffff );
if(FAILED(hr))
if(hr < 0)
{
RARCH_ERR("Couldn't create debug console.\n");
}

View File

@ -64,6 +64,4 @@ typedef struct xdk360_video
LPDIRECT3DSURFACE9 lpSurface;
} xdk360_video_t;
void xdk360_gfx_init_fbo(xdk360_video_t *vid);
#endif

View File

@ -19,11 +19,6 @@
#ifndef RARCH_360_RESOURCES_H
#define RARCH_360_RESOURCES_H
//--------------------------------------------------------------------------------------
// Name tag for resources. An app may initialize this structure, and pass
// it to the resource's Create() function. From then on, the app may call
// GetResource() to retrieve a resource using an ascii name.
//--------------------------------------------------------------------------------------
struct RESOURCE
{
unsigned long dwType;
@ -50,73 +45,74 @@ enum
//--------------------------------------------------------------------------------------
class PackedResource
{
protected:
unsigned char * m_pSysMemData; // Alloc'ed memory for resource headers etc.
unsigned long m_dwSysMemDataSize;
protected:
unsigned char * m_pSysMemData; // Alloc'ed memory for resource headers etc.
unsigned long m_dwSysMemDataSize;
unsigned char * m_pVidMemData; // Alloc'ed memory for resource data, etc.
unsigned long m_dwVidMemDataSize;
unsigned char * m_pVidMemData; // Alloc'ed memory for resource data, etc.
unsigned long m_dwVidMemDataSize;
RESOURCE* m_pResourceTags; // Tags to associate names with the resources
unsigned long m_dwNumResourceTags; // Number of resource tags
public:
int m_bInitialized; // Resource is fully initialized
HRESULT Create( const char * strFilename );
void Destroy();
D3DResource* RegisterResource( D3DResource* pResource ) const
{
return pResource;
}
RESOURCE* m_pResourceTags; // Tags to associate names with the resources
unsigned long m_dwNumResourceTags; // Number of resource tags
public:
int m_bInitialized; // Resource is fully initialized
HRESULT Create( const char * strFilename );
void Destroy();
void * GetData( unsigned long dwOffset ) const
{
return &m_pSysMemData[dwOffset];
}
D3DResource* RegisterResource( D3DResource* pResource ) const
{
return pResource;
}
D3DResource* GetResource( unsigned long dwOffset ) const
{
return (( D3DResource* )GetData( dwOffset ) );
}
void * GetData( unsigned long dwOffset ) const
{
return &m_pSysMemData[dwOffset];
}
D3DTexture* GetTexture( unsigned long dwOffset ) const
{
return ( D3DTexture* )GetResource( dwOffset );
}
D3DResource* GetResource( unsigned long dwOffset ) const
{
return (( D3DResource* )GetData( dwOffset ) );
}
D3DArrayTexture* GetArrayTexture( unsigned long dwOffset ) const
{
return ( D3DArrayTexture* )GetResource( dwOffset );
}
D3DTexture* GetTexture( unsigned long dwOffset ) const
{
return ( D3DTexture* )GetResource( dwOffset );
}
D3DVertexBuffer* GetVertexBuffer( unsigned long dwOffset ) const
{
return ( D3DVertexBuffer* )GetResource( dwOffset );
}
D3DArrayTexture* GetArrayTexture( unsigned long dwOffset ) const
{
return ( D3DArrayTexture* )GetResource( dwOffset );
}
void * GetData( const char * strName ) const;
D3DVertexBuffer* GetVertexBuffer( unsigned long dwOffset ) const
{
return ( D3DVertexBuffer* )GetResource( dwOffset );
}
D3DResource* GetResource( const char * strName ) const
{
return ( ( D3DResource* )GetData( strName ) );
}
void * GetData( const char * strName ) const;
D3DTexture* GetTexture( const char * strName ) const
{
return ( D3DTexture* )GetResource( strName );
}
D3DResource* GetResource( const char * strName ) const
{
return ( ( D3DResource* )GetData( strName ) );
}
D3DArrayTexture* GetArrayTexture( const char * strName ) const
{
return ( D3DArrayTexture* )GetResource( strName );
}
D3DTexture* GetTexture( const char * strName ) const
{
return ( D3DTexture* )GetResource( strName );
}
D3DVertexBuffer* GetVertexBuffer( const char * strName ) const
{
return ( D3DVertexBuffer* )GetResource( strName );
}
D3DArrayTexture* GetArrayTexture( const char * strName ) const
{
return ( D3DArrayTexture* )GetResource( strName );
}
PackedResource();
~PackedResource();
D3DVertexBuffer* GetVertexBuffer( const char * strName ) const
{
return ( D3DVertexBuffer* )GetResource( strName );
}
PackedResource();
~PackedResource();
};
#endif

View File

@ -68,7 +68,7 @@ endif
PPU_LDLIBS = -ldbgfont $(GL_LIBS) -lretro -lcgc -lgcm_cmd -lgcm_sys_stub -lresc_stub -lm -lio_stub -lfs_stub -lsysutil_stub -lsysutil_game_stub -lsysutil_screenshot_stub -lsysutil_np_stub -lpngdec_stub -ljpgdec_stub -lsysmodule_stub -laudio_stub -lnet_stub -lnetctl_stub -lpthread
DEFINES += -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OPENGL_TEXREF -DHAVE_VID_CONTEXT -DHAVE_OPENGLES -DHAVE_CG -DHAVE_CG_MENU -DHAVE_FILEBROWSER -DHAVE_FBO -DHAVE_RARCH_MAIN_WRAP -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_RGL -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RSOUND -DHAVE_ZLIB -D__CELLOS_LV2__ -DHAVE_CONFIGFILE=1 -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_GRIFFIN=1 -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -Dmain=rarch_main -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
DEFINES += -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OPENGL_TEXREF -DHAVE_HEADSET -DHAVE_VID_CONTEXT -DHAVE_OPENGLES -DHAVE_CG -DHAVE_CG_MENU -DHAVE_FILEBROWSER -DHAVE_FBO -DHAVE_RARCH_MAIN_WRAP -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_RGL -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RSOUND -DHAVE_ZLIB -D__CELLOS_LV2__ -DHAVE_CONFIGFILE=1 -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=1 -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -Dmain=rarch_main -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
ifeq ($(DEBUG), 1)
PPU_OPTIMIZE_LV := -O0 -g

View File

@ -27,6 +27,11 @@
#include "console_ext.h"
#include "../file.h"
#ifdef HAVE_CONFIGFILE
#include "../conf/config_file.h"
#include "../conf/config_file_macros.h"
#endif
#ifdef HAVE_ZLIB
#include "rzlib/zlib.h"
#define WRITEBUFFERSIZE (1024 * 512)
@ -195,8 +200,8 @@ int rarch_extract_zipfile(const char *zip_path)
}
}
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, "INFO - ZIP file extracted to cache partition.", 1, 180);
if(g_console.info_msg_enable)
rarch_settings_msg(S_MSG_EXTRACTED_ZIPFILE, S_DELAY_180);
return 0;
}
@ -490,6 +495,14 @@ struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END] = {
{ "Custom", 0.0f }
};
char rotation_lut[ASPECT_RATIO_END][PATH_MAX] =
{
"Normal",
"Vertical",
"Flipped",
"Flipped Rotated"
};
void rarch_set_auto_viewport(unsigned width, unsigned height)
{
if(width == 0 || height == 0)
@ -512,100 +525,6 @@ void rarch_set_auto_viewport(unsigned width, unsigned height)
aspectratio_lut[ASPECT_RATIO_AUTO].value = (int)aspect_x / (int)aspect_y;
}
/*============================================================
LIBRETRO
============================================================ */
#ifdef HAVE_LIBRETRO_MANAGEMENT
bool rarch_manage_libretro_core(const char *full_path, const char *path, const char *exe_ext)
{
g_extern.verbose = true;
bool return_code;
bool set_libretro_path = false;
char tmp_path2[1024], tmp_pathnewfile[1024];
RARCH_LOG("Assumed path of CORE executable: [%s]\n", full_path);
if (path_file_exists(full_path))
{
// if CORE executable exists, this means we have just installed
// a new libretro port and therefore we need to change it to a more
// sane name.
#if defined(__CELLOS_LV2__)
CellFsErrno ret;
#else
int ret;
#endif
rarch_console_name_from_id(tmp_path2, sizeof(tmp_path2));
strlcat(tmp_path2, exe_ext, sizeof(tmp_path2));
snprintf(tmp_pathnewfile, sizeof(tmp_pathnewfile), "%s%s", path, tmp_path2);
if (path_file_exists(tmp_pathnewfile))
{
// if libretro core already exists, this means we are
// upgrading the libretro core - so delete pre-existing
// file first.
RARCH_LOG("Upgrading emulator core...\n");
#if defined(__CELLOS_LV2__)
ret = cellFsUnlink(tmp_pathnewfile);
if (ret == CELL_FS_SUCCEEDED)
#elif defined(_XBOX)
ret = DeleteFile(tmp_pathnewfile);
if (ret != 0)
#endif
{
RARCH_LOG("Succeeded in removing pre-existing libretro core: [%s].\n", tmp_pathnewfile);
}
else
RARCH_LOG("Failed to remove pre-existing libretro core: [%s].\n", tmp_pathnewfile);
}
//now attempt the renaming.
#if defined(__CELLOS_LV2__)
ret = cellFsRename(full_path, tmp_pathnewfile);
if (ret != CELL_FS_SUCCEEDED)
#elif defined(_XBOX)
ret = MoveFileExA(full_path, tmp_pathnewfile, NULL);
if (ret == 0)
#endif
{
RARCH_ERR("Failed to rename CORE executable.\n");
}
else
{
RARCH_LOG("Libsnes core [%s] renamed to: [%s].\n", full_path, tmp_pathnewfile);
set_libretro_path = true;
}
}
else
{
RARCH_LOG("CORE executable was not found, libretro core path will be loaded from config file.\n");
}
if (set_libretro_path)
{
// CORE executable has been renamed, libretro path will now be set to the recently
// renamed new libretro core.
strlcpy(g_settings.libretro, tmp_pathnewfile, sizeof(g_settings.libretro));
return_code = 0;
}
else
{
// There was no CORE executable present, or the CORE executable file was not renamed.
// The libretro core path will still be loaded from the config file.
return_code = 1;
}
g_extern.verbose = false;
return return_code;
}
#endif
/*============================================================
RetroArch MAIN WRAP
============================================================ */
@ -774,12 +693,12 @@ void rarch_console_rsound_stop(void)
============================================================ */
#ifdef _XBOX
wchar_t * rarch_convert_char_to_wchar(const char * str)
void rarch_convert_char_to_wchar(wchar_t *buf, const char * str, size_t size)
{
unsigned long dwNum = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
wchar_t * w_str = new wchar_t[dwNum];
MultiByteToWideChar(CP_ACP, 0, str, -1, w_str, dwNum);
return w_str;
size /= sizeof(wchar_t);
rarch_assert(size >= dwNum);
MultiByteToWideChar(CP_ACP, 0, str, -1, buf, dwNum);
}
#endif
@ -789,3 +708,173 @@ const char * rarch_convert_wchar_to_const_char(const wchar_t * wstr)
wcstombs(str, wstr, sizeof(str));
return str;
}
/*============================================================
CONFIG
============================================================ */
#ifdef HAVE_CONFIGFILE
void rarch_config_create_default(const char * conf_name)
{
FILE * f;
RARCH_WARN("Config file \"%s\" doesn't exist. Creating...\n", conf_name);
f = fopen(conf_name, "w");
fclose(f);
}
void rarch_config_load(const char * conf_name, const char * libretro_dir_path, const char * exe_ext, bool find_libretro_path)
{
if(!path_file_exists(conf_name))
rarch_config_create_default(conf_name);
else
{
config_file_t * conf = config_file_new(conf_name);
// g_settings
#ifdef HAVE_LIBRETRO_MANAGEMENT
if(find_libretro_path)
{
CONFIG_GET_STRING(libretro, "libretro_path");
if(!strcmp(g_settings.libretro, ""))
{
const char *first_file = rarch_manage_libretro_set_first_file(libretro_dir_path, exe_ext);
if(first_file != NULL)
strlcpy(g_settings.libretro, first_file, sizeof(g_settings.libretro));
}
}
#endif
CONFIG_GET_STRING(cheat_database, "cheat_database");
CONFIG_GET_BOOL(rewind_enable, "rewind_enable");
CONFIG_GET_STRING(video.cg_shader_path, "video_cg_shader");
#ifdef HAVE_FBO
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");
#endif
#ifdef _XBOX
CONFIG_GET_BOOL_CONSOLE(gamma_correction_enable, "gamma_correction_enable");
CONFIG_GET_INT_CONSOLE(color_format, "color_format");
#endif
CONFIG_GET_BOOL(video.smooth, "video_smooth");
CONFIG_GET_BOOL(video.vsync, "video_vsync");
CONFIG_GET_FLOAT(video.aspect_ratio, "video_aspect_ratio");
CONFIG_GET_STRING(audio.device, "audio_device");
for (unsigned i = 0; i < 7; i++)
{
char cfg[64];
snprintf(cfg, sizeof(cfg), "input_dpad_emulation_p%u", i + 1);
CONFIG_GET_INT(input.dpad_emulation[i], cfg);
}
// g_console
#ifdef HAVE_FBO
CONFIG_GET_BOOL_CONSOLE(fbo_enabled, "fbo_enabled");
#endif
#ifdef __CELLOS_LV2__
CONFIG_GET_BOOL_CONSOLE(custom_bgm_enable, "custom_bgm_enable");
#endif
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_BOOL_CONSOLE(info_msg_enable, "info_msg_enable");
CONFIG_GET_INT_CONSOLE(aspect_ratio_index, "aspect_ratio_index");
CONFIG_GET_INT_CONSOLE(current_resolution_id, "current_resolution_id");
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");
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");
}
}
void rarch_config_save(const char * conf_name)
{
if(!path_file_exists(conf_name))
rarch_config_create_default(conf_name);
else
{
config_file_t * conf = config_file_new(conf_name);
if(conf == NULL)
conf = config_file_new(NULL);
// g_settings
config_set_string(conf, "libretro_path", g_settings.libretro);
#ifdef HAVE_XML
config_set_string(conf, "cheat_database_path", g_settings.cheat_database);
#endif
config_set_bool(conf, "rewind_enable", g_settings.rewind_enable);
config_set_string(conf, "video_cg_shader", g_settings.video.cg_shader_path);
config_set_float(conf, "video_aspect_ratio", g_settings.video.aspect_ratio);
#ifdef HAVE_FBO
config_set_float(conf, "video_fbo_scale_x", g_settings.video.fbo_scale_x);
config_set_float(conf, "video_fbo_scale_y", g_settings.video.fbo_scale_y);
config_set_string(conf, "video_second_pass_shader", g_settings.video.second_pass_shader);
config_set_bool(conf, "video_render_to_texture", g_settings.video.render_to_texture);
config_set_bool(conf, "video_second_pass_smooth", g_settings.video.second_pass_smooth);
#endif
config_set_bool(conf, "video_smooth", g_settings.video.smooth);
config_set_bool(conf, "video_vsync", g_settings.video.vsync);
config_set_string(conf, "audio_device", g_settings.audio.device);
for (unsigned i = 0; i < 7; i++)
{
char cfg[64];
snprintf(cfg, sizeof(cfg), "input_dpad_emulation_p%u", i + 1);
config_set_int(conf, cfg, g_settings.input.dpad_emulation[i]);
}
#ifdef RARCH_CONSOLE
config_set_bool(conf, "fbo_enabled", g_console.fbo_enabled);
#ifdef __CELLOS_LV2__
config_set_bool(conf, "custom_bgm_enable", g_console.custom_bgm_enable);
#endif
config_set_bool(conf, "overscan_enable", g_console.overscan_enable);
config_set_bool(conf, "screenshots_enable", g_console.screenshots_enable);
#ifdef _XBOX
config_set_bool(conf, "gamma_correction_enable", g_console.gamma_correction_enable);
config_set_int(conf, "color_format", g_console.color_format);
#endif
config_set_bool(conf, "throttle_enable", g_console.throttle_enable);
config_set_bool(conf, "triple_buffering_enable", g_console.triple_buffering_enable);
config_set_bool(conf, "info_msg_enable", g_console.info_msg_enable);
config_set_int(conf, "sound_mode", g_console.sound_mode);
config_set_int(conf, "aspect_ratio_index", g_console.aspect_ratio_index);
config_set_int(conf, "current_resolution_id", g_console.current_resolution_id);
config_set_int(conf, "custom_viewport_width", g_console.viewports.custom_vp.width);
config_set_int(conf, "custom_viewport_height", g_console.viewports.custom_vp.height);
config_set_int(conf, "custom_viewport_x", g_console.viewports.custom_vp.x);
config_set_int(conf, "custom_viewport_y", g_console.viewports.custom_vp.y);
config_set_int(conf, "screen_orientation", g_console.screen_orientation);
config_set_string(conf, "default_rom_startup_dir", g_console.default_rom_startup_dir);
config_set_float(conf, "menu_font_size", g_console.menu_font_size);
config_set_float(conf, "overscan_amount", g_console.overscan_amount);
#endif
// g_extern
config_set_int(conf, "state_slot", g_extern.state_slot);
config_set_int(conf, "audio_mute", g_extern.audio_data.mute);
if (!config_file_write(conf, conf_name))
RARCH_ERR("Failed to write config file to \"%s\". Check permissions.\n", conf_name);
free(conf);
}
}
#endif

View File

@ -17,10 +17,20 @@
#ifndef CONSOLE_EXT_H__
#define CONSOLE_EXT_H__
#ifdef HAVE_LIBRETRO_MANAGEMENT
#include "libretro_mgmt.h"
#endif
#include "console_settings.h"
#define IS_TIMER_NOT_EXPIRED(handle) (handle->frame_count < g_console.timer_expiration_frame_count)
#define IS_TIMER_EXPIRED(handle) (!(IS_TIMER_NOT_EXPIRED(handle)))
#define SET_TIMER_EXPIRATION(handle, value) (g_console.timer_expiration_frame_count = handle->frame_count + value)
/*============================================================
VIDEO
============================================================ */
enum aspect_ratio
{
ASPECT_RATIO_1_1 = 0,
@ -59,6 +69,24 @@ enum rotation
ORIENTATION_END
};
#define LAST_ORIENTATION (ORIENTATION_END-1)
extern char rotation_lut[ASPECT_RATIO_END][PATH_MAX];
/* ABGR color format defines */
#define WHITE 0xffffffffu
#define RED 0xff0000ffu
#define GREEN 0xff00ff00u
#define BLUE 0xffff0000u
#define YELLOW 0xff00ffffu
#define PURPLE 0xffff00ffu
#define CYAN 0xffffff00u
#define ORANGE 0xff0063ffu
#define SILVER 0xff8c848cu
#define LIGHTBLUE 0xFFFFE0E0U
#define LIGHTORANGE 0xFFE0EEFFu
struct aspect_ratio_elem
{
char name[64];
@ -71,6 +99,21 @@ extern void rarch_set_auto_viewport(unsigned width, unsigned height);
#include "console_ext_input.h"
/*============================================================
SOUND
============================================================ */
enum
{
SOUND_MODE_NORMAL,
#ifdef HAVE_RSOUND
SOUND_MODE_RSOUND,
#endif
#ifdef HAVE_HEADSET
SOUND_MODE_HEADSET,
#endif
};
/*============================================================
ROM EXTENSIONS
============================================================ */
@ -100,14 +143,35 @@ void rarch_input_set_default_keybind_names_for_emulator(void);
void rarch_input_set_keybind(unsigned player, unsigned keybind_action, uint64_t default_retro_joypad_id);
#ifdef HAVE_LIBRETRO_MANAGEMENT
bool rarch_manage_libretro_core(const char *full_path, const char *path, const char *exe_ext);
#endif
/*============================================================
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_MAIN_WRAP
struct rarch_main_wrap
@ -133,10 +197,13 @@ void rarch_console_rsound_stop(void);
#endif
#ifdef _XBOX
wchar_t * rarch_convert_char_to_wchar(const char * str);
void rarch_convert_char_to_wchar(wchar_t *buf, const char * str, size_t size);
#endif
const char * rarch_convert_wchar_to_const_char(const wchar_t * wstr);
void rarch_config_create_default(const char * conf_name);
void rarch_config_load(const char * conf_name, const char * libretro_dir_path, const char * exe_ext, bool find_libretro_path);
void rarch_config_save(const char * conf_name);
#endif

253
console/console_settings.c Normal file
View File

@ -0,0 +1,253 @@
/* 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 <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include "../general.h"
#include "console_settings.h"
void rarch_settings_change(unsigned setting)
{
switch(setting)
{
case S_ASPECT_RATIO_DECREMENT:
if(g_console.aspect_ratio_index > 0)
g_console.aspect_ratio_index--;
break;
case S_ASPECT_RATIO_INCREMENT:
if(g_console.aspect_ratio_index < LAST_ASPECT_RATIO)
g_console.aspect_ratio_index++;
break;
case S_FRAME_ADVANCE:
g_console.frame_advance_enable = true;
g_console.menu_enable = false;
g_console.mode_switch = MODE_EMULATION;
break;
case S_HW_TEXTURE_FILTER:
g_settings.video.smooth = !g_settings.video.smooth;
break;
case S_HW_TEXTURE_FILTER_2:
g_settings.video.second_pass_smooth = !g_settings.video.second_pass_smooth;
break;
case S_OVERSCAN_DECREMENT:
g_console.overscan_amount -= 0.01f;
g_console.overscan_enable = true;
if(g_console.overscan_amount == 0.0f)
g_console.overscan_enable = false;
break;
case S_OVERSCAN_INCREMENT:
g_console.overscan_amount += 0.01f;
g_console.overscan_enable = true;
if(g_console.overscan_amount == 0.0f)
g_console.overscan_enable = 0;
break;
case S_QUIT:
g_console.menu_enable = false;
g_console.ingame_menu_enable = false;
g_console.mode_switch = MODE_EXIT;
break;
case S_RETURN_TO_DASHBOARD:
g_console.menu_enable = false;
g_console.initialize_rarch_enable = false;
g_console.mode_switch = MODE_EXIT;
break;
case S_RETURN_TO_GAME:
g_console.frame_advance_enable = false;
//g_console.ingame_menu_item = 0;
g_console.menu_enable = false;
g_console.mode_switch = MODE_EMULATION;
break;
case S_RETURN_TO_LAUNCHER:
g_console.return_to_launcher = true;
g_console.menu_enable = false;
g_console.mode_switch = MODE_EXIT;
break;
case S_RETURN_TO_MENU:
g_console.menu_enable = false;
g_console.ingame_menu_item = 0;
g_console.mode_switch = MODE_MENU;
break;
case S_ROTATION_DECREMENT:
if(g_console.screen_orientation > 0)
g_console.screen_orientation--;
break;
case S_ROTATION_INCREMENT:
if(g_console.screen_orientation < LAST_ORIENTATION)
g_console.screen_orientation++;
break;
case S_START_RARCH:
g_console.menu_enable = false;
g_console.initialize_rarch_enable = 1;
g_console.mode_switch = MODE_EMULATION;
break;
case S_REWIND:
g_settings.rewind_enable = !g_settings.rewind_enable;
break;
case S_SAVESTATE_DECREMENT:
if(g_extern.state_slot != 0)
g_extern.state_slot--;
break;
case S_SAVESTATE_INCREMENT:
g_extern.state_slot++;
break;
case S_SCALE_ENABLED:
g_console.fbo_enabled = !g_console.fbo_enabled;
break;
case S_SCALE_FACTOR_DECREMENT:
g_settings.video.fbo_scale_x -= 1.0f;
g_settings.video.fbo_scale_y -= 1.0f;
break;
case S_SCALE_FACTOR_INCREMENT:
g_settings.video.fbo_scale_x += 1.0f;
g_settings.video.fbo_scale_y += 1.0f;
break;
case S_THROTTLE:
g_console.throttle_enable = !g_console.throttle_enable;
break;
case S_TRIPLE_BUFFERING:
g_console.triple_buffering_enable = !g_console.triple_buffering_enable;
break;
}
}
void rarch_settings_default(unsigned setting)
{
switch(setting)
{
case S_DEF_ASPECT_RATIO:
g_console.aspect_ratio_index = ASPECT_RATIO_4_3;
break;
case S_DEF_HW_TEXTURE_FILTER:
g_settings.video.smooth = 1;
break;
case S_DEF_HW_TEXTURE_FILTER_2:
g_settings.video.second_pass_smooth = 1;
break;
case S_DEF_OVERSCAN:
g_console.overscan_amount = 0.0f;
g_console.overscan_enable = false;
break;
case S_DEF_ROTATION:
g_console.screen_orientation = ORIENTATION_NORMAL;
break;
case S_DEF_THROTTLE:
g_console.throttle_enable = true;
break;
case S_DEF_TRIPLE_BUFFERING:
g_console.triple_buffering_enable = true;
break;
case S_DEF_SAVE_STATE:
g_extern.state_slot = 0;
break;
case S_DEF_SCALE_ENABLED:
g_console.fbo_enabled = true;
g_settings.video.fbo_scale_x = 2.0f;
g_settings.video.fbo_scale_y = 2.0f;
break;
case S_DEF_SCALE_FACTOR:
g_settings.video.fbo_scale_x = 2.0f;
g_settings.video.fbo_scale_y = 2.0f;
break;
}
}
void rarch_settings_msg(unsigned setting, unsigned delay)
{
char str[PATH_MAX];
msg_queue_clear(g_extern.msg_queue);
switch(setting)
{
case S_MSG_CACHE_PARTITION:
snprintf(str, sizeof(str), "INFO - All the contents of the ZIP files you have selected in the filebrowser\nare extracted to this partition.");
break;
case S_MSG_CHANGE_CONTROLS:
snprintf(str, sizeof(str), "INFO - Press LEFT/RIGHT to change the controls, and press\n[RetroPad Start] to reset a button to default values.");
break;
case S_MSG_EXTRACTED_ZIPFILE:
snprintf(str, sizeof(str), "INFO - ZIP file successfully extracted to cache partition.");
break;
case S_MSG_NOT_IMPLEMENTED:
snprintf(str, sizeof(str), "TODO - Not yet implemented.");
break;
case S_MSG_RESIZE_SCREEN:
snprintf(str, sizeof(str), "INFO - Resize the screen by moving around the two analog sticks.\nPress [RetroPad X] to reset to default values, and [RetroPad A] to go back.\nTo select the resized screen mode, set Aspect Ratio to: 'Custom'.");
break;
case S_MSG_RESTART_RARCH:
snprintf(str, sizeof(str), "INFO - You need to restart RetroArch for this change to take effect.");
break;
case S_MSG_SELECT_LIBRETRO_CORE:
snprintf(str, sizeof(str), "INFO - Select a Libretro core from the menu by pressing [RetroPad B].");
break;
case S_MSG_SELECT_SHADER:
snprintf(str, sizeof(str), "INFO - Select a shader from the menu by pressing [RetroPad A].");
break;
case S_MSG_SHADER_LOADING_SUCCEEDED:
snprintf(str, sizeof(str), "INFO - Shader successfully loaded.");
break;
}
msg_queue_push(g_extern.msg_queue, str, 1, delay);
}
#ifdef _XBOX
void rarch_settings_create_menu_item_label(wchar_t * strwbuf, unsigned setting, size_t size)
#else
void rarch_settings_create_menu_item_label(char * str, unsigned setting, size_t size)
#endif
{
#ifdef _XBOX
char str[PATH_MAX];
size_t SIZEOF_STR = sizeof(str);
#else
size_t SIZEOF_STR = size;
#endif
switch (setting)
{
case S_LBL_ASPECT_RATIO:
snprintf(str, SIZEOF_STR, "Aspect Ratio: %s", aspectratio_lut[g_console.aspect_ratio_index].name);
break;
case S_LBL_SHADER:
snprintf(str, SIZEOF_STR, "Shader #1: %s", g_settings.video.cg_shader_path);
break;
case S_LBL_SHADER_2:
snprintf(str, SIZEOF_STR, "Shader #2: %s", g_settings.video.second_pass_shader);
break;
case S_LBL_RARCH_VERSION:
snprintf(str, SIZEOF_STR, "RetroArch %s", PACKAGE_VERSION);
break;
case S_LBL_SCALE_FACTOR:
snprintf(str, SIZEOF_STR, "Scale Factor: %f (X) / %f (Y)", g_settings.video.fbo_scale_x, g_settings.video.fbo_scale_y);
break;
case S_LBL_ROTATION:
snprintf(str, SIZEOF_STR, "Rotation: %s", rotation_lut[g_console.screen_orientation]);
break;
case S_LBL_LOAD_STATE_SLOT:
snprintf(str, SIZEOF_STR, "Load State #%d", g_extern.state_slot);
break;
case S_LBL_SAVE_STATE_SLOT:
snprintf(str, SIZEOF_STR, "Save State #%d", g_extern.state_slot);
break;
}
#ifdef _XBOX
rarch_convert_char_to_wchar(strwbuf, str, size);
#endif
}

102
console/console_settings.h Normal file
View File

@ -0,0 +1,102 @@
/* 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 CONSOLE_SETTINGS_H
#define CONSOLE_SETTINGS_H
enum
{
S_DELAY_180 = 180,
S_DELAY_270 = 270
};
enum
{
S_ASPECT_RATIO_DECREMENT = 0,
S_ASPECT_RATIO_INCREMENT,
S_FRAME_ADVANCE,
S_HW_TEXTURE_FILTER,
S_HW_TEXTURE_FILTER_2,
S_OVERSCAN_DECREMENT,
S_OVERSCAN_INCREMENT,
S_QUIT,
S_RETURN_TO_DASHBOARD,
S_RETURN_TO_GAME,
S_RETURN_TO_LAUNCHER,
S_RETURN_TO_MENU,
S_ROTATION_DECREMENT,
S_ROTATION_INCREMENT,
S_REWIND,
S_SAVESTATE_DECREMENT,
S_SAVESTATE_INCREMENT,
S_SCALE_ENABLED,
S_SCALE_FACTOR_DECREMENT,
S_SCALE_FACTOR_INCREMENT,
S_START_RARCH,
S_THROTTLE,
S_TRIPLE_BUFFERING
};
enum
{
S_DEF_ASPECT_RATIO = 0,
S_DEF_HW_TEXTURE_FILTER,
S_DEF_HW_TEXTURE_FILTER_2,
S_DEF_OVERSCAN,
S_DEF_ROTATION,
S_DEF_THROTTLE,
S_DEF_TRIPLE_BUFFERING,
S_DEF_SAVE_STATE,
S_DEF_SCALE_ENABLED,
S_DEF_SCALE_FACTOR
};
enum
{
S_MSG_CACHE_PARTITION = 0,
S_MSG_CHANGE_CONTROLS,
S_MSG_EXTRACTED_ZIPFILE,
S_MSG_NOT_IMPLEMENTED,
S_MSG_RESIZE_SCREEN,
S_MSG_RESTART_RARCH,
S_MSG_SELECT_LIBRETRO_CORE,
S_MSG_SELECT_SHADER,
S_MSG_SHADER_LOADING_SUCCEEDED
};
enum
{
S_LBL_ASPECT_RATIO = 0,
S_LBL_RARCH_VERSION,
S_LBL_ROTATION,
S_LBL_SHADER,
S_LBL_SHADER_2,
S_LBL_SCALE_FACTOR,
S_LBL_LOAD_STATE_SLOT,
S_LBL_SAVE_STATE_SLOT,
};
void rarch_settings_change(unsigned setting);
void rarch_settings_default(unsigned setting);
void rarch_settings_msg(unsigned setting, unsigned delay);
#ifdef _XBOX
void rarch_settings_create_menu_item_label(wchar_t * strwbuf, unsigned setting, size_t size);
#else
void rarch_settings_create_menu_item_label(char * str, unsigned setting, size_t size);
#endif
#endif

View File

@ -91,7 +91,7 @@ const char * path, const char * extensions)
if(!(ffd.dwFileAttributes & FS_TYPES_DIRECTORY))
{
char tmp_extensions[512];
strncpy(tmp_extensions, extensions, sizeof(tmp_extensions));
strlcpy(tmp_extensions, extensions, sizeof(tmp_extensions));
const char * current_extension = filebrowser_get_extension(ffd.cFileName);
bool found_rom = false;
@ -158,7 +158,7 @@ const char * path, const char * extensions)
if (dirent.d_type == FS_TYPES_FILE)
{
char tmp_extensions[512];
strncpy(tmp_extensions, extensions, sizeof(tmp_extensions));
strlcpy(tmp_extensions, extensions, sizeof(tmp_extensions));
const char * current_extension = filebrowser_get_extension(dirent.d_name);
bool found_rom = false;

View File

@ -18,7 +18,6 @@
#define FILEBROWSER_H_
#define MAXJOLIET 255
#define MAX_PATH_LENGTH 1024
#include <stdint.h>
#include <stdlib.h>

View File

@ -22,6 +22,11 @@
CONSOLE EXTENSIONS
============================================================ */
#include "../console_ext.c"
#include "../console_settings.c"
#ifdef HAVE_LIBRETRO_MANAGEMENT
#include "../libretro_mgmt.c"
#endif
/*============================================================
COMPATIBILITY

View File

@ -40,6 +40,9 @@
#define video_set_rotation_func(rotation) gl_set_rotation(driver.video_data, rotation)
#define video_set_aspect_ratio_func(aspectratio_idx) gfx_ctx_set_aspect_ratio(driver.video_data, aspectratio_idx)
#define gfx_ctx_window_has_focus() (true)
#define gfx_ctx_swap_buffers() (psglSwap())
#define input_init_func() ps3_input_initialize()
#define input_poll_func() ps3_input_poll(driver.input_data)
#define input_input_state_func(snes_keybinds, port, device, index, id) \
@ -65,6 +68,9 @@
#define video_set_rotation_func(rotation) xdk360_set_rotation(driver.video_data, rotation)
#define video_set_aspect_ratio_func(aspectratio_idx) gfx_ctx_set_aspect_ratio(driver.video_data, aspectratio_idx)
#define gfx_ctx_window_has_focus() (true)
#define gfx_ctx_swap_buffers() (d3d9->d3d_render_device->Present(NULL, NULL, NULL, NULL))
#define input_init_func() xdk360_input_initialize()
#define input_poll_func() xdk360_input_poll(driver.input_data)
#define input_input_state_func(snes_keybinds, port, device, index, id) \
@ -95,5 +101,6 @@
wii_input_state(driver.input_data, snes_keybinds, port, device, index, id)
#define input_key_pressed_func(key) wii_key_pressed(driver.input_data, key)
#define input_free_func() wii_free_input(driver.input_data)
#define gfx_ctx_window_has_focus() (true)
#endif

136
console/libretro_mgmt.c Normal file
View File

@ -0,0 +1,136 @@
/* 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>
#include "console_ext.h"
const char *rarch_manage_libretro_install(const char *full_path, const char *path, const char *exe_ext)
{
int ret;
const char *retstr = NULL;
char tmp_path2[1024], tmp_pathnewfile[1024];
RARCH_LOG("Assumed path of CORE executable: [%s]\n", full_path);
if (path_file_exists(full_path))
{
// if CORE executable exists, this means we have just installed
// a new libretro port and therefore we need to change it to a more
// sane name.
rarch_console_name_from_id(tmp_path2, sizeof(tmp_path2));
strlcat(tmp_path2, exe_ext, sizeof(tmp_path2));
snprintf(tmp_pathnewfile, sizeof(tmp_pathnewfile), "%s%s", path, tmp_path2);
if (path_file_exists(tmp_pathnewfile))
{
// if libretro core already exists, this means we are
// upgrading the libretro core - so delete pre-existing
// file first.
RARCH_LOG("Upgrading emulator core...\n");
#if defined(__CELLOS_LV2__)
ret = cellFsUnlink(tmp_pathnewfile);
if (ret == CELL_FS_SUCCEEDED)
#elif defined(_XBOX)
ret = DeleteFile(tmp_pathnewfile);
if (ret != 0)
#endif
{
RARCH_LOG("Succeeded in removing pre-existing libretro core: [%s].\n", tmp_pathnewfile);
}
else
RARCH_ERR("Failed to remove pre-existing libretro core: [%s].\n", tmp_pathnewfile);
}
//now attempt the renaming.
#if defined(__CELLOS_LV2__)
ret = cellFsRename(full_path, tmp_pathnewfile);
if (ret != CELL_FS_SUCCEEDED)
#elif defined(_XBOX)
ret = MoveFileExA(full_path, tmp_pathnewfile, NULL);
if (ret == 0)
#endif
{
RARCH_ERR("Failed to rename CORE executable.\n");
}
else
{
RARCH_LOG("Libsnes core [%s] renamed to: [%s].\n", full_path, tmp_pathnewfile);
retstr = tmp_pathnewfile;
goto done;
}
}
RARCH_WARN("CORE executable was not found, or some other errors occurred. Will attempt to load libretro core path from config file.\n");
done:
return retstr;
}
const char *rarch_manage_libretro_set_first_file(const char *libretro_path, const char * exe_ext)
{
//We need to set libretro to the first entry in the cores
//directory so that it will be saved to the config file
char ** dir_list = dir_list_new(libretro_path, exe_ext);
const char * retstr = NULL;
const char * first_exe;
if (!dir_list)
{
RARCH_ERR("Couldn't read directory.\n");
goto error;
}
first_exe = dir_list[0];
if(first_exe)
{
#ifdef _XBOX
char fname_tmp[PATH_MAX];
fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp));
if(strcmp(fname_tmp, "RetroArch-Salamander.xex") == 0)
{
RARCH_WARN("First entry is RetroArch Salamander itself, increment entry by one and check if it exists.\n");
first_exe = dir_list[1];
fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp));
if(!first_exe)
{
RARCH_ERR("Unlikely error happened - no second entry - no choice but to set it to RetroArch Salamander\n");
first_exe = dir_list[0];
fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp));
}
}
retstr = fname_tmp;
#else
retstr = first_exe;
#endif
RARCH_LOG("Set first entry in libretro core dir to libretro path: [%s].\n", retstr);
goto end;
}
error:
RARCH_ERR("Failed to set first entry to libretro path.\n");
end:
dir_list_free(dir_list);
return retstr;
}

View File

@ -14,25 +14,20 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _360_SHARED_H
#define _360_SHARED_H
#ifndef LIBRETRO_MGMT_H__
#define LIBRETRO_MGMT_H__
#define MAX_PATH_LENGTH 1024
#include "../boolean.h"
enum {
MENU_ITEM_LOAD_STATE = 0,
MENU_ITEM_SAVE_STATE,
MENU_ITEM_KEEP_ASPECT_RATIO,
MENU_ITEM_OVERSCAN_AMOUNT,
MENU_ITEM_ORIENTATION,
MENU_ITEM_RESIZE_MODE,
MENU_ITEM_FRAME_ADVANCE,
MENU_ITEM_SCREENSHOT_MODE,
MENU_ITEM_RESET,
MENU_ITEM_RETURN_TO_GAME,
MENU_ITEM_RETURN_TO_DASHBOARD
enum
{
EXTERN_LAUNCHER_SALAMANDER,
#ifdef HAVE_MULTIMAN
EXTERN_LAUNCHER_MULTIMAN
#endif
};
#define MENU_ITEM_LAST MENU_ITEM_RETURN_TO_DASHBOARD+1
const char *rarch_manage_libretro_install(const char *full_path, const char *path, const char *exe_ext);
const char *rarch_manage_libretro_set_first_file(const char *libretro_path, const char * exe_ext);
#endif

View File

@ -1415,7 +1415,7 @@ int rsd_set_param(rsound_t *rd, enum rsd_settings option, void* param)
break;
case RSD_IDENTITY:
strncpy(rd->identity, param, sizeof(rd->identity));
strlcpy(rd->identity, param, sizeof(rd->identity));
rd->identity[sizeof(rd->identity)-1] = '\0';
break;

View File

@ -44,8 +44,6 @@
#define PATH_MAX 512
#endif
#define MAX_PATH_LENGTH 1024
#ifdef HAVE_LOGGER
#include "logger.h"
#define RARCH_LOG(...) logger_send("RetroArch Salamander: " __VA_ARGS__);
@ -72,16 +70,16 @@
#if defined(__CELLOS_LV2__)
static uint8_t np_pool[NP_POOL_SIZE];
char contentInfoPath[MAX_PATH_LENGTH];
char usrDirPath[MAX_PATH_LENGTH];
char contentInfoPath[PATH_MAX];
char usrDirPath[PATH_MAX];
SYS_PROCESS_PARAM(1001, 0x100000)
#elif defined(_XBOX)
DWORD volume_device_type;
#endif
char LIBRETRO_DIR_PATH[MAX_PATH_LENGTH];
char SYS_CONFIG_FILE[MAX_PATH_LENGTH];
char libretro_path[MAX_PATH_LENGTH];
char LIBRETRO_DIR_PATH[PATH_MAX];
char SYS_CONFIG_FILE[PATH_MAX];
char libretro_path[PATH_MAX];
static void find_and_set_first_file(void)
{
@ -107,7 +105,7 @@ static void find_and_set_first_file(void)
#ifdef _XBOX
//Check if it's RetroArch Salamander itself - if so, first_executable needs to
//be overridden
char fname_tmp[MAX_PATH_LENGTH];
char fname_tmp[PATH_MAX];
fill_pathname_base(fname_tmp, first_executable, sizeof(fname_tmp));
@ -140,7 +138,7 @@ static void find_and_set_first_file(void)
static void init_settings(void)
{
char tmp_str[MAX_PATH_LENGTH];
char tmp_str[PATH_MAX];
bool config_file_exists;
if(!path_file_exists(SYS_CONFIG_FILE))

View File

@ -207,8 +207,12 @@ struct console_settings
bool default_savestate_dir_enable;
bool fbo_enabled;
bool frame_advance_enable;
bool gamma_correction_enable;
#ifdef _XBOX
bool menus_hd_enable;
#endif
bool initialize_rarch_enable;
bool info_msg_enable;
bool gamma_correction_enable;
bool ingame_menu_enable;
bool menu_enable;
bool overscan_enable;
@ -477,6 +481,8 @@ int rarch_main_init(int argc, char *argv[]);
bool rarch_main_iterate(void);
void rarch_main_deinit(void);
void rarch_render_cached_frame(void);
void rarch_init_msg_queue(void);
void rarch_deinit_msg_queue(void);
void rarch_load_state(void);
void rarch_save_state(void);

View File

@ -95,17 +95,20 @@ void gfx_ctx_check_window(bool *quit,
*resize = true;
}
#ifndef HAVE_GRIFFIN
bool gfx_ctx_window_has_focus(void)
{
return true;
}
void gfx_ctx_set_resize(unsigned width, unsigned height) { }
void gfx_ctx_swap_buffers(void)
{
psglSwap();
}
#endif
void gfx_ctx_set_resize(unsigned width, unsigned height) { }
bool gfx_ctx_menu_init(void)
{
@ -324,7 +327,7 @@ void ps3_previous_resolution (void)
}
}
int ps3_check_resolution(uint32_t resolution_id)
int gfx_ctx_check_resolution(unsigned resolution_id)
{
return cellVideoOutGetResolutionAvailability(CELL_VIDEO_OUT_PRIMARY, resolution_id, CELL_VIDEO_OUT_ASPECT_AUTO, 0);
}
@ -408,4 +411,3 @@ void gfx_ctx_set_overscan(void)
gl->should_resize = true;
}

View File

@ -51,19 +51,21 @@ void gfx_ctx_check_window(bool *quit,
*resize = true;
}
bool gfx_ctx_window_has_focus(void)
{
return true;
}
void gfx_ctx_set_resize(unsigned width, unsigned height) { }
#ifndef HAVE_GRIFFIN
void gfx_ctx_swap_buffers(void)
{
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
d3d9->d3d_render_device->Present(NULL, NULL, NULL, NULL);
}
bool gfx_ctx_window_has_focus(void)
{
return true;
}
#endif
bool gfx_ctx_menu_init(void)
{
return true;
@ -133,3 +135,7 @@ void gfx_ctx_set_overscan(void)
d3d9->should_resize = true;
}
int gfx_ctx_check_resolution(unsigned resolution_id)
{
return 0;
}

View File

@ -46,4 +46,3 @@ void gl_render_msg_post(gl_t *gl)
{
cellDbgFontDraw();
}

View File

@ -1,8 +1,6 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
*
*
* 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.
@ -51,8 +49,6 @@ void gfx_ctx_destroy(void);
void gfx_ctx_get_video_size(unsigned *width, unsigned *height);
void gfx_ctx_update_window_title(bool reset);
void gfx_ctx_swap_buffers(void);
bool gfx_ctx_key_pressed(int key);
void gfx_ctx_check_window(bool *quit,
@ -64,8 +60,12 @@ void gfx_ctx_set_resize(unsigned width, unsigned height);
bool gfx_ctx_get_wm_info(SDL_SysWMinfo *info);
#endif
#ifndef HAVE_GRIFFIN
bool gfx_ctx_window_has_focus(void);
void gfx_ctx_swap_buffers(void);
#endif
void gfx_ctx_input_driver(const input_driver_t **input, void **input_data);
#ifdef HAVE_CG_MENU
@ -75,6 +75,7 @@ bool gfx_ctx_menu_init(void);
#ifdef RARCH_CONSOLE
void gfx_ctx_set_filtering(unsigned index, bool set_smooth);
void gfx_ctx_get_available_resolutions(void);
int gfx_ctx_check_resolution(unsigned resolution_id);
#endif
#if defined(HAVE_OPENGL) || defined(HAVE_D3D9)

View File

@ -542,20 +542,6 @@ static inline void set_texture_coords(GLfloat *coords, GLfloat xamt, GLfloat yam
coords[7] = yamt;
}
static void check_window(gl_t *gl)
{
bool quit, resize;
gfx_ctx_check_window(&quit,
&resize, &gl->win_width, &gl->win_height,
gl->frame_count);
if (quit)
gl->quitting = true;
else if (resize)
gl->should_resize = true;
}
#ifdef HAVE_FBO
static void gl_compute_fbo_geometry(gl_t *gl, unsigned width, unsigned height,
unsigned vp_width, unsigned vp_height)
@ -612,7 +598,7 @@ static void gl_compute_fbo_geometry(gl_t *gl, unsigned width, unsigned height,
}
}
static void gl_start_frame_fbo(gl_t *gl)
static inline void gl_start_frame_fbo(gl_t *gl)
{
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
pglBindFramebuffer(GL_FRAMEBUFFER, gl->fbo[0]);
@ -794,7 +780,7 @@ static void gl_update_input_size(gl_t *gl, unsigned width, unsigned height, unsi
}
#ifdef __CELLOS_LV2__
static void gl_copy_frame(gl_t *gl, const void *frame, unsigned width, unsigned height, unsigned pitch)
static inline void gl_copy_frame(gl_t *gl, const void *frame, unsigned width, unsigned height, unsigned pitch)
{
if (!gl->fbo_inited)
gl_set_viewport(gl, gl->win_width, gl->win_height, false, true);
@ -838,7 +824,7 @@ static void gl_init_textures(gl_t *gl)
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
}
#else
static void gl_copy_frame(gl_t *gl, const void *frame, unsigned width, unsigned height, unsigned pitch)
static inline void gl_copy_frame(gl_t *gl, const void *frame, unsigned width, unsigned height, unsigned pitch)
{
glPixelStorei(GL_UNPACK_ROW_LENGTH, pitch / gl->base_size);
glTexSubImage2D(GL_TEXTURE_2D,
@ -867,7 +853,7 @@ static void gl_init_textures(gl_t *gl)
}
#endif
static void gl_next_texture_index(gl_t *gl, const struct gl_tex_info *tex_info)
static inline void gl_next_texture_index(gl_t *gl, const struct gl_tex_info *tex_info)
{
memmove(gl->prev_info + 1, gl->prev_info, sizeof(*tex_info) * (TEXTURES - 1));
memcpy(&gl->prev_info[0], tex_info, sizeof(*tex_info));
@ -958,7 +944,9 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei
gl_render_msg_post(gl);
}
#ifndef RARCH_CONSOLE
gfx_ctx_update_window_title(false);
#endif
#ifdef RARCH_CONSOLE
if (!gl->block_swap)
@ -1189,7 +1177,17 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
static bool gl_alive(void *data)
{
gl_t *gl = (gl_t*)data;
check_window(gl);
bool quit, resize;
gfx_ctx_check_window(&quit,
&resize, &gl->win_width, &gl->win_height,
gl->frame_count);
if (quit)
gl->quitting = true;
else if (resize)
gl->should_resize = true;
return !gl->quitting;
}
@ -1267,14 +1265,38 @@ static void gl_stop(void)
static void gl_restart(void)
{
#ifdef HAVE_CG_MENU
bool should_menu_render;
#endif
#ifdef RARCH_CONSOLE
bool should_block_swap;
#endif
gl_t *gl = driver.video_data;
if (!gl)
return;
#ifdef RARCH_CONSOLE
should_block_swap = gl->block_swap;
#endif
#ifdef HAVE_CG_MENU
should_menu_render = gl->menu_render;
#endif
gl_stop();
gl_cg_invalidate_context();
gl_start();
#ifdef HAVE_CG_MENU
gl->menu_render = should_menu_render;
#endif
gl->frame_count = 0;
#ifdef RARCH_CONSOLE
gl->block_swap = should_block_swap;
SET_TIMER_EXPIRATION(gl, 30);
#endif
}
#endif

View File

@ -22,6 +22,7 @@ void gl_init_font(gl_t *gl, const char *font_path, unsigned font_size);
void gl_deinit_font(gl_t *gl);
void gl_render_msg(gl_t *gl, const char *msg);
void gl_render_msg_post(gl_t *gl);
#endif

View File

@ -805,30 +805,36 @@ static bool load_shader_params(unsigned i, config_file_t *conf)
scale->abs_x = geom->base_width;
scale->abs_y = geom->base_height;
if (strcmp(scale_type_x, "source") == 0)
scale->type_x = RARCH_SCALE_INPUT;
else if (strcmp(scale_type_x, "viewport") == 0)
scale->type_x = RARCH_SCALE_VIEWPORT;
else if (strcmp(scale_type_x, "absolute") == 0)
scale->type_x = RARCH_SCALE_ABSOLUTE;
else
if (scale_type_x)
{
RARCH_ERR("Invalid attribute.\n");
ret = false;
goto end;
if (strcmp(scale_type_x, "source") == 0)
scale->type_x = RARCH_SCALE_INPUT;
else if (strcmp(scale_type_x, "viewport") == 0)
scale->type_x = RARCH_SCALE_VIEWPORT;
else if (strcmp(scale_type_x, "absolute") == 0)
scale->type_x = RARCH_SCALE_ABSOLUTE;
else
{
RARCH_ERR("Invalid attribute.\n");
ret = false;
goto end;
}
}
if (strcmp(scale_type_y, "source") == 0)
scale->type_y = RARCH_SCALE_INPUT;
else if (strcmp(scale_type_y, "viewport") == 0)
scale->type_y = RARCH_SCALE_VIEWPORT;
else if (strcmp(scale_type_y, "absolute") == 0)
scale->type_y = RARCH_SCALE_ABSOLUTE;
else
if (scale_type_y)
{
RARCH_ERR("Invalid attribute.\n");
ret = false;
goto end;
if (strcmp(scale_type_y, "source") == 0)
scale->type_y = RARCH_SCALE_INPUT;
else if (strcmp(scale_type_y, "viewport") == 0)
scale->type_y = RARCH_SCALE_VIEWPORT;
else if (strcmp(scale_type_y, "absolute") == 0)
scale->type_y = RARCH_SCALE_ABSOLUTE;
else
{
RARCH_ERR("Invalid attribute.\n");
ret = false;
goto end;
}
}
if (scale->type_x == RARCH_SCALE_ABSOLUTE)

View File

@ -131,16 +131,12 @@ void hlsl_set_params(unsigned width, unsigned height,
static bool load_program(unsigned index, const char *prog, bool path_is_file)
{
bool ret, ret_fp, ret_vp;
HRESULT ret, ret_fp, ret_vp;
ID3DXBuffer *listing_f = NULL;
ID3DXBuffer *listing_v = NULL;
ID3DXBuffer *code_f = NULL;
ID3DXBuffer *code_v = NULL;
ret = true;
ret_fp = false;
ret_vp = false;
if (path_is_file)
{
ret_fp = D3DXCompileShaderFromFile(prog, NULL, NULL,
@ -157,7 +153,7 @@ static bool load_program(unsigned index, const char *prog, bool path_is_file)
"main_vertex", "vs_3_0", 0, &code_v, &listing_v, &prg[index].v_ctable );
}
if (FAILED(ret_fp) || FAILED(ret_vp) || listing_v || listing_f)
if (ret_fp < 0 || ret_vp < 0 || listing_v || listing_f)
{
RARCH_ERR("HLSL error:\n");
if(listing_f)

View File

@ -52,8 +52,6 @@
#include "menu.h"
#define MAX_PATH_LENGTH 1024
#define EMULATOR_CONTENT_DIR "SSNE10000"
#define EMULATOR_CORE_DIR "cores"
@ -61,21 +59,23 @@
#define NP_POOL_SIZE (128*1024)
static uint8_t np_pool[NP_POOL_SIZE];
char contentInfoPath[MAX_PATH_LENGTH];
char usrDirPath[MAX_PATH_LENGTH];
char DEFAULT_PRESET_FILE[MAX_PATH_LENGTH];
char DEFAULT_BORDER_FILE[MAX_PATH_LENGTH];
char DEFAULT_MENU_BORDER_FILE[MAX_PATH_LENGTH];
char PRESETS_DIR_PATH[MAX_PATH_LENGTH];
char INPUT_PRESETS_DIR_PATH[MAX_PATH_LENGTH];
char BORDERS_DIR_PATH[MAX_PATH_LENGTH];
char SHADERS_DIR_PATH[MAX_PATH_LENGTH];
char LIBRETRO_DIR_PATH[MAX_PATH_LENGTH];
char DEFAULT_SHADER_FILE[MAX_PATH_LENGTH];
char DEFAULT_MENU_SHADER_FILE[MAX_PATH_LENGTH];
char SYS_CONFIG_FILE[MAX_PATH_LENGTH];
char EMULATOR_CORE_SELF[MAX_PATH_LENGTH];
char MULTIMAN_EXECUTABLE[MAX_PATH_LENGTH];
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];
#ifdef HAVE_MULTIMAN
char MULTIMAN_EXECUTABLE[PATH_MAX];
#endif
int rarch_main(int argc, char *argv[]);
@ -91,6 +91,7 @@ static void set_default_settings(void)
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;
g_settings.video.render_to_texture = true;
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;
@ -147,6 +148,7 @@ static void set_default_settings(void)
g_console.viewports.custom_vp.x = 0;
g_console.viewports.custom_vp.y = 0;
g_console.custom_bgm_enable = true;
g_console.info_msg_enable = true;
// g_extern
g_extern.state_slot = 0;
@ -154,167 +156,6 @@ static void set_default_settings(void)
g_extern.verbose = true;
}
static void init_settings(bool load_libretro_path)
{
if(!path_file_exists(SYS_CONFIG_FILE))
{
RARCH_ERR("Config file \"%s\" doesn't exist. Creating...\n", SYS_CONFIG_FILE);
FILE * f;
f = fopen(SYS_CONFIG_FILE, "w");
fclose(f);
}
else
{
config_file_t * conf = config_file_new(SYS_CONFIG_FILE);
// g_settings
if(load_libretro_path)
{
CONFIG_GET_STRING(libretro, "libretro_path");
if(!strcmp(g_settings.libretro, ""))
{
//We need to set libretro to the first entry in the cores
//directory so that it will be saved to the config file
char ** dir_list = dir_list_new(LIBRETRO_DIR_PATH, ".SELF");
if (!dir_list)
{
RARCH_ERR("Couldn't read %s directory.\n", EMULATOR_CORE_DIR);
return;
}
const char * first_self = dir_list[0];
if(first_self)
{
RARCH_LOG("Set first entry in libretro %s dir: [%s] to libretro path.\n", EMULATOR_CORE_DIR, first_self);
strlcpy(g_settings.libretro, first_self, sizeof(g_settings.libretro));
}
else
{
RARCH_ERR("Failed to set first entry in libretro %s dir to libretro path.\n", EMULATOR_CORE_DIR);
}
dir_list_free(dir_list);
}
}
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");
CONFIG_GET_STRING(audio.device, "audio_device");
for (unsigned i = 0; i < 7; i++)
{
char cfg[64];
snprintf(cfg, sizeof(cfg), "input_dpad_emulation_p%u", i + 1);
CONFIG_GET_INT(input.dpad_emulation[i], cfg);
}
// g_console
CONFIG_GET_BOOL_CONSOLE(fbo_enabled, "fbo_enabled");
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");
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");
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");
}
}
static void save_settings(void)
{
if(!path_file_exists(SYS_CONFIG_FILE))
{
RARCH_ERR("Config file \"%s\" doesn't exist. Creating...\n", SYS_CONFIG_FILE);
FILE * f;
f = fopen(SYS_CONFIG_FILE, "w");
fclose(f);
}
else
{
config_file_t * conf = config_file_new(SYS_CONFIG_FILE);
if(conf == NULL)
conf = config_file_new(NULL);
// g_settings
config_set_string(conf, "libretro_path", g_settings.libretro);
config_set_string(conf, "cheat_database_path", g_settings.cheat_database);
config_set_bool(conf, "rewind_enable", g_settings.rewind_enable);
config_set_string(conf, "video_cg_shader", g_settings.video.cg_shader_path);
config_set_string(conf, "video_second_pass_shader", g_settings.video.second_pass_shader);
config_set_float(conf, "video_aspect_ratio", g_settings.video.aspect_ratio);
config_set_float(conf, "video_fbo_scale_x", g_settings.video.fbo_scale_x);
config_set_float(conf, "video_fbo_scale_y", g_settings.video.fbo_scale_y);
config_set_bool(conf, "video_render_to_texture", g_settings.video.render_to_texture);
config_set_bool(conf, "video_second_pass_smooth", g_settings.video.second_pass_smooth);
config_set_bool(conf, "video_smooth", g_settings.video.smooth);
config_set_bool(conf, "video_vsync", g_settings.video.vsync);
config_set_string(conf, "audio_device", g_settings.audio.device);
for (unsigned i = 0; i < 7; i++)
{
char cfg[64];
snprintf(cfg, sizeof(cfg), "input_dpad_emulation_p%u", i + 1);
config_set_int(conf, cfg, g_settings.input.dpad_emulation[i]);
}
// g_console
config_set_bool(conf, "fbo_enabled", g_console.fbo_enabled);
config_set_bool(conf, "custom_bgm_enable", g_console.custom_bgm_enable);
config_set_bool(conf, "overscan_enable", g_console.overscan_enable);
config_set_bool(conf, "screenshots_enable", g_console.screenshots_enable);
config_set_bool(conf, "throttle_enable", g_console.throttle_enable);
config_set_bool(conf, "triple_buffering_enable", g_console.triple_buffering_enable);
config_set_int(conf, "sound_mode", g_console.sound_mode);
config_set_int(conf, "aspect_ratio_index", g_console.aspect_ratio_index);
config_set_int(conf, "current_resolution_id", g_console.current_resolution_id);
config_set_int(conf, "custom_viewport_width", g_console.viewports.custom_vp.width);
config_set_int(conf, "custom_viewport_height", g_console.viewports.custom_vp.height);
config_set_int(conf, "custom_viewport_x", g_console.viewports.custom_vp.x);
config_set_int(conf, "custom_viewport_y", g_console.viewports.custom_vp.y);
config_set_int(conf, "screen_orientation", g_console.screen_orientation);
config_set_string(conf, "default_rom_startup_dir", g_console.default_rom_startup_dir);
config_set_float(conf, "menu_font_size", g_console.menu_font_size);
config_set_float(conf, "overscan_amount", g_console.overscan_amount);
// g_extern
config_set_int(conf, "state_slot", g_extern.state_slot);
config_set_int(conf, "audio_mute", g_extern.audio_data.mute);
if (!config_file_write(conf, SYS_CONFIG_FILE))
RARCH_ERR("Failed to write config file to \"%s\". Check permissions.\n", SYS_CONFIG_FILE);
free(conf);
}
}
#ifdef HAVE_SYSUTILS
static void callback_sysutil_exit(uint64_t status, uint64_t param, void *userdata)
{
@ -325,10 +166,8 @@ static void callback_sysutil_exit(uint64_t status, uint64_t param, void *userdat
switch (status)
{
case CELL_SYSUTIL_REQUEST_EXITGAME:
g_console.menu_enable = false;
gl->quitting = true;
g_console.ingame_menu_enable = false;
g_console.mode_switch = MODE_EXIT;
rarch_settings_change(S_QUIT);
break;
case CELL_SYSUTIL_OSKDIALOG_FINISHED:
oskutil_close(&g_console.oskutil_handle);
@ -352,7 +191,7 @@ static void get_environment_settings(int argc, char *argv[])
char dirName[CELL_GAME_DIRNAME_SIZE];
CellSysCacheParam param;
memset(&param, 0x00, sizeof(CellSysCacheParam));
strncpy(param.cacheId,CACHE_ID, sizeof(CellSysCacheParam));
strlcpy(param.cacheId,CACHE_ID, sizeof(CellSysCacheParam));
ret = cellSysCacheMount(&param);
if(ret != CELL_SYSCACHE_RET_OK_CLEARED)
@ -360,15 +199,16 @@ static void get_environment_settings(int argc, char *argv[])
RARCH_ERR("System cache partition could not be mounted, it might be already mounted.\n");
}
#ifdef HAVE_MULTIMAN
if(argc > 1)
{
/* launched from external launcher */
strncpy(MULTIMAN_EXECUTABLE, argv[2], sizeof(MULTIMAN_EXECUTABLE));
strlcpy(MULTIMAN_EXECUTABLE, argv[2], sizeof(MULTIMAN_EXECUTABLE));
}
else
{
/* not launched from external launcher, set default path */
strncpy(MULTIMAN_EXECUTABLE, "/dev_hdd0/game/BLES80608/USRDIR/RELOAD.SELF",
strlcpy(MULTIMAN_EXECUTABLE, "/dev_hdd0/game/BLES80608/USRDIR/RELOAD.SELF",
sizeof(MULTIMAN_EXECUTABLE));
}
@ -378,6 +218,7 @@ static void get_environment_settings(int argc, char *argv[])
RARCH_LOG("Started from multiMAN, auto-game start enabled.\n");
}
else
#endif
{
g_console.external_launcher_support = EXTERN_LAUNCHER_SALAMANDER;
RARCH_WARN("Not started from multiMAN, auto-game start disabled.\n");
@ -411,11 +252,13 @@ static void get_environment_settings(int argc, char *argv[])
ret = cellGameContentPermit(contentInfoPath, usrDirPath);
#ifdef HAVE_MULTIMAN
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);
}
#endif
if(ret < 0)
{
@ -476,15 +319,25 @@ int main(int argc, char *argv[])
config_set_defaults();
rarch_assert(g_extern.msg_queue = msg_queue_new(8));
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);
bool load_libretro_path = rarch_manage_libretro_core(full_path, tmp_path, ".SELF");
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;
set_default_settings();
init_settings(load_libretro_path);
rarch_config_load(SYS_CONFIG_FILE, LIBRETRO_DIR_PATH, ".SELF", find_libretro_file);
init_libretro_sym();
#if(CELL_SDK_VERSION > 0x340000)
@ -523,13 +376,16 @@ int main(int argc, char *argv[])
case EXTERN_LAUNCHER_SALAMANDER:
g_console.mode_switch = MODE_MENU;
break;
#ifdef HAVE_MULTIMAN
case EXTERN_LAUNCHER_MULTIMAN:
RARCH_LOG("Started from multiMAN, will auto-start game.\n");
strncpy(g_console.rom_path, argv[1], sizeof(g_console.rom_path));
g_console.initialize_rarch_enable = 1;
g_console.mode_switch = MODE_EMULATION;
strlcpy(g_console.rom_path, argv[1], sizeof(g_console.rom_path));
rarch_settings_change(S_START_RARCH);
rarch_startup(SYS_CONFIG_FILE);
break;
#endif
default:
break;
}
begin_loop:
@ -557,9 +413,11 @@ begin_loop:
begin_shutdown:
if(path_file_exists(SYS_CONFIG_FILE))
save_settings();
rarch_config_save(SYS_CONFIG_FILE);
if(g_console.emulator_initialized)
rarch_main_deinit();
input_ps3.free(NULL);
video_gl.stop();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -102,6 +102,7 @@ enum
SETTING_ENABLE_CUSTOM_BGM,
SETTING_DEFAULT_AUDIO_ALL,
SETTING_EMU_CURRENT_SAVE_STATE_SLOT,
SETTING_EMU_SHOW_INFO_MSG,
SETTING_RARCH_DEFAULT_EMU,
SETTING_EMU_DEFAULT_ALL,
SETTING_EMU_REWIND_ENABLED,

View File

@ -90,9 +90,9 @@ static void *ps3_audio_init(const char *device, unsigned rate, unsigned latency)
params.nChannel = AUDIO_CHANNELS;
params.nBlock = AUDIO_BLOCKS;
if(g_console.sound_mode == SOUND_MODE_HEADSET)
params.attr = CELL_AUDIO_PORTATTR_OUT_SECONDARY;
params.attr = CELL_AUDIO_PORTATTR_OUT_SECONDARY;
else
params.attr = 0;
params.attr = 0;
if (cellAudioPortOpen(&params, &data->audio_port) != CELL_OK)
{

View File

@ -244,7 +244,7 @@ void oskutil_unload(oskutil_params *params)
static void ps3_free_input(void *data)
{
(void)data;
cellPadEnd();
//cellPadEnd();
}
static void* ps3_input_initialize(void)

View File

@ -33,7 +33,6 @@ enum
#define MAX_SCALING_FACTOR (4.0f)
const char * ps3_get_resolution_label(uint32_t resolution);
int ps3_check_resolution(uint32_t resolution_id);
void ps3_previous_resolution (void);
void ps3_next_resolution (void);

View File

@ -17,28 +17,6 @@
#ifndef _PS3_SHARED_H
#define _PS3_SHARED_H
#define MAX_PATH_LENGTH 1024
/* ABGR color format */
#define WHITE 0xffffffffu
#define RED 0xff0000ffu
#define GREEN 0xff00ff00u
#define BLUE 0xffff0000u
#define YELLOW 0xff00ffffu
#define PURPLE 0xffff00ffu
#define CYAN 0xffffff00u
#define ORANGE 0xff0063ffu
#define SILVER 0xff8c848cu
#define LIGHTBLUE 0xFFFFE0E0U
#define LIGHTORANGE 0xFFE0EEFFu
enum
{
EXTERN_LAUNCHER_SALAMANDER,
EXTERN_LAUNCHER_MULTIMAN
};
enum
{
CONFIG_FILE,
@ -46,46 +24,19 @@ enum
INPUT_PRESET_FILE
};
enum
{
SOUND_MODE_NORMAL,
SOUND_MODE_RSOUND,
SOUND_MODE_HEADSET
};
enum {
MENU_ITEM_LOAD_STATE = 0,
MENU_ITEM_SAVE_STATE,
MENU_ITEM_KEEP_ASPECT_RATIO,
MENU_ITEM_OVERSCAN_AMOUNT,
MENU_ITEM_ORIENTATION,
MENU_ITEM_SCALE_FACTOR,
MENU_ITEM_RESIZE_MODE,
MENU_ITEM_FRAME_ADVANCE,
MENU_ITEM_SCREENSHOT_MODE,
MENU_ITEM_RESET,
MENU_ITEM_RETURN_TO_GAME,
MENU_ITEM_RETURN_TO_MENU,
MENU_ITEM_CHANGE_LIBRETRO,
MENU_ITEM_RETURN_TO_MULTIMAN,
MENU_ITEM_RETURN_TO_XMB
};
#define MENU_ITEM_LAST MENU_ITEM_RETURN_TO_XMB+1
extern char contentInfoPath[MAX_PATH_LENGTH];
extern char usrDirPath[MAX_PATH_LENGTH];
extern char DEFAULT_PRESET_FILE[MAX_PATH_LENGTH];
extern char DEFAULT_BORDER_FILE[MAX_PATH_LENGTH];
extern char DEFAULT_MENU_BORDER_FILE[MAX_PATH_LENGTH];
extern char PRESETS_DIR_PATH[MAX_PATH_LENGTH];
extern char INPUT_PRESETS_DIR_PATH[MAX_PATH_LENGTH];
extern char BORDERS_DIR_PATH[MAX_PATH_LENGTH];
extern char SHADERS_DIR_PATH[MAX_PATH_LENGTH];
extern char DEFAULT_SHADER_FILE[MAX_PATH_LENGTH];
extern char DEFAULT_MENU_SHADER_FILE[MAX_PATH_LENGTH];
extern char LIBRETRO_DIR_PATH[MAX_PATH_LENGTH];
extern char SYS_CONFIG_FILE[MAX_PATH_LENGTH];
extern char MULTIMAN_EXECUTABLE[MAX_PATH_LENGTH];
extern char contentInfoPath[PATH_MAX];
extern char usrDirPath[PATH_MAX];
extern char DEFAULT_PRESET_FILE[PATH_MAX];
extern char DEFAULT_BORDER_FILE[PATH_MAX];
extern char DEFAULT_MENU_BORDER_FILE[PATH_MAX];
extern char PRESETS_DIR_PATH[PATH_MAX];
extern char INPUT_PRESETS_DIR_PATH[PATH_MAX];
extern char BORDERS_DIR_PATH[PATH_MAX];
extern char SHADERS_DIR_PATH[PATH_MAX];
extern char DEFAULT_SHADER_FILE[PATH_MAX];
extern char DEFAULT_MENU_SHADER_FILE[PATH_MAX];
extern char LIBRETRO_DIR_PATH[PATH_MAX];
extern char SYS_CONFIG_FILE[PATH_MAX];
extern char MULTIMAN_EXECUTABLE[PATH_MAX];
#endif

View File

@ -1152,7 +1152,12 @@ static void init_recording(void)
params.fb_height = next_pow2(max_height);
}
RARCH_LOG("Recording with FFmpeg to %s @ %ux%u. (FB size: %ux%u 32-bit: %s)\n", g_extern.record_path, params.out_width, params.out_height, params.fb_width, params.fb_height, params.rgb32 ? "yes" : "no");
RARCH_LOG("Recording with FFmpeg to %s @ %ux%u. (FB size: %ux%u 32-bit: %s)\n",
g_extern.record_path,
params.out_width, params.out_height,
params.fb_width, params.fb_height,
params.rgb32 ? "yes" : "no");
g_extern.rec = ffemu_new(&params);
if (!g_extern.rec)
{
@ -1171,7 +1176,7 @@ static void deinit_recording(void)
}
#endif
static void init_msg_queue(void)
void rarch_init_msg_queue(void)
{
if (g_extern.msg_queue)
return;
@ -1179,7 +1184,7 @@ static void init_msg_queue(void)
rarch_assert(g_extern.msg_queue = msg_queue_new(8));
}
static void deinit_msg_queue(void)
void rarch_deinit_msg_queue(void)
{
if (g_extern.msg_queue)
{
@ -2363,7 +2368,6 @@ int rarch_main_init(int argc, char *argv[])
goto error;
init_system_av_info();
init_msg_queue();
if (!g_extern.sram_load_disable)
load_save_files();
@ -2543,7 +2547,6 @@ void rarch_main_deinit(void)
#ifdef HAVE_BSV_MOVIE
deinit_movie();
#endif
deinit_msg_queue();
pretro_unload_game();
pretro_deinit();
@ -2560,8 +2563,10 @@ int main(int argc, char *argv[])
#endif
int init_ret;
if ((init_ret = rarch_main_init(argc, argv))) return init_ret;
rarch_init_msg_queue();
while (rarch_main_iterate());
rarch_main_deinit();
rarch_deinit_msg_queue();
rarch_main_clear_state();
return 0;
}

View File

@ -212,6 +212,8 @@ void config_set_defaults(void)
g_settings.input.netplay_client_swap_input = netplay_client_swap_input;
for (int i = 0; i < MAX_PLAYERS; i++)
g_settings.input.joypad_map[i] = i;
rarch_init_msg_queue();
}
#ifdef HAVE_CONFIGFILE

View File

@ -135,7 +135,7 @@ int main(void)
log_fp = fopen("sd:/ssnes-log.txt", "w");
#endif
rarch_assert(g_extern.msg_queue = msg_queue_new(8));
config_set_defaults();
wii_video_init();
input_wii.init();

View File

@ -40,7 +40,7 @@ static void start_ssnes(const char *path)
{
char arg0[] = "ssnes";
char arg1[256];
strncpy(arg1, path, sizeof(arg1));
strlcpy(arg1, path, sizeof(arg1));
char *argv[3] = { arg0, arg1, NULL };
rarch_main(sizeof(argv) / sizeof(argv[0]) - 1, argv);
}