linux-dist: Replace platform ifdefs with USE_EVDEV and USE_JOYSTICK
This commit is contained in:
parent
064b22f237
commit
9dac10ae10
|
@ -34,11 +34,22 @@
|
|||
#endif
|
||||
|
||||
#if !defined(ANDROID) && HOST_OS != OS_DARWIN && !defined(TARGET_EMSCRIPTEN)
|
||||
#include <linux/joystick.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if defined(USE_EVDEV)
|
||||
#ifdef TARGET_PANDORA
|
||||
#define EVDEV_DEVICE "/dev/input/event4"
|
||||
#else
|
||||
#define EVDEV_DEVICE "/dev/event2"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(USE_JOYSTICK)
|
||||
#include <linux/joystick.h>
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_PANDORA
|
||||
#include <signal.h>
|
||||
#include <execinfo.h>
|
||||
|
@ -190,20 +201,18 @@ int setup_input_joystick(const char* device)
|
|||
|
||||
void SetupInput()
|
||||
{
|
||||
#if HOST_OS != OS_DARWIN && !defined(TARGET_EMSCRIPTEN)
|
||||
#ifdef TARGET_PANDORA
|
||||
#define EVDEV_DEVICE "/dev/input/event4"
|
||||
#else
|
||||
#define EVDEV_DEVICE "/dev/event2"
|
||||
#endif
|
||||
#if defined(USE_EVDEV)
|
||||
evdev_fd = setup_input_evdev(EVDEV_DEVICE);
|
||||
#endif
|
||||
|
||||
#if defined(USE_JOYSTICK)
|
||||
joystick_fd = setup_input_joystick("/dev/input/js0");
|
||||
#endif
|
||||
}
|
||||
|
||||
bool HandleKb(u32 port)
|
||||
{
|
||||
#if HOST_OS != OS_DARWIN && !defined(TARGET_EMSCRIPTEN)
|
||||
#if defined(USE_EVDEV)
|
||||
if (evdev_fd < 0)
|
||||
{
|
||||
return false;
|
||||
|
@ -318,7 +327,7 @@ bool HandleJoystick(u32 port)
|
|||
return false;
|
||||
}
|
||||
|
||||
#if HOST_OS != OS_DARWIN && !defined(TARGET_EMSCRIPTEN)
|
||||
#if defined(USE_JOYSTICK)
|
||||
struct js_event JE;
|
||||
while(read(joystick_fd, &JE, sizeof(JE)) == sizeof(JE))
|
||||
if (JE.number < MAP_SIZE)
|
||||
|
|
|
@ -7,6 +7,8 @@ WEBUI :=1
|
|||
USE_ALSA := 1
|
||||
USE_OSS := 1
|
||||
#USE_PULSEAUDIO := 1
|
||||
USE_EVDEV := 1
|
||||
USE_JOYSTICK := 1
|
||||
|
||||
CXX=${CC_PREFIX}g++
|
||||
CC=${CC_PREFIX}gcc
|
||||
|
@ -209,6 +211,14 @@ ifdef USE_X11
|
|||
LIBS += -lX11
|
||||
endif
|
||||
|
||||
ifdef USE_EVDEV
|
||||
CXXFLAGS += -D USE_EVDEV
|
||||
endif
|
||||
|
||||
ifdef USE_JOYSTICK
|
||||
CXXFLAGS += -D USE_JOYSTICK
|
||||
endif
|
||||
|
||||
ifdef USE_ALSA
|
||||
CXXFLAGS += -D USE_ALSA
|
||||
LIBS += -lasound
|
||||
|
|
Loading…
Reference in New Issue