mirror of https://github.com/bsnes-emu/bsnes.git
Offical WUP-028s require an activation sequence
This commit is contained in:
parent
66112af37e
commit
9f876e380c
|
@ -120,6 +120,8 @@ hacksByName = @{
|
||||||
|
|
||||||
JOYConnectedUsage: @2,
|
JOYConnectedUsage: @2,
|
||||||
JOYConnectedUsagePage: @0xFF00,
|
JOYConnectedUsagePage: @0xFF00,
|
||||||
|
|
||||||
|
JOYActivationReport: [NSData dataWithBytes:(uint8_t[]){0x13} length:1],
|
||||||
|
|
||||||
JOYSubElementStructs: @{
|
JOYSubElementStructs: @{
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ static NSString const *JOYConnectedUsagePage = @"JOYConnectedUsagePage";
|
||||||
static NSString const *JOYRumbleMin = @"JOYRumbleMin";
|
static NSString const *JOYRumbleMin = @"JOYRumbleMin";
|
||||||
static NSString const *JOYRumbleMax = @"JOYRumbleMax";
|
static NSString const *JOYRumbleMax = @"JOYRumbleMax";
|
||||||
static NSString const *JOYSwapZRz = @"JOYSwapZRz";
|
static NSString const *JOYSwapZRz = @"JOYSwapZRz";
|
||||||
|
static NSString const *JOYActivationReport = @"JOYActivationReport";
|
||||||
|
|
||||||
static NSMutableDictionary<id, JOYController *> *controllers; // Physical controllers
|
static NSMutableDictionary<id, JOYController *> *controllers; // Physical controllers
|
||||||
static NSMutableArray<JOYController *> *exposedControllers; // Logical controllers
|
static NSMutableArray<JOYController *> *exposedControllers; // Logical controllers
|
||||||
|
@ -691,15 +691,25 @@ typedef struct __attribute__((packed)) {
|
||||||
{
|
{
|
||||||
NSString *name = (__bridge NSString *)IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductKey));
|
NSString *name = (__bridge NSString *)IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductKey));
|
||||||
NSDictionary *hacks = hacksByName[name];
|
NSDictionary *hacks = hacksByName[name];
|
||||||
|
if (!hacks) {
|
||||||
|
hacks = hacksByManufacturer[(__bridge NSNumber *)IOHIDDeviceGetProperty(device, CFSTR(kIOHIDVendorIDKey))];
|
||||||
|
}
|
||||||
NSArray *filters = hacks[JOYReportIDFilters];
|
NSArray *filters = hacks[JOYReportIDFilters];
|
||||||
|
JOYController *controller = nil;
|
||||||
if (filters) {
|
if (filters) {
|
||||||
JOYController *controller = [[JOYMultiplayerController alloc] initWithDevice:device
|
controller = [[JOYMultiplayerController alloc] initWithDevice:device
|
||||||
reportIDFilters:filters];
|
reportIDFilters:filters];
|
||||||
[controllers setObject:controller forKey:[NSValue valueWithPointer:device]];
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
[controllers setObject:[[JOYController alloc] initWithDevice:device] forKey:[NSValue valueWithPointer:device]];
|
controller = [[JOYController alloc] initWithDevice:device];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hacks[JOYActivationReport]) {
|
||||||
|
[controller sendReport:hacks[JOYActivationReport]];
|
||||||
|
}
|
||||||
|
[controllers setObject:controller forKey:[NSValue valueWithPointer:device]];
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (void)controllerRemoved:(IOHIDDeviceRef) device
|
+ (void)controllerRemoved:(IOHIDDeviceRef) device
|
||||||
|
|
Loading…
Reference in New Issue