early-access version 1617
This commit is contained in:
17
externals/SDL/src/SDL.c
vendored
17
externals/SDL/src/SDL.c
vendored
@@ -27,6 +27,12 @@
|
||||
#elif !defined(__WINRT__)
|
||||
#include <unistd.h> /* For _exit(), etc. */
|
||||
#endif
|
||||
#if defined(__OS2__)
|
||||
#include "core/os2/SDL_os2.h"
|
||||
#endif
|
||||
#if SDL_THREAD_OS2
|
||||
#include "thread/os2/SDL_systls_c.h"
|
||||
#endif
|
||||
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
#include <emscripten.h>
|
||||
@@ -159,6 +165,10 @@ SDL_InitSubSystem(Uint32 flags)
|
||||
flags |= SDL_INIT_EVENTS;
|
||||
}
|
||||
|
||||
#if SDL_THREAD_OS2
|
||||
SDL_OS2TLSAlloc(); /* thread/os2/SDL_systls.c */
|
||||
#endif
|
||||
|
||||
#if SDL_VIDEO_DRIVER_WINDOWS
|
||||
if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) {
|
||||
if (SDL_HelperWindowCreate() < 0) {
|
||||
@@ -294,6 +304,13 @@ SDL_Init(Uint32 flags)
|
||||
void
|
||||
SDL_QuitSubSystem(Uint32 flags)
|
||||
{
|
||||
#if SDL_THREAD_OS2
|
||||
SDL_OS2TLSFree(); /* thread/os2/SDL_systls.c */
|
||||
#endif
|
||||
#if defined(__OS2__)
|
||||
SDL_OS2Quit();
|
||||
#endif
|
||||
|
||||
/* Shut down requested initialized subsystems */
|
||||
#if !SDL_SENSOR_DISABLED
|
||||
if ((flags & SDL_INIT_SENSOR)) {
|
||||
|
3
externals/SDL/src/SDL_dataqueue.c
vendored
3
externals/SDL/src/SDL_dataqueue.c
vendored
@@ -18,11 +18,10 @@
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "./SDL_internal.h"
|
||||
|
||||
#include "SDL.h"
|
||||
#include "./SDL_dataqueue.h"
|
||||
#include "SDL_assert.h"
|
||||
|
||||
typedef struct SDL_DataQueuePacket
|
||||
{
|
||||
|
232
externals/SDL/src/SDL_error.c
vendored
232
externals/SDL/src/SDL_error.c
vendored
@@ -22,106 +22,31 @@
|
||||
|
||||
/* Simple error handling in SDL */
|
||||
|
||||
#include "SDL_log.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_error_c.h"
|
||||
|
||||
#define SDL_ERRBUFIZE 1024
|
||||
|
||||
/* Private functions */
|
||||
|
||||
static const char *
|
||||
SDL_LookupString(const char *key)
|
||||
{
|
||||
/* FIXME: Add code to lookup key in language string hash-table */
|
||||
return key;
|
||||
}
|
||||
|
||||
/* Public functions */
|
||||
|
||||
static char *SDL_GetErrorMsg(char *errstr, int maxlen);
|
||||
|
||||
int
|
||||
SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
SDL_error *error;
|
||||
|
||||
/* Ignore call if invalid format pointer was passed */
|
||||
if (fmt == NULL) return -1;
|
||||
if (fmt != NULL) {
|
||||
va_list ap;
|
||||
SDL_error *error = SDL_GetErrBuf();
|
||||
|
||||
/* Copy in the key, mark error as valid */
|
||||
error = SDL_GetErrBuf();
|
||||
error->error = 1;
|
||||
SDL_strlcpy((char *) error->key, fmt, sizeof(error->key));
|
||||
error->error = 1; /* mark error as valid */
|
||||
|
||||
va_start(ap, fmt);
|
||||
error->argc = 0;
|
||||
while (*fmt) {
|
||||
if (*fmt++ == '%') {
|
||||
while (*fmt == '.' || (*fmt >= '0' && *fmt <= '9')) {
|
||||
++fmt;
|
||||
}
|
||||
switch (*fmt++) {
|
||||
case 0: /* Malformed format string.. */
|
||||
--fmt;
|
||||
break;
|
||||
case 'l':
|
||||
switch (*fmt++) {
|
||||
case 0: /* Malformed format string.. */
|
||||
--fmt;
|
||||
break;
|
||||
case 'i': case 'd': case 'u': case 'x': case 'X':
|
||||
error->args[error->argc++].value_l = va_arg(ap, long);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'c':
|
||||
case 'i':
|
||||
case 'd':
|
||||
case 'u':
|
||||
case 'o':
|
||||
case 'x':
|
||||
case 'X':
|
||||
error->args[error->argc++].value_i = va_arg(ap, int);
|
||||
break;
|
||||
case 'f':
|
||||
error->args[error->argc++].value_f = va_arg(ap, double);
|
||||
break;
|
||||
case 'p':
|
||||
error->args[error->argc++].value_ptr = va_arg(ap, void *);
|
||||
break;
|
||||
case 's':
|
||||
{
|
||||
int i = error->argc;
|
||||
const char *str = va_arg(ap, const char *);
|
||||
if (str == NULL)
|
||||
str = "(null)";
|
||||
SDL_strlcpy((char *) error->args[i].buf, str,
|
||||
ERR_MAX_STRLEN);
|
||||
error->argc++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (error->argc >= ERR_MAX_ARGS) {
|
||||
break;
|
||||
}
|
||||
va_start(ap, fmt);
|
||||
SDL_vsnprintf(error->str, ERR_MAX_STRLEN, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (SDL_LogGetPriority(SDL_LOG_CATEGORY_ERROR) <= SDL_LOG_PRIORITY_DEBUG) {
|
||||
/* If we are in debug mode, print out the error message */
|
||||
SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", error->str);
|
||||
}
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
if (SDL_LogGetPriority(SDL_LOG_CATEGORY_ERROR) <= SDL_LOG_PRIORITY_DEBUG) {
|
||||
/* If we are in debug mode, print out an error message
|
||||
* Avoid stomping on the static buffer in GetError, just
|
||||
* in case this is called while processing a ShowMessageBox to
|
||||
* show an error already in that static buffer.
|
||||
*/
|
||||
char errmsg[SDL_ERRBUFIZE];
|
||||
SDL_GetErrorMsg(errmsg, sizeof(errmsg));
|
||||
SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", errmsg);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -129,18 +54,14 @@ SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
|
||||
const char *
|
||||
SDL_GetError(void)
|
||||
{
|
||||
static char errmsg[SDL_ERRBUFIZE];
|
||||
|
||||
return SDL_GetErrorMsg(errmsg, SDL_ERRBUFIZE);
|
||||
const SDL_error *error = SDL_GetErrBuf();
|
||||
return error->error ? error->str : "";
|
||||
}
|
||||
|
||||
void
|
||||
SDL_ClearError(void)
|
||||
{
|
||||
SDL_error *error;
|
||||
|
||||
error = SDL_GetErrBuf();
|
||||
error->error = 0;
|
||||
SDL_GetErrBuf()->error = 0;
|
||||
}
|
||||
|
||||
/* Very common errors go here */
|
||||
@@ -181,129 +102,18 @@ main(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
|
||||
/* keep this at the end of the file so it works with GCC builds that don't
|
||||
support "#pragma GCC diagnostic push" ... we'll just leave the warning
|
||||
disabled after this. */
|
||||
/* this pragma arrived in GCC 4.2 and causes a warning on older GCCs! Sigh. */
|
||||
#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 2))))
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
#endif
|
||||
|
||||
/* This function has a bit more overhead than most error functions
|
||||
so that it supports internationalization and thread-safe errors.
|
||||
*/
|
||||
static char *
|
||||
char *
|
||||
SDL_GetErrorMsg(char *errstr, int maxlen)
|
||||
{
|
||||
SDL_error *error;
|
||||
const SDL_error *error = SDL_GetErrBuf();
|
||||
|
||||
/* Clear the error string */
|
||||
*errstr = '\0';
|
||||
--maxlen;
|
||||
|
||||
/* Get the thread-safe error, and print it out */
|
||||
error = SDL_GetErrBuf();
|
||||
if (error->error) {
|
||||
const char *fmt;
|
||||
char *msg = errstr;
|
||||
int len;
|
||||
int argi;
|
||||
|
||||
fmt = SDL_LookupString(error->key);
|
||||
argi = 0;
|
||||
while (*fmt && (maxlen > 0)) {
|
||||
if (*fmt == '%') {
|
||||
char tmp[32], *spot = tmp;
|
||||
*spot++ = *fmt++;
|
||||
while ((*fmt == '.' || (*fmt >= '0' && *fmt <= '9'))
|
||||
&& spot < (tmp + SDL_arraysize(tmp) - 2)) {
|
||||
*spot++ = *fmt++;
|
||||
}
|
||||
if (*fmt == 'l') {
|
||||
*spot++ = *fmt++;
|
||||
*spot++ = *fmt++;
|
||||
*spot++ = '\0';
|
||||
switch (spot[-2]) {
|
||||
case 'i': case 'd': case 'u': case 'x': case 'X':
|
||||
len = SDL_snprintf(msg, maxlen, tmp,
|
||||
error->args[argi++].value_l);
|
||||
if (len > 0) {
|
||||
msg += len;
|
||||
maxlen -= len;
|
||||
}
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
*spot++ = *fmt++;
|
||||
*spot++ = '\0';
|
||||
switch (spot[-2]) {
|
||||
case '%':
|
||||
*msg++ = '%';
|
||||
maxlen -= 1;
|
||||
break;
|
||||
case 'c':
|
||||
case 'i':
|
||||
case 'd':
|
||||
case 'u':
|
||||
case 'o':
|
||||
case 'x':
|
||||
case 'X':
|
||||
len =
|
||||
SDL_snprintf(msg, maxlen, tmp,
|
||||
error->args[argi++].value_i);
|
||||
if (len > 0) {
|
||||
msg += len;
|
||||
maxlen -= len;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
len =
|
||||
SDL_snprintf(msg, maxlen, tmp,
|
||||
error->args[argi++].value_f);
|
||||
if (len > 0) {
|
||||
msg += len;
|
||||
maxlen -= len;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
len =
|
||||
SDL_snprintf(msg, maxlen, tmp,
|
||||
error->args[argi++].value_ptr);
|
||||
if (len > 0) {
|
||||
msg += len;
|
||||
maxlen -= len;
|
||||
}
|
||||
break;
|
||||
|
||||
case 's':
|
||||
len =
|
||||
SDL_snprintf(msg, maxlen, tmp,
|
||||
SDL_LookupString(error->args[argi++].
|
||||
buf));
|
||||
if (len > 0) {
|
||||
msg += len;
|
||||
maxlen -= len;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
} else {
|
||||
*msg++ = *fmt++;
|
||||
maxlen -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* slide back if we've overshot the end of our buffer. */
|
||||
if (maxlen < 0) {
|
||||
msg -= (-maxlen) + 1;
|
||||
}
|
||||
|
||||
*msg = 0; /* NULL terminate the string */
|
||||
SDL_strlcpy(errstr, error->str, maxlen);
|
||||
} else {
|
||||
*errstr = '\0';
|
||||
}
|
||||
return (errstr);
|
||||
|
||||
return errstr;
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
26
externals/SDL/src/SDL_error_c.h
vendored
26
externals/SDL/src/SDL_error_c.h
vendored
@@ -28,33 +28,11 @@
|
||||
#define SDL_error_c_h_
|
||||
|
||||
#define ERR_MAX_STRLEN 128
|
||||
#define ERR_MAX_ARGS 5
|
||||
|
||||
typedef struct SDL_error
|
||||
{
|
||||
/* This is a numeric value corresponding to the current error */
|
||||
int error;
|
||||
|
||||
/* This is a key used to index into a language hashtable containing
|
||||
internationalized versions of the SDL error messages. If the key
|
||||
is not in the hashtable, or no hashtable is available, the key is
|
||||
used directly as an error message format string.
|
||||
*/
|
||||
char key[ERR_MAX_STRLEN];
|
||||
|
||||
/* These are the arguments for the error functions */
|
||||
int argc;
|
||||
union
|
||||
{
|
||||
void *value_ptr;
|
||||
#if 0 /* What is a character anyway? (UNICODE issues) */
|
||||
unsigned char value_c;
|
||||
#endif
|
||||
int value_i;
|
||||
long value_l;
|
||||
double value_f;
|
||||
char buf[ERR_MAX_STRLEN];
|
||||
} args[ERR_MAX_ARGS];
|
||||
int error; /* This is a numeric value corresponding to the current error */
|
||||
char str[ERR_MAX_STRLEN];
|
||||
} SDL_error;
|
||||
|
||||
/* Defined in SDL_thread.c */
|
||||
|
3
externals/SDL/src/SDL_internal.h
vendored
3
externals/SDL/src/SDL_internal.h
vendored
@@ -116,6 +116,9 @@
|
||||
#define SDL_HAVE_YUV !SDL_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_log.h"
|
||||
|
||||
#endif /* SDL_internal_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
2
externals/SDL/src/atomic/SDL_spinlock.c
vendored
2
externals/SDL/src/atomic/SDL_spinlock.c
vendored
@@ -138,6 +138,8 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
|
||||
/* "REP NOP" is PAUSE, coded for tools that don't know it by that name. */
|
||||
#if (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))
|
||||
#define PAUSE_INSTRUCTION() __asm__ __volatile__("pause\n") /* Some assemblers can't do REP NOP, so go with PAUSE. */
|
||||
#elif (defined(__arm__) && __ARM_ARCH__ >= 7) || defined(__aarch64__)
|
||||
#define PAUSE_INSTRUCTION() __asm__ __volatile__("yield" ::: "memory")
|
||||
#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
|
||||
#define PAUSE_INSTRUCTION() _mm_pause() /* this is actually "rep nop" and not a SIMD instruction. No inline asm in MSVC x86-64! */
|
||||
#elif defined(__WATCOMC__) && defined(__386__)
|
||||
|
7
externals/SDL/src/audio/SDL_audio.c
vendored
7
externals/SDL/src/audio/SDL_audio.c
vendored
@@ -104,6 +104,9 @@ static const AudioBootStrap *const bootstrap[] = {
|
||||
#if SDL_AUDIO_DRIVER_JACK
|
||||
&JACK_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_OS2
|
||||
&OS2AUDIO_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_DISK
|
||||
&DISKAUDIO_bootstrap,
|
||||
#endif
|
||||
@@ -574,7 +577,7 @@ SDL_BufferQueueDrainCallback(void *userdata, Uint8 *stream, int len)
|
||||
|
||||
if (len > 0) { /* fill any remaining space in the stream with silence. */
|
||||
SDL_assert(SDL_CountDataQueue(device->buffer_queue) == 0);
|
||||
SDL_memset(stream, device->spec.silence, len);
|
||||
SDL_memset(stream, device->callbackspec.silence, len);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -730,7 +733,7 @@ SDL_RunAudio(void *devicep)
|
||||
/* !!! FIXME: this should be LockDevice. */
|
||||
SDL_LockMutex(device->mixer_lock);
|
||||
if (SDL_AtomicGet(&device->paused)) {
|
||||
SDL_memset(data, device->spec.silence, data_len);
|
||||
SDL_memset(data, device->callbackspec.silence, data_len);
|
||||
} else {
|
||||
callback(udata, data, data_len);
|
||||
}
|
||||
|
1
externals/SDL/src/audio/SDL_audiocvt.c
vendored
1
externals/SDL/src/audio/SDL_audiocvt.c
vendored
@@ -30,7 +30,6 @@
|
||||
#include "SDL_audio_c.h"
|
||||
|
||||
#include "SDL_loadso.h"
|
||||
#include "SDL_assert.h"
|
||||
#include "../SDL_dataqueue.h"
|
||||
#include "SDL_cpuinfo.h"
|
||||
|
||||
|
3
externals/SDL/src/audio/SDL_audiotypecvt.c
vendored
3
externals/SDL/src/audio/SDL_audiotypecvt.c
vendored
@@ -18,12 +18,11 @@
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
#include "SDL_audio.h"
|
||||
#include "SDL_audio_c.h"
|
||||
#include "SDL_cpuinfo.h"
|
||||
#include "SDL_assert.h"
|
||||
|
||||
#ifdef __ARM_NEON
|
||||
#define HAVE_NEON_INTRINSICS 1
|
||||
|
1
externals/SDL/src/audio/SDL_sysaudio.h
vendored
1
externals/SDL/src/audio/SDL_sysaudio.h
vendored
@@ -207,6 +207,7 @@ extern AudioBootStrap openslES_bootstrap;
|
||||
extern AudioBootStrap ANDROIDAUDIO_bootstrap;
|
||||
extern AudioBootStrap PSPAUDIO_bootstrap;
|
||||
extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap;
|
||||
extern AudioBootStrap OS2AUDIO_bootstrap;
|
||||
|
||||
#endif /* SDL_sysaudio_h_ */
|
||||
|
||||
|
13
externals/SDL/src/audio/SDL_wave.c
vendored
13
externals/SDL/src/audio/SDL_wave.c
vendored
@@ -22,19 +22,17 @@
|
||||
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#else
|
||||
#ifndef SIZE_MAX
|
||||
#define SIZE_MAX ((size_t)-1)
|
||||
#endif
|
||||
#ifndef INT_MAX
|
||||
/* Make a lucky guess. */
|
||||
#define INT_MAX SDL_MAX_SINT32
|
||||
#endif
|
||||
#ifndef SIZE_MAX
|
||||
#define SIZE_MAX ((size_t)-1)
|
||||
#endif
|
||||
|
||||
/* Microsoft WAVE file loading routines */
|
||||
|
||||
#include "SDL_log.h"
|
||||
#include "SDL_hints.h"
|
||||
#include "SDL_audio.h"
|
||||
#include "SDL_wave.h"
|
||||
@@ -929,7 +927,7 @@ IMA_ADPCM_DecodeBlockHeader(ADPCM_DecoderState *state)
|
||||
{
|
||||
Sint16 step;
|
||||
Uint32 c;
|
||||
Uint8 *cstate = state->cstate;
|
||||
Uint8 *cstate = (Uint8 *) state->cstate;
|
||||
|
||||
for (c = 0; c < state->channels; c++) {
|
||||
size_t o = state->block.pos + c * 4;
|
||||
@@ -1335,7 +1333,8 @@ PCM_Init(WaveFile *file, size_t datalength)
|
||||
/* It wouldn't be that hard to support more exotic block sizes, but
|
||||
* the most common formats should do for now.
|
||||
*/
|
||||
if (format->blockalign * 8 != format->channels * format->bitspersample) {
|
||||
/* Make sure we're a multiple of the blockalign, at least. */
|
||||
if ((format->channels * format->bitspersample) % (format->blockalign * 8)) {
|
||||
return SDL_SetError("Unsupported block alignment");
|
||||
}
|
||||
|
||||
@@ -1561,7 +1560,7 @@ WaveReadPartialChunkData(SDL_RWops *src, WaveChunk *chunk, size_t length)
|
||||
}
|
||||
|
||||
if (length > 0) {
|
||||
chunk->data = SDL_malloc(length);
|
||||
chunk->data = (Uint8 *) SDL_malloc(length);
|
||||
if (chunk->data == NULL) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
@@ -32,7 +32,6 @@
|
||||
#include <signal.h> /* For kill() */
|
||||
#include <string.h>
|
||||
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_timer.h"
|
||||
#include "SDL_audio.h"
|
||||
#include "../SDL_audio_c.h"
|
||||
|
@@ -24,7 +24,6 @@
|
||||
|
||||
/* Output audio to Android */
|
||||
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_audio.h"
|
||||
#include "../SDL_audio_c.h"
|
||||
#include "SDL_androidaudio.h"
|
||||
|
@@ -31,7 +31,6 @@
|
||||
|
||||
#if MACOSX_COREAUDIO
|
||||
#include <CoreAudio/CoreAudio.h>
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#else
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
#import <UIKit/UIApplication.h>
|
||||
@@ -47,6 +46,7 @@ struct SDL_PrivateAudioData
|
||||
{
|
||||
SDL_Thread *thread;
|
||||
AudioQueueRef audioQueue;
|
||||
int numAudioBuffers;
|
||||
AudioQueueBufferRef *audioBuffer;
|
||||
void *buffer;
|
||||
UInt32 bufferOffset;
|
||||
@@ -57,6 +57,7 @@ struct SDL_PrivateAudioData
|
||||
SDL_atomic_t shutdown;
|
||||
#if MACOSX_COREAUDIO
|
||||
AudioDeviceID deviceID;
|
||||
SDL_atomic_t device_change_flag;
|
||||
#else
|
||||
SDL_bool interrupted;
|
||||
CFTypeRef interruption_listener;
|
||||
|
344
externals/SDL/src/audio/coreaudio/SDL_coreaudio.m
vendored
344
externals/SDL/src/audio/coreaudio/SDL_coreaudio.m
vendored
@@ -29,16 +29,25 @@
|
||||
#include "../SDL_audio_c.h"
|
||||
#include "../SDL_sysaudio.h"
|
||||
#include "SDL_coreaudio.h"
|
||||
#include "SDL_assert.h"
|
||||
#include "../../thread/SDL_systhread.h"
|
||||
|
||||
#define DEBUG_COREAUDIO 0
|
||||
|
||||
#define CHECK_RESULT(msg) \
|
||||
if (result != noErr) { \
|
||||
SDL_SetError("CoreAudio error (%s): %d", msg, (int) result); \
|
||||
return 0; \
|
||||
}
|
||||
#if DEBUG_COREAUDIO
|
||||
#define CHECK_RESULT(msg) \
|
||||
if (result != noErr) { \
|
||||
printf("COREAUDIO: Got error %d from '%s'!\n", (int) result, msg); \
|
||||
SDL_SetError("CoreAudio error (%s): %d", msg, (int) result); \
|
||||
return 0; \
|
||||
}
|
||||
#else
|
||||
#define CHECK_RESULT(msg) \
|
||||
if (result != noErr) { \
|
||||
SDL_SetError("CoreAudio error (%s): %d", msg, (int) result); \
|
||||
return 0; \
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if MACOSX_COREAUDIO
|
||||
static const AudioObjectPropertyAddress devlist_address = {
|
||||
@@ -270,11 +279,47 @@ device_list_changed(AudioObjectID systemObj, UInt32 num_addr, const AudioObjectP
|
||||
#endif
|
||||
|
||||
|
||||
static int open_playback_devices = 0;
|
||||
static int open_capture_devices = 0;
|
||||
static int open_playback_devices;
|
||||
static int open_capture_devices;
|
||||
static int num_open_devices;
|
||||
static SDL_AudioDevice **open_devices;
|
||||
|
||||
#if !MACOSX_COREAUDIO
|
||||
|
||||
static BOOL session_active = NO;
|
||||
|
||||
static void pause_audio_devices()
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!open_devices) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_open_devices; ++i) {
|
||||
SDL_AudioDevice *device = open_devices[i];
|
||||
if (device->hidden->audioQueue && !device->hidden->interrupted) {
|
||||
AudioQueuePause(device->hidden->audioQueue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void resume_audio_devices()
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!open_devices) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_open_devices; ++i) {
|
||||
SDL_AudioDevice *device = open_devices[i];
|
||||
if (device->hidden->audioQueue && !device->hidden->interrupted) {
|
||||
AudioQueueStart(device->hidden->audioQueue, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void interruption_begin(_THIS)
|
||||
{
|
||||
if (this != NULL && this->hidden->audioQueue != NULL) {
|
||||
@@ -321,61 +366,107 @@ static void interruption_end(_THIS)
|
||||
|
||||
@end
|
||||
|
||||
static BOOL update_audio_session(_THIS, SDL_bool open)
|
||||
static BOOL update_audio_session(_THIS, SDL_bool open, SDL_bool allow_playandrecord)
|
||||
{
|
||||
@autoreleasepool {
|
||||
AVAudioSession *session = [AVAudioSession sharedInstance];
|
||||
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
|
||||
|
||||
/* Set category to ambient by default so that other music continues playing. */
|
||||
NSString *category = AVAudioSessionCategoryAmbient;
|
||||
NSString *category = AVAudioSessionCategoryPlayback;
|
||||
NSString *mode = AVAudioSessionModeDefault;
|
||||
NSUInteger options = 0;
|
||||
NSUInteger options = AVAudioSessionCategoryOptionMixWithOthers;
|
||||
NSError *err = nil;
|
||||
const char *hint;
|
||||
|
||||
if (open_playback_devices && open_capture_devices) {
|
||||
hint = SDL_GetHint(SDL_HINT_AUDIO_CATEGORY);
|
||||
if (hint) {
|
||||
if (SDL_strcasecmp(hint, "AVAudioSessionCategoryAmbient") == 0) {
|
||||
category = AVAudioSessionCategoryAmbient;
|
||||
} else if (SDL_strcasecmp(hint, "AVAudioSessionCategorySoloAmbient") == 0) {
|
||||
category = AVAudioSessionCategorySoloAmbient;
|
||||
options &= ~AVAudioSessionCategoryOptionMixWithOthers;
|
||||
} else if (SDL_strcasecmp(hint, "AVAudioSessionCategoryPlayback") == 0 ||
|
||||
SDL_strcasecmp(hint, "playback") == 0) {
|
||||
category = AVAudioSessionCategoryPlayback;
|
||||
options &= ~AVAudioSessionCategoryOptionMixWithOthers;
|
||||
} else if (SDL_strcasecmp(hint, "AVAudioSessionCategoryPlayAndRecord") == 0 ||
|
||||
SDL_strcasecmp(hint, "playandrecord") == 0) {
|
||||
if (allow_playandrecord) {
|
||||
category = AVAudioSessionCategoryPlayAndRecord;
|
||||
}
|
||||
}
|
||||
} else if (open_playback_devices && open_capture_devices) {
|
||||
category = AVAudioSessionCategoryPlayAndRecord;
|
||||
#if !TARGET_OS_TV
|
||||
options = AVAudioSessionCategoryOptionDefaultToSpeaker;
|
||||
#endif
|
||||
} else if (open_capture_devices) {
|
||||
category = AVAudioSessionCategoryRecord;
|
||||
}
|
||||
|
||||
#if !TARGET_OS_TV
|
||||
if (category == AVAudioSessionCategoryPlayAndRecord) {
|
||||
options |= AVAudioSessionCategoryOptionDefaultToSpeaker;
|
||||
}
|
||||
#endif
|
||||
if (category == AVAudioSessionCategoryRecord ||
|
||||
category == AVAudioSessionCategoryPlayAndRecord) {
|
||||
/* AVAudioSessionCategoryOptionAllowBluetooth isn't available in the SDK for
|
||||
Apple TV but is still needed in order to output to Bluetooth devices.
|
||||
*/
|
||||
options |= 0x4; /* AVAudioSessionCategoryOptionAllowBluetooth; */
|
||||
}
|
||||
if (category == AVAudioSessionCategoryPlayAndRecord) {
|
||||
options |= AVAudioSessionCategoryOptionAllowBluetoothA2DP |
|
||||
AVAudioSessionCategoryOptionAllowAirPlay;
|
||||
}
|
||||
if (category == AVAudioSessionCategoryPlayback ||
|
||||
category == AVAudioSessionCategoryPlayAndRecord) {
|
||||
options |= AVAudioSessionCategoryOptionDuckOthers;
|
||||
}
|
||||
|
||||
if ([session respondsToSelector:@selector(setCategory:mode:options:error:)]) {
|
||||
if (![session.category isEqualToString:category] || session.categoryOptions != options) {
|
||||
/* Stop the current session so we don't interrupt other application audio */
|
||||
pause_audio_devices();
|
||||
[session setActive:NO error:nil];
|
||||
session_active = NO;
|
||||
|
||||
if (![session setCategory:category mode:mode options:options error:&err]) {
|
||||
NSString *desc = err.description;
|
||||
SDL_SetError("Could not set Audio Session category: %s", desc.UTF8String);
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const char *hint = SDL_GetHint(SDL_HINT_AUDIO_CATEGORY);
|
||||
if (hint) {
|
||||
if (SDL_strcasecmp(hint, "AVAudioSessionCategoryAmbient") == 0) {
|
||||
category = AVAudioSessionCategoryAmbient;
|
||||
} else if (SDL_strcasecmp(hint, "AVAudioSessionCategorySoloAmbient") == 0) {
|
||||
category = AVAudioSessionCategorySoloAmbient;
|
||||
} else if (SDL_strcasecmp(hint, "AVAudioSessionCategoryPlayback") == 0 ||
|
||||
SDL_strcasecmp(hint, "playback") == 0) {
|
||||
category = AVAudioSessionCategoryPlayback;
|
||||
if (![session.category isEqualToString:category]) {
|
||||
/* Stop the current session so we don't interrupt other application audio */
|
||||
pause_audio_devices();
|
||||
[session setActive:NO error:nil];
|
||||
session_active = NO;
|
||||
|
||||
if (![session setCategory:category error:&err]) {
|
||||
NSString *desc = err.description;
|
||||
SDL_SetError("Could not set Audio Session category: %s", desc.UTF8String);
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ([session respondsToSelector:@selector(setCategory:mode:options:error:)]) {
|
||||
if (![session setCategory:category mode:mode options:options error:&err]) {
|
||||
NSString *desc = err.description;
|
||||
SDL_SetError("Could not set Audio Session category: %s", desc.UTF8String);
|
||||
return NO;
|
||||
}
|
||||
} else {
|
||||
if (![session setCategory:category error:&err]) {
|
||||
NSString *desc = err.description;
|
||||
SDL_SetError("Could not set Audio Session category: %s", desc.UTF8String);
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
if (open && (open_playback_devices + open_capture_devices) == 1) {
|
||||
if ((open_playback_devices || open_capture_devices) && !session_active) {
|
||||
if (![session setActive:YES error:&err]) {
|
||||
if ([err code] == AVAudioSessionErrorCodeResourceNotAvailable &&
|
||||
category == AVAudioSessionCategoryPlayAndRecord) {
|
||||
return update_audio_session(this, open, SDL_FALSE);
|
||||
}
|
||||
|
||||
NSString *desc = err.description;
|
||||
SDL_SetError("Could not activate Audio Session: %s", desc.UTF8String);
|
||||
return NO;
|
||||
}
|
||||
} else if (!open_playback_devices && !open_capture_devices) {
|
||||
session_active = YES;
|
||||
resume_audio_devices();
|
||||
} else if (!open_playback_devices && !open_capture_devices && session_active) {
|
||||
pause_audio_devices();
|
||||
[session setActive:NO error:nil];
|
||||
session_active = NO;
|
||||
}
|
||||
|
||||
if (open) {
|
||||
@@ -403,13 +494,11 @@ static BOOL update_audio_session(_THIS, SDL_bool open)
|
||||
|
||||
this->hidden->interruption_listener = CFBridgingRetain(listener);
|
||||
} else {
|
||||
if (this->hidden->interruption_listener != NULL) {
|
||||
SDLInterruptionListener *listener = nil;
|
||||
listener = (SDLInterruptionListener *) CFBridgingRelease(this->hidden->interruption_listener);
|
||||
[center removeObserver:listener];
|
||||
@synchronized (listener) {
|
||||
listener.device = NULL;
|
||||
}
|
||||
SDLInterruptionListener *listener = nil;
|
||||
listener = (SDLInterruptionListener *) CFBridgingRelease(this->hidden->interruption_listener);
|
||||
[center removeObserver:listener];
|
||||
@synchronized (listener) {
|
||||
listener.device = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -431,12 +520,12 @@ outputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffe
|
||||
if (!SDL_AtomicGet(&this->enabled) || SDL_AtomicGet(&this->paused)) {
|
||||
/* Supply silence if audio is not enabled or paused */
|
||||
SDL_memset(inBuffer->mAudioData, this->spec.silence, inBuffer->mAudioDataBytesCapacity);
|
||||
} else if (this->stream ) {
|
||||
} else if (this->stream) {
|
||||
UInt32 remaining = inBuffer->mAudioDataBytesCapacity;
|
||||
Uint8 *ptr = (Uint8 *) inBuffer->mAudioData;
|
||||
|
||||
while (remaining > 0) {
|
||||
if ( SDL_AudioStreamAvailable(this->stream) == 0 ) {
|
||||
if (SDL_AudioStreamAvailable(this->stream) == 0) {
|
||||
/* Generate the data */
|
||||
SDL_LockMutex(this->mixer_lock);
|
||||
(*this->callbackspec.callback)(this->callbackspec.userdata,
|
||||
@@ -445,10 +534,10 @@ outputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffe
|
||||
this->hidden->bufferOffset = 0;
|
||||
SDL_AudioStreamPut(this->stream, this->hidden->buffer, this->hidden->bufferSize);
|
||||
}
|
||||
if ( SDL_AudioStreamAvailable(this->stream) > 0 ) {
|
||||
if (SDL_AudioStreamAvailable(this->stream) > 0) {
|
||||
int got;
|
||||
UInt32 len = SDL_AudioStreamAvailable(this->stream);
|
||||
if ( len > remaining )
|
||||
if (len > remaining)
|
||||
len = remaining;
|
||||
got = SDL_AudioStreamGet(this->stream, ptr, len);
|
||||
SDL_assert((got < 0) || (got == len));
|
||||
@@ -494,7 +583,7 @@ outputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffe
|
||||
static void
|
||||
inputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer,
|
||||
const AudioTimeStamp *inStartTime, UInt32 inNumberPacketDescriptions,
|
||||
const AudioStreamPacketDescription *inPacketDescs )
|
||||
const AudioStreamPacketDescription *inPacketDescs)
|
||||
{
|
||||
SDL_AudioDevice *this = (SDL_AudioDevice *) inUserData;
|
||||
|
||||
@@ -566,18 +655,32 @@ device_unplugged(AudioObjectID devid, UInt32 num_addr, const AudioObjectProperty
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* macOS calls this when the default device changed (if we have a default device open). */
|
||||
static OSStatus
|
||||
default_device_changed(AudioObjectID inObjectID, UInt32 inNumberAddresses, const AudioObjectPropertyAddress *inAddresses, void *inUserData)
|
||||
{
|
||||
SDL_AudioDevice *this = (SDL_AudioDevice *) inUserData;
|
||||
#if DEBUG_COREAUDIO
|
||||
printf("COREAUDIO: default device changed for SDL audio device %p!\n", this);
|
||||
#endif
|
||||
SDL_AtomicSet(&this->hidden->device_change_flag, 1); /* let the audioqueue thread pick up on this when safe to do so. */
|
||||
return noErr;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
COREAUDIO_CloseDevice(_THIS)
|
||||
{
|
||||
const SDL_bool iscapture = this->iscapture;
|
||||
int i;
|
||||
|
||||
/* !!! FIXME: what does iOS do when a bluetooth audio device vanishes? Headphones unplugged? */
|
||||
/* !!! FIXME: (we only do a "default" device on iOS right now...can we do more?) */
|
||||
#if MACOSX_COREAUDIO
|
||||
/* Fire a callback if the device stops being "alive" (disconnected, etc). */
|
||||
AudioObjectRemovePropertyListener(this->hidden->deviceID, &alive_address, device_unplugged, this);
|
||||
if (this->handle != NULL) { /* we don't register this listener for default devices. */
|
||||
AudioObjectRemovePropertyListener(this->hidden->deviceID, &alive_address, device_unplugged, this);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (iscapture) {
|
||||
@@ -587,9 +690,23 @@ COREAUDIO_CloseDevice(_THIS)
|
||||
}
|
||||
|
||||
#if !MACOSX_COREAUDIO
|
||||
update_audio_session(this, SDL_FALSE);
|
||||
update_audio_session(this, SDL_FALSE, SDL_TRUE);
|
||||
#endif
|
||||
|
||||
for (i = 0; i < num_open_devices; ++i) {
|
||||
if (open_devices[i] == this) {
|
||||
--num_open_devices;
|
||||
if (i < num_open_devices) {
|
||||
SDL_memmove(&open_devices[i], &open_devices[i+1], sizeof(open_devices[i])*(num_open_devices - i));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (num_open_devices == 0) {
|
||||
SDL_free(open_devices);
|
||||
open_devices = NULL;
|
||||
}
|
||||
|
||||
/* if callback fires again, feed silence; don't call into the app. */
|
||||
SDL_AtomicSet(&this->paused, 1);
|
||||
|
||||
@@ -666,6 +783,26 @@ prepare_device(_THIS, void *handle, int iscapture)
|
||||
this->hidden->deviceID = devid;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
assign_device_to_audioqueue(_THIS)
|
||||
{
|
||||
const AudioObjectPropertyAddress prop = {
|
||||
kAudioDevicePropertyDeviceUID,
|
||||
this->iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput,
|
||||
kAudioObjectPropertyElementMaster
|
||||
};
|
||||
|
||||
OSStatus result;
|
||||
CFStringRef devuid;
|
||||
UInt32 devuidsize = sizeof (devuid);
|
||||
result = AudioObjectGetPropertyData(this->hidden->deviceID, &prop, 0, NULL, &devuidsize, &devuid);
|
||||
CHECK_RESULT("AudioObjectGetPropertyData (kAudioDevicePropertyDeviceUID)");
|
||||
result = AudioQueueSetProperty(this->hidden->audioQueue, kAudioQueueProperty_CurrentDevice, &devuid, devuidsize);
|
||||
CHECK_RESULT("AudioQueueSetProperty (kAudioQueueProperty_CurrentDevice)");
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
@@ -686,26 +823,21 @@ prepare_audioqueue(_THIS)
|
||||
CHECK_RESULT("AudioQueueNewOutput");
|
||||
}
|
||||
|
||||
#if MACOSX_COREAUDIO
|
||||
{
|
||||
const AudioObjectPropertyAddress prop = {
|
||||
kAudioDevicePropertyDeviceUID,
|
||||
iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput,
|
||||
kAudioObjectPropertyElementMaster
|
||||
};
|
||||
CFStringRef devuid;
|
||||
UInt32 devuidsize = sizeof (devuid);
|
||||
result = AudioObjectGetPropertyData(this->hidden->deviceID, &prop, 0, NULL, &devuidsize, &devuid);
|
||||
CHECK_RESULT("AudioObjectGetPropertyData (kAudioDevicePropertyDeviceUID)");
|
||||
result = AudioQueueSetProperty(this->hidden->audioQueue, kAudioQueueProperty_CurrentDevice, &devuid, devuidsize);
|
||||
CHECK_RESULT("AudioQueueSetProperty (kAudioQueueProperty_CurrentDevice)");
|
||||
#if MACOSX_COREAUDIO
|
||||
if (!assign_device_to_audioqueue(this)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* !!! FIXME: what does iOS do when a bluetooth audio device vanishes? Headphones unplugged? */
|
||||
/* !!! FIXME: (we only do a "default" device on iOS right now...can we do more?) */
|
||||
/* Fire a callback if the device stops being "alive" (disconnected, etc). */
|
||||
AudioObjectAddPropertyListener(this->hidden->deviceID, &alive_address, device_unplugged, this);
|
||||
}
|
||||
#endif
|
||||
/* only listen for unplugging on specific devices, not the default device, as that should
|
||||
switch to a different device (or hang out silently if there _is_ no other device). */
|
||||
if (this->handle != NULL) {
|
||||
/* !!! FIXME: what does iOS do when a bluetooth audio device vanishes? Headphones unplugged? */
|
||||
/* !!! FIXME: (we only do a "default" device on iOS right now...can we do more?) */
|
||||
/* Fire a callback if the device stops being "alive" (disconnected, etc). */
|
||||
/* If this fails, oh well, we won't notice a device had an extraordinary event take place. */
|
||||
AudioObjectAddPropertyListener(this->hidden->deviceID, &alive_address, device_unplugged, this);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Calculate the final parameters for this audio specification */
|
||||
SDL_CalculateAudioSpec(&this->spec);
|
||||
@@ -769,6 +901,7 @@ prepare_audioqueue(_THIS)
|
||||
numAudioBuffers = ((int)SDL_ceil(MINIMUM_AUDIO_BUFFER_TIME_MS / msecs) * 2);
|
||||
}
|
||||
|
||||
this->hidden->numAudioBuffers = numAudioBuffers;
|
||||
this->hidden->audioBuffer = SDL_calloc(1, sizeof (AudioQueueBufferRef) * numAudioBuffers);
|
||||
if (this->hidden->audioBuffer == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
@@ -784,6 +917,7 @@ prepare_audioqueue(_THIS)
|
||||
CHECK_RESULT("AudioQueueAllocateBuffer");
|
||||
SDL_memset(this->hidden->audioBuffer[i]->mAudioData, this->spec.silence, this->hidden->audioBuffer[i]->mAudioDataBytesCapacity);
|
||||
this->hidden->audioBuffer[i]->mAudioDataByteSize = this->hidden->audioBuffer[i]->mAudioDataBytesCapacity;
|
||||
/* !!! FIXME: should we use AudioQueueEnqueueBufferWithParameters and specify all frames be "trimmed" so these are immediately ready to refill with SDL callback data? */
|
||||
result = AudioQueueEnqueueBuffer(this->hidden->audioQueue, this->hidden->audioBuffer[i], 0, NULL);
|
||||
CHECK_RESULT("AudioQueueEnqueueBuffer");
|
||||
}
|
||||
@@ -799,6 +933,20 @@ static int
|
||||
audioqueue_thread(void *arg)
|
||||
{
|
||||
SDL_AudioDevice *this = (SDL_AudioDevice *) arg;
|
||||
|
||||
#if MACOSX_COREAUDIO
|
||||
const AudioObjectPropertyAddress default_device_address = {
|
||||
this->iscapture ? kAudioHardwarePropertyDefaultInputDevice : kAudioHardwarePropertyDefaultOutputDevice,
|
||||
kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster
|
||||
};
|
||||
|
||||
if (this->handle == NULL) { /* opened the default device? Register to know if the user picks a new default. */
|
||||
/* we don't care if this fails; we just won't change to new default devices, but we still otherwise function in this case. */
|
||||
AudioObjectAddPropertyListener(kAudioObjectSystemObject, &default_device_address, default_device_changed, this);
|
||||
}
|
||||
#endif
|
||||
|
||||
const int rc = prepare_audioqueue(this);
|
||||
if (!rc) {
|
||||
this->hidden->thread_error = SDL_strdup(SDL_GetError());
|
||||
@@ -810,8 +958,36 @@ audioqueue_thread(void *arg)
|
||||
|
||||
/* init was successful, alert parent thread and start running... */
|
||||
SDL_SemPost(this->hidden->ready_semaphore);
|
||||
|
||||
while (!SDL_AtomicGet(&this->hidden->shutdown)) {
|
||||
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.10, 1);
|
||||
|
||||
#if MACOSX_COREAUDIO
|
||||
if ((this->handle == NULL) && SDL_AtomicGet(&this->hidden->device_change_flag)) {
|
||||
SDL_AtomicSet(&this->hidden->device_change_flag, 0);
|
||||
|
||||
#if DEBUG_COREAUDIO
|
||||
printf("COREAUDIO: audioqueue_thread is trying to switch to new default device!\n");
|
||||
#endif
|
||||
|
||||
/* if any of this fails, there's not much to do but wait to see if the user gives up
|
||||
and quits (flagging the audioqueue for shutdown), or toggles to some other system
|
||||
output device (in which case we'll try again). */
|
||||
const AudioDeviceID prev_devid = this->hidden->deviceID;
|
||||
if (prepare_device(this, this->handle, this->iscapture) && (prev_devid != this->hidden->deviceID)) {
|
||||
AudioQueueStop(this->hidden->audioQueue, 1);
|
||||
if (assign_device_to_audioqueue(this)) {
|
||||
int i;
|
||||
for (i = 0; i < this->hidden->numAudioBuffers; i++) {
|
||||
SDL_memset(this->hidden->audioBuffer[i]->mAudioData, this->spec.silence, this->hidden->audioBuffer[i]->mAudioDataBytesCapacity);
|
||||
/* !!! FIXME: should we use AudioQueueEnqueueBufferWithParameters and specify all frames be "trimmed" so these are immediately ready to refill with SDL callback data? */
|
||||
AudioQueueEnqueueBuffer(this->hidden->audioQueue, this->hidden->audioBuffer[i], 0, NULL);
|
||||
}
|
||||
AudioQueueStart(this->hidden->audioQueue, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!this->iscapture) { /* Drain off any pending playback. */
|
||||
@@ -819,6 +995,13 @@ audioqueue_thread(void *arg)
|
||||
CFRunLoopRunInMode(kCFRunLoopDefaultMode, secs, 0);
|
||||
}
|
||||
|
||||
#if MACOSX_COREAUDIO
|
||||
if (this->handle == NULL) {
|
||||
/* we don't care if this fails; we just won't change to new default devices, but we still otherwise function in this case. */
|
||||
AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &default_device_address, default_device_changed, this);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -828,6 +1011,7 @@ COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
||||
AudioStreamBasicDescription *strdesc;
|
||||
SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
|
||||
int valid_datatype = 0;
|
||||
SDL_AudioDevice **new_open_devices;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
@@ -845,8 +1029,14 @@ COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
||||
open_playback_devices++;
|
||||
}
|
||||
|
||||
new_open_devices = (SDL_AudioDevice **)SDL_realloc(open_devices, sizeof(open_devices[0]) * (num_open_devices + 1));
|
||||
if (new_open_devices) {
|
||||
open_devices = new_open_devices;
|
||||
open_devices[num_open_devices++] = this;
|
||||
}
|
||||
|
||||
#if !MACOSX_COREAUDIO
|
||||
if (!update_audio_session(this, SDL_TRUE)) {
|
||||
if (!update_audio_session(this, SDL_TRUE, SDL_TRUE)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -864,7 +1054,7 @@ COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
||||
this->spec.channels = session.preferredOutputNumberOfChannels;
|
||||
}
|
||||
#else
|
||||
/* Calling setPreferredOutputNumberOfChannels seems to break audio output on iOS */
|
||||
/* Calling setPreferredOutputNumberOfChannels seems to break audio output on iOS */
|
||||
#endif /* TARGET_OS_TV */
|
||||
}
|
||||
#endif
|
||||
|
@@ -24,7 +24,6 @@
|
||||
|
||||
/* Allow access to a raw mixing buffer */
|
||||
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_timer.h"
|
||||
#include "SDL_loadso.h"
|
||||
#include "SDL_audio.h"
|
||||
|
1
externals/SDL/src/audio/disk/SDL_diskaudio.c
vendored
1
externals/SDL/src/audio/disk/SDL_diskaudio.c
vendored
@@ -33,7 +33,6 @@
|
||||
#include "SDL_audio.h"
|
||||
#include "../SDL_audio_c.h"
|
||||
#include "SDL_diskaudio.h"
|
||||
#include "SDL_log.h"
|
||||
|
||||
/* !!! FIXME: these should be SDL hints, not environment variables. */
|
||||
/* environment variables and defaults. */
|
||||
|
@@ -23,10 +23,8 @@
|
||||
#if SDL_AUDIO_DRIVER_EMSCRIPTEN
|
||||
|
||||
#include "SDL_audio.h"
|
||||
#include "SDL_log.h"
|
||||
#include "../SDL_audio_c.h"
|
||||
#include "SDL_emscriptenaudio.h"
|
||||
#include "SDL_assert.h"
|
||||
|
||||
#include <emscripten/emscripten.h>
|
||||
|
||||
|
@@ -36,7 +36,6 @@ extern "C"
|
||||
#include "../SDL_audio_c.h"
|
||||
#include "../SDL_sysaudio.h"
|
||||
#include "SDL_haikuaudio.h"
|
||||
#include "SDL_assert.h"
|
||||
|
||||
}
|
||||
|
||||
|
3
externals/SDL/src/audio/jack/SDL_jackaudio.c
vendored
3
externals/SDL/src/audio/jack/SDL_jackaudio.c
vendored
@@ -18,12 +18,10 @@
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_JACK
|
||||
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_timer.h"
|
||||
#include "SDL_audio.h"
|
||||
#include "../SDL_audio_c.h"
|
||||
@@ -278,6 +276,7 @@ JACK_CloseDevice(_THIS)
|
||||
}
|
||||
|
||||
SDL_free(this->hidden->iobuffer);
|
||||
SDL_free(this->hidden);
|
||||
}
|
||||
|
||||
static int
|
||||
|
10
externals/SDL/src/audio/netbsd/SDL_netbsdaudio.c
vendored
10
externals/SDL/src/audio/netbsd/SDL_netbsdaudio.c
vendored
@@ -24,7 +24,7 @@
|
||||
|
||||
/*
|
||||
* Driver for native NetBSD audio(4).
|
||||
* vedge@vedge.com.ar.
|
||||
* nia@NetBSD.org
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
@@ -261,6 +261,14 @@ NETBSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
||||
prinfo->encoding = AUDIO_ENCODING_ULINEAR_BE;
|
||||
prinfo->precision = 16;
|
||||
break;
|
||||
case AUDIO_S32LSB:
|
||||
prinfo->encoding = AUDIO_ENCODING_SLINEAR_LE;
|
||||
prinfo->precision = 32;
|
||||
break;
|
||||
case AUDIO_S32MSB:
|
||||
prinfo->encoding = AUDIO_ENCODING_SLINEAR_BE;
|
||||
prinfo->precision = 32;
|
||||
break;
|
||||
}
|
||||
if (prinfo->encoding != AUDIO_ENCODING_NONE) {
|
||||
break;
|
||||
|
@@ -26,7 +26,6 @@
|
||||
https://googlesamples.github.io/android-audio-high-performance/guides/opensl_es.html
|
||||
*/
|
||||
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_audio.h"
|
||||
#include "../SDL_audio_c.h"
|
||||
#include "../../core/android/SDL_android.h"
|
||||
|
454
externals/SDL/src/audio/os2/SDL_os2audio.c
vendored
Executable file
454
externals/SDL/src/audio/os2/SDL_os2audio.c
vendored
Executable file
@@ -0,0 +1,454 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_OS2
|
||||
|
||||
/* Allow access to a raw mixing buffer */
|
||||
|
||||
#include "../../core/os2/SDL_os2.h"
|
||||
|
||||
#include "SDL_audio.h"
|
||||
#include "../SDL_audio_c.h"
|
||||
#include "SDL_os2audio.h"
|
||||
|
||||
/*
|
||||
void lockIncr(volatile int *piVal);
|
||||
#pragma aux lockIncr = \
|
||||
"lock add [eax], 1 "\
|
||||
parm [eax];
|
||||
|
||||
void lockDecr(volatile int *piVal);
|
||||
#pragma aux lockDecr = \
|
||||
"lock sub [eax], 1 "\
|
||||
parm [eax];
|
||||
*/
|
||||
|
||||
static ULONG _getEnvULong(PSZ pszName, ULONG ulMax, ULONG ulDefault)
|
||||
{
|
||||
ULONG ulValue;
|
||||
PCHAR pcEnd;
|
||||
PSZ pszEnvVal = SDL_getenv(pszName);
|
||||
|
||||
if (pszEnvVal == NULL)
|
||||
return ulDefault;
|
||||
|
||||
ulValue = SDL_strtoul((const char *)pszEnvVal, &pcEnd, 10);
|
||||
return (pcEnd == pszEnvVal) || (ulValue > ulMax)? ulDefault : ulMax;
|
||||
}
|
||||
|
||||
static int _MCIError(PSZ pszFunc, ULONG ulResult)
|
||||
{
|
||||
CHAR acBuf[128];
|
||||
mciGetErrorString(ulResult, acBuf, sizeof(acBuf));
|
||||
return SDL_SetError("[%s] %s", pszFunc, acBuf);
|
||||
}
|
||||
|
||||
static void _mixIOError(PSZ pszFunction, ULONG ulRC)
|
||||
{
|
||||
debug_os2("%s() - failed, rc = 0x%X (%s)",
|
||||
pszFunction, ulRC,
|
||||
(ulRC == MCIERR_INVALID_MODE) ? "Mixer mode does not match request" :
|
||||
(ulRC == MCIERR_INVALID_BUFFER) ? "Caller sent an invalid buffer" : "unknown");
|
||||
}
|
||||
|
||||
LONG APIENTRY cbAudioWriteEvent(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer,
|
||||
ULONG ulFlags)
|
||||
{
|
||||
SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)pBuffer->ulUserParm;
|
||||
ULONG ulRC;
|
||||
|
||||
if (ulFlags != MIX_WRITE_COMPLETE) {
|
||||
debug_os2("flags = 0x%X", ulFlags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*lockDecr((int *)&pAData->ulQueuedBuf);*/
|
||||
ulRC = DosPostEventSem(pAData->hevBuf);
|
||||
if (ulRC != NO_ERROR && ulRC != ERROR_ALREADY_POSTED) {
|
||||
debug_os2("DosPostEventSem(), rc = %u", ulRC);
|
||||
}
|
||||
|
||||
return 1; /* It seems, return value is not matter. */
|
||||
}
|
||||
|
||||
LONG APIENTRY cbAudioReadEvent(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer,
|
||||
ULONG ulFlags)
|
||||
{
|
||||
SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)pBuffer->ulUserParm;
|
||||
ULONG ulRC;
|
||||
|
||||
if (ulFlags != MIX_READ_COMPLETE) {
|
||||
debug_os2("flags = 0x%X", ulFlags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
pAData->stMCIMixSetup.pmixRead(pAData->stMCIMixSetup.ulMixHandle, pBuffer, 1);
|
||||
|
||||
ulRC = DosPostEventSem(pAData->hevBuf);
|
||||
if (ulRC != NO_ERROR && ulRC != ERROR_ALREADY_POSTED) {
|
||||
debug_os2("DosPostEventSem(), rc = %u", ulRC);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static void OS2_DetectDevices(void)
|
||||
{
|
||||
MCI_SYSINFO_PARMS stMCISysInfo;
|
||||
CHAR acBuf[256];
|
||||
ULONG ulDevicesNum;
|
||||
MCI_SYSINFO_LOGDEVICE stLogDevice;
|
||||
MCI_SYSINFO_PARMS stSysInfoParams;
|
||||
ULONG ulRC;
|
||||
ULONG ulHandle = 0;
|
||||
|
||||
acBuf[0] = '\0';
|
||||
stMCISysInfo.pszReturn = acBuf;
|
||||
stMCISysInfo.ulRetSize = sizeof(acBuf);
|
||||
stMCISysInfo.usDeviceType = MCI_DEVTYPE_AUDIO_AMPMIX;
|
||||
ulRC = mciSendCommand(0, MCI_SYSINFO, MCI_WAIT | MCI_SYSINFO_QUANTITY,
|
||||
&stMCISysInfo, 0);
|
||||
if (ulRC != NO_ERROR) {
|
||||
debug_os2("MCI_SYSINFO, MCI_SYSINFO_QUANTITY - failed, rc = 0x%X", ulRC);
|
||||
return;
|
||||
}
|
||||
|
||||
ulDevicesNum = atol(stMCISysInfo.pszReturn);
|
||||
|
||||
for (stSysInfoParams.ulNumber = 0; stSysInfoParams.ulNumber < ulDevicesNum;
|
||||
stSysInfoParams.ulNumber++) {
|
||||
/* Get device install name. */
|
||||
stSysInfoParams.pszReturn = acBuf;
|
||||
stSysInfoParams.ulRetSize = sizeof(acBuf);
|
||||
stSysInfoParams.usDeviceType = MCI_DEVTYPE_AUDIO_AMPMIX;
|
||||
ulRC = mciSendCommand(0, MCI_SYSINFO, MCI_WAIT | MCI_SYSINFO_INSTALLNAME,
|
||||
&stSysInfoParams, 0);
|
||||
if (ulRC != NO_ERROR) {
|
||||
debug_os2("MCI_SYSINFO, MCI_SYSINFO_INSTALLNAME - failed, rc = 0x%X", ulRC);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Get textual product description. */
|
||||
stSysInfoParams.ulItem = MCI_SYSINFO_QUERY_DRIVER;
|
||||
stSysInfoParams.pSysInfoParm = &stLogDevice;
|
||||
strcpy(stLogDevice.szInstallName, stSysInfoParams.pszReturn);
|
||||
ulRC = mciSendCommand(0, MCI_SYSINFO, MCI_WAIT | MCI_SYSINFO_ITEM,
|
||||
&stSysInfoParams, 0);
|
||||
if (ulRC != NO_ERROR) {
|
||||
debug_os2("MCI_SYSINFO, MCI_SYSINFO_ITEM - failed, rc = 0x%X", ulRC);
|
||||
continue;
|
||||
}
|
||||
|
||||
ulHandle++;
|
||||
SDL_AddAudioDevice(0, stLogDevice.szProductInfo, (void *)(ulHandle));
|
||||
ulHandle++;
|
||||
SDL_AddAudioDevice(1, stLogDevice.szProductInfo, (void *)(ulHandle));
|
||||
}
|
||||
}
|
||||
|
||||
static void OS2_WaitDevice(_THIS)
|
||||
{
|
||||
SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)_this->hidden;
|
||||
ULONG ulRC;
|
||||
|
||||
/* Wait for an audio chunk to finish */
|
||||
ulRC = DosWaitEventSem(pAData->hevBuf, 5000);
|
||||
if (ulRC != NO_ERROR) {
|
||||
debug_os2("DosWaitEventSem(), rc = %u", ulRC);
|
||||
}
|
||||
}
|
||||
|
||||
static Uint8 *OS2_GetDeviceBuf(_THIS)
|
||||
{
|
||||
SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)_this->hidden;
|
||||
return (Uint8 *) pAData->aMixBuffers[pAData->ulNextBuf].pBuffer;
|
||||
}
|
||||
|
||||
static void OS2_PlayDevice(_THIS)
|
||||
{
|
||||
SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)_this->hidden;
|
||||
ULONG ulRC;
|
||||
PMCI_MIX_BUFFER pMixBuffer = &pAData->aMixBuffers[pAData->ulNextBuf];
|
||||
|
||||
/* Queue it up */
|
||||
/*lockIncr((int *)&pAData->ulQueuedBuf);*/
|
||||
ulRC = pAData->stMCIMixSetup.pmixWrite(pAData->stMCIMixSetup.ulMixHandle,
|
||||
pMixBuffer, 1);
|
||||
if (ulRC != MCIERR_SUCCESS) {
|
||||
_mixIOError("pmixWrite", ulRC);
|
||||
} else {
|
||||
pAData->ulNextBuf = (pAData->ulNextBuf + 1) % pAData->cMixBuffers;
|
||||
}
|
||||
}
|
||||
|
||||
static void OS2_CloseDevice(_THIS)
|
||||
{
|
||||
SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)_this->hidden;
|
||||
MCI_GENERIC_PARMS sMCIGenericParms;
|
||||
ULONG ulRC;
|
||||
|
||||
if (pAData == NULL)
|
||||
return;
|
||||
|
||||
/* Close up audio */
|
||||
if (pAData->usDeviceId != (USHORT)~0) {
|
||||
/* Device is open. */
|
||||
if (pAData->stMCIMixSetup.ulBitsPerSample != 0) {
|
||||
/* Mixer was initialized. */
|
||||
ulRC = mciSendCommand(pAData->usDeviceId, MCI_MIXSETUP,
|
||||
MCI_WAIT | MCI_MIXSETUP_DEINIT,
|
||||
&pAData->stMCIMixSetup, 0);
|
||||
if (ulRC != MCIERR_SUCCESS) {
|
||||
debug_os2("MCI_MIXSETUP, MCI_MIXSETUP_DEINIT - failed");
|
||||
}
|
||||
}
|
||||
|
||||
if (pAData->cMixBuffers != 0) {
|
||||
/* Buffers was allocated. */
|
||||
MCI_BUFFER_PARMS stMCIBuffer;
|
||||
|
||||
stMCIBuffer.ulBufferSize = pAData->aMixBuffers[0].ulBufferLength;
|
||||
stMCIBuffer.ulNumBuffers = pAData->cMixBuffers;
|
||||
stMCIBuffer.pBufList = pAData->aMixBuffers;
|
||||
|
||||
ulRC = mciSendCommand(pAData->usDeviceId, MCI_BUFFER,
|
||||
MCI_WAIT | MCI_DEALLOCATE_MEMORY, &stMCIBuffer, 0);
|
||||
if (ulRC != MCIERR_SUCCESS) {
|
||||
debug_os2("MCI_BUFFER, MCI_DEALLOCATE_MEMORY - failed");
|
||||
}
|
||||
}
|
||||
|
||||
ulRC = mciSendCommand(pAData->usDeviceId, MCI_CLOSE, MCI_WAIT,
|
||||
&sMCIGenericParms, 0);
|
||||
if (ulRC != MCIERR_SUCCESS) {
|
||||
debug_os2("MCI_CLOSE - failed");
|
||||
}
|
||||
}
|
||||
|
||||
if (pAData->hevBuf != NULLHANDLE)
|
||||
DosCloseEventSem(pAData->hevBuf);
|
||||
|
||||
SDL_free(pAData);
|
||||
}
|
||||
|
||||
static int OS2_OpenDevice(_THIS, void *handle, const char *devname,
|
||||
int iscapture)
|
||||
{
|
||||
SDL_PrivateAudioData *pAData;
|
||||
SDL_AudioFormat SDLAudioFmt;
|
||||
MCI_AMP_OPEN_PARMS stMCIAmpOpen;
|
||||
MCI_BUFFER_PARMS stMCIBuffer;
|
||||
ULONG ulRC;
|
||||
ULONG ulIdx;
|
||||
BOOL new_freq;
|
||||
|
||||
new_freq = FALSE;
|
||||
SDL_zero(stMCIAmpOpen);
|
||||
SDL_zero(stMCIBuffer);
|
||||
|
||||
for (SDLAudioFmt = SDL_FirstAudioFormat(_this->spec.format);
|
||||
SDLAudioFmt != 0; SDLAudioFmt = SDL_NextAudioFormat()) {
|
||||
if (SDLAudioFmt == AUDIO_U8 || SDLAudioFmt == AUDIO_S16)
|
||||
break;
|
||||
}
|
||||
if (SDLAudioFmt == 0) {
|
||||
debug_os2("Unsupported audio format, AUDIO_S16 used");
|
||||
SDLAudioFmt = AUDIO_S16;
|
||||
}
|
||||
|
||||
pAData = (SDL_PrivateAudioData *) SDL_calloc(1, sizeof(struct SDL_PrivateAudioData));
|
||||
if (pAData == NULL)
|
||||
return SDL_OutOfMemory();
|
||||
_this->hidden = pAData;
|
||||
|
||||
ulRC = DosCreateEventSem(NULL, &pAData->hevBuf, DCE_AUTORESET, TRUE);
|
||||
if (ulRC != NO_ERROR) {
|
||||
debug_os2("DosCreateEventSem() failed, rc = %u", ulRC);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Open audio device */
|
||||
stMCIAmpOpen.usDeviceID = (handle != NULL) ? ((ULONG)handle - 1) : 0;
|
||||
stMCIAmpOpen.pszDeviceType = (PSZ)MCI_DEVTYPE_AUDIO_AMPMIX;
|
||||
ulRC = mciSendCommand(0, MCI_OPEN,
|
||||
(_getEnvULong("SDL_AUDIO_SHARE", 1, 0) != 0)?
|
||||
MCI_WAIT | MCI_OPEN_TYPE_ID | MCI_OPEN_SHAREABLE :
|
||||
MCI_WAIT | MCI_OPEN_TYPE_ID,
|
||||
&stMCIAmpOpen, 0);
|
||||
if (ulRC != MCIERR_SUCCESS) {
|
||||
stMCIAmpOpen.usDeviceID = (USHORT)~0;
|
||||
return _MCIError("MCI_OPEN", ulRC);
|
||||
}
|
||||
pAData->usDeviceId = stMCIAmpOpen.usDeviceID;
|
||||
|
||||
if (iscapture != 0) {
|
||||
MCI_CONNECTOR_PARMS stMCIConnector;
|
||||
MCI_AMP_SET_PARMS stMCIAmpSet;
|
||||
BOOL fLineIn = _getEnvULong("SDL_AUDIO_LINEIN", 1, 0);
|
||||
|
||||
/* Set particular connector. */
|
||||
SDL_zero(stMCIConnector);
|
||||
stMCIConnector.ulConnectorType = (fLineIn)? MCI_LINE_IN_CONNECTOR :
|
||||
MCI_MICROPHONE_CONNECTOR;
|
||||
mciSendCommand(stMCIAmpOpen.usDeviceID, MCI_CONNECTOR,
|
||||
MCI_WAIT | MCI_ENABLE_CONNECTOR |
|
||||
MCI_CONNECTOR_TYPE, &stMCIConnector, 0);
|
||||
|
||||
/* Disable monitor. */
|
||||
SDL_zero(stMCIAmpSet);
|
||||
stMCIAmpSet.ulItem = MCI_AMP_SET_MONITOR;
|
||||
mciSendCommand(stMCIAmpOpen.usDeviceID, MCI_SET,
|
||||
MCI_WAIT | MCI_SET_OFF | MCI_SET_ITEM,
|
||||
&stMCIAmpSet, 0);
|
||||
|
||||
/* Set record volume. */
|
||||
stMCIAmpSet.ulLevel = _getEnvULong("SDL_AUDIO_RECVOL", 100, 90);
|
||||
stMCIAmpSet.ulItem = MCI_AMP_SET_AUDIO;
|
||||
stMCIAmpSet.ulAudio = MCI_SET_AUDIO_ALL; /* Both cnannels. */
|
||||
stMCIAmpSet.ulValue = (fLineIn) ? MCI_LINE_IN_CONNECTOR :
|
||||
MCI_MICROPHONE_CONNECTOR ;
|
||||
|
||||
mciSendCommand(stMCIAmpOpen.usDeviceID, MCI_SET,
|
||||
MCI_WAIT | MCI_SET_AUDIO | MCI_AMP_SET_GAIN,
|
||||
&stMCIAmpSet, 0);
|
||||
}
|
||||
|
||||
_this->spec.format = SDLAudioFmt;
|
||||
_this->spec.channels = _this->spec.channels > 1 ? 2 : 1;
|
||||
if (_this->spec.freq < 8000) {
|
||||
_this->spec.freq = 8000;
|
||||
new_freq = TRUE;
|
||||
} else if (_this->spec.freq > 48000) {
|
||||
_this->spec.freq = 48000;
|
||||
new_freq = TRUE;
|
||||
}
|
||||
|
||||
/* Setup mixer. */
|
||||
pAData->stMCIMixSetup.ulFormatTag = MCI_WAVE_FORMAT_PCM;
|
||||
pAData->stMCIMixSetup.ulBitsPerSample = SDL_AUDIO_BITSIZE(SDLAudioFmt);
|
||||
pAData->stMCIMixSetup.ulSamplesPerSec = _this->spec.freq;
|
||||
pAData->stMCIMixSetup.ulChannels = _this->spec.channels;
|
||||
pAData->stMCIMixSetup.ulDeviceType = MCI_DEVTYPE_WAVEFORM_AUDIO;
|
||||
if (iscapture == 0) {
|
||||
pAData->stMCIMixSetup.ulFormatMode= MCI_PLAY;
|
||||
pAData->stMCIMixSetup.pmixEvent = cbAudioWriteEvent;
|
||||
} else {
|
||||
pAData->stMCIMixSetup.ulFormatMode= MCI_RECORD;
|
||||
pAData->stMCIMixSetup.pmixEvent = cbAudioReadEvent;
|
||||
}
|
||||
|
||||
ulRC = mciSendCommand(pAData->usDeviceId, MCI_MIXSETUP,
|
||||
MCI_WAIT | MCI_MIXSETUP_INIT, &pAData->stMCIMixSetup, 0);
|
||||
if (ulRC != MCIERR_SUCCESS && _this->spec.freq > 44100) {
|
||||
new_freq = TRUE;
|
||||
pAData->stMCIMixSetup.ulSamplesPerSec = 44100;
|
||||
_this->spec.freq = 44100;
|
||||
ulRC = mciSendCommand(pAData->usDeviceId, MCI_MIXSETUP,
|
||||
MCI_WAIT | MCI_MIXSETUP_INIT, &pAData->stMCIMixSetup, 0);
|
||||
}
|
||||
|
||||
debug_os2("Setup mixer [BPS: %u, Freq.: %u, Channels: %u]: %s",
|
||||
pAData->stMCIMixSetup.ulBitsPerSample,
|
||||
pAData->stMCIMixSetup.ulSamplesPerSec,
|
||||
pAData->stMCIMixSetup.ulChannels,
|
||||
(ulRC == MCIERR_SUCCESS)? "SUCCESS" : "FAIL");
|
||||
|
||||
if (ulRC != MCIERR_SUCCESS) {
|
||||
pAData->stMCIMixSetup.ulBitsPerSample = 0;
|
||||
return _MCIError("MCI_MIXSETUP", ulRC);
|
||||
}
|
||||
|
||||
if (_this->spec.samples == 0 || new_freq == TRUE) {
|
||||
/* also see SDL_audio.c:prepare_audiospec() */
|
||||
/* Pick a default of ~46 ms at desired frequency */
|
||||
Uint32 samples = (_this->spec.freq / 1000) * 46;
|
||||
Uint32 power2 = 1;
|
||||
while (power2 < samples) {
|
||||
power2 <<= 1;
|
||||
}
|
||||
_this->spec.samples = power2;
|
||||
}
|
||||
/* Update the fragment size as size in bytes */
|
||||
SDL_CalculateAudioSpec(&_this->spec);
|
||||
|
||||
/* Allocate memory buffers */
|
||||
stMCIBuffer.ulBufferSize = _this->spec.size;/* (_this->spec.freq / 1000) * 100 */
|
||||
stMCIBuffer.ulNumBuffers = NUM_BUFFERS;
|
||||
stMCIBuffer.pBufList = pAData->aMixBuffers;
|
||||
|
||||
ulRC = mciSendCommand(pAData->usDeviceId, MCI_BUFFER,
|
||||
MCI_WAIT | MCI_ALLOCATE_MEMORY, &stMCIBuffer, 0);
|
||||
if (ulRC != MCIERR_SUCCESS) {
|
||||
return _MCIError("MCI_BUFFER", ulRC);
|
||||
}
|
||||
pAData->cMixBuffers = stMCIBuffer.ulNumBuffers;
|
||||
_this->spec.size = stMCIBuffer.ulBufferSize;
|
||||
|
||||
/* Fill all device buffers with data */
|
||||
for (ulIdx = 0; ulIdx < stMCIBuffer.ulNumBuffers; ulIdx++) {
|
||||
pAData->aMixBuffers[ulIdx].ulFlags = 0;
|
||||
pAData->aMixBuffers[ulIdx].ulBufferLength = stMCIBuffer.ulBufferSize;
|
||||
pAData->aMixBuffers[ulIdx].ulUserParm = (ULONG)pAData;
|
||||
|
||||
memset(((PMCI_MIX_BUFFER)stMCIBuffer.pBufList)[ulIdx].pBuffer,
|
||||
_this->spec.silence, stMCIBuffer.ulBufferSize);
|
||||
}
|
||||
|
||||
/* Write buffers to kick off the amp mixer */
|
||||
/*pAData->ulQueuedBuf = 1;//stMCIBuffer.ulNumBuffers */
|
||||
ulRC = pAData->stMCIMixSetup.pmixWrite(pAData->stMCIMixSetup.ulMixHandle,
|
||||
pAData->aMixBuffers,
|
||||
1 /*stMCIBuffer.ulNumBuffers*/);
|
||||
if (ulRC != MCIERR_SUCCESS) {
|
||||
_mixIOError("pmixWrite", ulRC);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int OS2_Init(SDL_AudioDriverImpl * impl)
|
||||
{
|
||||
/* Set the function pointers */
|
||||
impl->DetectDevices = OS2_DetectDevices;
|
||||
impl->OpenDevice = OS2_OpenDevice;
|
||||
impl->PlayDevice = OS2_PlayDevice;
|
||||
impl->WaitDevice = OS2_WaitDevice;
|
||||
impl->GetDeviceBuf = OS2_GetDeviceBuf;
|
||||
impl->CloseDevice = OS2_CloseDevice;
|
||||
|
||||
/* TODO: IMPLEMENT CAPTURE SUPPORT:
|
||||
impl->CaptureFromDevice = ;
|
||||
impl->FlushCapture = ;
|
||||
impl->HasCaptureSupport = SDL_TRUE;
|
||||
*/
|
||||
return 1; /* this audio target is available. */
|
||||
}
|
||||
|
||||
|
||||
AudioBootStrap OS2AUDIO_bootstrap = { "MMOS2", "OS/2 DART", OS2_Init, 0 };
|
||||
|
||||
#endif /* SDL_AUDIO_DRIVER_OS2 */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
54
externals/SDL/src/audio/os2/SDL_os2audio.h
vendored
Executable file
54
externals/SDL/src/audio/os2/SDL_os2audio.h
vendored
Executable file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#ifndef SDL_os2mm_h_
|
||||
#define SDL_os2mm_h_
|
||||
|
||||
#include "../SDL_sysaudio.h"
|
||||
|
||||
#define INCL_OS2MM
|
||||
#define INCL_PM
|
||||
#define INCL_DOS
|
||||
#define INCL_DOSERRORS
|
||||
#include <os2.h>
|
||||
#include <os2me.h>
|
||||
|
||||
/* Hidden "this" pointer for the audio functions */
|
||||
#define _THIS SDL_AudioDevice *_this
|
||||
|
||||
#define NUM_BUFFERS 3
|
||||
|
||||
typedef struct SDL_PrivateAudioData
|
||||
{
|
||||
USHORT usDeviceId;
|
||||
BYTE _pad[2];
|
||||
MCI_MIXSETUP_PARMS stMCIMixSetup;
|
||||
HEV hevBuf;
|
||||
ULONG ulNextBuf;
|
||||
ULONG cMixBuffers;
|
||||
MCI_MIX_BUFFER aMixBuffers[NUM_BUFFERS];
|
||||
/* ULONG ulQueuedBuf;*/
|
||||
} SDL_PrivateAudioData;
|
||||
|
||||
#endif /* SDL_os2mm_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
@@ -26,7 +26,7 @@
|
||||
Stéphan Kochen: stephan .a.t. kochen.nl
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_hints.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_PULSEAUDIO
|
||||
|
||||
@@ -237,16 +237,20 @@ squashVersion(const int major, const int minor, const int patch)
|
||||
static const char *
|
||||
getAppName(void)
|
||||
{
|
||||
const char *verstr = PULSEAUDIO_pa_get_library_version();
|
||||
if (verstr != NULL) {
|
||||
int maj, min, patch;
|
||||
if (SDL_sscanf(verstr, "%d.%d.%d", &maj, &min, &patch) == 3) {
|
||||
if (squashVersion(maj, min, patch) >= squashVersion(0, 9, 15)) {
|
||||
return NULL; /* 0.9.15+ handles NULL correctly. */
|
||||
const char *retval = SDL_GetHint(SDL_HINT_AUDIO_DEVICE_APP_NAME);
|
||||
if (!retval || !*retval) {
|
||||
const char *verstr = PULSEAUDIO_pa_get_library_version();
|
||||
retval = "SDL Application"; /* the "oh well" default. */
|
||||
if (verstr != NULL) {
|
||||
int maj, min, patch;
|
||||
if (SDL_sscanf(verstr, "%d.%d.%d", &maj, &min, &patch) == 3) {
|
||||
if (squashVersion(maj, min, patch) >= squashVersion(0, 9, 15)) {
|
||||
retval = NULL; /* 0.9.15+ handles NULL correctly. */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return "SDL Application"; /* oh well. */
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -290,32 +294,39 @@ ConnectToPulseServer_Internal(pa_mainloop **_mainloop, pa_context **_context)
|
||||
return SDL_SetError("pa_mainloop_new() failed");
|
||||
}
|
||||
|
||||
*_mainloop = mainloop;
|
||||
|
||||
mainloop_api = PULSEAUDIO_pa_mainloop_get_api(mainloop);
|
||||
SDL_assert(mainloop_api); /* this never fails, right? */
|
||||
|
||||
context = PULSEAUDIO_pa_context_new(mainloop_api, getAppName());
|
||||
if (!context) {
|
||||
PULSEAUDIO_pa_mainloop_free(mainloop);
|
||||
return SDL_SetError("pa_context_new() failed");
|
||||
}
|
||||
*_context = context;
|
||||
|
||||
/* Connect to the PulseAudio server */
|
||||
if (PULSEAUDIO_pa_context_connect(context, NULL, 0, NULL) < 0) {
|
||||
PULSEAUDIO_pa_context_unref(context);
|
||||
PULSEAUDIO_pa_mainloop_free(mainloop);
|
||||
return SDL_SetError("Could not setup connection to PulseAudio");
|
||||
}
|
||||
|
||||
do {
|
||||
if (PULSEAUDIO_pa_mainloop_iterate(mainloop, 1, NULL) < 0) {
|
||||
PULSEAUDIO_pa_context_unref(context);
|
||||
PULSEAUDIO_pa_mainloop_free(mainloop);
|
||||
return SDL_SetError("pa_mainloop_iterate() failed");
|
||||
}
|
||||
state = PULSEAUDIO_pa_context_get_state(context);
|
||||
if (!PA_CONTEXT_IS_GOOD(state)) {
|
||||
PULSEAUDIO_pa_context_unref(context);
|
||||
PULSEAUDIO_pa_mainloop_free(mainloop);
|
||||
return SDL_SetError("Could not connect to PulseAudio");
|
||||
}
|
||||
} while (state != PA_CONTEXT_READY);
|
||||
|
||||
*_context = context;
|
||||
*_mainloop = mainloop;
|
||||
|
||||
return 0; /* connected and ready! */
|
||||
}
|
||||
|
||||
@@ -513,6 +524,7 @@ PULSEAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
||||
pa_buffer_attr paattr;
|
||||
pa_channel_map pacmap;
|
||||
pa_stream_flags_t flags = 0;
|
||||
const char *name = NULL;
|
||||
int state = 0;
|
||||
int rc = 0;
|
||||
|
||||
@@ -615,9 +627,11 @@ PULSEAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
||||
PULSEAUDIO_pa_channel_map_init_auto(&pacmap, this->spec.channels,
|
||||
PA_CHANNEL_MAP_WAVEEX);
|
||||
|
||||
name = SDL_GetHint(SDL_HINT_AUDIO_DEVICE_STREAM_NAME);
|
||||
|
||||
h->stream = PULSEAUDIO_pa_stream_new(
|
||||
h->context,
|
||||
"Simple DirectMedia Layer", /* stream description */
|
||||
(name && *name) ? name : "Audio Stream", /* stream description */
|
||||
&paspec, /* sample format spec */
|
||||
&pacmap /* channel map */
|
||||
);
|
||||
|
18
externals/SDL/src/audio/wasapi/SDL_wasapi.c
vendored
18
externals/SDL/src/audio/wasapi/SDL_wasapi.c
vendored
@@ -18,7 +18,6 @@
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_WASAPI
|
||||
@@ -28,8 +27,6 @@
|
||||
#include "SDL_timer.h"
|
||||
#include "../SDL_audio_c.h"
|
||||
#include "../SDL_sysaudio.h"
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_log.h"
|
||||
|
||||
#define COBJMACROS
|
||||
#include <mmdeviceapi.h>
|
||||
@@ -508,7 +505,7 @@ WASAPI_PrepDevice(_THIS, const SDL_bool updatestream)
|
||||
const SDL_AudioSpec oldspec = this->spec;
|
||||
const AUDCLNT_SHAREMODE sharemode = AUDCLNT_SHAREMODE_SHARED;
|
||||
UINT32 bufsize = 0; /* this is in sample frames, not samples, not bytes. */
|
||||
REFERENCE_TIME duration = 0;
|
||||
REFERENCE_TIME default_period = 0;
|
||||
IAudioClient *client = this->hidden->client;
|
||||
IAudioRenderClient *render = NULL;
|
||||
IAudioCaptureClient *capture = NULL;
|
||||
@@ -572,7 +569,7 @@ WASAPI_PrepDevice(_THIS, const SDL_bool updatestream)
|
||||
return SDL_SetError("WASAPI: Unsupported audio format");
|
||||
}
|
||||
|
||||
ret = IAudioClient_GetDevicePeriod(client, NULL, &duration);
|
||||
ret = IAudioClient_GetDevicePeriod(client, &default_period, NULL);
|
||||
if (FAILED(ret)) {
|
||||
return WIN_SetErrorFromHRESULT("WASAPI can't determine minimum device period", ret);
|
||||
}
|
||||
@@ -591,7 +588,7 @@ WASAPI_PrepDevice(_THIS, const SDL_bool updatestream)
|
||||
}
|
||||
|
||||
streamflags |= AUDCLNT_STREAMFLAGS_EVENTCALLBACK;
|
||||
ret = IAudioClient_Initialize(client, sharemode, streamflags, duration, sharemode == AUDCLNT_SHAREMODE_SHARED ? 0 : duration, waveformat, NULL);
|
||||
ret = IAudioClient_Initialize(client, sharemode, streamflags, 0, 0, waveformat, NULL);
|
||||
if (FAILED(ret)) {
|
||||
return WIN_SetErrorFromHRESULT("WASAPI can't initialize audio client", ret);
|
||||
}
|
||||
@@ -606,9 +603,12 @@ WASAPI_PrepDevice(_THIS, const SDL_bool updatestream)
|
||||
return WIN_SetErrorFromHRESULT("WASAPI can't determine buffer size", ret);
|
||||
}
|
||||
|
||||
this->spec.samples = (Uint16) bufsize;
|
||||
if (!this->iscapture) {
|
||||
this->spec.samples /= 2; /* fill half of the DMA buffer on each run. */
|
||||
/* Match the callback size to the period size to cut down on the number of
|
||||
interrupts waited for in each call to WaitDevice */
|
||||
{
|
||||
const float period_millis = default_period / 10000.0f;
|
||||
const float period_frames = period_millis * this->spec.freq / 1000.0f;
|
||||
this->spec.samples = (Uint16)SDL_ceilf(period_frames);
|
||||
}
|
||||
|
||||
/* Update the fragment size as size in bytes */
|
||||
|
@@ -18,7 +18,6 @@
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
/* This is code that Windows uses to talk to WASAPI-related system APIs.
|
||||
@@ -34,8 +33,6 @@
|
||||
#include "SDL_timer.h"
|
||||
#include "../SDL_audio_c.h"
|
||||
#include "../SDL_sysaudio.h"
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_log.h"
|
||||
|
||||
#define COBJMACROS
|
||||
#include <mmdeviceapi.h>
|
||||
@@ -248,7 +245,7 @@ WASAPI_PlatformInit(void)
|
||||
return SDL_SetError("WASAPI: CoInitialize() failed");
|
||||
}
|
||||
|
||||
ret = CoCreateInstance(&SDL_CLSID_MMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER, &SDL_IID_IMMDeviceEnumerator, (LPVOID) &enumerator);
|
||||
ret = CoCreateInstance(&SDL_CLSID_MMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER, &SDL_IID_IMMDeviceEnumerator, (LPVOID *) &enumerator);
|
||||
if (FAILED(ret)) {
|
||||
WIN_CoUninitialize();
|
||||
return WIN_SetErrorFromHRESULT("WASAPI CoCreateInstance(MMDeviceEnumerator)", ret);
|
||||
|
@@ -18,7 +18,6 @@
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
// This is C++/CX code that the WinRT port uses to talk to WASAPI-related
|
||||
@@ -40,8 +39,6 @@ extern "C" {
|
||||
#include "SDL_timer.h"
|
||||
#include "../SDL_audio_c.h"
|
||||
#include "../SDL_sysaudio.h"
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_log.h"
|
||||
}
|
||||
|
||||
#define COBJMACROS
|
||||
|
1
externals/SDL/src/audio/winmm/SDL_winmm.c
vendored
1
externals/SDL/src/audio/winmm/SDL_winmm.c
vendored
@@ -27,7 +27,6 @@
|
||||
#include "../../core/windows/SDL_windows.h"
|
||||
#include <mmsystem.h>
|
||||
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_timer.h"
|
||||
#include "SDL_audio.h"
|
||||
#include "../SDL_audio_c.h"
|
||||
|
501
externals/SDL/src/core/android/SDL_android.c
vendored
501
externals/SDL/src/core/android/SDL_android.c
vendored
@@ -19,11 +19,10 @@
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_atomic.h"
|
||||
#include "SDL_hints.h"
|
||||
#include "SDL_log.h"
|
||||
#include "SDL_main.h"
|
||||
#include "SDL_timer.h"
|
||||
|
||||
@@ -44,6 +43,8 @@
|
||||
#include "../../haptic/android/SDL_syshaptic_c.h"
|
||||
|
||||
#include <android/log.h>
|
||||
#include <android/configuration.h>
|
||||
#include <android/asset_manager_jni.h>
|
||||
#include <sys/system_properties.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/types.h>
|
||||
@@ -125,6 +126,9 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeClipboardChanged)(
|
||||
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)(
|
||||
JNIEnv *env, jclass cls);
|
||||
|
||||
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeLocaleChanged)(
|
||||
JNIEnv *env, jclass cls);
|
||||
|
||||
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSendQuit)(
|
||||
JNIEnv *env, jclass cls);
|
||||
|
||||
@@ -178,6 +182,7 @@ static JNINativeMethod SDLActivity_tab[] = {
|
||||
{ "onNativeAccel", "(FFF)V", SDL_JAVA_INTERFACE(onNativeAccel) },
|
||||
{ "onNativeClipboardChanged", "()V", SDL_JAVA_INTERFACE(onNativeClipboardChanged) },
|
||||
{ "nativeLowMemory", "()V", SDL_JAVA_INTERFACE(nativeLowMemory) },
|
||||
{ "onNativeLocaleChanged", "()V", SDL_JAVA_INTERFACE(onNativeLocaleChanged) },
|
||||
{ "nativeSendQuit", "()V", SDL_JAVA_INTERFACE(nativeSendQuit) },
|
||||
{ "nativeQuit", "()V", SDL_JAVA_INTERFACE(nativeQuit) },
|
||||
{ "nativePause", "()V", SDL_JAVA_INTERFACE(nativePause) },
|
||||
@@ -305,7 +310,7 @@ static jmethodID midIsScreenKeyboardShown;
|
||||
static jmethodID midIsTablet;
|
||||
static jmethodID midManualBackButton;
|
||||
static jmethodID midMinimizeWindow;
|
||||
static jmethodID midOpenAPKExpansionInputStream;
|
||||
static jmethodID midOpenURL;
|
||||
static jmethodID midRequestPermission;
|
||||
static jmethodID midSendMessage;
|
||||
static jmethodID midSetActivityTitle;
|
||||
@@ -354,6 +359,12 @@ static SDL_bool bHasEnvironmentVariables;
|
||||
static SDL_atomic_t bPermissionRequestPending;
|
||||
static SDL_bool bPermissionRequestResult;
|
||||
|
||||
/* Android AssetManager */
|
||||
static void Internal_Android_Create_AssetManager(void);
|
||||
static void Internal_Android_Destroy_AssetManager(void);
|
||||
static AAssetManager *asset_manager = NULL;
|
||||
static jobject javaAssetManagerRef = 0;
|
||||
|
||||
/*******************************************************************************
|
||||
Functions called by JNI
|
||||
*******************************************************************************/
|
||||
@@ -578,7 +589,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)(JNIEnv *env, jclass cl
|
||||
midIsTablet = (*env)->GetStaticMethodID(env, mActivityClass, "isTablet", "()Z");
|
||||
midManualBackButton = (*env)->GetStaticMethodID(env, mActivityClass, "manualBackButton", "()V");
|
||||
midMinimizeWindow = (*env)->GetStaticMethodID(env, mActivityClass, "minimizeWindow","()V");
|
||||
midOpenAPKExpansionInputStream = (*env)->GetStaticMethodID(env, mActivityClass, "openAPKExpansionInputStream", "(Ljava/lang/String;)Ljava/io/InputStream;");
|
||||
midOpenURL = (*env)->GetStaticMethodID(env, mActivityClass, "openURL", "(Ljava/lang/String;)I");
|
||||
midRequestPermission = (*env)->GetStaticMethodID(env, mActivityClass, "requestPermission", "(Ljava/lang/String;I)V");
|
||||
midSendMessage = (*env)->GetStaticMethodID(env, mActivityClass, "sendMessage", "(II)Z");
|
||||
midSetActivityTitle = (*env)->GetStaticMethodID(env, mActivityClass, "setActivityTitle","(Ljava/lang/String;)Z");
|
||||
@@ -608,7 +619,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)(JNIEnv *env, jclass cl
|
||||
!midIsTablet ||
|
||||
!midManualBackButton ||
|
||||
!midMinimizeWindow ||
|
||||
!midOpenAPKExpansionInputStream ||
|
||||
!midOpenURL ||
|
||||
!midRequestPermission ||
|
||||
!midSendMessage ||
|
||||
!midSetActivityTitle ||
|
||||
@@ -1134,6 +1145,15 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)(
|
||||
SDL_SendAppEvent(SDL_APP_LOWMEMORY);
|
||||
}
|
||||
|
||||
/* Locale
|
||||
* requires android:configChanges="layoutDirection|locale" in AndroidManifest.xml */
|
||||
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeLocaleChanged)(
|
||||
JNIEnv *env, jclass cls)
|
||||
{
|
||||
SDL_SendAppEvent(SDL_LOCALECHANGED);
|
||||
}
|
||||
|
||||
|
||||
/* Send Quit event to "SDLThread" thread */
|
||||
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSendQuit)(
|
||||
JNIEnv *env, jclass cls)
|
||||
@@ -1175,6 +1195,8 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeQuit)(
|
||||
Android_ResumeSem = NULL;
|
||||
}
|
||||
|
||||
Internal_Android_Destroy_AssetManager();
|
||||
|
||||
str = SDL_GetError();
|
||||
if (str && str[0]) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "SDL", "SDLActivity thread ends (error=%s)", str);
|
||||
@@ -1797,245 +1819,90 @@ static SDL_bool Android_JNI_ExceptionOccurred(SDL_bool silent)
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
static int Internal_Android_JNI_FileOpen(SDL_RWops *ctx)
|
||||
{
|
||||
static void Internal_Android_Create_AssetManager() {
|
||||
|
||||
struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__);
|
||||
|
||||
int result = 0;
|
||||
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
jmethodID mid;
|
||||
jobject context;
|
||||
jobject assetManager;
|
||||
jobject inputStream;
|
||||
jclass channels;
|
||||
jobject readableByteChannel;
|
||||
jstring fileNameJString;
|
||||
jobject fd;
|
||||
jclass fdCls;
|
||||
jfieldID descriptor;
|
||||
jobject javaAssetManager;
|
||||
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
if (!LocalReferenceHolder_Init(&refs, env)) {
|
||||
goto failure;
|
||||
LocalReferenceHolder_Cleanup(&refs);
|
||||
return;
|
||||
}
|
||||
|
||||
fileNameJString = (jstring)ctx->hidden.androidio.fileNameRef;
|
||||
ctx->hidden.androidio.position = 0;
|
||||
|
||||
/* context = SDLActivity.getContext(); */
|
||||
context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext);
|
||||
|
||||
/* assetManager = context.getAssets(); */
|
||||
/* javaAssetManager = context.getAssets(); */
|
||||
mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context),
|
||||
"getAssets", "()Landroid/content/res/AssetManager;");
|
||||
assetManager = (*env)->CallObjectMethod(env, context, mid);
|
||||
javaAssetManager = (*env)->CallObjectMethod(env, context, mid);
|
||||
|
||||
/* First let's try opening the file to obtain an AssetFileDescriptor.
|
||||
* This method reads the files directly from the APKs using standard *nix calls
|
||||
*/
|
||||
mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, assetManager), "openFd", "(Ljava/lang/String;)Landroid/content/res/AssetFileDescriptor;");
|
||||
inputStream = (*env)->CallObjectMethod(env, assetManager, mid, fileNameJString);
|
||||
if (Android_JNI_ExceptionOccurred(SDL_TRUE)) {
|
||||
goto fallback;
|
||||
}
|
||||
|
||||
mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, inputStream), "getStartOffset", "()J");
|
||||
ctx->hidden.androidio.offset = (long)(*env)->CallLongMethod(env, inputStream, mid);
|
||||
if (Android_JNI_ExceptionOccurred(SDL_TRUE)) {
|
||||
goto fallback;
|
||||
}
|
||||
|
||||
mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, inputStream), "getDeclaredLength", "()J");
|
||||
ctx->hidden.androidio.size = (long)(*env)->CallLongMethod(env, inputStream, mid);
|
||||
if (Android_JNI_ExceptionOccurred(SDL_TRUE)) {
|
||||
goto fallback;
|
||||
}
|
||||
|
||||
mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, inputStream), "getFileDescriptor", "()Ljava/io/FileDescriptor;");
|
||||
fd = (*env)->CallObjectMethod(env, inputStream, mid);
|
||||
fdCls = (*env)->GetObjectClass(env, fd);
|
||||
descriptor = (*env)->GetFieldID(env, fdCls, "descriptor", "I");
|
||||
ctx->hidden.androidio.fd = (*env)->GetIntField(env, fd, descriptor);
|
||||
ctx->hidden.androidio.assetFileDescriptorRef = (*env)->NewGlobalRef(env, inputStream);
|
||||
|
||||
/* Seek to the correct offset in the file. */
|
||||
lseek(ctx->hidden.androidio.fd, (off_t)ctx->hidden.androidio.offset, SEEK_SET);
|
||||
|
||||
if (0) {
|
||||
fallback:
|
||||
/* Disabled log message because of spam on the Nexus 7 */
|
||||
/* __android_log_print(ANDROID_LOG_DEBUG, "SDL", "Falling back to legacy InputStream method for opening file"); */
|
||||
|
||||
/* Try the old method using InputStream */
|
||||
ctx->hidden.androidio.assetFileDescriptorRef = NULL;
|
||||
|
||||
/* inputStream = assetManager.open(<filename>); */
|
||||
mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, assetManager),
|
||||
"open", "(Ljava/lang/String;I)Ljava/io/InputStream;");
|
||||
inputStream = (*env)->CallObjectMethod(env, assetManager, mid, fileNameJString, 1 /* ACCESS_RANDOM */);
|
||||
if (Android_JNI_ExceptionOccurred(SDL_FALSE)) {
|
||||
/* Try fallback to APK expansion files */
|
||||
inputStream = (*env)->CallStaticObjectMethod(env, mActivityClass, midOpenAPKExpansionInputStream, fileNameJString);
|
||||
|
||||
/* Exception is checked first because it always needs to be cleared.
|
||||
* If no exception occurred then the last SDL error message is kept.
|
||||
*/
|
||||
if (Android_JNI_ExceptionOccurred(SDL_FALSE) || !inputStream) {
|
||||
goto failure;
|
||||
}
|
||||
}
|
||||
|
||||
ctx->hidden.androidio.inputStreamRef = (*env)->NewGlobalRef(env, inputStream);
|
||||
|
||||
/* Despite all the visible documentation on [Asset]InputStream claiming
|
||||
* that the .available() method is not guaranteed to return the entire file
|
||||
* size, comments in <sdk>/samples/<ver>/ApiDemos/src/com/example/ ...
|
||||
* android/apis/content/ReadAsset.java imply that Android's
|
||||
* AssetInputStream.available() /will/ always return the total file size
|
||||
*/
|
||||
|
||||
/* size = inputStream.available(); */
|
||||
mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, inputStream),
|
||||
"available", "()I");
|
||||
ctx->hidden.androidio.size = (long)(*env)->CallIntMethod(env, inputStream, mid);
|
||||
if (Android_JNI_ExceptionOccurred(SDL_FALSE)) {
|
||||
goto failure;
|
||||
}
|
||||
|
||||
/* readableByteChannel = Channels.newChannel(inputStream); */
|
||||
channels = (*env)->FindClass(env, "java/nio/channels/Channels");
|
||||
mid = (*env)->GetStaticMethodID(env, channels,
|
||||
"newChannel",
|
||||
"(Ljava/io/InputStream;)Ljava/nio/channels/ReadableByteChannel;");
|
||||
readableByteChannel = (*env)->CallStaticObjectMethod(
|
||||
env, channels, mid, inputStream);
|
||||
if (Android_JNI_ExceptionOccurred(SDL_FALSE)) {
|
||||
goto failure;
|
||||
}
|
||||
|
||||
ctx->hidden.androidio.readableByteChannelRef =
|
||||
(*env)->NewGlobalRef(env, readableByteChannel);
|
||||
|
||||
/* Store .read id for reading purposes */
|
||||
mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, readableByteChannel),
|
||||
"read", "(Ljava/nio/ByteBuffer;)I");
|
||||
ctx->hidden.androidio.readMethod = mid;
|
||||
}
|
||||
|
||||
if (0) {
|
||||
failure:
|
||||
result = -1;
|
||||
|
||||
(*env)->DeleteGlobalRef(env, (jobject)ctx->hidden.androidio.fileNameRef);
|
||||
|
||||
if(ctx->hidden.androidio.inputStreamRef != NULL) {
|
||||
(*env)->DeleteGlobalRef(env, (jobject)ctx->hidden.androidio.inputStreamRef);
|
||||
}
|
||||
|
||||
if(ctx->hidden.androidio.readableByteChannelRef != NULL) {
|
||||
(*env)->DeleteGlobalRef(env, (jobject)ctx->hidden.androidio.readableByteChannelRef);
|
||||
}
|
||||
|
||||
if(ctx->hidden.androidio.assetFileDescriptorRef != NULL) {
|
||||
(*env)->DeleteGlobalRef(env, (jobject)ctx->hidden.androidio.assetFileDescriptorRef);
|
||||
}
|
||||
/**
|
||||
* Given a Dalvik AssetManager object, obtain the corresponding native AAssetManager
|
||||
* object. Note that the caller is responsible for obtaining and holding a VM reference
|
||||
* to the jobject to prevent its being garbage collected while the native object is
|
||||
* in use.
|
||||
*/
|
||||
javaAssetManagerRef = (*env)->NewGlobalRef(env, javaAssetManager);
|
||||
asset_manager = AAssetManager_fromJava(env, javaAssetManagerRef);
|
||||
|
||||
if (asset_manager == NULL) {
|
||||
(*env)->DeleteGlobalRef(env, javaAssetManagerRef);
|
||||
Android_JNI_ExceptionOccurred(SDL_TRUE);
|
||||
}
|
||||
|
||||
LocalReferenceHolder_Cleanup(&refs);
|
||||
return result;
|
||||
}
|
||||
|
||||
static void Internal_Android_Destroy_AssetManager() {
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
|
||||
if (asset_manager) {
|
||||
(*env)->DeleteGlobalRef(env, javaAssetManagerRef);
|
||||
asset_manager = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int Android_JNI_FileOpen(SDL_RWops *ctx,
|
||||
const char *fileName, const char *mode)
|
||||
{
|
||||
struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__);
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
int retval;
|
||||
jstring fileNameJString;
|
||||
AAsset *asset = NULL;
|
||||
ctx->hidden.androidio.asset = NULL;
|
||||
|
||||
if (!LocalReferenceHolder_Init(&refs, env)) {
|
||||
LocalReferenceHolder_Cleanup(&refs);
|
||||
if (asset_manager == NULL) {
|
||||
Internal_Android_Create_AssetManager();
|
||||
}
|
||||
|
||||
if (asset_manager == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!ctx) {
|
||||
LocalReferenceHolder_Cleanup(&refs);
|
||||
asset = AAssetManager_open(asset_manager, fileName, AASSET_MODE_UNKNOWN);
|
||||
if (asset == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
fileNameJString = (*env)->NewStringUTF(env, fileName);
|
||||
ctx->hidden.androidio.fileNameRef = (*env)->NewGlobalRef(env, fileNameJString);
|
||||
ctx->hidden.androidio.inputStreamRef = NULL;
|
||||
ctx->hidden.androidio.readableByteChannelRef = NULL;
|
||||
ctx->hidden.androidio.readMethod = NULL;
|
||||
ctx->hidden.androidio.assetFileDescriptorRef = NULL;
|
||||
|
||||
retval = Internal_Android_JNI_FileOpen(ctx);
|
||||
LocalReferenceHolder_Cleanup(&refs);
|
||||
return retval;
|
||||
ctx->hidden.androidio.asset = (void*) asset;
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t Android_JNI_FileRead(SDL_RWops *ctx, void *buffer,
|
||||
size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer,
|
||||
size_t size, size_t maxnum)
|
||||
{
|
||||
struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__);
|
||||
size_t result;
|
||||
AAsset *asset = (AAsset*) ctx->hidden.androidio.asset;
|
||||
result = AAsset_read(asset, buffer, size * maxnum);
|
||||
|
||||
if (ctx->hidden.androidio.assetFileDescriptorRef) {
|
||||
size_t bytesMax = size * maxnum;
|
||||
size_t result;
|
||||
if (ctx->hidden.androidio.size != -1 /* UNKNOWN_LENGTH */ && ctx->hidden.androidio.position + bytesMax > ctx->hidden.androidio.size) {
|
||||
bytesMax = ctx->hidden.androidio.size - ctx->hidden.androidio.position;
|
||||
}
|
||||
result = read(ctx->hidden.androidio.fd, buffer, bytesMax );
|
||||
if (result > 0) {
|
||||
ctx->hidden.androidio.position += result;
|
||||
LocalReferenceHolder_Cleanup(&refs);
|
||||
return result / size;
|
||||
}
|
||||
LocalReferenceHolder_Cleanup(&refs);
|
||||
return 0;
|
||||
if (result > 0) {
|
||||
/* Number of chuncks */
|
||||
return (result / size);
|
||||
} else {
|
||||
jlong bytesRemaining = (jlong) (size * maxnum);
|
||||
jlong bytesMax = (jlong) (ctx->hidden.androidio.size - ctx->hidden.androidio.position);
|
||||
int bytesRead = 0;
|
||||
JNIEnv *env;
|
||||
jobject readableByteChannel;
|
||||
jmethodID readMethod;
|
||||
jobject byteBuffer;
|
||||
|
||||
/* Don't read more bytes than those that remain in the file, otherwise we get an exception */
|
||||
if (bytesRemaining > bytesMax) bytesRemaining = bytesMax;
|
||||
|
||||
env = Android_JNI_GetEnv();
|
||||
if (!LocalReferenceHolder_Init(&refs, env)) {
|
||||
LocalReferenceHolder_Cleanup(&refs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
readableByteChannel = (jobject)ctx->hidden.androidio.readableByteChannelRef;
|
||||
readMethod = (jmethodID)ctx->hidden.androidio.readMethod;
|
||||
byteBuffer = (*env)->NewDirectByteBuffer(env, buffer, bytesRemaining);
|
||||
|
||||
while (bytesRemaining > 0) {
|
||||
/* result = readableByteChannel.read(...); */
|
||||
int result = (*env)->CallIntMethod(env, readableByteChannel, readMethod, byteBuffer);
|
||||
|
||||
if (Android_JNI_ExceptionOccurred(SDL_FALSE)) {
|
||||
LocalReferenceHolder_Cleanup(&refs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (result < 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
bytesRemaining -= result;
|
||||
bytesRead += result;
|
||||
ctx->hidden.androidio.position += result;
|
||||
}
|
||||
LocalReferenceHolder_Cleanup(&refs);
|
||||
return bytesRead / size;
|
||||
/* Error or EOF */
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2046,148 +1913,27 @@ size_t Android_JNI_FileWrite(SDL_RWops *ctx, const void *buffer,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int Internal_Android_JNI_FileClose(SDL_RWops *ctx, SDL_bool release)
|
||||
Sint64 Android_JNI_FileSize(SDL_RWops *ctx)
|
||||
{
|
||||
struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__);
|
||||
|
||||
int result = 0;
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
|
||||
if (!LocalReferenceHolder_Init(&refs, env)) {
|
||||
LocalReferenceHolder_Cleanup(&refs);
|
||||
return SDL_SetError("Failed to allocate enough JVM local references");
|
||||
}
|
||||
|
||||
if (ctx) {
|
||||
if (release) {
|
||||
(*env)->DeleteGlobalRef(env, (jobject)ctx->hidden.androidio.fileNameRef);
|
||||
}
|
||||
|
||||
if (ctx->hidden.androidio.assetFileDescriptorRef) {
|
||||
jobject inputStream = (jobject)ctx->hidden.androidio.assetFileDescriptorRef;
|
||||
jmethodID mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, inputStream),
|
||||
"close", "()V");
|
||||
(*env)->CallVoidMethod(env, inputStream, mid);
|
||||
(*env)->DeleteGlobalRef(env, (jobject)ctx->hidden.androidio.assetFileDescriptorRef);
|
||||
if (Android_JNI_ExceptionOccurred(SDL_FALSE)) {
|
||||
result = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
jobject inputStream = (jobject)ctx->hidden.androidio.inputStreamRef;
|
||||
|
||||
/* inputStream.close(); */
|
||||
jmethodID mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, inputStream),
|
||||
"close", "()V");
|
||||
(*env)->CallVoidMethod(env, inputStream, mid);
|
||||
(*env)->DeleteGlobalRef(env, (jobject)ctx->hidden.androidio.inputStreamRef);
|
||||
(*env)->DeleteGlobalRef(env, (jobject)ctx->hidden.androidio.readableByteChannelRef);
|
||||
if (Android_JNI_ExceptionOccurred(SDL_FALSE)) {
|
||||
result = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (release) {
|
||||
SDL_FreeRW(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
LocalReferenceHolder_Cleanup(&refs);
|
||||
off64_t result;
|
||||
AAsset *asset = (AAsset*) ctx->hidden.androidio.asset;
|
||||
result = AAsset_getLength64(asset);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Sint64 Android_JNI_FileSize(SDL_RWops *ctx)
|
||||
Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence)
|
||||
{
|
||||
return ctx->hidden.androidio.size;
|
||||
}
|
||||
|
||||
Sint64 Android_JNI_FileSeek(SDL_RWops *ctx, Sint64 offset, int whence)
|
||||
{
|
||||
if (ctx->hidden.androidio.assetFileDescriptorRef) {
|
||||
off_t ret;
|
||||
switch (whence) {
|
||||
case RW_SEEK_SET:
|
||||
if (ctx->hidden.androidio.size != -1 /* UNKNOWN_LENGTH */ && offset > ctx->hidden.androidio.size) offset = ctx->hidden.androidio.size;
|
||||
offset += ctx->hidden.androidio.offset;
|
||||
break;
|
||||
case RW_SEEK_CUR:
|
||||
offset += ctx->hidden.androidio.position;
|
||||
if (ctx->hidden.androidio.size != -1 /* UNKNOWN_LENGTH */ && offset > ctx->hidden.androidio.size) offset = ctx->hidden.androidio.size;
|
||||
offset += ctx->hidden.androidio.offset;
|
||||
break;
|
||||
case RW_SEEK_END:
|
||||
offset = ctx->hidden.androidio.offset + ctx->hidden.androidio.size + offset;
|
||||
break;
|
||||
default:
|
||||
return SDL_SetError("Unknown value for 'whence'");
|
||||
}
|
||||
|
||||
ret = lseek(ctx->hidden.androidio.fd, (off_t)offset, SEEK_SET);
|
||||
if (ret == -1) return -1;
|
||||
ctx->hidden.androidio.position = ret - ctx->hidden.androidio.offset;
|
||||
} else {
|
||||
Sint64 newPosition;
|
||||
Sint64 movement;
|
||||
|
||||
switch (whence) {
|
||||
case RW_SEEK_SET:
|
||||
newPosition = offset;
|
||||
break;
|
||||
case RW_SEEK_CUR:
|
||||
newPosition = ctx->hidden.androidio.position + offset;
|
||||
break;
|
||||
case RW_SEEK_END:
|
||||
newPosition = ctx->hidden.androidio.size + offset;
|
||||
break;
|
||||
default:
|
||||
return SDL_SetError("Unknown value for 'whence'");
|
||||
}
|
||||
|
||||
/* Validate the new position */
|
||||
if (newPosition < 0) {
|
||||
return SDL_Error(SDL_EFSEEK);
|
||||
}
|
||||
if (newPosition > ctx->hidden.androidio.size) {
|
||||
newPosition = ctx->hidden.androidio.size;
|
||||
}
|
||||
|
||||
movement = newPosition - ctx->hidden.androidio.position;
|
||||
if (movement > 0) {
|
||||
unsigned char buffer[4096];
|
||||
|
||||
/* The easy case where we're seeking forwards */
|
||||
while (movement > 0) {
|
||||
Sint64 amount = sizeof (buffer);
|
||||
size_t result;
|
||||
if (amount > movement) {
|
||||
amount = movement;
|
||||
}
|
||||
result = Android_JNI_FileRead(ctx, buffer, 1, (size_t)amount);
|
||||
if (result <= 0) {
|
||||
/* Failed to read/skip the required amount, so fail */
|
||||
return -1;
|
||||
}
|
||||
|
||||
movement -= result;
|
||||
}
|
||||
|
||||
} else if (movement < 0) {
|
||||
/* We can't seek backwards so we have to reopen the file and seek */
|
||||
/* forwards which obviously isn't very efficient */
|
||||
Internal_Android_JNI_FileClose(ctx, SDL_FALSE);
|
||||
Internal_Android_JNI_FileOpen(ctx);
|
||||
Android_JNI_FileSeek(ctx, newPosition, RW_SEEK_SET);
|
||||
}
|
||||
}
|
||||
|
||||
return ctx->hidden.androidio.position;
|
||||
|
||||
off64_t result;
|
||||
AAsset *asset = (AAsset*) ctx->hidden.androidio.asset;
|
||||
result = AAsset_seek64(asset, offset, whence);
|
||||
return result;
|
||||
}
|
||||
|
||||
int Android_JNI_FileClose(SDL_RWops *ctx)
|
||||
{
|
||||
return Internal_Android_JNI_FileClose(ctx, SDL_TRUE);
|
||||
AAsset *asset = (AAsset*) ctx->hidden.androidio.asset;
|
||||
AAsset_close(asset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Android_JNI_SetClipboardText(const char *text)
|
||||
@@ -2717,6 +2463,11 @@ const char * SDL_AndroidGetExternalStoragePath(void)
|
||||
return s_AndroidExternalFilesPath;
|
||||
}
|
||||
|
||||
SDL_bool SDL_AndroidRequestPermission(const char *permission)
|
||||
{
|
||||
return Android_JNI_RequestPermission(permission);
|
||||
}
|
||||
|
||||
void Android_JNI_GetManifestEnvironmentVariables(void)
|
||||
{
|
||||
if (!mActivityClass || !midGetManifestEnvironmentVariables) {
|
||||
@@ -2796,6 +2547,74 @@ SDL_bool Android_JNI_RequestPermission(const char *permission)
|
||||
return bPermissionRequestResult;
|
||||
}
|
||||
|
||||
int Android_JNI_GetLocale(char *buf, size_t buflen)
|
||||
{
|
||||
AConfiguration *cfg;
|
||||
|
||||
SDL_assert(buflen > 6);
|
||||
|
||||
/* Need to re-create the asset manager if locale has changed (SDL_LOCALECHANGED) */
|
||||
Internal_Android_Destroy_AssetManager();
|
||||
|
||||
if (asset_manager == NULL) {
|
||||
Internal_Android_Create_AssetManager();
|
||||
}
|
||||
|
||||
if (asset_manager == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
cfg = AConfiguration_new();
|
||||
if (cfg == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
{
|
||||
char language[2] = {};
|
||||
char country[2] = {};
|
||||
size_t id = 0;
|
||||
|
||||
AConfiguration_fromAssetManager(cfg, asset_manager);
|
||||
AConfiguration_getLanguage(cfg, language);
|
||||
AConfiguration_getCountry(cfg, country);
|
||||
|
||||
/* copy language (not null terminated) */
|
||||
if (language[0]) {
|
||||
buf[id++] = language[0];
|
||||
if (language[1]) {
|
||||
buf[id++] = language[1];
|
||||
}
|
||||
}
|
||||
|
||||
buf[id++] = '_';
|
||||
|
||||
/* copy country (not null terminated) */
|
||||
if (country[0]) {
|
||||
buf[id++] = country[0];
|
||||
if (country[1]) {
|
||||
buf[id++] = country[1];
|
||||
}
|
||||
}
|
||||
|
||||
buf[id++] = '\0';
|
||||
SDL_assert(id <= buflen);
|
||||
}
|
||||
|
||||
AConfiguration_delete(cfg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
Android_JNI_OpenURL(const char *url)
|
||||
{
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
jstring jurl = (*env)->NewStringUTF(env, url);
|
||||
const int ret = (*env)->CallStaticIntMethod(env, mActivityClass, midOpenURL, jurl);
|
||||
(*env)->DeleteLocalRef(env, jurl);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* __ANDROID__ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
5
externals/SDL/src/core/android/SDL_android.h
vendored
5
externals/SDL/src/core/android/SDL_android.h
vendored
@@ -104,6 +104,9 @@ void Android_JNI_InitTouch(void);
|
||||
JNIEnv *Android_JNI_GetEnv(void);
|
||||
int Android_JNI_SetupThread(void);
|
||||
|
||||
/* Locale */
|
||||
int Android_JNI_GetLocale(char *buf, size_t buflen);
|
||||
|
||||
/* Generic messages */
|
||||
int Android_JNI_SendMessage(int command, int param);
|
||||
|
||||
@@ -126,6 +129,8 @@ SDL_bool Android_JNI_SetRelativeMouseEnabled(SDL_bool enabled);
|
||||
/* Request permission */
|
||||
SDL_bool Android_JNI_RequestPermission(const char *permission);
|
||||
|
||||
int Android_JNI_OpenURL(const char *url);
|
||||
|
||||
int SDL_GetAndroidSDKVersion(void);
|
||||
|
||||
SDL_bool SDL_IsAndroidTablet(void);
|
||||
|
165
externals/SDL/src/core/freebsd/SDL_evdev_kbd_default_keyaccmap.h
vendored
Executable file
165
externals/SDL/src/core/freebsd/SDL_evdev_kbd_default_keyaccmap.h
vendored
Executable file
@@ -0,0 +1,165 @@
|
||||
#include <sys/kbio.h>
|
||||
|
||||
/*
|
||||
* Automatically generated from /usr/share/vt/keymaps/us.acc.kbd.
|
||||
* DO NOT EDIT!
|
||||
*/
|
||||
static keymap_t keymap_default_us_acc = { 0x6d, {
|
||||
/* alt
|
||||
* scan cntrl alt alt cntrl
|
||||
* code base shift cntrl shift alt shift cntrl shift spcl flgs
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/*00*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 },
|
||||
/*01*/{{ 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, DBG, DBG, }, 0x03,0x00 },
|
||||
/*02*/{{ '1', '!', NOP, NOP, '1', '!', NOP, NOP, }, 0x33,0x00 },
|
||||
/*03*/{{ '2', '@', 0x00, 0x00, '2', '@', 0x00, 0x00, }, 0x00,0x00 },
|
||||
/*04*/{{ '3', '#', NOP, NOP, '3', '#', NOP, NOP, }, 0x33,0x00 },
|
||||
/*05*/{{ '4', '$', NOP, NOP, '4', '$', NOP, NOP, }, 0x33,0x00 },
|
||||
/*06*/{{ '5', '%', NOP, NOP, '5', '%', NOP, NOP, }, 0x33,0x00 },
|
||||
/*07*/{{ '6', '^', 0x1E, 0x1E, '6', DCIR, 0x1E, 0x1E, }, 0x04,0x00 },
|
||||
/*08*/{{ '7', '&', NOP, NOP, '7', '&', NOP, NOP, }, 0x33,0x00 },
|
||||
/*09*/{{ '8', '*', NOP, NOP, '8', DRIN, NOP, NOP, }, 0x37,0x00 },
|
||||
/*0a*/{{ '9', '(', NOP, NOP, '9', '(', NOP, NOP, }, 0x33,0x00 },
|
||||
/*0b*/{{ '0', ')', NOP, NOP, '0', ')', NOP, NOP, }, 0x33,0x00 },
|
||||
/*0c*/{{ '-', '_', 0x1F, 0x1F, '-', '_', 0x1F, 0x1F, }, 0x00,0x00 },
|
||||
/*0d*/{{ '=', '+', NOP, NOP, '=', '+', NOP, NOP, }, 0x33,0x00 },
|
||||
/*0e*/{{ 0x08, 0x08, 0x7F, 0x7F, 0x08, 0x08, 0x7F, 0x7F, }, 0x00,0x00 },
|
||||
/*0f*/{{ 0x09, BTAB, NEXT, NEXT, 0x09, BTAB, NOP, NOP, }, 0x77,0x00 },
|
||||
/*10*/{{ 'q', 'Q', 0x11, 0x11, 'q', 'Q', 0x11, 0x11, }, 0x00,0x01 },
|
||||
/*11*/{{ 'w', 'W', 0x17, 0x17, 'w', 'W', 0x17, 0x17, }, 0x00,0x01 },
|
||||
/*12*/{{ 'e', 'E', 0x05, 0x05, 'e', 'E', 0x05, 0x05, }, 0x00,0x01 },
|
||||
/*13*/{{ 'r', 'R', 0x12, 0x12, 'r', 'R', 0x12, 0x12, }, 0x00,0x01 },
|
||||
/*14*/{{ 't', 'T', 0x14, 0x14, 't', 'T', 0x14, 0x14, }, 0x00,0x01 },
|
||||
/*15*/{{ 'y', 'Y', 0x19, 0x19, 'y', 'Y', 0x19, 0x19, }, 0x00,0x01 },
|
||||
/*16*/{{ 'u', 'U', 0x15, 0x15, 'u', 'U', 0x15, 0x15, }, 0x00,0x01 },
|
||||
/*17*/{{ 'i', 'I', 0x09, 0x09, 'i', 'I', 0x09, 0x09, }, 0x00,0x01 },
|
||||
/*18*/{{ 'o', 'O', 0x0F, 0x0F, 'o', 'O', 0x0F, 0x0F, }, 0x00,0x01 },
|
||||
/*19*/{{ 'p', 'P', 0x10, 0x10, 'p', 'P', 0x10, 0x10, }, 0x00,0x01 },
|
||||
/*1a*/{{ '[', '{', 0x1B, 0x1B, '[', '{', 0x1B, 0x1B, }, 0x00,0x00 },
|
||||
/*1b*/{{ ']', '}', 0x1D, 0x1D, ']', '}', 0x1D, 0x1D, }, 0x00,0x00 },
|
||||
/*1c*/{{ 0x0D, 0x0D, 0x0A, 0x0A, 0x0D, 0x0D, 0x0A, 0x0A, }, 0x00,0x00 },
|
||||
/*1d*/{{ LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, }, 0xFF,0x00 },
|
||||
/*1e*/{{ 'a', 'A', 0x01, 0x01, 'a', 'A', 0x01, 0x01, }, 0x00,0x01 },
|
||||
/*1f*/{{ 's', 'S', 0x13, 0x13, 's', 'S', 0x13, 0x13, }, 0x00,0x01 },
|
||||
/*20*/{{ 'd', 'D', 0x04, 0x04, 'd', 'D', 0x04, 0x04, }, 0x00,0x01 },
|
||||
/*21*/{{ 'f', 'F', 0x06, 0x06, 'f', 'F', 0x06, 0x06, }, 0x00,0x01 },
|
||||
/*22*/{{ 'g', 'G', 0x07, 0x07, 'g', 'G', 0x07, 0x07, }, 0x00,0x01 },
|
||||
/*23*/{{ 'h', 'H', 0x08, 0x08, 'h', 'H', 0x08, 0x08, }, 0x00,0x01 },
|
||||
/*24*/{{ 'j', 'J', 0x0A, 0x0A, 'j', 'J', 0x0A, 0x0A, }, 0x00,0x01 },
|
||||
/*25*/{{ 'k', 'K', 0x0B, 0x0B, 'k', 'K', 0x0B, 0x0B, }, 0x00,0x01 },
|
||||
/*26*/{{ 'l', 'L', 0x0C, 0x0C, 'l', 'L', 0x0C, 0x0C, }, 0x00,0x01 },
|
||||
/*27*/{{ ';', ':', NOP, NOP, ';', ':', NOP, NOP, }, 0x33,0x00 },
|
||||
/*28*/{{ '\'', '"', NOP, NOP, DACU, DUML, NOP, NOP, }, 0x3F,0x00 },
|
||||
/*29*/{{ '`', '~', NOP, NOP, DGRA, DTIL, NOP, NOP, }, 0x3F,0x00 },
|
||||
/*2a*/{{ LSH, LSH, LSH, LSH, LSH, LSH, LSH, LSH, }, 0xFF,0x00 },
|
||||
/*2b*/{{ '\\', '|', 0x1C, 0x1C, '\\', '|', 0x1C, 0x1C, }, 0x00,0x00 },
|
||||
/*2c*/{{ 'z', 'Z', 0x1A, 0x1A, 'z', 'Z', 0x1A, 0x1A, }, 0x00,0x01 },
|
||||
/*2d*/{{ 'x', 'X', 0x18, 0x18, 'x', 'X', 0x18, 0x18, }, 0x00,0x01 },
|
||||
/*2e*/{{ 'c', 'C', 0x03, 0x03, 'c', 'C', 0x03, 0x03, }, 0x00,0x01 },
|
||||
/*2f*/{{ 'v', 'V', 0x16, 0x16, 'v', 'V', 0x16, 0x16, }, 0x00,0x01 },
|
||||
/*30*/{{ 'b', 'B', 0x02, 0x02, 'b', 'B', 0x02, 0x02, }, 0x00,0x01 },
|
||||
/*31*/{{ 'n', 'N', 0x0E, 0x0E, 'n', 'N', 0x0E, 0x0E, }, 0x00,0x01 },
|
||||
/*32*/{{ 'm', 'M', 0x0D, 0x0D, 'm', 'M', 0x0D, 0x0D, }, 0x00,0x01 },
|
||||
/*33*/{{ ',', '<', NOP, NOP, DCED, '<', NOP, NOP, }, 0x3B,0x00 },
|
||||
/*34*/{{ '.', '>', NOP, NOP, '.', '>', NOP, NOP, }, 0x33,0x00 },
|
||||
/*35*/{{ '/', '?', NOP, NOP, '/', '?', NOP, NOP, }, 0x33,0x00 },
|
||||
/*36*/{{ RSH, RSH, RSH, RSH, RSH, RSH, RSH, RSH, }, 0xFF,0x00 },
|
||||
/*37*/{{ '*', '*', '*', '*', '*', '*', '*', '*', }, 0x00,0x00 },
|
||||
/*38*/{{ LALT, LALT, LALT, LALT, LALT, LALT, LALT, LALT, }, 0xFF,0x00 },
|
||||
/*39*/{{ ' ', ' ', 0x00, 0x00, ' ', ' ', SUSP, SUSP, }, 0x03,0x00 },
|
||||
/*3a*/{{ CLK, CLK, CLK, CLK, CLK, CLK, CLK, CLK, }, 0xFF,0x00 },
|
||||
/*3b*/{{ F( 1), F(13), F(25), F(37), S( 1), S(11), S( 1), S(11),}, 0xFF,0x00 },
|
||||
/*3c*/{{ F( 2), F(14), F(26), F(38), S( 2), S(12), S( 2), S(12),}, 0xFF,0x00 },
|
||||
/*3d*/{{ F( 3), F(15), F(27), F(39), S( 3), S(13), S( 3), S(13),}, 0xFF,0x00 },
|
||||
/*3e*/{{ F( 4), F(16), F(28), F(40), S( 4), S(14), S( 4), S(14),}, 0xFF,0x00 },
|
||||
/*3f*/{{ F( 5), F(17), F(29), F(41), S( 5), S(15), S( 5), S(15),}, 0xFF,0x00 },
|
||||
/*40*/{{ F( 6), F(18), F(30), F(42), S( 6), S(16), S( 6), S(16),}, 0xFF,0x00 },
|
||||
/*41*/{{ F( 7), F(19), F(31), F(43), S( 7), S( 7), S( 7), S( 7),}, 0xFF,0x00 },
|
||||
/*42*/{{ F( 8), F(20), F(32), F(44), S( 8), S( 8), S( 8), S( 8),}, 0xFF,0x00 },
|
||||
/*43*/{{ F( 9), F(21), F(33), F(45), S( 9), S( 9), S( 9), S( 9),}, 0xFF,0x00 },
|
||||
/*44*/{{ F(10), F(22), F(34), F(46), S(10), S(10), S(10), S(10),}, 0xFF,0x00 },
|
||||
/*45*/{{ NLK, NLK, NLK, NLK, NLK, NLK, NLK, NLK, }, 0xFF,0x00 },
|
||||
/*46*/{{ SLK, SLK, SLK, SLK, SLK, SLK, SLK, SLK, }, 0xFF,0x00 },
|
||||
/*47*/{{ F(49), '7', '7', '7', '7', '7', '7', '7', }, 0x80,0x02 },
|
||||
/*48*/{{ F(50), '8', '8', '8', '8', '8', '8', '8', }, 0x80,0x02 },
|
||||
/*49*/{{ F(51), '9', '9', '9', '9', '9', '9', '9', }, 0x80,0x02 },
|
||||
/*4a*/{{ F(52), '-', '-', '-', '-', '-', '-', '-', }, 0x80,0x02 },
|
||||
/*4b*/{{ F(53), '4', '4', '4', '4', '4', '4', '4', }, 0x80,0x02 },
|
||||
/*4c*/{{ F(54), '5', '5', '5', '5', '5', '5', '5', }, 0x80,0x02 },
|
||||
/*4d*/{{ F(55), '6', '6', '6', '6', '6', '6', '6', }, 0x80,0x02 },
|
||||
/*4e*/{{ F(56), '+', '+', '+', '+', '+', '+', '+', }, 0x80,0x02 },
|
||||
/*4f*/{{ F(57), '1', '1', '1', '1', '1', '1', '1', }, 0x80,0x02 },
|
||||
/*50*/{{ F(58), '2', '2', '2', '2', '2', '2', '2', }, 0x80,0x02 },
|
||||
/*51*/{{ F(59), '3', '3', '3', '3', '3', '3', '3', }, 0x80,0x02 },
|
||||
/*52*/{{ F(60), '0', '0', '0', '0', '0', '0', '0', }, 0x80,0x02 },
|
||||
/*53*/{{ 0x7F, '.', '.', '.', '.', '.', RBT, RBT, }, 0x03,0x02 },
|
||||
/*54*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 },
|
||||
/*55*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 },
|
||||
/*56*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 },
|
||||
/*57*/{{ F(11), F(23), F(35), F(47), S(11), S(11), S(11), S(11),}, 0xFF,0x00 },
|
||||
/*58*/{{ F(12), F(24), F(36), F(48), S(12), S(12), S(12), S(12),}, 0xFF,0x00 },
|
||||
/*59*/{{ 0x0D, 0x0D, 0x0A, 0x0A, 0x0D, 0x0D, 0x0A, 0x0A, }, 0x00,0x00 },
|
||||
/*5a*/{{ RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, }, 0xFF,0x00 },
|
||||
/*5b*/{{ '/', '/', '/', '/', '/', '/', '/', '/', }, 0x00,0x02 },
|
||||
/*5c*/{{ NEXT, NEXT, NOP, NOP, DBG, DBG, DBG, DBG, }, 0xFF,0x00 },
|
||||
/*5d*/{{ RALT, RALT, RALT, RALT, RALT, RALT, RALT, RALT, }, 0xFF,0x00 },
|
||||
/*5e*/{{ F(49), F(49), F(49), F(49), F(49), F(49), F(49), F(49),}, 0xFF,0x00 },
|
||||
/*5f*/{{ F(50), F(50), F(50), F(50), F(50), F(50), F(50), F(50),}, 0xFF,0x00 },
|
||||
/*60*/{{ F(51), F(51), F(51), F(51), F(51), F(51), F(51), F(51),}, 0xFF,0x00 },
|
||||
/*61*/{{ F(53), F(53), F(53), F(53), F(53), F(53), F(53), F(53),}, 0xFF,0x00 },
|
||||
/*62*/{{ F(55), F(55), F(55), F(55), F(55), F(55), F(55), F(55),}, 0xFF,0x00 },
|
||||
/*63*/{{ F(57), F(57), F(57), F(57), F(57), F(57), F(57), F(57),}, 0xFF,0x00 },
|
||||
/*64*/{{ F(58), F(58), F(58), F(58), F(58), F(58), F(58), F(58),}, 0xFF,0x00 },
|
||||
/*65*/{{ F(59), F(59), F(59), F(59), F(59), F(59), F(59), F(59),}, 0xFF,0x00 },
|
||||
/*66*/{{ F(60), F(60), F(60), F(60), F(60), F(60), F(60), F(60),}, 0xFF,0x00 },
|
||||
/*67*/{{ F(61), F(61), F(61), F(61), F(61), F(61), RBT, F(61),}, 0xFF,0x00 },
|
||||
/*68*/{{ SPSC, SPSC, SUSP, SUSP, NOP, NOP, SUSP, SUSP, }, 0xFF,0x00 },
|
||||
/*69*/{{ F(62), F(62), F(62), F(62), F(62), F(62), F(62), F(62),}, 0xFF,0x00 },
|
||||
/*6a*/{{ F(63), F(63), F(63), F(63), F(63), F(63), F(63), F(63),}, 0xFF,0x00 },
|
||||
/*6b*/{{ F(64), F(64), F(64), F(64), F(64), F(64), F(64), F(64),}, 0xFF,0x00 },
|
||||
/*6c*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 },
|
||||
} };
|
||||
|
||||
static accentmap_t accentmap_default_us_acc = { 11, {
|
||||
/* dgra=0 */
|
||||
{ '`', { { 'a',0xe0 }, { 'A',0xc0 }, { 'e',0xe8 }, { 'E',0xc8 },
|
||||
{ 'i',0xec }, { 'I',0xcc }, { 'o',0xf2 }, { 'O',0xd2 },
|
||||
{ 'u',0xf9 }, { 'U',0xd9 }, }, },
|
||||
/* dacu=1 */
|
||||
{ 0xb4, { { 'a',0xe1 }, { 'A',0xc1 }, { 'e',0xe9 }, { 'E',0xc9 },
|
||||
{ 'i',0xed }, { 'I',0xcd }, { 'o',0xf3 }, { 'O',0xd3 },
|
||||
{ 'u',0xfa }, { 'U',0xda }, { 'y',0xfd }, { 'Y',0xdd }, }, },
|
||||
/* dcir=2 */
|
||||
{ '^', { { 'a',0xe2 }, { 'A',0xc2 }, { 'e',0xea }, { 'E',0xca },
|
||||
{ 'i',0xee }, { 'I',0xce }, { 'o',0xf4 }, { 'O',0xd4 },
|
||||
{ 'u',0xfb }, { 'U',0xdb }, }, },
|
||||
/* dtil=3 */
|
||||
{ '~', { { 'a',0xe3 }, { 'A',0xc3 }, { 'n',0xf1 }, { 'N',0xd1 },
|
||||
{ 'o',0xf5 }, { 'O',0xd5 }, }, },
|
||||
/* dmac=4 */
|
||||
{ 0x00 },
|
||||
/* dbre=5 */
|
||||
{ 0x00 },
|
||||
/* ddot=6 */
|
||||
{ 0x00 },
|
||||
/* duml=7 */
|
||||
{ 0xa8, { { 'a',0xe4 }, { 'A',0xc4 }, { 'e',0xeb }, { 'E',0xcb },
|
||||
{ 'i',0xef }, { 'I',0xcf }, { 'o',0xf6 }, { 'O',0xd6 },
|
||||
{ 'u',0xfc }, { 'U',0xdc }, { 'y',0xff }, }, },
|
||||
/* dsla=8 */
|
||||
{ 0x00 },
|
||||
/* drin=9 */
|
||||
{ 0xb0, { { 'a',0xe5 }, { 'A',0xc5 }, }, },
|
||||
/* dced=10 */
|
||||
{ 0xb8, { { 'c',0xe7 }, { 'C',0xc7 }, }, },
|
||||
/* dapo=11 */
|
||||
{ 0x00 },
|
||||
/* ddac=12 */
|
||||
{ 0x00 },
|
||||
/* dogo=13 */
|
||||
{ 0x00 },
|
||||
/* dcar=14 */
|
||||
{ 0x00 },
|
||||
} };
|
||||
|
572
externals/SDL/src/core/freebsd/SDL_evdev_kbd_freebsd.c
vendored
Executable file
572
externals/SDL/src/core/freebsd/SDL_evdev_kbd_freebsd.c
vendored
Executable file
@@ -0,0 +1,572 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#include "../linux/SDL_evdev_kbd.h"
|
||||
#include "SDL_hints.h"
|
||||
|
||||
#ifdef SDL_INPUT_FBSDKBIO
|
||||
|
||||
/* This logic is adapted from drivers/tty/vt/keyboard.c in the Linux kernel source, slightly modified to work with FreeBSD */
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/kbio.h>
|
||||
#include <sys/consio.h>
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#include "../../events/SDL_events_c.h"
|
||||
#include "SDL_evdev_kbd_default_keyaccmap.h"
|
||||
|
||||
typedef void (fn_handler_fn)(SDL_EVDEV_keyboard_state *kbd);
|
||||
|
||||
/*
|
||||
* Keyboard State
|
||||
*/
|
||||
|
||||
struct SDL_EVDEV_keyboard_state
|
||||
{
|
||||
int console_fd;
|
||||
int keyboard_fd;
|
||||
unsigned long old_kbd_mode;
|
||||
unsigned short **key_maps;
|
||||
keymap_t* key_map;
|
||||
keyboard_info_t* kbInfo;
|
||||
unsigned char shift_down[4]; /* shift state counters.. */
|
||||
SDL_bool dead_key_next;
|
||||
int npadch; /* -1 or number assembled on pad */
|
||||
accentmap_t *accents;
|
||||
unsigned int diacr;
|
||||
SDL_bool rep; /* flag telling character repeat */
|
||||
unsigned char lockstate;
|
||||
unsigned char ledflagstate;
|
||||
char shift_state;
|
||||
char text[128];
|
||||
unsigned int text_len;
|
||||
};
|
||||
|
||||
static int SDL_EVDEV_kbd_load_keymaps(SDL_EVDEV_keyboard_state *kbd)
|
||||
{
|
||||
return (ioctl(kbd->keyboard_fd, GIO_KEYMAP, kbd->key_map) >= 0);
|
||||
}
|
||||
|
||||
static SDL_EVDEV_keyboard_state * kbd_cleanup_state = NULL;
|
||||
static int kbd_cleanup_sigactions_installed = 0;
|
||||
static int kbd_cleanup_atexit_installed = 0;
|
||||
|
||||
static struct sigaction old_sigaction[NSIG];
|
||||
|
||||
static int fatal_signals[] =
|
||||
{
|
||||
/* Handlers for SIGTERM and SIGINT are installed in SDL_QuitInit. */
|
||||
SIGHUP, SIGQUIT, SIGILL, SIGABRT,
|
||||
SIGFPE, SIGSEGV, SIGPIPE, SIGBUS,
|
||||
SIGSYS
|
||||
};
|
||||
|
||||
static void kbd_cleanup(void)
|
||||
{
|
||||
SDL_EVDEV_keyboard_state* kbd = kbd_cleanup_state;
|
||||
if (kbd == NULL) {
|
||||
return;
|
||||
}
|
||||
kbd_cleanup_state = NULL;
|
||||
|
||||
ioctl(kbd->keyboard_fd, KDSKBMODE, kbd->old_kbd_mode);
|
||||
if (kbd->keyboard_fd != kbd->console_fd) close(kbd->keyboard_fd);
|
||||
ioctl(kbd->console_fd, CONS_SETKBD, (unsigned long)(kbd->kbInfo->kb_index));
|
||||
}
|
||||
|
||||
void
|
||||
SDL_EVDEV_kbd_reraise_signal(int sig)
|
||||
{
|
||||
raise(sig);
|
||||
}
|
||||
|
||||
siginfo_t* SDL_EVDEV_kdb_cleanup_siginfo = NULL;
|
||||
void* SDL_EVDEV_kdb_cleanup_ucontext = NULL;
|
||||
|
||||
static void kbd_cleanup_signal_action(int signum, siginfo_t* info, void* ucontext)
|
||||
{
|
||||
struct sigaction* old_action_p = &(old_sigaction[signum]);
|
||||
sigset_t sigset;
|
||||
|
||||
/* Restore original signal handler before going any further. */
|
||||
sigaction(signum, old_action_p, NULL);
|
||||
|
||||
/* Unmask current signal. */
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, signum);
|
||||
sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
|
||||
/* Save original signal info and context for archeologists. */
|
||||
SDL_EVDEV_kdb_cleanup_siginfo = info;
|
||||
SDL_EVDEV_kdb_cleanup_ucontext = ucontext;
|
||||
|
||||
/* Restore keyboard. */
|
||||
kbd_cleanup();
|
||||
|
||||
/* Reraise signal. */
|
||||
SDL_EVDEV_kbd_reraise_signal(signum);
|
||||
}
|
||||
|
||||
static void kbd_unregister_emerg_cleanup()
|
||||
{
|
||||
int tabidx, signum;
|
||||
|
||||
kbd_cleanup_state = NULL;
|
||||
|
||||
if (!kbd_cleanup_sigactions_installed) {
|
||||
return;
|
||||
}
|
||||
kbd_cleanup_sigactions_installed = 0;
|
||||
|
||||
for (tabidx = 0; tabidx < sizeof(fatal_signals) / sizeof(fatal_signals[0]); ++tabidx) {
|
||||
struct sigaction* old_action_p;
|
||||
struct sigaction cur_action;
|
||||
signum = fatal_signals[tabidx];
|
||||
old_action_p = &(old_sigaction[signum]);
|
||||
|
||||
/* Examine current signal action */
|
||||
if (sigaction(signum, NULL, &cur_action))
|
||||
continue;
|
||||
|
||||
/* Check if action installed and not modifed */
|
||||
if (!(cur_action.sa_flags & SA_SIGINFO)
|
||||
|| cur_action.sa_sigaction != &kbd_cleanup_signal_action)
|
||||
continue;
|
||||
|
||||
/* Restore original action */
|
||||
sigaction(signum, old_action_p, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void kbd_cleanup_atexit(void)
|
||||
{
|
||||
/* Restore keyboard. */
|
||||
kbd_cleanup();
|
||||
|
||||
/* Try to restore signal handlers in case shared library is being unloaded */
|
||||
kbd_unregister_emerg_cleanup();
|
||||
}
|
||||
|
||||
static void kbd_register_emerg_cleanup(SDL_EVDEV_keyboard_state * kbd)
|
||||
{
|
||||
int tabidx, signum;
|
||||
|
||||
if (kbd_cleanup_state != NULL) {
|
||||
return;
|
||||
}
|
||||
kbd_cleanup_state = kbd;
|
||||
|
||||
if (!kbd_cleanup_atexit_installed) {
|
||||
/* Since glibc 2.2.3, atexit() (and on_exit(3)) can be used within a shared library to establish
|
||||
* functions that are called when the shared library is unloaded.
|
||||
* -- man atexit(3)
|
||||
*/
|
||||
atexit(kbd_cleanup_atexit);
|
||||
kbd_cleanup_atexit_installed = 1;
|
||||
}
|
||||
|
||||
if (kbd_cleanup_sigactions_installed) {
|
||||
return;
|
||||
}
|
||||
kbd_cleanup_sigactions_installed = 1;
|
||||
|
||||
for (tabidx = 0; tabidx < sizeof(fatal_signals) / sizeof(fatal_signals[0]); ++tabidx) {
|
||||
struct sigaction* old_action_p;
|
||||
struct sigaction new_action;
|
||||
signum = fatal_signals[tabidx];
|
||||
old_action_p = &(old_sigaction[signum]);
|
||||
if (sigaction(signum, NULL, old_action_p))
|
||||
continue;
|
||||
|
||||
/* Skip SIGHUP and SIGPIPE if handler is already installed
|
||||
* - assume the handler will do the cleanup
|
||||
*/
|
||||
if ((signum == SIGHUP || signum == SIGPIPE)
|
||||
&& (old_action_p->sa_handler != SIG_DFL
|
||||
|| (void (*)(int))old_action_p->sa_sigaction != SIG_DFL))
|
||||
continue;
|
||||
|
||||
new_action = *old_action_p;
|
||||
new_action.sa_flags |= SA_SIGINFO;
|
||||
new_action.sa_sigaction = &kbd_cleanup_signal_action;
|
||||
sigaction(signum, &new_action, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
SDL_EVDEV_keyboard_state *
|
||||
SDL_EVDEV_kbd_init(void)
|
||||
{
|
||||
SDL_EVDEV_keyboard_state *kbd;
|
||||
char flag_state;
|
||||
char* devicePath;
|
||||
|
||||
kbd = (SDL_EVDEV_keyboard_state *)SDL_calloc(1, sizeof(SDL_EVDEV_keyboard_state));
|
||||
if (!kbd) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
kbd->npadch = -1;
|
||||
|
||||
/* This might fail if we're not connected to a tty (e.g. on the Steam Link) */
|
||||
kbd->keyboard_fd = kbd->console_fd = open("/dev/tty", O_RDONLY);
|
||||
|
||||
kbd->shift_state = 0;
|
||||
|
||||
kbd->accents = SDL_calloc(sizeof(accentmap_t), 1);
|
||||
kbd->key_map = SDL_calloc(sizeof(keymap_t), 1);
|
||||
kbd->kbInfo = SDL_calloc(sizeof(keyboard_info_t), 1);
|
||||
|
||||
ioctl(kbd->console_fd, KDGKBINFO, kbd->kbInfo);
|
||||
|
||||
if (ioctl(kbd->console_fd, KDGKBSTATE, &flag_state) == 0) {
|
||||
kbd->ledflagstate = flag_state;
|
||||
}
|
||||
|
||||
if (ioctl(kbd->console_fd, GIO_DEADKEYMAP, kbd->accents) < 0)
|
||||
{
|
||||
SDL_free(kbd->accents);
|
||||
kbd->accents = &accentmap_default_us_acc;
|
||||
}
|
||||
|
||||
if (ioctl(kbd->console_fd, KDGKBMODE, &kbd->old_kbd_mode) == 0) {
|
||||
/* Set the keyboard in XLATE mode and load the keymaps */
|
||||
ioctl(kbd->console_fd, KDSKBMODE, (unsigned long)(K_XLATE));
|
||||
if(!SDL_EVDEV_kbd_load_keymaps(kbd))
|
||||
{
|
||||
SDL_free(kbd->key_map);
|
||||
kbd->key_map = &keymap_default_us_acc;
|
||||
}
|
||||
/* Allow inhibiting keyboard mute with env. variable for debugging etc. */
|
||||
if (getenv("SDL_INPUT_FREEBSD_KEEP_KBD") == NULL) {
|
||||
/* Take keyboard from console and open the actual keyboard device.
|
||||
* Ensures that the keystrokes do not leak through to the console.
|
||||
*/
|
||||
ioctl(kbd->console_fd, CONS_RELKBD, 1ul);
|
||||
asprintf(&devicePath, "/dev/kbd%d", kbd->kbInfo->kb_index);
|
||||
kbd->keyboard_fd = open(devicePath, O_WRONLY);
|
||||
if (kbd->keyboard_fd == -1)
|
||||
{
|
||||
// Give keyboard back.
|
||||
ioctl(kbd->console_fd, CONS_SETKBD, (unsigned long)(kbd->kbInfo->kb_index));
|
||||
kbd->keyboard_fd = kbd->console_fd;
|
||||
}
|
||||
|
||||
/* Make sure to restore keyboard if application fails to call
|
||||
* SDL_Quit before exit or fatal signal is raised.
|
||||
*/
|
||||
if (!SDL_GetHintBoolean(SDL_HINT_NO_SIGNAL_HANDLERS, SDL_FALSE)) {
|
||||
kbd_register_emerg_cleanup(kbd);
|
||||
}
|
||||
free(devicePath);
|
||||
}
|
||||
else kbd->keyboard_fd = kbd->console_fd;
|
||||
}
|
||||
|
||||
return kbd;
|
||||
}
|
||||
|
||||
void
|
||||
SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *kbd)
|
||||
{
|
||||
if (!kbd) {
|
||||
return;
|
||||
}
|
||||
|
||||
kbd_unregister_emerg_cleanup();
|
||||
|
||||
if (kbd->keyboard_fd >= 0) {
|
||||
/* Restore the original keyboard mode */
|
||||
ioctl(kbd->keyboard_fd, KDSKBMODE, kbd->old_kbd_mode);
|
||||
|
||||
close(kbd->keyboard_fd);
|
||||
if (kbd->console_fd != kbd->keyboard_fd && kbd->console_fd >= 0)
|
||||
{
|
||||
// Give back keyboard.
|
||||
ioctl(kbd->console_fd, CONS_SETKBD, (unsigned long)(kbd->kbInfo->kb_index));
|
||||
}
|
||||
kbd->console_fd = kbd->keyboard_fd = -1;
|
||||
}
|
||||
|
||||
SDL_free(kbd);
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper Functions.
|
||||
*/
|
||||
static void put_queue(SDL_EVDEV_keyboard_state *kbd, uint c)
|
||||
{
|
||||
/* c is already part of a UTF-8 sequence and safe to add as a character */
|
||||
if (kbd->text_len < (sizeof(kbd->text)-1)) {
|
||||
kbd->text[kbd->text_len++] = (char)c;
|
||||
}
|
||||
}
|
||||
|
||||
static void put_utf8(SDL_EVDEV_keyboard_state *kbd, uint c)
|
||||
{
|
||||
if (c < 0x80)
|
||||
/* 0******* */
|
||||
put_queue(kbd, c);
|
||||
else if (c < 0x800) {
|
||||
/* 110***** 10****** */
|
||||
put_queue(kbd, 0xc0 | (c >> 6));
|
||||
put_queue(kbd, 0x80 | (c & 0x3f));
|
||||
} else if (c < 0x10000) {
|
||||
if (c >= 0xD800 && c < 0xE000)
|
||||
return;
|
||||
if (c == 0xFFFF)
|
||||
return;
|
||||
/* 1110**** 10****** 10****** */
|
||||
put_queue(kbd, 0xe0 | (c >> 12));
|
||||
put_queue(kbd, 0x80 | ((c >> 6) & 0x3f));
|
||||
put_queue(kbd, 0x80 | (c & 0x3f));
|
||||
} else if (c < 0x110000) {
|
||||
/* 11110*** 10****** 10****** 10****** */
|
||||
put_queue(kbd, 0xf0 | (c >> 18));
|
||||
put_queue(kbd, 0x80 | ((c >> 12) & 0x3f));
|
||||
put_queue(kbd, 0x80 | ((c >> 6) & 0x3f));
|
||||
put_queue(kbd, 0x80 | (c & 0x3f));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We have a combining character DIACR here, followed by the character CH.
|
||||
* If the combination occurs in the table, return the corresponding value.
|
||||
* Otherwise, if CH is a space or equals DIACR, return DIACR.
|
||||
* Otherwise, conclude that DIACR was not combining after all,
|
||||
* queue it and return CH.
|
||||
*/
|
||||
static unsigned int handle_diacr(SDL_EVDEV_keyboard_state *kbd, unsigned int ch)
|
||||
{
|
||||
unsigned int d = kbd->diacr;
|
||||
unsigned int i, j;
|
||||
|
||||
kbd->diacr = 0;
|
||||
|
||||
for (i = 0; i < kbd->accents->n_accs; i++) {
|
||||
if (kbd->accents->acc[i].accchar == d)
|
||||
{
|
||||
for (j = 0; j < NUM_ACCENTCHARS; ++j) {
|
||||
if (kbd->accents->acc[i].map[j][0] == 0) /* end of table */
|
||||
break;
|
||||
if (kbd->accents->acc[i].map[j][0] == ch)
|
||||
return kbd->accents->acc[i].map[j][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ch == ' ' || ch == d) {
|
||||
put_utf8(kbd, d);
|
||||
return 0;
|
||||
}
|
||||
put_utf8(kbd, d);
|
||||
|
||||
return ch;
|
||||
}
|
||||
|
||||
static int vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag)
|
||||
{
|
||||
return (kbd->ledflagstate & flag) != 0;
|
||||
}
|
||||
|
||||
static void chg_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag)
|
||||
{
|
||||
kbd->ledflagstate ^= flag;
|
||||
ioctl(kbd->keyboard_fd, KDSKBSTATE, (unsigned long)(kbd->ledflagstate));
|
||||
}
|
||||
|
||||
/*
|
||||
* Special function handlers
|
||||
*/
|
||||
|
||||
static void k_self(SDL_EVDEV_keyboard_state *kbd, unsigned int value, char up_flag)
|
||||
{
|
||||
if (up_flag)
|
||||
return; /* no action, if this is a key release */
|
||||
|
||||
if (kbd->diacr)
|
||||
value = handle_diacr(kbd, value);
|
||||
|
||||
if (kbd->dead_key_next) {
|
||||
kbd->dead_key_next = SDL_FALSE;
|
||||
kbd->diacr = value;
|
||||
return;
|
||||
}
|
||||
put_utf8(kbd, value);
|
||||
}
|
||||
|
||||
static void k_deadunicode(SDL_EVDEV_keyboard_state *kbd, unsigned int value, char up_flag)
|
||||
{
|
||||
if (up_flag)
|
||||
return;
|
||||
|
||||
kbd->diacr = (kbd->diacr ? handle_diacr(kbd, value) : value);
|
||||
}
|
||||
|
||||
static void k_shift(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag)
|
||||
{
|
||||
int old_state = kbd->shift_state;
|
||||
|
||||
if (kbd->rep)
|
||||
return;
|
||||
|
||||
if (up_flag) {
|
||||
/*
|
||||
* handle the case that two shift or control
|
||||
* keys are depressed simultaneously
|
||||
*/
|
||||
if (kbd->shift_down[value])
|
||||
kbd->shift_down[value]--;
|
||||
} else
|
||||
kbd->shift_down[value]++;
|
||||
|
||||
if (kbd->shift_down[value])
|
||||
kbd->shift_state |= (1 << value);
|
||||
else
|
||||
kbd->shift_state &= ~(1 << value);
|
||||
|
||||
/* kludge */
|
||||
if (up_flag && kbd->shift_state != old_state && kbd->npadch != -1) {
|
||||
put_utf8(kbd, kbd->npadch);
|
||||
kbd->npadch = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *kbd, unsigned int keycode, int down)
|
||||
{
|
||||
keymap_t key_map;
|
||||
struct keyent_t keysym;
|
||||
unsigned int final_key_state;
|
||||
unsigned int map_from_key_sym;
|
||||
|
||||
key_map = *kbd->key_map;
|
||||
|
||||
if (!kbd) {
|
||||
return;
|
||||
}
|
||||
|
||||
kbd->rep = (down == 2);
|
||||
|
||||
if (keycode < NUM_KEYS) {
|
||||
if (keycode >= 89 && keycode <= 95) {
|
||||
/* These constitute unprintable language-related keys, so ignore them. */
|
||||
return;
|
||||
}
|
||||
if (keycode > 95)
|
||||
keycode -= 7;
|
||||
if (vc_kbd_led(kbd, ALKED) || (kbd->shift_state & 0x8))
|
||||
{
|
||||
keycode += ALTGR_OFFSET;
|
||||
}
|
||||
keysym = key_map.key[keycode];
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
final_key_state = kbd->shift_state & 0x7;
|
||||
if ((keysym.flgs & FLAG_LOCK_C) && vc_kbd_led(kbd, LED_CAP))
|
||||
final_key_state ^= 0x1;
|
||||
if ((keysym.flgs & FLAG_LOCK_N) && vc_kbd_led(kbd, LED_NUM))
|
||||
final_key_state ^= 0x1;
|
||||
|
||||
map_from_key_sym = keysym.map[final_key_state];
|
||||
if ((keysym.spcl & (0x80 >> final_key_state)) || (map_from_key_sym & SPCLKEY)) {
|
||||
/* Special function.*/
|
||||
if (map_from_key_sym == 0)
|
||||
return; /* Nothing to do. */
|
||||
if (map_from_key_sym & SPCLKEY)
|
||||
map_from_key_sym &= ~SPCLKEY;
|
||||
if (map_from_key_sym >= F_ACC && map_from_key_sym <= L_ACC) {
|
||||
/* Accent function.*/
|
||||
unsigned int accent_index = map_from_key_sym - F_ACC;
|
||||
if (kbd->accents->acc[accent_index].accchar != 0) {
|
||||
k_deadunicode(kbd, kbd->accents->acc[accent_index].accchar, !down);
|
||||
}
|
||||
} else {
|
||||
switch(map_from_key_sym) {
|
||||
case ASH: /* alt/meta shift */
|
||||
k_shift(kbd, 3, down == 0);
|
||||
break;
|
||||
case LSHA: /* left shift + alt lock */
|
||||
case RSHA: /* right shift + alt lock */
|
||||
if (down == 0) chg_vc_kbd_led(kbd, ALKED);
|
||||
case LSH: /* left shift */
|
||||
case RSH: /* right shift */
|
||||
k_shift(kbd, 0, down == 0);
|
||||
break;
|
||||
case LCTRA: /* left ctrl + alt lock */
|
||||
case RCTRA: /* right ctrl + alt lock */
|
||||
if (down == 0) chg_vc_kbd_led(kbd, ALKED);
|
||||
case LCTR: /* left ctrl */
|
||||
case RCTR: /* right ctrl */
|
||||
k_shift(kbd, 1, down == 0);
|
||||
break;
|
||||
case LALTA: /* left alt + alt lock */
|
||||
case RALTA: /* right alt + alt lock */
|
||||
if (down == 0) chg_vc_kbd_led(kbd, ALKED);
|
||||
case LALT: /* left alt */
|
||||
case RALT: /* right alt */
|
||||
k_shift(kbd, 2, down == 0);
|
||||
break;
|
||||
case ALK: /* alt lock */
|
||||
if (down == 1) chg_vc_kbd_led(kbd, ALKED);
|
||||
break;
|
||||
case CLK: /* caps lock*/
|
||||
if (down == 1) chg_vc_kbd_led(kbd, CLKED);
|
||||
break;
|
||||
case NLK: /* num lock */
|
||||
if (down == 1) chg_vc_kbd_led(kbd, NLKED);
|
||||
break;
|
||||
case SLK: /* scroll lock */
|
||||
if (down == 1) chg_vc_kbd_led(kbd, SLKED);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (map_from_key_sym == '\n' || map_from_key_sym == '\r') {
|
||||
if (kbd->diacr) {
|
||||
kbd->diacr = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (map_from_key_sym >= ' ' && map_from_key_sym != 127) {
|
||||
k_self(kbd, map_from_key_sym, !down);
|
||||
}
|
||||
}
|
||||
|
||||
if (kbd->text_len > 0) {
|
||||
kbd->text[kbd->text_len] = '\0';
|
||||
SDL_SendKeyboardText(kbd->text);
|
||||
kbd->text_len = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* SDL_INPUT_FBSDKBIO */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
26
externals/SDL/src/core/linux/SDL_dbus.c
vendored
26
externals/SDL/src/core/linux/SDL_dbus.c
vendored
@@ -57,6 +57,10 @@ LoadDBUSSyms(void)
|
||||
SDL_DBUS_SYM(message_new_method_call);
|
||||
SDL_DBUS_SYM(message_append_args);
|
||||
SDL_DBUS_SYM(message_append_args_valist);
|
||||
SDL_DBUS_SYM(message_iter_init_append);
|
||||
SDL_DBUS_SYM(message_iter_open_container);
|
||||
SDL_DBUS_SYM(message_iter_append_basic);
|
||||
SDL_DBUS_SYM(message_iter_close_container);
|
||||
SDL_DBUS_SYM(message_get_args);
|
||||
SDL_DBUS_SYM(message_get_args_valist);
|
||||
SDL_DBUS_SYM(message_iter_init);
|
||||
@@ -65,6 +69,7 @@ LoadDBUSSyms(void)
|
||||
SDL_DBUS_SYM(message_iter_get_arg_type);
|
||||
SDL_DBUS_SYM(message_iter_recurse);
|
||||
SDL_DBUS_SYM(message_unref);
|
||||
SDL_DBUS_SYM(threads_init_default);
|
||||
SDL_DBUS_SYM(error_init);
|
||||
SDL_DBUS_SYM(error_is_set);
|
||||
SDL_DBUS_SYM(error_free);
|
||||
@@ -124,19 +129,30 @@ SDL_DBus_Init(void)
|
||||
return; /* oh well */
|
||||
}
|
||||
|
||||
dbus.error_init(&err);
|
||||
dbus.session_conn = dbus.bus_get_private(DBUS_BUS_SESSION, &err);
|
||||
if (!dbus.error_is_set(&err)) {
|
||||
dbus.system_conn = dbus.bus_get_private(DBUS_BUS_SYSTEM, &err);
|
||||
if (!dbus.threads_init_default()) {
|
||||
is_dbus_available = SDL_FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
dbus.error_init(&err);
|
||||
/* session bus is required */
|
||||
|
||||
dbus.session_conn = dbus.bus_get_private(DBUS_BUS_SESSION, &err);
|
||||
if (dbus.error_is_set(&err)) {
|
||||
dbus.error_free(&err);
|
||||
SDL_DBus_Quit();
|
||||
is_dbus_available = SDL_FALSE;
|
||||
return; /* oh well */
|
||||
}
|
||||
dbus.connection_set_exit_on_disconnect(dbus.system_conn, 0);
|
||||
dbus.connection_set_exit_on_disconnect(dbus.session_conn, 0);
|
||||
|
||||
/* system bus is optional */
|
||||
dbus.system_conn = dbus.bus_get_private(DBUS_BUS_SYSTEM, &err);
|
||||
if (!dbus.error_is_set(&err)) {
|
||||
dbus.connection_set_exit_on_disconnect(dbus.system_conn, 0);
|
||||
}
|
||||
|
||||
dbus.error_free(&err);
|
||||
}
|
||||
}
|
||||
|
||||
|
5
externals/SDL/src/core/linux/SDL_dbus.h
vendored
5
externals/SDL/src/core/linux/SDL_dbus.h
vendored
@@ -54,6 +54,10 @@ typedef struct SDL_DBusContext {
|
||||
DBusMessage *(*message_new_method_call)(const char *, const char *, const char *, const char *);
|
||||
dbus_bool_t (*message_append_args)(DBusMessage *, int, ...);
|
||||
dbus_bool_t (*message_append_args_valist)(DBusMessage *, int, va_list);
|
||||
void (*message_iter_init_append)(DBusMessage *, DBusMessageIter *);
|
||||
dbus_bool_t (*message_iter_open_container)(DBusMessageIter *, int, const char *, DBusMessageIter *);
|
||||
dbus_bool_t (*message_iter_append_basic)(DBusMessageIter *, int, const void *);
|
||||
dbus_bool_t (*message_iter_close_container)(DBusMessageIter *, DBusMessageIter *);
|
||||
dbus_bool_t (*message_get_args)(DBusMessage *, DBusError *, int, ...);
|
||||
dbus_bool_t (*message_get_args_valist)(DBusMessage *, DBusError *, int, va_list);
|
||||
dbus_bool_t (*message_iter_init)(DBusMessage *, DBusMessageIter *);
|
||||
@@ -62,6 +66,7 @@ typedef struct SDL_DBusContext {
|
||||
int (*message_iter_get_arg_type)(DBusMessageIter *);
|
||||
void (*message_iter_recurse)(DBusMessageIter *, DBusMessageIter *);
|
||||
void (*message_unref)(DBusMessage *);
|
||||
dbus_bool_t (*threads_init_default)(void);
|
||||
void (*error_init)(DBusError *);
|
||||
dbus_bool_t (*error_is_set)(const DBusError *);
|
||||
void (*error_free)(DBusError *);
|
||||
|
2
externals/SDL/src/core/linux/SDL_evdev.c
vendored
2
externals/SDL/src/core/linux/SDL_evdev.c
vendored
@@ -39,11 +39,11 @@
|
||||
#include <linux/input.h>
|
||||
|
||||
#include "SDL.h"
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_endian.h"
|
||||
#include "SDL_scancode.h"
|
||||
#include "../../events/SDL_events_c.h"
|
||||
#include "../../events/scancodes_linux.h" /* adds linux_scancode_table */
|
||||
#include "../../core/linux/SDL_evdev_capabilities.h"
|
||||
#include "../../core/linux/SDL_udev.h"
|
||||
|
||||
/* These are not defined in older Linux kernel headers */
|
||||
|
98
externals/SDL/src/core/linux/SDL_evdev_capabilities.c
vendored
Executable file
98
externals/SDL/src/core/linux/SDL_evdev_capabilities.c
vendored
Executable file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 2020 Collabora Ltd.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "SDL_evdev_capabilities.h"
|
||||
|
||||
#if HAVE_LIBUDEV_H || defined(SDL_JOYSTICK_LINUX)
|
||||
|
||||
extern int
|
||||
SDL_EVDEV_GuessDeviceClass(unsigned long bitmask_ev[NBITS(EV_MAX)],
|
||||
unsigned long bitmask_abs[NBITS(ABS_MAX)],
|
||||
unsigned long bitmask_key[NBITS(KEY_MAX)],
|
||||
unsigned long bitmask_rel[NBITS(REL_MAX)])
|
||||
{
|
||||
int devclass = 0;
|
||||
unsigned long keyboard_mask;
|
||||
|
||||
/* X, Y, Z axes but no buttons probably means an accelerometer */
|
||||
if (test_bit(EV_ABS, bitmask_ev) &&
|
||||
test_bit(ABS_X, bitmask_abs) &&
|
||||
test_bit(ABS_Y, bitmask_abs) &&
|
||||
test_bit(ABS_Z, bitmask_abs) &&
|
||||
!test_bit(EV_KEY, bitmask_ev)) {
|
||||
return SDL_UDEV_DEVICE_ACCELEROMETER;
|
||||
}
|
||||
|
||||
/* RX, RY, RZ axes but no buttons also probably means an accelerometer */
|
||||
if (test_bit(EV_ABS, bitmask_ev) &&
|
||||
test_bit(ABS_RX, bitmask_abs) &&
|
||||
test_bit(ABS_RY, bitmask_abs) &&
|
||||
test_bit(ABS_RZ, bitmask_abs) &&
|
||||
!test_bit(EV_KEY, bitmask_ev)) {
|
||||
return SDL_UDEV_DEVICE_ACCELEROMETER;
|
||||
}
|
||||
|
||||
if (test_bit(EV_ABS, bitmask_ev) &&
|
||||
test_bit(ABS_X, bitmask_abs) && test_bit(ABS_Y, bitmask_abs)) {
|
||||
if (test_bit(BTN_STYLUS, bitmask_key) || test_bit(BTN_TOOL_PEN, bitmask_key)) {
|
||||
; /* ID_INPUT_TABLET */
|
||||
} else if (test_bit(BTN_TOOL_FINGER, bitmask_key) && !test_bit(BTN_TOOL_PEN, bitmask_key)) {
|
||||
; /* ID_INPUT_TOUCHPAD */
|
||||
} else if (test_bit(BTN_MOUSE, bitmask_key)) {
|
||||
devclass |= SDL_UDEV_DEVICE_MOUSE; /* ID_INPUT_MOUSE */
|
||||
} else if (test_bit(BTN_TOUCH, bitmask_key)) {
|
||||
/* TODO: better determining between touchscreen and multitouch touchpad,
|
||||
see https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-input_id.c */
|
||||
devclass |= SDL_UDEV_DEVICE_TOUCHSCREEN; /* ID_INPUT_TOUCHSCREEN */
|
||||
}
|
||||
|
||||
if (test_bit(BTN_TRIGGER, bitmask_key) ||
|
||||
test_bit(BTN_A, bitmask_key) ||
|
||||
test_bit(BTN_1, bitmask_key) ||
|
||||
test_bit(ABS_RX, bitmask_abs) ||
|
||||
test_bit(ABS_RY, bitmask_abs) ||
|
||||
test_bit(ABS_RZ, bitmask_abs) ||
|
||||
test_bit(ABS_THROTTLE, bitmask_abs) ||
|
||||
test_bit(ABS_RUDDER, bitmask_abs) ||
|
||||
test_bit(ABS_WHEEL, bitmask_abs) ||
|
||||
test_bit(ABS_GAS, bitmask_abs) ||
|
||||
test_bit(ABS_BRAKE, bitmask_abs)) {
|
||||
devclass |= SDL_UDEV_DEVICE_JOYSTICK; /* ID_INPUT_JOYSTICK */
|
||||
}
|
||||
}
|
||||
|
||||
if (test_bit(EV_REL, bitmask_ev) &&
|
||||
test_bit(REL_X, bitmask_rel) && test_bit(REL_Y, bitmask_rel) &&
|
||||
test_bit(BTN_MOUSE, bitmask_key)) {
|
||||
devclass |= SDL_UDEV_DEVICE_MOUSE; /* ID_INPUT_MOUSE */
|
||||
}
|
||||
|
||||
/* the first 32 bits are ESC, numbers, and Q to D; if we have any of
|
||||
* those, consider it a keyboard device; do not test KEY_RESERVED, though */
|
||||
keyboard_mask = 0xFFFFFFFE;
|
||||
if ((bitmask_key[0] & keyboard_mask) != 0)
|
||||
devclass |= SDL_UDEV_DEVICE_KEYBOARD; /* ID_INPUT_KEYBOARD */
|
||||
|
||||
return devclass;
|
||||
}
|
||||
|
||||
#endif
|
59
externals/SDL/src/core/linux/SDL_evdev_capabilities.h
vendored
Executable file
59
externals/SDL/src/core/linux/SDL_evdev_capabilities.h
vendored
Executable file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 2020 Collabora Ltd.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#ifndef SDL_evdev_capabilities_h_
|
||||
#define SDL_evdev_capabilities_h_
|
||||
|
||||
#if HAVE_LIBUDEV_H || defined(SDL_JOYSTICK_LINUX)
|
||||
|
||||
#include <linux/input.h>
|
||||
|
||||
/* A device can be any combination of these classes */
|
||||
typedef enum
|
||||
{
|
||||
SDL_UDEV_DEVICE_UNKNOWN = 0x0000,
|
||||
SDL_UDEV_DEVICE_MOUSE = 0x0001,
|
||||
SDL_UDEV_DEVICE_KEYBOARD = 0x0002,
|
||||
SDL_UDEV_DEVICE_JOYSTICK = 0x0004,
|
||||
SDL_UDEV_DEVICE_SOUND = 0x0008,
|
||||
SDL_UDEV_DEVICE_TOUCHSCREEN = 0x0010,
|
||||
SDL_UDEV_DEVICE_ACCELEROMETER = 0x0020
|
||||
} SDL_UDEV_deviceclass;
|
||||
|
||||
#define BITS_PER_LONG (sizeof(unsigned long) * 8)
|
||||
#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
|
||||
#define EVDEV_OFF(x) ((x)%BITS_PER_LONG)
|
||||
#define EVDEV_LONG(x) ((x)/BITS_PER_LONG)
|
||||
#define test_bit(bit, array) ((array[EVDEV_LONG(bit)] >> EVDEV_OFF(bit)) & 1)
|
||||
|
||||
extern int SDL_EVDEV_GuessDeviceClass(unsigned long bitmask_ev[NBITS(EV_MAX)],
|
||||
unsigned long bitmask_abs[NBITS(ABS_MAX)],
|
||||
unsigned long bitmask_key[NBITS(KEY_MAX)],
|
||||
unsigned long bitmask_rel[NBITS(REL_MAX)]);
|
||||
|
||||
#endif /* HAVE_LIBUDEV_H || defined(SDL_JOYSTICK_LINUX) */
|
||||
|
||||
#endif /* SDL_evdev_capabilities_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
2
externals/SDL/src/core/linux/SDL_evdev_kbd.c
vendored
2
externals/SDL/src/core/linux/SDL_evdev_kbd.c
vendored
@@ -819,7 +819,7 @@ SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *kbd, unsigned int keycode, int d
|
||||
}
|
||||
}
|
||||
|
||||
#else /* !SDL_INPUT_LINUXKD */
|
||||
#elif !defined(SDL_INPUT_FBSDKBIO) /* !SDL_INPUT_LINUXKD */
|
||||
|
||||
SDL_EVDEV_keyboard_state *
|
||||
SDL_EVDEV_kbd_init(void)
|
||||
|
232
externals/SDL/src/core/linux/SDL_fcitx.c
vendored
232
externals/SDL/src/core/linux/SDL_fcitx.c
vendored
@@ -20,9 +20,6 @@
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#ifdef HAVE_FCITX_FRONTEND_H
|
||||
|
||||
#include <fcitx/frontend.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "SDL_fcitx.h"
|
||||
@@ -36,23 +33,20 @@
|
||||
#endif
|
||||
#include "SDL_hints.h"
|
||||
|
||||
#define FCITX_DBUS_SERVICE "org.fcitx.Fcitx"
|
||||
#define FCITX_DBUS_SERVICE "org.freedesktop.portal.Fcitx"
|
||||
|
||||
#define FCITX_IM_DBUS_PATH "/inputmethod"
|
||||
#define FCITX_IC_DBUS_PATH "/inputcontext_%d"
|
||||
#define FCITX_IM_DBUS_PATH "/org/freedesktop/portal/inputmethod"
|
||||
|
||||
#define FCITX_IM_DBUS_INTERFACE "org.fcitx.Fcitx.InputMethod"
|
||||
#define FCITX_IC_DBUS_INTERFACE "org.fcitx.Fcitx.InputContext"
|
||||
#define FCITX_IM_DBUS_INTERFACE "org.fcitx.Fcitx.InputMethod1"
|
||||
#define FCITX_IC_DBUS_INTERFACE "org.fcitx.Fcitx.InputContext1"
|
||||
|
||||
#define IC_NAME_MAX 64
|
||||
#define DBUS_TIMEOUT 500
|
||||
|
||||
typedef struct _FcitxClient
|
||||
{
|
||||
SDL_DBusContext *dbus;
|
||||
|
||||
char servicename[IC_NAME_MAX];
|
||||
char icname[IC_NAME_MAX];
|
||||
char *ic_path;
|
||||
|
||||
int id;
|
||||
|
||||
@@ -61,34 +55,6 @@ typedef struct _FcitxClient
|
||||
|
||||
static FcitxClient fcitx_client;
|
||||
|
||||
static int
|
||||
GetDisplayNumber()
|
||||
{
|
||||
const char *display = SDL_getenv("DISPLAY");
|
||||
const char *p = NULL;
|
||||
int number = 0;
|
||||
|
||||
if (display == NULL)
|
||||
return 0;
|
||||
|
||||
display = SDL_strchr(display, ':');
|
||||
if (display == NULL)
|
||||
return 0;
|
||||
|
||||
display++;
|
||||
p = SDL_strchr(display, '.');
|
||||
if (p == NULL && display != NULL) {
|
||||
number = SDL_strtod(display, NULL);
|
||||
} else {
|
||||
char *buffer = SDL_strdup(display);
|
||||
buffer[p - display] = '\0';
|
||||
number = SDL_strtod(buffer, NULL);
|
||||
SDL_free(buffer);
|
||||
}
|
||||
|
||||
return number;
|
||||
}
|
||||
|
||||
static char*
|
||||
GetAppName()
|
||||
{
|
||||
@@ -118,6 +84,54 @@ GetAppName()
|
||||
return SDL_strdup("SDL_App");
|
||||
}
|
||||
|
||||
size_t Fcitx_GetPreeditString(SDL_DBusContext *dbus, DBusMessage *msg, char **ret) {
|
||||
char *text = NULL, *subtext;
|
||||
size_t text_bytes = 0;
|
||||
DBusMessageIter iter, array, sub;
|
||||
|
||||
dbus->message_iter_init(msg, &iter);
|
||||
/* Message type is a(si)i, we only need string part */
|
||||
if (dbus->message_iter_get_arg_type(&iter) == DBUS_TYPE_ARRAY) {
|
||||
/* First pass: calculate string length */
|
||||
dbus->message_iter_recurse(&iter, &array);
|
||||
while (dbus->message_iter_get_arg_type(&array) == DBUS_TYPE_STRUCT) {
|
||||
dbus->message_iter_recurse(&array, &sub);
|
||||
if (dbus->message_iter_get_arg_type(&sub) == DBUS_TYPE_STRING) {
|
||||
dbus->message_iter_get_basic(&sub, &subtext);
|
||||
if (subtext && *subtext) {
|
||||
text_bytes += SDL_strlen(subtext);
|
||||
}
|
||||
}
|
||||
dbus->message_iter_next(&array);
|
||||
}
|
||||
if (text_bytes) {
|
||||
text = SDL_malloc(text_bytes + 1);
|
||||
}
|
||||
|
||||
if (text) {
|
||||
char* pivot = text;
|
||||
/* Second pass: join all the sub string */
|
||||
dbus->message_iter_recurse(&iter, &array);
|
||||
while (dbus->message_iter_get_arg_type(&array) == DBUS_TYPE_STRUCT) {
|
||||
dbus->message_iter_recurse(&array, &sub);
|
||||
if (dbus->message_iter_get_arg_type(&sub) == DBUS_TYPE_STRING) {
|
||||
dbus->message_iter_get_basic(&sub, &subtext);
|
||||
if (subtext && *subtext) {
|
||||
size_t length = SDL_strlen(subtext);
|
||||
SDL_strlcpy(pivot, subtext, length + 1);
|
||||
pivot += length;
|
||||
}
|
||||
}
|
||||
dbus->message_iter_next(&array);
|
||||
}
|
||||
} else {
|
||||
text_bytes = 0;
|
||||
}
|
||||
}
|
||||
*ret= text;
|
||||
return text_bytes;
|
||||
}
|
||||
|
||||
static DBusHandlerResult
|
||||
DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data)
|
||||
{
|
||||
@@ -130,22 +144,27 @@ DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data)
|
||||
dbus->message_iter_init(msg, &iter);
|
||||
dbus->message_iter_get_basic(&iter, &text);
|
||||
|
||||
if (text)
|
||||
SDL_SendKeyboardText(text);
|
||||
if (text && *text) {
|
||||
char buf[SDL_TEXTINPUTEVENT_TEXT_SIZE];
|
||||
size_t text_bytes = SDL_strlen(text), i = 0;
|
||||
|
||||
while (i < text_bytes) {
|
||||
size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf));
|
||||
SDL_SendKeyboardText(buf);
|
||||
|
||||
i += sz;
|
||||
}
|
||||
}
|
||||
|
||||
return DBUS_HANDLER_RESULT_HANDLED;
|
||||
}
|
||||
|
||||
if (dbus->message_is_signal(msg, FCITX_IC_DBUS_INTERFACE, "UpdatePreedit")) {
|
||||
DBusMessageIter iter;
|
||||
const char *text;
|
||||
|
||||
dbus->message_iter_init(msg, &iter);
|
||||
dbus->message_iter_get_basic(&iter, &text);
|
||||
|
||||
if (text && *text) {
|
||||
if (dbus->message_is_signal(msg, FCITX_IC_DBUS_INTERFACE, "UpdateFormattedPreedit")) {
|
||||
char *text = NULL;
|
||||
size_t text_bytes = Fcitx_GetPreeditString(dbus, msg, &text);
|
||||
if (text_bytes) {
|
||||
char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
|
||||
size_t text_bytes = SDL_strlen(text), i = 0;
|
||||
size_t i = 0;
|
||||
size_t cursor = 0;
|
||||
|
||||
while (i < text_bytes) {
|
||||
@@ -157,6 +176,9 @@ DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data)
|
||||
i += sz;
|
||||
cursor += chars;
|
||||
}
|
||||
SDL_free(text);
|
||||
} else {
|
||||
SDL_SendEditingText("", 0, 0);
|
||||
}
|
||||
|
||||
SDL_Fcitx_UpdateTextRect(NULL);
|
||||
@@ -169,7 +191,10 @@ DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data)
|
||||
static void
|
||||
FcitxClientICCallMethod(FcitxClient *client, const char *method)
|
||||
{
|
||||
SDL_DBus_CallVoidMethod(client->servicename, client->icname, FCITX_IC_DBUS_INTERFACE, method, DBUS_TYPE_INVALID);
|
||||
if (!client->ic_path) {
|
||||
return;
|
||||
}
|
||||
SDL_DBus_CallVoidMethod(FCITX_DBUS_SERVICE, client->ic_path, FCITX_IC_DBUS_INTERFACE, method, DBUS_TYPE_INVALID);
|
||||
}
|
||||
|
||||
static void SDLCALL
|
||||
@@ -179,40 +204,68 @@ Fcitx_SetCapabilities(void *data,
|
||||
const char *internal_editing)
|
||||
{
|
||||
FcitxClient *client = (FcitxClient *)data;
|
||||
Uint32 caps = CAPACITY_NONE;
|
||||
|
||||
if (!(internal_editing && *internal_editing == '1')) {
|
||||
caps |= CAPACITY_PREEDIT;
|
||||
Uint32 caps = 0;
|
||||
if (!client->ic_path) {
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_DBus_CallVoidMethod(client->servicename, client->icname, FCITX_IC_DBUS_INTERFACE, "SetCapacity", DBUS_TYPE_UINT32, &caps, DBUS_TYPE_INVALID);
|
||||
if (!(internal_editing && *internal_editing == '1')) {
|
||||
caps |= (1 << 1); /* Preedit Flag */
|
||||
caps |= (1 << 4); /* Formatted Preedit Flag */
|
||||
}
|
||||
|
||||
SDL_DBus_CallVoidMethod(FCITX_DBUS_SERVICE, client->ic_path, FCITX_IC_DBUS_INTERFACE, "SetCapability", DBUS_TYPE_UINT64, &caps, DBUS_TYPE_INVALID);
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
FcitxCreateInputContext(SDL_DBusContext* dbus, const char *appname, char **ic_path) {
|
||||
const char *program = "program";
|
||||
SDL_bool retval = SDL_FALSE;
|
||||
if (dbus->session_conn) {
|
||||
DBusMessage *msg = dbus->message_new_method_call(FCITX_DBUS_SERVICE, FCITX_IM_DBUS_PATH, FCITX_IM_DBUS_INTERFACE, "CreateInputContext");
|
||||
if (msg) {
|
||||
DBusMessage *reply = NULL;
|
||||
DBusMessageIter args, array, sub;
|
||||
dbus->message_iter_init_append(msg, &args);
|
||||
dbus->message_iter_open_container(&args, DBUS_TYPE_ARRAY, "(ss)", &array);
|
||||
dbus->message_iter_open_container(&array, DBUS_TYPE_STRUCT, 0, &sub);
|
||||
dbus->message_iter_append_basic(&sub, DBUS_TYPE_STRING, &program);
|
||||
dbus->message_iter_append_basic(&sub, DBUS_TYPE_STRING, &appname);
|
||||
dbus->message_iter_close_container(&array, &sub);
|
||||
dbus->message_iter_close_container(&args, &array);
|
||||
reply = dbus->connection_send_with_reply_and_block(dbus->session_conn, msg, 300, NULL);
|
||||
if (reply) {
|
||||
if (dbus->message_get_args(reply, NULL, DBUS_TYPE_OBJECT_PATH, ic_path, DBUS_TYPE_INVALID)) {
|
||||
retval = SDL_TRUE;
|
||||
}
|
||||
dbus->message_unref(reply);
|
||||
}
|
||||
dbus->message_unref(msg);
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
FcitxClientCreateIC(FcitxClient *client)
|
||||
{
|
||||
char *appname = GetAppName();
|
||||
pid_t pid = getpid();
|
||||
int id = -1;
|
||||
Uint32 enable, arg1, arg2, arg3, arg4;
|
||||
char *ic_path = NULL;
|
||||
SDL_DBusContext *dbus = client->dbus;
|
||||
|
||||
if (!SDL_DBus_CallMethod(client->servicename, FCITX_IM_DBUS_PATH, FCITX_IM_DBUS_INTERFACE, "CreateICv3",
|
||||
DBUS_TYPE_STRING, &appname, DBUS_TYPE_INT32, &pid, DBUS_TYPE_INVALID,
|
||||
DBUS_TYPE_INT32, &id, DBUS_TYPE_BOOLEAN, &enable, DBUS_TYPE_UINT32, &arg1, DBUS_TYPE_UINT32, &arg2, DBUS_TYPE_UINT32, &arg3, DBUS_TYPE_UINT32, &arg4, DBUS_TYPE_INVALID)) {
|
||||
id = -1; /* just in case. */
|
||||
/* SDL_DBus_CallMethod cannot handle a(ss) type, call dbus function directly */
|
||||
if (!FcitxCreateInputContext(dbus, appname, &ic_path)) {
|
||||
ic_path = NULL; /* just in case. */
|
||||
}
|
||||
|
||||
SDL_free(appname);
|
||||
|
||||
if (id >= 0) {
|
||||
SDL_DBusContext *dbus = client->dbus;
|
||||
|
||||
client->id = id;
|
||||
|
||||
SDL_snprintf(client->icname, IC_NAME_MAX, FCITX_IC_DBUS_PATH, client->id);
|
||||
if (ic_path) {
|
||||
SDL_free(client->ic_path);
|
||||
client->ic_path = SDL_strdup(ic_path);
|
||||
|
||||
dbus->bus_add_match(dbus->session_conn,
|
||||
"type='signal', interface='org.fcitx.Fcitx.InputContext'",
|
||||
"type='signal', interface='org.fcitx.Fcitx.InputContext1'",
|
||||
NULL);
|
||||
dbus->connection_add_filter(dbus->session_conn,
|
||||
&DBus_MessageFilter, dbus,
|
||||
@@ -232,13 +285,14 @@ Fcitx_ModState(void)
|
||||
Uint32 fcitx_mods = 0;
|
||||
SDL_Keymod sdl_mods = SDL_GetModState();
|
||||
|
||||
if (sdl_mods & KMOD_SHIFT) fcitx_mods |= FcitxKeyState_Shift;
|
||||
if (sdl_mods & KMOD_CAPS) fcitx_mods |= FcitxKeyState_CapsLock;
|
||||
if (sdl_mods & KMOD_CTRL) fcitx_mods |= FcitxKeyState_Ctrl;
|
||||
if (sdl_mods & KMOD_ALT) fcitx_mods |= FcitxKeyState_Alt;
|
||||
if (sdl_mods & KMOD_NUM) fcitx_mods |= FcitxKeyState_NumLock;
|
||||
if (sdl_mods & KMOD_LGUI) fcitx_mods |= FcitxKeyState_Super;
|
||||
if (sdl_mods & KMOD_RGUI) fcitx_mods |= FcitxKeyState_Meta;
|
||||
if (sdl_mods & KMOD_SHIFT) fcitx_mods |= (1 << 0);
|
||||
if (sdl_mods & KMOD_CAPS) fcitx_mods |= (1 << 1);
|
||||
if (sdl_mods & KMOD_CTRL) fcitx_mods |= (1 << 2);
|
||||
if (sdl_mods & KMOD_ALT) fcitx_mods |= (1 << 3);
|
||||
if (sdl_mods & KMOD_NUM) fcitx_mods |= (1 << 4);
|
||||
if (sdl_mods & KMOD_MODE) fcitx_mods |= (1 << 7);
|
||||
if (sdl_mods & KMOD_LGUI) fcitx_mods |= (1 << 6);
|
||||
if (sdl_mods & KMOD_RGUI) fcitx_mods |= (1 << 28);
|
||||
|
||||
return fcitx_mods;
|
||||
}
|
||||
@@ -253,10 +307,6 @@ SDL_Fcitx_Init()
|
||||
fcitx_client.cursor_rect.w = 0;
|
||||
fcitx_client.cursor_rect.h = 0;
|
||||
|
||||
SDL_snprintf(fcitx_client.servicename, IC_NAME_MAX,
|
||||
"%s-%d",
|
||||
FCITX_DBUS_SERVICE, GetDisplayNumber());
|
||||
|
||||
return FcitxClientCreateIC(&fcitx_client);
|
||||
}
|
||||
|
||||
@@ -264,6 +314,10 @@ void
|
||||
SDL_Fcitx_Quit()
|
||||
{
|
||||
FcitxClientICCallMethod(&fcitx_client, "DestroyIC");
|
||||
if (fcitx_client.ic_path) {
|
||||
SDL_free(fcitx_client.ic_path);
|
||||
fcitx_client.ic_path = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -288,12 +342,16 @@ SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode)
|
||||
{
|
||||
Uint32 state = Fcitx_ModState();
|
||||
Uint32 handled = SDL_FALSE;
|
||||
int type = FCITX_PRESS_KEY;
|
||||
Uint32 is_release = SDL_FALSE;
|
||||
Uint32 event_time = 0;
|
||||
|
||||
if (SDL_DBus_CallMethod(fcitx_client.servicename, fcitx_client.icname, FCITX_IC_DBUS_INTERFACE, "ProcessKeyEvent",
|
||||
DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &keycode, DBUS_TYPE_UINT32, &state, DBUS_TYPE_INT32, &type, DBUS_TYPE_UINT32, &event_time, DBUS_TYPE_INVALID,
|
||||
DBUS_TYPE_INT32, &handled, DBUS_TYPE_INVALID)) {
|
||||
if (!fcitx_client.ic_path) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
if (SDL_DBus_CallMethod(FCITX_DBUS_SERVICE, fcitx_client.ic_path, FCITX_IC_DBUS_INTERFACE, "ProcessKeyEvent",
|
||||
DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &keycode, DBUS_TYPE_UINT32, &state, DBUS_TYPE_BOOLEAN, &is_release, DBUS_TYPE_UINT32, &event_time, DBUS_TYPE_INVALID,
|
||||
DBUS_TYPE_BOOLEAN, &handled, DBUS_TYPE_INVALID)) {
|
||||
if (handled) {
|
||||
SDL_Fcitx_UpdateTextRect(NULL);
|
||||
return SDL_TRUE;
|
||||
@@ -350,7 +408,7 @@ SDL_Fcitx_UpdateTextRect(SDL_Rect *rect)
|
||||
x += cursor->x;
|
||||
y += cursor->y;
|
||||
|
||||
SDL_DBus_CallVoidMethod(fcitx_client.servicename, fcitx_client.icname, FCITX_IC_DBUS_INTERFACE, "SetCursorRect",
|
||||
SDL_DBus_CallVoidMethod(FCITX_DBUS_SERVICE, fcitx_client.ic_path, FCITX_IC_DBUS_INTERFACE, "SetCursorRect",
|
||||
DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, DBUS_TYPE_INT32, &cursor->w, DBUS_TYPE_INT32, &cursor->h, DBUS_TYPE_INVALID);
|
||||
}
|
||||
|
||||
@@ -368,6 +426,4 @@ SDL_Fcitx_PumpEvents(void)
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HAVE_FCITX_FRONTEND_H */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
6
externals/SDL/src/core/linux/SDL_ime.c
vendored
6
externals/SDL/src/core/linux/SDL_ime.c
vendored
@@ -43,7 +43,7 @@ static void
|
||||
InitIME()
|
||||
{
|
||||
static SDL_bool inited = SDL_FALSE;
|
||||
#ifdef HAVE_FCITX_FRONTEND_H
|
||||
#ifdef HAVE_FCITX
|
||||
const char *im_module = SDL_getenv("SDL_IM_MODULE");
|
||||
const char *xmodifiers = SDL_getenv("XMODIFIERS");
|
||||
#endif
|
||||
@@ -54,7 +54,7 @@ InitIME()
|
||||
inited = SDL_TRUE;
|
||||
|
||||
/* See if fcitx IME support is being requested */
|
||||
#ifdef HAVE_FCITX_FRONTEND_H
|
||||
#ifdef HAVE_FCITX
|
||||
if (!SDL_IME_Init_Real &&
|
||||
((im_module && SDL_strcmp(im_module, "fcitx") == 0) ||
|
||||
(!im_module && xmodifiers && SDL_strstr(xmodifiers, "@im=fcitx") != NULL))) {
|
||||
@@ -66,7 +66,7 @@ InitIME()
|
||||
SDL_IME_UpdateTextRect_Real = SDL_Fcitx_UpdateTextRect;
|
||||
SDL_IME_PumpEvents_Real = SDL_Fcitx_PumpEvents;
|
||||
}
|
||||
#endif /* HAVE_FCITX_FRONTEND_H */
|
||||
#endif /* HAVE_FCITX */
|
||||
|
||||
/* default to IBus */
|
||||
#ifdef HAVE_IBUS_IBUS_H
|
||||
|
189
externals/SDL/src/core/linux/SDL_threadprio.c
vendored
189
externals/SDL/src/core/linux/SDL_threadprio.c
vendored
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_thread.h"
|
||||
|
||||
#if !SDL_THREADS_DISABLED
|
||||
#include <sys/time.h>
|
||||
@@ -31,9 +32,20 @@
|
||||
#include <pthread.h>
|
||||
#include "SDL_system.h"
|
||||
|
||||
/* RLIMIT_RTTIME requires kernel >= 2.6.25 and is in glibc >= 2.14 */
|
||||
#ifndef RLIMIT_RTTIME
|
||||
#define RLIMIT_RTTIME 15
|
||||
#endif
|
||||
/* SCHED_RESET_ON_FORK is in kernel >= 2.6.32. */
|
||||
#ifndef SCHED_RESET_ON_FORK
|
||||
#define SCHED_RESET_ON_FORK 0x40000000
|
||||
#endif
|
||||
|
||||
#include "SDL_dbus.h"
|
||||
|
||||
#if SDL_USE_LIBDBUS
|
||||
#include <sched.h>
|
||||
|
||||
/* d-bus queries to org.freedesktop.RealtimeKit1. */
|
||||
#define RTKIT_DBUS_NODE "org.freedesktop.RealtimeKit1"
|
||||
#define RTKIT_DBUS_PATH "/org/freedesktop/RealtimeKit1"
|
||||
@@ -41,6 +53,8 @@
|
||||
|
||||
static pthread_once_t rtkit_initialize_once = PTHREAD_ONCE_INIT;
|
||||
static Sint32 rtkit_min_nice_level = -20;
|
||||
static Sint32 rtkit_max_realtime_priority = 99;
|
||||
static Sint64 rtkit_max_rttime_usec = 200000;
|
||||
|
||||
static void
|
||||
rtkit_initialize()
|
||||
@@ -52,10 +66,84 @@ rtkit_initialize()
|
||||
DBUS_TYPE_INT32, &rtkit_min_nice_level)) {
|
||||
rtkit_min_nice_level = -20;
|
||||
}
|
||||
|
||||
/* Try getting maximum realtime priority: this can be less than the POSIX default (99). */
|
||||
if (!dbus || !SDL_DBus_QueryPropertyOnConnection(dbus->system_conn, RTKIT_DBUS_NODE, RTKIT_DBUS_PATH, RTKIT_DBUS_INTERFACE, "MaxRealtimePriority",
|
||||
DBUS_TYPE_INT32, &rtkit_max_realtime_priority)) {
|
||||
rtkit_max_realtime_priority = 99;
|
||||
}
|
||||
|
||||
/* Try getting maximum rttime allowed by rtkit: exceeding this value will result in SIGKILL */
|
||||
if (!dbus || !SDL_DBus_QueryPropertyOnConnection(dbus->system_conn, RTKIT_DBUS_NODE, RTKIT_DBUS_PATH, RTKIT_DBUS_INTERFACE, "RTTimeUSecMax",
|
||||
DBUS_TYPE_INT64, &rtkit_max_rttime_usec)) {
|
||||
rtkit_max_rttime_usec = 200000;
|
||||
}
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
rtkit_setpriority(pid_t thread, int nice_level)
|
||||
rtkit_initialize_realtime_thread()
|
||||
{
|
||||
// Following is an excerpt from rtkit README that outlines the requirements
|
||||
// a thread must meet before making rtkit requests:
|
||||
//
|
||||
// * Only clients with RLIMIT_RTTIME set will get RT scheduling
|
||||
//
|
||||
// * RT scheduling will only be handed out to processes with
|
||||
// SCHED_RESET_ON_FORK set to guarantee that the scheduling
|
||||
// settings cannot 'leak' to child processes, thus making sure
|
||||
// that 'RT fork bombs' cannot be used to bypass RLIMIT_RTTIME
|
||||
// and take the system down.
|
||||
//
|
||||
// * Limits are enforced on all user controllable resources, only
|
||||
// a maximum number of users, processes, threads can request RT
|
||||
// scheduling at the same time.
|
||||
//
|
||||
// * Only a limited number of threads may be made RT in a
|
||||
// specific time frame.
|
||||
//
|
||||
// * Client authorization is verified with PolicyKit
|
||||
|
||||
int err;
|
||||
struct rlimit rlimit;
|
||||
int nLimit = RLIMIT_RTTIME;
|
||||
pid_t nPid = 0; //self
|
||||
int nSchedPolicy = sched_getscheduler(nPid) | SCHED_RESET_ON_FORK;
|
||||
struct sched_param schedParam = {};
|
||||
|
||||
// Requirement #1: Set RLIMIT_RTTIME
|
||||
err = getrlimit(nLimit, &rlimit);
|
||||
if (err)
|
||||
{
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
// Current rtkit allows a max of 200ms right now
|
||||
rlimit.rlim_max = rtkit_max_rttime_usec;
|
||||
rlimit.rlim_cur = rlimit.rlim_max / 2;
|
||||
err = setrlimit(nLimit, &rlimit);
|
||||
if (err)
|
||||
{
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
// Requirement #2: Add SCHED_RESET_ON_FORK to the scheduler policy
|
||||
err = sched_getparam(nPid, &schedParam);
|
||||
if (err)
|
||||
{
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
err = sched_setscheduler(nPid, nSchedPolicy, &schedParam);
|
||||
if (err)
|
||||
{
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
rtkit_setpriority_nice(pid_t thread, int nice_level)
|
||||
{
|
||||
Uint64 ui64 = (Uint64)thread;
|
||||
Sint32 si32 = (Sint32)nice_level;
|
||||
@@ -74,10 +162,42 @@ rtkit_setpriority(pid_t thread, int nice_level)
|
||||
}
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
rtkit_setpriority_realtime(pid_t thread, int rt_priority)
|
||||
{
|
||||
Uint64 ui64 = (Uint64)thread;
|
||||
Uint32 ui32 = (Uint32)rt_priority;
|
||||
SDL_DBusContext *dbus = SDL_DBus_GetContext();
|
||||
|
||||
pthread_once(&rtkit_initialize_once, rtkit_initialize);
|
||||
|
||||
if (ui32 > rtkit_max_realtime_priority)
|
||||
ui32 = rtkit_max_realtime_priority;
|
||||
|
||||
// We always perform the thread state changes necessary for rtkit.
|
||||
// This wastes some system calls if the state is already set but
|
||||
// typically code sets a thread priority and leaves it so it's
|
||||
// not expected that this wasted effort will be an issue.
|
||||
// We also do not quit if this fails, we let the rtkit request
|
||||
// go through to determine whether it really needs to fail or not.
|
||||
rtkit_initialize_realtime_thread();
|
||||
|
||||
if (!dbus || !SDL_DBus_CallMethodOnConnection(dbus->system_conn,
|
||||
RTKIT_DBUS_NODE, RTKIT_DBUS_PATH, RTKIT_DBUS_INTERFACE, "MakeThreadRealtime",
|
||||
DBUS_TYPE_UINT64, &ui64, DBUS_TYPE_UINT32, &ui32, DBUS_TYPE_INVALID,
|
||||
DBUS_TYPE_INVALID)) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
return SDL_TRUE;
|
||||
}
|
||||
#else
|
||||
|
||||
#define rtkit_max_realtime_priority 99
|
||||
|
||||
#endif /* dbus */
|
||||
#endif /* threads */
|
||||
|
||||
|
||||
/* this is a public symbol, so it has to exist even if threads are disabled. */
|
||||
int
|
||||
SDL_LinuxSetThreadPriority(Sint64 threadID, int priority)
|
||||
@@ -102,7 +222,7 @@ SDL_LinuxSetThreadPriority(Sint64 threadID, int priority)
|
||||
|
||||
README and sample code at: http://git.0pointer.net/rtkit.git
|
||||
*/
|
||||
if (rtkit_setpriority((pid_t)threadID, priority)) {
|
||||
if (rtkit_setpriority_nice((pid_t)threadID, priority)) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -111,6 +231,69 @@ SDL_LinuxSetThreadPriority(Sint64 threadID, int priority)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* this is a public symbol, so it has to exist even if threads are disabled. */
|
||||
int
|
||||
SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy)
|
||||
{
|
||||
#if SDL_THREADS_DISABLED
|
||||
return SDL_Unsupported();
|
||||
#else
|
||||
int osPriority;
|
||||
|
||||
if (schedPolicy == SCHED_RR || schedPolicy == SCHED_FIFO) {
|
||||
if (sdlPriority == SDL_THREAD_PRIORITY_LOW) {
|
||||
osPriority = 1;
|
||||
} else if (sdlPriority == SDL_THREAD_PRIORITY_HIGH) {
|
||||
osPriority = rtkit_max_realtime_priority * 3 / 4;
|
||||
} else if (sdlPriority == SDL_THREAD_PRIORITY_TIME_CRITICAL) {
|
||||
osPriority = rtkit_max_realtime_priority;
|
||||
} else {
|
||||
osPriority = rtkit_max_realtime_priority / 2;
|
||||
}
|
||||
} else {
|
||||
if (sdlPriority == SDL_THREAD_PRIORITY_LOW) {
|
||||
osPriority = 19;
|
||||
} else if (sdlPriority == SDL_THREAD_PRIORITY_HIGH) {
|
||||
osPriority = -10;
|
||||
} else if (sdlPriority == SDL_THREAD_PRIORITY_TIME_CRITICAL) {
|
||||
osPriority = -20;
|
||||
} else {
|
||||
osPriority = 0;
|
||||
}
|
||||
|
||||
if (setpriority(PRIO_PROCESS, (id_t)threadID, osPriority) == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#if SDL_USE_LIBDBUS
|
||||
/* Note that this fails you most likely:
|
||||
* Have your process's scheduler incorrectly configured.
|
||||
See the requirements at:
|
||||
http://git.0pointer.net/rtkit.git/tree/README#n16
|
||||
* Encountered dbus/polkit security restrictions. Note
|
||||
that the RealtimeKit1 dbus endpoint is inaccessible
|
||||
over ssh connections for most common distro configs.
|
||||
You might want to check your local config for details:
|
||||
/usr/share/polkit-1/actions/org.freedesktop.RealtimeKit1.policy
|
||||
|
||||
README and sample code at: http://git.0pointer.net/rtkit.git
|
||||
*/
|
||||
if (schedPolicy == SCHED_RR || schedPolicy == SCHED_FIFO) {
|
||||
if (rtkit_setpriority_realtime((pid_t)threadID, osPriority)) {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (rtkit_setpriority_nice((pid_t)threadID, osPriority)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return SDL_SetError("setpriority() failed");
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* __LINUX__ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
55
externals/SDL/src/core/linux/SDL_udev.c
vendored
55
externals/SDL/src/core/linux/SDL_udev.c
vendored
@@ -32,6 +32,7 @@
|
||||
#include <linux/input.h>
|
||||
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_evdev_capabilities.h"
|
||||
#include "SDL_loadso.h"
|
||||
#include "SDL_timer.h"
|
||||
#include "SDL_hints.h"
|
||||
@@ -291,12 +292,6 @@ SDL_UDEV_LoadLibrary(void)
|
||||
return retval;
|
||||
}
|
||||
|
||||
#define BITS_PER_LONG (sizeof(unsigned long) * 8)
|
||||
#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
|
||||
#define OFF(x) ((x)%BITS_PER_LONG)
|
||||
#define LONG(x) ((x)/BITS_PER_LONG)
|
||||
#define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)
|
||||
|
||||
static void get_caps(struct udev_device *dev, struct udev_device *pdev, const char *attr, unsigned long *bitmask, size_t bitmask_len)
|
||||
{
|
||||
const char *value;
|
||||
@@ -330,13 +325,11 @@ static void get_caps(struct udev_device *dev, struct udev_device *pdev, const ch
|
||||
static int
|
||||
guess_device_class(struct udev_device *dev)
|
||||
{
|
||||
int devclass = 0;
|
||||
struct udev_device *pdev;
|
||||
unsigned long bitmask_ev[NBITS(EV_MAX)];
|
||||
unsigned long bitmask_abs[NBITS(ABS_MAX)];
|
||||
unsigned long bitmask_key[NBITS(KEY_MAX)];
|
||||
unsigned long bitmask_rel[NBITS(REL_MAX)];
|
||||
unsigned long keyboard_mask;
|
||||
|
||||
/* walk up the parental chain until we find the real input device; the
|
||||
* argument is very likely a subdevice of this, like eventN */
|
||||
@@ -353,48 +346,10 @@ guess_device_class(struct udev_device *dev)
|
||||
get_caps(dev, pdev, "capabilities/rel", bitmask_rel, SDL_arraysize(bitmask_rel));
|
||||
get_caps(dev, pdev, "capabilities/key", bitmask_key, SDL_arraysize(bitmask_key));
|
||||
|
||||
if (test_bit(EV_ABS, bitmask_ev) &&
|
||||
test_bit(ABS_X, bitmask_abs) && test_bit(ABS_Y, bitmask_abs)) {
|
||||
if (test_bit(BTN_STYLUS, bitmask_key) || test_bit(BTN_TOOL_PEN, bitmask_key)) {
|
||||
; /* ID_INPUT_TABLET */
|
||||
} else if (test_bit(BTN_TOOL_FINGER, bitmask_key) && !test_bit(BTN_TOOL_PEN, bitmask_key)) {
|
||||
; /* ID_INPUT_TOUCHPAD */
|
||||
} else if (test_bit(BTN_MOUSE, bitmask_key)) {
|
||||
devclass |= SDL_UDEV_DEVICE_MOUSE; /* ID_INPUT_MOUSE */
|
||||
} else if (test_bit(BTN_TOUCH, bitmask_key)) {
|
||||
/* TODO: better determining between touchscreen and multitouch touchpad,
|
||||
see https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-input_id.c */
|
||||
devclass |= SDL_UDEV_DEVICE_TOUCHSCREEN; /* ID_INPUT_TOUCHSCREEN */
|
||||
}
|
||||
|
||||
if (test_bit(BTN_TRIGGER, bitmask_key) ||
|
||||
test_bit(BTN_A, bitmask_key) ||
|
||||
test_bit(BTN_1, bitmask_key) ||
|
||||
test_bit(ABS_RX, bitmask_abs) ||
|
||||
test_bit(ABS_RY, bitmask_abs) ||
|
||||
test_bit(ABS_RZ, bitmask_abs) ||
|
||||
test_bit(ABS_THROTTLE, bitmask_abs) ||
|
||||
test_bit(ABS_RUDDER, bitmask_abs) ||
|
||||
test_bit(ABS_WHEEL, bitmask_abs) ||
|
||||
test_bit(ABS_GAS, bitmask_abs) ||
|
||||
test_bit(ABS_BRAKE, bitmask_abs)) {
|
||||
devclass |= SDL_UDEV_DEVICE_JOYSTICK; /* ID_INPUT_JOYSTICK */
|
||||
}
|
||||
}
|
||||
|
||||
if (test_bit(EV_REL, bitmask_ev) &&
|
||||
test_bit(REL_X, bitmask_rel) && test_bit(REL_Y, bitmask_rel) &&
|
||||
test_bit(BTN_MOUSE, bitmask_key)) {
|
||||
devclass |= SDL_UDEV_DEVICE_MOUSE; /* ID_INPUT_MOUSE */
|
||||
}
|
||||
|
||||
/* the first 32 bits are ESC, numbers, and Q to D; if we have any of
|
||||
* those, consider it a keyboard device; do not test KEY_RESERVED, though */
|
||||
keyboard_mask = 0xFFFFFFFE;
|
||||
if ((bitmask_key[0] & keyboard_mask) != 0)
|
||||
devclass |= SDL_UDEV_DEVICE_KEYBOARD; /* ID_INPUT_KEYBOARD */
|
||||
|
||||
return devclass;
|
||||
return SDL_EVDEV_GuessDeviceClass(&bitmask_ev[0],
|
||||
&bitmask_abs[0],
|
||||
&bitmask_key[0],
|
||||
&bitmask_rel[0]);
|
||||
}
|
||||
|
||||
static void
|
||||
|
11
externals/SDL/src/core/linux/SDL_udev.h
vendored
11
externals/SDL/src/core/linux/SDL_udev.h
vendored
@@ -46,17 +46,6 @@ typedef enum
|
||||
SDL_UDEV_DEVICEREMOVED
|
||||
} SDL_UDEV_deviceevent;
|
||||
|
||||
/* A device can be any combination of these classes */
|
||||
typedef enum
|
||||
{
|
||||
SDL_UDEV_DEVICE_UNKNOWN = 0x0000,
|
||||
SDL_UDEV_DEVICE_MOUSE = 0x0001,
|
||||
SDL_UDEV_DEVICE_KEYBOARD = 0x0002,
|
||||
SDL_UDEV_DEVICE_JOYSTICK = 0x0004,
|
||||
SDL_UDEV_DEVICE_SOUND = 0x0008,
|
||||
SDL_UDEV_DEVICE_TOUCHSCREEN = 0x0010
|
||||
} SDL_UDEV_deviceclass;
|
||||
|
||||
typedef void (*SDL_UDEV_Callback)(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath);
|
||||
|
||||
typedef struct SDL_UDEV_CallbackList {
|
||||
|
38
externals/SDL/src/core/os2/SDL_os2.c
vendored
Executable file
38
externals/SDL/src/core/os2/SDL_os2.c
vendored
Executable file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if defined(__OS2__)
|
||||
|
||||
#include "geniconv/geniconv.h"
|
||||
|
||||
/* SDL_OS2Quit() will be called from SDL_QuitSubSystem() */
|
||||
void SDL_OS2Quit(void)
|
||||
{
|
||||
/* Unload DLL used for iconv. We can do it at any time and use iconv again -
|
||||
* dynamic library will be loaded on first call iconv_open() (see geniconv). */
|
||||
libiconv_clean();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
52
externals/SDL/src/core/os2/SDL_os2.h
vendored
Executable file
52
externals/SDL/src/core/os2/SDL_os2.h
vendored
Executable file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#ifndef SDL_os2_h_
|
||||
#define SDL_os2_h_
|
||||
|
||||
#include "SDL_log.h"
|
||||
#include "SDL_stdinc.h"
|
||||
#include "geniconv/geniconv.h"
|
||||
|
||||
#ifdef OS2DEBUG
|
||||
#if (OS2DEBUG-0 >= 2)
|
||||
# define debug_os2(s,...) SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, \
|
||||
__func__ "(): " ##s, ##__VA_ARGS__)
|
||||
#else
|
||||
# define debug_os2(s,...) printf(__func__ "(): " ##s "\n", ##__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#else /* no debug */
|
||||
|
||||
# define debug_os2(s,...) do {} while (0)
|
||||
|
||||
#endif /* OS2DEBUG */
|
||||
|
||||
|
||||
/* StrUTF8New() - geniconv/sys2utf8.c */
|
||||
#define OS2_SysToUTF8(S) StrUTF8New(1, (S), SDL_strlen((S)) + 1)
|
||||
#define OS2_UTF8ToSys(S) StrUTF8New(0, (char *)(S), SDL_strlen((S)) + 1)
|
||||
|
||||
/* SDL_OS2Quit() will be called from SDL_QuitSubSystem() */
|
||||
void SDL_OS2Quit(void);
|
||||
|
||||
#endif /* SDL_os2_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
157
externals/SDL/src/core/os2/geniconv/geniconv.c
vendored
Executable file
157
externals/SDL/src/core/os2/geniconv/geniconv.c
vendored
Executable file
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
Universal iconv implementation for OS/2.
|
||||
|
||||
Andrey Vasilkin, 2016.
|
||||
*/
|
||||
|
||||
#define INCL_DOSMODULEMGR /* Module Manager values */
|
||||
#define INCL_DOSERRORS /* Error values */
|
||||
#include <os2.h>
|
||||
|
||||
#include "geniconv.h"
|
||||
|
||||
/*#define DEBUG*/
|
||||
|
||||
#ifdef DEBUG
|
||||
# include <stdio.h>
|
||||
# define debug(s,...) printf(__func__"(): "##s"\n" ,##__VA_ARGS__)
|
||||
#else
|
||||
# define debug(s,...) do {} while (0)
|
||||
#endif
|
||||
|
||||
/* Exports from os2iconv.c */
|
||||
extern iconv_t _System os2_iconv_open(const char* tocode, const char* fromcode);
|
||||
extern size_t _System os2_iconv(iconv_t cd, char* * inbuf,
|
||||
size_t *inbytesleft, char* * outbuf,
|
||||
size_t *outbytesleft);
|
||||
extern int _System os2_iconv_close(iconv_t cd);
|
||||
|
||||
/* Functions pointers types */
|
||||
typedef iconv_t _System (*FNICONV_OPEN)(const char* tocode, const char* fromcode);
|
||||
typedef size_t _System (*FNICONV)(iconv_t cd, char* * inbuf,
|
||||
size_t *inbytesleft, char* * outbuf,
|
||||
size_t *outbytesleft);
|
||||
typedef int _System (*FNICONV_CLOSE)(iconv_t cd);
|
||||
|
||||
/* Used DLL module handle */
|
||||
static HMODULE hmIconv = NULLHANDLE;
|
||||
/* Functions pointers */
|
||||
static FNICONV_OPEN fn_iconv_open = NULL;
|
||||
static FNICONV fn_iconv = NULL;
|
||||
static FNICONV_CLOSE fn_iconv_close = NULL;
|
||||
|
||||
|
||||
static BOOL _loadDLL(PSZ pszName, PSZ pszIconvOpen, PSZ pszIconv,
|
||||
PSZ pszIconvClose)
|
||||
{
|
||||
ULONG ulRC;
|
||||
CHAR acError[256];
|
||||
|
||||
ulRC = DosLoadModule(acError, sizeof(acError), pszName, &hmIconv);
|
||||
if (ulRC != NO_ERROR) {
|
||||
debug("DLL not loaded: %s", &acError);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
do {
|
||||
ulRC = DosQueryProcAddr(hmIconv, 0, pszIconvOpen, (PFN *)&fn_iconv_open);
|
||||
if (ulRC != NO_ERROR) {
|
||||
debug("Error: cannot find entry %s in %s", pszIconvOpen, pszName);
|
||||
break;
|
||||
}
|
||||
|
||||
ulRC = DosQueryProcAddr(hmIconv, 0, pszIconv, (PFN *)&fn_iconv);
|
||||
if (ulRC != NO_ERROR) {
|
||||
debug("Error: cannot find entry %s in %s", pszIconv, pszName);
|
||||
break;
|
||||
}
|
||||
|
||||
ulRC = DosQueryProcAddr(hmIconv, 0, pszIconvClose, (PFN *)&fn_iconv_close);
|
||||
if (ulRC != NO_ERROR) {
|
||||
debug("Error: cannot find entry %s in %s", pszIconvClose, pszName);
|
||||
break;
|
||||
}
|
||||
|
||||
debug("DLL %s used", pszName);
|
||||
return TRUE;
|
||||
} while (FALSE);
|
||||
|
||||
DosFreeModule(hmIconv);
|
||||
hmIconv = NULLHANDLE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void _init(void)
|
||||
{
|
||||
if (fn_iconv_open != NULL) /* Already was initialized */
|
||||
return;
|
||||
|
||||
/* Try to load kiconv.dll, iconv2.dll or iconv.dll */
|
||||
if (!_loadDLL("KICONV", "_libiconv_open", "_libiconv", "_libiconv_close") &&
|
||||
!_loadDLL("ICONV2", "_libiconv_open", "_libiconv", "_libiconv_close") &&
|
||||
!_loadDLL("ICONV", "_iconv_open", "_iconv", "_iconv_close") ) {
|
||||
/* No DLL was loaded - use OS/2 conversion objects API */
|
||||
debug("Uni*() API used");
|
||||
fn_iconv_open = os2_iconv_open;
|
||||
fn_iconv = os2_iconv;
|
||||
fn_iconv_close = os2_iconv_close;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Public routines.
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
/* Non-standard function for iconv to unload the used dynamic library */
|
||||
void libiconv_clean(void)
|
||||
{
|
||||
if (hmIconv != NULLHANDLE) {
|
||||
DosFreeModule(hmIconv);
|
||||
hmIconv = NULLHANDLE;
|
||||
|
||||
fn_iconv_open = NULL;
|
||||
fn_iconv = NULL;
|
||||
fn_iconv_close = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
iconv_t libiconv_open(const char* tocode, const char* fromcode)
|
||||
{
|
||||
_init();
|
||||
return fn_iconv_open(tocode, fromcode);
|
||||
}
|
||||
|
||||
size_t libiconv(iconv_t cd, char* * inbuf, size_t *inbytesleft,
|
||||
char* * outbuf, size_t *outbytesleft)
|
||||
{
|
||||
return fn_iconv(cd, inbuf, inbytesleft, outbuf, outbytesleft);
|
||||
}
|
||||
|
||||
int libiconv_close(iconv_t cd)
|
||||
{
|
||||
return fn_iconv_close(cd);
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
85
externals/SDL/src/core/os2/geniconv/geniconv.h
vendored
Executable file
85
externals/SDL/src/core/os2/geniconv/geniconv.h
vendored
Executable file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
Universal iconv implementation for OS/2.
|
||||
|
||||
Andrey Vasilkin, 2016.
|
||||
*/
|
||||
|
||||
#ifndef GENICONV_H
|
||||
#define GENICONV_H
|
||||
|
||||
#include <iconv.h>
|
||||
|
||||
#ifdef iconv_open
|
||||
#undef iconv_open
|
||||
#endif
|
||||
#define iconv_open libiconv_open
|
||||
|
||||
#ifdef iconv
|
||||
#undef iconv
|
||||
#endif
|
||||
#define iconv libiconv
|
||||
|
||||
#ifdef iconv_close
|
||||
#undef iconv_close
|
||||
#endif
|
||||
#define iconv_close libiconv_close
|
||||
|
||||
#define iconv_clean libiconv_clean
|
||||
|
||||
/* Non-standard function for iconv to unload the used dynamic library */
|
||||
void libiconv_clean(void);
|
||||
|
||||
iconv_t libiconv_open (const char *tocode, const char *fromcode);
|
||||
int libiconv_close(iconv_t cd);
|
||||
size_t libiconv (iconv_t cd, char **inbuf, size_t *inbytesleft,
|
||||
char **outbuf, size_t *outbytesleft);
|
||||
|
||||
/* System codepage <-> UTF-8
|
||||
*
|
||||
* StrUTF8()
|
||||
* Coverts string from system cp to UTF-8 (fToUTF8 is not 0) or from UTF-8 to
|
||||
* the system cp (fToUTF8 is 0). Converted ASCIIZ string will be placed at the
|
||||
* buffer pcDst, up to cbDst - 1 (for sys->utf8) or 2 (for utf8->sys) bytes.
|
||||
* Returns the number of bytes written into pcDst, not counting the terminating
|
||||
* 0 byte(s) or -1 on error.
|
||||
*/
|
||||
int StrUTF8(int fToUTF8, char *pcDst, int cbDst, char *pcSrc, int cbSrc);
|
||||
|
||||
/* StrUTF8New()
|
||||
* Coverts string from system cp to UTF-8 (fToUTF8 is not 0) or from UTF-8 to
|
||||
* the system cp (fToUTF8 is 0). Memory for the new string is obtained by
|
||||
* using libc malloc().
|
||||
* Returns converted string, terminating two bytes 0 is appended to the result.
|
||||
* Returns null on error.
|
||||
*/
|
||||
char *StrUTF8New(int fToUTF8, char *pcStr, int cbStr);
|
||||
|
||||
/* StrUTF8Free()
|
||||
* Deallocates the memory block located by StrUTF8New() (just libc free()).
|
||||
*/
|
||||
void StrUTF8Free(char *pszStr);
|
||||
|
||||
#endif /* GENICONV_H */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
21
externals/SDL/src/core/os2/geniconv/iconv.h
vendored
Executable file
21
externals/SDL/src/core/os2/geniconv/iconv.h
vendored
Executable file
@@ -0,0 +1,21 @@
|
||||
#ifndef ICONV_H_ /* minimal iconv.h header based on public knowledge */
|
||||
#define ICONV_H_
|
||||
|
||||
#include <stddef.h> /* size_t */
|
||||
#include <errno.h>
|
||||
|
||||
typedef void *iconv_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern iconv_t iconv_open(const char *, const char *);
|
||||
extern size_t iconv(iconv_t, char **, size_t *, char **, size_t *);
|
||||
extern int iconv_close(iconv_t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ICONV_H_ */
|
37
externals/SDL/src/core/os2/geniconv/makefile
vendored
Executable file
37
externals/SDL/src/core/os2/geniconv/makefile
vendored
Executable file
@@ -0,0 +1,37 @@
|
||||
#
|
||||
# Universal iconv implementation for OS/2.
|
||||
#
|
||||
# OpenWatcom makefile to build a library that uses kiconv.dll / iconv2.dll /
|
||||
# iconv.dll or OS/2 Uni*() API.
|
||||
#
|
||||
# Andrey Vasilkin, 2016.
|
||||
#
|
||||
|
||||
LIBFILE = geniconv.lib
|
||||
|
||||
all: $(LIBFILE) test.exe .symbolic
|
||||
|
||||
CFLAGS = -I$(%WATCOM)/h/os2 -I$(%WATCOM)/h -I. -bt=os2 -q -d0 -w2
|
||||
|
||||
SRCS = geniconv.c os2cp.c os2iconv.c
|
||||
SRCS+= sys2utf8.c
|
||||
|
||||
OBJS = $(SRCS:.c=.obj)
|
||||
|
||||
LIBS = libuls.lib libconv.lib $(LIBFILE)
|
||||
|
||||
test.exe: $(LIBFILE) test.obj
|
||||
wlink op quiet system os2v2 file test.obj lib {$(LIBS)} name $*
|
||||
|
||||
$(LIBFILE): $(OBJS)
|
||||
@if exist $@ rm $@
|
||||
@for %f in ($(OBJS)) do wlib -q -b $* +%f
|
||||
|
||||
.c.obj:
|
||||
wcc386 $(CFLAGS) -fo=$^@ $<
|
||||
|
||||
clean: .SYMBOLIC
|
||||
@if exist *.obj rm *.obj
|
||||
@if exist *.err rm *.err
|
||||
@if exist $(LIBFILE) rm $(LIBFILE)
|
||||
@if exist test.exe rm test.exe
|
401
externals/SDL/src/core/os2/geniconv/os2cp.c
vendored
Executable file
401
externals/SDL/src/core/os2/geniconv/os2cp.c
vendored
Executable file
@@ -0,0 +1,401 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#define INCL_DOSNLS
|
||||
#define INCL_DOSERRORS
|
||||
#include <os2.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "os2cp.h"
|
||||
|
||||
typedef struct _CP2NAME {
|
||||
ULONG ulCode;
|
||||
PSZ pszName;
|
||||
} CP2NAME;
|
||||
|
||||
typedef struct _NAME2CP {
|
||||
PSZ pszName;
|
||||
ULONG ulCode;
|
||||
} NAME2CP;
|
||||
|
||||
static CP2NAME aCP2Name[] = {
|
||||
{367, "ANSI_X3.4-1968"},
|
||||
{813, "ECMA-118"},
|
||||
{819, "CP819"},
|
||||
{850, "850"},
|
||||
{862, "862"},
|
||||
{866, "866"},
|
||||
{874, "ISO-IR-166"},
|
||||
{878, "KOI8-R"},
|
||||
{896, "JISX0201-1976"},
|
||||
{901, "ISO-8859-13"},
|
||||
{912, "ISO-8859-2"},
|
||||
{913, "ISO-8859-3"},
|
||||
{914, "ISO-8859-4"},
|
||||
{915, "CYRILLIC"},
|
||||
{920, "ISO-8859-9"},
|
||||
{923, "ISO-8859-15"},
|
||||
{943, "MS_KANJI"},
|
||||
{954, "EUC-JP"},
|
||||
{964, "EUC-TW"},
|
||||
{970, "EUC-KR"},
|
||||
{1051, "HP-ROMAN8"},
|
||||
{1089, "ARABIC"},
|
||||
{1129, "VISCII"},
|
||||
{1168, "KOI8-U"},
|
||||
{1200, "ISO-10646-UCS-2"},
|
||||
{1202, "UTF-16LE"},
|
||||
{1204, "UCS-2BE"},
|
||||
{1208, "UTF-8"},
|
||||
{1232, "UTF-32BE"},
|
||||
{1234, "UTF-32LE"},
|
||||
{1236, "ISO-10646-UCS-4"},
|
||||
{1250, "CP1250"},
|
||||
{1251, "CP1251"},
|
||||
{1252, "CP1252"},
|
||||
{1253, "CP1253"},
|
||||
{1254, "CP1254"},
|
||||
{1255, "CP1255"},
|
||||
{1256, "CP1256"},
|
||||
{1257, "CP1257"},
|
||||
{1275, "MAC"},
|
||||
{1383, "CN-GB"},
|
||||
{1386, "GBK"},
|
||||
{1392, "GB18030"},
|
||||
{62210, "HEBREW"}
|
||||
};
|
||||
|
||||
static NAME2CP aName2CP[] = {
|
||||
{"850", 850},
|
||||
{"862", 862},
|
||||
{"866", 866},
|
||||
{"ANSI_X3.4-1968", 367},
|
||||
{"ANSI_X3.4-1986", 367},
|
||||
{"ARABIC", 1089},
|
||||
{"ASCII", 367},
|
||||
{"ASMO-708", 1089},
|
||||
{"CN-GB", 1383},
|
||||
{"CP1250", 1250},
|
||||
{"CP1251", 1251},
|
||||
{"CP1252", 1252},
|
||||
{"CP1253", 1253},
|
||||
{"CP1254", 1254},
|
||||
{"CP1255", 1255},
|
||||
{"CP1256", 1256},
|
||||
{"CP1257", 1257},
|
||||
{"CP367", 367},
|
||||
{"CP819", 819},
|
||||
{"CP850", 850},
|
||||
{"CP862", 862},
|
||||
{"CP866", 866},
|
||||
{"CP936", 1386},
|
||||
{"CSASCII", 367},
|
||||
{"CSEUCKR", 970},
|
||||
{"CSEUCPKDFMTJAPANESE", 954},
|
||||
{"CSEUCTW", 964},
|
||||
{"CSGB2312", 1383},
|
||||
{"CSHALFWIDTHKATAKANA", 896},
|
||||
{"CSHPROMAN8", 1051},
|
||||
{"CSIBM866", 866},
|
||||
{"CSISOLATIN1", 819},
|
||||
{"CSISOLATIN2", 912},
|
||||
{"CSISOLATIN3", 913},
|
||||
{"CSISOLATIN4", 914},
|
||||
{"CSISOLATIN5", 920},
|
||||
{"CSISOLATINARABIC", 1089},
|
||||
{"CSISOLATINCYRILLIC", 915},
|
||||
{"CSISOLATINGREEK", 813},
|
||||
{"CSISOLATINHEBREW", 62210},
|
||||
{"CSKOI8R", 878},
|
||||
{"CSKSC56011987", 970},
|
||||
{"CSMACINTOSH", 1275},
|
||||
{"CSPC850MULTILINGUAL", 850},
|
||||
{"CSPC862LATINHEBREW", 862},
|
||||
{"CSSHIFTJIS", 943},
|
||||
{"CSUCS4", 1236},
|
||||
{"CSUNICODE", 1200},
|
||||
{"CSUNICODE11", 1204},
|
||||
{"CSVISCII", 1129},
|
||||
{"CYRILLIC", 915},
|
||||
{"ECMA-114", 1089},
|
||||
{"ECMA-118", 813},
|
||||
{"ELOT_928", 813},
|
||||
{"EUC-CN", 1383},
|
||||
{"EUC-JP", 954},
|
||||
{"EUC-KR", 970},
|
||||
{"EUC-TW", 964},
|
||||
{"EUCCN", 1383},
|
||||
{"EUCJP", 954},
|
||||
{"EUCKR", 970},
|
||||
{"EUCTW", 964},
|
||||
{"EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE", 954},
|
||||
{"GB18030", 1392},
|
||||
{"GB2312", 1383},
|
||||
{"GBK", 1386},
|
||||
{"GREEK", 813},
|
||||
{"GREEK8", 813},
|
||||
{"HEBREW", 62210},
|
||||
{"HP-ROMAN8", 1051},
|
||||
{"IBM367", 367},
|
||||
{"IBM819", 819},
|
||||
{"IBM850", 850},
|
||||
{"IBM862", 862},
|
||||
{"IBM866", 866},
|
||||
{"ISO-10646-UCS-2", 1200},
|
||||
{"ISO-10646-UCS-4", 1236},
|
||||
{"ISO-8859-1", 819},
|
||||
{"ISO-8859-13", 901},
|
||||
{"ISO-8859-15", 923},
|
||||
{"ISO-8859-2", 912},
|
||||
{"ISO-8859-3", 913},
|
||||
{"ISO-8859-4", 914},
|
||||
{"ISO-8859-5", 915},
|
||||
{"ISO-8859-6", 1089},
|
||||
{"ISO-8859-7", 813},
|
||||
{"ISO-8859-8", 62210},
|
||||
{"ISO-8859-9", 920},
|
||||
{"ISO-IR-100", 819},
|
||||
{"ISO-IR-101", 912},
|
||||
{"ISO-IR-109", 913},
|
||||
{"ISO-IR-110", 914},
|
||||
{"ISO-IR-126", 813},
|
||||
{"ISO-IR-127", 1089},
|
||||
{"ISO-IR-138", 62210},
|
||||
{"ISO-IR-144", 915},
|
||||
{"ISO-IR-148", 920},
|
||||
{"ISO-IR-149", 970},
|
||||
{"ISO-IR-166", 874},
|
||||
{"ISO-IR-179", 901},
|
||||
{"ISO-IR-203", 923},
|
||||
{"ISO-IR-6", 367},
|
||||
{"ISO646-US", 367},
|
||||
{"ISO8859-1", 819},
|
||||
{"ISO8859-13", 901},
|
||||
{"ISO8859-15", 923},
|
||||
{"ISO8859-2", 912},
|
||||
{"ISO8859-3", 913},
|
||||
{"ISO8859-4", 914},
|
||||
{"ISO8859-5", 915},
|
||||
{"ISO8859-6", 1089},
|
||||
{"ISO8859-7", 813},
|
||||
{"ISO8859-8", 62210},
|
||||
{"ISO8859-9", 920},
|
||||
{"ISO_646.IRV:1991", 367},
|
||||
{"ISO_8859-1", 819},
|
||||
{"ISO_8859-13", 901},
|
||||
{"ISO_8859-15", 923},
|
||||
{"ISO_8859-15:1998", 923},
|
||||
{"ISO_8859-1:1987", 819},
|
||||
{"ISO_8859-2", 912},
|
||||
{"ISO_8859-2:1987", 912},
|
||||
{"ISO_8859-3", 913},
|
||||
{"ISO_8859-3:1988", 913},
|
||||
{"ISO_8859-4", 914},
|
||||
{"ISO_8859-4:1988", 914},
|
||||
{"ISO_8859-5", 915},
|
||||
{"ISO_8859-5:1988", 915},
|
||||
{"ISO_8859-6", 1089},
|
||||
{"ISO_8859-6:1987", 1089},
|
||||
{"ISO_8859-7", 813},
|
||||
{"ISO_8859-7:1987", 813},
|
||||
{"ISO_8859-7:2003", 813},
|
||||
{"ISO_8859-8", 62210},
|
||||
{"ISO_8859-8:1988", 62210},
|
||||
{"ISO_8859-9", 920},
|
||||
{"ISO_8859-9:1989", 920},
|
||||
{"JISX0201-1976", 896},
|
||||
{"JIS_X0201", 896},
|
||||
{"KOI8-R", 878},
|
||||
{"KOI8-U", 1168},
|
||||
{"KOREAN", 970},
|
||||
{"KSC_5601", 970},
|
||||
{"KS_C_5601-1987", 970},
|
||||
{"KS_C_5601-1989", 970},
|
||||
{"L1", 819},
|
||||
{"L2", 912},
|
||||
{"L3", 913},
|
||||
{"L4", 914},
|
||||
{"L5", 920},
|
||||
{"L7", 901},
|
||||
{"LATIN-9", 923},
|
||||
{"LATIN1", 819},
|
||||
{"LATIN2", 912},
|
||||
{"LATIN3", 913},
|
||||
{"LATIN4", 914},
|
||||
{"LATIN5", 920},
|
||||
{"LATIN7", 901},
|
||||
{"MAC", 1275},
|
||||
{"MACINTOSH", 1275},
|
||||
{"MACROMAN", 1275},
|
||||
{"MS-ANSI", 1252},
|
||||
{"MS-ARAB", 1256},
|
||||
{"MS-CYRL", 1251},
|
||||
{"MS-EE", 1250},
|
||||
{"MS-GREEK", 1253},
|
||||
{"MS-HEBR", 1255},
|
||||
{"MS-TURK", 1254},
|
||||
{"MS936", 1386},
|
||||
{"MS_KANJI", 943},
|
||||
{"R8", 1051},
|
||||
{"ROMAN8", 1051},
|
||||
{"SHIFT-JIS", 943},
|
||||
{"SHIFT_JIS", 943},
|
||||
{"SJIS", 943},
|
||||
{"TIS-620", 874},
|
||||
{"TIS620", 874},
|
||||
{"TIS620-0", 874},
|
||||
{"TIS620.2529-1", 874},
|
||||
{"TIS620.2533-0", 874},
|
||||
{"TIS620.2533-1", 874},
|
||||
{"UCS-2", 1200},
|
||||
{"UCS-2BE", 1204},
|
||||
{"UCS-4", 1236},
|
||||
{"UNICODE-1-1", 1204},
|
||||
{"UNICODEBIG", 1204},
|
||||
{"US", 367},
|
||||
{"US-ASCII", 367},
|
||||
{"UTF-16", 1204},
|
||||
{"UTF-16BE", 1200},
|
||||
{"UTF-16LE", 1202},
|
||||
{"UTF-32", 1236},
|
||||
{"UTF-32BE", 1232},
|
||||
{"UTF-32LE", 1234},
|
||||
{"UTF-8", 1208},
|
||||
{"VISCII", 1129},
|
||||
{"VISCII1.1-1", 1129},
|
||||
{"WINBALTRIM", 1257},
|
||||
{"WINDOWS-1250", 1250},
|
||||
{"WINDOWS-1251", 1251},
|
||||
{"WINDOWS-1252", 1252},
|
||||
{"WINDOWS-1253", 1253},
|
||||
{"WINDOWS-1254", 1254},
|
||||
{"WINDOWS-1255", 1255},
|
||||
{"WINDOWS-1256", 1256},
|
||||
{"WINDOWS-1257", 1257},
|
||||
{"WINDOWS-936", 1386},
|
||||
{"X0201", 896}
|
||||
};
|
||||
|
||||
char *os2cpToName(unsigned long cp)
|
||||
{
|
||||
ULONG ulLo = 0;
|
||||
ULONG ulHi = (sizeof(aCP2Name) / sizeof(struct _CP2NAME)) - 1;
|
||||
ULONG ulNext;
|
||||
LONG lFound = -1;
|
||||
|
||||
if (cp == SYSTEM_CP) {
|
||||
ULONG aulCP[3];
|
||||
ULONG cCP;
|
||||
|
||||
if (DosQueryCp(sizeof(aulCP), aulCP, &cCP) != NO_ERROR)
|
||||
return NULL;
|
||||
|
||||
cp = aulCP[0];
|
||||
}
|
||||
|
||||
if (aCP2Name[0].ulCode > cp || aCP2Name[ulHi].ulCode < cp)
|
||||
return NULL;
|
||||
|
||||
if (aCP2Name[0].ulCode == cp)
|
||||
return aCP2Name[0].pszName;
|
||||
|
||||
if (aCP2Name[ulHi].ulCode == cp)
|
||||
return aCP2Name[ulHi].pszName;
|
||||
|
||||
while ((ulHi - ulLo) > 1) {
|
||||
ulNext = (ulLo + ulHi) / 2;
|
||||
|
||||
if (aCP2Name[ulNext].ulCode < cp)
|
||||
ulLo = ulNext;
|
||||
else if (aCP2Name[ulNext].ulCode > cp)
|
||||
ulHi = ulNext;
|
||||
else {
|
||||
lFound = ulNext;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (lFound == -1)? NULL : aCP2Name[lFound].pszName;
|
||||
}
|
||||
|
||||
unsigned long os2cpFromName(char *cp)
|
||||
{
|
||||
ULONG ulLo = 0;
|
||||
ULONG ulHi = (sizeof(aName2CP) / sizeof(struct _NAME2CP)) - 1;
|
||||
ULONG ulNext;
|
||||
LONG lFound = -1;
|
||||
LONG lCmp;
|
||||
PCHAR pcEnd;
|
||||
CHAR acBuf[64];
|
||||
|
||||
if (cp == NULL) {
|
||||
ULONG aulCP[3];
|
||||
ULONG cCP;
|
||||
|
||||
return (DosQueryCp(sizeof(aulCP), aulCP, &cCP) != NO_ERROR)? 0 : aulCP[0];
|
||||
}
|
||||
|
||||
while (isspace(*cp))
|
||||
cp++;
|
||||
|
||||
pcEnd = strchr(cp, ' ');
|
||||
if (pcEnd == NULL)
|
||||
pcEnd = strchr(cp, '\0');
|
||||
|
||||
ulNext = pcEnd - cp;
|
||||
if (ulNext >= sizeof(acBuf))
|
||||
return 0;
|
||||
|
||||
memcpy(acBuf, cp, ulNext);
|
||||
acBuf[ulNext] = '\0';
|
||||
strupr(acBuf);
|
||||
|
||||
lCmp = strcmp(aName2CP[0].pszName, acBuf);
|
||||
if (lCmp > 0)
|
||||
return 0;
|
||||
else if (lCmp == 0)
|
||||
return aName2CP[0].ulCode;
|
||||
|
||||
lCmp = strcmp(aName2CP[ulHi].pszName, acBuf);
|
||||
if (lCmp < 0)
|
||||
return 0;
|
||||
else if (lCmp == 0)
|
||||
return aName2CP[ulHi].ulCode;
|
||||
|
||||
while ((ulHi - ulLo) > 1) {
|
||||
ulNext = (ulLo + ulHi) / 2;
|
||||
|
||||
lCmp = strcmp(aName2CP[ulNext].pszName, acBuf);
|
||||
if (lCmp < 0)
|
||||
ulLo = ulNext;
|
||||
else if (lCmp > 0)
|
||||
ulHi = ulNext;
|
||||
else {
|
||||
lFound = ulNext;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (lFound == -1)? 0 : aName2CP[lFound].ulCode;
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
32
externals/SDL/src/core/os2/geniconv/os2cp.h
vendored
Executable file
32
externals/SDL/src/core/os2/geniconv/os2cp.h
vendored
Executable file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef OS2CP_H
|
||||
#define OS2CP_H 1
|
||||
|
||||
#define SYSTEM_CP 0
|
||||
|
||||
char *os2cpToName(unsigned long cp);
|
||||
unsigned long os2cpFromName(char *cp);
|
||||
|
||||
#endif /* OS2CP_H */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
270
externals/SDL/src/core/os2/geniconv/os2iconv.c
vendored
Executable file
270
externals/SDL/src/core/os2/geniconv/os2iconv.c
vendored
Executable file
@@ -0,0 +1,270 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
Implementation iconv via OS/2 conversion objects API.
|
||||
|
||||
Andrey Vasilkin.
|
||||
*/
|
||||
|
||||
#define ICONV_THREAD_SAFE 1
|
||||
|
||||
#include "geniconv.h"
|
||||
#define _ULS_CALLCONV_
|
||||
#define CALLCONV _System
|
||||
#include <uconv.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef ICONV_THREAD_SAFE
|
||||
#define INCL_DOSSEMAPHORES
|
||||
#define INCL_DOSERRORS
|
||||
#include <os2.h>
|
||||
#endif
|
||||
#include "os2cp.h"
|
||||
|
||||
#if !defined(min)
|
||||
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#define MAX_CP_NAME_LEN 64
|
||||
|
||||
typedef struct iuconv_obj {
|
||||
UconvObject uo_tocode;
|
||||
UconvObject uo_fromcode;
|
||||
int buf_len;
|
||||
UniChar *buf;
|
||||
#ifdef ICONV_THREAD_SAFE
|
||||
HMTX hMtx;
|
||||
#endif
|
||||
} iuconv_obj;
|
||||
|
||||
|
||||
static int _createUconvObj(const char *code, UconvObject *uobj)
|
||||
{
|
||||
UniChar uc_code[MAX_CP_NAME_LEN];
|
||||
int i;
|
||||
const char *ch = code;
|
||||
|
||||
if (code == NULL)
|
||||
uc_code[0] = 0;
|
||||
else {
|
||||
for (i = 0; i < MAX_CP_NAME_LEN; i++) {
|
||||
uc_code[i] = (unsigned short)*ch;
|
||||
if (! (*ch))
|
||||
break;
|
||||
ch++;
|
||||
}
|
||||
}
|
||||
|
||||
return UniCreateUconvObject(uc_code, uobj);
|
||||
}
|
||||
|
||||
static int uconv_open(const char *code, UconvObject *uobj)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (!stricmp(code, "UTF-16")) {
|
||||
*uobj = NULL;
|
||||
return ULS_SUCCESS;
|
||||
}
|
||||
|
||||
rc = _createUconvObj(code, uobj);
|
||||
if (rc != ULS_SUCCESS) {
|
||||
unsigned long cp = os2cpFromName((char *)code);
|
||||
char cp_name[16];
|
||||
|
||||
if (cp != 0 && _snprintf(cp_name, sizeof(cp_name), "IBM-%u", cp) > 0)
|
||||
rc = _createUconvObj(cp_name, uobj);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
extern iconv_t _System os2_iconv_open(const char* tocode, const char* fromcode)
|
||||
{
|
||||
UconvObject uo_tocode;
|
||||
UconvObject uo_fromcode;
|
||||
int rc;
|
||||
iuconv_obj *iuobj;
|
||||
|
||||
if (tocode == NULL)
|
||||
tocode = "";
|
||||
|
||||
if (fromcode == NULL)
|
||||
fromcode = "";
|
||||
|
||||
if (stricmp(tocode, fromcode) != 0) {
|
||||
rc = uconv_open(fromcode, &uo_fromcode);
|
||||
if (rc != ULS_SUCCESS) {
|
||||
errno = EINVAL;
|
||||
return (iconv_t)(-1);
|
||||
}
|
||||
|
||||
rc = uconv_open(tocode, &uo_tocode);
|
||||
if (rc != ULS_SUCCESS) {
|
||||
UniFreeUconvObject(uo_fromcode);
|
||||
errno = EINVAL;
|
||||
return (iconv_t)(-1);
|
||||
}
|
||||
} else {
|
||||
uo_tocode = NULL;
|
||||
uo_fromcode = NULL;
|
||||
}
|
||||
|
||||
iuobj = (iuconv_obj *) malloc(sizeof(iuconv_obj));
|
||||
iuobj->uo_tocode = uo_tocode;
|
||||
iuobj->uo_fromcode = uo_fromcode;
|
||||
iuobj->buf_len = 0;
|
||||
iuobj->buf = NULL;
|
||||
#ifdef ICONV_THREAD_SAFE
|
||||
DosCreateMutexSem(NULL, &iuobj->hMtx, 0, FALSE);
|
||||
#endif
|
||||
|
||||
return iuobj;
|
||||
}
|
||||
|
||||
extern size_t _System os2_iconv(iconv_t cd, char* * inbuf,
|
||||
size_t *inbytesleft,
|
||||
char* * outbuf, size_t *outbytesleft)
|
||||
{
|
||||
UconvObject uo_tocode = ((iuconv_obj *)(cd))->uo_tocode;
|
||||
UconvObject uo_fromcode = ((iuconv_obj *)(cd))->uo_fromcode;
|
||||
size_t nonIdenticalConv = 0;
|
||||
UniChar *uc_buf;
|
||||
size_t uc_buf_len;
|
||||
UniChar **uc_str;
|
||||
size_t *uc_str_len;
|
||||
int rc;
|
||||
size_t ret = (size_t)(-1);
|
||||
|
||||
if (uo_tocode == NULL && uo_fromcode == NULL) {
|
||||
uc_buf_len = min(*inbytesleft, *outbytesleft);
|
||||
memcpy(*outbuf, *inbuf, uc_buf_len);
|
||||
*inbytesleft -= uc_buf_len;
|
||||
*outbytesleft -= uc_buf_len;
|
||||
outbuf += uc_buf_len;
|
||||
inbuf += uc_buf_len;
|
||||
return uc_buf_len;
|
||||
}
|
||||
|
||||
#ifdef ICONV_THREAD_SAFE
|
||||
DosRequestMutexSem(((iuconv_obj *)(cd))->hMtx, SEM_INDEFINITE_WAIT);
|
||||
#endif
|
||||
|
||||
if (uo_tocode && uo_fromcode &&
|
||||
(((iuconv_obj *)cd)->buf_len >> 1) < *inbytesleft) {
|
||||
if (((iuconv_obj *)cd)->buf != NULL)
|
||||
free(((iuconv_obj *)cd)->buf);
|
||||
((iuconv_obj *)cd)->buf_len = *inbytesleft << 1;
|
||||
((iuconv_obj *)cd)->buf = (UniChar *)malloc(((iuconv_obj *)cd)->buf_len);
|
||||
}
|
||||
|
||||
if (uo_fromcode) {
|
||||
if (uo_tocode) {
|
||||
uc_buf = ((iuconv_obj *)cd)->buf;
|
||||
uc_buf_len = ((iuconv_obj *)cd)->buf_len;
|
||||
uc_str = &uc_buf;
|
||||
} else {
|
||||
uc_str = (UniChar **)outbuf;
|
||||
uc_buf_len = *outbytesleft;
|
||||
}
|
||||
uc_buf_len = uc_buf_len >> 1;
|
||||
uc_str_len = &uc_buf_len;
|
||||
rc = UniUconvToUcs(uo_fromcode, (void **)inbuf, inbytesleft,
|
||||
uc_str, uc_str_len, &nonIdenticalConv);
|
||||
uc_buf_len = uc_buf_len << 1;
|
||||
if (!uo_tocode)
|
||||
*outbytesleft = uc_buf_len;
|
||||
|
||||
if (rc != ULS_SUCCESS) {
|
||||
errno = EILSEQ;
|
||||
goto done;
|
||||
} else if (*inbytesleft && !*uc_str_len) {
|
||||
errno = E2BIG;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!uo_tocode)
|
||||
return nonIdenticalConv;
|
||||
|
||||
uc_buf = ((iuconv_obj *)cd)->buf;
|
||||
uc_buf_len = ((iuconv_obj *)cd)->buf_len - uc_buf_len;
|
||||
uc_str = &uc_buf;
|
||||
uc_str_len = &uc_buf_len;
|
||||
} else {
|
||||
uc_str = (UniChar **)inbuf;
|
||||
uc_str_len = inbytesleft;
|
||||
}
|
||||
|
||||
*uc_str_len = *uc_str_len>>1;
|
||||
rc = UniUconvFromUcs(uo_tocode, uc_str, uc_str_len, (void **)outbuf,
|
||||
outbytesleft, &nonIdenticalConv);
|
||||
if (rc != ULS_SUCCESS) {
|
||||
switch (rc) {
|
||||
case ULS_BUFFERFULL:
|
||||
errno = E2BIG;
|
||||
break;
|
||||
case ULS_ILLEGALSEQUENCE:
|
||||
errno = EILSEQ;
|
||||
break;
|
||||
case ULS_INVALID:
|
||||
errno = EINVAL;
|
||||
break;
|
||||
}
|
||||
goto done;
|
||||
} else if (*uc_str_len && !*outbytesleft) {
|
||||
errno = E2BIG;
|
||||
goto done;
|
||||
}
|
||||
|
||||
ret = nonIdenticalConv;
|
||||
|
||||
done:
|
||||
|
||||
#ifdef ICONV_THREAD_SAFE
|
||||
DosReleaseMutexSem(((iuconv_obj *)cd)->hMtx);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
int _System os2_iconv_close(iconv_t cd)
|
||||
{
|
||||
if (!cd) return 0;
|
||||
|
||||
#ifdef ICONV_THREAD_SAFE
|
||||
DosCloseMutexSem(((iuconv_obj *)cd)->hMtx);
|
||||
#endif
|
||||
if (((iuconv_obj *)cd)->uo_tocode != NULL)
|
||||
UniFreeUconvObject(((iuconv_obj *)cd)->uo_tocode);
|
||||
if (((iuconv_obj *)cd)->uo_fromcode != NULL)
|
||||
UniFreeUconvObject(((iuconv_obj *)cd)->uo_fromcode);
|
||||
|
||||
if (((iuconv_obj *)cd)->buf != NULL)
|
||||
free(((iuconv_obj *)cd)->buf);
|
||||
|
||||
free(cd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
107
externals/SDL/src/core/os2/geniconv/sys2utf8.c
vendored
Executable file
107
externals/SDL/src/core/os2/geniconv/sys2utf8.c
vendored
Executable file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "geniconv.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
int StrUTF8(int fToUTF8, char *pcDst, int cbDst, char *pcSrc, int cbSrc)
|
||||
{
|
||||
size_t rc;
|
||||
char *pcDstStart = pcDst;
|
||||
iconv_t cd;
|
||||
char *pszToCP, *pszFromCP;
|
||||
int fError = 0;
|
||||
|
||||
if (cbDst < 4)
|
||||
return -1;
|
||||
|
||||
if (fToUTF8) {
|
||||
pszToCP = "UTF-8";
|
||||
pszFromCP = "";
|
||||
} else {
|
||||
pszToCP = "";
|
||||
pszFromCP = "UTF-8";
|
||||
}
|
||||
|
||||
cd = iconv_open(pszToCP, pszFromCP);
|
||||
if (cd == (iconv_t)-1)
|
||||
return -1;
|
||||
|
||||
while (cbSrc > 0) {
|
||||
rc = iconv(cd, &pcSrc, (size_t *)&cbSrc, &pcDst, (size_t *)&cbDst);
|
||||
if (rc == (size_t)-1) {
|
||||
if (errno == EILSEQ) {
|
||||
/* Try to skip invalid character */
|
||||
pcSrc++;
|
||||
cbSrc--;
|
||||
continue;
|
||||
}
|
||||
|
||||
fError = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
iconv_close(cd);
|
||||
|
||||
/* Write trailing ZERO (1 byte for UTF-8, 2 bytes for the system cp) */
|
||||
if (fToUTF8) {
|
||||
if (cbDst < 1) {
|
||||
pcDst--;
|
||||
fError = 1; /* The destination buffer overflow */
|
||||
}
|
||||
*pcDst = '\0';
|
||||
} else {
|
||||
if (cbDst < 2) {
|
||||
pcDst -= (cbDst == 0)? 2 : 1;
|
||||
fError = 1; /* The destination buffer overflow */
|
||||
}
|
||||
*((short *)pcDst) = '\0';
|
||||
}
|
||||
|
||||
return (fError) ? -1 : (pcDst - pcDstStart);
|
||||
}
|
||||
|
||||
char *StrUTF8New(int fToUTF8, char *pcStr, int cbStr)
|
||||
{
|
||||
int cbNewStr = (((cbStr > 4)? cbStr : 4) + 1) * 2;
|
||||
char *pszNewStr = (char *) malloc(cbNewStr);
|
||||
|
||||
if (pszNewStr == NULL)
|
||||
return NULL;
|
||||
|
||||
cbNewStr = StrUTF8(fToUTF8, pszNewStr, cbNewStr, pcStr, cbStr);
|
||||
if (cbNewStr != -1) {
|
||||
pcStr = (char *) realloc(pszNewStr, cbNewStr + ((fToUTF8)? 1 : sizeof(short)));
|
||||
if (pcStr)
|
||||
return pcStr;
|
||||
}
|
||||
|
||||
free(pszNewStr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void StrUTF8Free(char *pszStr)
|
||||
{
|
||||
free(pszStr);
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
69
externals/SDL/src/core/os2/geniconv/test.c
vendored
Executable file
69
externals/SDL/src/core/os2/geniconv/test.c
vendored
Executable file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "geniconv.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char acBuf[128];
|
||||
char *inbuf = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"; /* KOI8-R string */
|
||||
size_t inbytesleft = strlen(inbuf);
|
||||
char *outbuf = acBuf;
|
||||
size_t outbytesleft = sizeof(acBuf);
|
||||
iconv_t ic;
|
||||
|
||||
/* KOI8 -> system cp */
|
||||
ic = iconv_open("", "KOI8-R");
|
||||
if (ic == (iconv_t)(-1)) {
|
||||
puts("iconv_open() fail");
|
||||
return 1;
|
||||
}
|
||||
|
||||
iconv(ic, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
||||
printf("KOI8-R to system cp: %s\n", acBuf);
|
||||
|
||||
iconv_close(ic);
|
||||
|
||||
/* System cp -> UTF-8 -> system cp: */
|
||||
|
||||
/* System cp -> UTF-8 by StrUTF8New() */
|
||||
inbuf = StrUTF8New(1, acBuf, strlen(acBuf));
|
||||
|
||||
/* UTF-8 -> system cp. by StrUTF8() */
|
||||
if (StrUTF8(0, acBuf, sizeof(acBuf), inbuf, strlen(inbuf)) == -1) {
|
||||
puts("StrUTF8() failed");
|
||||
} else {
|
||||
printf("system cp. -> UTF-8 -> system cp.: %s\n", acBuf);
|
||||
}
|
||||
|
||||
free(inbuf);
|
||||
|
||||
/* Unload used DLL */
|
||||
iconv_clean();
|
||||
|
||||
puts("Done.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
1
externals/SDL/src/core/unix/SDL_poll.c
vendored
1
externals/SDL/src/core/unix/SDL_poll.c
vendored
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_poll.h"
|
||||
|
||||
#ifdef HAVE_POLL
|
||||
|
94
externals/SDL/src/core/windows/SDL_hid.c
vendored
Executable file
94
externals/SDL/src/core/windows/SDL_hid.c
vendored
Executable file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#ifndef __WINRT__
|
||||
|
||||
#include "SDL_hid.h"
|
||||
|
||||
|
||||
HidD_GetString_t SDL_HidD_GetManufacturerString;
|
||||
HidD_GetString_t SDL_HidD_GetProductString;
|
||||
HidD_GetPreparsedData_t SDL_HidD_GetPreparsedData;
|
||||
HidD_FreePreparsedData_t SDL_HidD_FreePreparsedData;
|
||||
HidP_GetCaps_t SDL_HidP_GetCaps;
|
||||
HidP_GetButtonCaps_t SDL_HidP_GetButtonCaps;
|
||||
HidP_GetValueCaps_t SDL_HidP_GetValueCaps;
|
||||
HidP_MaxDataListLength_t SDL_HidP_MaxDataListLength;
|
||||
HidP_GetData_t SDL_HidP_GetData;
|
||||
|
||||
static HMODULE s_pHIDDLL = 0;
|
||||
static int s_HIDDLLRefCount = 0;
|
||||
|
||||
|
||||
int
|
||||
WIN_LoadHIDDLL(void)
|
||||
{
|
||||
if (s_pHIDDLL) {
|
||||
SDL_assert(s_HIDDLLRefCount > 0);
|
||||
s_HIDDLLRefCount++;
|
||||
return 0; /* already loaded */
|
||||
}
|
||||
|
||||
s_pHIDDLL = LoadLibrary(L"hid.dll");
|
||||
if (!s_pHIDDLL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
SDL_assert(s_HIDDLLRefCount == 0);
|
||||
s_HIDDLLRefCount = 1;
|
||||
|
||||
SDL_HidD_GetManufacturerString = (HidD_GetString_t)GetProcAddress(s_pHIDDLL, "HidD_GetManufacturerString");
|
||||
SDL_HidD_GetProductString = (HidD_GetString_t)GetProcAddress(s_pHIDDLL, "HidD_GetProductString");
|
||||
SDL_HidD_GetPreparsedData = (HidD_GetPreparsedData_t)GetProcAddress(s_pHIDDLL, "HidD_GetPreparsedData");
|
||||
SDL_HidD_FreePreparsedData = (HidD_FreePreparsedData_t)GetProcAddress(s_pHIDDLL, "HidD_FreePreparsedData");
|
||||
SDL_HidP_GetCaps = (HidP_GetCaps_t)GetProcAddress(s_pHIDDLL, "HidP_GetCaps");
|
||||
SDL_HidP_GetButtonCaps = (HidP_GetButtonCaps_t)GetProcAddress(s_pHIDDLL, "HidP_GetButtonCaps");
|
||||
SDL_HidP_GetValueCaps = (HidP_GetValueCaps_t)GetProcAddress(s_pHIDDLL, "HidP_GetValueCaps");
|
||||
SDL_HidP_MaxDataListLength = (HidP_MaxDataListLength_t)GetProcAddress(s_pHIDDLL, "HidP_MaxDataListLength");
|
||||
SDL_HidP_GetData = (HidP_GetData_t)GetProcAddress(s_pHIDDLL, "HidP_GetData");
|
||||
if (!SDL_HidD_GetManufacturerString || !SDL_HidD_GetProductString || !SDL_HidD_GetPreparsedData ||
|
||||
!SDL_HidD_FreePreparsedData || !SDL_HidP_GetCaps || !SDL_HidP_GetButtonCaps ||
|
||||
!SDL_HidP_GetValueCaps || !SDL_HidP_MaxDataListLength || !SDL_HidP_GetData) {
|
||||
WIN_UnloadHIDDLL();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
WIN_UnloadHIDDLL(void)
|
||||
{
|
||||
if (s_pHIDDLL) {
|
||||
SDL_assert(s_HIDDLLRefCount > 0);
|
||||
if (--s_HIDDLLRefCount == 0) {
|
||||
FreeLibrary(s_pHIDDLL);
|
||||
s_pHIDDLL = NULL;
|
||||
}
|
||||
} else {
|
||||
SDL_assert(s_HIDDLLRefCount == 0);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !__WINRT__ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
208
externals/SDL/src/core/windows/SDL_hid.h
vendored
Executable file
208
externals/SDL/src/core/windows/SDL_hid.h
vendored
Executable file
@@ -0,0 +1,208 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#ifndef SDL_hid_h_
|
||||
#define SDL_hid_h_
|
||||
|
||||
#include "SDL_windows.h"
|
||||
|
||||
#ifndef __WINRT__
|
||||
|
||||
typedef LONG NTSTATUS;
|
||||
typedef USHORT USAGE;
|
||||
typedef struct _HIDP_PREPARSED_DATA *PHIDP_PREPARSED_DATA;
|
||||
|
||||
typedef struct _HIDD_ATTRIBUTES
|
||||
{
|
||||
ULONG Size;
|
||||
USHORT VendorID;
|
||||
USHORT ProductID;
|
||||
USHORT VersionNumber;
|
||||
} HIDD_ATTRIBUTES, *PHIDD_ATTRIBUTES;
|
||||
|
||||
typedef enum {
|
||||
HidP_Input = 0,
|
||||
HidP_Output = 1,
|
||||
HidP_Feature = 2
|
||||
} HIDP_REPORT_TYPE;
|
||||
|
||||
typedef struct {
|
||||
USAGE UsagePage;
|
||||
UCHAR ReportID;
|
||||
BOOLEAN IsAlias;
|
||||
USHORT BitField;
|
||||
USHORT LinkCollection;
|
||||
USAGE LinkUsage;
|
||||
USAGE LinkUsagePage;
|
||||
BOOLEAN IsRange;
|
||||
BOOLEAN IsStringRange;
|
||||
BOOLEAN IsDesignatorRange;
|
||||
BOOLEAN IsAbsolute;
|
||||
ULONG Reserved[ 10 ];
|
||||
union {
|
||||
struct {
|
||||
USAGE UsageMin;
|
||||
USAGE UsageMax;
|
||||
USHORT StringMin;
|
||||
USHORT StringMax;
|
||||
USHORT DesignatorMin;
|
||||
USHORT DesignatorMax;
|
||||
USHORT DataIndexMin;
|
||||
USHORT DataIndexMax;
|
||||
} Range;
|
||||
struct {
|
||||
USAGE Usage;
|
||||
USAGE Reserved1;
|
||||
USHORT StringIndex;
|
||||
USHORT Reserved2;
|
||||
USHORT DesignatorIndex;
|
||||
USHORT Reserved3;
|
||||
USHORT DataIndex;
|
||||
USHORT Reserved4;
|
||||
} NotRange;
|
||||
};
|
||||
} HIDP_BUTTON_CAPS, *PHIDP_BUTTON_CAPS;
|
||||
|
||||
typedef struct {
|
||||
USAGE UsagePage;
|
||||
UCHAR ReportID;
|
||||
BOOLEAN IsAlias;
|
||||
USHORT BitField;
|
||||
USHORT LinkCollection;
|
||||
USAGE LinkUsage;
|
||||
USAGE LinkUsagePage;
|
||||
BOOLEAN IsRange;
|
||||
BOOLEAN IsStringRange;
|
||||
BOOLEAN IsDesignatorRange;
|
||||
BOOLEAN IsAbsolute;
|
||||
BOOLEAN HasNull;
|
||||
UCHAR Reserved;
|
||||
USHORT BitSize;
|
||||
USHORT ReportCount;
|
||||
USHORT Reserved2[ 5 ];
|
||||
ULONG UnitsExp;
|
||||
ULONG Units;
|
||||
LONG LogicalMin;
|
||||
LONG LogicalMax;
|
||||
LONG PhysicalMin;
|
||||
LONG PhysicalMax;
|
||||
union {
|
||||
struct {
|
||||
USAGE UsageMin;
|
||||
USAGE UsageMax;
|
||||
USHORT StringMin;
|
||||
USHORT StringMax;
|
||||
USHORT DesignatorMin;
|
||||
USHORT DesignatorMax;
|
||||
USHORT DataIndexMin;
|
||||
USHORT DataIndexMax;
|
||||
} Range;
|
||||
struct {
|
||||
USAGE Usage;
|
||||
USAGE Reserved1;
|
||||
USHORT StringIndex;
|
||||
USHORT Reserved2;
|
||||
USHORT DesignatorIndex;
|
||||
USHORT Reserved3;
|
||||
USHORT DataIndex;
|
||||
USHORT Reserved4;
|
||||
} NotRange;
|
||||
};
|
||||
} HIDP_VALUE_CAPS, *PHIDP_VALUE_CAPS;
|
||||
|
||||
typedef struct {
|
||||
USAGE Usage;
|
||||
USAGE UsagePage;
|
||||
USHORT InputReportByteLength;
|
||||
USHORT OutputReportByteLength;
|
||||
USHORT FeatureReportByteLength;
|
||||
USHORT Reserved[ 17 ];
|
||||
USHORT NumberLinkCollectionNodes;
|
||||
USHORT NumberInputButtonCaps;
|
||||
USHORT NumberInputValueCaps;
|
||||
USHORT NumberInputDataIndices;
|
||||
USHORT NumberOutputButtonCaps;
|
||||
USHORT NumberOutputValueCaps;
|
||||
USHORT NumberOutputDataIndices;
|
||||
USHORT NumberFeatureButtonCaps;
|
||||
USHORT NumberFeatureValueCaps;
|
||||
USHORT NumberFeatureDataIndices;
|
||||
} HIDP_CAPS, *PHIDP_CAPS;
|
||||
|
||||
typedef struct {
|
||||
USHORT DataIndex;
|
||||
USHORT Reserved;
|
||||
union {
|
||||
ULONG RawValue;
|
||||
BOOLEAN On;
|
||||
};
|
||||
} HIDP_DATA, *PHIDP_DATA;
|
||||
|
||||
#define HIDP_ERROR_CODES( p1, p2 ) ((NTSTATUS)(((p1) << 28) | (0x11 << 16) | (p2)))
|
||||
#define HIDP_STATUS_SUCCESS HIDP_ERROR_CODES( 0x0, 0x0000 )
|
||||
#define HIDP_STATUS_NULL HIDP_ERROR_CODES( 0x8, 0x0001 )
|
||||
#define HIDP_STATUS_INVALID_PREPARSED_DATA HIDP_ERROR_CODES( 0xC, 0x0001 )
|
||||
#define HIDP_STATUS_INVALID_REPORT_TYPE HIDP_ERROR_CODES( 0xC, 0x0002 )
|
||||
#define HIDP_STATUS_INVALID_REPORT_LENGTH HIDP_ERROR_CODES( 0xC, 0x0003 )
|
||||
#define HIDP_STATUS_USAGE_NOT_FOUND HIDP_ERROR_CODES( 0xC, 0x0004 )
|
||||
#define HIDP_STATUS_VALUE_OUT_OF_RANGE HIDP_ERROR_CODES( 0xC, 0x0005 )
|
||||
#define HIDP_STATUS_BAD_LOG_PHY_VALUES HIDP_ERROR_CODES( 0xC, 0x0006 )
|
||||
#define HIDP_STATUS_BUFFER_TOO_SMALL HIDP_ERROR_CODES( 0xC, 0x0007 )
|
||||
#define HIDP_STATUS_INTERNAL_ERROR HIDP_ERROR_CODES( 0xC, 0x0008 )
|
||||
#define HIDP_STATUS_I8042_TRANS_UNKNOWN HIDP_ERROR_CODES( 0xC, 0x0009 )
|
||||
#define HIDP_STATUS_INCOMPATIBLE_REPORT_ID HIDP_ERROR_CODES( 0xC, 0x000A )
|
||||
#define HIDP_STATUS_NOT_VALUE_ARRAY HIDP_ERROR_CODES( 0xC, 0x000B )
|
||||
#define HIDP_STATUS_IS_VALUE_ARRAY HIDP_ERROR_CODES( 0xC, 0x000C )
|
||||
#define HIDP_STATUS_DATA_INDEX_NOT_FOUND HIDP_ERROR_CODES( 0xC, 0x000D )
|
||||
#define HIDP_STATUS_DATA_INDEX_OUT_OF_RANGE HIDP_ERROR_CODES( 0xC, 0x000E )
|
||||
#define HIDP_STATUS_BUTTON_NOT_PRESSED HIDP_ERROR_CODES( 0xC, 0x000F )
|
||||
#define HIDP_STATUS_REPORT_DOES_NOT_EXIST HIDP_ERROR_CODES( 0xC, 0x0010 )
|
||||
#define HIDP_STATUS_NOT_IMPLEMENTED HIDP_ERROR_CODES( 0xC, 0x0020 )
|
||||
|
||||
|
||||
extern int WIN_LoadHIDDLL(void);
|
||||
extern void WIN_UnloadHIDDLL(void);
|
||||
|
||||
typedef BOOLEAN (WINAPI *HidD_GetString_t)(HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength);
|
||||
typedef BOOLEAN (WINAPI *HidD_GetPreparsedData_t)(HANDLE HidDeviceObject, PHIDP_PREPARSED_DATA *PreparsedData);
|
||||
typedef BOOLEAN (WINAPI *HidD_FreePreparsedData_t)(PHIDP_PREPARSED_DATA PreparsedData);
|
||||
typedef NTSTATUS (WINAPI *HidP_GetCaps_t)(PHIDP_PREPARSED_DATA PreparsedData, PHIDP_CAPS Capabilities);
|
||||
typedef NTSTATUS (WINAPI *HidP_GetButtonCaps_t)(HIDP_REPORT_TYPE ReportType, PHIDP_BUTTON_CAPS ButtonCaps, PUSHORT ButtonCapsLength, PHIDP_PREPARSED_DATA PreparsedData);
|
||||
typedef NTSTATUS (WINAPI *HidP_GetValueCaps_t)(HIDP_REPORT_TYPE ReportType, PHIDP_VALUE_CAPS ValueCaps, PUSHORT ValueCapsLength, PHIDP_PREPARSED_DATA PreparsedData);
|
||||
typedef ULONG (WINAPI *HidP_MaxDataListLength_t)(HIDP_REPORT_TYPE ReportType, PHIDP_PREPARSED_DATA PreparsedData);
|
||||
typedef NTSTATUS (WINAPI *HidP_GetData_t)(HIDP_REPORT_TYPE ReportType, PHIDP_DATA DataList, PULONG DataLength, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
|
||||
|
||||
extern HidD_GetString_t SDL_HidD_GetManufacturerString;
|
||||
extern HidD_GetString_t SDL_HidD_GetProductString;
|
||||
extern HidD_GetPreparsedData_t SDL_HidD_GetPreparsedData;
|
||||
extern HidD_FreePreparsedData_t SDL_HidD_FreePreparsedData;
|
||||
extern HidP_GetCaps_t SDL_HidP_GetCaps;
|
||||
extern HidP_GetButtonCaps_t SDL_HidP_GetButtonCaps;
|
||||
extern HidP_GetValueCaps_t SDL_HidP_GetValueCaps;
|
||||
extern HidP_MaxDataListLength_t SDL_HidP_MaxDataListLength;
|
||||
extern HidP_GetData_t SDL_HidP_GetData;
|
||||
|
||||
#endif /* !__WINRT__ */
|
||||
|
||||
#endif /* SDL_hid_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
1
externals/SDL/src/core/windows/SDL_windows.c
vendored
1
externals/SDL/src/core/windows/SDL_windows.c
vendored
@@ -24,7 +24,6 @@
|
||||
|
||||
#include "SDL_windows.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_assert.h"
|
||||
|
||||
#include <objbase.h> /* for CoInitialize/CoUninitialize (Win32 only) */
|
||||
|
||||
|
5
externals/SDL/src/core/windows/SDL_xinput.c
vendored
5
externals/SDL/src/core/windows/SDL_xinput.c
vendored
@@ -20,7 +20,6 @@
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_xinput.h"
|
||||
|
||||
|
||||
@@ -82,6 +81,10 @@ WIN_LoadXInputDLL(void)
|
||||
return 0; /* already loaded */
|
||||
}
|
||||
|
||||
/* NOTE: Don't load XinputUap.dll
|
||||
* This is XInput emulation over Windows.Gaming.Input, and has all the
|
||||
* limitations of that API (no devices at startup, no background input, etc.)
|
||||
*/
|
||||
version = (1 << 16) | 4;
|
||||
s_pXInputDLL = LoadLibrary(L"XInput1_4.dll"); /* 1.4 Ships with Windows 8. */
|
||||
if (!s_pXInputDLL) {
|
||||
|
@@ -47,10 +47,8 @@ using namespace Windows::Phone::UI::Input;
|
||||
|
||||
/* SDL includes */
|
||||
extern "C" {
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_hints.h"
|
||||
#include "SDL_log.h"
|
||||
#include "SDL_main.h"
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_render.h"
|
||||
|
76
externals/SDL/src/cpuinfo/SDL_cpuinfo.c
vendored
76
externals/SDL/src/cpuinfo/SDL_cpuinfo.c
vendored
@@ -28,6 +28,7 @@
|
||||
#include "../core/windows/SDL_windows.h"
|
||||
#endif
|
||||
#if defined(__OS2__)
|
||||
#undef HAVE_SYSCTLBYNAME
|
||||
#define INCL_DOS
|
||||
#include <os2.h>
|
||||
#ifndef QSV_NUMPROCESSORS
|
||||
@@ -49,7 +50,7 @@
|
||||
#endif
|
||||
#if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))
|
||||
#include <sys/sysctl.h> /* For AltiVec check */
|
||||
#elif defined(__OpenBSD__) && defined(__powerpc__)
|
||||
#elif (defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(__powerpc__)
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h> /* For AltiVec check */
|
||||
#include <machine/cpu.h>
|
||||
@@ -90,6 +91,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_ELF_AUX_INFO)
|
||||
#include <sys/auxv.h>
|
||||
#endif
|
||||
|
||||
#ifdef __RISCOS__
|
||||
#include <kernel.h>
|
||||
#include <swis.h>
|
||||
@@ -314,9 +319,11 @@ CPU_haveAltiVec(void)
|
||||
{
|
||||
volatile int altivec = 0;
|
||||
#ifndef SDL_CPUINFO_DISABLED
|
||||
#if (defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))) || (defined(__OpenBSD__) && defined(__powerpc__))
|
||||
#if (defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))) || (defined(__OpenBSD__) && defined(__powerpc__)) || (defined(__FreeBSD__) && defined(__powerpc__))
|
||||
#ifdef __OpenBSD__
|
||||
int selectors[2] = { CTL_MACHDEP, CPU_ALTIVEC };
|
||||
#elif defined(__FreeBSD__)
|
||||
int selectors[2] = { CTL_HW, PPC_FEATURE_HAS_ALTIVEC };
|
||||
#else
|
||||
int selectors[2] = { CTL_HW, HW_VECTORUNIT };
|
||||
#endif
|
||||
@@ -457,6 +464,13 @@ CPU_haveNEON(void)
|
||||
return 1; /* all Apple ARMv7 chips and later have NEON. */
|
||||
#elif defined(__APPLE__)
|
||||
return 0; /* assume anything else from Apple doesn't have NEON. */
|
||||
#elif defined(__OpenBSD__)
|
||||
return 1; /* OpenBSD only supports ARMv7 CPUs that have NEON. */
|
||||
#elif defined(HAVE_ELF_AUX_INFO) && defined(HWCAP_NEON)
|
||||
unsigned long hasneon = 0;
|
||||
if (elf_aux_info(AT_HWCAP, (void *)&hasneon, (int)sizeof(hasneon)) != 0)
|
||||
return 0;
|
||||
return ((hasneon & HWCAP_NEON) == HWCAP_NEON);
|
||||
#elif !defined(__arm__)
|
||||
return 0; /* not an ARM CPU at all. */
|
||||
#elif defined(__QNXNTO__)
|
||||
@@ -481,7 +495,7 @@ CPU_haveNEON(void)
|
||||
/* Use the VFPSupport_Features SWI to access the MVFR registers */
|
||||
{
|
||||
_kernel_swi_regs regs;
|
||||
regs.r[0] = 0;
|
||||
regs.r[0] = 0;
|
||||
if (_kernel_swi(VFPSupport_Features, ®s, ®s) == NULL) {
|
||||
if ((regs.r[2] & 0xFFF000) == 0x111000) {
|
||||
return 1;
|
||||
@@ -700,7 +714,7 @@ SDL_GetCPUCacheLineSize(void)
|
||||
const char *cpuType = SDL_GetCPUType();
|
||||
int a, b, c, d;
|
||||
(void) a; (void) b; (void) c; (void) d;
|
||||
if (SDL_strcmp(cpuType, "GenuineIntel") == 0) {
|
||||
if (SDL_strcmp(cpuType, "GenuineIntel") == 0 || SDL_strcmp(cpuType, "CentaurHauls") == 0 || SDL_strcmp(cpuType, " Shanghai ") == 0) {
|
||||
cpuid(0x00000001, a, b, c, d);
|
||||
return (((b >> 8) & 0xff) * 8);
|
||||
} else if (SDL_strcmp(cpuType, "AuthenticAMD") == 0 || SDL_strcmp(cpuType, "HygonGenuine") == 0) {
|
||||
@@ -880,7 +894,7 @@ SDL_GetSystemRAM(void)
|
||||
#endif
|
||||
#ifdef HAVE_SYSCTLBYNAME
|
||||
if (SDL_SystemRAM <= 0) {
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__DragonFly__)
|
||||
#ifdef HW_REALMEM
|
||||
int mib[2] = {CTL_HW, HW_REALMEM};
|
||||
#else
|
||||
@@ -956,6 +970,58 @@ SDL_SIMDAlloc(const size_t len)
|
||||
return retval;
|
||||
}
|
||||
|
||||
void *
|
||||
SDL_SIMDRealloc(void *mem, const size_t len)
|
||||
{
|
||||
const size_t alignment = SDL_SIMDGetAlignment();
|
||||
const size_t padding = alignment - (len % alignment);
|
||||
const size_t padded = (padding != alignment) ? (len + padding) : len;
|
||||
Uint8 *retval = (Uint8*) mem;
|
||||
void *oldmem = mem;
|
||||
size_t memdiff = 0, ptrdiff;
|
||||
Uint8 *ptr;
|
||||
|
||||
if (mem) {
|
||||
void **realptr = (void **) mem;
|
||||
realptr--;
|
||||
mem = *(((void **) mem) - 1);
|
||||
|
||||
/* Check the delta between the real pointer and user pointer */
|
||||
memdiff = ((size_t) oldmem) - ((size_t) mem);
|
||||
}
|
||||
|
||||
ptr = (Uint8 *) SDL_realloc(mem, padded + alignment + sizeof (void *));
|
||||
|
||||
if (ptr == mem) {
|
||||
return retval; /* Pointer didn't change, nothing to do */
|
||||
}
|
||||
if (ptr == NULL) {
|
||||
return NULL; /* Out of memory, bail! */
|
||||
}
|
||||
|
||||
/* Store the actual malloc pointer right before our aligned pointer. */
|
||||
retval = ptr + sizeof (void *);
|
||||
retval += alignment - (((size_t) retval) % alignment);
|
||||
|
||||
/* Make sure the delta is the same! */
|
||||
if (mem) {
|
||||
ptrdiff = ((size_t) retval) - ((size_t) ptr);
|
||||
if (memdiff != ptrdiff) { /* Delta has changed, copy to new offset! */
|
||||
oldmem = (void*) (((size_t) ptr) + memdiff);
|
||||
|
||||
/* Even though the data past the old `len` is undefined, this is the
|
||||
* only length value we have, and it guarantees that we copy all the
|
||||
* previous memory anyhow.
|
||||
*/
|
||||
SDL_memmove(retval, oldmem, len);
|
||||
}
|
||||
}
|
||||
|
||||
/* Actually store the malloc pointer, finally. */
|
||||
*(((void **) retval) - 1) = ptr;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void
|
||||
SDL_SIMDFree(void *ptr)
|
||||
{
|
||||
|
39
externals/SDL/src/dynapi/SDL_dynapi_overrides.h
vendored
39
externals/SDL/src/dynapi/SDL_dynapi_overrides.h
vendored
@@ -749,3 +749,42 @@
|
||||
#define SDL_GetAndroidSDKVersion SDL_GetAndroidSDKVersion_REAL
|
||||
#define SDL_isupper SDL_isupper_REAL
|
||||
#define SDL_islower SDL_islower_REAL
|
||||
#define SDL_JoystickAttachVirtual SDL_JoystickAttachVirtual_REAL
|
||||
#define SDL_JoystickDetachVirtual SDL_JoystickDetachVirtual_REAL
|
||||
#define SDL_JoystickIsVirtual SDL_JoystickIsVirtual_REAL
|
||||
#define SDL_JoystickSetVirtualAxis SDL_JoystickSetVirtualAxis_REAL
|
||||
#define SDL_JoystickSetVirtualBall SDL_JoystickSetVirtualBall_REAL
|
||||
#define SDL_JoystickSetVirtualButton SDL_JoystickSetVirtualButton_REAL
|
||||
#define SDL_JoystickSetVirtualHat SDL_JoystickSetVirtualHat_REAL
|
||||
#define SDL_GetErrorMsg SDL_GetErrorMsg_REAL
|
||||
#define SDL_LockSensors SDL_LockSensors_REAL
|
||||
#define SDL_UnlockSensors SDL_UnlockSensors_REAL
|
||||
#define SDL_Metal_GetLayer SDL_Metal_GetLayer_REAL
|
||||
#define SDL_Metal_GetDrawableSize SDL_Metal_GetDrawableSize_REAL
|
||||
#define SDL_trunc SDL_trunc_REAL
|
||||
#define SDL_truncf SDL_truncf_REAL
|
||||
#define SDL_GetPreferredLocales SDL_GetPreferredLocales_REAL
|
||||
#define SDL_SIMDRealloc SDL_SIMDRealloc_REAL
|
||||
#define SDL_AndroidRequestPermission SDL_AndroidRequestPermission_REAL
|
||||
#define SDL_OpenURL SDL_OpenURL_REAL
|
||||
#define SDL_HasSurfaceRLE SDL_HasSurfaceRLE_REAL
|
||||
#define SDL_GameControllerHasLED SDL_GameControllerHasLED_REAL
|
||||
#define SDL_GameControllerSetLED SDL_GameControllerSetLED_REAL
|
||||
#define SDL_JoystickHasLED SDL_JoystickHasLED_REAL
|
||||
#define SDL_JoystickSetLED SDL_JoystickSetLED_REAL
|
||||
#define SDL_GameControllerRumbleTriggers SDL_GameControllerRumbleTriggers_REAL
|
||||
#define SDL_JoystickRumbleTriggers SDL_JoystickRumbleTriggers_REAL
|
||||
#define SDL_GameControllerHasAxis SDL_GameControllerHasAxis_REAL
|
||||
#define SDL_GameControllerHasButton SDL_GameControllerHasButton_REAL
|
||||
#define SDL_GameControllerGetNumTouchpads SDL_GameControllerGetNumTouchpads_REAL
|
||||
#define SDL_GameControllerGetNumTouchpadFingers SDL_GameControllerGetNumTouchpadFingers_REAL
|
||||
#define SDL_GameControllerGetTouchpadFinger SDL_GameControllerGetTouchpadFinger_REAL
|
||||
#define SDL_crc32 SDL_crc32_REAL
|
||||
#define SDL_GameControllerGetSerial SDL_GameControllerGetSerial_REAL
|
||||
#define SDL_JoystickGetSerial SDL_JoystickGetSerial_REAL
|
||||
#define SDL_GameControllerHasSensor SDL_GameControllerHasSensor_REAL
|
||||
#define SDL_GameControllerSetSensorEnabled SDL_GameControllerSetSensorEnabled_REAL
|
||||
#define SDL_GameControllerIsSensorEnabled SDL_GameControllerIsSensorEnabled_REAL
|
||||
#define SDL_GameControllerGetSensorData SDL_GameControllerGetSensorData_REAL
|
||||
#define SDL_wcscasecmp SDL_wcscasecmp_REAL
|
||||
#define SDL_wcsncasecmp SDL_wcsncasecmp_REAL
|
||||
|
40
externals/SDL/src/dynapi/SDL_dynapi_procs.h
vendored
40
externals/SDL/src/dynapi/SDL_dynapi_procs.h
vendored
@@ -809,3 +809,43 @@ SDL_DYNAPI_PROC(int,SDL_GetAndroidSDKVersion,(void),(),return)
|
||||
#endif
|
||||
SDL_DYNAPI_PROC(int,SDL_isupper,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_islower,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_JoystickAttachVirtual,(SDL_JoystickType a, int b, int c, int d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_JoystickDetachVirtual,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickIsVirtual,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_JoystickSetVirtualAxis,(SDL_Joystick *a, int b, Sint16 c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_JoystickSetVirtualButton,(SDL_Joystick *a, int b, Uint8 c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_JoystickSetVirtualHat,(SDL_Joystick *a, int b, Uint8 c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(char*,SDL_GetErrorMsg,(char *a, int b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_LockSensors,(void),(),)
|
||||
SDL_DYNAPI_PROC(void,SDL_UnlockSensors,(void),(),)
|
||||
SDL_DYNAPI_PROC(void*,SDL_Metal_GetLayer,(SDL_MetalView a),(a),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_Metal_GetDrawableSize,(SDL_Window *a, int *b, int *c),(a,b,c),)
|
||||
SDL_DYNAPI_PROC(double,SDL_trunc,(double a),(a),return)
|
||||
SDL_DYNAPI_PROC(float,SDL_truncf,(float a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Locale *,SDL_GetPreferredLocales,(void),(),return)
|
||||
SDL_DYNAPI_PROC(void*,SDL_SIMDRealloc,(void *a, const size_t b),(a, b),return)
|
||||
#ifdef __ANDROID__
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_AndroidRequestPermission,(const char *a),(a),return)
|
||||
#endif
|
||||
SDL_DYNAPI_PROC(int,SDL_OpenURL,(const char *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_HasSurfaceRLE,(SDL_Surface *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GameControllerHasLED,(SDL_GameController *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GameControllerSetLED,(SDL_GameController *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickHasLED,(SDL_Joystick *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_JoystickSetLED,(SDL_Joystick *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GameControllerRumbleTriggers,(SDL_GameController *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_JoystickRumbleTriggers,(SDL_Joystick *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GameControllerHasAxis,(SDL_GameController *a, SDL_GameControllerAxis b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GameControllerHasButton,(SDL_GameController *a, SDL_GameControllerButton b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GameControllerGetNumTouchpads,(SDL_GameController *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GameControllerGetNumTouchpadFingers,(SDL_GameController *a, int b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GameControllerGetTouchpadFinger,(SDL_GameController *a, int b, int c, Uint8 *d, float *e, float *f, float *g),(a,b,c,d,e,f,g),return)
|
||||
SDL_DYNAPI_PROC(Uint32,SDL_crc32,(Uint32 a, const void *b, size_t c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GameControllerGetSerial,(SDL_GameController *a),(a),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_JoystickGetSerial,(SDL_Joystick *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GameControllerHasSensor,(SDL_GameController *a, SDL_SensorType b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GameControllerSetSensorEnabled,(SDL_GameController *a, SDL_SensorType b, SDL_bool c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GameControllerIsSensorEnabled,(SDL_GameController *a, SDL_SensorType b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GameControllerGetSensorData,(SDL_GameController *a, SDL_SensorType b, float *c, int d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_wcscasecmp,(const wchar_t *a, const wchar_t *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_wcsncasecmp,(const wchar_t *a, const wchar_t *b, size_t c),(a,b,c),return)
|
||||
|
89
externals/SDL/src/events/SDL_events.c
vendored
89
externals/SDL/src/events/SDL_events.c
vendored
@@ -35,9 +35,9 @@
|
||||
|
||||
#undef SDL_PRIs64
|
||||
#ifdef __WIN32__
|
||||
#define SDL_PRIs64 "I64d"
|
||||
#define SDL_PRIs64 "I64d"
|
||||
#else
|
||||
#define SDL_PRIs64 "lld"
|
||||
#define SDL_PRIs64 "lld"
|
||||
#endif
|
||||
|
||||
/* An arbitrary limit so we don't have unbounded growth */
|
||||
@@ -92,6 +92,54 @@ static struct
|
||||
} SDL_EventQ = { NULL, { 1 }, { 0 }, 0, NULL, NULL, NULL, NULL, NULL };
|
||||
|
||||
|
||||
#if !SDL_JOYSTICK_DISABLED
|
||||
|
||||
static SDL_bool SDL_update_joysticks = SDL_TRUE;
|
||||
|
||||
static void
|
||||
SDL_CalculateShouldUpdateJoysticks()
|
||||
{
|
||||
if (SDL_GetHintBoolean(SDL_HINT_AUTO_UPDATE_JOYSTICKS, SDL_TRUE) &&
|
||||
(!SDL_disabled_events[SDL_JOYAXISMOTION >> 8] || SDL_JoystickEventState(SDL_QUERY))) {
|
||||
SDL_update_joysticks = SDL_TRUE;
|
||||
} else {
|
||||
SDL_update_joysticks = SDL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void SDLCALL
|
||||
SDL_AutoUpdateJoysticksChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
|
||||
{
|
||||
SDL_CalculateShouldUpdateJoysticks();
|
||||
}
|
||||
|
||||
#endif /* !SDL_JOYSTICK_DISABLED */
|
||||
|
||||
|
||||
#if !SDL_SENSOR_DISABLED
|
||||
|
||||
static SDL_bool SDL_update_sensors = SDL_TRUE;
|
||||
|
||||
static void
|
||||
SDL_CalculateShouldUpdateSensors()
|
||||
{
|
||||
if (SDL_GetHintBoolean(SDL_HINT_AUTO_UPDATE_SENSORS, SDL_TRUE) &&
|
||||
!SDL_disabled_events[SDL_SENSORUPDATE >> 8]) {
|
||||
SDL_update_sensors = SDL_TRUE;
|
||||
} else {
|
||||
SDL_update_sensors = SDL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void SDLCALL
|
||||
SDL_AutoUpdateSensorsChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
|
||||
{
|
||||
SDL_CalculateShouldUpdateSensors();
|
||||
}
|
||||
|
||||
#endif /* !SDL_SENSOR_DISABLED */
|
||||
|
||||
|
||||
/* 0 (default) means no logging, 1 means logging, 2 means logging with mouse and finger motion */
|
||||
static int SDL_DoEventLogging = 0;
|
||||
|
||||
@@ -678,20 +726,24 @@ SDL_PumpEvents(void)
|
||||
{
|
||||
SDL_VideoDevice *_this = SDL_GetVideoDevice();
|
||||
|
||||
/* Release any keys held down from last frame */
|
||||
SDL_ReleaseAutoReleaseKeys();
|
||||
|
||||
/* Get events from the video subsystem */
|
||||
if (_this) {
|
||||
_this->PumpEvents(_this);
|
||||
}
|
||||
|
||||
#if !SDL_JOYSTICK_DISABLED
|
||||
/* Check for joystick state change */
|
||||
if ((!SDL_disabled_events[SDL_JOYAXISMOTION >> 8] || SDL_JoystickEventState(SDL_QUERY))) {
|
||||
if (SDL_update_joysticks) {
|
||||
SDL_JoystickUpdate();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !SDL_SENSOR_DISABLED
|
||||
/* Check for sensor state change */
|
||||
if (!SDL_disabled_events[SDL_SENSORUPDATE >> 8]) {
|
||||
if (SDL_update_sensors) {
|
||||
SDL_SensorUpdate();
|
||||
}
|
||||
#endif
|
||||
@@ -943,6 +995,17 @@ SDL_EventState(Uint32 type, int state)
|
||||
/* Querying state... */
|
||||
break;
|
||||
}
|
||||
|
||||
#if !SDL_JOYSTICK_DISABLED
|
||||
if (state == SDL_DISABLE || state == SDL_ENABLE) {
|
||||
SDL_CalculateShouldUpdateJoysticks();
|
||||
}
|
||||
#endif
|
||||
#if !SDL_SENSOR_DISABLED
|
||||
if (state == SDL_DISABLE || state == SDL_ENABLE) {
|
||||
SDL_CalculateShouldUpdateSensors();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* turn off drag'n'drop support if we've disabled the events.
|
||||
@@ -1005,9 +1068,21 @@ SDL_SendKeymapChangedEvent(void)
|
||||
return SDL_SendAppEvent(SDL_KEYMAPCHANGED);
|
||||
}
|
||||
|
||||
int
|
||||
SDL_SendLocaleChangedEvent(void)
|
||||
{
|
||||
return SDL_SendAppEvent(SDL_LOCALECHANGED);
|
||||
}
|
||||
|
||||
int
|
||||
SDL_EventsInit(void)
|
||||
{
|
||||
#if !SDL_JOYSTICK_DISABLED
|
||||
SDL_AddHintCallback(SDL_HINT_AUTO_UPDATE_JOYSTICKS, SDL_AutoUpdateJoysticksChanged, NULL);
|
||||
#endif
|
||||
#if !SDL_SENSOR_DISABLED
|
||||
SDL_AddHintCallback(SDL_HINT_AUTO_UPDATE_SENSORS, SDL_AutoUpdateSensorsChanged, NULL);
|
||||
#endif
|
||||
SDL_AddHintCallback(SDL_HINT_EVENT_LOGGING, SDL_EventLoggingChanged, NULL);
|
||||
if (SDL_StartEventLoop() < 0) {
|
||||
SDL_DelHintCallback(SDL_HINT_EVENT_LOGGING, SDL_EventLoggingChanged, NULL);
|
||||
@@ -1025,6 +1100,12 @@ SDL_EventsQuit(void)
|
||||
SDL_QuitQuit();
|
||||
SDL_StopEventLoop();
|
||||
SDL_DelHintCallback(SDL_HINT_EVENT_LOGGING, SDL_EventLoggingChanged, NULL);
|
||||
#if !SDL_JOYSTICK_DISABLED
|
||||
SDL_DelHintCallback(SDL_HINT_AUTO_UPDATE_JOYSTICKS, SDL_AutoUpdateJoysticksChanged, NULL);
|
||||
#endif
|
||||
#if !SDL_SENSOR_DISABLED
|
||||
SDL_DelHintCallback(SDL_HINT_AUTO_UPDATE_SENSORS, SDL_AutoUpdateSensorsChanged, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
1
externals/SDL/src/events/SDL_events_c.h
vendored
1
externals/SDL/src/events/SDL_events_c.h
vendored
@@ -46,6 +46,7 @@ extern void SDL_QuitInterrupt(void);
|
||||
extern int SDL_SendAppEvent(SDL_EventType eventType);
|
||||
extern int SDL_SendSysWMEvent(SDL_SysWMmsg * message);
|
||||
extern int SDL_SendKeymapChangedEvent(void);
|
||||
extern int SDL_SendLocaleChangedEvent(void);
|
||||
|
||||
extern int SDL_SendQuit(void);
|
||||
|
||||
|
81
externals/SDL/src/events/SDL_keyboard.c
vendored
81
externals/SDL/src/events/SDL_keyboard.c
vendored
@@ -25,7 +25,6 @@
|
||||
#include "SDL_timer.h"
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_events_c.h"
|
||||
#include "SDL_assert.h"
|
||||
#include "../video/SDL_sysvideo.h"
|
||||
|
||||
|
||||
@@ -33,6 +32,9 @@
|
||||
|
||||
/* Global keyboard information */
|
||||
|
||||
#define KEYBOARD_HARDWARE 0x01
|
||||
#define KEYBOARD_AUTORELEASE 0x02
|
||||
|
||||
typedef struct SDL_Keyboard SDL_Keyboard;
|
||||
|
||||
struct SDL_Keyboard
|
||||
@@ -40,8 +42,10 @@ struct SDL_Keyboard
|
||||
/* Data common to all keyboards */
|
||||
SDL_Window *focus;
|
||||
Uint16 modstate;
|
||||
Uint8 keysource[SDL_NUM_SCANCODES];
|
||||
Uint8 keystate[SDL_NUM_SCANCODES];
|
||||
SDL_Keycode keymap[SDL_NUM_SCANCODES];
|
||||
SDL_bool autorelease_pending;
|
||||
};
|
||||
|
||||
static SDL_Keyboard SDL_keyboard;
|
||||
@@ -675,19 +679,20 @@ SDL_SetKeyboardFocus(SDL_Window * window)
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
|
||||
static int
|
||||
SDL_SendKeyboardKeyInternal(Uint8 source, Uint8 state, SDL_Scancode scancode)
|
||||
{
|
||||
SDL_Keyboard *keyboard = &SDL_keyboard;
|
||||
int posted;
|
||||
SDL_Keymod modifier;
|
||||
SDL_Keycode keycode;
|
||||
Uint32 type;
|
||||
Uint8 repeat;
|
||||
Uint8 repeat = SDL_FALSE;
|
||||
|
||||
if (!scancode) {
|
||||
if (scancode == SDL_SCANCODE_UNKNOWN) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_KEYBOARD
|
||||
printf("The '%s' key has been %s\n", SDL_GetScancodeName(scancode),
|
||||
state == SDL_PRESSED ? "pressed" : "released");
|
||||
@@ -707,12 +712,20 @@ SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
|
||||
}
|
||||
|
||||
/* Drop events that don't change state */
|
||||
repeat = (state && keyboard->keystate[scancode]);
|
||||
if (keyboard->keystate[scancode] == state && !repeat) {
|
||||
#if 0
|
||||
printf("Keyboard event didn't change state - dropped!\n");
|
||||
#endif
|
||||
return 0;
|
||||
if (state) {
|
||||
if (keyboard->keystate[scancode]) {
|
||||
if (!(keyboard->keysource[scancode] & source)) {
|
||||
keyboard->keysource[scancode] |= source;
|
||||
return 0;
|
||||
}
|
||||
repeat = SDL_TRUE;
|
||||
}
|
||||
keyboard->keysource[scancode] |= source;
|
||||
} else {
|
||||
if (!keyboard->keystate[scancode]) {
|
||||
return 0;
|
||||
}
|
||||
keyboard->keysource[scancode] = 0;
|
||||
}
|
||||
|
||||
/* Update internal keyboard state */
|
||||
@@ -720,6 +733,10 @@ SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
|
||||
|
||||
keycode = keyboard->keymap[scancode];
|
||||
|
||||
if (source == KEYBOARD_AUTORELEASE) {
|
||||
keyboard->autorelease_pending = SDL_TRUE;
|
||||
}
|
||||
|
||||
/* Update modifiers state if applicable */
|
||||
switch (keycode) {
|
||||
case SDLK_LCTRL:
|
||||
@@ -785,6 +802,48 @@ SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
|
||||
return (posted);
|
||||
}
|
||||
|
||||
int
|
||||
SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
|
||||
{
|
||||
return SDL_SendKeyboardKeyInternal(KEYBOARD_HARDWARE, state, scancode);
|
||||
}
|
||||
|
||||
int
|
||||
SDL_SendKeyboardKeyAutoRelease(SDL_Scancode scancode)
|
||||
{
|
||||
return SDL_SendKeyboardKeyInternal(KEYBOARD_AUTORELEASE, SDL_PRESSED, scancode);
|
||||
}
|
||||
|
||||
void
|
||||
SDL_ReleaseAutoReleaseKeys(void)
|
||||
{
|
||||
SDL_Keyboard *keyboard = &SDL_keyboard;
|
||||
SDL_Scancode scancode;
|
||||
|
||||
if (keyboard->autorelease_pending) {
|
||||
for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_NUM_SCANCODES; ++scancode) {
|
||||
if (keyboard->keysource[scancode] == KEYBOARD_AUTORELEASE) {
|
||||
SDL_SendKeyboardKeyInternal(KEYBOARD_AUTORELEASE, SDL_RELEASED, scancode);
|
||||
}
|
||||
}
|
||||
keyboard->autorelease_pending = SDL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_HardwareKeyboardKeyPressed(void)
|
||||
{
|
||||
SDL_Keyboard *keyboard = &SDL_keyboard;
|
||||
SDL_Scancode scancode;
|
||||
|
||||
for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_NUM_SCANCODES; ++scancode) {
|
||||
if ((keyboard->keysource[scancode] & KEYBOARD_HARDWARE) != 0) {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
}
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
SDL_SendKeyboardText(const char *text)
|
||||
{
|
||||
|
7
externals/SDL/src/events/SDL_keyboard_c.h
vendored
7
externals/SDL/src/events/SDL_keyboard_c.h
vendored
@@ -49,6 +49,13 @@ extern void SDL_SetKeyboardFocus(SDL_Window * window);
|
||||
|
||||
/* Send a keyboard key event */
|
||||
extern int SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode);
|
||||
extern int SDL_SendKeyboardKeyAutoRelease(SDL_Scancode scancode);
|
||||
|
||||
/* Release all the autorelease keys */
|
||||
extern void SDL_ReleaseAutoReleaseKeys(void);
|
||||
|
||||
/* Return true if any hardware key is pressed */
|
||||
extern SDL_bool SDL_HardwareKeyboardKeyPressed(void);
|
||||
|
||||
/* Send keyboard text input */
|
||||
extern int SDL_SendKeyboardText(const char *text);
|
||||
|
38
externals/SDL/src/events/SDL_mouse.c
vendored
38
externals/SDL/src/events/SDL_mouse.c
vendored
@@ -22,7 +22,6 @@
|
||||
|
||||
/* General mouse handling code for SDL */
|
||||
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_hints.h"
|
||||
#include "SDL_timer.h"
|
||||
#include "SDL_events.h"
|
||||
@@ -32,6 +31,10 @@
|
||||
#ifdef __WIN32__
|
||||
#include "../core/windows/SDL_windows.h" // For GetDoubleClickTime()
|
||||
#endif
|
||||
#if defined(__OS2__)
|
||||
#define INCL_WIN
|
||||
#include <os2.h>
|
||||
#endif
|
||||
|
||||
/* #define DEBUG_MOUSE */
|
||||
|
||||
@@ -54,6 +57,8 @@ SDL_MouseDoubleClickTimeChanged(void *userdata, const char *name, const char *ol
|
||||
} else {
|
||||
#ifdef __WIN32__
|
||||
mouse->double_click_time = GetDoubleClickTime();
|
||||
#elif defined(__OS2__)
|
||||
mouse->double_click_time = WinQuerySysValue(HWND_DESKTOP, SV_DBLCLKTIME);
|
||||
#else
|
||||
mouse->double_click_time = 500;
|
||||
#endif
|
||||
@@ -722,23 +727,24 @@ Uint32
|
||||
SDL_GetGlobalMouseState(int *x, int *y)
|
||||
{
|
||||
SDL_Mouse *mouse = SDL_GetMouse();
|
||||
int tmpx, tmpy;
|
||||
|
||||
/* make sure these are never NULL for the backend implementations... */
|
||||
if (!x) {
|
||||
x = &tmpx;
|
||||
if (mouse->GetGlobalMouseState) {
|
||||
int tmpx, tmpy;
|
||||
|
||||
/* make sure these are never NULL for the backend implementations... */
|
||||
if (!x) {
|
||||
x = &tmpx;
|
||||
}
|
||||
if (!y) {
|
||||
y = &tmpy;
|
||||
}
|
||||
|
||||
*x = *y = 0;
|
||||
|
||||
return mouse->GetGlobalMouseState(x, y);
|
||||
} else {
|
||||
return SDL_GetMouseState(x, y);
|
||||
}
|
||||
if (!y) {
|
||||
y = &tmpy;
|
||||
}
|
||||
|
||||
*x = *y = 0;
|
||||
|
||||
if (!mouse->GetGlobalMouseState) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mouse->GetGlobalMouseState(x, y);
|
||||
}
|
||||
|
||||
void
|
||||
|
2
externals/SDL/src/events/SDL_quit.c
vendored
2
externals/SDL/src/events/SDL_quit.c
vendored
@@ -19,8 +19,8 @@
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
#include "SDL_hints.h"
|
||||
#include "SDL_assert.h"
|
||||
|
||||
/* General quit handling code for SDL */
|
||||
|
||||
|
1
externals/SDL/src/events/SDL_touch.c
vendored
1
externals/SDL/src/events/SDL_touch.c
vendored
@@ -22,7 +22,6 @@
|
||||
|
||||
/* General touch handling code for SDL */
|
||||
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_events_c.h"
|
||||
#include "../video/SDL_sysvideo.h"
|
||||
|
@@ -32,7 +32,6 @@
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_filesystem.h"
|
||||
#include "SDL_log.h"
|
||||
|
||||
char *
|
||||
SDL_GetBasePath(void)
|
||||
|
@@ -32,7 +32,6 @@
|
||||
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_filesystem.h"
|
||||
|
||||
char *
|
||||
|
129
externals/SDL/src/filesystem/os2/SDL_sysfilesystem.c
vendored
Executable file
129
externals/SDL/src/filesystem/os2/SDL_sysfilesystem.c
vendored
Executable file
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#ifdef SDL_FILESYSTEM_OS2
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* System dependent filesystem routines */
|
||||
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_filesystem.h"
|
||||
#include "../../core/os2/SDL_os2.h"
|
||||
|
||||
#define INCL_DOSFILEMGR
|
||||
#define INCL_DOSPROCESS
|
||||
#define INCL_DOSERRORS
|
||||
#include <os2.h>
|
||||
|
||||
|
||||
char *
|
||||
SDL_GetBasePath(void)
|
||||
{
|
||||
PTIB tib;
|
||||
PPIB pib;
|
||||
ULONG ulRC = DosGetInfoBlocks(&tib, &pib);
|
||||
PCHAR pcEnd;
|
||||
ULONG cbResult;
|
||||
CHAR acBuf[_MAX_PATH];
|
||||
|
||||
if (ulRC != NO_ERROR) {
|
||||
debug_os2("DosGetInfoBlocks() failed, rc = %u", ulRC);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pcEnd = SDL_strrchr(pib->pib_pchcmd, '\\');
|
||||
if (pcEnd != NULL)
|
||||
pcEnd++;
|
||||
else {
|
||||
if (pib->pib_pchcmd[1] == ':')
|
||||
pcEnd = &pib->pib_pchcmd[2];
|
||||
else {
|
||||
SDL_SetError("No path in pib->pib_pchcmd");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
cbResult = pcEnd - pib->pib_pchcmd;
|
||||
SDL_memcpy(acBuf, pib->pib_pchcmd, cbResult);
|
||||
acBuf[cbResult] = '\0';
|
||||
|
||||
return OS2_SysToUTF8(acBuf);
|
||||
}
|
||||
|
||||
char *
|
||||
SDL_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
PSZ pszPath;
|
||||
CHAR acBuf[_MAX_PATH];
|
||||
int lPosApp, lPosOrg;
|
||||
PSZ pszApp, pszOrg;
|
||||
|
||||
if (!app) {
|
||||
SDL_InvalidParamError("app");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pszPath = SDL_getenv("HOME");
|
||||
if (!pszPath) {
|
||||
pszPath = SDL_getenv("ETC");
|
||||
if (!pszPath) {
|
||||
SDL_SetError("HOME or ETC environment not set");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!org) {
|
||||
lPosApp = SDL_snprintf(acBuf, sizeof(acBuf) - 1, "%s", pszPath);
|
||||
} else {
|
||||
pszOrg = OS2_UTF8ToSys(org);
|
||||
if (!pszOrg) {
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
lPosApp = SDL_snprintf(acBuf, sizeof(acBuf) - 1, "%s\\%s", pszPath, pszOrg);
|
||||
SDL_free(pszOrg);
|
||||
}
|
||||
if (lPosApp < 0)
|
||||
return NULL;
|
||||
|
||||
DosCreateDir(acBuf, NULL);
|
||||
|
||||
pszApp = OS2_UTF8ToSys(app);
|
||||
if (!pszApp) {
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lPosOrg = SDL_snprintf(&acBuf[lPosApp], sizeof(acBuf) - lPosApp - 1, "\\%s", pszApp);
|
||||
SDL_free(pszApp);
|
||||
if (lPosOrg < 0)
|
||||
return NULL;
|
||||
|
||||
DosCreateDir(acBuf, NULL);
|
||||
*((PUSHORT)&acBuf[lPosApp + lPosOrg]) = (USHORT)'\0\\';
|
||||
|
||||
return OS2_SysToUTF8(acBuf);
|
||||
}
|
||||
|
||||
#endif /* SDL_FILESYSTEM_OS2 */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
@@ -28,7 +28,6 @@
|
||||
#include "../../core/windows/SDL_windows.h"
|
||||
#include <shlobj.h>
|
||||
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_filesystem.h"
|
||||
|
@@ -48,7 +48,16 @@ SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType)
|
||||
{
|
||||
static wstring path;
|
||||
if (path.empty()) {
|
||||
#if defined(NTDDI_WIN10_19H1) && (NTDDI_VERSION >= NTDDI_WIN10_19H1) && (WINAPI_FAMILY == WINAPI_FAMILY_PC_APP) /* Only PC supports mods */
|
||||
/* Windows 1903 supports mods, via the EffectiveLocation API */
|
||||
if (Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8, 0)) {
|
||||
path = Windows::ApplicationModel::Package::Current->EffectiveLocation->Path->Data();
|
||||
} else {
|
||||
path = Windows::ApplicationModel::Package::Current->InstalledLocation->Path->Data();
|
||||
}
|
||||
#else
|
||||
path = Windows::ApplicationModel::Package::Current->InstalledLocation->Path->Data();
|
||||
#endif
|
||||
}
|
||||
return path.c_str();
|
||||
}
|
||||
|
1
externals/SDL/src/haptic/SDL_haptic.c
vendored
1
externals/SDL/src/haptic/SDL_haptic.c
vendored
@@ -23,7 +23,6 @@
|
||||
#include "SDL_syshaptic.h"
|
||||
#include "SDL_haptic_c.h"
|
||||
#include "../joystick/SDL_joystick_c.h" /* For SDL_PrivateJoystickValid */
|
||||
#include "SDL_assert.h"
|
||||
|
||||
/* Global for SDL_windowshaptic.c */
|
||||
#if (defined(SDL_HAPTIC_DINPUT) && SDL_HAPTIC_DINPUT) || (defined(SDL_HAPTIC_XINPUT) && SDL_HAPTIC_XINPUT)
|
||||
|
@@ -22,7 +22,6 @@
|
||||
|
||||
#ifdef SDL_HAPTIC_ANDROID
|
||||
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_timer.h"
|
||||
#include "SDL_syshaptic_c.h"
|
||||
#include "../SDL_syshaptic.h"
|
||||
|
21
externals/SDL/src/haptic/darwin/SDL_syshaptic.c
vendored
21
externals/SDL/src/haptic/darwin/SDL_syshaptic.c
vendored
@@ -22,13 +22,12 @@
|
||||
|
||||
#ifdef SDL_HAPTIC_IOKIT
|
||||
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_haptic.h"
|
||||
#include "../SDL_syshaptic.h"
|
||||
#include "SDL_joystick.h"
|
||||
#include "../../joystick/SDL_sysjoystick.h" /* For the real SDL_Joystick */
|
||||
#include "../../joystick/darwin/SDL_sysjoystick_c.h" /* For joystick hwdata */
|
||||
#include "../../joystick/darwin/SDL_iokitjoystick_c.h" /* For joystick hwdata */
|
||||
#include "SDL_syshaptic_c.h"
|
||||
|
||||
#include <IOKit/IOKitLib.h>
|
||||
@@ -599,12 +598,14 @@ SDL_SYS_HapticMouse(void)
|
||||
int
|
||||
SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick)
|
||||
{
|
||||
#ifdef SDL_JOYSTICK_IOKIT
|
||||
if (joystick->driver != &SDL_DARWIN_JoystickDriver) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
if (joystick->hwdata->ffservice != 0) {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
#endif
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
@@ -615,6 +616,7 @@ SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick)
|
||||
int
|
||||
SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
|
||||
{
|
||||
#ifdef SDL_JOYSTICK_IOKIT
|
||||
if (joystick->driver != &SDL_DARWIN_JoystickDriver) {
|
||||
return 0;
|
||||
}
|
||||
@@ -622,6 +624,7 @@ SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
|
||||
joystick->hwdata->ffservice)) {
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -632,6 +635,7 @@ SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
|
||||
int
|
||||
SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
|
||||
{
|
||||
#ifdef SDL_JOYSTICK_IOKIT
|
||||
int device_index = 0;
|
||||
SDL_hapticlist_item *item;
|
||||
|
||||
@@ -648,6 +652,9 @@ SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
|
||||
}
|
||||
|
||||
return SDL_SYS_HapticOpenFromService(haptic, joystick->hwdata->ffservice);
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -765,6 +772,10 @@ SDL_SYS_SetDirection(FFEFFECT * effect, SDL_HapticDirection * dir, int naxes)
|
||||
rglDir[2] = dir->dir[2];
|
||||
}
|
||||
return 0;
|
||||
case SDL_HAPTIC_STEERING_AXIS:
|
||||
effect->dwFlags |= FFEFF_CARTESIAN;
|
||||
rglDir[0] = 0;
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return SDL_SetError("Haptic: Unknown direction type.");
|
||||
@@ -813,7 +824,11 @@ SDL_SYS_ToFFEFFECT(SDL_Haptic * haptic, FFEFFECT * dest, SDL_HapticEffect * src)
|
||||
envelope->dwSize = sizeof(FFENVELOPE); /* Always should be this. */
|
||||
|
||||
/* Axes. */
|
||||
dest->cAxes = haptic->naxes;
|
||||
if (src->constant.direction.type == SDL_HAPTIC_STEERING_AXIS) {
|
||||
dest->cAxes = 1;
|
||||
} else {
|
||||
dest->cAxes = haptic->naxes;
|
||||
}
|
||||
if (dest->cAxes > 0) {
|
||||
axes = SDL_malloc(sizeof(DWORD) * dest->cAxes);
|
||||
if (axes == NULL) {
|
||||
|
23
externals/SDL/src/haptic/linux/SDL_syshaptic.c
vendored
23
externals/SDL/src/haptic/linux/SDL_syshaptic.c
vendored
@@ -22,12 +22,12 @@
|
||||
|
||||
#ifdef SDL_HAPTIC_LINUX
|
||||
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_haptic.h"
|
||||
#include "../SDL_syshaptic.h"
|
||||
#include "SDL_joystick.h"
|
||||
#include "../../joystick/SDL_sysjoystick.h" /* For the real SDL_Joystick */
|
||||
#include "../../joystick/linux/SDL_sysjoystick_c.h" /* For joystick hwdata */
|
||||
#include "../../core/linux/SDL_evdev_capabilities.h"
|
||||
#include "../../core/linux/SDL_udev.h"
|
||||
|
||||
#include <unistd.h> /* close */
|
||||
@@ -86,8 +86,6 @@ static SDL_hapticlist_item *SDL_hapticlist = NULL;
|
||||
static SDL_hapticlist_item *SDL_hapticlist_tail = NULL;
|
||||
static int numhaptics = 0;
|
||||
|
||||
#define test_bit(nr, addr) \
|
||||
(((1UL << ((nr) & 31)) & (((const unsigned int *) addr)[(nr) >> 5])) != 0)
|
||||
#define EV_TEST(ev,f) \
|
||||
if (test_bit((ev), features)) ret |= (f);
|
||||
/*
|
||||
@@ -512,10 +510,15 @@ SDL_SYS_HapticMouse(void)
|
||||
int
|
||||
SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick)
|
||||
{
|
||||
#ifdef SDL_JOYSTICK_LINUX
|
||||
if (joystick->driver != &SDL_LINUX_JoystickDriver) {
|
||||
return 0;
|
||||
return SDL_FALSE;
|
||||
}
|
||||
return EV_IsHaptic(joystick->hwdata->fd);
|
||||
if (EV_IsHaptic(joystick->hwdata->fd)) {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
#endif
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -525,6 +528,7 @@ SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick)
|
||||
int
|
||||
SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
|
||||
{
|
||||
#ifdef SDL_JOYSTICK_LINUX
|
||||
if (joystick->driver != &SDL_LINUX_JoystickDriver) {
|
||||
return 0;
|
||||
}
|
||||
@@ -533,6 +537,7 @@ SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
|
||||
if (SDL_strcmp(joystick->hwdata->fname, haptic->hwdata->fname) == 0) {
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -543,6 +548,7 @@ SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
|
||||
int
|
||||
SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
|
||||
{
|
||||
#ifdef SDL_JOYSTICK_LINUX
|
||||
int device_index = 0;
|
||||
int fd;
|
||||
int ret;
|
||||
@@ -577,6 +583,9 @@ SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
|
||||
haptic->hwdata->fname = SDL_strdup( joystick->hwdata->fname );
|
||||
|
||||
return 0;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -718,7 +727,9 @@ SDL_SYS_ToDirection(Uint16 *dest, SDL_HapticDirection * src)
|
||||
*dest = (Uint16) tmp;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_HAPTIC_STEERING_AXIS:
|
||||
*dest = 0x4000;
|
||||
break;
|
||||
default:
|
||||
return SDL_SetError("Haptic: Unsupported direction type.");
|
||||
}
|
||||
|
@@ -51,10 +51,6 @@ static LPDIRECTINPUT8 dinput = NULL;
|
||||
static int
|
||||
DI_SetError(const char *str, HRESULT err)
|
||||
{
|
||||
/*
|
||||
SDL_SetError("Haptic: %s - %s: %s", str,
|
||||
DXGetErrorString8A(err), DXGetErrorDescription8A(err));
|
||||
*/
|
||||
return SDL_SetError("Haptic error %s", str);
|
||||
}
|
||||
|
||||
@@ -87,7 +83,7 @@ SDL_DINPUT_HapticInit(void)
|
||||
coinitialized = SDL_TRUE;
|
||||
|
||||
ret = CoCreateInstance(&CLSID_DirectInput8, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_IDirectInput8, (LPVOID)& dinput);
|
||||
&IID_IDirectInput8, (LPVOID *) &dinput);
|
||||
if (FAILED(ret)) {
|
||||
SDL_SYS_HapticQuit();
|
||||
return DI_SetError("CoCreateInstance", ret);
|
||||
@@ -589,6 +585,10 @@ SDL_SYS_SetDirection(DIEFFECT * effect, SDL_HapticDirection * dir, int naxes)
|
||||
if (naxes > 2)
|
||||
rglDir[2] = dir->dir[2];
|
||||
return 0;
|
||||
case SDL_HAPTIC_STEERING_AXIS:
|
||||
effect->dwFlags |= DIEFF_CARTESIAN;
|
||||
rglDir[0] = 0;
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return SDL_SetError("Haptic: Unknown direction type.");
|
||||
@@ -637,7 +637,11 @@ SDL_SYS_ToDIEFFECT(SDL_Haptic * haptic, DIEFFECT * dest,
|
||||
envelope->dwSize = sizeof(DIENVELOPE); /* Always should be this. */
|
||||
|
||||
/* Axes. */
|
||||
dest->cAxes = haptic->naxes;
|
||||
if (src->constant.direction.type == SDL_HAPTIC_STEERING_AXIS) {
|
||||
dest->cAxes = 1;
|
||||
} else {
|
||||
dest->cAxes = haptic->naxes;
|
||||
}
|
||||
if (dest->cAxes > 0) {
|
||||
axes = SDL_malloc(sizeof(DWORD) * dest->cAxes);
|
||||
if (axes == NULL) {
|
||||
|
@@ -22,7 +22,6 @@
|
||||
|
||||
#if SDL_HAPTIC_DINPUT || SDL_HAPTIC_XINPUT
|
||||
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_thread.h"
|
||||
#include "SDL_mutex.h"
|
||||
#include "SDL_timer.h"
|
||||
|
@@ -50,6 +50,7 @@ struct haptic_hwdata
|
||||
/*
|
||||
* Haptic system effect data.
|
||||
*/
|
||||
#if SDL_HAPTIC_DINPUT || SDL_HAPTIC_XINPUT
|
||||
struct haptic_hweffect
|
||||
{
|
||||
#if SDL_HAPTIC_DINPUT
|
||||
@@ -60,6 +61,7 @@ struct haptic_hweffect
|
||||
XINPUT_VIBRATION vibration;
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* List of available haptic devices.
|
||||
|
@@ -26,7 +26,6 @@
|
||||
|
||||
#if SDL_HAPTIC_XINPUT
|
||||
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_hints.h"
|
||||
#include "SDL_timer.h"
|
||||
#include "SDL_windowshaptic_c.h"
|
||||
|
248
externals/SDL/src/hidapi/SDL_hidapi.c
vendored
248
externals/SDL/src/hidapi/SDL_hidapi.c
vendored
@@ -63,6 +63,7 @@
|
||||
#define make_path PLATFORM_make_path
|
||||
#define read_thread PLATFORM_read_thread
|
||||
|
||||
#undef HIDAPI_H__
|
||||
#if __LINUX__
|
||||
|
||||
#include "../../core/linux/SDL_udev.h"
|
||||
@@ -97,8 +98,6 @@ static const SDL_UDEV_Symbols *udev_ctx = NULL;
|
||||
#include "windows/hid.c"
|
||||
#define HAVE_PLATFORM_BACKEND 1
|
||||
#define udev_ctx 1
|
||||
#else
|
||||
#error Need a hid.c for this platform!
|
||||
#endif
|
||||
|
||||
#undef hid_device_
|
||||
@@ -129,6 +128,68 @@ static const SDL_UDEV_Symbols *udev_ctx = NULL;
|
||||
#undef make_path
|
||||
#undef read_thread
|
||||
|
||||
#ifdef SDL_JOYSTICK_HIDAPI_STEAMXBOX
|
||||
#define HAVE_DRIVER_BACKEND 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DRIVER_BACKEND
|
||||
|
||||
/* DRIVER HIDAPI Implementation */
|
||||
|
||||
#define hid_device_ DRIVER_hid_device_
|
||||
#define hid_device DRIVER_hid_device
|
||||
#define hid_device_info DRIVER_hid_device_info
|
||||
#define hid_init DRIVER_hid_init
|
||||
#define hid_exit DRIVER_hid_exit
|
||||
#define hid_enumerate DRIVER_hid_enumerate
|
||||
#define hid_free_enumeration DRIVER_hid_free_enumeration
|
||||
#define hid_open DRIVER_hid_open
|
||||
#define hid_open_path DRIVER_hid_open_path
|
||||
#define hid_write DRIVER_hid_write
|
||||
#define hid_read_timeout DRIVER_hid_read_timeout
|
||||
#define hid_read DRIVER_hid_read
|
||||
#define hid_set_nonblocking DRIVER_hid_set_nonblocking
|
||||
#define hid_send_feature_report DRIVER_hid_send_feature_report
|
||||
#define hid_get_feature_report DRIVER_hid_get_feature_report
|
||||
#define hid_close DRIVER_hid_close
|
||||
#define hid_get_manufacturer_string DRIVER_hid_get_manufacturer_string
|
||||
#define hid_get_product_string DRIVER_hid_get_product_string
|
||||
#define hid_get_serial_number_string DRIVER_hid_get_serial_number_string
|
||||
#define hid_get_indexed_string DRIVER_hid_get_indexed_string
|
||||
#define hid_error DRIVER_hid_error
|
||||
|
||||
#ifdef SDL_JOYSTICK_HIDAPI_STEAMXBOX
|
||||
#undef HIDAPI_H__
|
||||
#include "steamxbox/hid.c"
|
||||
#else
|
||||
#error Need a driver hid.c for this platform!
|
||||
#endif
|
||||
|
||||
#undef hid_device_
|
||||
#undef hid_device
|
||||
#undef hid_device_info
|
||||
#undef hid_init
|
||||
#undef hid_exit
|
||||
#undef hid_enumerate
|
||||
#undef hid_free_enumeration
|
||||
#undef hid_open
|
||||
#undef hid_open_path
|
||||
#undef hid_write
|
||||
#undef hid_read_timeout
|
||||
#undef hid_read
|
||||
#undef hid_set_nonblocking
|
||||
#undef hid_send_feature_report
|
||||
#undef hid_get_feature_report
|
||||
#undef hid_close
|
||||
#undef hid_get_manufacturer_string
|
||||
#undef hid_get_product_string
|
||||
#undef hid_get_serial_number_string
|
||||
#undef hid_get_indexed_string
|
||||
#undef hid_error
|
||||
|
||||
#endif /* HAVE_DRIVER_BACKEND */
|
||||
|
||||
|
||||
#ifdef SDL_LIBUSB_DYNAMIC
|
||||
/* libusb HIDAPI Implementation */
|
||||
|
||||
@@ -298,23 +359,21 @@ SDL_libusb_get_string_descriptor(libusb_device_handle *dev,
|
||||
/* Shared HIDAPI Implementation */
|
||||
|
||||
#undef HIDAPI_H__
|
||||
#include "hidapi.h"
|
||||
#include "hidapi/hidapi.h"
|
||||
|
||||
struct hidapi_backend {
|
||||
#define F(x) typeof(x) *x
|
||||
F(hid_write);
|
||||
F(hid_read_timeout);
|
||||
F(hid_read);
|
||||
F(hid_set_nonblocking);
|
||||
F(hid_send_feature_report);
|
||||
F(hid_get_feature_report);
|
||||
F(hid_close);
|
||||
F(hid_get_manufacturer_string);
|
||||
F(hid_get_product_string);
|
||||
F(hid_get_serial_number_string);
|
||||
F(hid_get_indexed_string);
|
||||
F(hid_error);
|
||||
#undef F
|
||||
int (*hid_write)(hid_device* device, const unsigned char* data, size_t length);
|
||||
int (*hid_read_timeout)(hid_device* device, unsigned char* data, size_t length, int milliseconds);
|
||||
int (*hid_read)(hid_device* device, unsigned char* data, size_t length);
|
||||
int (*hid_set_nonblocking)(hid_device* device, int nonblock);
|
||||
int (*hid_send_feature_report)(hid_device* device, const unsigned char* data, size_t length);
|
||||
int (*hid_get_feature_report)(hid_device* device, unsigned char* data, size_t length);
|
||||
void (*hid_close)(hid_device* device);
|
||||
int (*hid_get_manufacturer_string)(hid_device* device, wchar_t* string, size_t maxlen);
|
||||
int (*hid_get_product_string)(hid_device* device, wchar_t* string, size_t maxlen);
|
||||
int (*hid_get_serial_number_string)(hid_device* device, wchar_t* string, size_t maxlen);
|
||||
int (*hid_get_indexed_string)(hid_device* device, int string_index, wchar_t* string, size_t maxlen);
|
||||
const wchar_t* (*hid_error)(hid_device* device);
|
||||
};
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
@@ -334,6 +393,23 @@ static const struct hidapi_backend PLATFORM_Backend = {
|
||||
};
|
||||
#endif /* HAVE_PLATFORM_BACKEND */
|
||||
|
||||
#if HAVE_DRIVER_BACKEND
|
||||
static const struct hidapi_backend DRIVER_Backend = {
|
||||
(void*)DRIVER_hid_write,
|
||||
(void*)DRIVER_hid_read_timeout,
|
||||
(void*)DRIVER_hid_read,
|
||||
(void*)DRIVER_hid_set_nonblocking,
|
||||
(void*)DRIVER_hid_send_feature_report,
|
||||
(void*)DRIVER_hid_get_feature_report,
|
||||
(void*)DRIVER_hid_close,
|
||||
(void*)DRIVER_hid_get_manufacturer_string,
|
||||
(void*)DRIVER_hid_get_product_string,
|
||||
(void*)DRIVER_hid_get_serial_number_string,
|
||||
(void*)DRIVER_hid_get_indexed_string,
|
||||
(void*)DRIVER_hid_error
|
||||
};
|
||||
#endif /* HAVE_DRIVER_BACKEND */
|
||||
|
||||
#ifdef SDL_LIBUSB_DYNAMIC
|
||||
static const struct hidapi_backend LIBUSB_Backend = {
|
||||
(void*)LIBUSB_hid_write,
|
||||
@@ -361,7 +437,7 @@ struct _HIDDeviceWrapper
|
||||
static HIDDeviceWrapper *
|
||||
CreateHIDDeviceWrapper(hid_device *device, const struct hidapi_backend *backend)
|
||||
{
|
||||
HIDDeviceWrapper *ret = SDL_malloc(sizeof(*ret));
|
||||
HIDDeviceWrapper *ret = (HIDDeviceWrapper *)SDL_malloc(sizeof(*ret));
|
||||
ret->device = device;
|
||||
ret->backend = backend;
|
||||
return ret;
|
||||
@@ -420,6 +496,28 @@ LIBUSB_CopyHIDDeviceInfo(struct LIBUSB_hid_device_info *pSrc,
|
||||
}
|
||||
#endif /* SDL_LIBUSB_DYNAMIC */
|
||||
|
||||
#if HAVE_DRIVER_BACKEND
|
||||
static void
|
||||
DRIVER_CopyHIDDeviceInfo(struct DRIVER_hid_device_info *pSrc,
|
||||
struct hid_device_info *pDst)
|
||||
{
|
||||
COPY_IF_EXISTS(path)
|
||||
pDst->vendor_id = pSrc->vendor_id;
|
||||
pDst->product_id = pSrc->product_id;
|
||||
WCOPY_IF_EXISTS(serial_number)
|
||||
pDst->release_number = pSrc->release_number;
|
||||
WCOPY_IF_EXISTS(manufacturer_string)
|
||||
WCOPY_IF_EXISTS(product_string)
|
||||
pDst->usage_page = pSrc->usage_page;
|
||||
pDst->usage = pSrc->usage;
|
||||
pDst->interface_number = pSrc->interface_number;
|
||||
pDst->interface_class = pSrc->interface_class;
|
||||
pDst->interface_subclass = pSrc->interface_subclass;
|
||||
pDst->interface_protocol = pSrc->interface_protocol;
|
||||
pDst->next = NULL;
|
||||
}
|
||||
#endif /* HAVE_DRIVER_BACKEND */
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
static void
|
||||
PLATFORM_CopyHIDDeviceInfo(struct PLATFORM_hid_device_info *pSrc,
|
||||
@@ -458,8 +556,9 @@ int HID_API_EXPORT HID_API_CALL hid_init(void)
|
||||
#ifdef SDL_LIBUSB_DYNAMIC
|
||||
libusb_ctx.libhandle = SDL_LoadObject(SDL_LIBUSB_DYNAMIC);
|
||||
if (libusb_ctx.libhandle != NULL) {
|
||||
SDL_bool loaded = SDL_TRUE;
|
||||
#define LOAD_LIBUSB_SYMBOL(func) \
|
||||
libusb_ctx.func = SDL_LoadFunction(libusb_ctx.libhandle, "libusb_" #func);
|
||||
if (!(libusb_ctx.func = SDL_LoadFunction(libusb_ctx.libhandle, "libusb_" #func))) {loaded = SDL_FALSE;}
|
||||
LOAD_LIBUSB_SYMBOL(init)
|
||||
LOAD_LIBUSB_SYMBOL(exit)
|
||||
LOAD_LIBUSB_SYMBOL(get_device_list)
|
||||
@@ -488,9 +587,17 @@ int HID_API_EXPORT HID_API_CALL hid_init(void)
|
||||
LOAD_LIBUSB_SYMBOL(handle_events_completed)
|
||||
#undef LOAD_LIBUSB_SYMBOL
|
||||
|
||||
if ((err = LIBUSB_hid_init()) < 0) {
|
||||
if (loaded == SDL_TRUE) {
|
||||
if ((err = LIBUSB_hid_init()) < 0) {
|
||||
SDL_UnloadObject(libusb_ctx.libhandle);
|
||||
libusb_ctx.libhandle = NULL;
|
||||
return err;
|
||||
}
|
||||
} else {
|
||||
SDL_UnloadObject(libusb_ctx.libhandle);
|
||||
return err;
|
||||
libusb_ctx.libhandle = NULL;
|
||||
/* SDL_LogWarn(SDL_LOG_CATEGORY_INPUT, SDL_LIBUSB_DYNAMIC " found but could not load function."); */
|
||||
/* ignore error: continue without libusb */
|
||||
}
|
||||
}
|
||||
#endif /* SDL_LIBUSB_DYNAMIC */
|
||||
@@ -502,13 +609,16 @@ int HID_API_EXPORT HID_API_CALL hid_init(void)
|
||||
if (udev_ctx && (err = PLATFORM_hid_init()) < 0) {
|
||||
#ifdef SDL_LIBUSB_DYNAMIC
|
||||
if (libusb_ctx.libhandle) {
|
||||
LIBUSB_hid_exit();
|
||||
SDL_UnloadObject(libusb_ctx.libhandle);
|
||||
libusb_ctx.libhandle = NULL;
|
||||
}
|
||||
#endif /* SDL_LIBUSB_DYNAMIC */
|
||||
return err;
|
||||
}
|
||||
#endif /* HAVE_PLATFORM_BACKEND */
|
||||
|
||||
SDL_hidapi_wasinit = SDL_TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -519,6 +629,7 @@ int HID_API_EXPORT HID_API_CALL hid_exit(void)
|
||||
if (SDL_hidapi_wasinit == SDL_FALSE) {
|
||||
return 0;
|
||||
}
|
||||
SDL_hidapi_wasinit = SDL_FALSE;
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
if (udev_ctx) {
|
||||
@@ -529,6 +640,7 @@ int HID_API_EXPORT HID_API_CALL hid_exit(void)
|
||||
if (libusb_ctx.libhandle) {
|
||||
err |= LIBUSB_hid_exit(); /* Ehhhhh */
|
||||
SDL_UnloadObject(libusb_ctx.libhandle);
|
||||
libusb_ctx.libhandle = NULL;
|
||||
}
|
||||
#endif /* SDL_LIBUSB_DYNAMIC */
|
||||
return err;
|
||||
@@ -540,22 +652,40 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
|
||||
struct LIBUSB_hid_device_info *usb_devs = NULL;
|
||||
struct LIBUSB_hid_device_info *usb_dev;
|
||||
#endif
|
||||
#if HAVE_DRIVER_BACKEND
|
||||
struct DRIVER_hid_device_info* driver_devs = NULL;
|
||||
struct DRIVER_hid_device_info* driver_dev;
|
||||
#endif
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
struct PLATFORM_hid_device_info *raw_devs = NULL;
|
||||
struct PLATFORM_hid_device_info *raw_dev;
|
||||
#endif
|
||||
struct hid_device_info *devs = NULL, *last = NULL, *new_dev;
|
||||
|
||||
if (SDL_hidapi_wasinit == SDL_FALSE) {
|
||||
hid_init();
|
||||
if (hid_init() != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef SDL_LIBUSB_DYNAMIC
|
||||
if (libusb_ctx.libhandle) {
|
||||
usb_devs = LIBUSB_hid_enumerate(vendor_id, product_id);
|
||||
#ifdef DEBUG_HIDAPI
|
||||
SDL_Log("libusb devices found:");
|
||||
#endif
|
||||
for (usb_dev = usb_devs; usb_dev; usb_dev = usb_dev->next) {
|
||||
new_dev = (struct hid_device_info*) SDL_malloc(sizeof(struct hid_device_info));
|
||||
if (!new_dev) {
|
||||
LIBUSB_hid_free_enumeration(usb_devs);
|
||||
hid_free_enumeration(devs);
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
LIBUSB_CopyHIDDeviceInfo(usb_dev, new_dev);
|
||||
#ifdef DEBUG_HIDAPI
|
||||
SDL_Log(" - %ls %ls 0x%.4hx 0x%.4hx",
|
||||
usb_dev->manufacturer_string, usb_dev->product_string,
|
||||
usb_dev->vendor_id, usb_dev->product_id);
|
||||
#endif
|
||||
|
||||
if (last != NULL) {
|
||||
last->next = new_dev;
|
||||
@@ -567,11 +697,34 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
|
||||
}
|
||||
#endif /* SDL_LIBUSB_DYNAMIC */
|
||||
|
||||
#ifdef HAVE_DRIVER_BACKEND
|
||||
driver_devs = DRIVER_hid_enumerate(vendor_id, product_id);
|
||||
for (driver_dev = driver_devs; driver_dev; driver_dev = driver_dev->next) {
|
||||
new_dev = (struct hid_device_info*) SDL_malloc(sizeof(struct hid_device_info));
|
||||
DRIVER_CopyHIDDeviceInfo(driver_dev, new_dev);
|
||||
|
||||
if (last != NULL) {
|
||||
last->next = new_dev;
|
||||
} else {
|
||||
devs = new_dev;
|
||||
}
|
||||
last = new_dev;
|
||||
}
|
||||
#endif /* HAVE_DRIVER_BACKEND */
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
if (udev_ctx) {
|
||||
raw_devs = PLATFORM_hid_enumerate(vendor_id, product_id);
|
||||
#ifdef DEBUG_HIDAPI
|
||||
SDL_Log("hidraw devices found:");
|
||||
#endif
|
||||
for (raw_dev = raw_devs; raw_dev; raw_dev = raw_dev->next) {
|
||||
SDL_bool bFound = SDL_FALSE;
|
||||
#ifdef DEBUG_HIDAPI
|
||||
SDL_Log(" - %ls %ls 0x%.4hx 0x%.4hx",
|
||||
raw_dev->manufacturer_string, raw_dev->product_string,
|
||||
raw_dev->vendor_id, raw_dev->product_id);
|
||||
#endif
|
||||
#ifdef SDL_LIBUSB_DYNAMIC
|
||||
for (usb_dev = usb_devs; usb_dev; usb_dev = usb_dev->next) {
|
||||
if (raw_dev->vendor_id == usb_dev->vendor_id &&
|
||||
@@ -581,9 +734,30 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_DRIVER_BACKEND
|
||||
for (driver_dev = driver_devs; driver_dev; driver_dev = driver_dev->next) {
|
||||
if (raw_dev->vendor_id == driver_dev->vendor_id &&
|
||||
raw_dev->product_id == driver_dev->product_id &&
|
||||
(raw_dev->interface_number < 0 || raw_dev->interface_number == driver_dev->interface_number)) {
|
||||
bFound = SDL_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (!bFound) {
|
||||
new_dev = (struct hid_device_info*) SDL_malloc(sizeof(struct hid_device_info));
|
||||
if (!new_dev) {
|
||||
#ifdef SDL_LIBUSB_DYNAMIC
|
||||
if (libusb_ctx.libhandle) {
|
||||
LIBUSB_hid_free_enumeration(usb_devs);
|
||||
}
|
||||
#endif
|
||||
PLATFORM_hid_free_enumeration(raw_devs);
|
||||
hid_free_enumeration(devs);
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
PLATFORM_CopyHIDDeviceInfo(raw_dev, new_dev);
|
||||
new_dev->next = NULL;
|
||||
|
||||
@@ -624,8 +798,8 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsi
|
||||
{
|
||||
hid_device *pDevice = NULL;
|
||||
|
||||
if (SDL_hidapi_wasinit == SDL_FALSE) {
|
||||
hid_init();
|
||||
if (hid_init() != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
@@ -636,6 +810,15 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsi
|
||||
return WrapHIDDevice(wrapper);
|
||||
}
|
||||
#endif /* HAVE_PLATFORM_BACKEND */
|
||||
|
||||
#if HAVE_DRIVER_BACKEND
|
||||
if ((pDevice = (hid_device*) DRIVER_hid_open(vendor_id, product_id, serial_number)) != NULL) {
|
||||
|
||||
HIDDeviceWrapper *wrapper = CreateHIDDeviceWrapper(pDevice, &DRIVER_Backend);
|
||||
return WrapHIDDevice(wrapper);
|
||||
}
|
||||
#endif /* HAVE_DRIVER_BACKEND */
|
||||
|
||||
#ifdef SDL_LIBUSB_DYNAMIC
|
||||
if (libusb_ctx.libhandle &&
|
||||
(pDevice = (hid_device*) LIBUSB_hid_open(vendor_id, product_id, serial_number)) != NULL) {
|
||||
@@ -644,6 +827,7 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsi
|
||||
return WrapHIDDevice(wrapper);
|
||||
}
|
||||
#endif /* SDL_LIBUSB_DYNAMIC */
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -651,8 +835,8 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path, int bEx
|
||||
{
|
||||
hid_device *pDevice = NULL;
|
||||
|
||||
if (SDL_hidapi_wasinit == SDL_FALSE) {
|
||||
hid_init();
|
||||
if (hid_init() != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
@@ -663,6 +847,15 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path, int bEx
|
||||
return WrapHIDDevice(wrapper);
|
||||
}
|
||||
#endif /* HAVE_PLATFORM_BACKEND */
|
||||
|
||||
#if HAVE_DRIVER_BACKEND
|
||||
if ((pDevice = (hid_device*) DRIVER_hid_open_path(path, bExclusive)) != NULL) {
|
||||
|
||||
HIDDeviceWrapper *wrapper = CreateHIDDeviceWrapper(pDevice, &DRIVER_Backend);
|
||||
return WrapHIDDevice(wrapper);
|
||||
}
|
||||
#endif /* HAVE_DRIVER_BACKEND */
|
||||
|
||||
#ifdef SDL_LIBUSB_DYNAMIC
|
||||
if (libusb_ctx.libhandle &&
|
||||
(pDevice = (hid_device*) LIBUSB_hid_open_path(path, bExclusive)) != NULL) {
|
||||
@@ -671,6 +864,7 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path, int bEx
|
||||
return WrapHIDDevice(wrapper);
|
||||
}
|
||||
#endif /* SDL_LIBUSB_DYNAMIC */
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
52
externals/SDL/src/hidapi/android/hid.cpp
vendored
52
externals/SDL/src/hidapi/android/hid.cpp
vendored
@@ -436,6 +436,12 @@ public:
|
||||
g_JVM->AttachCurrentThread( &env, NULL );
|
||||
pthread_setspecific( g_ThreadKey, (void*)env );
|
||||
|
||||
if ( !g_HIDDeviceManagerCallbackHandler )
|
||||
{
|
||||
LOGV( "Device open without callback handler" );
|
||||
return false;
|
||||
}
|
||||
|
||||
m_bIsWaitingForOpen = false;
|
||||
m_bOpenResult = env->CallBooleanMethod( g_HIDDeviceManagerCallbackHandler, g_midHIDDeviceManagerOpen, m_nId );
|
||||
ExceptionCheck( env, "BOpen" );
|
||||
@@ -545,11 +551,18 @@ public:
|
||||
g_JVM->AttachCurrentThread( &env, NULL );
|
||||
pthread_setspecific( g_ThreadKey, (void*)env );
|
||||
|
||||
jbyteArray pBuf = NewByteArray( env, pData, nDataLen );
|
||||
int nRet = env->CallIntMethod( g_HIDDeviceManagerCallbackHandler, g_midHIDDeviceManagerSendOutputReport, m_nId, pBuf );
|
||||
ExceptionCheck( env, "SendOutputReport" );
|
||||
|
||||
env->DeleteLocalRef( pBuf );
|
||||
int nRet = -1;
|
||||
if ( g_HIDDeviceManagerCallbackHandler )
|
||||
{
|
||||
jbyteArray pBuf = NewByteArray( env, pData, nDataLen );
|
||||
nRet = env->CallIntMethod( g_HIDDeviceManagerCallbackHandler, g_midHIDDeviceManagerSendOutputReport, m_nId, pBuf );
|
||||
ExceptionCheck( env, "SendOutputReport" );
|
||||
env->DeleteLocalRef( pBuf );
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGV( "SendOutputReport without callback handler" );
|
||||
}
|
||||
return nRet;
|
||||
}
|
||||
|
||||
@@ -560,10 +573,18 @@ public:
|
||||
g_JVM->AttachCurrentThread( &env, NULL );
|
||||
pthread_setspecific( g_ThreadKey, (void*)env );
|
||||
|
||||
jbyteArray pBuf = NewByteArray( env, pData, nDataLen );
|
||||
int nRet = env->CallIntMethod( g_HIDDeviceManagerCallbackHandler, g_midHIDDeviceManagerSendFeatureReport, m_nId, pBuf );
|
||||
ExceptionCheck( env, "SendFeatureReport" );
|
||||
env->DeleteLocalRef( pBuf );
|
||||
int nRet = -1;
|
||||
if ( g_HIDDeviceManagerCallbackHandler )
|
||||
{
|
||||
jbyteArray pBuf = NewByteArray( env, pData, nDataLen );
|
||||
nRet = env->CallIntMethod( g_HIDDeviceManagerCallbackHandler, g_midHIDDeviceManagerSendFeatureReport, m_nId, pBuf );
|
||||
ExceptionCheck( env, "SendFeatureReport" );
|
||||
env->DeleteLocalRef( pBuf );
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGV( "SendFeatureReport without callback handler" );
|
||||
}
|
||||
return nRet;
|
||||
}
|
||||
|
||||
@@ -587,6 +608,12 @@ public:
|
||||
g_JVM->AttachCurrentThread( &env, NULL );
|
||||
pthread_setspecific( g_ThreadKey, (void*)env );
|
||||
|
||||
if ( !g_HIDDeviceManagerCallbackHandler )
|
||||
{
|
||||
LOGV( "GetFeatureReport without callback handler" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
{
|
||||
hid_mutex_guard cvl( &m_cvLock );
|
||||
if ( m_bIsWaitingForFeatureReport )
|
||||
@@ -657,8 +684,11 @@ public:
|
||||
g_JVM->AttachCurrentThread( &env, NULL );
|
||||
pthread_setspecific( g_ThreadKey, (void*)env );
|
||||
|
||||
env->CallVoidMethod( g_HIDDeviceManagerCallbackHandler, g_midHIDDeviceManagerClose, m_nId );
|
||||
ExceptionCheck( env, "Close" );
|
||||
if ( g_HIDDeviceManagerCallbackHandler )
|
||||
{
|
||||
env->CallVoidMethod( g_HIDDeviceManagerCallbackHandler, g_midHIDDeviceManagerClose, m_nId );
|
||||
ExceptionCheck( env, "Close" );
|
||||
}
|
||||
|
||||
hid_mutex_guard dataLock( &m_dataLock );
|
||||
m_vecData.clear();
|
||||
|
28
externals/SDL/src/hidapi/libusb/hid.c
vendored
28
externals/SDL/src/hidapi/libusb/hid.c
vendored
@@ -524,17 +524,17 @@ static int is_xbox360(unsigned short vendor_id, const struct libusb_interface_de
|
||||
|
||||
static int is_xboxone(unsigned short vendor_id, const struct libusb_interface_descriptor *intf_desc)
|
||||
{
|
||||
static const int XB1_IFACE_SUBCLASS = 71;
|
||||
static const int XB1_IFACE_PROTOCOL = 208;
|
||||
static const int SUPPORTED_VENDORS[] = {
|
||||
0x045e, /* Microsoft */
|
||||
0x0738, /* Mad Catz */
|
||||
0x0e6f, /* PDP */
|
||||
0x0f0d, /* Hori */
|
||||
0x1532, /* Razer Wildcat */
|
||||
0x24c6, /* PowerA */
|
||||
0x2e24, /* Hyperkin */
|
||||
};
|
||||
static const int XB1_IFACE_SUBCLASS = 71;
|
||||
static const int XB1_IFACE_PROTOCOL = 208;
|
||||
static const int SUPPORTED_VENDORS[] = {
|
||||
0x045e, /* Microsoft */
|
||||
0x0738, /* Mad Catz */
|
||||
0x0e6f, /* PDP */
|
||||
0x0f0d, /* Hori */
|
||||
0x1532, /* Razer Wildcat */
|
||||
0x24c6, /* PowerA */
|
||||
0x2e24, /* Hyperkin */
|
||||
};
|
||||
|
||||
if (intf_desc->bInterfaceNumber == 0 &&
|
||||
intf_desc->bInterfaceClass == LIBUSB_CLASS_VENDOR_SPEC &&
|
||||
@@ -783,7 +783,7 @@ hid_device * hid_open(unsigned short vendor_id, unsigned short product_id, const
|
||||
return handle;
|
||||
}
|
||||
|
||||
static void read_callback(struct libusb_transfer *transfer)
|
||||
static void LIBUSB_CALL read_callback(struct libusb_transfer *transfer)
|
||||
{
|
||||
hid_device *dev = (hid_device *)transfer->user_data;
|
||||
int res;
|
||||
@@ -982,9 +982,9 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path, int bExclusive)
|
||||
libusb_get_config_descriptor(usb_dev, 0, &conf_desc);
|
||||
if (!conf_desc)
|
||||
continue;
|
||||
for (j = 0; j < conf_desc->bNumInterfaces; j++) {
|
||||
for (j = 0; j < conf_desc->bNumInterfaces && !good_open; j++) {
|
||||
const struct libusb_interface *intf = &conf_desc->interface[j];
|
||||
for (k = 0; k < intf->num_altsetting; k++) {
|
||||
for (k = 0; k < intf->num_altsetting && !good_open; k++) {
|
||||
const struct libusb_interface_descriptor *intf_desc;
|
||||
intf_desc = &intf->altsetting[k];
|
||||
if (should_enumerate_interface(desc.idVendor, intf_desc)) {
|
||||
|
40
externals/SDL/src/hidapi/linux/hid.c
vendored
40
externals/SDL/src/hidapi/linux/hid.c
vendored
@@ -86,7 +86,7 @@ struct hid_device_ {
|
||||
int device_handle;
|
||||
int blocking;
|
||||
int uses_numbered_reports;
|
||||
int is_bluetooth;
|
||||
int needs_ble_hack;
|
||||
};
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ static hid_device *new_hid_device(void)
|
||||
dev->device_handle = -1;
|
||||
dev->blocking = 1;
|
||||
dev->uses_numbered_reports = 0;
|
||||
dev->is_bluetooth = 0;
|
||||
dev->needs_ble_hack = 0;
|
||||
|
||||
return dev;
|
||||
}
|
||||
@@ -269,12 +269,12 @@ next_line:
|
||||
return (found_id && found_name && found_serial);
|
||||
}
|
||||
|
||||
static int is_bluetooth(hid_device *dev)
|
||||
static int is_BLE(hid_device *dev)
|
||||
{
|
||||
struct udev *udev;
|
||||
struct udev_device *udev_dev, *hid_dev;
|
||||
struct stat s;
|
||||
int ret = -1;
|
||||
int ret;
|
||||
|
||||
/* Create the udev object */
|
||||
udev = udev_new();
|
||||
@@ -284,13 +284,13 @@ static int is_bluetooth(hid_device *dev)
|
||||
}
|
||||
|
||||
/* Get the dev_t (major/minor numbers) from the file handle. */
|
||||
ret = fstat(dev->device_handle, &s);
|
||||
if (-1 == ret) {
|
||||
if (fstat(dev->device_handle, &s) < 0) {
|
||||
udev_unref(udev);
|
||||
return ret;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Open a udev device from the dev_t. 'c' means character device. */
|
||||
ret = 0;
|
||||
udev_dev = udev_device_new_from_devnum(udev, 'c', s.st_rdev);
|
||||
if (udev_dev) {
|
||||
hid_dev = udev_device_get_parent_with_subsystem_devtype(
|
||||
@@ -298,13 +298,13 @@ static int is_bluetooth(hid_device *dev)
|
||||
"hid",
|
||||
NULL);
|
||||
if (hid_dev) {
|
||||
unsigned short dev_vid;
|
||||
unsigned short dev_pid;
|
||||
int bus_type;
|
||||
unsigned short dev_vid = 0;
|
||||
unsigned short dev_pid = 0;
|
||||
int bus_type = 0;
|
||||
char *serial_number_utf8 = NULL;
|
||||
char *product_name_utf8 = NULL;
|
||||
|
||||
ret = parse_uevent_info(
|
||||
parse_uevent_info(
|
||||
udev_device_get_sysattr_value(hid_dev, "uevent"),
|
||||
&bus_type,
|
||||
&dev_vid,
|
||||
@@ -314,7 +314,12 @@ static int is_bluetooth(hid_device *dev)
|
||||
free(serial_number_utf8);
|
||||
free(product_name_utf8);
|
||||
|
||||
ret = (bus_type == BUS_BLUETOOTH);
|
||||
if (bus_type == BUS_BLUETOOTH) {
|
||||
/* Right now the Steam Controller is the only BLE device that we send feature reports to */
|
||||
if (dev_vid == 0x28de /* Valve */) {
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* hid_dev doesn't need to be (and can't be) unref'd.
|
||||
I'm not sure why, but it'll throw double-free() errors. */
|
||||
@@ -327,7 +332,6 @@ static int is_bluetooth(hid_device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int get_device_string(hid_device *dev, enum device_string_id key, wchar_t *string, size_t maxlen)
|
||||
{
|
||||
struct udev *udev;
|
||||
@@ -715,7 +719,7 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path, int bExclusive)
|
||||
dev->device_handle = open(path, O_RDWR);
|
||||
|
||||
/* If we have a good handle, return it. */
|
||||
if (dev->device_handle > 0) {
|
||||
if (dev->device_handle >= 0) {
|
||||
|
||||
/* Get the report descriptor */
|
||||
int res, desc_size = 0;
|
||||
@@ -741,7 +745,7 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path, int bExclusive)
|
||||
rpt_desc.size);
|
||||
}
|
||||
|
||||
dev->is_bluetooth = (is_bluetooth(dev) == 1);
|
||||
dev->needs_ble_hack = (is_BLE(dev) == 1);
|
||||
|
||||
return dev;
|
||||
}
|
||||
@@ -840,8 +844,8 @@ int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data,
|
||||
{
|
||||
int res;
|
||||
|
||||
/* It looks like HIDIOCGFEATURE() on Bluetooth devices doesn't return the report number */
|
||||
if (dev->is_bluetooth) {
|
||||
/* It looks like HIDIOCGFEATURE() on Bluetooth LE devices doesn't return the report number */
|
||||
if (dev->needs_ble_hack) {
|
||||
data[1] = data[0];
|
||||
++data;
|
||||
--length;
|
||||
@@ -849,7 +853,7 @@ int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data,
|
||||
res = ioctl(dev->device_handle, HIDIOCGFEATURE(length), data);
|
||||
if (res < 0)
|
||||
perror("ioctl (GFEATURE)");
|
||||
else if (dev->is_bluetooth)
|
||||
else if (dev->needs_ble_hack)
|
||||
++res;
|
||||
|
||||
return res;
|
||||
|
111
externals/SDL/src/hidapi/windows/hid.c
vendored
111
externals/SDL/src/hidapi/windows/hid.c
vendored
@@ -68,6 +68,13 @@ typedef LONG NTSTATUS;
|
||||
report that we've seen is ~200-250ms so let's double that */
|
||||
#define HID_WRITE_TIMEOUT_MILLISECONDS 500
|
||||
|
||||
/* We will only enumerate devices that match these usages */
|
||||
#define USAGE_PAGE_GENERIC_DESKTOP 0x0001
|
||||
#define USAGE_JOYSTICK 0x0004
|
||||
#define USAGE_GAMEPAD 0x0005
|
||||
#define USAGE_MULTIAXISCONTROLLER 0x0008
|
||||
#define USB_VENDOR_VALVE 0x28de
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -307,25 +314,25 @@ int HID_API_EXPORT hid_exit(void)
|
||||
|
||||
int hid_blacklist(unsigned short vendor_id, unsigned short product_id)
|
||||
{
|
||||
// Corsair Gaming keyboard - Causes deadlock when asking for device details
|
||||
if ( vendor_id == 0x1B1C && product_id == 0x1B3D )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
size_t i;
|
||||
static const struct { unsigned short vid; unsigned short pid; } known_bad[] = {
|
||||
/* Causes deadlock when asking for device details... */
|
||||
{ 0x1B1C, 0x1B3D }, /* Corsair Gaming keyboard */
|
||||
{ 0x1532, 0x0109 }, /* Razer Lycosa Gaming keyboard */
|
||||
{ 0x1532, 0x010B }, /* Razer Arctosa Gaming keyboard */
|
||||
{ 0x045E, 0x0822 }, /* Microsoft Precision Mouse */
|
||||
|
||||
// SPEEDLINK COMPETITION PRO - turns into an Android controller when enumerated
|
||||
if ( vendor_id == 0x0738 && product_id == 0x2217 )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
/* Turns into an Android controller when enumerated... */
|
||||
{ 0x0738, 0x2217 } /* SPEEDLINK COMPETITION PRO */
|
||||
};
|
||||
|
||||
// Sound BlasterX G1 - Causes 10 second stalls when asking for manufacturer's string
|
||||
if ( vendor_id == 0x041E && product_id == 0x3249 )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
for (i = 0; i < (sizeof(known_bad)/sizeof(known_bad[0])); i++) {
|
||||
if ((vendor_id == known_bad[i].vid) && (product_id == known_bad[i].pid)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id)
|
||||
@@ -402,6 +409,11 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
|
||||
goto cont;
|
||||
}
|
||||
|
||||
/* XInput devices don't get real HID reports and are better handled by the raw input driver */
|
||||
if (strstr(device_interface_detail_data->DevicePath, "&ig_") != NULL) {
|
||||
goto cont;
|
||||
}
|
||||
|
||||
/* Make sure this device is of Setup Class "HIDClass" and has a
|
||||
driver bound to it. */
|
||||
/* In the main HIDAPI tree this is a loop which will erroneously open
|
||||
@@ -444,7 +456,7 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
|
||||
if (write_handle == INVALID_HANDLE_VALUE) {
|
||||
/* Unable to open the device. */
|
||||
//register_error(dev, "CreateFile");
|
||||
goto cont_close;
|
||||
goto cont;
|
||||
}
|
||||
|
||||
|
||||
@@ -469,6 +481,30 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
|
||||
wchar_t wstr[WSTR_LEN]; /* TODO: Determine Size */
|
||||
size_t len;
|
||||
|
||||
/* Get the Usage Page and Usage for this device. */
|
||||
hidp_res = HidD_GetPreparsedData(write_handle, &pp_data);
|
||||
if (hidp_res) {
|
||||
nt_res = HidP_GetCaps(pp_data, &caps);
|
||||
HidD_FreePreparsedData(pp_data);
|
||||
if (nt_res != HIDP_STATUS_SUCCESS) {
|
||||
goto cont_close;
|
||||
}
|
||||
}
|
||||
else {
|
||||
goto cont_close;
|
||||
}
|
||||
|
||||
/* SDL Modification: Ignore the device if it's not a gamepad. This limits compatibility
|
||||
risk from devices that may respond poorly to our string queries below. */
|
||||
if (attrib.VendorID != USB_VENDOR_VALVE) {
|
||||
if (caps.UsagePage != USAGE_PAGE_GENERIC_DESKTOP) {
|
||||
goto cont_close;
|
||||
}
|
||||
if (caps.Usage != USAGE_JOYSTICK && caps.Usage != USAGE_GAMEPAD && caps.Usage != USAGE_MULTIAXISCONTROLLER) {
|
||||
goto cont_close;
|
||||
}
|
||||
}
|
||||
|
||||
/* VID/PID match. Create the record. */
|
||||
tmp = (struct hid_device_info*) calloc(1, sizeof(struct hid_device_info));
|
||||
if (cur_dev) {
|
||||
@@ -478,20 +514,10 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
|
||||
root = tmp;
|
||||
}
|
||||
cur_dev = tmp;
|
||||
|
||||
/* Get the Usage Page and Usage for this device. */
|
||||
hidp_res = HidD_GetPreparsedData(write_handle, &pp_data);
|
||||
if (hidp_res) {
|
||||
nt_res = HidP_GetCaps(pp_data, &caps);
|
||||
if (nt_res == HIDP_STATUS_SUCCESS) {
|
||||
cur_dev->usage_page = caps.UsagePage;
|
||||
cur_dev->usage = caps.Usage;
|
||||
}
|
||||
|
||||
HidD_FreePreparsedData(pp_data);
|
||||
}
|
||||
|
||||
/* Fill out the record */
|
||||
cur_dev->usage_page = caps.UsagePage;
|
||||
cur_dev->usage = caps.Usage;
|
||||
cur_dev->next = NULL;
|
||||
str = device_interface_detail_data->DevicePath;
|
||||
if (str) {
|
||||
@@ -694,6 +720,14 @@ static int hid_write_timeout(hid_device *dev, const unsigned char *data, size_t
|
||||
size_t stashed_length = length;
|
||||
unsigned char *buf;
|
||||
|
||||
#if 1
|
||||
/* If the application is writing to the device, it knows how much data to write.
|
||||
* This matches the behavior on other platforms. It's also important when writing
|
||||
* to Sony game controllers over Bluetooth, where there's a CRC at the end which
|
||||
* must not be tampered with.
|
||||
*/
|
||||
buf = (unsigned char *) data;
|
||||
#else
|
||||
/* Make sure the right number of bytes are passed to WriteFile. Windows
|
||||
expects the number of bytes which are in the _longest_ report (plus
|
||||
one for the report number) bytes even if the data is a report
|
||||
@@ -711,6 +745,7 @@ static int hid_write_timeout(hid_device *dev, const unsigned char *data, size_t
|
||||
memset(buf + length, 0, dev->output_report_length - length);
|
||||
length = dev->output_report_length;
|
||||
}
|
||||
#endif
|
||||
if (length > 512)
|
||||
{
|
||||
return hid_write_output_report( dev, data, stashed_length );
|
||||
@@ -891,12 +926,6 @@ int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *dev, unsigned
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* bytes_returned does not include the first byte which contains the
|
||||
report ID. The data buffer actually contains one more byte than
|
||||
bytes_returned. */
|
||||
bytes_returned++;
|
||||
|
||||
|
||||
return bytes_returned;
|
||||
#endif
|
||||
}
|
||||
@@ -973,23 +1002,23 @@ HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev)
|
||||
/*#define S11*/
|
||||
#define P32
|
||||
#ifdef S11
|
||||
unsigned short VendorID = 0xa0a0;
|
||||
unsigned short VendorID = 0xa0a0;
|
||||
unsigned short ProductID = 0x0001;
|
||||
#endif
|
||||
|
||||
#ifdef P32
|
||||
unsigned short VendorID = 0x04d8;
|
||||
unsigned short VendorID = 0x04d8;
|
||||
unsigned short ProductID = 0x3f;
|
||||
#endif
|
||||
|
||||
#ifdef PICPGM
|
||||
unsigned short VendorID = 0x04d8;
|
||||
unsigned short ProductID = 0x0033;
|
||||
unsigned short VendorID = 0x04d8;
|
||||
unsigned short ProductID = 0x0033;
|
||||
#endif
|
||||
|
||||
int __cdecl main(int argc, char* argv[])
|
||||
{
|
||||
int res;
|
||||
int i, res;
|
||||
unsigned char buf[65];
|
||||
|
||||
UNREFERENCED_PARAMETER(argc);
|
||||
@@ -1025,7 +1054,7 @@ int __cdecl main(int argc, char* argv[])
|
||||
printf("Unable to read()\n");
|
||||
|
||||
/* Print out the returned buffer. */
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (i = 0; i < 4; i++)
|
||||
printf("buf[%d]: %d\n", i, buf[i]);
|
||||
|
||||
return 0;
|
||||
|
791
externals/SDL/src/joystick/SDL_gamecontroller.c
vendored
791
externals/SDL/src/joystick/SDL_gamecontroller.c
vendored
File diff suppressed because it is too large
Load Diff
326
externals/SDL/src/joystick/SDL_gamecontrollerdb.h
vendored
326
externals/SDL/src/joystick/SDL_gamecontrollerdb.h
vendored
@@ -34,21 +34,57 @@ static const char *s_ControllerMappings [] =
|
||||
#if SDL_JOYSTICK_XINPUT
|
||||
"xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
#endif
|
||||
#if SDL_JOYSTICK_WGI
|
||||
"030000007e0500000920000000007701,Nintendo Switch Pro Controller,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"030000007e0500000920000000007701,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"0300000032150000000a000000007703,Razer Atrox Arcade Stick,a:b0,b:b1,dpdown:b12,dpleft:b13,dpright:b11,dpup:b10,leftshoulder:b4,lefttrigger:b8,rightshoulder:b5,righttrigger:b9,x:b2,y:b3,",
|
||||
#endif
|
||||
#if SDL_JOYSTICK_DINPUT
|
||||
"03000000fa2d00000100000000000000,3DRUDDER,leftx:a0,lefty:a1,rightx:a5,righty:a2,",
|
||||
"03000000c82d00000090000000000000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,",
|
||||
"03000000c82d00001038000000000000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,",
|
||||
"03000000c82d00000650000000000000,8BitDo M30 GamePad,a:b0,b:b1,back:b10,guide:b2,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,start:b11,x:b3,y:b4,",
|
||||
"03000000c82d00005106000000000000,8BitDo M30 GamePad,a:b0,b:b1,back:b10,guide:b2,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,start:b11,x:b3,y:b4,",
|
||||
"030000003512000012ab000000000000,8BitDo NES30 GamePad,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,",
|
||||
"03000000022000000090000000000000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,",
|
||||
"03000000203800000900000000000000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,",
|
||||
"03000000c82d00000060000000000000,8BitDo SF30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,",
|
||||
"03000000c82d00000061000000000000,8BitDo SF30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,",
|
||||
"03000000102800000900000000000000,8BitDo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,",
|
||||
"03000000c82d00000160000000000000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,",
|
||||
"03000000a00500003232000000000000,8BitDo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,",
|
||||
"03000000c82d00002038000000000000,8BitDo,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,",
|
||||
"03000000c82d00000090000000000000,8BitDo FC30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000090000000000000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00001038000000000000,8BitDo FC30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00001038000000000000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000650000000000000,8BitDo M30 Gamepad,a:b0,b:b1,back:b10,guide:b2,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000650000000000000,8BitDo M30 Gamepad,a:b1,b:b0,back:b10,guide:b2,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00005106000000000000,8BitDo M30 Gamepad,a:b0,b:b1,back:b10,guide:b2,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00005106000000000000,8BitDo M30 Gamepad,a:b1,b:b0,back:b10,guide:b2,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00001590000000000000,8BitDo N30 Pro 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00001590000000000000,8BitDo N30 Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00006528000000000000,8BitDo N30 Pro 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00006528000000000000,8BitDo N30 Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"030000003512000012ab000000000000,8BitDo NES30 Gamepad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"030000003512000012ab000000000000,8BitDo NES30 Gamepad,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000022000000090000000000000,8BitDo NES30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000022000000090000000000000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000203800000900000000000000,8BitDo NES30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000203800000900000000000000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00002038000000000000,8BitDo NES30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00002038000000000000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000060000000000000,8BitDo SF30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000060000000000000,8BitDo SF30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000061000000000000,8BitDo SF30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000061000000000000,8BitDo SF30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000102800000900000000000000,8BitDo SFC30 Gamepad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000102800000900000000000000,8BitDo SFC30 Gamepad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00001290000000000000,8BitDo SN30 Gamepad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00001290000000000000,8BitDo SN30 Gamepad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00006228000000000000,8BitDo SN30 Gamepad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00006228000000000000,8BitDo SN30 Gamepad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000260000000000000,8BitDo SN30 Pro+,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000260000000000000,8BitDo SN30 Pro+,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000261000000000000,8BitDo SN30 Pro+,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000261000000000000,8BitDo SN30 Pro+,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000160000000000000,8BitDo SN30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000160000000000000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"030000003512000020ab000000000000,8BitDo SNES30 Gamepad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"030000003512000020ab000000000000,8BitDo SNES30 Gamepad,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00001890000000000000,8BitDo Zero 2,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00001890000000000000,8BitDo Zero 2,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00003032000000000000,8BitDo Zero 2,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00003032000000000000,8BitDo Zero 2,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000a00500003232000000000000,8BitDo Zero Gamepad,a:b0,b:b1,back:b10,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000a00500003232000000000000,8BitDo Zero Gamepad,a:b1,b:b0,back:b10,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"030000008f0e00001200000000000000,Acme GA-02,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,",
|
||||
"03000000fa190000f0ff000000000000,Acteck AGJ-3200,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
|
||||
"03000000341a00003608000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
@@ -96,11 +132,12 @@ static const char *s_ControllerMappings [] =
|
||||
"03000000300f00000b01000000000000,GGE909 Recoil Pad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,",
|
||||
"03000000790000002201000000000000,Game Controller for PC,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
|
||||
"0300000066f700000100000000000000,Game VIB Joystick,a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,start:b11,x:b0,y:b1,",
|
||||
"03000000280400000140000000000000,GamePad Pro USB,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
|
||||
"03000000ac0500003d03000000000000,GameSir,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
|
||||
"03000000ac0500004d04000000000000,GameSir,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
|
||||
"03000000ffff00000000000000000000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
||||
"03000000c01100000140000000000000,GameStop PS4 Fun Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"03000000260900002625000000000000,Gamecube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,lefttrigger:a4,leftx:a0,lefty:a1,righttrigger:a5,rightx:a2,righty:a3,start:b7,x:b2,y:b3,",
|
||||
"03000000280400000140000000000000,Gamepad Pro USB,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
|
||||
"030000005c1a00003330000000000000,Genius MaxFire Grandias 12V,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b4,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b2,y:b3,",
|
||||
"030000008305000031b0000000000000,Genius Maxfire Blaze 3,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
||||
"03000000451300000010000000000000,Genius Maxfire Grandias 12,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
||||
@@ -142,9 +179,11 @@ static const char *s_ControllerMappings [] =
|
||||
"030000006d04000018c2000000000000,Logitech F510 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"030000006d04000019c2000000000000,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */
|
||||
"03000000380700008081000000000000,MADCATZ SFV Arcade FightStick Alpha PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"03000000380700006382000000000000,MLG GamePad PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"03000000380700006382000000000000,MLG Gamepad PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"03000000c62400002a89000000000000,MOGA XP5-A Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
|
||||
"03000000c62400002b89000000000000,MOGA XP5-A Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
|
||||
"03000000c62400001a89000000000000,MOGA XP5-X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
|
||||
"03000000c62400001b89000000000000,MOGA XP5-X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
|
||||
"03000000250900006688000000000000,MP-8866 Super Dual Box,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,",
|
||||
"03000000380700006652000000000000,Mad Catz C.T.R.L.R,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,",
|
||||
"03000000380700005032000000000000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
@@ -161,7 +200,6 @@ static const char *s_ControllerMappings [] =
|
||||
"03000000380700003888000000000000,Madcatz Arcade Fightstick TE S+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"030000002a0600001024000000000000,Matricom,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b2,y:b3,",
|
||||
"03000000250900000128000000000000,Mayflash Arcade Stick,a:b1,b:b2,back:b8,leftshoulder:b0,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b3,righttrigger:b7,start:b9,x:b5,y:b6,",
|
||||
"03000000790000004318000000000000,Mayflash GameCube Controller Adapter,a:b1,b:b2,back:b0,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b0,leftshoulder:b4,leftstick:b0,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b0,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,",
|
||||
"03000000790000004418000000000000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,",
|
||||
"030000008f0e00001030000000000000,Mayflash USB Adapter for original Sega Saturn controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b5,rightshoulder:b2,righttrigger:b7,start:b9,x:b3,y:b4,",
|
||||
"0300000025090000e803000000000000,Mayflash Wii Classic Controller,a:b1,b:b0,back:b8,dpdown:b13,dpleft:b12,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,",
|
||||
@@ -170,9 +208,12 @@ static const char *s_ControllerMappings [] =
|
||||
"030000006b140000010c000000000000,NACON GC-400ES,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
||||
"030000001008000001e5000000000000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,",
|
||||
"03000000152000000182000000000000,NGDS,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,",
|
||||
"030000004b120000014d000000000000,NYKO AIRFLO,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:a3,leftstick:a0,lefttrigger:b6,rightshoulder:b5,rightstick:a2,righttrigger:b7,start:b9,x:b2,y:b3,",
|
||||
"030000004b120000014d000000000000,NYKO AIRFLO EX,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,",
|
||||
"03000000790000004318000000000000,Nintendo GameCube Controller,a:b1,b:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000790000004318000000000000,Nintendo GameCube Controller,a:b1,b:b0,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b2,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000bd12000015d0000000000000,Nintendo Retrolink USB Super SNES Classic Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b9,x:b3,y:b0,",
|
||||
"030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
||||
"030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"030000000d0500000308000000000000,Nostromo N45,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b12,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b10,x:b2,y:b3,",
|
||||
"03000000d62000006d57000000000000,OPP PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"03000000362800000100000000000000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b13,rightx:a3,righty:a4,x:b1,y:b2,",
|
||||
@@ -199,6 +240,7 @@ static const char *s_ControllerMappings [] =
|
||||
"030000004c050000a00b000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"030000004c050000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"030000004c050000cc09000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"030000004c050000e60c000000000000,PS5 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"030000008f0e00000300000000000000,Piranha xtreme,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,",
|
||||
"03000000d62000006dca000000000000,PowerA Pro Ex,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"03000000d62000009557000000000000,Pro Elite PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
@@ -230,6 +272,7 @@ static const char *s_ControllerMappings [] =
|
||||
"0300000000f000000300000000000000,RetroUSB.com RetroPad,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,",
|
||||
"0300000000f00000f100000000000000,RetroUSB.com Super RetroPort,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,",
|
||||
"03000000790000001100000000000000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,",
|
||||
"030000006b140000130d000000000000,Revolution Pro Controller 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"030000006b140000010d000000000000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"030000006f0e00001e01000000000000,Rock Candy PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"030000006f0e00002801000000000000,Rock Candy PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
@@ -238,6 +281,7 @@ static const char *s_ControllerMappings [] =
|
||||
"03000000341a00000908000000000000,SL-6566,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
||||
"03000000790000001c18000000000000,STK-7024X,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
|
||||
"03000000ff1100003133000000000000,SVEN X-PAD,a:b2,b:b3,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,rightx:a2,righty:a4,start:b5,x:b0,y:b1,",
|
||||
"03000000457500002211000000000000,SZMY-POWER PC Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"03000000a306000023f6000000000000,Saitek Cyborg V.1 Game pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,",
|
||||
"03000000a30600001af5000000000000,Saitek Cyborg,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,",
|
||||
"03000000300f00001201000000000000,Saitek Dual Analog Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,",
|
||||
@@ -261,6 +305,7 @@ static const char *s_ControllerMappings [] =
|
||||
"030000004f04000007d0000000000000,T Mini Wireless,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"03000000fa1900000706000000000000,Team 5,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
|
||||
"03000000b50700001203000000000000,Techmobility X6-38V,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,",
|
||||
"030000004f0400000ed0000000000000,ThrustMaster eSwap PRO Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"030000004f04000015b3000000000000,Thrustmaster Dual Analog 4,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,",
|
||||
"030000004f04000023b3000000000000,Thrustmaster Dual Trigger 3-in-1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"030000004f04000004b3000000000000,Thrustmaster Firestorm Dual Power 3,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,",
|
||||
@@ -271,13 +316,13 @@ static const char *s_ControllerMappings [] =
|
||||
"03000000b80500000210000000000000,Trust Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
|
||||
"03000000d90400000200000000000000,TwinShock PS2,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,",
|
||||
"03000000300f00000701000000000000,USB 4-Axis 12-Button Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,",
|
||||
"03000000341a00002308000000000000,USB Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
||||
"030000005509000000b4000000000000,USB Gamepad,a:b10,b:b11,back:b5,dpdown:b1,dpleft:b2,dpright:b3,dpup:b0,guide:b14,leftshoulder:b8,leftstick:b6,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b7,righttrigger:a5,rightx:a2,righty:a3,start:b4,x:b12,y:b13,",
|
||||
"030000006b1400000203000000000000,USB Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
||||
"03000000790000000a00000000000000,USB Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,",
|
||||
"03000000f0250000c183000000000000,USB Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"03000000ff1100004133000000000000,USB Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a4,righty:a2,start:b9,x:b3,y:b0,",
|
||||
"03000000632500002305000000000000,USB Vibration Joystick (BM),a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
|
||||
"03000000341a00002308000000000000,USB gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
||||
"030000005509000000b4000000000000,USB gamepad,a:b10,b:b11,back:b5,dpdown:b1,dpleft:b2,dpright:b3,dpup:b0,guide:b14,leftshoulder:b8,leftstick:b6,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b7,righttrigger:a5,rightx:a2,righty:a3,start:b4,x:b12,y:b13,",
|
||||
"030000006b1400000203000000000000,USB gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
||||
"03000000790000000a00000000000000,USB gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,",
|
||||
"03000000f0250000c183000000000000,USB gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"03000000ff1100004133000000000000,USB gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a4,righty:a2,start:b9,x:b3,y:b0,",
|
||||
"03000000790000001b18000000000000,Venom Arcade Joystick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
|
||||
"030000006f0e00000302000000000000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
|
||||
"030000006f0e00000702000000000000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
|
||||
@@ -285,24 +330,53 @@ static const char *s_ControllerMappings [] =
|
||||
"03000000341a00000608000000000000,Xeox,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
||||
"03000000172700004431000000000000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a7,rightx:a2,righty:a5,start:b11,x:b3,y:b4,",
|
||||
"03000000790000004f18000000000000,ZD-T Android,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
|
||||
"03000000120c0000101e000000000000,ZEROPLUS P4 Wired Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"03000000d81d00000f00000000000000,iBUFFALO BSGP1204 Series,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
|
||||
"03000000d81d00001000000000000000,iBUFFALO BSGP1204P Series,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
|
||||
"03000000830500006020000000000000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,",
|
||||
"03000000830500006020000000000000,iBuffalo SNES Controller,a:b0,b:b1,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000830500006020000000000000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"030000004f04000003d0000000000000,run'n'drive,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b7,leftshoulder:a3,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:a4,rightstick:b11,righttrigger:b5,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"03000000101c0000171c000000000000,uRage Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
|
||||
#endif
|
||||
#if defined(__MACOSX__)
|
||||
"03000000c82d00000090000001000000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,",
|
||||
"03000000c82d00001038000000010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,",
|
||||
"03000000c82d00000650000001000000,8BitDo M30 GamePad,a:b0,b:b1,back:b10,guide:b2,leftshoulder:b6,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a5,start:b11,x:b3,y:b4,",
|
||||
"03000000c82d00005106000000010000,8BitDo M30 GamePad,a:b0,b:b1,back:b10,guide:b2,leftshoulder:b6,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,start:b11,x:b3,y:b4,",
|
||||
"030000003512000012ab000001000000,8BitDo NES30 GamePad,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,",
|
||||
"03000000022000000090000001000000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,",
|
||||
"03000000203800000900000000010000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,",
|
||||
"03000000102800000900000000000000,8BitDo SFC30 GamePad Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,",
|
||||
"03000000c82d00000160000001000000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,",
|
||||
"03000000a00500003232000008010000,8BitDo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,",
|
||||
"03000000a00500003232000009010000,8BitDo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,",
|
||||
"03000000c82d00000090000001000000,8BitDo FC30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000090000001000000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00001038000000010000,8BitDo FC30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00001038000000010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000650000001000000,8BitDo M30 Gamepad,a:b0,b:b1,back:b10,guide:b2,leftshoulder:b6,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a5,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000650000001000000,8BitDo M30 Gamepad,a:b1,b:b0,back:b10,guide:b2,leftshoulder:b6,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a5,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00005106000000010000,8BitDo M30 Gamepad,a:b0,b:b1,back:b10,guide:b2,leftshoulder:b6,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00005106000000010000,8BitDo M30 Gamepad,a:b1,b:b0,back:b10,guide:b2,leftshoulder:b6,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00001590000001000000,8BitDo N30 Pro 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00001590000001000000,8BitDo N30 Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00006528000000010000,8BitDo N30 Pro 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00006528000000010000,8BitDo N30 Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"030000003512000012ab000001000000,8BitDo NES30 Gamepad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"030000003512000012ab000001000000,8BitDo NES30 Gamepad,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000022000000090000001000000,8BitDo NES30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000022000000090000001000000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000203800000900000000010000,8BitDo NES30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000203800000900000000010000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000102800000900000000000000,8BitDo SFC30 Gamepad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000102800000900000000000000,8BitDo SFC30 Gamepad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00001290000001000000,8BitDo SN30 Gamepad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00001290000001000000,8BitDo SN30 Gamepad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000260000001000000,8BitDo SN30 Pro+,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000260000001000000,8BitDo SN30 Pro+,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000261000000010000,8BitDo SN30 Pro+,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000261000000010000,8BitDo SN30 Pro+,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000160000001000000,8BitDo SN30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000160000001000000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00001890000001000000,8BitDo Zero 2,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00001890000001000000,8BitDo Zero 2,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00003032000000010000,8BitDo Zero 2,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00003032000000010000,8BitDo Zero 2,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000a00500003232000008010000,8BitDo Zero Gamepad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000a00500003232000008010000,8BitDo Zero Gamepad,a:b1,b:b2,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000a00500003232000009010000,8BitDo Zero Gamepad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000a00500003232000009010000,8BitDo Zero Gamepad,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c62400001a89000000010000,BDA MOGA XP5-X Plus,a:b0,b:b1,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b14,leftshoulder:b6,leftstick:b15,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b16,righttrigger:a4,rightx:a2,righty:a3,start:b13,x:b3,y:b4,",
|
||||
"03000000c62400001b89000000010000,BDA MOGA XP5-X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
|
||||
"03000000d62000002a79000000010000,BDA PS4 Fightpad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"030000008305000031b0000000000000,Cideko AK08b,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"03000000260900008888000088020000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,",
|
||||
@@ -311,10 +385,12 @@ static const char *s_ControllerMappings [] =
|
||||
"030000000d0f00008500000000010000,Fighting Commander,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"03000000790000000600000000000000,G-Shark GP-702,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,",
|
||||
"0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
||||
"03000000c01100000140000000010000,GameStop PS4 Fun Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"03000000ad1b000001f9000000000000,Gamestop BB-070 X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
|
||||
"030000000d0f00005f00000000000000,HORI Fighting Commander 4 PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"030000000d0f00005e00000000000000,HORI Fighting Commander 4 PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"030000000d0f00004d00000000000000,HORI Gem Pad 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"030000000d0f0000aa00000072050000,HORI Real Arcade Pro,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
|
||||
"030000000d0f00006e00000000010000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"030000000d0f00006600000000010000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"030000000d0f00006600000000000000,HORIPAD FPS PLUS 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
@@ -340,6 +416,7 @@ static const char *s_ControllerMappings [] =
|
||||
"03000000790000000018000000000000,Mayflash WiiU Pro Game Controller Adapter (DInput),a:b4,b:b8,back:b32,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b16,leftstick:b40,lefttrigger:b24,leftx:a0,lefty:a4,rightshoulder:b20,rightstick:b44,righttrigger:b28,rightx:a8,righty:a12,start:b36,x:b0,y:b12,",
|
||||
"030000001008000001e5000006010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,",
|
||||
"03000000550900001472000025050000,NVIDIA Controller v01.04,a:b0,b:b1,back:b17,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b4,leftstick:b7,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a5,start:b6,x:b2,y:b3,",
|
||||
"030000004b120000014d000000010000,NYKO AIRFLO EX,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,",
|
||||
"030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
||||
"030000006f0e00000901000002010000,PDP Versus Fighting Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
|
||||
"030000004c0500006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,",
|
||||
@@ -348,6 +425,7 @@ static const char *s_ControllerMappings [] =
|
||||
"030000004c050000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"030000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"030000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"050000004c050000e60c000000010000,PS5 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"030000008f0e00000300000000000000,Piranha xtreme,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,",
|
||||
"030000008916000000fd000000000000,Razer Onza TE,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
|
||||
"03000000321500000204000000010000,Razer Panthera (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
@@ -359,8 +437,10 @@ static const char *s_ControllerMappings [] =
|
||||
"0300000032150000030a000000000000,Razer Wildcat,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
|
||||
"03000000790000001100000000000000,Retrolink Classic Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a3,lefty:a4,rightshoulder:b5,start:b9,x:b3,y:b0,",
|
||||
"03000000790000001100000006010000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,",
|
||||
"030000006b140000130d000000010000,Revolution Pro Controller 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"030000006b140000010d000000010000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"030000003512000021ab000000000000,SFC30 Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,",
|
||||
"03000000457500002211000000010000,SZMY-POWER PC Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"03000000b40400000a01000000000000,Sega Saturn USB Gamepad,a:b0,b:b1,back:b5,guide:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b8,x:b3,y:b4,",
|
||||
"03000000811700007e05000000000000,Sega Saturn,a:b2,b:b4,dpdown:b16,dpleft:b15,dpright:b14,dpup:b17,leftshoulder:b8,lefttrigger:a5,leftx:a0,lefty:a2,rightshoulder:b9,righttrigger:a4,start:b13,x:b0,y:b6,",
|
||||
"030000004c050000cc09000000000000,Sony DualShock 4 V2,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
@@ -372,6 +452,7 @@ static const char *s_ControllerMappings [] =
|
||||
"03000000381000002014000001000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,x:b2,y:b3,",
|
||||
"03000000110100001714000000000000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,start:b12,x:b2,y:b3,",
|
||||
"03000000110100001714000020010000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,start:b12,x:b2,y:b3,",
|
||||
"030000004f0400000ed0000000020000,ThrustMaster eSwap PRO Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"030000004f04000015b3000000000000,Thrustmaster Dual Analog 3.2,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,",
|
||||
"030000004f04000000b3000000000000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,",
|
||||
"03000000bd12000015d0000000000000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b9,x:b3,y:b0,",
|
||||
@@ -393,31 +474,69 @@ static const char *s_ControllerMappings [] =
|
||||
"030000005e040000fd02000003090000,Xbox Wireless Controller,a:b0,b:b1,back:b16,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
|
||||
"03000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,",
|
||||
"03000000120c0000100e000000010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"03000000830500006020000000010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,",
|
||||
"03000000120c0000101e000000010000,ZEROPLUS P4 Wired Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"03000000830500006020000000010000,iBuffalo SNES Controller,a:b0,b:b1,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000830500006020000000010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000830500006020000000000000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,back:b6,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b3,y:b2,",
|
||||
#endif
|
||||
#if defined(__LINUX__)
|
||||
"03000000c82d00000090000011010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,",
|
||||
"05000000c82d00001038000000010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,",
|
||||
"03000000c82d00000650000011010000,8BitDo M30 GamePad,a:b0,b:b1,back:b10,guide:b2,leftshoulder:b6,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a5,start:b11,x:b3,y:b4,",
|
||||
"05000000c82d00005106000000010000,8BitDo M30 gamepad,a:b0,b:b1,back:b10,guide:b2,leftshoulder:b6,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,start:b11,x:b3,y:b4,",
|
||||
"030000003512000012ab000010010000,8BitDo NES30 GamePad,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,",
|
||||
"03000000022000000090000011010000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,",
|
||||
"03000000c82d00000190000011010000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,",
|
||||
"05000000203800000900000000010000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,",
|
||||
"05000000c82d00002038000000010000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,",
|
||||
"05000000c82d00000061000000010000,8BitDo SF30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,",
|
||||
"05000000102800000900000000010000,8BitDo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,",
|
||||
"05000000c82d00003028000000010000,8BitDo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,",
|
||||
"03000000c82d00000160000011010000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,",
|
||||
"05000000a00500003232000001000000,8BitDo Zero GamePad,a:b0,b:b1,back:b10,dpdown:b122,dpleft:b119,dpright:b120,dpup:b117,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,",
|
||||
"05000000a00500003232000008010000,8BitDo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,",
|
||||
"03000000c82d00000090000011010000,8BitDo FC30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000090000011010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d00001038000000010000,8BitDo FC30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d00001038000000010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000650000011010000,8BitDo M30 Gamepad,a:b0,b:b1,back:b10,guide:b2,leftshoulder:b6,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a5,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d00005106000000010000,8BitDo M30 Gamepad,a:b1,b:b0,back:b10,guide:b2,leftshoulder:b6,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00001590000011010000,8BitDo N30 Pro 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00001590000011010000,8BitDo N30 Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d00006528000000010000,8BitDo N30 Pro 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d00006528000000010000,8BitDo N30 Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"030000003512000012ab000010010000,8BitDo NES30 Gamepad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"030000003512000012ab000010010000,8BitDo NES30 Gamepad,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000022000000090000011010000,8BitDo NES30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000022000000090000011010000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000190000011010000,8BitDo NES30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000190000011010000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000203800000900000000010000,8BitDo NES30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000203800000900000000010000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d00002038000000010000,8BitDo NES30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d00002038000000010000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d00000061000000010000,8BitDo SF30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d00000061000000010000,8BitDo SF30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000102800000900000000010000,8BitDo SFC30 Gamepad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000102800000900000000010000,8BitDo SFC30 Gamepad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d00003028000000010000,8BitDo SFC30 Gamepad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d00003028000000010000,8BitDo SFC30 Gamepad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000260000011010000,8BitDo SN30 Pro+,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000260000011010000,8BitDo SN30 Pro+,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d00000261000000010000,8BitDo SN30 Pro+,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d00000261000000010000,8BitDo SN30 Pro+,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000160000011010000,8BitDo SN30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00000160000011010000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"030000003512000020ab000010010000,8BitDo SNES30 Gamepad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"030000003512000020ab000010010000,8BitDo SNES30 Gamepad,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000202800000900000000010000,8BitDo SNES30 Gamepad,a:b0,b:b1,back:b10,dpdown:b122,dpleft:b119,dpright:b120,dpup:b117,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000202800000900000000010000,8BitDo SNES30 Gamepad,a:b1,b:b0,back:b10,dpdown:b122,dpleft:b119,dpright:b120,dpup:b117,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00001890000011010000,8BitDo Zero 2,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00001890000011010000,8BitDo Zero 2,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d00003032000000010000,8BitDo Zero 2,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d00003032000000010000,8BitDo Zero 2,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000a00500003232000001000000,8BitDo Zero Gamepad,a:b0,b:b1,back:b10,dpdown:b122,dpleft:b119,dpright:b120,dpup:b117,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000a00500003232000001000000,8BitDo Zero Gamepad,a:b1,b:b0,back:b10,dpdown:b122,dpleft:b119,dpright:b120,dpup:b117,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000a00500003232000008010000,8BitDo Zero Gamepad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000a00500003232000008010000,8BitDo Zero Gamepad,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00001290000011010000,8Bitdo SN30 Gamepad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000c82d00001290000011010000,8Bitdo SN30 Gamepad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d00006228000000010000,8Bitdo SN30 Gamepad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d00006228000000010000,8Bitdo SN30 Gamepad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000050b00000045000031000000,ASUS Gamepad,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b10,x:b2,y:b3,",
|
||||
"05000000050b00000045000040000000,ASUS Gamepad,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b10,x:b2,y:b3,",
|
||||
"030000006f0e00003901000020060000,Afterglow Controller for Xbox One,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"030000006f0e00003901000000430000,Afterglow Prismatic Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"030000006f0e00001302000000010000,Afterglow,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"03000000100000008200000011010000,Akishop Customs PS360+ v1.66,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
|
||||
"05000000491900000204000021000000,Amazon Fire Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b17,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b12,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
|
||||
"03000000790000003018000011010000,Arcade Fightstick F300,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
|
||||
"03000000c62400001b89000011010000,BDA MOGA XP5-X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
|
||||
"03000000d62000002a79000011010000,BDA PS4 Fightpad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"03000000b40400000a01000000010000,CYPRESS USB Gamepad,a:b0,b:b1,back:b5,guide:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b8,x:b3,y:b4,",
|
||||
"03000000ffff0000ffff000000010000,Chinese-made Xbox Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,",
|
||||
@@ -427,16 +546,17 @@ static const char *s_ControllerMappings [] =
|
||||
"03000000790000000600000010010000,DragonRise Inc. Generic USB Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,",
|
||||
"030000006f0e00003001000001010000,EA Sports PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"0300000079000000d418000000010000,GPD Win 2 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"0500000047532067616d657061640000,GS gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
||||
"0500000047532067616d657061640000,GS Gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
||||
"03000000341a000005f7000010010000,GameCube {HuiJia USB box},a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,",
|
||||
"03000000bc2000000055000011010000,GameSir G3w,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
|
||||
"0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
||||
"03000000c01100000140000011010000,GameStop PS4 Fun Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"030000006f0e00000104000000010000,Gamestop Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"030000008f0e00000800000010010000,Gasia Co. Ltd PS(R) Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
|
||||
"030000006f0e00001304000000010000,Generic X-Box pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"03000000f0250000c183000010010000,Goodbetterbest Ltd USB Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"03000000280400000140000000010000,Gravis GamePad Pro USB ,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
|
||||
"030000008f0e00000610000000010000,GreenAsia Electronics 4Axes 12Keys GamePad ,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a3,righty:a2,start:b11,x:b3,y:b0,",
|
||||
"03000000280400000140000000010000,Gravis Gamepad Pro USB ,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
|
||||
"030000008f0e00000610000000010000,GreenAsia Electronics 4Axes 12Keys Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a3,righty:a2,start:b11,x:b3,y:b0,",
|
||||
"030000008f0e00001200000010010000,GreenAsia Inc. USB Joystick,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,",
|
||||
"03000000c9110000f055000011010000,HJC Game GAMEPAD,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
||||
"030000000d0f00001000000011010000,HORI CO. LTD. FIGHTING STICK 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
|
||||
@@ -445,6 +565,8 @@ static const char *s_ControllerMappings [] =
|
||||
"030000000d0f00006b00000011010000,HORI CO. LTD. Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"030000000d0f00008400000011010000,HORI Fighting Commander,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"030000000d0f00008500000010010000,HORI Fighting Commander,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"030000000d0f0000d800000072056800,HORI Real Arcade Pro S,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
|
||||
"030000000d0f0000aa00000011010000,HORI Real Arcade Pro,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
|
||||
"030000000d0f00006e00000011010000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"030000000d0f00006600000011010000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"030000000d0f00006700000001010000,HORIPAD ONE,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
@@ -469,11 +591,11 @@ static const char *s_ControllerMappings [] =
|
||||
"030000006d0400001ec2000020200000,Logitech F510 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"030000006d04000019c2000011010000,Logitech F710 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */
|
||||
"030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"030000006d04000015c2000010010000,Logitech Logitech Extreme 3D,a:b0,b:b4,back:b6,guide:b8,leftshoulder:b9,leftstick:h0.8,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:h0.2,start:b7,x:b2,y:b5,",
|
||||
"030000006d04000018c2000010010000,Logitech RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"030000006d04000011c2000010010000,Logitech WingMan Cordless RumblePad,a:b0,b:b1,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b6,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b10,rightx:a3,righty:a4,start:b8,x:b3,y:b4,",
|
||||
"03000000c62400002b89000011010000,MOGA XP5-A Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
|
||||
"05000000c62400002a89000000010000,MOGA XP5-A Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b22,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
|
||||
"05000000c62400001a89000000010000,MOGA XP5-X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
|
||||
"03000000250900006688000000010000,MP-8866 Super Dual Box,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,",
|
||||
"05000000380700006652000025010000,Mad Catz C.T.R.L.R ,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"03000000380700005032000011010000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
@@ -502,10 +624,13 @@ static const char *s_ControllerMappings [] =
|
||||
"030000001008000001e5000010010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,",
|
||||
"03000000550900001472000011010000,NVIDIA Controller v01.04,a:b0,b:b1,back:b14,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b17,leftshoulder:b4,leftstick:b7,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a5,start:b6,x:b2,y:b3,",
|
||||
"03000000550900001072000011010000,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b13,leftshoulder:b4,leftstick:b8,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,",
|
||||
"030000004b120000014d000000010000,NYKO AIRFLO EX,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,",
|
||||
"03000000451300000830000010010000,NYKO CORE,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"03000000790000004318000010010000,Nintendo GameCube Controller,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,",
|
||||
"03000000790000004318000010010000,Nintendo GameCube Controller,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000790000004318000010010000,Nintendo GameCube Controller,a:b1,b:b0,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b2,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"030000007e0500003703000000016800,Nintendo GameCube Controller,a:b0,b:b2,dpdown:b6,dpleft:b4,dpright:b5,dpup:b7,lefttrigger:a4,leftx:a0,lefty:a1~,rightshoulder:b9,righttrigger:a5,rightx:a2,righty:a3~,start:b8,x:b1,y:b3,",
|
||||
"050000007e0500000920000001000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
||||
"050000007e0500000920000001000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"050000007e0500000920000001000000,Nintendo Switch Pro Controller,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,",
|
||||
"05000000010000000100000003000000,Nintendo Wiimote,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
||||
"030000000d0500000308000010010000,Nostromo n45 Dual Analog Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b12,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b10,x:b2,y:b3,",
|
||||
@@ -540,6 +665,8 @@ static const char *s_ControllerMappings [] =
|
||||
"050000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"050000004c050000cc09000000810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,",
|
||||
"050000004c050000cc09000001800000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,",
|
||||
"030000004c050000e60c000011010000,PS5 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"050000004c050000e60c000000010000,PS5 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"030000004c050000da0c000011010000,Playstation Controller,a:b2,b:b1,back:b8,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,",
|
||||
"03000000c62400000053000000010000,PowerA,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"03000000300f00001211000011010000,QanBa Arcade JoyStick,a:b2,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b6,start:b9,x:b1,y:b3,",
|
||||
@@ -558,12 +685,14 @@ static const char *s_ControllerMappings [] =
|
||||
"0300000032150000030a000001010000,Razer Wildcat,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"0300000000f000000300000000010000,RetroPad,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,",
|
||||
"03000000790000001100000010010000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,",
|
||||
"030000006b140000130d000011010000,Revolution Pro Controller 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"030000006b140000010d000011010000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"030000006f0e00001e01000011010000,Rock Candy PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"030000006f0e00004601000001010000,Rock Candy Xbox One Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"030000006f0e00001f01000000010000,Rock Candy,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"03000000632500007505000010010000,SHANWAN PS3/PC Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
|
||||
"03000000341a00000908000010010000,SL-6566,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
||||
"03000000457500002211000010010000,SZMY-POWER PC Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"03000000a306000023f6000011010000,Saitek Cyborg V.1 Game Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,",
|
||||
"03000000a30600000cff000010010000,Saitek P2500 Force Rumble Pad,a:b2,b:b3,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,x:b0,y:b1,",
|
||||
"03000000a30600000c04000011010000,Saitek P2900 Wireless Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b12,x:b0,y:b3,",
|
||||
@@ -577,18 +706,20 @@ static const char *s_ControllerMappings [] =
|
||||
"030000005e0400008e02000020200000,SpeedLink XEOX Pro Analog Gamepad pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"030000005e0400008e02000073050000,Speedlink TORID Wireless Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"03000000d11800000094000011010000,Stadia Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,",
|
||||
"03000000de2800000112000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
|
||||
"03000000de2800000211000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
|
||||
"03000000de2800004211000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
|
||||
"03000000de2800000112000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
|
||||
"03000000de2800000211000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
|
||||
"03000000de2800004211000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
|
||||
"03000000de280000fc11000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"05000000de2800000212000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
|
||||
"05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
|
||||
"05000000de2800000611000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
|
||||
"05000000de2800000212000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
|
||||
"05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
|
||||
"05000000de2800000611000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
|
||||
"03000000de280000ff11000001000000,Steam Virtual Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"0500000011010000311400001b010000,SteelSeries Stratus Duo,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b32,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
|
||||
"05000000110100001914000009010000,SteelSeries Stratus XL,a:b0,b:b1,back:b17,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b18,leftshoulder:b6,leftstick:b13,lefttrigger:+a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:+a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
|
||||
"03000000ad1b000038f0000090040000,Street Fighter IV FightStick TE,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"03000000666600000488000000010000,Super Joy Box 5 Pro,a:b2,b:b1,back:b9,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,",
|
||||
"0300000000f00000f100000000010000,Super RetroPort,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,",
|
||||
"030000004f0400000ed0000011010000,ThrustMaster eSwap PRO Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"030000004f04000020b3000010010000,Thrustmaster 2 in 1 DT,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,",
|
||||
"030000004f04000015b3000010010000,Thrustmaster Dual Analog 4,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,",
|
||||
"030000004f04000023b3000000010000,Thrustmaster Dual Trigger 3-in-1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
@@ -599,8 +730,8 @@ static const char *s_ControllerMappings [] =
|
||||
"03000000d814000007cd000011010000,Toodles 2008 Chimp PC/PS3,a:b0,b:b1,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b3,y:b2,",
|
||||
"03000000100800000100000010010000,Twin USB PS2 Adapter,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,",
|
||||
"03000000100800000300000010010000,USB Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,",
|
||||
"03000000790000000600000007010000,USB Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,",
|
||||
"03000000790000001100000000010000,USB Gamepad1,a:b2,b:b1,back:b8,dpdown:a0,dpleft:a1,dpright:a2,dpup:a4,start:b9,",
|
||||
"03000000790000000600000007010000,USB gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,",
|
||||
"05000000ac0500003232000001000000,VR-BOX,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b2,y:b3,",
|
||||
"030000006f0e00000302000011010000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
|
||||
"030000006f0e00000702000011010000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
|
||||
@@ -624,52 +755,97 @@ static const char *s_ControllerMappings [] =
|
||||
"05000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,",
|
||||
"03000000c0160000e105000001010000,Xin-Mo Xin-Mo Dual Arcade,a:b4,b:b3,back:b6,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b9,leftshoulder:b2,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b1,y:b0,",
|
||||
"03000000120c0000100e000011010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"03000000120c0000101e000011010000,ZEROPLUS P4 Wired Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"03000000666600006706000000010000,boom PSX to PC Converter,a:b2,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,",
|
||||
"030000000d0f00000d00000000010000,hori,a:b0,b:b6,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b3,leftx:b4,lefty:b5,rightshoulder:b7,start:b9,x:b1,y:b2,",
|
||||
"03000000830500006020000010010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,",
|
||||
"03000000830500006020000010010000,iBuffalo SNES Controller,a:b0,b:b1,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"03000000830500006020000010010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"050000006964726f69643a636f6e0000,idroid:con,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"03000000b50700001503000010010000,impact,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,",
|
||||
"030000009b2800000300000001010000,raphnet.net 4nes4snes v1.5,a:b0,b:b4,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b1,y:b5,",
|
||||
#endif
|
||||
#if defined(__ANDROID__)
|
||||
"05000000c82d000006500000ffff3f00,8BitDo M30 Gamepad,a:b0,b:b1,back:b4,guide:b17,leftshoulder:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b10,righttrigger:a4,start:b6,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d000006500000ffff3f00,8BitDo M30 Gamepad,a:b1,b:b0,back:b4,guide:b17,leftshoulder:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b10,righttrigger:a4,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d000051060000ffff3f00,8BitDo M30 Gamepad,a:b0,b:b1,back:b4,guide:b17,leftshoulder:b9,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,righttrigger:a5,start:b6,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d000051060000ffff3f00,8BitDo M30 Gamepad,a:b1,b:b0,back:b4,guide:b17,leftshoulder:b9,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,righttrigger:a5,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d000015900000ffff3f00,8BitDo N30 Pro 2,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d000015900000ffff3f00,8BitDo N30 Pro 2,a:b1,b:b0,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d000065280000ffff3f00,8BitDo N30 Pro 2,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b17,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d000065280000ffff3f00,8BitDo N30 Pro 2,a:b1,b:b0,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b17,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"050000000220000000900000ffff3f00,8BitDo NES30 Pro,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"050000000220000000900000ffff3f00,8BitDo NES30 Pro,a:b1,b:b0,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"050000002038000009000000ffff3f00,8BitDo NES30 Pro,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"050000002038000009000000ffff3f00,8BitDo NES30 Pro,a:b1,b:b0,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d000000600000ffff3f00,8BitDo SF30 Pro,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:b15,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:b16,rightx:a2,righty:a3,start:b6,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d000000600000ffff3f00,8BitDo SF30 Pro,a:b1,b:b0,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:b15,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:b16,rightx:a2,righty:a3,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d000000610000ffff3f00,8BitDo SF30 Pro,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d000000610000ffff3f00,8BitDo SF30 Pro,a:b1,b:b0,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d000012900000ffff3f00,8BitDo SN30 Gamepad,a:b0,b:b1,back:b4,leftshoulder:b9,leftx:a0,lefty:a1,rightshoulder:b10,start:b6,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d000012900000ffff3f00,8BitDo SN30 Gamepad,a:b1,b:b0,back:b4,leftshoulder:b9,leftx:a0,lefty:a1,rightshoulder:b10,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d000062280000ffff3f00,8BitDo SN30 Gamepad,a:b0,b:b1,back:b4,leftshoulder:b9,leftx:a0,lefty:a1,rightshoulder:b10,start:b6,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d000062280000ffff3f00,8BitDo SN30 Gamepad,a:b1,b:b0,back:b4,leftshoulder:b9,leftx:a0,lefty:a1,rightshoulder:b10,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d000002600000ffff0f00,8BitDo SN30 Pro+,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b17,leftshoulder:b9,leftstick:b7,lefttrigger:b15,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:b16,rightx:a2,righty:a3,start:b6,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d000002600000ffff0f00,8BitDo SN30 Pro+,a:b1,b:b0,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b17,leftshoulder:b9,leftstick:b7,lefttrigger:b15,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:b16,rightx:a2,righty:a3,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d000001600000ffff3f00,8BitDo SN30 Pro,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d000001600000ffff3f00,8BitDo SN30 Pro,a:b1,b:b0,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"050000002028000009000000ffff3f00,8BitDo SNES30 Gamepad,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"050000002028000009000000ffff3f00,8BitDo SNES30 Gamepad,a:b1,b:b0,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"050000003512000020ab000000780f00,8BitDo SNES30 Gamepad,a:b20,b:b21,back:b30,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b26,rightshoulder:b27,start:b31,x:b23,y:b24,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"050000003512000020ab000000780f00,8BitDo SNES30 Gamepad,a:b21,b:b20,back:b30,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b26,rightshoulder:b27,start:b31,x:b24,y:b23,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d000018900000ffff0f00,8BitDo Zero 2,a:b0,b:b1,back:b4,leftshoulder:b9,leftx:a0,lefty:a1,rightshoulder:b10,start:b6,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d000018900000ffff0f00,8BitDo Zero 2,a:b1,b:b0,back:b4,leftshoulder:b9,leftx:a0,lefty:a1,rightshoulder:b10,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d000030320000ffff0f00,8BitDo Zero 2,a:b0,b:b1,back:b4,leftshoulder:b9,leftx:a0,lefty:a1,rightshoulder:b10,start:b6,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000c82d000030320000ffff0f00,8BitDo Zero 2,a:b1,b:b0,back:b4,leftshoulder:b9,leftx:a0,lefty:a1,rightshoulder:b10,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"05000000d6020000e5890000dfff3f00,GPD XD Plus,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a4,rightx:a2,righty:a5,start:b6,x:b2,y:b3,",
|
||||
"0500000031366332860c44aadfff0f00,GS Gamepad,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:b15,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:b16,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
|
||||
"05000000bc20000000550000ffff3f00,GameSir G3w,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
|
||||
"050000005509000003720000cf7f3f00,NVIDIA Controller v01.01,a:b0,b:b1,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
|
||||
"050000005509000010720000ffff3f00,NVIDIA Controller v01.03,a:b0,b:b1,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
|
||||
"050000005509000014720000df7f3f00,NVIDIA Controller v01.04,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a4,rightx:a2,righty:a5,start:b6,x:b2,y:b3,",
|
||||
"050000007e05000009200000ffff0f00,Nintendo Switch Pro Controller,a:b1,b:b0,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:b15,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:b16,rightx:a2,righty:a3,sdk>=:29,start:b6,x:b3,y:b2,",
|
||||
"050000007e05000009200000ffff0f00,Nintendo Switch Pro Controller,a:b0,b:b1,back:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:b10,rightx:a2,righty:a3,sdk<=:28,start:b16,x:b17,y:b2,", /* Extremely slow in Bluetooth mode on Android */
|
||||
"050000007e05000009200000ffff0f00,Nintendo Switch Pro Controller,a:b1,b:b0,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:b15,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:b16,rightx:a2,righty:a3,start:b6,x:b3,y:b2,sdk>=:29,",
|
||||
"050000007e05000009200000ffff0f00,Nintendo Switch Pro Controller,a:b0,b:b1,back:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:b10,rightx:a2,righty:a3,start:b16,x:b17,y:b2,sdk<=:28,", /* Extremely slow in Bluetooth mode on Android */
|
||||
"050000004c05000068020000dfff3f00,PS3 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
|
||||
"030000004c050000cc09000000006800,PS4 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
|
||||
"050000004c050000c4050000fffe3f00,PS4 Controller,a:b1,b:b17,back:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:+a4,rightx:a2,righty:a5,start:b16,x:b0,y:b2,",
|
||||
"050000004c050000c4050000ffff3f00,PS4 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
|
||||
"050000004c050000cc090000fffe3f00,PS4 Controller,a:b1,b:b17,back:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:a4,rightx:a2,righty:a5,start:b16,x:b0,y:b2,",
|
||||
"050000004c050000cc090000ffff3f00,PS4 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
|
||||
"050000004c050000e60c0000fffe3f00,PS5 Controller,a:b1,b:b17,back:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:a4,rightx:a2,righty:a5,start:b16,x:b0,y:b2,",
|
||||
"05000000f8270000bf0b0000ffff3f00,Razer Kishi,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
|
||||
"050000003215000005070000ffff3f00,Razer Raiju Mobile,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
|
||||
"050000003215000007070000ffff3f00,Razer Raiju Mobile,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
|
||||
"050000003215000000090000bf7f3f00,Razer Serval,a:b0,b:b1,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,x:b2,y:b3,",
|
||||
"05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
|
||||
"05000000de2800000611000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
|
||||
"050000004f0400000ed00000fffe3f00,ThrustMaster eSwap PRO Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
|
||||
"050000005e040000fd020000ff7f3f00,Xbox One S Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
|
||||
"050000005e040000130b0000ffff3f00,Xbox One Series X Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
|
||||
"050000005e040000e00200000ffe3f00,Xbox One Wireless Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b3,leftstick:b15,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b16,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b17,y:b2,",
|
||||
"050000005e040000fd020000ffff3f00,Xbox One Wireless Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
|
||||
"050000005e04000091020000ff073f00,Xbox Wireless Controller,a:b0,b:b1,back:b4,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b2,y:b3,", /* The DPAD doesn't seem to work on this controller on Android TV? */
|
||||
"050000001727000044310000ffff3f00,XiaoMi Game Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a7,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a6,rightx:a2,righty:a5,start:b6,x:b2,y:b3,",
|
||||
"0500000083050000602000000ffe0000,iBuffalo USB 2-axis 8-button Gamepad,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b15,rightshoulder:b16,start:b10,x:b2,y:b3,",
|
||||
"0500000083050000602000000ffe0000,iBuffalo SNES Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b15,rightshoulder:b16,start:b10,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"0500000083050000602000000ffe0000,iBuffalo SNES Controller,a:b1,b:b0,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b15,rightshoulder:b16,start:b10,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
#endif
|
||||
#if defined(SDL_JOYSTICK_MFI)
|
||||
"05000000ac050000010000004f066d01,*,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a5,rightx:a3,righty:a4,x:b2,y:b3,",
|
||||
"05000000ac05000001000000cf076d01,*,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b2,y:b3,",
|
||||
"05000000ac05000001000000df076d01,*,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,",
|
||||
"05000000ac05000001000000ff076d01,*,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b2,y:b3,",
|
||||
"05000000ac050000020000004f066d02,*,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,rightshoulder:b5,x:b2,y:b3,",
|
||||
"050000004c050000cc090000df070000,DUALSHOCK 4 Wireless Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,",
|
||||
"050000004c050000cc090000df070000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,",
|
||||
"050000004c050000cc090000ff070000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b2,y:b3,",
|
||||
"050000004c050000cc090000ff870001,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,touchpad:b11,x:b2,y:b3,",
|
||||
"05000000ac0500000300000043006d03,Remote,a:b0,b:b2,leftx:a0,lefty:a1,",
|
||||
"05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
|
||||
"05000000de2800000611000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
|
||||
"050000005e040000050b0000ff070001,Xbox Elite Wireless Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b13,paddle3:b12,paddle4:b14,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b2,y:b3,",
|
||||
"050000005e040000e0020000df070000,Xbox Wireless Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,",
|
||||
"050000005e040000e0020000ff070000,Xbox Wireless Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b2,y:b3,",
|
||||
#endif
|
||||
#if defined(SDL_JOYSTICK_VIRTUAL)
|
||||
"00000000000000000000000000007601,Virtual Joystick,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
|
||||
#endif
|
||||
#if defined(SDL_JOYSTICK_EMSCRIPTEN)
|
||||
"default,Standard Gamepad,a:b0,b:b1,back:b8,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b16,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
||||
#endif
|
||||
"hidapi,*,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
806
externals/SDL/src/joystick/SDL_joystick.c
vendored
806
externals/SDL/src/joystick/SDL_joystick.c
vendored
File diff suppressed because it is too large
Load Diff
93
externals/SDL/src/joystick/SDL_joystick_c.h
vendored
93
externals/SDL/src/joystick/SDL_joystick_c.h
vendored
@@ -52,17 +52,30 @@ extern int SDL_JoystickGetDeviceIndexFromInstanceID(SDL_JoystickID instance_id);
|
||||
/* Function to extract information from an SDL joystick GUID */
|
||||
extern void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version);
|
||||
|
||||
/* Function to get a custom name for a controller manufacturer, if it's available */
|
||||
extern const char *SDL_GetCustomJoystickManufacturer(const char *manufacturer);
|
||||
|
||||
/* Function to get a custom name for a controller, if it's available */
|
||||
extern const char *SDL_GetCustomJoystickName(Uint16 vendor, Uint16 product);
|
||||
/* Function to standardize the name for a controller
|
||||
This should be freed with SDL_free() when no longer needed
|
||||
*/
|
||||
extern char *SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_name, const char *product_name);
|
||||
|
||||
/* Function to return the type of a controller */
|
||||
extern SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromVIDPID(Uint16 vendor, Uint16 product);
|
||||
extern SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromGUID(SDL_JoystickGUID guid, const char *name);
|
||||
extern SDL_GameControllerType SDL_GetJoystickGameControllerType(const char *name, Uint16 vendor, Uint16 product, int interface_number, int interface_class, int interface_subclass, int interface_protocol);
|
||||
|
||||
/* Function to return whether a joystick is an Xbox One Elite controller */
|
||||
extern SDL_bool SDL_IsJoystickXboxOneElite(Uint16 vendor_id, Uint16 product_id);
|
||||
|
||||
/* Function to return whether a joystick is an Xbox One Series X controller */
|
||||
extern SDL_bool SDL_IsJoystickXboxOneSeriesX(Uint16 vendor_id, Uint16 product_id);
|
||||
|
||||
/* Function to return whether a joystick is a PS4 controller */
|
||||
extern SDL_bool SDL_IsJoystickPS4(Uint16 vendor_id, Uint16 product_id);
|
||||
|
||||
/* Function to return whether a joystick is a PS5 controller */
|
||||
extern SDL_bool SDL_IsJoystickPS5(Uint16 vendor_id, Uint16 product_id);
|
||||
|
||||
/* Function to return whether a joystick is a Nintendo Switch Pro controller */
|
||||
extern SDL_bool SDL_IsJoystickNintendoSwitchPro(Uint16 vendor_id, Uint16 product_id);
|
||||
extern SDL_bool SDL_IsJoystickNintendoSwitchProInputOnly(Uint16 vendor_id, Uint16 product_id);
|
||||
|
||||
/* Function to return whether a joystick is a Steam Controller */
|
||||
@@ -71,9 +84,18 @@ extern SDL_bool SDL_IsJoystickSteamController(Uint16 vendor_id, Uint16 product_i
|
||||
/* Function to return whether a joystick guid comes from the XInput driver */
|
||||
extern SDL_bool SDL_IsJoystickXInput(SDL_JoystickGUID guid);
|
||||
|
||||
/* Function to return whether a joystick guid comes from the WGI driver */
|
||||
extern SDL_bool SDL_IsJoystickWGI(SDL_JoystickGUID guid);
|
||||
|
||||
/* Function to return whether a joystick guid comes from the HIDAPI driver */
|
||||
extern SDL_bool SDL_IsJoystickHIDAPI(SDL_JoystickGUID guid);
|
||||
|
||||
/* Function to return whether a joystick guid comes from the RAWINPUT driver */
|
||||
extern SDL_bool SDL_IsJoystickRAWINPUT(SDL_JoystickGUID guid);
|
||||
|
||||
/* Function to return whether a joystick guid comes from the Virtual driver */
|
||||
extern SDL_bool SDL_IsJoystickVirtual(SDL_JoystickGUID guid);
|
||||
|
||||
/* Function to return whether a joystick should be ignored */
|
||||
extern SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid);
|
||||
|
||||
@@ -87,21 +109,70 @@ extern SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUI
|
||||
extern void SDL_GameControllerHandleDelayedGuideButton(SDL_Joystick *joystick);
|
||||
|
||||
/* Internal event queueing functions */
|
||||
extern void SDL_PrivateJoystickAddTouchpad(SDL_Joystick *joystick, int nfingers);
|
||||
extern void SDL_PrivateJoystickAddSensor(SDL_Joystick *joystick, SDL_SensorType type);
|
||||
extern void SDL_PrivateJoystickAdded(SDL_JoystickID device_instance);
|
||||
extern void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance);
|
||||
extern int SDL_PrivateJoystickAxis(SDL_Joystick * joystick,
|
||||
extern int SDL_PrivateJoystickAxis(SDL_Joystick *joystick,
|
||||
Uint8 axis, Sint16 value);
|
||||
extern int SDL_PrivateJoystickBall(SDL_Joystick * joystick,
|
||||
extern int SDL_PrivateJoystickBall(SDL_Joystick *joystick,
|
||||
Uint8 ball, Sint16 xrel, Sint16 yrel);
|
||||
extern int SDL_PrivateJoystickHat(SDL_Joystick * joystick,
|
||||
extern int SDL_PrivateJoystickHat(SDL_Joystick *joystick,
|
||||
Uint8 hat, Uint8 value);
|
||||
extern int SDL_PrivateJoystickButton(SDL_Joystick * joystick,
|
||||
extern int SDL_PrivateJoystickButton(SDL_Joystick *joystick,
|
||||
Uint8 button, Uint8 state);
|
||||
extern void SDL_PrivateJoystickBatteryLevel(SDL_Joystick * joystick,
|
||||
extern int SDL_PrivateJoystickTouchpad(SDL_Joystick *joystick,
|
||||
int touchpad, int finger, Uint8 state, float x, float y, float pressure);
|
||||
extern int SDL_PrivateJoystickSensor(SDL_Joystick *joystick,
|
||||
SDL_SensorType type, const float *data, int num_values);
|
||||
extern void SDL_PrivateJoystickBatteryLevel(SDL_Joystick *joystick,
|
||||
SDL_JoystickPowerLevel ePowerLevel);
|
||||
|
||||
/* Internal sanity checking functions */
|
||||
extern SDL_bool SDL_PrivateJoystickValid(SDL_Joystick * joystick);
|
||||
extern SDL_bool SDL_PrivateJoystickValid(SDL_Joystick *joystick);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
EMappingKind_None = 0,
|
||||
EMappingKind_Button = 1,
|
||||
EMappingKind_Axis = 2,
|
||||
EMappingKind_Hat = 3
|
||||
} EMappingKind;
|
||||
|
||||
typedef struct _SDL_InputMapping
|
||||
{
|
||||
EMappingKind kind;
|
||||
Uint8 target;
|
||||
} SDL_InputMapping;
|
||||
|
||||
typedef struct _SDL_GamepadMapping
|
||||
{
|
||||
SDL_InputMapping a;
|
||||
SDL_InputMapping b;
|
||||
SDL_InputMapping x;
|
||||
SDL_InputMapping y;
|
||||
SDL_InputMapping back;
|
||||
SDL_InputMapping guide;
|
||||
SDL_InputMapping start;
|
||||
SDL_InputMapping leftstick;
|
||||
SDL_InputMapping rightstick;
|
||||
SDL_InputMapping leftshoulder;
|
||||
SDL_InputMapping rightshoulder;
|
||||
SDL_InputMapping dpup;
|
||||
SDL_InputMapping dpdown;
|
||||
SDL_InputMapping dpleft;
|
||||
SDL_InputMapping dpright;
|
||||
SDL_InputMapping leftx;
|
||||
SDL_InputMapping lefty;
|
||||
SDL_InputMapping rightx;
|
||||
SDL_InputMapping righty;
|
||||
SDL_InputMapping lefttrigger;
|
||||
SDL_InputMapping righttrigger;
|
||||
} SDL_GamepadMapping;
|
||||
|
||||
/* Function to get autodetected gamepad controller mapping from the driver */
|
||||
extern SDL_bool SDL_PrivateJoystickGetAutoGamepadMapping(int device_index,
|
||||
SDL_GamepadMapping *out);
|
||||
|
||||
#endif /* SDL_joystick_c_h_ */
|
||||
|
||||
|
61
externals/SDL/src/joystick/SDL_sysjoystick.h
vendored
61
externals/SDL/src/joystick/SDL_sysjoystick.h
vendored
@@ -39,10 +39,32 @@ typedef struct _SDL_JoystickAxisInfo
|
||||
SDL_bool sent_initial_value; /* Whether we've sent the initial axis value */
|
||||
} SDL_JoystickAxisInfo;
|
||||
|
||||
typedef struct _SDL_JoystickTouchpadFingerInfo
|
||||
{
|
||||
Uint8 state;
|
||||
float x;
|
||||
float y;
|
||||
float pressure;
|
||||
} SDL_JoystickTouchpadFingerInfo;
|
||||
|
||||
typedef struct _SDL_JoystickTouchpadInfo
|
||||
{
|
||||
int nfingers;
|
||||
SDL_JoystickTouchpadFingerInfo *fingers;
|
||||
} SDL_JoystickTouchpadInfo;
|
||||
|
||||
typedef struct _SDL_JoystickSensorInfo
|
||||
{
|
||||
SDL_SensorType type;
|
||||
SDL_bool enabled;
|
||||
float data[3]; /* If this needs to expand, update SDL_ControllerSensorEvent */
|
||||
} SDL_JoystickSensorInfo;
|
||||
|
||||
struct _SDL_Joystick
|
||||
{
|
||||
SDL_JoystickID instance_id; /* Device instance, monotonically increasing from 0 */
|
||||
char *name; /* Joystick name - system dependent */
|
||||
char *serial; /* Joystick serial */
|
||||
SDL_JoystickGUID guid; /* Joystick guid */
|
||||
|
||||
int naxes; /* Number of axis controls on the joystick */
|
||||
@@ -60,15 +82,30 @@ struct _SDL_Joystick
|
||||
int nbuttons; /* Number of buttons on the joystick */
|
||||
Uint8 *buttons; /* Current button states */
|
||||
|
||||
int ntouchpads; /* Number of touchpads on the joystick */
|
||||
SDL_JoystickTouchpadInfo *touchpads; /* Current touchpad states */
|
||||
|
||||
int nsensors; /* Number of sensors on the joystick */
|
||||
int nsensors_enabled;
|
||||
SDL_JoystickSensorInfo *sensors;
|
||||
|
||||
Uint16 low_frequency_rumble;
|
||||
Uint16 high_frequency_rumble;
|
||||
Uint32 rumble_expiration;
|
||||
|
||||
Uint16 left_trigger_rumble;
|
||||
Uint16 right_trigger_rumble;
|
||||
Uint32 trigger_rumble_expiration;
|
||||
|
||||
Uint8 led_red;
|
||||
Uint8 led_green;
|
||||
Uint8 led_blue;
|
||||
|
||||
SDL_bool attached;
|
||||
SDL_bool is_game_controller;
|
||||
SDL_bool delayed_guide_button; /* SDL_TRUE if this device has the guide button event delayed */
|
||||
SDL_bool force_recentering; /* SDL_TRUE if this device needs to have its state reset to 0 */
|
||||
SDL_JoystickPowerLevel epowerlevel; /* power level of this joystick, SDL_JOYSTICK_POWER_UNKNOWN if not supported */
|
||||
|
||||
struct _SDL_JoystickDriver *driver;
|
||||
|
||||
struct joystick_hwdata *hwdata; /* Driver dependent information */
|
||||
@@ -119,24 +156,35 @@ typedef struct _SDL_JoystickDriver
|
||||
This should fill the nbuttons and naxes fields of the joystick structure.
|
||||
It returns 0, or -1 if there is an error.
|
||||
*/
|
||||
int (*Open)(SDL_Joystick * joystick, int device_index);
|
||||
int (*Open)(SDL_Joystick *joystick, int device_index);
|
||||
|
||||
/* Rumble functionality */
|
||||
int (*Rumble)(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble);
|
||||
int (*Rumble)(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble);
|
||||
int (*RumbleTriggers)(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble);
|
||||
|
||||
/* LED functionality */
|
||||
SDL_bool (*HasLED)(SDL_Joystick *joystick);
|
||||
int (*SetLED)(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue);
|
||||
|
||||
/* Sensor functionality */
|
||||
int (*SetSensorsEnabled)(SDL_Joystick *joystick, SDL_bool enabled);
|
||||
|
||||
/* Function to update the state of a joystick - called as a device poll.
|
||||
* This function shouldn't update the joystick structure directly,
|
||||
* but instead should call SDL_PrivateJoystick*() to deliver events
|
||||
* and update joystick device state.
|
||||
*/
|
||||
void (*Update)(SDL_Joystick * joystick);
|
||||
void (*Update)(SDL_Joystick *joystick);
|
||||
|
||||
/* Function to close a joystick after use */
|
||||
void (*Close)(SDL_Joystick * joystick);
|
||||
void (*Close)(SDL_Joystick *joystick);
|
||||
|
||||
/* Function to perform any system-specific joystick related cleanup */
|
||||
void (*Quit)(void);
|
||||
|
||||
/* Function to get the autodetected controller mapping; returns false if there isn't any. */
|
||||
SDL_bool (*GetGamepadMapping)(int device_index, SDL_GamepadMapping * out);
|
||||
|
||||
} SDL_JoystickDriver;
|
||||
|
||||
/* Windows and Mac OSX has a limit of MAX_DWORD / 1000, Linux kernel has a limit of 0xFFFF */
|
||||
@@ -150,8 +198,11 @@ extern SDL_JoystickDriver SDL_DUMMY_JoystickDriver;
|
||||
extern SDL_JoystickDriver SDL_EMSCRIPTEN_JoystickDriver;
|
||||
extern SDL_JoystickDriver SDL_HAIKU_JoystickDriver;
|
||||
extern SDL_JoystickDriver SDL_HIDAPI_JoystickDriver;
|
||||
extern SDL_JoystickDriver SDL_RAWINPUT_JoystickDriver;
|
||||
extern SDL_JoystickDriver SDL_IOS_JoystickDriver;
|
||||
extern SDL_JoystickDriver SDL_LINUX_JoystickDriver;
|
||||
extern SDL_JoystickDriver SDL_VIRTUAL_JoystickDriver;
|
||||
extern SDL_JoystickDriver SDL_WGI_JoystickDriver;
|
||||
extern SDL_JoystickDriver SDL_WINDOWS_JoystickDriver;
|
||||
|
||||
#endif /* SDL_sysjoystick_h_ */
|
||||
|
@@ -18,7 +18,6 @@
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#ifdef SDL_JOYSTICK_ANDROID
|
||||
@@ -29,9 +28,7 @@
|
||||
|
||||
#include "SDL_joystick.h"
|
||||
#include "SDL_hints.h"
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_timer.h"
|
||||
#include "SDL_log.h"
|
||||
#include "SDL_sysjoystick_c.h"
|
||||
#include "../SDL_joystick_c.h"
|
||||
#include "../../events/SDL_keyboard_c.h"
|
||||
@@ -71,28 +68,6 @@ static SDL_joylist_item *SDL_joylist_tail = NULL;
|
||||
static int numjoysticks = 0;
|
||||
|
||||
|
||||
/* Public domain CRC implementation adapted from:
|
||||
http://home.thep.lu.se/~bjorn/crc/crc32_simple.c
|
||||
*/
|
||||
static Uint32 crc32_for_byte(Uint32 r)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < 8; ++i) {
|
||||
r = (r & 1? 0: (Uint32)0xEDB88320L) ^ r >> 1;
|
||||
}
|
||||
return r ^ (Uint32)0xFF000000L;
|
||||
}
|
||||
|
||||
static Uint32 crc32(const void *data, size_t count)
|
||||
{
|
||||
Uint32 crc = 0;
|
||||
int i;
|
||||
for(i = 0; i < count; ++i) {
|
||||
crc = crc32_for_byte((Uint8)crc ^ ((const Uint8*)data)[i]) ^ crc >> 8;
|
||||
}
|
||||
return crc;
|
||||
}
|
||||
|
||||
/* Function to convert Android keyCodes into SDL ones.
|
||||
* This code manipulation is done to get a sequential list of codes.
|
||||
* FIXME: This is only suited for the case where we use a fixed number of buttons determined by ANDROID_MAX_NBUTTONS
|
||||
@@ -139,16 +114,16 @@ keycode_to_SDL(int keycode)
|
||||
button = SDL_CONTROLLER_BUTTON_GUIDE;
|
||||
break;
|
||||
case AKEYCODE_BUTTON_L2:
|
||||
button = SDL_CONTROLLER_BUTTON_MAX; /* Not supported by GameController */
|
||||
button = 15;
|
||||
break;
|
||||
case AKEYCODE_BUTTON_R2:
|
||||
button = SDL_CONTROLLER_BUTTON_MAX+1; /* Not supported by GameController */
|
||||
button = 16;
|
||||
break;
|
||||
case AKEYCODE_BUTTON_C:
|
||||
button = SDL_CONTROLLER_BUTTON_MAX+2; /* Not supported by GameController */
|
||||
button = 17;
|
||||
break;
|
||||
case AKEYCODE_BUTTON_Z:
|
||||
button = SDL_CONTROLLER_BUTTON_MAX+3; /* Not supported by GameController */
|
||||
button = 18;
|
||||
break;
|
||||
|
||||
/* D-Pad key codes (API 1) */
|
||||
@@ -166,7 +141,7 @@ keycode_to_SDL(int keycode)
|
||||
break;
|
||||
case AKEYCODE_DPAD_CENTER:
|
||||
/* This is handled better by applications as the A button */
|
||||
/*button = SDL_CONTROLLER_BUTTON_MAX+4;*/ /* Not supported by GameController */
|
||||
/*button = 19;*/
|
||||
button = SDL_CONTROLLER_BUTTON_A;
|
||||
break;
|
||||
|
||||
@@ -187,7 +162,7 @@ keycode_to_SDL(int keycode)
|
||||
case AKEYCODE_BUTTON_14:
|
||||
case AKEYCODE_BUTTON_15:
|
||||
case AKEYCODE_BUTTON_16:
|
||||
button = keycode - AKEYCODE_BUTTON_1 + SDL_CONTROLLER_BUTTON_MAX + 5;
|
||||
button = 20 + (keycode - AKEYCODE_BUTTON_1);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -392,7 +367,8 @@ Android_AddJoystick(int device_id, const char *name, const char *desc, int vendo
|
||||
*guid16++ = SDL_SwapLE16(product_id);
|
||||
*guid16++ = 0;
|
||||
} else {
|
||||
Uint32 crc = crc32(desc, SDL_strlen(desc));
|
||||
Uint32 crc = 0;
|
||||
SDL_crc32(crc, desc, SDL_strlen(desc));
|
||||
SDL_memcpy(guid16, desc, SDL_min(2*sizeof(*guid16), SDL_strlen(desc)));
|
||||
guid16 += 2;
|
||||
*(Uint32 *)guid16 = SDL_SwapLE32(crc);
|
||||
@@ -410,7 +386,7 @@ Android_AddJoystick(int device_id, const char *name, const char *desc, int vendo
|
||||
SDL_zerop(item);
|
||||
item->guid = guid;
|
||||
item->device_id = device_id;
|
||||
item->name = SDL_strdup(name);
|
||||
item->name = SDL_CreateJoystickName(vendor_id, product_id, NULL, name);
|
||||
if (item->name == NULL) {
|
||||
SDL_free(item);
|
||||
return -1;
|
||||
@@ -443,7 +419,7 @@ Android_AddJoystick(int device_id, const char *name, const char *desc, int vendo
|
||||
SDL_PrivateJoystickAdded(item->device_instance);
|
||||
|
||||
#ifdef DEBUG_JOYSTICK
|
||||
SDL_Log("Added joystick %s with device_id %d", name, device_id);
|
||||
SDL_Log("Added joystick %s with device_id %d", item->name, device_id);
|
||||
#endif
|
||||
|
||||
return numjoysticks;
|
||||
@@ -634,6 +610,30 @@ ANDROID_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uin
|
||||
return SDL_Unsupported();
|
||||
}
|
||||
|
||||
static int
|
||||
ANDROID_JoystickRumbleTriggers(SDL_Joystick * joystick, Uint16 left_rumble, Uint16 right_rumble)
|
||||
{
|
||||
return SDL_Unsupported();
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
ANDROID_JoystickHasLED(SDL_Joystick * joystick)
|
||||
{
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
static int
|
||||
ANDROID_JoystickSetLED(SDL_Joystick * joystick, Uint8 red, Uint8 green, Uint8 blue)
|
||||
{
|
||||
return SDL_Unsupported();
|
||||
}
|
||||
|
||||
static int
|
||||
ANDROID_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled)
|
||||
{
|
||||
return SDL_Unsupported();
|
||||
}
|
||||
|
||||
static void
|
||||
ANDROID_JoystickUpdate(SDL_Joystick * joystick)
|
||||
{
|
||||
@@ -694,6 +694,12 @@ ANDROID_JoystickQuit(void)
|
||||
#endif /* 0 */
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
ANDROID_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out)
|
||||
{
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
SDL_JoystickDriver SDL_ANDROID_JoystickDriver =
|
||||
{
|
||||
ANDROID_JoystickInit,
|
||||
@@ -706,9 +712,14 @@ SDL_JoystickDriver SDL_ANDROID_JoystickDriver =
|
||||
ANDROID_JoystickGetDeviceInstanceID,
|
||||
ANDROID_JoystickOpen,
|
||||
ANDROID_JoystickRumble,
|
||||
ANDROID_JoystickRumbleTriggers,
|
||||
ANDROID_JoystickHasLED,
|
||||
ANDROID_JoystickSetLED,
|
||||
ANDROID_JoystickSetSensorsEnabled,
|
||||
ANDROID_JoystickUpdate,
|
||||
ANDROID_JoystickClose,
|
||||
ANDROID_JoystickQuit,
|
||||
ANDROID_JoystickGetGamepadMapping
|
||||
};
|
||||
|
||||
#endif /* SDL_JOYSTICK_ANDROID */
|
||||
|
822
externals/SDL/src/joystick/bsd/SDL_bsdjoystick.c
vendored
Executable file
822
externals/SDL/src/joystick/bsd/SDL_bsdjoystick.c
vendored
Executable file
@@ -0,0 +1,822 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#ifdef SDL_JOYSTICK_USBHID
|
||||
|
||||
/*
|
||||
* Joystick driver for the uhid(4) interface found in OpenBSD,
|
||||
* NetBSD and FreeBSD.
|
||||
*
|
||||
* Maintainer: <vedge at csoft.org>
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef __FreeBSD_kernel_version
|
||||
#define __FreeBSD_kernel_version __FreeBSD_version
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_USB_H)
|
||||
#include <usb.h>
|
||||
#endif
|
||||
#ifdef __DragonFly__
|
||||
#include <bus/u4b/usb.h>
|
||||
#include <bus/u4b/usbhid.h>
|
||||
#else
|
||||
#include <dev/usb/usb.h>
|
||||
#include <dev/usb/usbhid.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_USBHID_H)
|
||||
#include <usbhid.h>
|
||||
#elif defined(HAVE_LIBUSB_H)
|
||||
#include <libusb.h>
|
||||
#elif defined(HAVE_LIBUSBHID_H)
|
||||
#include <libusbhid.h>
|
||||
#endif
|
||||
|
||||
#if defined(__FREEBSD__) || defined(__FreeBSD_kernel__)
|
||||
#include <osreldate.h>
|
||||
#if __FreeBSD_kernel_version > 800063
|
||||
#include <dev/usb/usb_ioctl.h>
|
||||
#endif
|
||||
#include <sys/joystick.h>
|
||||
#elif defined(__DragonFly__)
|
||||
#include <bus/u4b/usb_ioctl.h>
|
||||
#include <sys/joystick.h>
|
||||
#endif
|
||||
|
||||
#if SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
|
||||
#include <machine/joystick.h>
|
||||
#endif
|
||||
|
||||
#include "SDL_joystick.h"
|
||||
#include "../SDL_sysjoystick.h"
|
||||
#include "../SDL_joystick_c.h"
|
||||
|
||||
#define MAX_UHID_JOYS 64
|
||||
#define MAX_JOY_JOYS 2
|
||||
#define MAX_JOYS (MAX_UHID_JOYS + MAX_JOY_JOYS)
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
|
||||
#define HUG_DPAD_UP 0x90
|
||||
#define HUG_DPAD_DOWN 0x91
|
||||
#define HUG_DPAD_RIGHT 0x92
|
||||
#define HUG_DPAD_LEFT 0x93
|
||||
|
||||
#define HAT_CENTERED 0x00
|
||||
#define HAT_UP 0x01
|
||||
#define HAT_RIGHT 0x02
|
||||
#define HAT_DOWN 0x04
|
||||
#define HAT_LEFT 0x08
|
||||
#define HAT_RIGHTUP (HAT_RIGHT|HAT_UP)
|
||||
#define HAT_RIGHTDOWN (HAT_RIGHT|HAT_DOWN)
|
||||
#define HAT_LEFTUP (HAT_LEFT|HAT_UP)
|
||||
#define HAT_LEFTDOWN (HAT_LEFT|HAT_DOWN)
|
||||
|
||||
/* calculate the value from the state of the dpad */
|
||||
int
|
||||
dpad_to_sdl(Sint32 *dpad)
|
||||
{
|
||||
if (dpad[2]) {
|
||||
if (dpad[0])
|
||||
return HAT_RIGHTUP;
|
||||
else if (dpad[1])
|
||||
return HAT_RIGHTDOWN;
|
||||
else
|
||||
return HAT_RIGHT;
|
||||
} else if (dpad[3]) {
|
||||
if (dpad[0])
|
||||
return HAT_LEFTUP;
|
||||
else if (dpad[1])
|
||||
return HAT_LEFTDOWN;
|
||||
else
|
||||
return HAT_LEFT;
|
||||
} else if (dpad[0]) {
|
||||
return HAT_UP;
|
||||
} else if (dpad[1]) {
|
||||
return HAT_DOWN;
|
||||
}
|
||||
return HAT_CENTERED;
|
||||
}
|
||||
#endif
|
||||
|
||||
struct report
|
||||
{
|
||||
#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000) || \
|
||||
defined(__DragonFly__)
|
||||
void *buf; /* Buffer */
|
||||
#elif defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063)
|
||||
struct usb_gen_descriptor *buf; /* Buffer */
|
||||
#else
|
||||
struct usb_ctl_report *buf; /* Buffer */
|
||||
#endif
|
||||
size_t size; /* Buffer size */
|
||||
int rid; /* Report ID */
|
||||
enum
|
||||
{
|
||||
SREPORT_UNINIT,
|
||||
SREPORT_CLEAN,
|
||||
SREPORT_DIRTY
|
||||
} status;
|
||||
};
|
||||
|
||||
static struct
|
||||
{
|
||||
int uhid_report;
|
||||
hid_kind_t kind;
|
||||
const char *name;
|
||||
} const repinfo[] = {
|
||||
{UHID_INPUT_REPORT, hid_input, "input"},
|
||||
{UHID_OUTPUT_REPORT, hid_output, "output"},
|
||||
{UHID_FEATURE_REPORT, hid_feature, "feature"}
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
REPORT_INPUT = 0,
|
||||
REPORT_OUTPUT = 1,
|
||||
REPORT_FEATURE = 2
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
JOYAXE_X,
|
||||
JOYAXE_Y,
|
||||
JOYAXE_Z,
|
||||
JOYAXE_SLIDER,
|
||||
JOYAXE_WHEEL,
|
||||
JOYAXE_RX,
|
||||
JOYAXE_RY,
|
||||
JOYAXE_RZ,
|
||||
JOYAXE_count
|
||||
};
|
||||
|
||||
struct joystick_hwdata
|
||||
{
|
||||
int fd;
|
||||
char *path;
|
||||
enum
|
||||
{
|
||||
BSDJOY_UHID, /* uhid(4) */
|
||||
BSDJOY_JOY /* joy(4) */
|
||||
} type;
|
||||
struct report_desc *repdesc;
|
||||
struct report inreport;
|
||||
int axis_map[JOYAXE_count]; /* map present JOYAXE_* to 0,1,.. */
|
||||
};
|
||||
|
||||
static char *joynames[MAX_JOYS];
|
||||
static char *joydevnames[MAX_JOYS];
|
||||
|
||||
static int report_alloc(struct report *, struct report_desc *, int);
|
||||
static void report_free(struct report *);
|
||||
|
||||
#if defined(USBHID_UCR_DATA) || (defined(__FreeBSD_kernel__) && __FreeBSD_kernel_version <= 800063)
|
||||
#define REP_BUF_DATA(rep) ((rep)->buf->ucr_data)
|
||||
#elif (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000)) || \
|
||||
defined(__DragonFly__)
|
||||
#define REP_BUF_DATA(rep) ((rep)->buf)
|
||||
#elif (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063))
|
||||
#define REP_BUF_DATA(rep) ((rep)->buf->ugd_data)
|
||||
#else
|
||||
#define REP_BUF_DATA(rep) ((rep)->buf->data)
|
||||
#endif
|
||||
|
||||
static int numjoysticks = 0;
|
||||
|
||||
static int BSD_JoystickOpen(SDL_Joystick *joy, int device_index);
|
||||
static void BSD_JoystickClose(SDL_Joystick *joy);
|
||||
|
||||
static int
|
||||
BSD_JoystickInit(void)
|
||||
{
|
||||
char s[16];
|
||||
int i, fd;
|
||||
|
||||
numjoysticks = 0;
|
||||
|
||||
SDL_memset(joynames, 0, sizeof(joynames));
|
||||
SDL_memset(joydevnames, 0, sizeof(joydevnames));
|
||||
|
||||
for (i = 0; i < MAX_UHID_JOYS; i++) {
|
||||
SDL_Joystick nj;
|
||||
|
||||
SDL_snprintf(s, SDL_arraysize(s), "/dev/uhid%d", i);
|
||||
|
||||
joynames[numjoysticks] = SDL_strdup(s);
|
||||
|
||||
if (BSD_JoystickOpen(&nj, numjoysticks) == 0) {
|
||||
BSD_JoystickClose(&nj);
|
||||
numjoysticks++;
|
||||
} else {
|
||||
SDL_free(joynames[numjoysticks]);
|
||||
joynames[numjoysticks] = NULL;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < MAX_JOY_JOYS; i++) {
|
||||
SDL_snprintf(s, SDL_arraysize(s), "/dev/joy%d", i);
|
||||
fd = open(s, O_RDONLY);
|
||||
if (fd != -1) {
|
||||
joynames[numjoysticks++] = SDL_strdup(s);
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
/* Read the default USB HID usage table. */
|
||||
hid_init(NULL);
|
||||
|
||||
return (numjoysticks);
|
||||
}
|
||||
|
||||
static int
|
||||
BSD_JoystickGetCount(void)
|
||||
{
|
||||
return numjoysticks;
|
||||
}
|
||||
|
||||
static void
|
||||
BSD_JoystickDetect(void)
|
||||
{
|
||||
}
|
||||
|
||||
static const char *
|
||||
BSD_JoystickGetDeviceName(int device_index)
|
||||
{
|
||||
if (joydevnames[device_index] != NULL) {
|
||||
return (joydevnames[device_index]);
|
||||
}
|
||||
return (joynames[device_index]);
|
||||
}
|
||||
|
||||
static int
|
||||
BSD_JoystickGetDevicePlayerIndex(int device_index)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
BSD_JoystickSetDevicePlayerIndex(int device_index, int player_index)
|
||||
{
|
||||
}
|
||||
|
||||
/* Function to perform the mapping from device index to the instance id for this index */
|
||||
static SDL_JoystickID
|
||||
BSD_JoystickGetDeviceInstanceID(int device_index)
|
||||
{
|
||||
return device_index;
|
||||
}
|
||||
|
||||
static int
|
||||
usage_to_joyaxe(unsigned usage)
|
||||
{
|
||||
int joyaxe;
|
||||
switch (usage) {
|
||||
case HUG_X:
|
||||
joyaxe = JOYAXE_X;
|
||||
break;
|
||||
case HUG_Y:
|
||||
joyaxe = JOYAXE_Y;
|
||||
break;
|
||||
case HUG_Z:
|
||||
joyaxe = JOYAXE_Z;
|
||||
break;
|
||||
case HUG_SLIDER:
|
||||
joyaxe = JOYAXE_SLIDER;
|
||||
break;
|
||||
case HUG_WHEEL:
|
||||
joyaxe = JOYAXE_WHEEL;
|
||||
break;
|
||||
case HUG_RX:
|
||||
joyaxe = JOYAXE_RX;
|
||||
break;
|
||||
case HUG_RY:
|
||||
joyaxe = JOYAXE_RY;
|
||||
break;
|
||||
case HUG_RZ:
|
||||
joyaxe = JOYAXE_RZ;
|
||||
break;
|
||||
default:
|
||||
joyaxe = -1;
|
||||
}
|
||||
return joyaxe;
|
||||
}
|
||||
|
||||
static unsigned
|
||||
hatval_to_sdl(Sint32 hatval)
|
||||
{
|
||||
static const unsigned hat_dir_map[8] = {
|
||||
SDL_HAT_UP, SDL_HAT_RIGHTUP, SDL_HAT_RIGHT, SDL_HAT_RIGHTDOWN,
|
||||
SDL_HAT_DOWN, SDL_HAT_LEFTDOWN, SDL_HAT_LEFT, SDL_HAT_LEFTUP
|
||||
};
|
||||
unsigned result;
|
||||
if ((hatval & 7) == hatval)
|
||||
result = hat_dir_map[hatval];
|
||||
else
|
||||
result = SDL_HAT_CENTERED;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
BSD_JoystickOpen(SDL_Joystick *joy, int device_index)
|
||||
{
|
||||
char *path = joynames[device_index];
|
||||
struct joystick_hwdata *hw;
|
||||
struct hid_item hitem;
|
||||
struct hid_data *hdata;
|
||||
struct report *rep = NULL;
|
||||
#if defined(__NetBSD__)
|
||||
usb_device_descriptor_t udd;
|
||||
struct usb_string_desc usd;
|
||||
#endif
|
||||
int fd;
|
||||
int i;
|
||||
|
||||
fd = open(path, O_RDONLY);
|
||||
if (fd == -1) {
|
||||
return SDL_SetError("%s: %s", path, strerror(errno));
|
||||
}
|
||||
|
||||
joy->instance_id = device_index;
|
||||
hw = (struct joystick_hwdata *)
|
||||
SDL_malloc(sizeof(struct joystick_hwdata));
|
||||
if (hw == NULL) {
|
||||
close(fd);
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
joy->hwdata = hw;
|
||||
hw->fd = fd;
|
||||
hw->path = SDL_strdup(path);
|
||||
if (!SDL_strncmp(path, "/dev/joy", 8)) {
|
||||
hw->type = BSDJOY_JOY;
|
||||
joy->naxes = 2;
|
||||
joy->nbuttons = 2;
|
||||
joy->nhats = 0;
|
||||
joy->nballs = 0;
|
||||
joydevnames[device_index] = SDL_strdup("Gameport joystick");
|
||||
goto usbend;
|
||||
} else {
|
||||
hw->type = BSDJOY_UHID;
|
||||
}
|
||||
|
||||
{
|
||||
int ax;
|
||||
for (ax = 0; ax < JOYAXE_count; ax++)
|
||||
hw->axis_map[ax] = -1;
|
||||
}
|
||||
hw->repdesc = hid_get_report_desc(fd);
|
||||
if (hw->repdesc == NULL) {
|
||||
SDL_SetError("%s: USB_GET_REPORT_DESC: %s", hw->path,
|
||||
strerror(errno));
|
||||
goto usberr;
|
||||
}
|
||||
rep = &hw->inreport;
|
||||
#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
rep->rid = hid_get_report_id(fd);
|
||||
if (rep->rid < 0) {
|
||||
#else
|
||||
if (ioctl(fd, USB_GET_REPORT_ID, &rep->rid) < 0) {
|
||||
#endif
|
||||
rep->rid = -1; /* XXX */
|
||||
}
|
||||
#if defined(__NetBSD__)
|
||||
if (ioctl(fd, USB_GET_DEVICE_DESC, &udd) == -1)
|
||||
goto desc_failed;
|
||||
|
||||
/* Get default language */
|
||||
usd.usd_string_index = USB_LANGUAGE_TABLE;
|
||||
usd.usd_language_id = 0;
|
||||
if (ioctl(fd, USB_GET_STRING_DESC, &usd) == -1 || usd.usd_desc.bLength < 4) {
|
||||
usd.usd_language_id = 0;
|
||||
} else {
|
||||
usd.usd_language_id = UGETW(usd.usd_desc.bString[0]);
|
||||
}
|
||||
|
||||
usd.usd_string_index = udd.iProduct;
|
||||
if (ioctl(fd, USB_GET_STRING_DESC, &usd) == 0) {
|
||||
char str[128];
|
||||
char *new_name = NULL;
|
||||
int i;
|
||||
for (i = 0; i < (usd.usd_desc.bLength >> 1) - 1 && i < sizeof(str) - 1; i++) {
|
||||
str[i] = UGETW(usd.usd_desc.bString[i]);
|
||||
}
|
||||
str[i] = '\0';
|
||||
asprintf(&new_name, "%s @ %s", str, path);
|
||||
if (new_name != NULL) {
|
||||
SDL_free(joydevnames[numjoysticks]);
|
||||
joydevnames[numjoysticks] = new_name;
|
||||
}
|
||||
}
|
||||
desc_failed:
|
||||
#endif
|
||||
if (report_alloc(rep, hw->repdesc, REPORT_INPUT) < 0) {
|
||||
goto usberr;
|
||||
}
|
||||
if (rep->size <= 0) {
|
||||
SDL_SetError("%s: Input report descriptor has invalid length",
|
||||
hw->path);
|
||||
goto usberr;
|
||||
}
|
||||
#if defined(USBHID_NEW) || (defined(__FREEBSD__) && __FreeBSD_kernel_version >= 500111) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
hdata = hid_start_parse(hw->repdesc, 1 << hid_input, rep->rid);
|
||||
#else
|
||||
hdata = hid_start_parse(hw->repdesc, 1 << hid_input);
|
||||
#endif
|
||||
if (hdata == NULL) {
|
||||
SDL_SetError("%s: Cannot start HID parser", hw->path);
|
||||
goto usberr;
|
||||
}
|
||||
joy->naxes = 0;
|
||||
joy->nbuttons = 0;
|
||||
joy->nhats = 0;
|
||||
joy->nballs = 0;
|
||||
for (i = 0; i < JOYAXE_count; i++)
|
||||
hw->axis_map[i] = -1;
|
||||
|
||||
while (hid_get_item(hdata, &hitem) > 0) {
|
||||
char *sp;
|
||||
const char *s;
|
||||
|
||||
switch (hitem.kind) {
|
||||
case hid_collection:
|
||||
switch (HID_PAGE(hitem.usage)) {
|
||||
case HUP_GENERIC_DESKTOP:
|
||||
switch (HID_USAGE(hitem.usage)) {
|
||||
case HUG_JOYSTICK:
|
||||
case HUG_GAME_PAD:
|
||||
s = hid_usage_in_page(hitem.usage);
|
||||
sp = SDL_malloc(SDL_strlen(s) + 5);
|
||||
SDL_snprintf(sp, SDL_strlen(s) + 5, "%s (%d)",
|
||||
s, device_index);
|
||||
joydevnames[device_index] = sp;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case hid_input:
|
||||
switch (HID_PAGE(hitem.usage)) {
|
||||
case HUP_GENERIC_DESKTOP:
|
||||
{
|
||||
unsigned usage = HID_USAGE(hitem.usage);
|
||||
int joyaxe = usage_to_joyaxe(usage);
|
||||
if (joyaxe >= 0) {
|
||||
hw->axis_map[joyaxe] = 1;
|
||||
} else if (usage == HUG_HAT_SWITCH
|
||||
#ifdef __OpenBSD__
|
||||
|| usage == HUG_DPAD_UP
|
||||
#endif
|
||||
) {
|
||||
joy->nhats++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HUP_BUTTON:
|
||||
joy->nbuttons++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
hid_end_parse(hdata);
|
||||
for (i = 0; i < JOYAXE_count; i++)
|
||||
if (hw->axis_map[i] > 0)
|
||||
hw->axis_map[i] = joy->naxes++;
|
||||
|
||||
if (joy->naxes == 0 && joy->nbuttons == 0 && joy->nhats == 0 && joy->nballs == 0) {
|
||||
SDL_SetError("%s: Not a joystick, ignoring", hw->path);
|
||||
goto usberr;
|
||||
}
|
||||
|
||||
usbend:
|
||||
/* The poll blocks the event thread. */
|
||||
fcntl(fd, F_SETFL, O_NONBLOCK);
|
||||
#ifdef __NetBSD__
|
||||
/* Flush pending events */
|
||||
if (rep) {
|
||||
while (read(joy->hwdata->fd, REP_BUF_DATA(rep), rep->size) == rep->size)
|
||||
;
|
||||
}
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
usberr:
|
||||
close(hw->fd);
|
||||
SDL_free(hw->path);
|
||||
SDL_free(hw);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
static void
|
||||
BSD_JoystickUpdate(SDL_Joystick *joy)
|
||||
{
|
||||
struct hid_item hitem;
|
||||
struct hid_data *hdata;
|
||||
struct report *rep;
|
||||
int nbutton, naxe = -1;
|
||||
Sint32 v;
|
||||
#ifdef __OpenBSD__
|
||||
Sint32 dpad[4] = {0, 0, 0, 0};
|
||||
#endif
|
||||
|
||||
#if defined(__FREEBSD__) || SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H || defined(__FreeBSD_kernel__) || defined(__DragonFly_)
|
||||
struct joystick gameport;
|
||||
static int x, y, xmin = 0xffff, ymin = 0xffff, xmax = 0, ymax = 0;
|
||||
|
||||
if (joy->hwdata->type == BSDJOY_JOY) {
|
||||
while (read(joy->hwdata->fd, &gameport, sizeof gameport) == sizeof gameport) {
|
||||
if (abs(x - gameport.x) > 8) {
|
||||
x = gameport.x;
|
||||
if (x < xmin) {
|
||||
xmin = x;
|
||||
}
|
||||
if (x > xmax) {
|
||||
xmax = x;
|
||||
}
|
||||
if (xmin == xmax) {
|
||||
xmin--;
|
||||
xmax++;
|
||||
}
|
||||
v = (Sint32) x;
|
||||
v -= (xmax + xmin + 1) / 2;
|
||||
v *= 32768 / ((xmax - xmin + 1) / 2);
|
||||
SDL_PrivateJoystickAxis(joy, 0, v);
|
||||
}
|
||||
if (abs(y - gameport.y) > 8) {
|
||||
y = gameport.y;
|
||||
if (y < ymin) {
|
||||
ymin = y;
|
||||
}
|
||||
if (y > ymax) {
|
||||
ymax = y;
|
||||
}
|
||||
if (ymin == ymax) {
|
||||
ymin--;
|
||||
ymax++;
|
||||
}
|
||||
v = (Sint32) y;
|
||||
v -= (ymax + ymin + 1) / 2;
|
||||
v *= 32768 / ((ymax - ymin + 1) / 2);
|
||||
SDL_PrivateJoystickAxis(joy, 1, v);
|
||||
}
|
||||
SDL_PrivateJoystickButton(joy, 0, gameport.b1);
|
||||
SDL_PrivateJoystickButton(joy, 1, gameport.b2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif /* defined(__FREEBSD__) || SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H */
|
||||
|
||||
rep = &joy->hwdata->inreport;
|
||||
|
||||
while (read(joy->hwdata->fd, REP_BUF_DATA(rep), rep->size) == rep->size) {
|
||||
#if defined(USBHID_NEW) || (defined(__FREEBSD__) && __FreeBSD_kernel_version >= 500111) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input, rep->rid);
|
||||
#else
|
||||
hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input);
|
||||
#endif
|
||||
if (hdata == NULL) {
|
||||
/*fprintf(stderr, "%s: Cannot start HID parser\n", joy->hwdata->path);*/
|
||||
continue;
|
||||
}
|
||||
|
||||
for (nbutton = 0; hid_get_item(hdata, &hitem) > 0;) {
|
||||
switch (hitem.kind) {
|
||||
case hid_input:
|
||||
switch (HID_PAGE(hitem.usage)) {
|
||||
case HUP_GENERIC_DESKTOP:
|
||||
{
|
||||
unsigned usage = HID_USAGE(hitem.usage);
|
||||
int joyaxe = usage_to_joyaxe(usage);
|
||||
if (joyaxe >= 0) {
|
||||
naxe = joy->hwdata->axis_map[joyaxe];
|
||||
/* scaleaxe */
|
||||
v = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
|
||||
v -= (hitem.logical_maximum +
|
||||
hitem.logical_minimum + 1) / 2;
|
||||
v *= 32768 /
|
||||
((hitem.logical_maximum -
|
||||
hitem.logical_minimum + 1) / 2);
|
||||
SDL_PrivateJoystickAxis(joy, naxe, v);
|
||||
} else if (usage == HUG_HAT_SWITCH) {
|
||||
v = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
|
||||
SDL_PrivateJoystickHat(joy, 0,
|
||||
hatval_to_sdl(v) -
|
||||
hitem.logical_minimum);
|
||||
}
|
||||
#ifdef __OpenBSD__
|
||||
else if (usage == HUG_DPAD_UP) {
|
||||
dpad[0] = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
|
||||
SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
|
||||
}
|
||||
else if (usage == HUG_DPAD_DOWN) {
|
||||
dpad[1] = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
|
||||
SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
|
||||
}
|
||||
else if (usage == HUG_DPAD_RIGHT) {
|
||||
dpad[2] = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
|
||||
SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
|
||||
}
|
||||
else if (usage == HUG_DPAD_LEFT) {
|
||||
dpad[3] = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
|
||||
SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case HUP_BUTTON:
|
||||
v = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
|
||||
SDL_PrivateJoystickButton(joy, nbutton, v);
|
||||
nbutton++;
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
hid_end_parse(hdata);
|
||||
}
|
||||
}
|
||||
|
||||
/* Function to close a joystick after use */
|
||||
static void
|
||||
BSD_JoystickClose(SDL_Joystick *joy)
|
||||
{
|
||||
if (SDL_strncmp(joy->hwdata->path, "/dev/joy", 8)) {
|
||||
report_free(&joy->hwdata->inreport);
|
||||
hid_dispose_report_desc(joy->hwdata->repdesc);
|
||||
}
|
||||
close(joy->hwdata->fd);
|
||||
SDL_free(joy->hwdata->path);
|
||||
SDL_free(joy->hwdata);
|
||||
}
|
||||
|
||||
static void
|
||||
BSD_JoystickQuit(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_JOYS; i++) {
|
||||
SDL_free(joynames[i]);
|
||||
SDL_free(joydevnames[i]);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static SDL_JoystickGUID
|
||||
BSD_JoystickGetDeviceGUID( int device_index )
|
||||
{
|
||||
SDL_JoystickGUID guid;
|
||||
/* the GUID is just the first 16 chars of the name for now */
|
||||
const char *name = BSD_JoystickGetDeviceName( device_index );
|
||||
SDL_zero( guid );
|
||||
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
|
||||
return guid;
|
||||
}
|
||||
|
||||
static int
|
||||
report_alloc(struct report *r, struct report_desc *rd, int repind)
|
||||
{
|
||||
int len;
|
||||
|
||||
#ifdef __DragonFly__
|
||||
len = hid_report_size(rd, repinfo[repind].kind, r->rid);
|
||||
#elif __FREEBSD__
|
||||
# if (__FreeBSD_kernel_version >= 460000) || defined(__FreeBSD_kernel__)
|
||||
# if (__FreeBSD_kernel_version <= 500111)
|
||||
len = hid_report_size(rd, r->rid, repinfo[repind].kind);
|
||||
# else
|
||||
len = hid_report_size(rd, repinfo[repind].kind, r->rid);
|
||||
# endif
|
||||
# else
|
||||
len = hid_report_size(rd, repinfo[repind].kind, &r->rid);
|
||||
# endif
|
||||
#else
|
||||
# ifdef USBHID_NEW
|
||||
len = hid_report_size(rd, repinfo[repind].kind, r->rid);
|
||||
# else
|
||||
len = hid_report_size(rd, repinfo[repind].kind, &r->rid);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
if (len < 0) {
|
||||
return SDL_SetError("Negative HID report size");
|
||||
}
|
||||
r->size = len;
|
||||
|
||||
if (r->size > 0) {
|
||||
#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000) || defined(__DragonFly__)
|
||||
r->buf = SDL_malloc(r->size);
|
||||
#else
|
||||
r->buf = SDL_malloc(sizeof(*r->buf) - sizeof(REP_BUF_DATA(r)) +
|
||||
r->size);
|
||||
#endif
|
||||
if (r->buf == NULL) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
} else {
|
||||
r->buf = NULL;
|
||||
}
|
||||
|
||||
r->status = SREPORT_CLEAN;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
report_free(struct report *r)
|
||||
{
|
||||
SDL_free(r->buf);
|
||||
r->status = SREPORT_UNINIT;
|
||||
}
|
||||
|
||||
static int
|
||||
BSD_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
|
||||
{
|
||||
return SDL_Unsupported();
|
||||
}
|
||||
|
||||
static int
|
||||
BSD_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble)
|
||||
{
|
||||
return SDL_Unsupported();
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
BSD_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out)
|
||||
{
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
BSD_JoystickHasLED(SDL_Joystick *joystick)
|
||||
{
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
static int
|
||||
BSD_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue)
|
||||
{
|
||||
return SDL_Unsupported();
|
||||
}
|
||||
|
||||
static int
|
||||
BSD_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled)
|
||||
{
|
||||
return SDL_Unsupported();
|
||||
}
|
||||
|
||||
SDL_JoystickDriver SDL_BSD_JoystickDriver =
|
||||
{
|
||||
BSD_JoystickInit,
|
||||
BSD_JoystickGetCount,
|
||||
BSD_JoystickDetect,
|
||||
BSD_JoystickGetDeviceName,
|
||||
BSD_JoystickGetDevicePlayerIndex,
|
||||
BSD_JoystickSetDevicePlayerIndex,
|
||||
BSD_JoystickGetDeviceGUID,
|
||||
BSD_JoystickGetDeviceInstanceID,
|
||||
BSD_JoystickOpen,
|
||||
BSD_JoystickRumble,
|
||||
BSD_JoystickRumbleTriggers,
|
||||
BSD_JoystickHasLED,
|
||||
BSD_JoystickSetLED,
|
||||
BSD_JoystickSetSensorsEnabled,
|
||||
BSD_JoystickUpdate,
|
||||
BSD_JoystickClose,
|
||||
BSD_JoystickQuit,
|
||||
BSD_JoystickGetGamepadMapping
|
||||
};
|
||||
|
||||
#endif /* SDL_JOYSTICK_USBHID */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
15
externals/SDL/src/joystick/check_8bitdo.sh
vendored
Executable file
15
externals/SDL/src/joystick/check_8bitdo.sh
vendored
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Check to make sure 8BitDo controller configurations are correct
|
||||
|
||||
echo "Expected output:"
|
||||
cat <<__EOF__
|
||||
"050000003512000020ab000000780f00,8BitDo SNES30 Gamepad,a:b20,b:b21,back:b30,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b26,rightshoulder:b27,start:b31,x:b23,y:b24,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"050000003512000020ab000000780f00,8BitDo SNES30 Gamepad,a:b21,b:b20,back:b30,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b26,rightshoulder:b27,start:b31,x:b24,y:b23,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
|
||||
__EOF__
|
||||
|
||||
echo "Actual output:"
|
||||
fgrep 8BitDo SDL_gamecontrollerdb.h | fgrep -v hint
|
||||
egrep "hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1" SDL_gamecontrollerdb.h | fgrep -i 8bit | fgrep -v x:b2,y:b3 | fgrep -v x:b3,y:b4
|
||||
egrep "hint:.SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1" SDL_gamecontrollerdb.h | fgrep -i 8bit | fgrep -v x:b3,y:b2 | fgrep -v x:b4,y:b3
|
72
externals/SDL/src/joystick/controller_type.h
vendored
72
externals/SDL/src/joystick/controller_type.h
vendored
@@ -54,6 +54,7 @@ typedef enum
|
||||
k_eControllerType_SwitchInputOnlyController = 42,
|
||||
k_eControllerType_MobileTouch = 43,
|
||||
k_eControllerType_XInputSwitchController = 44, // Client-side only, used to mark Switch-compatible controllers as not supporting Switch controller protocol
|
||||
k_eControllerType_PS5Controller = 45,
|
||||
k_eControllerType_LastController, // Don't add game controllers below this enumeration - this enumeration can change value
|
||||
|
||||
// Keyboards and Mice
|
||||
@@ -163,6 +164,19 @@ static const ControllerDescription_t arrControllers[] = {
|
||||
{ MAKE_CONTROLLER_ID( 0x7545, 0x0104 ), k_eControllerType_PS4Controller, NULL }, // Armor 3 or Level Up Cobra - At least one variant has gyro
|
||||
{ MAKE_CONTROLLER_ID( 0x9886, 0x0025 ), k_eControllerType_PS4Controller, NULL }, // Astro C40
|
||||
{ MAKE_CONTROLLER_ID( 0x0e6f, 0x0207 ), k_eControllerType_PS4Controller, NULL }, // Victrix Pro Fightstick w/ Touchpad for PS4
|
||||
// Removing the Giotek because there were a bunch of help tickets from users w/ issues including from non-PS4 controller users. This VID/PID is probably used in different FW's
|
||||
// { MAKE_CONTROLLER_ID( 0x7545, 0x1122 ), k_eControllerType_PS4Controller, NULL }, // Giotek VX4 - trackpad/gyro don't work. Had to not filter on interface info. Light bar is flaky, but works.
|
||||
{ MAKE_CONTROLLER_ID( 0x044f, 0xd00e ), k_eControllerType_PS4Controller, NULL }, // Thrustmast Eswap Pro - No gyro and lightbar doesn't change color. Works otherwise
|
||||
{ MAKE_CONTROLLER_ID( 0x0c12, 0x1e10 ), k_eControllerType_PS4Controller, NULL }, // P4 Wired Gamepad generic knock off - lightbar but not trackpad or gyro
|
||||
{ MAKE_CONTROLLER_ID( 0x146b, 0x0d09 ), k_eControllerType_PS4Controller, NULL }, // NACON Daija Fight Stick - touchpad but no gyro/rumble
|
||||
{ MAKE_CONTROLLER_ID( 0x146b, 0x0d10 ), k_eControllerType_PS4Controller, NULL }, // NACON Revolution Unlimited
|
||||
{ MAKE_CONTROLLER_ID( 0x146b, 0x0d08 ), k_eControllerType_PS4Controller, NULL }, // NACON Revolution Unlimited Wireless Dongle
|
||||
{ MAKE_CONTROLLER_ID( 0x146b, 0x0d06 ), k_eControllerType_PS4Controller, NULL }, // NACON Asymetrical Controller Wireless Dongle -- show up as ps4 until you connect controller to it then it reboots into Xbox controller with different vvid/pid
|
||||
{ MAKE_CONTROLLER_ID( 0x146b, 0x1103 ), k_eControllerType_PS4Controller, NULL }, // NACON Asymetrical Controller -- on windows this doesn't enumerate
|
||||
{ MAKE_CONTROLLER_ID( 0x0f0d, 0x0123 ), k_eControllerType_PS4Controller, NULL }, // HORI Wireless Controller Light (Japan only) - only over bt- over usb is xbox and pid 0x0124
|
||||
{ MAKE_CONTROLLER_ID( 0x146b, 0x0d13 ), k_eControllerType_PS4Controller, NULL }, // NACON Revolution 3
|
||||
|
||||
{ MAKE_CONTROLLER_ID( 0x054c, 0x0ce6 ), k_eControllerType_PS5Controller, NULL }, // Sony PS5 Controller
|
||||
|
||||
{ MAKE_CONTROLLER_ID( 0x0079, 0x0006 ), k_eControllerType_UnknownNonSteamController, NULL }, // DragonRise Generic USB PCB, sometimes configured as a PC Twin Shock Controller - looks like a DS3 but the face buttons are 1-4 instead of symbols
|
||||
|
||||
@@ -306,9 +320,11 @@ static const ControllerDescription_t arrControllers[] = {
|
||||
{ MAKE_CONTROLLER_ID( 0x045e, 0x02e3 ), k_eControllerType_XBoxOneController, "Xbox One Elite Controller" }, // Microsoft X-Box One Elite pad
|
||||
{ MAKE_CONTROLLER_ID( 0x045e, 0x02ea ), k_eControllerType_XBoxOneController, "Xbox One S Controller" }, // Microsoft X-Box One S pad
|
||||
{ MAKE_CONTROLLER_ID( 0x045e, 0x02fd ), k_eControllerType_XBoxOneController, "Xbox One S Controller" }, // Microsoft X-Box One S pad (Bluetooth)
|
||||
{ MAKE_CONTROLLER_ID( 0x045e, 0x02ff ), k_eControllerType_XBoxOneController, "Xbox One Elite Controller" }, // Microsoft X-Box One Elite pad
|
||||
{ MAKE_CONTROLLER_ID( 0x045e, 0x02ff ), k_eControllerType_XBoxOneController, NULL }, // Microsoft X-Box One controller with the RAWINPUT driver on Windows
|
||||
{ MAKE_CONTROLLER_ID( 0x045e, 0x0b00 ), k_eControllerType_XBoxOneController, "Xbox One Elite 2 Controller" }, // Microsoft X-Box One Elite Series 2 pad
|
||||
{ MAKE_CONTROLLER_ID( 0x045e, 0x0b05 ), k_eControllerType_XBoxOneController, "Xbox One Elite 2 Controller" }, // Microsoft X-Box One Elite Series 2 pad (Bluetooth)
|
||||
{ MAKE_CONTROLLER_ID( 0x045e, 0x0b12 ), k_eControllerType_XBoxOneController, "Xbox One Series X Controller" }, // Microsoft X-Box One Elite Series X pad
|
||||
{ MAKE_CONTROLLER_ID( 0x045e, 0x0b13 ), k_eControllerType_XBoxOneController, "Xbox One Series X Controller" }, // Microsoft X-Box One Elite Series X pad (Bluetooth)
|
||||
{ MAKE_CONTROLLER_ID( 0x0738, 0x4a01 ), k_eControllerType_XBoxOneController, NULL }, // Mad Catz FightStick TE 2
|
||||
{ MAKE_CONTROLLER_ID( 0x0e6f, 0x0139 ), k_eControllerType_XBoxOneController, "PDP Xbox One Afterglow" }, // PDP Afterglow Wired Controller for Xbox One
|
||||
{ MAKE_CONTROLLER_ID( 0x0e6f, 0x013B ), k_eControllerType_XBoxOneController, "PDP Xbox One Face-Off Controller" }, // PDP Face-Off Gamepad for Xbox One
|
||||
@@ -380,6 +396,7 @@ static const ControllerDescription_t arrControllers[] = {
|
||||
{ MAKE_CONTROLLER_ID( 0x0f0d, 0x00c5 ), k_eControllerType_XBoxOneController, NULL }, // HORI Fighting Commander
|
||||
{ MAKE_CONTROLLER_ID( 0x1532, 0x0a00 ), k_eControllerType_XBoxOneController, NULL }, // Razer Atrox Arcade Stick
|
||||
{ MAKE_CONTROLLER_ID( 0x1532, 0x0a03 ), k_eControllerType_XBoxOneController, NULL }, // Razer Wildcat
|
||||
{ MAKE_CONTROLLER_ID( 0x1532, 0x0a14 ), k_eControllerType_XBoxOneController, NULL }, // Razer Wolverine Ultimate
|
||||
{ MAKE_CONTROLLER_ID( 0x24c6, 0x541a ), k_eControllerType_XBoxOneController, NULL }, // PowerA Xbox One Mini Wired Controller
|
||||
{ MAKE_CONTROLLER_ID( 0x24c6, 0x542a ), k_eControllerType_XBoxOneController, NULL }, // Xbox ONE spectra
|
||||
{ MAKE_CONTROLLER_ID( 0x24c6, 0x543a ), k_eControllerType_XBoxOneController, "PowerA XBox One Controller" }, // PowerA Xbox ONE liquid metal controller
|
||||
@@ -392,6 +409,7 @@ static const ControllerDescription_t arrControllers[] = {
|
||||
{ MAKE_CONTROLLER_ID( 0x2e24, 0x0652 ), k_eControllerType_XBoxOneController, NULL }, // Hyperkin Duke
|
||||
{ MAKE_CONTROLLER_ID( 0x2e24, 0x1618 ), k_eControllerType_XBoxOneController, NULL }, // Hyperkin Duke
|
||||
{ MAKE_CONTROLLER_ID( 0x2e24, 0x1688 ), k_eControllerType_XBoxOneController, NULL }, // Hyperkin X91
|
||||
{ MAKE_CONTROLLER_ID( 0x146b, 0x0611 ), k_eControllerType_XBoxOneController, NULL }, // Xbox Controller Mode for NACON Revolution 3
|
||||
|
||||
// These have been added via Minidump for unrecognized Xinput controller assert
|
||||
{ MAKE_CONTROLLER_ID( 0x0000, 0x0000 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller
|
||||
@@ -450,10 +468,9 @@ static const ControllerDescription_t arrControllers[] = {
|
||||
{ MAKE_CONTROLLER_ID( 0x1430, 0x2a9 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller
|
||||
{ MAKE_CONTROLLER_ID( 0x1430, 0x70b ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller
|
||||
{ MAKE_CONTROLLER_ID( 0x146b, 0x604 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller
|
||||
{ MAKE_CONTROLLER_ID( 0x146b, 0x605 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller
|
||||
{ MAKE_CONTROLLER_ID( 0x146b, 0x605 ), k_eControllerType_XBoxOneController, NULL }, // NACON PS4 controller in Xbox mode - might also be other bigben brand xbox controllers
|
||||
{ MAKE_CONTROLLER_ID( 0x146b, 0x606 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller
|
||||
{ MAKE_CONTROLLER_ID( 0x146b, 0x609 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller
|
||||
{ MAKE_CONTROLLER_ID( 0x1532, 0xa14 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller
|
||||
{ MAKE_CONTROLLER_ID( 0x1bad, 0x28e ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller
|
||||
{ MAKE_CONTROLLER_ID( 0x1bad, 0x2a0 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller
|
||||
{ MAKE_CONTROLLER_ID( 0x1bad, 0x5500 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller
|
||||
@@ -498,6 +515,7 @@ static const ControllerDescription_t arrControllers[] = {
|
||||
{ MAKE_CONTROLLER_ID( 0xf0d, 0xba ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller
|
||||
{ MAKE_CONTROLLER_ID( 0xf0d, 0xd8 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller
|
||||
{ MAKE_CONTROLLER_ID( 0xfff, 0x2a1 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller
|
||||
{ MAKE_CONTROLLER_ID( 0x45e, 0x867 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller
|
||||
|
||||
//{ MAKE_CONTROLLER_ID( 0x1949, 0x0402 ), /*android*/, NULL }, // Unknown Controller
|
||||
|
||||
@@ -521,13 +539,22 @@ static const ControllerDescription_t arrControllers[] = {
|
||||
{ MAKE_CONTROLLER_ID( 0x0f0d, 0x00c1 ), k_eControllerType_SwitchInputOnlyController, NULL }, // HORIPAD for Nintendo Switch
|
||||
{ MAKE_CONTROLLER_ID( 0x0f0d, 0x0092 ), k_eControllerType_SwitchInputOnlyController, NULL }, // HORI Pokken Tournament DX Pro Pad
|
||||
{ MAKE_CONTROLLER_ID( 0x0f0d, 0x00f6 ), k_eControllerType_SwitchProController, NULL }, // HORI Wireless Switch Pad
|
||||
{ MAKE_CONTROLLER_ID( 0x0f0d, 0x00dc ), k_eControllerType_XInputSwitchController, NULL }, // HORI Battle Pad. Is a Switch controller but shows up through XInput on Windows.
|
||||
#ifdef _WIN32
|
||||
{ MAKE_CONTROLLER_ID( 0x0f0d, 0x00dc ), k_eControllerType_XInputSwitchController, NULL }, // HORI Fighting Commander - Is a Switch controller but shows up through XInput on Windows.
|
||||
#else
|
||||
{ MAKE_CONTROLLER_ID( 0x0f0d, 0x00dc ), k_eControllerType_SwitchProController, "HORI Fighting Commander" },
|
||||
#endif
|
||||
{ MAKE_CONTROLLER_ID( 0x0e6f, 0x0185 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Wired Fight Pad Pro for Nintendo Switch
|
||||
{ MAKE_CONTROLLER_ID( 0x0e6f, 0x0180 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Faceoff Wired Pro Controller for Nintendo Switch
|
||||
{ MAKE_CONTROLLER_ID( 0x0e6f, 0x0181 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Faceoff Deluxe Wired Pro Controller for Nintendo Switch
|
||||
{ MAKE_CONTROLLER_ID( 0x20d6, 0xa711 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PowerA Wired Controller Plus/PowerA Wired Controller Nintendo GameCube Style
|
||||
{ MAKE_CONTROLLER_ID( 0x20d6, 0xa712 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PowerA - Fusion Fight Pad
|
||||
{ MAKE_CONTROLLER_ID( 0x20d6, 0xa713 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PowerA - Super Mario Controller
|
||||
{ MAKE_CONTROLLER_ID( 0x0e6f, 0x0186 ), k_eControllerType_SwitchProController, NULL }, // PDP Afterglow Wireless Switch Controller - working gyro. USB doesn't work
|
||||
{ MAKE_CONTROLLER_ID( 0x0e6f, 0x0184 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Faceoff Wired Deluxe+ Audio Controller
|
||||
{ MAKE_CONTROLLER_ID( 0x0f0d, 0x00aa ), k_eControllerType_SwitchInputOnlyController, NULL }, // HORI Real Arcade Pro V Hayabusa in Switch Mode
|
||||
{ MAKE_CONTROLLER_ID( 0x0e6f, 0x0188 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Afterglow Wired Deluxe+ Audio Controller
|
||||
{ MAKE_CONTROLLER_ID( 0x0e6f, 0x0187 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Rockcandy Wirec Controller
|
||||
|
||||
// Valve products - don't add to public list
|
||||
{ MAKE_CONTROLLER_ID( 0x0000, 0x11fb ), k_eControllerType_MobileTouch, NULL }, // Streaming mobile touch virtual controls
|
||||
@@ -573,10 +600,10 @@ static SDL_INLINE EControllerType GuessControllerType( int nVID, int nPID )
|
||||
if ( !s_bCheckedForDuplicates )
|
||||
{
|
||||
s_bCheckedForDuplicates = true;
|
||||
|
||||
for ( int i = 0; i < sizeof( arrControllers ) / sizeof( arrControllers[ 0 ] ); ++i )
|
||||
int i, j;
|
||||
for ( i = 0; i < sizeof( arrControllers ) / sizeof( arrControllers[ 0 ] ); ++i )
|
||||
{
|
||||
for ( int j = i + 1; j < sizeof( arrControllers ) / sizeof( arrControllers[ 0 ] ); ++j )
|
||||
for ( j = i + 1; j < sizeof( arrControllers ) / sizeof( arrControllers[ 0 ] ); ++j )
|
||||
{
|
||||
if ( arrControllers[ i ].m_unDeviceID == arrControllers[ j ].m_unDeviceID )
|
||||
{
|
||||
@@ -609,6 +636,10 @@ static SDL_INLINE EControllerType GuessControllerType( int nVID, int nPID )
|
||||
{
|
||||
return k_eControllerType_PS4Controller;
|
||||
}
|
||||
if ( SDL_strncasecmp( pszOverride, "PS5", 3 ) == 0 )
|
||||
{
|
||||
return k_eControllerType_PS5Controller;
|
||||
}
|
||||
if ( SDL_strncasecmp( pszOverride, "SwitchPro", 9 ) == 0 )
|
||||
{
|
||||
return k_eControllerType_SwitchProController;
|
||||
@@ -650,5 +681,32 @@ static SDL_INLINE const char *GuessControllerName( int nVID, int nPID )
|
||||
|
||||
#undef MAKE_CONTROLLER_ID
|
||||
|
||||
static SDL_INLINE int GetDefaultDeadzoneSizeForControllerType( EControllerType eControllerType )
|
||||
{
|
||||
switch ( eControllerType )
|
||||
{
|
||||
case k_eControllerType_UnknownNonSteamController:
|
||||
case k_eControllerType_XBoxOneController:
|
||||
case k_eControllerType_XBox360Controller:
|
||||
case k_eControllerType_AppleController:
|
||||
case k_eControllerType_AndroidController:
|
||||
case k_eControllerType_PS3Controller:
|
||||
return 10000;
|
||||
case k_eControllerType_SteamControllerV2:
|
||||
return 8192;
|
||||
case k_eControllerType_PS4Controller:
|
||||
case k_eControllerType_PS5Controller:
|
||||
return 4096;
|
||||
case k_eControllerType_SwitchJoyConLeft:
|
||||
case k_eControllerType_SwitchJoyConRight:
|
||||
case k_eControllerType_SwitchJoyConPair:
|
||||
return 8192; // Actual dead-zone should be 15% of full-scale, but we use this to account for variances in 3rd-party controllers
|
||||
case k_eControllerType_SwitchProController:
|
||||
return 8192; // Actual dead-zone should be closer to 10% of full-scale, but we use this to account for variances in 3rd-party controllers
|
||||
default:
|
||||
return 8192;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // CONSTANTS_H
|
||||
|
||||
|
1116
externals/SDL/src/joystick/darwin/SDL_iokitjoystick.c
vendored
Executable file
1116
externals/SDL/src/joystick/darwin/SDL_iokitjoystick.c
vendored
Executable file
File diff suppressed because it is too large
Load Diff
81
externals/SDL/src/joystick/darwin/SDL_iokitjoystick_c.h
vendored
Executable file
81
externals/SDL/src/joystick/darwin/SDL_iokitjoystick_c.h
vendored
Executable file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#ifndef SDL_JOYSTICK_IOKIT_H
|
||||
#define SDL_JOYSTICK_IOKIT_H
|
||||
|
||||
#include <IOKit/hid/IOHIDLib.h>
|
||||
#include <ForceFeedback/ForceFeedback.h>
|
||||
#include <ForceFeedback/ForceFeedbackConstants.h>
|
||||
|
||||
struct recElement
|
||||
{
|
||||
IOHIDElementRef elementRef;
|
||||
IOHIDElementCookie cookie;
|
||||
uint32_t usagePage, usage; /* HID usage */
|
||||
SInt32 min; /* reported min value possible */
|
||||
SInt32 max; /* reported max value possible */
|
||||
|
||||
/* runtime variables used for auto-calibration */
|
||||
SInt32 minReport; /* min returned value */
|
||||
SInt32 maxReport; /* max returned value */
|
||||
|
||||
struct recElement *pNext; /* next element in list */
|
||||
};
|
||||
typedef struct recElement recElement;
|
||||
|
||||
struct joystick_hwdata
|
||||
{
|
||||
IOHIDDeviceRef deviceRef; /* HIDManager device handle */
|
||||
io_service_t ffservice; /* Interface for force feedback, 0 = no ff */
|
||||
FFDeviceObjectReference ffdevice;
|
||||
FFEFFECT *ffeffect;
|
||||
FFEffectObjectReference ffeffect_ref;
|
||||
SDL_bool ff_initialized;
|
||||
|
||||
char product[256]; /* name of product */
|
||||
uint32_t usage; /* usage page from IOUSBHID Parser.h which defines general usage */
|
||||
uint32_t usagePage; /* usage within above page from IOUSBHID Parser.h which defines specific usage */
|
||||
|
||||
int axes; /* number of axis (calculated, not reported by device) */
|
||||
int buttons; /* number of buttons (calculated, not reported by device) */
|
||||
int hats; /* number of hat switches (calculated, not reported by device) */
|
||||
int elements; /* number of total elements (should be total of above) (calculated, not reported by device) */
|
||||
|
||||
recElement *firstAxis;
|
||||
recElement *firstButton;
|
||||
recElement *firstHat;
|
||||
|
||||
SDL_bool removed;
|
||||
SDL_Joystick *joystick;
|
||||
SDL_bool runLoopAttached; /* is 'deviceRef' attached to a CFRunLoop? */
|
||||
|
||||
int instance_id;
|
||||
SDL_JoystickGUID guid;
|
||||
|
||||
struct joystick_hwdata *pNext; /* next device */
|
||||
};
|
||||
typedef struct joystick_hwdata recDevice;
|
||||
|
||||
#endif /* SDL_JOYSTICK_IOKIT_H */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user