mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-12 11:24:59 +02:00
Merge IOKit hotplug support patch [Sintendo]
Merge libretro Super Game Boy support improvement patch [fr500]
This commit is contained in:
@@ -101,8 +101,6 @@ struct InputJoypadIOKit {
|
||||
}
|
||||
|
||||
auto poll(vector<shared_pointer<HID::Device>>& devices) -> void {
|
||||
detectDevices(); //hotplug support
|
||||
|
||||
for(auto& jp : joypads) {
|
||||
IOHIDDeviceRef device = jp.device;
|
||||
|
||||
@@ -181,13 +179,13 @@ struct InputJoypadIOKit {
|
||||
IOHIDManagerSetDeviceMatchingMultiple(manager, matcher);
|
||||
IOHIDManagerRegisterDeviceMatchingCallback(manager, deviceMatchingCallback, this);
|
||||
IOHIDManagerRegisterDeviceRemovalCallback(manager, deviceRemovalCallback, this);
|
||||
IOHIDManagerScheduleWithRunLoop(manager, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
|
||||
|
||||
if(IOHIDManagerOpen(manager, kIOHIDOptionsTypeNone) != kIOReturnSuccess) {
|
||||
releaseManager();
|
||||
return false;
|
||||
}
|
||||
|
||||
detectDevices();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -261,14 +259,6 @@ private:
|
||||
CFRelease(pageNumber), CFRelease(usageNumber);
|
||||
return dict;
|
||||
}
|
||||
|
||||
auto detectDevices() -> void {
|
||||
CFRunLoopRef runLoop = CFRunLoopGetCurrent();
|
||||
CFStringRef runLoopMode = CFSTR("rubyJoypadIOKit");
|
||||
IOHIDManagerScheduleWithRunLoop(manager, runLoop, runLoopMode);
|
||||
while(CFRunLoopRunInMode(runLoopMode, 0, true) == kCFRunLoopRunHandledSource);
|
||||
IOHIDManagerUnscheduleFromRunLoop(manager, runLoop, runLoopMode);
|
||||
}
|
||||
};
|
||||
|
||||
auto deviceMatchingCallback(void* context, IOReturn result, void* sender, IOHIDDeviceRef device) -> void {
|
||||
|
Reference in New Issue
Block a user