(360) Preliminary FBO scaling options - need to restart before change

is applied, fbo_reinit function doesn't seem to work on-the-fly yet,
and 3x/4x FBO seems to crash right now
This commit is contained in:
TwinAphex51224 2012-05-24 11:34:10 +02:00
parent 11a03290ce
commit 83d6fd3cbb
6 changed files with 98 additions and 6 deletions

View File

@ -37,7 +37,8 @@ Shader #1:
Shader #2:
Hardware filtering shader #1:
Hardware filtering shader #2:
Custom Scaling/Dual Shaders
Custom Scaling/Dual Shaders:
Custom Scaling Factor:
</ItemsText>
</Properties>
<XuiListItem>
@ -184,6 +185,18 @@ Custom Scaling/Dual Shaders
<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

@ -38,6 +38,7 @@ Shader #2:
Hardware filtering shader #1:
Hardware filtering shader #2:
Cutom Scaling/Dual Shaders:
Cutom Scaling Factor:
</ItemsText>
</Properties>
<XuiListItem>
@ -160,6 +161,18 @@ Cutom Scaling/Dual Shaders:
<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

@ -230,24 +230,83 @@ HRESULT CRetroArchControls::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled
HRESULT CRetroArchSettings::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
{
char shader1str[128], shader2str[128];
char shader1str[128], shader2str[128], scalefactor[128];
GetChildById(L"XuiSettingsList", &m_settingslist);
GetChildById(L"XuiBackButton", &m_back);
snprintf(shader1str, sizeof(shader1str), "Shader #1: %s", g_settings.video.cg_shader_path);
snprintf(shader2str, sizeof(shader2str), "Shader #2: %s", g_settings.video.second_pass_shader);
snprintf(scalefactor, sizeof(scalefactor), "Scale Factor: %f (X) / %f (Y)", g_settings.video.fbo_scale_x, g_settings.video.fbo_scale_y);
m_settingslist.SetText(SETTING_EMU_REWIND_ENABLED, g_settings.rewind_enable ? L"Rewind: ON" : L"Rewind: OFF");
m_settingslist.SetText(SETTING_GAMMA_CORRECTION_ENABLED, g_console.gamma_correction_enable ? L"Gamma correction: ON" : L"Gamma correction: OFF");
m_settingslist.SetText(SETTING_HW_TEXTURE_FILTER, g_settings.video.smooth ? L"Hardware filtering shader #1: Linear interpolation" : L"Hardware filtering shader #1: Point filtering");
m_settingslist.SetText(SETTING_HW_TEXTURE_FILTER_2, g_settings.video.second_pass_smooth ? L"Hardware filtering shader #2: Linear interpolation" : L"Hardware filtering shader #2: Point filtering");
m_settingslist.SetText(SETTING_SCALE_ENABLED, g_console.fbo_enabled ? L"Custom Scaling/Dual Shaders: ON" : L"Custom Scaling/Dual Shaders: OFF");
snprintf(shader1str, sizeof(shader1str), "Shader #1: %s", g_settings.video.cg_shader_path);
snprintf(shader2str, sizeof(shader2str), "Shader #2: %s", g_settings.video.second_pass_shader);
m_settingslist.SetText(SETTING_SHADER, rarch_convert_char_to_wchar(shader1str));
m_settingslist.SetText(SETTING_COLOR_FORMAT, g_console.color_format ? L"Color format: 32bit ARGB" : L"Color format: 16bit RGBA");
m_settingslist.SetText(SETTING_SHADER_2, rarch_convert_char_to_wchar(shader2str));
m_settingslist.SetText(SETTING_SCALE_FACTOR, rarch_convert_char_to_wchar(scalefactor));
return S_OK;
}
HRESULT CRetroArchSettings::OnControlNavigate(XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled)
{
char scalefactor[128];
int current_index;
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
current_index = m_settingslist.GetCurSel();
switch(pControlNavigateData->nControlNavigate)
{
case XUI_CONTROL_NAVIGATE_LEFT:
switch(current_index)
{
case SETTING_SCALE_FACTOR:
if(vid->fbo_enabled)
{
if((g_settings.video.fbo_scale_x > MIN_SCALING_FACTOR))
{
g_settings.video.fbo_scale_x -= 1.0f;
g_settings.video.fbo_scale_y -= 1.0f;
//xdk360_gfx_init_fbo(vid);
snprintf(scalefactor, sizeof(scalefactor), "Scale Factor: %f (X) / %f (Y)", g_settings.video.fbo_scale_x, g_settings.video.fbo_scale_y);
m_settingslist.SetText(SETTING_SCALE_FACTOR, rarch_convert_char_to_wchar(scalefactor));
}
}
default:
break;
}
break;
case XUI_CONTROL_NAVIGATE_RIGHT:
switch(current_index)
{
case SETTING_SCALE_FACTOR:
if(vid->fbo_enabled)
{
if((g_settings.video.fbo_scale_x < MAX_SCALING_FACTOR))
{
g_settings.video.fbo_scale_x += 1.0f;
g_settings.video.fbo_scale_y += 1.0f;
//xdk360_gfx_init_fbo(vid);
snprintf(scalefactor, sizeof(scalefactor), "Scale Factor: %f (X) / %f (Y)", g_settings.video.fbo_scale_x, g_settings.video.fbo_scale_y);
m_settingslist.SetText(SETTING_SCALE_FACTOR, rarch_convert_char_to_wchar(scalefactor));
}
}
default:
break;
}
break;
case XUI_CONTROL_NAVIGATE_UP:
case XUI_CONTROL_NAVIGATE_DOWN:
break;
}
return S_OK;
}
HRESULT CRetroArchQuickMenu::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
{
GetChildById(L"XuiQuickMenuList", &m_quickmenulist);

View File

@ -29,7 +29,8 @@ enum
SETTING_SHADER_2,
SETTING_HW_TEXTURE_FILTER,
SETTING_HW_TEXTURE_FILTER_2,
SETTING_SCALE_ENABLED
SETTING_SCALE_ENABLED,
SETTING_SCALE_FACTOR
};
enum
@ -180,9 +181,11 @@ protected:
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();

View File

@ -395,7 +395,7 @@ void xdk360_set_fbo_enable (bool enable)
vid->fbo_enabled = enable;
}
static void xdk360_gfx_init_fbo(xdk360_video_t *vid)
void xdk360_gfx_init_fbo(xdk360_video_t *vid)
{
if (vid->lpTexture_ot)
{

View File

@ -24,6 +24,9 @@
#define DFONT_MAX 4096
#define PRIM_FVF (D3DFVF_XYZRHW | D3DFVF_TEX1)
#define MIN_SCALING_FACTOR (1.0f)
#define MAX_SCALING_FACTOR (2.0f)
typedef struct
{
float x;
@ -63,6 +66,7 @@ void xdk360_video_init (void);
void xdk360_video_deinit (void);
void xdk360_video_set_vsync (bool vsync);
void xdk360_set_fbo_enable (bool enable);
void xdk360_gfx_init_fbo(xdk360_video_t *vid);
void set_viewport(bool force_full);
extern void *g_d3d;