Merge branch 'master' into ratecontrol

This commit is contained in:
Themaister 2012-02-14 16:58:55 +01:00
commit 16c740ffd8
9 changed files with 277 additions and 41 deletions

View File

@ -341,8 +341,6 @@ begin_loop:
if(g_console.mode_switch == MODE_EMULATION)
{
bool repeat = false;
if(g_console.ingame_menu_item != 0)
g_console.ingame_menu_enable = true;
input_xdk360.poll(NULL);

View File

@ -14,20 +14,21 @@
<XuiButton>
<Properties>
<Id>XuiBtnRomBrowser</Id>
<Width>481.112000</Width>
<Width>488.312012</Width>
<Height>38.000000</Height>
<Position>43.887970,58.455994,0.000000</Position>
<Position>38.127724,64.215515,0.000000</Position>
<Pivot>245.362122,102.247192,0.000000</Pivot>
<NavUp>XuiBtnQuit</NavUp>
<NavDown>XuiBtnSettings</NavDown>
<NavDown>XuiBtnQuickMenu</NavDown>
<Text>ROM Browser</Text>
</Properties>
</XuiButton>
<XuiText>
<Properties>
<Id>XuiTxtTitle</Id>
<Width>240.000000</Width>
<Width>247.200012</Width>
<Height>40.000000</Height>
<Position>49.341614,15.399994,0.000000</Position>
<Position>43.581604,21.159988,0.000000</Position>
<Text>SSNES 360</Text>
<TextColor>0xff0f0f0f</TextColor>
<DropShadowColor>0x800f0f0f</DropShadowColor>
@ -38,10 +39,10 @@
<XuiButton>
<Properties>
<Id>XuiBtnSettings</Id>
<Width>481.112000</Width>
<Width>488.312012</Width>
<Height>38.000000</Height>
<Position>43.887970,109.855988,0.000000</Position>
<NavUp>XuiBtnRomBrowser</NavUp>
<Position>38.127960,201.615982,0.000000</Position>
<NavUp>XuiBtnControls</NavUp>
<NavDown>XuiBtnQuit</NavDown>
<Text>Settings</Text>
</Properties>
@ -49,9 +50,10 @@
<XuiButton>
<Properties>
<Id>XuiBtnQuit</Id>
<Width>481.112000</Width>
<Width>488.312012</Width>
<Height>38.000000</Height>
<Position>44.087982,158.855988,0.000000</Position>
<Position>38.327736,246.007980,0.000000</Position>
<Pivot>245.162109,-84.153275,0.000000</Pivot>
<NavUp>XuiBtnSettings</NavUp>
<NavDown>XuiBtnRomBrowser</NavDown>
<Text>Quit</Text>
@ -77,5 +79,27 @@
<Font>Arial Unicode MS</Font>
</Properties>
</XuiText>
<XuiButton>
<Properties>
<Id>XuiBtnQuickMenu</Id>
<Width>488.312012</Width>
<Height>38.000000</Height>
<Position>38.130001,111.655991,0.000000</Position>
<NavUp>XuiBtnRomBrowser</NavUp>
<NavDown>XuiBtnControls</NavDown>
<Text>Quick Menu</Text>
</Properties>
</XuiButton>
<XuiButton>
<Properties>
<Id>XuiBtnControls</Id>
<Width>488.312012</Width>
<Height>38.000000</Height>
<Position>38.130001,156.655991,0.000000</Position>
<NavUp>XuiBtnQuickMenu</NavUp>
<NavDown>XuiBtnSettings</NavDown>
<Text>Controls</Text>
</Properties>
</XuiButton>
</XuiScene>
</XuiCanvas>

View File

@ -0,0 +1,121 @@
<XuiCanvas version="000c">
<Properties>
<Width>1280.000000</Width>
<Height>720.000000</Height>
</Properties>
<XuiScene>
<Properties>
<Id>XuiScene1</Id>
<Width>584.528076</Width>
<Height>363.320007</Height>
<Position>347.429474,184.843964,0.000000</Position>
<ClassOverride>SSNESQuickMenu</ClassOverride>
</Properties>
<XuiButton>
<Properties>
<Id>XuiBtnLoadState</Id>
<Width>488.312012</Width>
<Height>38.000000</Height>
<Position>38.127724,64.215515,0.000000</Position>
<Pivot>245.362122,102.247192,0.000000</Pivot>
<NavLeft>XuiBackButton</NavLeft>
<NavRight>XuiBackButton</NavRight>
<NavUp>XuiBtnReturnToGame</NavUp>
<NavDown>XuiBtnSaveState</NavDown>
<Text>Load State #0</Text>
</Properties>
</XuiButton>
<XuiText>
<Properties>
<Id>XuiTxtTitle</Id>
<Width>121.056023</Width>
<Height>40.000000</Height>
<Position>43.581604,21.159988,0.000000</Position>
<Text>Quick Menu</Text>
<TextColor>0xff0f0f0f</TextColor>
<DropShadowColor>0x800f0f0f</DropShadowColor>
<Font>Arial Unicode MS</Font>
<TextStyle>21</TextStyle>
</Properties>
</XuiText>
<XuiButton>
<Properties>
<Id>XuiBtnFrameAdvance</Id>
<Width>488.312012</Width>
<Height>38.000000</Height>
<Position>38.127960,201.615982,0.000000</Position>
<NavLeft>XuiBackButton</NavLeft>
<NavRight>XuiBackButton</NavRight>
<NavUp>XuiBtnFilteringShader</NavUp>
<NavDown>XuiBtnReturnToGame</NavDown>
<Text>Frame Advance</Text>
</Properties>
</XuiButton>
<XuiButton>
<Properties>
<Id>XuiBtnReturnToGame</Id>
<Width>488.312012</Width>
<Height>38.000000</Height>
<Position>38.327736,246.007980,0.000000</Position>
<Pivot>245.162109,-84.153275,0.000000</Pivot>
<NavLeft>XuiBackButton</NavLeft>
<NavRight>XuiBackButton</NavRight>
<NavUp>XuiBtnFrameAdvance</NavUp>
<NavDown>XuiBtnLoadState</NavDown>
<Text>Return to Game</Text>
</Properties>
</XuiButton>
<XuiButton>
<Properties>
<Id>XuiBtnSaveState</Id>
<Width>488.312012</Width>
<Height>38.000000</Height>
<Position>38.130001,111.655991,0.000000</Position>
<NavLeft>XuiBackButton</NavLeft>
<NavRight>XuiBackButton</NavRight>
<NavUp>XuiBtnLoadState</NavUp>
<NavDown>XuiBtnFilteringShader</NavDown>
<Text>Save State #0</Text>
</Properties>
</XuiButton>
<XuiButton>
<Properties>
<Id>XuiBtnFilteringShader</Id>
<Width>488.312012</Width>
<Height>38.000000</Height>
<Position>38.130001,156.655991,0.000000</Position>
<NavLeft>XuiBackButton</NavLeft>
<NavRight>XuiBackButton</NavRight>
<NavUp>XuiBtnSaveState</NavUp>
<NavDown>XuiBtnFrameAdvance</NavDown>
</Properties>
</XuiButton>
<XuiText>
<Properties>
<Id>XuiTxtTitle1</Id>
<Width>45.024040</Width>
<Height>40.000000</Height>
<Position>493.581604,21.159988,0.000000</Position>
<Text>1/2</Text>
<TextColor>0xff0f0f0f</TextColor>
<DropShadowColor>0x800f0f0f</DropShadowColor>
<Font>Arial Unicode MS</Font>
<TextStyle>21</TextStyle>
</Properties>
</XuiText>
<XuiBackButton>
<Properties>
<Id>XuiBackButton</Id>
<Width>208.632019</Width>
<Height>36.000000</Height>
<Position>356.670013,309.000000,0.000000</Position>
<NavLeft>XuiBtnLoadState</NavLeft>
<NavRight>XuiBtnLoadState</NavRight>
<NavUp>XuiBtnReturnToGame</NavUp>
<NavDown>XuiBtnLoadState</NavDown>
<Text>Go back to menu</Text>
<PressKey>22593</PressKey>
</Properties>
</XuiBackButton>
</XuiScene>
</XuiCanvas>

View File

@ -33,7 +33,7 @@
<Visual>XuiBackButton</Visual>
<NavLeft>XuiBtnRewind</NavLeft>
<NavRight>XuiBackButton1</NavRight>
<NavUp>XuiBackButton1</NavUp>
<NavUp>XuiBtnHWFilter</NavUp>
<NavDown>XuiBackButton1</NavDown>
<Text>Go back to menu</Text>
<PressKey>22593</PressKey>
@ -42,7 +42,7 @@
<XuiButton>
<Properties>
<Id>XuiBtnRewind</Id>
<Width>215.000000</Width>
<Width>465.905640</Width>
<Height>38.000000</Height>
<Position>24.447998,58.447998,0.000000</Position>
<NavLeft>XuiBackButton1</NavLeft>
@ -57,13 +57,13 @@
<Id>XuiCheckbox1</Id>
<Width>56.304016</Width>
<Height>50.000000</Height>
<Position>252.000000,58.000000,0.000000</Position>
<Position>507.000000,58.000000,0.000000</Position>
</Properties>
</XuiCheckbox>
<XuiButton>
<Properties>
<Id>XuiBtnHWFilter</Id>
<Width>215.000000</Width>
<Width>465.905640</Width>
<Height>38.000000</Height>
<Position>24.447998,108.447998,0.000000</Position>
<NavLeft>XuiBackButton1</NavLeft>

View File

@ -32,11 +32,19 @@ CSSNES app;
filebrowser_t browser;
char strbuffer[1024];
static void return_to_game (void)
{
g_console.frame_advance_enable = false;
g_console.menu_enable = false;
g_console.mode_switch = MODE_EMULATION;
}
/* Register custom classes */
HRESULT CSSNES::RegisterXuiClasses (void)
{
CSSNESMain::Register();
CSSNESFileBrowser::Register();
CSSNESQuickMenu::Register();
CSSNESSettings::Register();
return S_OK;
}
@ -46,6 +54,7 @@ HRESULT CSSNES::UnregisterXuiClasses (void)
{
CSSNESMain::Unregister();
CSSNESFileBrowser::Unregister();
CSSNESQuickMenu::Register();
CSSNESSettings::Unregister();
return S_OK;
}
@ -88,10 +97,10 @@ static void set_filter_element(int index, CXuiControl * obj)
switch(index)
{
case FALSE:
obj->SetText(L"Point filtering");
obj->SetText(L"Hardware filtering: Point filtering");
break;
case TRUE:
obj->SetText(L"Linear interpolation");
obj->SetText(L"Hardware filtering: Linear interpolation");
break;
}
}
@ -108,13 +117,54 @@ HRESULT CSSNESSettings::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
return S_OK;
}
HRESULT CSSNESQuickMenu::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
{
GetChildById(L"XuiBtnLoadState", &m_loadstate);
GetChildById(L"XuiBtnSaveState", &m_savestate);
GetChildById(L"XuiBtnFilteringShader", &m_hw_filter);
GetChildById(L"XuiBtnFrameAdvance", &m_frame_advance);
GetChildById(L"XuiBtnReturnToGame", &m_return_to_game);
GetChildById(L"XuiBackButton", &m_back);
set_filter_element(g_settings.video.smooth, &m_hw_filter);
return S_OK;
}
HRESULT CSSNESQuickMenu::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled )
{
if ( hObjPressed == m_hw_filter)
g_settings.video.smooth = !g_settings.video.smooth;
else if ( hObjPressed == m_loadstate && g_console.emulator_initialized)
{
ssnes_load_state();
return_to_game();
}
else if ( hObjPressed == m_frame_advance && g_console.emulator_initialized)
{
g_console.frame_advance_enable = true;
g_console.menu_enable = false;
g_console.mode_switch = MODE_EMULATION;
}
else if ( hObjPressed == m_return_to_game && g_console.emulator_initialized)
return_to_game();
else if ( hObjPressed == m_back )
NavigateBack(app.hMainScene);
set_filter_element(g_settings.video.smooth, &m_hw_filter);
bHandled = TRUE;
return S_OK;
}
HRESULT CSSNESMain::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
{
GetChildById(L"XuiBtnRomBrowser", &m_filebrowser);
GetChildById(L"XuiBtnSettings", &m_settings);
GetChildById(L"XuiBtnQuickMenu", &m_quick_menu);
GetChildById(L"XuiBtnControls", &m_controls);
GetChildById(L"XuiBtnQuit", &m_quit);
GetChildById(L"XuiTxtTitle", &m_title);
GetChildById(L"XuiTxtCoreText", &m_core);
const char * core_text = snes_library_id();
char package_version[32];
sprintf(package_version, "SSNES %s", PACKAGE_VERSION);
@ -143,8 +193,8 @@ HRESULT CSSNESFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled )
wcstombs(strbuffer, (const wchar_t *)m_romlist.GetText(index), sizeof(strbuffer));
memset(g_console.rom_path, 0, sizeof(g_console.rom_path));
sprintf(g_console.rom_path, "%s%s", g_console.default_rom_startup_dir, strbuffer);
g_console.menu_enable = false;
g_console.mode_switch = MODE_EMULATION;
return_to_game();
g_console.initialize_ssnes_enable = 1;
}
else if(browser.cur[index].d_type == FILE_ATTRIBUTE_DIRECTORY)
@ -157,9 +207,7 @@ HRESULT CSSNESFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled )
}
}
else if(hObjPressed == m_back)
{
NavigateBack(app.hMainScene);
}
bHandled = TRUE;
return S_OK;
@ -177,16 +225,8 @@ HRESULT CSSNESSettings::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled )
g_settings.video.smooth = !g_settings.video.smooth;
}
else if ( hObjPressed == m_back )
{
HRESULT hr = XuiSceneNavigateBack(app.hSSNESSettings, app.hMainScene, XUSER_INDEX_FOCUS);
if (FAILED(hr))
{
SSNES_ERR("Failed to load scene.\n");
}
NavigateBack(app.hMainScene);
}
set_filter_element(g_settings.video.smooth, &m_hw_filter);
bHandled = TRUE;
return S_OK;
@ -207,6 +247,15 @@ HRESULT CSSNESMain::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled )
NavigateForward(app.hFileBrowser);
}
else if ( hObjPressed == m_quick_menu)
{
hr = XuiSceneCreate(L"file://game:/media/", L"ssnes_quickmenu.xur", NULL, &app.hQuickMenu);
if (FAILED(hr))
SSNES_ERR("Failed to load scene.\n");
NavigateForward(app.hQuickMenu);
}
else if ( hObjPressed == m_settings )
{
hr = XuiSceneCreate(L"file://game:/media/", L"ssnes_settings.xur", NULL, &app.hSSNESSettings);
@ -275,13 +324,13 @@ void menu_loop(void)
HRESULT hr;
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
if(g_console.ingame_menu_enable)
if(g_console.emulator_initialized)
video_xdk360.set_swap_block_state(NULL, true);
do
{
g_frame_count++;
if(g_console.ingame_menu_enable)
if(g_console.emulator_initialized)
ssnes_render_cached_frame();
else
vid->xdk360_render_device->Clear(0, NULL,
@ -296,19 +345,19 @@ void menu_loop(void)
&& IS_TIMER_EXPIRED());
g_console.mode_switch = g_console.menu_enable ? MODE_MENU : MODE_EMULATION;
if(g_console.mode_switch == MODE_EMULATION)
{
SET_TIMER_EXPIRATION(30);
}
app.RunFrame(); /* Update XUI */
hr = app.Render(); /* Render XUI */
hr = XuiTimersRun(); /* Update XUI timers */
if(g_console.mode_switch == MODE_EMULATION && !g_console.frame_advance_enable)
{
SET_TIMER_EXPIRATION(30);
}
video_xdk360.swap(NULL);
}while(g_console.menu_enable);
if(g_console.ingame_menu_enable)
if(g_console.emulator_initialized)
video_xdk360.set_swap_block_state(NULL, false);
g_console.ingame_menu_enable = false;

View File

@ -27,6 +27,7 @@ class CSSNES : public CXuiModule
public:
HXUIOBJ hMainScene;
HXUIOBJ hFileBrowser;
HXUIOBJ hQuickMenu;
HXUIOBJ hSSNESSettings;
protected:
/* Override so that Cssnes can register classes */
@ -39,6 +40,8 @@ class CSSNESMain: public CXuiSceneImpl
{
protected:
CXuiControl m_filebrowser;
CXuiControl m_quick_menu;
CXuiControl m_controls;
CXuiControl m_settings;
CXuiControl m_quit;
CXuiTextElement m_title;
@ -73,6 +76,27 @@ public:
XUI_IMPLEMENT_CLASS(CSSNESFileBrowser, L"SSNESFileBrowser", XUI_CLASS_SCENE)
};
class CSSNESQuickMenu: public CXuiSceneImpl
{
protected:
CXuiControl m_loadstate;
CXuiControl m_savestate;
CXuiControl m_hw_filter;
CXuiControl m_frame_advance;
CXuiControl m_return_to_game;
CXuiControl m_back;
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_IMPLEMENT_CLASS(CSSNESQuickMenu, L"SSNESQuickMenu", XUI_CLASS_SCENE)
};
class CSSNESSettings: public CXuiSceneImpl
{
protected:

View File

@ -107,9 +107,9 @@ static bool xdk360_key_pressed(void *data, int key)
{
g_console.menu_enable = true;
g_console.ingame_menu_enable = true;
g_console.mode_switch = MODE_EMULATION;
g_console.mode_switch = MODE_MENU;
}
return g_console.frame_advance_enable;
return false;
case SSNES_REWIND:
return ((state[0].Gamepad.sThumbRY > DEADZONE) && !(state[0].Gamepad.bRightTrigger > 128));
case SSNES_QUIT_KEY:

View File

@ -498,6 +498,23 @@
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_LTCG|Xbox 360'">$(OutDir)media\Arial_12.xpr;%(Outputs)</Outputs>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\..\360\media\ssnes_quickmenu.xui">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='CodeAnalysis|Xbox 360'">xui2bin /D /NOLOGO "%(RelativeDir)ssnes_quickmenu.xui" "$(OutDir)media\ssnes_quickmenu.xur"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Xbox 360'">xui2bin /D /NOLOGO "%(RelativeDir)ssnes_quickmenu.xui" "$(OutDir)media\ssnes_quickmenu.xur"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Profile|Xbox 360'">xui2bin /D /NOLOGO "%(RelativeDir)ssnes_quickmenu.xui" "$(OutDir)media\ssnes_quickmenu.xur"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Profile_FastCap|Xbox 360'">xui2bin /D /NOLOGO "%(RelativeDir)ssnes_quickmenu.xui" "$(OutDir)media\ssnes_quickmenu.xur"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Xbox 360'">xui2bin /D /NOLOGO "%(RelativeDir)ssnes_quickmenu.xui" "$(OutDir)media\ssnes_quickmenu.xur"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release_LTCG|Xbox 360'">xui2bin /D /NOLOGO "%(RelativeDir)ssnes_quickmenu.xui" "$(OutDir)media\ssnes_quickmenu.xur"</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='CodeAnalysis|Xbox 360'">$(OutDir)media\ssnes_quickmenu.xur;</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Xbox 360'">$(OutDir)media\ssnes_quickmenu.xur;</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Profile|Xbox 360'">$(OutDir)media\ssnes_quickmenu.xur;</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Profile_FastCap|Xbox 360'">$(OutDir)media\ssnes_quickmenu.xur;</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Xbox 360'">$(OutDir)media\ssnes_quickmenu.xur;</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_LTCG|Xbox 360'">$(OutDir)media\ssnes_quickmenu.xur;</Outputs>
</CustomBuild>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View File

@ -258,5 +258,8 @@
<CustomBuild Include="..\..\360\media\Arial_12.rdf">
<Filter>Source Files\media</Filter>
</CustomBuild>
<CustomBuild Include="..\..\360\media\ssnes_quickmenu.xui">
<Filter>Source Files\media</Filter>
</CustomBuild>
</ItemGroup>
</Project>