fix(input): SDL 3 games no longer crash on the virtual pads' udev devices (#2915)

This commit is contained in:
Tamim Kabir authored and GitHub committed 2026-11-22 02:43:32 -05:00
1 parent 9cfab884d5
commit a8d03d687f
2 files changed
+137 -8

No files matched your search

+65
View File
@@ -582,6 +582,16 @@ const char *udev_device_get_action(void *device) {
return real_get(device);
}
const char *udev_device_get_driver(void *device) {
static const char *(*real_get)(void *);
struct pad *pad = device_pad(device);
if (pad != NULL) return NULL;
if (real_get == NULL) real_get = next_symbol("udev_device_get_driver");
if (real_get == NULL) return NULL;
return real_get(device);
}
dev_t udev_device_get_devnum(void *device) {
static dev_t (*real_get)(void *);
struct pad *pad = device_pad(device);
@@ -686,6 +696,54 @@ void *udev_device_get_sysattr_list_entry(void *device) {
return real_get != NULL ? real_get(device) : NULL;
}
void *udev_device_get_current_tags_list_entry(void *device) {
static void *(*real_get)(void *);
if (device_pad(device) != NULL) return NULL;
if (real_get == NULL) real_get = next_symbol("udev_device_get_current_tags_list_entry");
return real_get != NULL ? real_get(device) : NULL;
}
int udev_device_has_current_tag(void *device, const char *tag) {
static int (*real_has)(void *, const char *);
if (device_pad(device) != NULL) return 0;
if (real_has == NULL) real_has = next_symbol("udev_device_has_current_tag");
return real_has != NULL ? real_has(device, tag) : 0;
}
void *udev_device_get_devlinks_list_entry(void *device) {
static void *(*real_get)(void *);
if (device_pad(device) != NULL) return NULL;
if (real_get == NULL) real_get = next_symbol("udev_device_get_devlinks_list_entry");
return real_get != NULL ? real_get(device) : NULL;
}
unsigned long long udev_device_get_seqnum(void *device) {
static unsigned long long (*real_get)(void *);
if (device_pad(device) != NULL) return 0;
if (real_get == NULL) real_get = next_symbol("udev_device_get_seqnum");
return real_get != NULL ? real_get(device) : 0;
}
unsigned long long udev_device_get_usec_since_initialized(void *device) {
static unsigned long long (*real_get)(void *);
if (device_pad(device) != NULL) return 0;
if (real_get == NULL) real_get = next_symbol("udev_device_get_usec_since_initialized");
return real_get != NULL ? real_get(device) : 0;
}
int udev_device_set_sysattr_value(void *device, const char *sysattr, const char *value) {
static int (*real_set)(void *, const char *, const char *);
if (device_pad(device) != NULL) return -EACCES;
if (real_set == NULL) real_set = next_symbol("udev_device_set_sysattr_value");
return real_set != NULL ? real_set(device, sysattr, value) : -ENOSYS;
}
void *udev_device_new_from_devnum(void *udev, char type, dev_t devnum) {
static void *(*real_new)(void *, char, dev_t);
struct pad pad;
@@ -1011,6 +1069,7 @@ static const struct udev_symbol udev_symbols[] = {
{"udev_device_get_subsystem", (void *)udev_device_get_subsystem},
{"udev_device_get_devtype", (void *)udev_device_get_devtype},
{"udev_device_get_action", (void *)udev_device_get_action},
{"udev_device_get_driver", (void *)udev_device_get_driver},
{"udev_device_get_devnum", (void *)udev_device_get_devnum},
{"udev_device_get_sysattr_value", (void *)udev_device_get_sysattr_value},
{"udev_device_get_property_value", (void *)udev_device_get_property_value},
@@ -1023,6 +1082,12 @@ static const struct udev_symbol udev_symbols[] = {
{"udev_device_get_properties_list_entry", (void *)udev_device_get_properties_list_entry},
{"udev_device_get_tags_list_entry", (void *)udev_device_get_tags_list_entry},
{"udev_device_get_sysattr_list_entry", (void *)udev_device_get_sysattr_list_entry},
{"udev_device_get_current_tags_list_entry", (void *)udev_device_get_current_tags_list_entry},
{"udev_device_has_current_tag", (void *)udev_device_has_current_tag},
{"udev_device_get_devlinks_list_entry", (void *)udev_device_get_devlinks_list_entry},
{"udev_device_get_seqnum", (void *)udev_device_get_seqnum},
{"udev_device_get_usec_since_initialized", (void *)udev_device_get_usec_since_initialized},
{"udev_device_set_sysattr_value", (void *)udev_device_set_sysattr_value},
{"udev_enumerate_new", (void *)udev_enumerate_new},
{"udev_enumerate_ref", (void *)udev_enumerate_ref},
{"udev_enumerate_unref", (void *)udev_enumerate_unref},