Conversation
Not sure how safe is that? |
|
At the very least, diff --git a/engine/h2shared/in_sdl.c b/engine/h2shared/in_sdl.c
index b62fd4f..2aac20c 100644
--- a/engine/h2shared/in_sdl.c
+++ b/engine/h2shared/in_sdl.c
@@ -52,7 +52,7 @@ static int buttonremap[] =
static SDL_Joystick *joy_id = NULL;
static int joy_available;
-static cvar_t in_joystick = {"joystick", "1", CVAR_ARCHIVE}; /* enable/disable joystick */
+static cvar_t in_joystick = {"joystick", "0", CVAR_ARCHIVE}; /* enable/disable joystick */
static cvar_t joy_index = {"joy_index", "0", CVAR_NONE}; /* joystick to use when have multiple */
static cvar_t joy_axisforward = {"joy_axisforward", "1", CVAR_NONE}; /* axis for forward/backward movement */
@@ -75,7 +75,7 @@ static cvar_t joy_sensitivityyaw = {"joy_sensitivityyaw", "-1", CVAR_NONE}; /*
/* hack to generate uparrow/leftarrow etc. key events
* for axes if the stick driver isn't generating them. */
/* might be useful for menu navigation etc. */
-#define JOY_KEYEVENT_FOR_AXES 1 /* not for now */
+#define JOY_KEYEVENT_FOR_AXES 1
#if (JOY_KEYEVENT_FOR_AXES)
static cvar_t joy_axiskeyevents = {"joy_axiskeyevents", "1", CVAR_ARCHIVE};
static cvar_t joy_axiskeyevents_deadzone = {"joy_axiskeyevents_deadzone", "0.5", CVAR_ARCHIVE};
@@ -812,6 +812,7 @@ void IN_SendKeyEvents (void)
{
SDL_Event event;
int sym, state, modstate;
+ int joy2key;
qboolean gamekey;
if ((gamekey = Key_IsGameKey()) != prev_gamekey)
@@ -1102,14 +1103,14 @@ void IN_SendKeyEvents (void)
case SDL_JOYBUTTONUP:
if (in_mode_set)
break;
- uint8_t key = 0;
+ joy2key = 0;
switch (K_JOY1 + event.jbutton.button) {
/* Hard code SELECT & START buttons for menu control */
case K_AUX5:
- key = K_ESCAPE;
+ joy2key = K_ESCAPE;
break;
case K_AUX6:
- key = K_ENTER;
+ joy2key = K_ENTER;
}
Con_DPrintf ("Pressed joystick button %s\n", Key_KeynumToString(K_JOY1 + event.jbutton.button));
if (event.jbutton.button > K_AUX28 - K_JOY1)
@@ -1118,7 +1119,7 @@ void IN_SendKeyEvents (void)
event.jbutton.button);
break;
}
- Key_Event(key ? key : (K_JOY1 + event.jbutton.button), event.jbutton.state == SDL_PRESSED);
+ Key_Event(joy2key ? joy2key : (K_JOY1 + event.jbutton.button), event.jbutton.state == SDL_PRESSED);
break;
/* mouse/trackball motion handled by IN_MouseMove() */ |
I haven't seen any side effects. When not in game, for joystick direction to work in the menus,
I'm fine with this. Do you want to commit including your changes? |
a205ec6 to
f98c3cc
Compare
f98c3cc to
132b231
Compare
Working for a cheap generic DragonRise game pad: