(360) Added hardware filtering settings

This commit is contained in:
TwinAphex51224 2012-02-10 17:17:44 +01:00
parent 34b85e115b
commit c0cba36dec
6 changed files with 64 additions and 3 deletions

View File

@ -138,6 +138,7 @@ static void set_default_settings (void)
g_console.emulator_initialized = 0;
g_console.mode_switch = MODE_MENU;
strlcpy(g_console.default_rom_startup_dir, "game:\\roms\\", sizeof(g_console.default_rom_startup_dir));
g_console.filter_type = D3DTEXF_LINEAR;
//g_extern
g_extern.state_slot = 0;
@ -176,6 +177,7 @@ static void init_settings (void)
// g_console
CONFIG_GET_BOOL_CONSOLE(throttle_enable, "throttle_enable");
CONFIG_GET_STRING_CONSOLE(default_rom_startup_dir, "default_rom_startup_dir");
CONFIG_GET_INT_CONSOLE(filter_type, "filter_type");
// g_extern
CONFIG_GET_INT_EXTERN(state_slot, "state_slot");
@ -203,6 +205,7 @@ static void save_settings (void)
// g_console
config_set_string(conf, "default_rom_startup_dir", g_console.default_rom_startup_dir);
config_set_bool(conf, "throttle_enable", g_console.throttle_enable);
config_set_int(conf, "filter_type", g_console.filter_type);
// g_extern
config_set_int(conf, "state_slot", g_extern.state_slot);

View File

@ -45,7 +45,10 @@
<Width>215.000000</Width>
<Height>38.000000</Height>
<Position>24.447998,58.447998,0.000000</Position>
<NavLeft>XuiBackButton1</NavLeft>
<NavRight>XuiBackButton1</NavRight>
<NavUp>XuiBtnHWFilter</NavUp>
<NavDown>XuiBtnHWFilter</NavDown>
<Text>Rewind</Text>
</Properties>
</XuiButton>
@ -57,5 +60,17 @@
<Position>252.000000,58.000000,0.000000</Position>
</Properties>
</XuiCheckbox>
<XuiButton>
<Properties>
<Id>XuiBtnHWFilter</Id>
<Width>215.000000</Width>
<Height>38.000000</Height>
<Position>24.447998,108.447998,0.000000</Position>
<NavLeft>XuiBackButton1</NavLeft>
<NavRight>XuiBackButton1</NavRight>
<NavUp>XuiBtnRewind</NavUp>
<NavDown>XuiBtnRewind</NavDown>
</Properties>
</XuiButton>
</XuiTabScene>
</XuiCanvas>

View File

@ -83,12 +83,33 @@ HRESULT CSSNESFileBrowser::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
return S_OK;
}
static void set_filter_element(int index, CXuiControl * obj)
{
switch(index)
{
case D3DTEXF_NONE:
obj->SetText(L"None");
break;
case D3DTEXF_POINT:
obj->SetText(L"Point filtering");
break;
case D3DTEXF_LINEAR:
obj->SetText(L"Linear interpolation");
break;
case D3DTEXF_ANISOTROPIC:
obj->SetText(L"Anisotropic filtering");
break;
}
}
HRESULT CSSNESSettings::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
{
GetChildById(L"XuiBtnRewind", &m_rewind);
GetChildById(L"XuiCheckbox1", &m_rewind_cb);
GetChildById(L"XuiBackButton1", &m_back);
GetChildById(L"XuiBtnHWFilter", &m_hw_filter);
set_filter_element(g_console.filter_type, &m_hw_filter);
m_rewind_cb.SetCheck(g_settings.rewind_enable);
return S_OK;
}
@ -157,6 +178,24 @@ HRESULT CSSNESSettings::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled )
g_settings.rewind_enable = !g_settings.rewind_enable;
m_rewind_cb.SetCheck(g_settings.rewind_enable);
}
else if ( hObjPressed == m_hw_filter)
{
switch(g_console.filter_type)
{
case D3DTEXF_NONE:
g_console.filter_type = D3DTEXF_LINEAR;
break;
case D3DTEXF_POINT:
g_console.filter_type = D3DTEXF_NONE;
break;
case D3DTEXF_LINEAR:
g_console.filter_type = D3DTEXF_ANISOTROPIC;
break;
case D3DTEXF_ANISOTROPIC:
g_console.filter_type = D3DTEXF_POINT;
break;
}
}
else if ( hObjPressed == m_back )
{
HRESULT hr = XuiSceneNavigateBack(app.hSSNESSettings, app.hMainScene, XUSER_INDEX_FOCUS);
@ -168,6 +207,7 @@ HRESULT CSSNESSettings::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled )
NavigateBack(app.hMainScene);
}
set_filter_element(g_console.filter_type, &m_hw_filter);
bHandled = TRUE;
return S_OK;
}

View File

@ -78,6 +78,7 @@ class CSSNESSettings: public CXuiSceneImpl
protected:
CXuiControl m_rewind;
CXuiCheckbox m_rewind_cb;
CXuiControl m_hw_filter;
CXuiControl m_back;
public:
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );

View File

@ -254,8 +254,8 @@ static bool xdk360_gfx_frame(void *data, const void *frame,
}
vid->xdk360_render_device->SetTexture(0, vid->lpTexture);
vid->xdk360_render_device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
vid->xdk360_render_device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
vid->xdk360_render_device->SetSamplerState(0, D3DSAMP_MINFILTER, g_console.filter_type);
vid->xdk360_render_device->SetSamplerState(0, D3DSAMP_MAGFILTER, g_console.filter_type);
vid->xdk360_render_device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
vid->xdk360_render_device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
@ -302,6 +302,7 @@ void xdk360_video_init(void)
video_info.force_aspect = false;
video_info.smooth = true;
video_info.input_scale = 2;
g_d3d = xdk360_gfx_init(&video_info, NULL, NULL);
}

View File

@ -183,7 +183,8 @@ struct console_settings
bool triple_buffering_enable;
float overscan_amount;
uint32_t aspect_ratio_index;
uint32_t emulator_initialized;
uint32_t emulator_initialized;
uint32_t filter_type;
uint32_t screen_orientation;
uint32_t current_resolution_index;
uint32_t current_resolution_id;