mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-09 02:48:54 +00:00
(HID) Create null_hid
This commit is contained in:
parent
0b5e006f29
commit
9ade0a8a7f
@ -164,6 +164,7 @@ OBJ += frontend/frontend.o \
|
|||||||
gfx/drivers/nullgfx.o \
|
gfx/drivers/nullgfx.o \
|
||||||
audio/drivers/nullaudio.o \
|
audio/drivers/nullaudio.o \
|
||||||
input/drivers/nullinput.o \
|
input/drivers/nullinput.o \
|
||||||
|
input/drivers_hid/null_hid.o \
|
||||||
input/drivers_joypad/nullinput_joypad.o \
|
input/drivers_joypad/nullinput_joypad.o \
|
||||||
input/drivers_joypad/hid_joypad.o \
|
input/drivers_joypad/hid_joypad.o \
|
||||||
playlist.o \
|
playlist.o \
|
||||||
|
@ -343,15 +343,18 @@ INPUT
|
|||||||
|
|
||||||
#include "../input/drivers_joypad/hid_joypad.c"
|
#include "../input/drivers_joypad/hid_joypad.c"
|
||||||
|
|
||||||
|
#include "../input/drivers_hid/null_hid.c"
|
||||||
|
|
||||||
|
#ifdef HAVE_HID
|
||||||
|
#include "../input/drivers_hid/apple_hid.c"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
#include "../input/connect/joypad_connection.c"
|
#include "../input/connect/joypad_connection.c"
|
||||||
#include "../input/connect/connect_ps3.c"
|
#include "../input/connect/connect_ps3.c"
|
||||||
#include "../input/connect/connect_ps4.c"
|
#include "../input/connect/connect_ps4.c"
|
||||||
#include "../input/connect/connect_wii.c"
|
#include "../input/connect/connect_wii.c"
|
||||||
|
|
||||||
#ifdef HAVE_HID
|
|
||||||
#include "../input/drivers_hid/apple_hid.c"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IOS
|
#ifdef IOS
|
||||||
#include "../apple/iOS/bluetooth/btdynamic.c"
|
#include "../apple/iOS/bluetooth/btdynamic.c"
|
||||||
|
115
input/drivers_hid/null_hid.c
Normal file
115
input/drivers_hid/null_hid.c
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
/* RetroArch - A frontend for libretro.
|
||||||
|
* Copyright (C) 2013-2014 - Jason Fetters
|
||||||
|
* Copyright (C) 2011-2015 - 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../drivers/apple_input.h"
|
||||||
|
#include "../input_hid_driver.h"
|
||||||
|
|
||||||
|
typedef struct null_hid
|
||||||
|
{
|
||||||
|
void *empty;
|
||||||
|
} null_hid_t;
|
||||||
|
|
||||||
|
static bool null_hid_joypad_query(void *data, unsigned pad)
|
||||||
|
{
|
||||||
|
return pad < MAX_USERS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *null_hid_joypad_name(void *data, unsigned pad)
|
||||||
|
{
|
||||||
|
/* TODO/FIXME - implement properly */
|
||||||
|
if (pad >= MAX_USERS)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint64_t null_hid_joypad_get_buttons(void *data, unsigned port)
|
||||||
|
{
|
||||||
|
(void)data;
|
||||||
|
(void)port;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool null_hid_joypad_button(void *data, unsigned port, uint16_t joykey)
|
||||||
|
{
|
||||||
|
(void)data;
|
||||||
|
(void)port;
|
||||||
|
(void)joykey;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool null_hid_joypad_rumble(void *data, unsigned pad,
|
||||||
|
enum retro_rumble_effect effect, uint16_t strength)
|
||||||
|
{
|
||||||
|
(void)data;
|
||||||
|
(void)pad;
|
||||||
|
(void)effect;
|
||||||
|
(void)strength;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int16_t null_hid_joypad_axis(void *data, unsigned port, uint32_t joyaxis)
|
||||||
|
{
|
||||||
|
(void)data;
|
||||||
|
(void)port;
|
||||||
|
(void)joyaxis;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *null_hid_init(void)
|
||||||
|
{
|
||||||
|
null_hid_t *hid_null = (null_hid_t*)calloc(1, sizeof(*hid_null));
|
||||||
|
|
||||||
|
if (!hid_null)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
return hid_null;
|
||||||
|
|
||||||
|
error:
|
||||||
|
if (hid_null)
|
||||||
|
free(hid_null);
|
||||||
|
return hid_null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void null_hid_free(void *data)
|
||||||
|
{
|
||||||
|
null_hid_t *hid_null = (null_hid_t*)data;
|
||||||
|
|
||||||
|
if (hid_null)
|
||||||
|
free(hid_null);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void null_hid_poll(void *data)
|
||||||
|
{
|
||||||
|
(void)data;
|
||||||
|
}
|
||||||
|
|
||||||
|
hid_driver_t null_hid = {
|
||||||
|
null_hid_init,
|
||||||
|
null_hid_joypad_query,
|
||||||
|
null_hid_free,
|
||||||
|
null_hid_joypad_button,
|
||||||
|
null_hid_joypad_get_buttons,
|
||||||
|
null_hid_joypad_axis,
|
||||||
|
null_hid_poll,
|
||||||
|
null_hid_joypad_rumble,
|
||||||
|
null_hid_joypad_name,
|
||||||
|
"null",
|
||||||
|
};
|
@ -26,6 +26,7 @@ static hid_driver_t *hid_drivers[] = {
|
|||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
&apple_hid,
|
&apple_hid,
|
||||||
#endif
|
#endif
|
||||||
|
&null_hid,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ struct hid_driver
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern hid_driver_t apple_hid;
|
extern hid_driver_t apple_hid;
|
||||||
|
extern hid_driver_t null_hid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hid_driver_find_handle:
|
* hid_driver_find_handle:
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
#include "../libretro-common/compat/compat.c"
|
#include "../libretro-common/compat/compat.c"
|
||||||
|
|
||||||
#include "../input/drivers/nullinput.c"
|
#include "../input/drivers/nullinput.c"
|
||||||
|
#include "../input/drivers_hid/null_hid.c"
|
||||||
#include "../input/drivers_joypad/hid_joypad.c"
|
#include "../input/drivers_joypad/hid_joypad.c"
|
||||||
#include "../input/drivers_joypad/nullinput_joypad.c"
|
#include "../input/drivers_joypad/nullinput_joypad.c"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user