Wii: Bump MAXJOYAXES to 9 to avoid menu corruption, and fix _functio.h, CONFIG_FunctionNameToNum, CONFIG_AnalogNameToNum, so that this does not crash.

git-svn-id: https://svn.eduke32.com/eduke32@4827 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2014-12-18 18:16:16 +00:00
parent eca33954db
commit 989f182eb4
5 changed files with 30 additions and 154 deletions

View file

@ -681,9 +681,10 @@ int32_t initinput(void)
SDL_JoystickEventState(SDL_ENABLE);
inputdevices |= 4;
joynumaxes = SDL_JoystickNumAxes(joydev);
// KEEPINSYNC source/gamedefs.h, source/jmact/_control.h
joynumaxes = min(9, SDL_JoystickNumAxes(joydev));
joynumbuttons = min(32, SDL_JoystickNumButtons(joydev));
joynumhats = SDL_JoystickNumHats(joydev);
joynumhats = min((36-joynumbuttons)/4,SDL_JoystickNumHats(joydev));
initprintf("Joystick 1 has %d axes, %d buttons, and %d hat(s).\n", joynumaxes, joynumbuttons, joynumhats);
joyaxis = (int32_t *)Bcalloc(joynumaxes, sizeof(int32_t));

View file

@ -27,6 +27,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// default button assignments and game function names
// axis defaults are also included
#include "_control.h"
#include "control.h"
#ifndef function_private_h_
#define function_private_h_
@ -218,7 +220,7 @@ const char oldkeydefaults[NUMGAMEFUNCTIONS*3][MAXGAMEFUNCLEN] =
"Dpad_Aiming", "", "",
};
static const char * mousedefaults[] =
static const char * mousedefaults[MAXMOUSEBUTTONS] =
{
"Fire",
"MedKit",
@ -226,45 +228,27 @@ static const char * mousedefaults[] =
"",
"Previous_Weapon",
"Next_Weapon",
"",
"",
"",
""
};
static const char * mouseclickeddefaults[] =
static const char * mouseclickeddefaults[MAXMOUSEBUTTONS] =
{
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
};
static const char * mouseanalogdefaults[] =
static const char * mouseanalogdefaults[MAXMOUSEAXES] =
{
"analog_turning",
"analog_moving",
};
static const char * mousedigitaldefaults[] =
static const char * mousedigitaldefaults[MAXMOUSEDIGITAL] =
{
"",
"",
"",
"",
};
#if defined(GEKKO)
static const char * joystickdefaults[] =
static const char * joystickdefaults[MAXJOYBUTTONSANDHATS] =
{
"Open", // A
"Fire", // B
@ -285,27 +269,10 @@ static const char * joystickdefaults[] =
"Inventory_Right", // D-Pad Right
"Inventory", // D-Pad Down
"Inventory_Left", // D-Pad Left
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
};
static const char * joystickclickeddefaults[] =
static const char * joystickclickeddefaults[MAXJOYBUTTONSANDHATS] =
{
"",
"",
@ -320,74 +287,23 @@ static const char * joystickclickeddefaults[] =
"",
"",
"Inventory",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
};
static const char * joystickanalogdefaults[] =
static const char * joystickanalogdefaults[MAXJOYAXES] =
{
"analog_strafing",
"analog_moving",
"analog_turning",
"analog_lookingupanddown",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
};
static const char * joystickdigitaldefaults[] =
static const char * joystickdigitaldefaults[MAXJOYDIGITAL] =
{
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
};
#else
static const char * joystickdefaults[] =
static const char * joystickdefaults[MAXJOYBUTTONSANDHATS] =
{
"Fire",
"Strafe",
@ -428,61 +344,24 @@ static const char * joystickdefaults[] =
};
static const char * joystickclickeddefaults[] =
static const char * joystickclickeddefaults[MAXJOYBUTTONSANDHATS] =
{
"",
"Inventory",
"Jump",
"Crouch",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
};
static const char * joystickanalogdefaults[] =
static const char * joystickanalogdefaults[MAXJOYAXES] =
{
"analog_turning",
"analog_moving",
"analog_strafing",
"",
"",
"",
"",
"",
};
static const char * joystickdigitaldefaults[] =
static const char * joystickdigitaldefaults[MAXJOYDIGITAL] =
{
"",
"",
@ -491,15 +370,6 @@ static const char * joystickdigitaldefaults[] =
"",
"",
"Run",
"",
"",
"",
"",
"",
"",
"",
"",
"",
};
#endif

View file

@ -64,6 +64,9 @@ int32_t CONFIG_FunctionNameToNum(const char *func)
{
int32_t i;
if (!func)
return -1;
i = hash_find(&h_gamefuncs,func);
if (i < 0)
@ -104,6 +107,8 @@ char *CONFIG_FunctionNumToName(int32_t func)
int32_t CONFIG_AnalogNameToNum(const char *func)
{
if (!func)
return -1;
if (!Bstrcasecmp(func,"analog_turning"))
{

View file

@ -46,18 +46,18 @@ extern "C" {
#define SETUPFILENAME "eduke32.cfg"
// Number of JOY buttons
// KEEPINSYNC jmact/_control.h
// KEEPINSYNC source/jmact/_control.h, build/src/sdlayer.c
#define MAXJOYBUTTONS 32
#define MAXJOYBUTTONSANDHATS (MAXJOYBUTTONS+4)
// Number of Mouse Axes
// KEEPINSYNC jmact/_control.h
// KEEPINSYNC source/jmact/_control.h, build/src/sdlayer.c
#define MAXMOUSEAXES 2
#define MAXMOUSEDIGITAL (MAXMOUSEAXES*2)
// Number of JOY axes
// KEEPINSYNC jmact/_control.h
#define MAXJOYAXES 8
// KEEPINSYNC source/jmact/_control.h, build/src/sdlayer.c
#define MAXJOYAXES 9
#define MAXJOYDIGITAL (MAXJOYAXES*2)
// DEFAULT mouse sensitivity scale

View file

@ -64,18 +64,18 @@ extern "C" {
//#define MAXMOUSEBUTTONS 10
// Number of Mouse Axes
// KEEPINSYNC gamedefs.h
// KEEPINSYNC source/gamedefs.h, build/src/sdlayer.c
#define MAXMOUSEAXES 2
#define MAXMOUSEDIGITAL (MAXMOUSEAXES*2)
// Number of JOY buttons
// KEEPINSYNC gamedefs.h
// KEEPINSYNC source/gamedefs.h, build/src/sdlayer.c
#define MAXJOYBUTTONS 32
#define MAXJOYBUTTONSANDHATS (MAXJOYBUTTONS+4)
// Number of JOY axes
// KEEPINSYNC gamedefs.h
#define MAXJOYAXES 8
// KEEPINSYNC source/gamedefs.h, build/src/sdlayer.c
#define MAXJOYAXES 9
#define MAXJOYDIGITAL (MAXJOYAXES*2)
// NORMAL axis scale