(360) Can exit back to menu and load another ROM with thumb stick

left + thumb stick right - loads several ROMs fine but might still
be crash-prone
This commit is contained in:
TwinAphex51224 2012-02-08 18:52:42 +01:00
parent 315b28862a
commit dc1a32f7f7
3 changed files with 17 additions and 6 deletions

View File

@ -209,6 +209,7 @@ int main(int argc, char *argv[])
begin_loop: begin_loop:
if(g_console.mode_switch == MODE_EMULATION) if(g_console.mode_switch == MODE_EMULATION)
{ {
input_xdk360.poll(NULL);
while(ssnes_main_iterate()); while(ssnes_main_iterate());
} }
else if(g_console.mode_switch == MODE_MENU) else if(g_console.mode_switch == MODE_MENU)
@ -220,12 +221,9 @@ begin_loop:
if(g_emulator_initialized) if(g_emulator_initialized)
ssnes_main_deinit(); ssnes_main_deinit();
struct ssnes_main_wrap args; struct ssnes_main_wrap args = {0};
args.verbose = g_extern.verbose;
args.sram_path = NULL;
args.state_path = NULL;
args.config_path = NULL;
args.verbose = g_extern.verbose;
args.rom_path = g_console.rom_path; args.rom_path = g_console.rom_path;
int init_ret = ssnes_main_init_wrap(&args); int init_ret = ssnes_main_init_wrap(&args);

View File

@ -124,6 +124,7 @@ HRESULT CSSNESFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled )
{ {
memset(strbuffer, 0, sizeof(strbuffer)); memset(strbuffer, 0, sizeof(strbuffer));
wcstombs(strbuffer, (const wchar_t *)m_romlist.GetText(index), sizeof(strbuffer)); 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); sprintf(g_console.rom_path, "%s%s", g_console.default_rom_startup_dir, strbuffer);
g_console.menu_enable = false; g_console.menu_enable = false;
g_console.mode_switch = MODE_EMULATION; g_console.mode_switch = MODE_EMULATION;

View File

@ -20,7 +20,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <xtl.h> #include <xtl.h>
#include "../driver.h" #include "../driver.h"
#include "../general.h"
#include "../libsnes.hpp" #include "../libsnes.hpp"
#include "shared.h"
static XINPUT_STATE state[4]; static XINPUT_STATE state[4];
@ -109,7 +111,17 @@ static void* xdk360_input_init(void)
static bool xdk360_key_pressed(void *data, int key) static bool xdk360_key_pressed(void *data, int key)
{ {
(void)data; (void)data;
(void)key;
switch(key)
{
case SSNES_QUIT_KEY:
g_console.menu_enable = ((state[0].Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_THUMB)
&& (state[0].Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB));
g_console.mode_switch = g_console.menu_enable ? MODE_MENU : MODE_EMULATION;
return g_console.menu_enable;
default:
return false;
}
return false; return false;
} }