(360) Move xdk360_input_loop to menu.cpp

This commit is contained in:
TwinAphex51224 2012-06-28 18:53:35 +02:00
parent c0f10f41ed
commit 4293872f5c
3 changed files with 40 additions and 42 deletions

View File

@ -847,6 +847,45 @@ void menu_free (void)
app.Uninit(); app.Uninit();
} }
static void ingame_menu_resize (void)
{
XINPUT_STATE state;
XInputGetState(0, &state);
if(state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT || state.Gamepad.sThumbLX < -DEADZONE)
g_console.viewports.custom_vp.x -= 1;
else if (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT || state.Gamepad.sThumbLX > DEADZONE)
g_console.viewports.custom_vp.x += 1;
if (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP || state.Gamepad.sThumbLY > DEADZONE)
g_console.viewports.custom_vp.y += 1;
else if (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN || state.Gamepad.sThumbLY < -DEADZONE)
g_console.viewports.custom_vp.y -= 1;
if (state.Gamepad.sThumbRX < -DEADZONE || state.Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_THUMB)
g_console.viewports.custom_vp.width -= 1;
else if (state.Gamepad.sThumbRX > DEADZONE || state.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB)
g_console.viewports.custom_vp.width += 1;
if (state.Gamepad.sThumbRY > DEADZONE || state.Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_SHOULDER)
g_console.viewports.custom_vp.height += 1;
else if (state.Gamepad.sThumbRY < -DEADZONE || state.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER)
g_console.viewports.custom_vp.height -= 1;
if (state.Gamepad.wButtons & XINPUT_GAMEPAD_Y)
{
g_console.viewports.custom_vp.x = 0;
g_console.viewports.custom_vp.y = 0;
g_console.viewports.custom_vp.width = 1280; //FIXME: hardcoded
g_console.viewports.custom_vp.height = 720; //FIXME: hardcoded
}
if(state.Gamepad.wButtons & XINPUT_GAMEPAD_B)
{
g_console.input_loop = INPUT_LOOP_MENU;
}
}
void menu_loop(void) void menu_loop(void)
{ {
HRESULT hr; HRESULT hr;
@ -887,7 +926,7 @@ void menu_loop(void)
XuiSceneNavigateBack(hCur, app.hMainScene, XUSER_INDEX_ANY); XuiSceneNavigateBack(hCur, app.hMainScene, XUSER_INDEX_ANY);
break; break;
case INPUT_LOOP_RESIZE_MODE: case INPUT_LOOP_RESIZE_MODE:
xdk360_input_loop(); ingame_menu_resize();
break; break;
default: default:
break; break;

View File

@ -22,7 +22,6 @@
#include "../libretro.h" #include "../libretro.h"
#include "../console/retroarch_console.h" #include "../console/retroarch_console.h"
#include "xdk360_input.h" #include "xdk360_input.h"
#include "frontend-xdk/menu.h"
static uint64_t state[4]; static uint64_t state[4];
static unsigned pads_connected; static unsigned pads_connected;
@ -100,45 +99,6 @@ void xdk360_input_map_dpad_to_stick(uint32_t map_dpad_enum, uint32_t controller_
} }
} }
void xdk360_input_loop(void)
{
XINPUT_STATE state;
XInputGetState(0, &state);
if(state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT || state.Gamepad.sThumbLX < -DEADZONE)
g_console.viewports.custom_vp.x -= 1;
else if (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT || state.Gamepad.sThumbLX > DEADZONE)
g_console.viewports.custom_vp.x += 1;
if (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP || state.Gamepad.sThumbLY > DEADZONE)
g_console.viewports.custom_vp.y += 1;
else if (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN || state.Gamepad.sThumbLY < -DEADZONE)
g_console.viewports.custom_vp.y -= 1;
if (state.Gamepad.sThumbRX < -DEADZONE || state.Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_THUMB)
g_console.viewports.custom_vp.width -= 1;
else if (state.Gamepad.sThumbRX > DEADZONE || state.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB)
g_console.viewports.custom_vp.width += 1;
if (state.Gamepad.sThumbRY > DEADZONE || state.Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_SHOULDER)
g_console.viewports.custom_vp.height += 1;
else if (state.Gamepad.sThumbRY < -DEADZONE || state.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER)
g_console.viewports.custom_vp.height -= 1;
if (state.Gamepad.wButtons & XINPUT_GAMEPAD_Y)
{
g_console.viewports.custom_vp.x = 0;
g_console.viewports.custom_vp.y = 0;
g_console.viewports.custom_vp.width = 1280; //FIXME: hardcoded
g_console.viewports.custom_vp.height = 720; //FIXME: hardcoded
}
if(state.Gamepad.wButtons & XINPUT_GAMEPAD_B)
{
g_console.input_loop = INPUT_LOOP_MENU;
}
}
static bool xdk360_key_pressed(void *data, int key) static bool xdk360_key_pressed(void *data, int key)
{ {
(void)data; (void)data;

View File

@ -30,6 +30,5 @@
#define DEADZONE (16000) #define DEADZONE (16000)
extern void xdk360_input_map_dpad_to_stick(uint32_t map_dpad_enum, uint32_t controller_id); extern void xdk360_input_map_dpad_to_stick(uint32_t map_dpad_enum, uint32_t controller_id);
extern void xdk360_input_loop(void);
#endif #endif