From 4293872f5cd1ef74037c9b43ba6e6b263c4b4d48 Mon Sep 17 00:00:00 2001 From: TwinAphex51224 Date: Thu, 28 Jun 2012 18:53:35 +0200 Subject: [PATCH] (360) Move xdk360_input_loop to menu.cpp --- 360/frontend-xdk/menu.cpp | 41 ++++++++++++++++++++++++++++++++++++++- 360/xdk360_input.c | 40 -------------------------------------- 360/xdk360_input.h | 1 - 3 files changed, 40 insertions(+), 42 deletions(-) diff --git a/360/frontend-xdk/menu.cpp b/360/frontend-xdk/menu.cpp index 5b5ebc2367..2cf4a92fa3 100644 --- a/360/frontend-xdk/menu.cpp +++ b/360/frontend-xdk/menu.cpp @@ -847,6 +847,45 @@ void menu_free (void) 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) { HRESULT hr; @@ -887,7 +926,7 @@ void menu_loop(void) XuiSceneNavigateBack(hCur, app.hMainScene, XUSER_INDEX_ANY); break; case INPUT_LOOP_RESIZE_MODE: - xdk360_input_loop(); + ingame_menu_resize(); break; default: break; diff --git a/360/xdk360_input.c b/360/xdk360_input.c index dff39336ea..d7c9b12dbd 100644 --- a/360/xdk360_input.c +++ b/360/xdk360_input.c @@ -22,7 +22,6 @@ #include "../libretro.h" #include "../console/retroarch_console.h" #include "xdk360_input.h" -#include "frontend-xdk/menu.h" static uint64_t state[4]; 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) { (void)data; diff --git a/360/xdk360_input.h b/360/xdk360_input.h index ae25f017b6..6ac6535b4d 100644 --- a/360/xdk360_input.h +++ b/360/xdk360_input.h @@ -30,6 +30,5 @@ #define DEADZONE (16000) extern void xdk360_input_map_dpad_to_stick(uint32_t map_dpad_enum, uint32_t controller_id); -extern void xdk360_input_loop(void); #endif