Revert "Remove platform-specific MAX_PADS - use global define MAX_PLAYERS"

This reverts commit fb1355b9755ffd0b919945b155b17350f3a2d5e2.
This commit is contained in:
twinaphex 2013-03-16 17:51:45 +01:00
parent f028a8555e
commit ad2cd4e492
10 changed files with 40 additions and 33 deletions

View File

@ -39,10 +39,10 @@ typedef struct
#define PRESSED_RIGHT(x, y) ((x >= dzone_max))
static unsigned pads_connected;
static int state_device_ids[MAX_PLAYERS];
static uint64_t state[MAX_PLAYERS];
static int state_device_ids[MAX_PADS];
static uint64_t state[MAX_PADS];
static uint64_t keycode_lut[LAST_KEYCODE];
dpad_values_t dpad_state[MAX_PLAYERS];
dpad_values_t dpad_state[MAX_PADS];
struct input_pointer
@ -237,7 +237,7 @@ static void *android_input_init(void)
if (!g_settings.input.autodetect_enable)
{
for (j = 0; j < MAX_PLAYERS; j++)
for (j = 0; j < MAX_PADS; j++)
{
uint8_t shift = 8 + (j * 8);
for (k = 0; k < RARCH_FIRST_CUSTOM_BIND; k++)
@ -251,7 +251,7 @@ static void *android_input_init(void)
}
}
for(i = 0; i < MAX_PLAYERS; i++)
for(i = 0; i < MAX_PADS; i++)
{
for(j = 0; j < RARCH_FIRST_META_KEY; j++)
{

View File

@ -75,7 +75,7 @@ void input_autodetect_setup (void *data, char *msg, size_t sizeof_msg, unsigned
char name_buf[256];
name_buf[0] = 0;
if (port > MAX_PLAYERS)
if (port > MAX_PADS)
{
snprintf(msg, sizeof_msg, "Max number of pads reached.\n");
return;

View File

@ -17,6 +17,8 @@
#ifndef _ANDROID_INPUT_AUTODETECT_H
#define _ANDROID_INPUT_AUTODETECT_H
#define MAX_PADS 8
#define AKEY_EVENT_NO_ACTION 255
enum {

View File

@ -99,13 +99,7 @@
extern "C" {
#endif
#if defined(_XBOX) || defined(GEKKO)
#define MAX_PLAYERS 4
#elif defined(PSP)
#define MAX_PLAYERS 1
#else
#define MAX_PLAYERS 8
#endif
enum menu_enums
{

View File

@ -36,7 +36,9 @@
#define GC_JOYSTICK_THRESHOLD 48
#define WII_JOYSTICK_THRESHOLD 40
static uint64_t pad_state[MAX_PLAYERS];
#define MAX_PADS 4
static uint64_t pad_state[MAX_PADS];
const struct platform_bind platform_keys[] = {
{ GX_GC_A, "GC A button" },
@ -137,7 +139,7 @@ static int16_t gx_input_state(void *data, const struct retro_keybind **binds,
(void)data;
(void)index;
if (port >= MAX_PLAYERS || device != RETRO_DEVICE_JOYPAD)
if (port >= MAX_PADS || device != RETRO_DEVICE_JOYPAD)
return 0;
return (binds[port][id].joykey & pad_state[port]) ? 1 : 0;
@ -451,7 +453,7 @@ static void *gx_input_init(void)
driver.input->set_keybinds(driver.input_data, 0, i, 0,
(1ULL << KEYBINDS_ACTION_SET_DEFAULT_BINDS));
for(unsigned i = 0; i < MAX_PLAYERS; i++)
for(unsigned i = 0; i < MAX_PADS; i++)
{
unsigned keybind_action = 0;
@ -495,7 +497,7 @@ static void gx_input_poll(void *data)
WPAD_ReadPending(WPAD_CHAN_ALL, NULL);
#endif
for (unsigned port = 0; port < MAX_PLAYERS; port++)
for (unsigned port = 0; port < MAX_PADS; port++)
{
uint32_t down = 0;
uint64_t *state_cur = &pad_state[port];

View File

@ -104,7 +104,7 @@ const struct platform_bind platform_keys[] = {
{ (1ULL << RETRO_DEVICE_ID_JOYPAD_DOWN) | (1ULL << RARCH_ANALOG_RIGHT_Y_DPAD_DOWN), "RStick D-Pad Down" },
};
static uint64_t state[MAX_PLAYERS];
static uint64_t state[MAX_PADS];
static unsigned pads_connected;
#ifdef HAVE_MOUSE
static unsigned mice_connected;
@ -115,7 +115,7 @@ static void ps3_input_poll(void *data)
CellPadInfo2 pad_info;
(void)data;
for (unsigned i = 0; i < MAX_PLAYERS; i++)
for (unsigned i = 0; i < MAX_PADS; i++)
{
static CellPadData state_tmp;
cellPadGetData(i, &state_tmp);
@ -508,7 +508,7 @@ static void ps3_input_set_keybinds(void *data, unsigned device,
static void* ps3_input_init(void)
{
cellPadInit(MAX_PLAYERS);
cellPadInit(MAX_PADS);
#ifdef HAVE_MOUSE
cellMouseInit(MAX_MICE);
#endif
@ -518,7 +518,7 @@ static void* ps3_input_init(void)
driver.input->set_keybinds(driver.input_data, 0, i, 0,
(1ULL << KEYBINDS_ACTION_SET_DEFAULT_BINDS));
for(unsigned i = 0; i < MAX_PLAYERS; i++)
for(unsigned i = 0; i < MAX_PADS; i++)
{
unsigned keybind_action = 0;

View File

@ -22,6 +22,10 @@
#include "sdk_defines.h"
#ifndef __PSL1GHT__
#define MAX_PADS 7
#endif
#define DEADZONE_LOW 55
#define DEADZONE_HIGH 210

View File

@ -35,6 +35,8 @@
#define ANALOGSTICK_DEADZONE_LOW (0x40)
#define ANALOGSTICK_DEADZONE_HIGH (0xc0)
#define MAX_PADS 1
const struct platform_bind platform_keys[] = {
{ PSP_GAMEPAD_CIRCLE, "Circle button" },
{ PSP_GAMEPAD_CROSS, "Cross button" },
@ -172,7 +174,7 @@ static void* psp_input_initialize(void)
driver.input->set_keybinds(driver.input_data, 0, i, 0,
(1ULL << KEYBINDS_ACTION_SET_DEFAULT_BINDS));
for(unsigned i = 0; i < MAX_PLAYERS; i++)
for(unsigned i = 0; i < MAX_PADS; i++)
{
unsigned keybind_action = 0;

View File

@ -21,6 +21,7 @@
#include <xtl.h>
#endif
#define MAX_PADS 4
#define DEADZONE (16000)
#include "../driver.h"
@ -28,14 +29,14 @@
#include "../libretro.h"
static uint64_t state[MAX_PLAYERS];
static uint64_t state[MAX_PADS];
unsigned pads_connected;
#ifdef _XBOX1
static HANDLE gamepads[MAX_PLAYERS];
static HANDLE gamepads[MAX_PADS];
static DWORD dwDeviceMask;
static bool bInserted[MAX_PLAYERS];
static bool bRemoved[MAX_PLAYERS];
static bool bInserted[MAX_PADS];
static bool bRemoved[MAX_PADS];
#endif
const struct platform_bind platform_keys[] = {
@ -88,9 +89,9 @@ static void xdk_input_poll(void *data)
XGetDeviceChanges(XDEVICE_TYPE_GAMEPAD, reinterpret_cast<PDWORD>(&dwInsertions), reinterpret_cast<PDWORD>(&dwRemovals));
for (unsigned i = 0; i < MAX_PLAYERS; i++)
for (unsigned i = 0; i < MAX_PADS; i++)
{
XINPUT_CAPABILITIES caps[MAX_PLAYERS];
XINPUT_CAPABILITIES caps[MAX_PADS];
(void)caps;
// handle removed devices
bRemoved[i] = (dwRemovals & (1<<i)) ? true : false;
@ -167,7 +168,7 @@ static void xdk_input_poll(void *data)
}
}
#elif defined(_XBOX360)
for (unsigned i = 0; i < MAX_PLAYERS; i++)
for (unsigned i = 0; i < MAX_PADS; i++)
{
XINPUT_STATE state_tmp;
pads_connected += (XInputGetState(i, &state_tmp) == ERROR_DEVICE_NOT_CONNECTED) ? 0 : 1;
@ -404,7 +405,7 @@ static void *xdk_input_init(void)
driver.input->set_keybinds(driver.input_data, 0, i, 0,
(1ULL << KEYBINDS_ACTION_SET_DEFAULT_BINDS));
for(unsigned i = 0; i < MAX_PLAYERS; i++)
for(unsigned i = 0; i < MAX_PADS; i++)
{
unsigned keybind_action = 0;

View File

@ -24,12 +24,14 @@
#include <input/input.h>
#include <usb/usbmain.h>
static uint64_t state[MAX_PLAYERS];
#define MAX_PADS 4
static uint64_t state[MAX_PADS];
static void xenon360_input_poll(void *data)
{
(void)data;
for (unsigned i = 0; i < MAX_PLAYERS; i++)
for (unsigned i = 0; i < MAX_PADS; i++)
{
struct controller_data_s pad;
usb_do_poll();
@ -62,7 +64,7 @@ static int16_t xenon360_input_state(void *data, const struct retro_keybind **bin
uint64_t button = binds[player][id].joykey;
int16_t retval = 0;
if(player < MAX_PLAYERS)
if(player < MAX_PADS)
{
switch (device)
{
@ -104,7 +106,7 @@ static void* xenon360_input_init(void)
xenon360_input_set_keybinds(driver.input_data, 0, i,
(1ULL << KEYBINDS_ACTION_SET_DEFAULT_BINDS));
for(unsigned i = 0; i < MAX_PLAYERS; i++)
for(unsigned i = 0; i < MAX_PADS; i++)
{
unsigned keybind_action = 0;