Compare commits
21
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9fd3ce83c | ||
|
|
7fa9f1559c | ||
|
|
b2ec286e35 | ||
|
|
05eb08053d | ||
|
|
c2ebe1024b | ||
|
|
1a722ef500 | ||
|
|
6303197b20 | ||
|
|
6c0a114efb | ||
|
|
e5ccc80aba | ||
|
|
00096baf18 | ||
|
|
1dbe85efd1 | ||
|
|
52bffcbcd5 | ||
|
|
89433c2339 | ||
|
|
b0fd3fad53 | ||
|
|
31dfc10c3b | ||
|
|
66399e4211 | ||
|
|
45075eec86 | ||
|
|
9b2c70c9c8 | ||
|
|
ac23faf0a6 | ||
|
|
221d6ea8a8 | ||
|
|
01eb305493 |
No files matched your search
@@ -64,6 +64,7 @@ jobs:
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
brew install \
|
||||
autoconf \
|
||||
ninja \
|
||||
pkg-config
|
||||
|
||||
|
||||
@@ -965,6 +965,24 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED "SDL_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED"
|
||||
|
||||
/**
|
||||
* A variable controlling whether IOKit should be used for controller handling.
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - IOKit is not used
|
||||
* "1" - IOKit is used (the default)
|
||||
*/
|
||||
#define SDL_HINT_JOYSTICK_IOKIT "SDL_JOYSTICK_IOKIT"
|
||||
|
||||
/**
|
||||
* A variable controlling whether GCController should be used for controller handling.
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - GCController is not used
|
||||
* "1" - GCController is used (the default)
|
||||
*/
|
||||
#define SDL_HINT_JOYSTICK_MFI "SDL_JOYSTICK_MFI"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether the RAWINPUT joystick drivers should be used for better handling XInput-capable devices.
|
||||
*
|
||||
|
||||
@@ -593,6 +593,7 @@ static const char *s_ControllerMappings[] = {
|
||||
"05000000503200000110000000000000,Atari Classic Controller,a:b0,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b4,start:b3,x:b1,",
|
||||
"03000000503200000210000000000000,Atari Game Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a4,rightx:a2,righty:a3,start:b8,x:b2,y:b3,",
|
||||
"05000000503200000210000000000000,Atari Game 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:b3,y:b2,",
|
||||
"05000000503200000210000000000000128804098,Atari Game 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:b3,y:b2,",
|
||||
"030000005e0400008e02000047010000,Atari Xbox 360 Game 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,",
|
||||
"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,",
|
||||
|
||||
@@ -2346,7 +2346,8 @@ SDL_bool SDL_IsJoystickXboxSeriesX(Uint16 vendor_id, Uint16 product_id)
|
||||
}
|
||||
}
|
||||
if (vendor_id == USB_VENDOR_8BITDO) {
|
||||
if (product_id == USB_PRODUCT_8BITDO_XBOX_CONTROLLER) {
|
||||
if (product_id == USB_PRODUCT_8BITDO_XBOX_CONTROLLER1 ||
|
||||
product_id == USB_PRODUCT_8BITDO_XBOX_CONTROLLER2) {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
}
|
||||
@@ -2792,6 +2793,7 @@ SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid)
|
||||
};
|
||||
|
||||
static Uint32 rog_chakram_list[] = {
|
||||
MAKE_VIDPID(0x0b05, 0x1906), /* ROG Pugio II */
|
||||
MAKE_VIDPID(0x0b05, 0x1958), /* ROG Chakram Core Mouse */
|
||||
MAKE_VIDPID(0x0b05, 0x18e3), /* ROG Chakram (wired) Mouse */
|
||||
MAKE_VIDPID(0x0b05, 0x18e5), /* ROG Chakram (wireless) Mouse */
|
||||
|
||||
@@ -657,8 +657,8 @@ static SDL_bool CreateHIDManager(void)
|
||||
|
||||
static int DARWIN_JoystickInit(void)
|
||||
{
|
||||
if (gpDeviceList) {
|
||||
return SDL_SetError("Joystick: Device list already inited.");
|
||||
if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_IOKIT, SDL_TRUE)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!CreateHIDManager()) {
|
||||
@@ -694,10 +694,12 @@ static void DARWIN_JoystickDetect(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* run this after the checks above so we don't set device->removed and delete the device before
|
||||
DARWIN_JoystickUpdate can run to clean up the SDL_Joystick object that owns this device */
|
||||
while (CFRunLoopRunInMode(SDL_JOYSTICK_RUNLOOP_MODE, 0, TRUE) == kCFRunLoopRunHandledSource) {
|
||||
/* no-op. Pending callbacks will fire in CFRunLoopRunInMode(). */
|
||||
if (hidman) {
|
||||
/* run this after the checks above so we don't set device->removed and delete the device before
|
||||
DARWIN_JoystickUpdate can run to clean up the SDL_Joystick object that owns this device */
|
||||
while (CFRunLoopRunInMode(SDL_JOYSTICK_RUNLOOP_MODE, 0, TRUE) == kCFRunLoopRunHandledSource) {
|
||||
/* no-op. Pending callbacks will fire in CFRunLoopRunInMode(). */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ static SDL_joylist_item *JoystickByIndex(int index);
|
||||
static SDL_joylist_item *SDL_joylist = NULL;
|
||||
static SDL_joylist_item *SDL_joylist_tail = NULL;
|
||||
static int numjoysticks = 0;
|
||||
static int instance_counter = 0;
|
||||
|
||||
static EM_BOOL Emscripten_JoyStickConnected(int eventType, const EmscriptenGamepadEvent *gamepadEvent, void *userData)
|
||||
{
|
||||
@@ -72,7 +71,7 @@ static EM_BOOL Emscripten_JoyStickConnected(int eventType, const EmscriptenGamep
|
||||
|
||||
item->naxes = gamepadEvent->numAxes;
|
||||
item->nbuttons = gamepadEvent->numButtons;
|
||||
item->device_instance = instance_counter++;
|
||||
item->device_instance = SDL_GetNextJoystickInstanceID();
|
||||
|
||||
item->timestamp = gamepadEvent->timestamp;
|
||||
|
||||
@@ -168,7 +167,6 @@ static void EMSCRIPTEN_JoystickQuit(void)
|
||||
SDL_joylist = SDL_joylist_tail = NULL;
|
||||
|
||||
numjoysticks = 0;
|
||||
instance_counter = 0;
|
||||
|
||||
emscripten_set_gamepadconnected_callback(NULL, 0, NULL);
|
||||
emscripten_set_gamepaddisconnected_callback(NULL, 0, NULL);
|
||||
|
||||
@@ -663,6 +663,10 @@ static void SDLCALL SDL_AppleTVRemoteRotationHintChanged(void *udata, const char
|
||||
|
||||
static int IOS_JoystickInit(void)
|
||||
{
|
||||
if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_MFI, SDL_TRUE)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(__MACOSX__)
|
||||
#if _SDL_HAS_BUILTIN(__builtin_available)
|
||||
if (@available(macOS 10.16, *)) {
|
||||
@@ -1680,6 +1684,10 @@ static SDL_bool IOS_JoystickGetGamepadMapping(int device_index, SDL_GamepadMappi
|
||||
#if defined(SDL_JOYSTICK_MFI) && defined(__MACOSX__)
|
||||
SDL_bool IOS_SupportedHIDDevice(IOHIDDeviceRef device)
|
||||
{
|
||||
if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_MFI, SDL_TRUE)) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
if (@available(macOS 10.16, *)) {
|
||||
const int MAX_ATTEMPTS = 3;
|
||||
for (int attempt = 0; attempt < MAX_ATTEMPTS; ++attempt) {
|
||||
|
||||
@@ -52,7 +52,8 @@
|
||||
#define USB_VENDOR_VALVE 0x28de
|
||||
#define USB_VENDOR_ZEROPLUS 0x0c12
|
||||
|
||||
#define USB_PRODUCT_8BITDO_XBOX_CONTROLLER 0x2002
|
||||
#define USB_PRODUCT_8BITDO_XBOX_CONTROLLER1 0x2002 /* Ultimate Wired Controller for Xbox */
|
||||
#define USB_PRODUCT_8BITDO_XBOX_CONTROLLER2 0x3106 /* Ultimate Wireless / Pro 2 Wired Controller */
|
||||
#define USB_PRODUCT_AMAZON_LUNA_CONTROLLER 0x0419
|
||||
#define USB_PRODUCT_ASTRO_C40_XBOX360 0x0024
|
||||
#define USB_PRODUCT_BACKBONE_ONE_IOS 0x0103
|
||||
|
||||
@@ -453,7 +453,6 @@ static BOOL CALLBACK EnumJoystickDetectCallback(LPCDIDEVICEINSTANCE pDeviceInsta
|
||||
char *hidPath = NULL;
|
||||
char *name = NULL;
|
||||
LPDIRECTINPUTDEVICE8 device = NULL;
|
||||
DIDEVCAPS caps;
|
||||
|
||||
/* We are only supporting HID devices. */
|
||||
CHECK(pDeviceInstance->dwDevType & DIDEVTYPE_HID);
|
||||
@@ -463,13 +462,6 @@ static BOOL CALLBACK EnumJoystickDetectCallback(LPCDIDEVICEINSTANCE pDeviceInsta
|
||||
CHECK(QueryDevicePath(device, &hidPath));
|
||||
CHECK(QueryDeviceInfo(device, &vendor, &product));
|
||||
|
||||
/* Check to make sure the device has buttons and axes.
|
||||
* This fixes incorrectly detecting the ROG CHAKRAM X mouse as a game controller on Windows 10
|
||||
*/
|
||||
caps.dwSize = sizeof(caps);
|
||||
CHECK(SUCCEEDED(IDirectInputDevice8_GetCapabilities(device, &caps)));
|
||||
CHECK(caps.dwAxes > 0 && caps.dwButtons > 0);
|
||||
|
||||
CHECK(!SDL_IsXInputDevice(vendor, product, hidPath));
|
||||
|
||||
pNewJoystick = *(JoyStick_DeviceData **)pContext;
|
||||
|
||||
@@ -988,7 +988,8 @@ static void RAWINPUT_DetectDevices(void)
|
||||
|
||||
devices = (PRAWINPUTDEVICELIST)SDL_malloc(sizeof(RAWINPUTDEVICELIST) * device_count);
|
||||
if (devices) {
|
||||
if (GetRawInputDeviceList(devices, &device_count, sizeof(RAWINPUTDEVICELIST)) != -1) {
|
||||
device_count = GetRawInputDeviceList(devices, &device_count, sizeof(RAWINPUTDEVICELIST));
|
||||
if (device_count != (UINT)-1) {
|
||||
for (i = 0; i < device_count; ++i) {
|
||||
RAWINPUT_AddDevice(devices[i].hDevice);
|
||||
}
|
||||
|
||||
@@ -136,7 +136,8 @@ static SDL_bool SDL_IsXInputDevice(Uint16 vendor, Uint16 product)
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
if (GetRawInputDeviceList(raw_devices, &raw_device_count, sizeof(RAWINPUTDEVICELIST)) == -1) {
|
||||
raw_device_count = GetRawInputDeviceList(raw_devices, &raw_device_count, sizeof(RAWINPUTDEVICELIST));
|
||||
if (raw_device_count == (UINT)-1) {
|
||||
SDL_free(raw_devices);
|
||||
raw_devices = NULL;
|
||||
return SDL_FALSE; /* oh well. */
|
||||
|
||||
@@ -134,7 +134,8 @@ static void GuessXInputDevice(Uint8 userid, Uint16 *pVID, Uint16 *pPID, Uint16 *
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetRawInputDeviceList(devices, &device_count, sizeof(RAWINPUTDEVICELIST)) == -1) {
|
||||
device_count = GetRawInputDeviceList(devices, &device_count, sizeof(RAWINPUTDEVICELIST));
|
||||
if (device_count == (UINT)-1) {
|
||||
SDL_free(devices);
|
||||
return; /* oh well. */
|
||||
}
|
||||
|
||||
@@ -980,8 +980,12 @@ static void SW_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
|
||||
static void SW_DestroyRenderer(SDL_Renderer *renderer)
|
||||
{
|
||||
SDL_Window *window = renderer->window;
|
||||
SW_RenderData *data = (SW_RenderData *)renderer->driverdata;
|
||||
|
||||
if (window) {
|
||||
SDL_DestroyWindowSurface(window);
|
||||
}
|
||||
SDL_free(data);
|
||||
SDL_free(renderer);
|
||||
}
|
||||
@@ -1035,8 +1039,6 @@ SDL_Renderer *SW_CreateRendererForSurface(SDL_Surface *surface)
|
||||
renderer->info = SW_RenderDriver.info;
|
||||
renderer->driverdata = data;
|
||||
|
||||
SW_ActivateRenderer(renderer);
|
||||
|
||||
return renderer;
|
||||
}
|
||||
|
||||
|
||||
@@ -339,12 +339,7 @@ int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poin
|
||||
if (is_uniform) {
|
||||
Uint32 color;
|
||||
if (tmp) {
|
||||
if (dst->format->Amask) {
|
||||
color = SDL_MapRGBA(tmp->format, c0.r, c0.g, c0.b, c0.a);
|
||||
} else {
|
||||
// color = SDL_MapRGB(tmp->format, c0.r, c0.g, c0.b);
|
||||
color = SDL_MapRGBA(tmp->format, c0.r, c0.g, c0.b, c0.a);
|
||||
}
|
||||
color = SDL_MapRGBA(tmp->format, c0.r, c0.g, c0.b, c0.a);
|
||||
} else {
|
||||
color = SDL_MapRGBA(dst->format, c0.r, c0.g, c0.b, c0.a);
|
||||
}
|
||||
|
||||
@@ -1989,6 +1989,7 @@ int SDL_vasprintf(char **strp, const char *fmt, va_list ap)
|
||||
|
||||
/* Check error code */
|
||||
if (retval < 0) {
|
||||
SDL_free(p);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -2010,5 +2011,3 @@ int SDL_vasprintf(char **strp, const char *fmt, va_list ap)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <timer_alarm.h>
|
||||
#include <kernel_util.h>
|
||||
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_thread.h"
|
||||
@@ -38,11 +38,6 @@ struct SDL_semaphore
|
||||
s32 semid;
|
||||
};
|
||||
|
||||
static void usercb(struct timer_alarm_t *alarm, void *arg)
|
||||
{
|
||||
iReleaseWaitThread((int)arg);
|
||||
}
|
||||
|
||||
/* Create a semaphore */
|
||||
SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
|
||||
{
|
||||
@@ -85,8 +80,8 @@ void SDL_DestroySemaphore(SDL_sem *sem)
|
||||
int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
|
||||
{
|
||||
int ret;
|
||||
struct timer_alarm_t alarm;
|
||||
InitializeTimerAlarm(&alarm);
|
||||
u64 timeout_usec;
|
||||
u64 *timeout_ptr;
|
||||
|
||||
if (sem == NULL) {
|
||||
return SDL_InvalidParamError("sem");
|
||||
@@ -99,12 +94,14 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
|
||||
return 0;
|
||||
}
|
||||
|
||||
timeout_ptr = NULL;
|
||||
|
||||
if (timeout != SDL_MUTEX_MAXWAIT) {
|
||||
SetTimerAlarm(&alarm, MSec2TimerBusClock(timeout), &usercb, (void *)GetThreadId());
|
||||
timeout_usec = timeout * 1000;
|
||||
timeout_ptr = &timeout_usec;
|
||||
}
|
||||
|
||||
ret = WaitSema(sem->semid);
|
||||
StopTimerAlarm(&alarm);
|
||||
ret = WaitSemaEx(sem->semid, 1, timeout_ptr);
|
||||
|
||||
if (ret < 0) {
|
||||
return SDL_MUTEX_TIMEDOUT;
|
||||
|
||||
@@ -825,6 +825,9 @@ void SDL_SetCurrentDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode
|
||||
|
||||
void SDL_SetDesktopDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
|
||||
{
|
||||
if (display->desktop_mode.driverdata) {
|
||||
SDL_free(display->desktop_mode.driverdata);
|
||||
}
|
||||
SDL_memcpy(&display->desktop_mode, mode, sizeof(*mode));
|
||||
}
|
||||
|
||||
|
||||
@@ -1321,9 +1321,9 @@ STDMETHODIMP IPPASink_QueryInterface(TSFSink *sink, REFIID riid, PVOID *ppv)
|
||||
|
||||
STDMETHODIMP IPPASink_OnActivated(TSFSink *sink, DWORD dwProfileType, LANGID langid, REFCLSID clsid, REFGUID catid, REFGUID guidProfile, HKL hkl, DWORD dwFlags)
|
||||
{
|
||||
static const GUID TF_PROFILE_DAYI = { 0x037B2C25, 0x480C, 0x4D7F, { 0xB0, 0x27, 0xD6, 0xCA, 0x6B, 0x69, 0x78, 0x8A } };
|
||||
static const GUID SDL_TF_PROFILE_DAYI = { 0x037B2C25, 0x480C, 0x4D7F, { 0xB0, 0x27, 0xD6, 0xCA, 0x6B, 0x69, 0x78, 0x8A } };
|
||||
SDL_VideoData *videodata = (SDL_VideoData *)sink->data;
|
||||
videodata->ime_candlistindexbase = WIN_IsEqualGUID(&TF_PROFILE_DAYI, guidProfile) ? 0 : 1;
|
||||
videodata->ime_candlistindexbase = WIN_IsEqualGUID(&SDL_TF_PROFILE_DAYI, guidProfile) ? 0 : 1;
|
||||
if (WIN_IsEqualIID(catid, &GUID_TFCAT_TIP_KEYBOARD) && (dwFlags & TF_IPSINK_FLAG_ACTIVE)) {
|
||||
IME_InputLangChanged((SDL_VideoData *)sink->data);
|
||||
}
|
||||
|
||||
@@ -756,7 +756,7 @@ static int XLookupStringAsUTF8(XKeyEvent *event_struct, char *buffer_return, int
|
||||
{
|
||||
int result = X11_XLookupString(event_struct, buffer_return, bytes_buffer, keysym_return, status_in_out);
|
||||
if (IsHighLatin1(buffer_return, result)) {
|
||||
char *utf8_text = SDL_iconv_string("UTF-8", "ISO-8859-1", buffer_return, result);
|
||||
char *utf8_text = SDL_iconv_string("UTF-8", "ISO-8859-1", buffer_return, result + 1);
|
||||
if (utf8_text) {
|
||||
SDL_strlcpy(buffer_return, utf8_text, bytes_buffer);
|
||||
SDL_free(utf8_text);
|
||||
|
||||
Reference in new issue
Block a user