Add null joypad driver

This commit is contained in:
twinaphex 2014-10-27 14:45:28 +01:00
parent 30ca42cb9d
commit bab9ee307d
9 changed files with 96 additions and 0 deletions

View File

@ -134,6 +134,16 @@ $(OBJDIR)/tools/input_common_joyconfig.o: input/input_common.c
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -DIS_JOYCONFIG -c -o $@ $<
$(OBJDIR)/tools/nullinput_joyconfig.o: input/nullinput.c
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -DIS_JOYCONFIG -c -o $@ $<
$(OBJDIR)/tools/nullinput_joypad_joyconfig.o: input/nullinput_joypad.c
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -DIS_JOYCONFIG -c -o $@ $<
$(OBJDIR)/tools/input_keymaps_joyconfig.o: input/input_keymaps.c
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CC $<),)

View File

@ -145,6 +145,7 @@ OBJ += frontend/frontend.o \
gfx/nullgfx.o \
audio/nullaudio.o \
input/nullinput.o \
input/nullinput_joypad.o \
input/osk/nullosk.o \
playlist.o \
movie.o \
@ -638,6 +639,8 @@ JOYCONFIG_OBJ += tools/retroarch-joyconfig.o \
libretro-sdk/file/file_path.o \
libretro-sdk/string/string_list.o \
libretro-sdk/compat/compat.o \
input/nullinput.o \
input/nullinput_joypad.o \
tools/input_context_joyconfig.o \
tools/input_common_joyconfig.o \
tools/input_keymaps_joyconfig.o

View File

@ -171,6 +171,16 @@ $(OBJDIR)/tools/input_context_joyconfig.o: input/input_context.c
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -DIS_JOYCONFIG -c -o $@ $<
$(OBJDIR)/tools/nullinput_joyconfig.o: input/nullinput.c
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -DIS_JOYCONFIG -c -o $@ $<
$(OBJDIR)/tools/nullinput_joypad_joyconfig.o: input/nullinput_joypad.c
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -DIS_JOYCONFIG -c -o $@ $<
$(OBJDIR)/%.o: %.cpp
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CXX $<),)

View File

@ -101,6 +101,7 @@ enum
JOYPAD_APPLE_HID,
JOYPAD_APPLE_IOS,
JOYPAD_QNX,
JOYPAD_NULL,
CAMERA_V4L2,
CAMERA_RWEBCAM,

View File

@ -370,6 +370,7 @@ INPUT
#endif
#include "../input/nullinput.c"
#include "../input/nullinput_joypad.c"
/*============================================================
STATE TRACKER

View File

@ -66,6 +66,7 @@ rarch_joypad_driver_t *joypad_drivers[] = {
#ifdef __QNX__
&qnx_joypad,
#endif
&null_joypad,
NULL,
};

View File

@ -62,6 +62,7 @@ extern rarch_joypad_driver_t apple_hid_joypad;
extern rarch_joypad_driver_t apple_ios_joypad;
extern rarch_joypad_driver_t android_joypad;
extern rarch_joypad_driver_t qnx_joypad;
extern rarch_joypad_driver_t null_joypad;
#ifdef __cplusplus
}

67
input/nullinput_joypad.c Normal file
View File

@ -0,0 +1,67 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2014 - Daniel De Matteis
* Copyright (C) 2013-2014 - CatalystG
*
* 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 <stdint.h>
#include <stddef.h>
#include <boolean.h>
#include "input_context.h"
static const char *null_joypad_name(unsigned pad)
{
return "null";
}
static bool null_joypad_init(void)
{
return true;
}
static bool null_joypad_button(unsigned port_num, uint16_t joykey)
{
return false;
}
static int16_t null_joypad_axis(unsigned port_num, uint32_t joyaxis)
{
return 0;
}
static void null_joypad_poll(void)
{
}
static bool null_joypad_query_pad(unsigned pad)
{
return true;
}
static void null_joypad_destroy(void)
{
}
rarch_joypad_driver_t null_joypad = {
null_joypad_init,
null_joypad_query_pad,
null_joypad_destroy,
null_joypad_button,
null_joypad_axis,
null_joypad_poll,
NULL,
null_joypad_name,
"null",
};

View File

@ -210,6 +210,8 @@ const char *config_get_default_joypad(void)
return "apple_ios";
case JOYPAD_QNX:
return "qnx";
case JOYPAD_NULL:
return "null";
}
return NULL;