From 2797ec3a79e15f8e132b7dadac0387849f4457f0 Mon Sep 17 00:00:00 2001 From: TwinAphex51224 Date: Tue, 24 Jan 2012 00:29:03 +0100 Subject: [PATCH] (360) file browser button now goes to ROM loading/emulation state --- 360/main.c | 48 ++++++++++++++++++++++++++++++++++++------------ 360/menu.cpp | 6 ++++-- 360/menu.h | 5 +++-- 3 files changed, 43 insertions(+), 16 deletions(-) diff --git a/360/main.c b/360/main.c index 879aa5947d..4656a7f321 100644 --- a/360/main.c +++ b/360/main.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include "menu.h" @@ -46,7 +47,9 @@ typedef struct _STRING { extern "C" int __stdcall ObCreateSymbolicLink( STRING*, STRING*); uint32_t mode_switch = MODE_MENU; +bool init_ssnes = false; int Mounted[20]; +uint32_t g_emulator_initialized = 0; int ssnes_main(int argc, char *argv[]); @@ -148,18 +151,39 @@ int main(int argc, char *argv[]) xdk360_video_init(); menu_init(); - //menu_loop(); - char arg1[] = "ssnes"; - char arg2[] = "d:\\roms\\mario.sfc"; - char arg3[] = "-v"; - char arg4[] = "-c"; - char arg5[] = "d:\\ssnes.cfg"; - char *argv_[] = { arg1, arg2, arg3, arg4, arg5, NULL }; - int argc_ = sizeof(argv_) / sizeof(argv_[0]) - 1; - int init_ret = ssnes_main_init(argc_, argv_); - while(ssnes_main_iterate()); - ssnes_main_deinit(); - xdk360_video_deinit(); +begin_loop: + if(mode_switch == MODE_EMULATION) + { + while(ssnes_main_iterate()); + } + else if(mode_switch == MODE_MENU) + { + menu_loop(); + + if(init_ssnes) + { + if(g_emulator_initialized) + ssnes_main_deinit(); + + char arg1[] = "ssnes"; + char arg2[] = "d:\\roms\\mario.sfc"; + char arg3[] = "-v"; + char arg4[] = "-c"; + char arg5[] = "d:\\ssnes.cfg"; + char *argv_[] = { arg1, arg2, arg3, arg4, arg5, NULL }; + int argc_ = sizeof(argv_) / sizeof(argv_[0]) - 1; + int init_ret = ssnes_main_init(argc_, argv_); + g_emulator_initialized = 1; + init_ssnes = 0; + } + } + else + goto begin_shutdown; + + goto begin_loop; + +begin_shutdown: + xdk360_video_deinit(); } diff --git a/360/menu.cpp b/360/menu.cpp index 8d4a07d218..cdd3a24932 100644 --- a/360/menu.cpp +++ b/360/menu.cpp @@ -20,6 +20,7 @@ #include #include "xdk360_video.h" #include "menu.h" +#include "shared.h" CSSNES app; HXUIOBJ hMainScene; @@ -42,7 +43,7 @@ HRESULT CSSNES::UnregisterXuiClasses (void) HRESULT CMyMainScene::OnInit(XUIMessageInit * pInitData, BOOL& bHandled) { GetChildById(L"XuiBtnRomBrowser", &m_filebrowser); - GetChildByid(L"XuiBtnSettings", &m_settings); + GetChildById(L"XuiBtnSettings", &m_settings); GetChildById(L"XuiBtnQuit", &m_quit); GetChildById(L"XuiTxtTitle", &m_title); @@ -51,10 +52,11 @@ HRESULT CMyMainScene::OnInit(XUIMessageInit * pInitData, BOOL& bHandled) HRESULT CMyMainScene::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled ) { - if ( hObjPressed == m_filebrowser ) { menu_is_running = false; + mode_switch = MODE_EMULATION; + init_ssnes = 1; } bHandled = TRUE; diff --git a/360/menu.h b/360/menu.h index 8366dea83c..fef3c494df 100644 --- a/360/menu.h +++ b/360/menu.h @@ -17,11 +17,12 @@ class CMyMainScene: public CXuiSceneImpl { protected: CXuiControl m_filebrowser; - CxuiControl m_settings; + CXuiControl m_settings; CXuiControl m_quit; - CxuiTextElemet m_title; + CXuiTextElement m_title; public: HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled ); + HRESULT OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled ); XUI_BEGIN_MSG_MAP() XUI_ON_XM_INIT( OnInit)