diff --git a/src/command.c b/src/command.c index 4e9d97aa6..9804dbc03 100644 --- a/src/command.c +++ b/src/command.c @@ -1875,6 +1875,45 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) return true; } +// Block the Xbox DInput default axes and reset to the current defaults +static boolean CV_FilterJoyAxisVars2(consvar_t *v, const char *valstr) +{ + if (!stricmp(v->name, "joyaxis_turn") && !stricmp(valstr, "X-Axis")) + return false; + if (!stricmp(v->name, "joyaxis2_turn") && !stricmp(valstr, "X-Axis")) + return false; + if (!stricmp(v->name, "joyaxis3_turn") && !stricmp(valstr, "X-Axis")) + return false; + if (!stricmp(v->name, "joyaxis4_turn") && !stricmp(valstr, "X-Axis")) + return false; + if (!stricmp(v->name, "joyaxis_aim") && !stricmp(valstr, "Y-Axis")) + return false; + if (!stricmp(v->name, "joyaxis2_aim") && !stricmp(valstr, "Y-Axis")) + return false; + if (!stricmp(v->name, "joyaxis3_aim") && !stricmp(valstr, "Y-Axis")) + return false; + if (!stricmp(v->name, "joyaxis4_aim") && !stricmp(valstr, "Y-Axis")) + return false; + if (!stricmp(v->name, "joyaxis_fire") && !stricmp(valstr, "None")) + return false; + if (!stricmp(v->name, "joyaxis2_fire") && !stricmp(valstr, "None")) + return false; + if (!stricmp(v->name, "joyaxis3_fire") && !stricmp(valstr, "None")) + return false; + if (!stricmp(v->name, "joyaxis4_fire") && !stricmp(valstr, "None")) + return false; + if (!stricmp(v->name, "joyaxis_drift") && !stricmp(valstr, "None")) + return false; + if (!stricmp(v->name, "joyaxis2_drift") && !stricmp(valstr, "None")) + return false; + if (!stricmp(v->name, "joyaxis3_drift") && !stricmp(valstr, "None")) + return false; + if (!stricmp(v->name, "joyaxis4_drift") && !stricmp(valstr, "None")) + return false; + + return true; +} + static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr) { // True means allow the CV change, False means block it @@ -1908,6 +1947,13 @@ static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr) return false; } + if (GETMAJOREXECVERSION(cv_execversion.value) < 10) // 10 = 1.6 + { + // axis defaults changed again to SDL game controllers + if (!CV_FilterJoyAxisVars2(v, valstr)) + return false; + } + return true; } diff --git a/src/doomdef.h b/src/doomdef.h index 070130cb2..012b49266 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -204,7 +204,7 @@ extern char logfilename[1024]; // it's only for detection of the version the player is using so the MS can alert them of an update. // Only set it higher, not lower, obviously. // Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1". -#define MODVERSION 9 +#define MODVERSION 10 // Filter consvars by version // To version config.cfg, MAJOREXECVERSION is set equal to MODVERSION automatically. diff --git a/src/g_game.c b/src/g_game.c index 1e97f08cb..7d12bfb8b 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -491,8 +491,8 @@ consvar_t cv_moveaxis = {"joyaxis_move", "None", CV_SAVE, joyaxis_cons_t, NULL, consvar_t cv_brakeaxis = {"joyaxis_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_aimaxis = {"joyaxis_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_lookaxis = {"joyaxis_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_fireaxis = {"joyaxis_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_driftaxis = {"joyaxis_drift", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_fireaxis = {"joyaxis_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_driftaxis = {"joyaxis_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_xdeadzone = {"joy_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_ydeadzone = {"joy_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -501,8 +501,8 @@ consvar_t cv_moveaxis2 = {"joyaxis2_move", "None", CV_SAVE, joyaxis_cons_t, NULL consvar_t cv_brakeaxis2 = {"joyaxis2_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_aimaxis2 = {"joyaxis2_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_lookaxis2 = {"joyaxis2_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_fireaxis2 = {"joyaxis2_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_driftaxis2 = {"joyaxis2_drift", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_fireaxis2 = {"joyaxis2_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_driftaxis2 = {"joyaxis2_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_xdeadzone2 = {"joy2_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_ydeadzone2 = {"joy2_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -511,8 +511,8 @@ consvar_t cv_moveaxis3 = {"joyaxis3_move", "None", CV_SAVE, joyaxis_cons_t, NULL consvar_t cv_brakeaxis3 = {"joyaxis3_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_aimaxis3 = {"joyaxis3_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_lookaxis3 = {"joyaxis3_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_fireaxis3 = {"joyaxis3_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_driftaxis3 = {"joyaxis3_drift", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_fireaxis3 = {"joyaxis3_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_driftaxis3 = {"joyaxis3_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_xdeadzone3 = {"joy3_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_ydeadzone3 = {"joy3_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -521,8 +521,8 @@ consvar_t cv_moveaxis4 = {"joyaxis4_move", "None", CV_SAVE, joyaxis_cons_t, NULL consvar_t cv_brakeaxis4 = {"joyaxis4_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_aimaxis4 = {"joyaxis4_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_lookaxis4 = {"joyaxis4_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_fireaxis4 = {"joyaxis4_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_driftaxis4 = {"joyaxis4_drift", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_fireaxis4 = {"joyaxis4_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_driftaxis4 = {"joyaxis4_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_xdeadzone4 = {"joy4_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_ydeadzone4 = {"joy4_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; diff --git a/src/g_input.c b/src/g_input.c index 08a323c78..dafbeca31 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -1308,8 +1308,8 @@ void G_Controldefault(UINT8 player) gamecontrol[gc_accelerate ][1] = KEY_JOY1+0; // A gamecontrol[gc_lookback ][1] = KEY_JOY1+2; // X gamecontrol[gc_brake ][1] = KEY_JOY1+1; // B - gamecontrol[gc_fire ][1] = KEY_JOY1+4; // LB - gamecontrol[gc_drift ][1] = KEY_JOY1+5; // RB + gamecontrol[gc_fire ][1] = KEY_JOY1+9; // LB + gamecontrol[gc_drift ][1] = KEY_JOY1+10; // RB // Extra controls gamecontrol[gc_pause ][0] = KEY_PAUSE; @@ -1328,8 +1328,8 @@ void G_Controldefault(UINT8 player) gamecontrol[gc_camtoggle ][0] = KEY_BACKSPACE; gamecontrol[gc_viewpoint ][1] = KEY_JOY1+3; // Y - gamecontrol[gc_pause ][1] = KEY_JOY1+6; // Back - gamecontrol[gc_systemmenu ][0] = KEY_JOY1+7; // Start + gamecontrol[gc_pause ][1] = KEY_JOY1+4; // Back + gamecontrol[gc_systemmenu ][0] = KEY_JOY1+6; // Start //gamecontrol[gc_camtoggle ][1] = KEY_HAT1+0; // D-Pad Up //gamecontrol[gc_screenshot ][1] = KEY_HAT1+1; // D-Pad Down // absolutely fucking NOT gamecontrol[gc_talkkey ][1] = KEY_HAT1+1; // D-Pad Down @@ -1342,8 +1342,8 @@ void G_Controldefault(UINT8 player) gamecontrolbis[gc_accelerate ][0] = KEY_2JOY1+0; // A gamecontrolbis[gc_lookback ][0] = KEY_2JOY1+2; // X gamecontrolbis[gc_brake ][0] = KEY_2JOY1+1; // B - gamecontrolbis[gc_fire ][0] = KEY_2JOY1+4; // LB - gamecontrolbis[gc_drift ][0] = KEY_2JOY1+5; // RB + gamecontrolbis[gc_fire ][0] = KEY_2JOY1+9; // LB + gamecontrolbis[gc_drift ][0] = KEY_2JOY1+10; // RB } if (player == 0 || player == 3) @@ -1352,8 +1352,8 @@ void G_Controldefault(UINT8 player) gamecontrol3[gc_accelerate ][0] = KEY_3JOY1+0; // A gamecontrol3[gc_lookback ][0] = KEY_3JOY1+2; // X gamecontrol3[gc_brake ][0] = KEY_3JOY1+1; // B - gamecontrol3[gc_fire ][0] = KEY_3JOY1+4; // LB - gamecontrol3[gc_drift ][0] = KEY_3JOY1+5; // RB + gamecontrol3[gc_fire ][0] = KEY_3JOY1+9; // LB + gamecontrol3[gc_drift ][0] = KEY_3JOY1+10; // RB } if (player == 0 || player == 4) @@ -1362,8 +1362,8 @@ void G_Controldefault(UINT8 player) gamecontrol4[gc_accelerate ][0] = KEY_4JOY1+0; // A gamecontrol4[gc_lookback ][0] = KEY_4JOY1+2; // X gamecontrol4[gc_brake ][0] = KEY_4JOY1+1; // B - gamecontrol4[gc_fire ][0] = KEY_4JOY1+4; // LB - gamecontrol4[gc_drift ][0] = KEY_4JOY1+5; // RB + gamecontrol4[gc_fire ][0] = KEY_4JOY1+9; // LB + gamecontrol4[gc_drift ][0] = KEY_4JOY1+10; // RB } } @@ -1452,25 +1452,51 @@ INT32 G_CheckDoubleUsage(INT32 keynum, boolean modify) static INT32 G_FilterKeyByVersion(INT32 numctrl, INT32 keyidx, INT32 player, INT32 *keynum1, INT32 *keynum2, boolean *nestedoverride) { - // Special case: ignore KEY_PAUSE because it's hardcoded - if (keyidx == 0 && *keynum1 == KEY_PAUSE) - { - if (*keynum2 != KEY_PAUSE) - { - *keynum1 = *keynum2; // shift down keynum2 and continue - *keynum2 = 0; - } - else - return -1; // skip setting control - } - else if (keyidx == 1 && *keynum2 == KEY_PAUSE) - return -1; // skip setting control - -#if 1 - // We don't have changed control defaults yet - (void)numctrl; - (void)player; +#if 1 // SRB2Kart filters/migrations (void)nestedoverride; + + // Migration: 1.6 (majorexec 10) Joystick Defaults changed to use SDL Game Controllers + if (GETMAJOREXECVERSION(cv_execversion.value) < 10) + { + INT32 joybuttonbase = KEY_JOY1; + + switch (player) + { + case 0: + joybuttonbase = KEY_JOY1; + break; + case 1: + joybuttonbase = KEY_2JOY1; + break; + case 2: + joybuttonbase = KEY_3JOY1; + break; + case 3: + joybuttonbase = KEY_4JOY1; + break; + } + + // The face buttons match, so we don't need to rebind those. + + if (keyidx == 1 && numctrl == gc_fire && *keynum2 == joybuttonbase + 4) // Xbox DInput LB + { + *keynum2 = joybuttonbase + 9; // SDL LEFTSHOULDER + } + if (keyidx == 1 && numctrl == gc_drift && *keynum2 == joybuttonbase + 5) // Xbox DInput RB + { + *keynum2 = joybuttonbase + 10; // SDL RIGHTSHOULDER + } + + // Pause and Systemmenu are only bound for P1 + if (keyidx == 1 && player == 0 && numctrl == gc_pause && *keynum2 == joybuttonbase + 6) // Xbox DInput Back + { + *keynum2 = joybuttonbase + 4; // SDL BACK + } + if (keyidx == 0 && player == 0 && numctrl == gc_systemmenu && *keynum1 == joybuttonbase + 7) // Xbox DInput Start + { + *keynum1 = joybuttonbase + 6; // SDL START + } + } #else #if !defined (DC) && !defined (_PSP) && !defined (GP2X) && !defined (_NDS) && !defined(WMINPUT) && !defined(_WII) if (GETMAJOREXECVERSION(cv_execversion.value) < 27 && ( // v2.1.22