(360) Added gamma correction setting

This commit is contained in:
TwinAphex51224 2012-03-08 23:29:18 +01:00
parent 94f09d2093
commit ac070a6b2b
6 changed files with 108 additions and 69 deletions

View File

@ -162,11 +162,12 @@ static void set_default_settings (void)
//g_console
g_console.block_config_read = true;
g_console.throttle_enable = true;
g_console.gamma_correction_enable = false;
g_console.initialize_ssnes_enable = false;
g_console.emulator_initialized = 0;
g_console.mode_switch = MODE_MENU;
g_console.screen_orientation = ORIENTATION_NORMAL;
g_console.throttle_enable = true;
strlcpy(g_console.default_rom_startup_dir, "game:", sizeof(g_console.default_rom_startup_dir));
//g_extern
@ -313,6 +314,7 @@ static void init_settings (bool load_libsnes_path)
// g_console
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(screen_orientation, "screen_orientation");
@ -343,6 +345,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, "gamma_correction_enable", g_console.gamma_correction_enable);
config_set_bool(conf, "throttle_enable", g_console.throttle_enable);
config_set_int(conf, "screen_orientation", g_console.screen_orientation);

View File

@ -3,74 +3,92 @@
<Width>1280.000000</Width>
<Height>720.000000</Height>
</Properties>
<XuiTabScene>
<XuiScene>
<Properties>
<Id>XuiTabScene1</Id>
<Width>586.256042</Width>
<Id>XuiScene1</Id>
<Width>584.528076</Width>
<Height>363.320007</Height>
<Position>345.343994,188.096008,0.000000</Position>
<Position>344.000031,184.000015,0.000000</Position>
<ClassOverride>SSNESSettings</ClassOverride>
<DefaultFocus>XuiBtnRewind</DefaultFocus>
</Properties>
<XuiText>
<Properties>
<Id>XuiTxtSettings</Id>
<Width>240.000000</Width>
<Id>XuiTxtTitle</Id>
<Width>121.056023</Width>
<Height>40.000000</Height>
<Position>25.816010,19.903992,0.000000</Position>
<Position>43.581604,21.159988,0.000000</Position>
<Text>Settings</Text>
<TextColor>0xff0f0f0f</TextColor>
<DropShadowColor>0x800f0f0f</DropShadowColor>
<TextStyle>20</TextStyle>
<Font>Arial Unicode MS</Font>
<TextStyle>21</TextStyle>
</Properties>
</XuiText>
<XuiBackButton>
<Properties>
<Id>XuiBackButton1</Id>
<Id>XuiBackButton</Id>
<Width>208.632019</Width>
<Height>36.000000</Height>
<Position>356.671997,309.000031,0.000000</Position>
<Visual>XuiBackButton</Visual>
<NavLeft>XuiBtnRewind</NavLeft>
<NavRight>XuiBackButton1</NavRight>
<NavUp>XuiBtnHWFilter</NavUp>
<NavDown>XuiBackButton1</NavDown>
<Position>356.670013,309.000000,0.000000</Position>
<NavLeft>XuiSettingsList</NavLeft>
<NavRight>XuiSettingsList</NavRight>
<NavUp>XuiSettingsList</NavUp>
<NavDown>XuiSettingsList</NavDown>
<Text>Go back to menu</Text>
<PressKey>22593</PressKey>
</Properties>
</XuiBackButton>
<XuiButton>
<XuiCommonList>
<Properties>
<Id>XuiBtnRewind</Id>
<Width>465.905640</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>
<Id>XuiSettingsList</Id>
<Width>492.000000</Width>
<Height>232.720001</Height>
<Position>44.880005,64.959991,0.000000</Position>
<NavLeft>XuiBackButton</NavLeft>
<NavRight>XuiBackButton</NavRight>
<NavUp>XuiBackButton</NavUp>
<NavDown>XuiBackButton</NavDown>
<ItemsText>Rewind:
Gamma Correction:
Hardware filtering:
</ItemsText>
</Properties>
</XuiButton>
<XuiCheckbox>
<XuiListItem>
<Properties>
<Id>XuiCheckbox1</Id>
<Width>56.304016</Width>
<Height>50.000000</Height>
<Position>507.000000,58.000000,0.000000</Position>
<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>
</XuiCheckbox>
<XuiButton>
</XuiListItem>
<XuiListItem>
<Properties>
<Id>XuiBtnHWFilter</Id>
<Width>465.905640</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>
<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>
</XuiButton>
</XuiTabScene>
</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>
</XuiScene>
</XuiCanvas>

View File

@ -131,13 +131,12 @@ static const wchar_t * set_filter_element(int index)
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);
GetChildById(L"XuiSettingsList", &m_settingslist);
GetChildById(L"XuiBackButton", &m_back);
m_hw_filter.SetText(set_filter_element(g_settings.video.smooth));
m_rewind_cb.SetCheck(g_settings.rewind_enable);
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_HARDWARE_FILTERING, set_filter_element(g_settings.video.smooth));
return S_OK;
}
@ -369,17 +368,30 @@ HRESULT CSSNESCoreBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled )
HRESULT CSSNESSettings::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled )
{
if ( hObjPressed == m_rewind)
int current_index;
if ( hObjPressed == m_settingslist)
{
g_settings.rewind_enable = !g_settings.rewind_enable;
m_rewind_cb.SetCheck(g_settings.rewind_enable);
current_index = m_settingslist.GetCurSel();
switch(current_index)
{
case SETTING_EMU_REWIND_ENABLED:
g_settings.rewind_enable = !g_settings.rewind_enable;
m_settingslist.SetText(SETTING_EMU_REWIND_ENABLED, g_settings.rewind_enable ? L"Rewind: ON" : L"Rewind: OFF");
break;
case SETTING_GAMMA_CORRECTION_ENABLED:
g_console.gamma_correction_enable = !g_console.gamma_correction_enable;
m_settingslist.SetText(SETTING_GAMMA_CORRECTION_ENABLED, g_console.gamma_correction_enable ? L"Gamma correction: ON" : L"Gamma correction: OFF");
break;
case SETTING_HARDWARE_FILTERING:
g_settings.video.smooth = !g_settings.video.smooth;
m_settingslist.SetText(SETTING_HARDWARE_FILTERING, set_filter_element(g_settings.video.smooth));
break;
}
}
else if ( hObjPressed == m_hw_filter)
{
g_settings.video.smooth = !g_settings.video.smooth;
m_hw_filter.SetText(set_filter_element(g_settings.video.smooth));
}
else if ( hObjPressed == m_back )
if ( hObjPressed == m_back )
NavigateBack(app.hMainScene);
bHandled = TRUE;

View File

@ -22,6 +22,13 @@
#include <xui.h>
#include <xuiapp.h>
enum
{
SETTING_EMU_REWIND_ENABLED = 0,
SETTING_GAMMA_CORRECTION_ENABLED,
SETTING_HARDWARE_FILTERING
};
class CSSNES : public CXuiModule
{
public:
@ -118,9 +125,7 @@ public:
class CSSNESSettings: public CXuiSceneImpl
{
protected:
CXuiControl m_rewind;
CXuiCheckbox m_rewind_cb;
CXuiControl m_hw_filter;
CXuiList m_settingslist;
CXuiControl m_back;
public:
HRESULT OnInit( XUIMessageInit* pInitData, int & bHandled );
@ -131,7 +136,7 @@ public:
XUI_ON_XM_NOTIFY_PRESS( OnNotifyPress )
XUI_END_MSG_MAP();
XUI_IMPLEMENT_CLASS(CSSNESSettings, L"SSNESSettings", XUI_CLASS_TABSCENE)
XUI_IMPLEMENT_CLASS(CSSNESSettings, L"SSNESSettings", XUI_CLASS_SCENE)
};
int menu_init (void);

View File

@ -1,4 +1,4 @@
/* SSNES - A Super Nintendo Entertainment System (SNES) Emulator frontend for libsnes.
/* SSNES - A Super Nintendo Entertainment System (SNES) Emulator frontend for libsnes.
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
* Copyright (C) 2011-2012 - Daniel De Matteis
*
@ -119,10 +119,10 @@ static void *xdk360_gfx_init(const video_info_t *video, const input_driver_t **i
if(!vid->video_mode.fIsWideScreen)
vid->d3dpp.Flags |= D3DPRESENTFLAG_NO_LETTERBOX;
vid->d3dpp.BackBufferWidth = vid->video_mode.fIsHiDef ? 1280 : 640;
vid->d3dpp.BackBufferHeight = vid->video_mode.fIsHiDef ? 720 : 480;
vid->d3dpp.BackBufferFormat = (D3DFORMAT)MAKESRGBFMT(D3DFMT_A8R8G8B8);
vid->d3dpp.FrontBufferFormat = (D3DFORMAT)MAKESRGBFMT(D3DFMT_LE_X8R8G8B8);
vid->d3dpp.BackBufferWidth = vid->video_mode.fIsHiDef ? 1280 : 640;
vid->d3dpp.BackBufferHeight = vid->video_mode.fIsHiDef ? 720 : 480;
vid->d3dpp.BackBufferFormat = g_console.gamma_correction_enable ? (D3DFORMAT)MAKESRGBFMT(D3DFMT_A8R8G8B8) : D3DFMT_A8R8G8B8;
vid->d3dpp.FrontBufferFormat = g_console.gamma_correction_enable ? (D3DFORMAT)MAKESRGBFMT(D3DFMT_LE_X8R8G8B8) : D3DFMT_LE_X8R8G8B8;
vid->d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
vid->d3dpp.MultiSampleQuality = 0;
vid->d3dpp.BackBufferCount = 2;

View File

@ -192,6 +192,7 @@ struct console_settings
bool force_resize_enable;
#endif
bool frame_advance_enable;
bool gamma_correction_enable;
bool initialize_ssnes_enable;
bool ingame_menu_enable;
bool menu_enable;