• Login
  • Register
  • Dolphin Forums
  • Home
  • FAQ
  • Download
  • Wiki
  • Code


Dolphin, the GameCube and Wii emulator - Forums › Dolphin Emulator Discussion and Support › Development Discussion v
« Previous 1 ... 22 23 24 25 26 ... 117 Next »

Implementing joystick plug in notifications on Windows
View New Posts | View Today's Posts

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Modes
Implementing joystick plug in notifications on Windows
08-11-2017, 02:44 AM
#1
Dwedit Offline
Junior Member
**
Posts: 17
Threads: 6
Joined: Mar 2016
Okay, so I've downloaded the source code, and started writing some code.
So far, I have some working code that registers device notifications for HID devices, mice, and keyboards, and also the windows message handler code that executes when such a device is plugged in.
I've tested it by plugging in the one device I had sitting around (Steam Controller Receiver), and the handler code is getting called when it's plugged in.
I haven't tried bluetooth devices yet.

Just a few more questions...

Do we need to detect the Mayflash GC adapter getting plugged in during run time? I don't know its device class GUID, but could probably find it out later.
What about other kinds of USB devices that would get passed on to Dolphin?
Do we need to handle devices getting removed too?
Do we need an added delay before triggering a joystick rescan?

Then finally...

What do I actually do after the device has been plugged in to perform a joystick rescan? What function do I call?
Find
Reply
08-11-2017, 02:52 AM
#2
ExtremeDude2 Offline
Gotta post fast
*******
Posts: 9,315
Threads: 273
Joined: Dec 2010
You might want to check out #dolphin-dev on freenode to get in easy contact with devs.
Check out my videos (dead)
[Image: sig-22354.png]
Website Find
Reply
08-11-2017, 03:21 AM (This post was last modified: 08-11-2017, 03:25 AM by leolam.)
#3
leolam Offline
Developer
**********
Developers (Some Administrators and Super Moderators)
Posts: 1,478
Threads: 5
Joined: Sep 2015
Quote:Do we need to detect the Mayflash GC adapter getting plugged in during run time? I don't know its device class GUID, but could probably find it out later.
No. The GC adapter code is separate from ControllerInterface, which is where the hotplug logic is implemented.

Quote:What about other kinds of USB devices that would get passed on to Dolphin?
ControllerInterface should only care about controllers.

For USB passthrough, we already handle device insertions/removals and communicate these events to the emulated software correctly (AFAIK).

Quote:Do we need to handle devices getting removed too?
Yes.

Quote:Do we need an added delay before triggering a joystick rescan?
Not if you're doing an event-based implementation, i.e. only triggering the hotplug code when a device is actually being inserted/removed.

Quote:What do I actually do after the device has been plugged in to perform a joystick rescan? What function do I call?
I suggest reading evdev.cpp or the macOS implementation for more details, but basically:

* Listen for device change events and figure out what device got added/removed.
* Call g_controller_interface.AddDevice when a device gets inserted
* Call g_controller_interface.RemoveDevice when a device gets removed. You should pass a function that returns true for the device you want to remove, like this.
* On any change, after calling AddDevice/RemoveDevice, call g_controller_interface.InvokeHotplugCallbacks
Website Find
Reply
« Next Oldest | Next Newest »


  • View a Printable Version
  • Subscribe to this thread
Forum Jump:


Users browsing this thread: 1 Guest(s)



Powered By MyBB | Theme by Fragma

Linear Mode
Threaded Mode