externals: Link SDL2 statically. (#6461)
This commit is contained in:
parent
d8e74a9ff4
commit
71a9981430
10 changed files with 61 additions and 75 deletions
|
@ -19,13 +19,19 @@
|
|||
#include "common/param_package.h"
|
||||
#include "input_common/gcadapter/gc_adapter.h"
|
||||
|
||||
// Workaround for older libusb versions not having libusb_init_context.
|
||||
// libusb_init is deprecated and causes a compile error in newer versions.
|
||||
#if !defined(LIBUSB_API_VERSION) || (LIBUSB_API_VERSION < 0x0100010A)
|
||||
#define libusb_init_context(a, b, c) libusb_init(a)
|
||||
#endif
|
||||
|
||||
namespace GCAdapter {
|
||||
|
||||
Adapter::Adapter() {
|
||||
if (usb_adapter_handle != nullptr) {
|
||||
return;
|
||||
}
|
||||
const int init_res = libusb_init(&libusb_ctx);
|
||||
const int init_res = libusb_init_context(&libusb_ctx, nullptr, 0);
|
||||
if (init_res == LIBUSB_SUCCESS) {
|
||||
adapter_scan_thread = std::thread(&Adapter::AdapterScanThread, this);
|
||||
} else {
|
||||
|
|
|
@ -57,11 +57,35 @@ typedef struct {
|
|||
|
||||
} SDL_ExtendedGameControllerBind;
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2, 26, 0)
|
||||
/* our hard coded list of mapping support */
|
||||
typedef enum {
|
||||
SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT,
|
||||
SDL_CONTROLLER_MAPPING_PRIORITY_API,
|
||||
SDL_CONTROLLER_MAPPING_PRIORITY_USER,
|
||||
} SDL_ControllerMappingPriority;
|
||||
|
||||
typedef struct _ControllerMapping_t {
|
||||
SDL_JoystickGUID guid;
|
||||
char* name;
|
||||
char* mapping;
|
||||
SDL_ControllerMappingPriority priority;
|
||||
struct _ControllerMapping_t* next;
|
||||
} ControllerMapping_t;
|
||||
#endif
|
||||
|
||||
struct _SDL_GameController {
|
||||
#if SDL_VERSION_ATLEAST(2, 26, 0)
|
||||
const void* magic;
|
||||
#endif
|
||||
|
||||
SDL_Joystick* joystick; /* underlying joystick device */
|
||||
int ref_count;
|
||||
|
||||
const char* name;
|
||||
#if SDL_VERSION_ATLEAST(2, 26, 0)
|
||||
ControllerMapping_t* mapping;
|
||||
#endif
|
||||
int num_bindings;
|
||||
SDL_ExtendedGameControllerBind* bindings;
|
||||
SDL_ExtendedGameControllerBind** last_match_axis;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue