Skip to content

Commit

Permalink
Add builtin_sdl2
Browse files Browse the repository at this point in the history
  • Loading branch information
inactive123 committed Sep 3, 2016
1 parent 72df613 commit 9df9b79
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,7 @@ ifeq ($(HAVE_SDL2), 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)
Expand Down
4 changes: 4 additions & 0 deletions griffin/griffin.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,10 @@ INPUT
#include "../input/common/x11_input_common.c"
#endif

#ifdef HAVE_SDL2
#include "../input/autoconf/builtin_sdl2.c"
#endif

#if defined(__CELLOS_LV2__)
#include "../input/drivers/ps3_input.c"
#include "../input/drivers_joypad/ps3_joypad.c"
Expand Down
50 changes: 50 additions & 0 deletions input/autoconf/builtin_sdl2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/* 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 <http://www.gnu.org/licenses/>.
*/

#include "../input_autodetect.h"
#include "builtin.h"

#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
};


0 comments on commit 9df9b79

Please sign in to comment.