(360) Can now return back to game from the menu by pressing

L3 + R3 (if a ROM has already been loaded)
This commit is contained in:
TwinAphex51224 2012-02-11 15:31:11 +01:00
parent 6e753d7d99
commit 390628b1e3
4 changed files with 26 additions and 2 deletions

View File

@ -299,10 +299,22 @@ void menu_loop(void)
do
{
g_frame_count++;
vid->xdk360_render_device->Clear(0, NULL,
D3DCLEAR_TARGET | D3DCLEAR_STENCIL | D3DCLEAR_ZBUFFER,
D3DCOLOR_ARGB(255, 32, 32, 64), 1.0, 0);
XINPUT_STATE state;
XInputGetState(0, &state);
g_console.menu_enable = !((state.Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_THUMB)
&& (state.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB) && (g_console.emulator_initialized)
&& 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(60);
app.RunFrame(); /* Update XUI */
hr = app.Render(); /* Render XUI */
hr = XuiTimersRun(); /* Update XUI timers */

View File

@ -22,6 +22,7 @@
#include "../driver.h"
#include "../general.h"
#include "../libsnes.hpp"
#include "xdk360_video.h"
#include "shared.h"
static XINPUT_STATE state[4];
@ -130,8 +131,14 @@ static bool xdk360_key_pressed(void *data, int key)
return ((state[0].Gamepad.sThumbRY > DEADZONE) && !(state[0].Gamepad.bRightTrigger > 128));
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;
&& (state[0].Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB) && IS_TIMER_EXPIRED());
if(g_console.menu_enable)
{
g_console.mode_switch = MODE_MENU;
SET_TIMER_EXPIRATION(60);
}
else
g_console.mode_switch = MODE_EMULATION;
return g_console.menu_enable;
default:
return false;

View File

@ -32,9 +32,13 @@ typedef struct xdk360_video
D3DPRESENT_PARAMETERS d3dpp;
} xdk360_video_t;
#define IS_TIMER_EXPIRED() (!(g_frame_count < g_console.timer_expiration_frame_count))
#define SET_TIMER_EXPIRATION(value) g_console.timer_expiration_frame_count = g_frame_count + value;
void xdk360_video_init(void);
void xdk360_video_deinit(void);
extern unsigned g_frame_count;
extern void *g_d3d;
#endif

View File

@ -192,6 +192,7 @@ struct console_settings
uint32_t mode_switch;
uint32_t *supported_resolutions;
uint32_t supported_resolutions_count;
uint32_t timer_expiration_frame_count;
#ifdef _XBOX
DWORD volume_device_type;
#endif