diff --git a/Makefile.common b/Makefile.common index 366ec85e0c..be72ceab49 100644 --- a/Makefile.common +++ b/Makefile.common @@ -572,9 +572,9 @@ ifeq ($(HAVE_DINPUT), 1) endif ifeq ($(HAVE_XINPUT), 1) - DEFINES += -DHAVE_XINPUT -DHAVE_BUILTIN_AUTOCONFIG - OBJ += input/drivers_joypad/xinput_joypad.o \ - input/autoconf/builtin_win.o + HAVE_BUILTIN_AUTOCONFIG=1 + DEFINES += -DHAVE_XINPUT + OBJ += input/drivers_joypad/xinput_joypad.o endif ifeq ($(HAVE_OPENDINGUX_FBDEV), 1) @@ -798,10 +798,10 @@ ifeq ($(HAVE_SDL), 1) endif ifeq ($(HAVE_SDL2), 1) + HAVE_BUILTIN_AUTOCONFIG=1 OBJ += gfx/drivers/sdl2_gfx.o \ input/drivers/sdl_input.o \ input/drivers_joypad/sdl_joypad.o \ - input/autoconf/builtin_sdl2.o \ audio/drivers/sdl_audio.o ifeq ($(HAVE_GL_CONTEXT), 1) @@ -871,6 +871,11 @@ ifeq ($(HAVE_VULKAN), 1) LIBS += -lstdc++ endif +ifeq ($(HAVE_BUILTIN_AUTOCONFIG), 1) + OBJ += input/input_autodetect_builtin.o + DEFINES += -DHAVE_BUILTIN_AUTOCONFIG +endif + ifeq ($(HAVE_OMAP), 1) OBJ += gfx/drivers/omap_gfx.o endif diff --git a/griffin/griffin.c b/griffin/griffin.c index d3bf911c80..6567d4a4c6 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -405,34 +405,27 @@ INPUT #include "../input/common/x11_input_common.c" #endif -#ifdef HAVE_SDL2 -#include "../input/autoconf/builtin_sdl2.c" +#ifdef HAVE_BUILTIN_AUTOCONFIG +#include "../input/input_autodetect_builtin.c" #endif #if defined(__CELLOS_LV2__) #include "../input/drivers/ps3_input.c" #include "../input/drivers_joypad/ps3_joypad.c" -#include "../input/autoconf/builtin_ps3.c" #elif defined(SN_TARGET_PSP2) || defined(PSP) || defined(VITA) #include "../input/drivers/psp_input.c" #include "../input/drivers_joypad/psp_joypad.c" -#include "../input/autoconf/builtin_psp.c" #elif defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH) #include "../input/drivers/cocoa_input.c" #elif defined(_3DS) #include "../input/drivers/ctr_input.c" #include "../input/drivers_joypad/ctr_joypad.c" -#include "../input/autoconf/builtin_ctr.c" #elif defined(GEKKO) #include "../input/drivers/gx_input.c" #include "../input/drivers_joypad/gx_joypad.c" -#include "../input/autoconf/builtin_gx.c" #elif defined(_XBOX) #include "../input/drivers/xdk_xinput_input.c" #include "../input/drivers_joypad/xdk_joypad.c" -#include "../input/autoconf/builtin_xdk.c" -#elif defined(_WIN32) -#include "../input/autoconf/builtin_win.c" #elif defined(XENON) #include "../input/drivers/xenon360_input.c" #elif defined(ANDROID) diff --git a/input/autoconf/builtin_ctr.c b/input/autoconf/builtin_ctr.c deleted file mode 100644 index 769c115f15..0000000000 --- a/input/autoconf/builtin_ctr.c +++ /dev/null @@ -1,50 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2016 - Ali Bouhlel - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#include "../input_autodetect.h" -#include "builtin.h" - -#define CTRINPUT_DEFAULT_BINDS \ -DECL_BTN(a, 8) \ -DECL_BTN(b, 0) \ -DECL_BTN(x, 9) \ -DECL_BTN(y, 1) \ -DECL_BTN(start, 3) \ -DECL_BTN(select, 2) \ -DECL_BTN(up, 4) \ -DECL_BTN(down, 5) \ -DECL_BTN(left, 6) \ -DECL_BTN(right, 7) \ -DECL_BTN(l, 10) \ -DECL_BTN(r, 11) \ -DECL_BTN(l2, 12) \ -DECL_BTN(r2, 13) \ -DECL_AXIS(l_x_plus, +0) \ -DECL_AXIS(l_x_minus, -0) \ -DECL_AXIS(l_y_plus, +1) \ -DECL_AXIS(l_y_minus, -1) \ -DECL_AXIS(r_x_plus, +2) \ -DECL_AXIS(r_x_minus, -2) \ -DECL_AXIS(r_y_plus, -3) \ -DECL_AXIS(r_y_minus, +3) - -const char* const input_builtin_autoconfs[] = -{ - DECL_AUTOCONF_DEVICE("3DS Controller", "ctr", CTRINPUT_DEFAULT_BINDS), - NULL -}; - - diff --git a/input/autoconf/builtin_gx.c b/input/autoconf/builtin_gx.c deleted file mode 100644 index 1f196c4f3d..0000000000 --- a/input/autoconf/builtin_gx.c +++ /dev/null @@ -1,106 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#include "../input_autodetect.h" -#include "builtin.h" - -#define GXINPUT_GAMECUBE_DEFAULT_BINDS \ -DECL_BTN(a, 0) \ -DECL_BTN(b, 1) \ -DECL_BTN(x, 2) \ -DECL_BTN(y, 3) \ -DECL_BTN(start, 4) \ -DECL_BTN(select, 6) \ -DECL_BTN(up, 9) \ -DECL_BTN(down, 10) \ -DECL_BTN(left, 11) \ -DECL_BTN(right, 12) \ -DECL_BTN(l, 7) \ -DECL_BTN(r, 8) \ -DECL_AXIS(l_x_plus, +0) \ -DECL_AXIS(l_x_minus, -0) \ -DECL_AXIS(l_y_plus, +1) \ -DECL_AXIS(l_y_minus, -1) \ -DECL_AXIS(r_x_plus, +2) \ -DECL_AXIS(r_x_minus, -2) \ -DECL_AXIS(r_y_plus, -3) \ -DECL_AXIS(r_y_minus, +3) - -#define GXINPUT_WIIMOTE_DEFAULT_BINDS \ -DECL_BTN(a, 31) \ -DECL_BTN(b, 30) \ -DECL_BTN(x, 29) \ -DECL_BTN(y, 28) \ -DECL_BTN(start, 32) \ -DECL_BTN(select, 33) \ -DECL_BTN(up, 35) \ -DECL_BTN(down, 36) \ -DECL_BTN(left, 37) \ -DECL_BTN(right, 38) - -#define GXINPUT_NUNCHUK_DEFAULT_BINDS \ -DECL_BTN(a, 28) \ -DECL_BTN(b, 29) \ -DECL_BTN(x, 30) \ -DECL_BTN(y, 31) \ -DECL_BTN(start, 32) \ -DECL_BTN(select, 33) \ -DECL_BTN(up, 35) \ -DECL_BTN(down, 36) \ -DECL_BTN(left, 37) \ -DECL_BTN(right, 38) \ -DECL_BTN(l, 39) \ -DECL_BTN(r, 40) \ -DECL_AXIS(l_x_plus, +0) \ -DECL_AXIS(l_x_minus, -0) \ -DECL_AXIS(l_y_plus, +1) \ -DECL_AXIS(l_y_minus, -1) - -#define GXINPUT_CLASSIC_DEFAULT_BINDS \ -DECL_BTN(a, 13) \ -DECL_BTN(b, 14) \ -DECL_BTN(x, 15) \ -DECL_BTN(y, 16) \ -DECL_BTN(start, 17) \ -DECL_BTN(select, 18) \ -DECL_BTN(up, 24) \ -DECL_BTN(down, 25) \ -DECL_BTN(left, 26) \ -DECL_BTN(right, 27) \ -DECL_BTN(l, 20) \ -DECL_BTN(r, 21) \ -DECL_BTN(l2, 22) \ -DECL_BTN(r2, 23) \ -DECL_AXIS(l_x_plus, +0) \ -DECL_AXIS(l_x_minus, -0) \ -DECL_AXIS(l_y_plus, +1) \ -DECL_AXIS(l_y_minus, -1) \ -DECL_AXIS(r_x_plus, +2) \ -DECL_AXIS(r_x_minus, -2) \ -DECL_AXIS(r_y_plus, -3) \ -DECL_AXIS(r_y_minus, +3) - -const char* const input_builtin_autoconfs[] = -{ - DECL_AUTOCONF_DEVICE("GameCube Controller", "gx", GXINPUT_GAMECUBE_DEFAULT_BINDS), -#ifdef HW_RVL - DECL_AUTOCONF_DEVICE("Wiimote Controller", "gx", GXINPUT_WIIMOTE_DEFAULT_BINDS), - DECL_AUTOCONF_DEVICE("Nunchuk Controller", "gx", GXINPUT_NUNCHUK_DEFAULT_BINDS), - DECL_AUTOCONF_DEVICE("Classic Controller", "gx", GXINPUT_CLASSIC_DEFAULT_BINDS), -#endif - NULL -}; - diff --git a/input/autoconf/builtin_ps3.c b/input/autoconf/builtin_ps3.c deleted file mode 100644 index ea6f5ac48c..0000000000 --- a/input/autoconf/builtin_ps3.c +++ /dev/null @@ -1,51 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#include "../input_autodetect.h" -#include "builtin.h" - -#define PS3INPUT_DEFAULT_BINDS \ -DECL_BTN(a, 8) \ -DECL_BTN(b, 0) \ -DECL_BTN(x, 9) \ -DECL_BTN(y, 1) \ -DECL_BTN(start, 3) \ -DECL_BTN(select, 2) \ -DECL_BTN(up, 4) \ -DECL_BTN(down, 5) \ -DECL_BTN(left, 6) \ -DECL_BTN(right, 7) \ -DECL_BTN(l, 10) \ -DECL_BTN(r, 11) \ -DECL_BTN(l3, 14) \ -DECL_BTN(r3, 15) \ -DECL_BTN(l2, 12) \ -DECL_BTN(r2, 13) \ -DECL_AXIS(l_x_plus, +0) \ -DECL_AXIS(l_x_minus, -0) \ -DECL_AXIS(l_y_plus, +1) \ -DECL_AXIS(l_y_minus, -1) \ -DECL_AXIS(r_x_plus, +2) \ -DECL_AXIS(r_x_minus, -2) \ -DECL_AXIS(r_y_plus, -3) \ -DECL_AXIS(r_y_minus, +3) - -const char* const input_builtin_autoconfs[] = -{ - DECL_AUTOCONF_DEVICE("SixAxis Controller", "ps3", PS3INPUT_DEFAULT_BINDS), - NULL -}; - diff --git a/input/autoconf/builtin_psp.c b/input/autoconf/builtin_psp.c deleted file mode 100644 index e60bdc6ef9..0000000000 --- a/input/autoconf/builtin_psp.c +++ /dev/null @@ -1,53 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#include "../input_autodetect.h" -#include "builtin.h" - -#define PSPINPUT_DEFAULT_BINDS \ -DECL_BTN(a, 8) \ -DECL_BTN(b, 0) \ -DECL_BTN(x, 9) \ -DECL_BTN(y, 1) \ -DECL_BTN(start, 3) \ -DECL_BTN(select, 2) \ -DECL_BTN(up, 4) \ -DECL_BTN(down, 5) \ -DECL_BTN(left, 6) \ -DECL_BTN(right, 7) \ -DECL_BTN(l, 10) \ -DECL_BTN(r, 11) \ -DECL_BTN(l2, 12) \ -DECL_BTN(r2, 13) \ -DECL_AXIS(l_x_plus, +0) \ -DECL_AXIS(l_x_minus, -0) \ -DECL_AXIS(l_y_plus, +1) \ -DECL_AXIS(l_y_minus, -1) \ -DECL_AXIS(r_x_plus, +2) \ -DECL_AXIS(r_x_minus, -2) \ -DECL_AXIS(r_y_plus, -3) \ -DECL_AXIS(r_y_minus, +3) - -const char* const input_builtin_autoconfs[] = -{ -#ifdef VITA - DECL_AUTOCONF_DEVICE("Vita Controller", "vita", PSPINPUT_DEFAULT_BINDS), -#else - DECL_AUTOCONF_DEVICE("PSP Controller", "psp", PSPINPUT_DEFAULT_BINDS), -#endif - NULL -}; - diff --git a/input/autoconf/builtin_sdl2.c b/input/autoconf/builtin_sdl2.c deleted file mode 100644 index ee5ddbeb7f..0000000000 --- a/input/autoconf/builtin_sdl2.c +++ /dev/null @@ -1,52 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2016 - Ali Bouhlel - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#include "../input_autodetect.h" -#include "builtin.h" - -/* TODO/FIXME - Missing L2/R2 */ - -#define SDL2_DEFAULT_BINDS \ -DECL_BTN(a, 1) \ -DECL_BTN(b, 0) \ -DECL_BTN(x, 3) \ -DECL_BTN(y, 2) \ -DECL_BTN(start, 6) \ -DECL_BTN(select, 4) \ -DECL_BTN(up, 11) \ -DECL_BTN(down, 12) \ -DECL_BTN(left, 13) \ -DECL_BTN(right, 14) \ -DECL_BTN(l, 9) \ -DECL_BTN(r, 10) \ -DECL_BTN(l3, 7) \ -DECL_BTN(r3, 8) \ -DECL_AXIS(l_x_plus, +0) \ -DECL_AXIS(l_x_minus, -0) \ -DECL_AXIS(l_y_plus, +1) \ -DECL_AXIS(l_y_minus, -1) \ -DECL_AXIS(r_x_plus, +2) \ -DECL_AXIS(r_x_minus, -2) \ -DECL_AXIS(r_y_plus, -3) \ -DECL_AXIS(r_y_minus, +3) - -const char* const input_builtin_autoconfs[] = -{ - DECL_AUTOCONF_DEVICE("SDL2 Controller", "sdl2", SDL2_DEFAULT_BINDS), - NULL -}; - - diff --git a/input/autoconf/builtin_win.c b/input/autoconf/builtin_win.c deleted file mode 100644 index 4b07b43f76..0000000000 --- a/input/autoconf/builtin_win.c +++ /dev/null @@ -1,55 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2013-2014 - pinumbernumber - * Copyright (C) 2011-2016 - Daniel De Matteis - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#include "../input_autodetect.h" -#include "builtin.h" - -#define XINPUT_DEFAULT_BINDS \ -DECL_BTN(a, 1) \ -DECL_BTN(b, 0) \ -DECL_BTN(x, 3) \ -DECL_BTN(y, 2) \ -DECL_BTN(start, 6) \ -DECL_BTN(select, 7) \ -DECL_BTN(up, h0up) \ -DECL_BTN(down, h0down) \ -DECL_BTN(left, h0left) \ -DECL_BTN(right, h0right) \ -DECL_BTN(l, 4) \ -DECL_BTN(r, 5) \ -DECL_BTN(l3, 8) \ -DECL_BTN(r3, 9) \ -DECL_BTN(menu_toggle, 10) \ -DECL_AXIS(l2, +4) \ -DECL_AXIS(r2, +5) \ -DECL_AXIS(l_x_plus, +0) \ -DECL_AXIS(l_x_minus, -0) \ -DECL_AXIS(l_y_plus, -1) \ -DECL_AXIS(l_y_minus, +1) \ -DECL_AXIS(r_x_plus, +2) \ -DECL_AXIS(r_x_minus, -2) \ -DECL_AXIS(r_y_plus, -3) \ -DECL_AXIS(r_y_minus, +3) - -const char* const input_builtin_autoconfs[] = -{ - DECL_AUTOCONF_DEVICE("XInput Controller (User 1)", "xinput", XINPUT_DEFAULT_BINDS), - DECL_AUTOCONF_DEVICE("XInput Controller (User 2)", "xinput", XINPUT_DEFAULT_BINDS), - DECL_AUTOCONF_DEVICE("XInput Controller (User 3)", "xinput", XINPUT_DEFAULT_BINDS), - DECL_AUTOCONF_DEVICE("XInput Controller (User 4)", "xinput", XINPUT_DEFAULT_BINDS), - NULL -}; - diff --git a/input/autoconf/builtin_xdk.c b/input/autoconf/builtin_xdk.c deleted file mode 100644 index 698a0a208c..0000000000 --- a/input/autoconf/builtin_xdk.c +++ /dev/null @@ -1,51 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2013-2014 - pinumbernumber - * Copyright (C) 2011-2016 - Daniel De Matteis - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#include "../input_autodetect.h" -#include "builtin.h" - -#define XINPUT_DEFAULT_BINDS \ -DECL_BTN(a, 8) \ -DECL_BTN(b, 0) \ -DECL_BTN(x, 9) \ -DECL_BTN(y, 1) \ -DECL_BTN(start, 3) \ -DECL_BTN(select, 2) \ -DECL_BTN(up, 4) \ -DECL_BTN(down, 5) \ -DECL_BTN(left, 6) \ -DECL_BTN(right, 7) \ -DECL_BTN(l, 10) \ -DECL_BTN(r, 11) \ -DECL_BTN(l3, 14) \ -DECL_BTN(r3, 15) \ -DECL_BTN(l2, 12) \ -DECL_BTN(r2, 13) \ -DECL_AXIS(l_x_plus, +0) \ -DECL_AXIS(l_x_minus, -0) \ -DECL_AXIS(l_y_plus, -1) \ -DECL_AXIS(l_y_minus, +1) \ -DECL_AXIS(r_x_plus, +2) \ -DECL_AXIS(r_x_minus, -2) \ -DECL_AXIS(r_y_plus, -3) \ -DECL_AXIS(r_y_minus, +3) - -const char* const input_builtin_autoconfs[] = -{ - DECL_AUTOCONF_DEVICE("XInput Controller", "xdk", XINPUT_DEFAULT_BINDS), - NULL -}; - diff --git a/input/input_autodetect_builtin.c b/input/input_autodetect_builtin.c new file mode 100644 index 0000000000..7e8d321e30 --- /dev/null +++ b/input/input_autodetect_builtin.c @@ -0,0 +1,287 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2014-2016 - Ali Bouhlel + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include "input_autodetect.h" +#include "input_autodetect_builtin.h" + +/* TODO/FIXME - Missing L2/R2 */ + +#define SDL2_DEFAULT_BINDS \ +DECL_BTN(a, 1) \ +DECL_BTN(b, 0) \ +DECL_BTN(x, 3) \ +DECL_BTN(y, 2) \ +DECL_BTN(start, 6) \ +DECL_BTN(select, 4) \ +DECL_BTN(up, 11) \ +DECL_BTN(down, 12) \ +DECL_BTN(left, 13) \ +DECL_BTN(right, 14) \ +DECL_BTN(l, 9) \ +DECL_BTN(r, 10) \ +DECL_BTN(l3, 7) \ +DECL_BTN(r3, 8) \ +DECL_AXIS(l_x_plus, +0) \ +DECL_AXIS(l_x_minus, -0) \ +DECL_AXIS(l_y_plus, +1) \ +DECL_AXIS(l_y_minus, -1) \ +DECL_AXIS(r_x_plus, +2) \ +DECL_AXIS(r_x_minus, -2) \ +DECL_AXIS(r_y_plus, -3) \ +DECL_AXIS(r_y_minus, +3) + +#define PSPINPUT_DEFAULT_BINDS \ +DECL_BTN(a, 8) \ +DECL_BTN(b, 0) \ +DECL_BTN(x, 9) \ +DECL_BTN(y, 1) \ +DECL_BTN(start, 3) \ +DECL_BTN(select, 2) \ +DECL_BTN(up, 4) \ +DECL_BTN(down, 5) \ +DECL_BTN(left, 6) \ +DECL_BTN(right, 7) \ +DECL_BTN(l, 10) \ +DECL_BTN(r, 11) \ +DECL_BTN(l2, 12) \ +DECL_BTN(r2, 13) \ +DECL_AXIS(l_x_plus, +0) \ +DECL_AXIS(l_x_minus, -0) \ +DECL_AXIS(l_y_plus, +1) \ +DECL_AXIS(l_y_minus, -1) \ +DECL_AXIS(r_x_plus, +2) \ +DECL_AXIS(r_x_minus, -2) \ +DECL_AXIS(r_y_plus, -3) \ +DECL_AXIS(r_y_minus, +3) + +#define CTRINPUT_DEFAULT_BINDS \ +DECL_BTN(a, 8) \ +DECL_BTN(b, 0) \ +DECL_BTN(x, 9) \ +DECL_BTN(y, 1) \ +DECL_BTN(start, 3) \ +DECL_BTN(select, 2) \ +DECL_BTN(up, 4) \ +DECL_BTN(down, 5) \ +DECL_BTN(left, 6) \ +DECL_BTN(right, 7) \ +DECL_BTN(l, 10) \ +DECL_BTN(r, 11) \ +DECL_BTN(l2, 12) \ +DECL_BTN(r2, 13) \ +DECL_AXIS(l_x_plus, +0) \ +DECL_AXIS(l_x_minus, -0) \ +DECL_AXIS(l_y_plus, +1) \ +DECL_AXIS(l_y_minus, -1) \ +DECL_AXIS(r_x_plus, +2) \ +DECL_AXIS(r_x_minus, -2) \ +DECL_AXIS(r_y_plus, -3) \ +DECL_AXIS(r_y_minus, +3) + +#define GXINPUT_GAMECUBE_DEFAULT_BINDS \ +DECL_BTN(a, 0) \ +DECL_BTN(b, 1) \ +DECL_BTN(x, 2) \ +DECL_BTN(y, 3) \ +DECL_BTN(start, 4) \ +DECL_BTN(select, 6) \ +DECL_BTN(up, 9) \ +DECL_BTN(down, 10) \ +DECL_BTN(left, 11) \ +DECL_BTN(right, 12) \ +DECL_BTN(l, 7) \ +DECL_BTN(r, 8) \ +DECL_AXIS(l_x_plus, +0) \ +DECL_AXIS(l_x_minus, -0) \ +DECL_AXIS(l_y_plus, +1) \ +DECL_AXIS(l_y_minus, -1) \ +DECL_AXIS(r_x_plus, +2) \ +DECL_AXIS(r_x_minus, -2) \ +DECL_AXIS(r_y_plus, -3) \ +DECL_AXIS(r_y_minus, +3) + +#define GXINPUT_WIIMOTE_DEFAULT_BINDS \ +DECL_BTN(a, 31) \ +DECL_BTN(b, 30) \ +DECL_BTN(x, 29) \ +DECL_BTN(y, 28) \ +DECL_BTN(start, 32) \ +DECL_BTN(select, 33) \ +DECL_BTN(up, 35) \ +DECL_BTN(down, 36) \ +DECL_BTN(left, 37) \ +DECL_BTN(right, 38) + +#define GXINPUT_NUNCHUK_DEFAULT_BINDS \ +DECL_BTN(a, 28) \ +DECL_BTN(b, 29) \ +DECL_BTN(x, 30) \ +DECL_BTN(y, 31) \ +DECL_BTN(start, 32) \ +DECL_BTN(select, 33) \ +DECL_BTN(up, 35) \ +DECL_BTN(down, 36) \ +DECL_BTN(left, 37) \ +DECL_BTN(right, 38) \ +DECL_BTN(l, 39) \ +DECL_BTN(r, 40) \ +DECL_AXIS(l_x_plus, +0) \ +DECL_AXIS(l_x_minus, -0) \ +DECL_AXIS(l_y_plus, +1) \ +DECL_AXIS(l_y_minus, -1) + +#define GXINPUT_CLASSIC_DEFAULT_BINDS \ +DECL_BTN(a, 13) \ +DECL_BTN(b, 14) \ +DECL_BTN(x, 15) \ +DECL_BTN(y, 16) \ +DECL_BTN(start, 17) \ +DECL_BTN(select, 18) \ +DECL_BTN(up, 24) \ +DECL_BTN(down, 25) \ +DECL_BTN(left, 26) \ +DECL_BTN(right, 27) \ +DECL_BTN(l, 20) \ +DECL_BTN(r, 21) \ +DECL_BTN(l2, 22) \ +DECL_BTN(r2, 23) \ +DECL_AXIS(l_x_plus, +0) \ +DECL_AXIS(l_x_minus, -0) \ +DECL_AXIS(l_y_plus, +1) \ +DECL_AXIS(l_y_minus, -1) \ +DECL_AXIS(r_x_plus, +2) \ +DECL_AXIS(r_x_minus, -2) \ +DECL_AXIS(r_y_plus, -3) \ +DECL_AXIS(r_y_minus, +3) + +#define PS3INPUT_DEFAULT_BINDS \ +DECL_BTN(a, 8) \ +DECL_BTN(b, 0) \ +DECL_BTN(x, 9) \ +DECL_BTN(y, 1) \ +DECL_BTN(start, 3) \ +DECL_BTN(select, 2) \ +DECL_BTN(up, 4) \ +DECL_BTN(down, 5) \ +DECL_BTN(left, 6) \ +DECL_BTN(right, 7) \ +DECL_BTN(l, 10) \ +DECL_BTN(r, 11) \ +DECL_BTN(l3, 14) \ +DECL_BTN(r3, 15) \ +DECL_BTN(l2, 12) \ +DECL_BTN(r2, 13) \ +DECL_AXIS(l_x_plus, +0) \ +DECL_AXIS(l_x_minus, -0) \ +DECL_AXIS(l_y_plus, +1) \ +DECL_AXIS(l_y_minus, -1) \ +DECL_AXIS(r_x_plus, +2) \ +DECL_AXIS(r_x_minus, -2) \ +DECL_AXIS(r_y_plus, -3) \ +DECL_AXIS(r_y_minus, +3) + +#ifdef _XBOX +#define XINPUT_DEFAULT_BINDS \ +DECL_BTN(a, 1) \ +DECL_BTN(b, 0) \ +DECL_BTN(x, 3) \ +DECL_BTN(y, 2) \ +DECL_BTN(start, 6) \ +DECL_BTN(select, 7) \ +DECL_BTN(up, h0up) \ +DECL_BTN(down, h0down) \ +DECL_BTN(left, h0left) \ +DECL_BTN(right, h0right) \ +DECL_BTN(l, 4) \ +DECL_BTN(r, 5) \ +DECL_BTN(l3, 8) \ +DECL_BTN(r3, 9) \ +DECL_BTN(menu_toggle, 10) \ +DECL_AXIS(l2, +4) \ +DECL_AXIS(r2, +5) \ +DECL_AXIS(l_x_plus, +0) \ +DECL_AXIS(l_x_minus, -0) \ +DECL_AXIS(l_y_plus, -1) \ +DECL_AXIS(l_y_minus, +1) \ +DECL_AXIS(r_x_plus, +2) \ +DECL_AXIS(r_x_minus, -2) \ +DECL_AXIS(r_y_plus, -3) \ +DECL_AXIS(r_y_minus, +3) +#else +#define XINPUT_DEFAULT_BINDS \ +DECL_BTN(a, 8) \ +DECL_BTN(b, 0) \ +DECL_BTN(x, 9) \ +DECL_BTN(y, 1) \ +DECL_BTN(start, 3) \ +DECL_BTN(select, 2) \ +DECL_BTN(up, 4) \ +DECL_BTN(down, 5) \ +DECL_BTN(left, 6) \ +DECL_BTN(right, 7) \ +DECL_BTN(l, 10) \ +DECL_BTN(r, 11) \ +DECL_BTN(l3, 14) \ +DECL_BTN(r3, 15) \ +DECL_BTN(l2, 12) \ +DECL_BTN(r2, 13) \ +DECL_AXIS(l_x_plus, +0) \ +DECL_AXIS(l_x_minus, -0) \ +DECL_AXIS(l_y_plus, -1) \ +DECL_AXIS(l_y_minus, +1) \ +DECL_AXIS(r_x_plus, +2) \ +DECL_AXIS(r_x_minus, -2) \ +DECL_AXIS(r_y_plus, -3) \ +DECL_AXIS(r_y_minus, +3) +#endif + +const char* const input_builtin_autoconfs[] = +{ +#if defined(_WIN32) && defined(_XBOX) + DECL_AUTOCONF_DEVICE("XInput Controller", "xdk", XINPUT_DEFAULT_BINDS), +#elif defined(_WIN32) + DECL_AUTOCONF_DEVICE("XInput Controller (User 1)", "xinput", XINPUT_DEFAULT_BINDS), + DECL_AUTOCONF_DEVICE("XInput Controller (User 2)", "xinput", XINPUT_DEFAULT_BINDS), + DECL_AUTOCONF_DEVICE("XInput Controller (User 3)", "xinput", XINPUT_DEFAULT_BINDS), + DECL_AUTOCONF_DEVICE("XInput Controller (User 4)", "xinput", XINPUT_DEFAULT_BINDS), +#endif +#ifdef HAVE_SDL2 + DECL_AUTOCONF_DEVICE("SDL2 Controller", "sdl2", SDL2_DEFAULT_BINDS), +#endif +#if defined(VITA) + DECL_AUTOCONF_DEVICE("Vita Controller", "vita", PSPINPUT_DEFAULT_BINDS), +#elif defined(PSP) + DECL_AUTOCONF_DEVICE("PSP Controller", "psp", PSPINPUT_DEFAULT_BINDS), +#endif +#ifdef _3DS + DECL_AUTOCONF_DEVICE("3DS Controller", "ctr", CTRINPUT_DEFAULT_BINDS), +#endif +#ifdef GEKKO + DECL_AUTOCONF_DEVICE("GameCube Controller", "gx", GXINPUT_GAMECUBE_DEFAULT_BINDS), +#ifdef HW_RVL + DECL_AUTOCONF_DEVICE("Wiimote Controller", "gx", GXINPUT_WIIMOTE_DEFAULT_BINDS), + DECL_AUTOCONF_DEVICE("Nunchuk Controller", "gx", GXINPUT_NUNCHUK_DEFAULT_BINDS), + DECL_AUTOCONF_DEVICE("Classic Controller", "gx", GXINPUT_CLASSIC_DEFAULT_BINDS), +#endif +#endif +#ifdef __CELLOS_LV2__ + DECL_AUTOCONF_DEVICE("SixAxis Controller", "ps3", PS3INPUT_DEFAULT_BINDS), +#endif + NULL +}; + + diff --git a/input/autoconf/builtin.h b/input/input_autodetect_builtin.h similarity index 93% rename from input/autoconf/builtin.h rename to input/input_autodetect_builtin.h index f99d2831fe..447500c68b 100644 --- a/input/autoconf/builtin.h +++ b/input/input_autodetect_builtin.h @@ -1,4 +1,5 @@ /* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen * Copyright (C) 2013-2014 - pinumbernumber * Copyright (C) 2011-2016 - Daniel De Matteis * @@ -17,7 +18,7 @@ #ifndef AUTOCONF_BUILTIN_H__ #define AUTOCONF_BUILTIN_H__ -#include "../input_config.h" +#include "input_config.h" #define DECL_BTN(btn, bind) "input_" #btn "_btn = " #bind "\n" #define DECL_AXIS(axis, bind) "input_" #axis "_axis = " #bind "\n"