Support plugging and unplugging joypads while running
Moderator: ZSNES Mods
Support plugging and unplugging joypads while running
From what I've noticed, when you unplug a USB controller while ZSNES is running, then plug it back in again, it will not recognize the controller until you restart the program. That gets annoying. I'd like to see ZSNES able to recognize controllers as they are plugged in.
Maybe it would be possible to check if a controller matches a previously inserted-and-removed controller and auto-map the buttons to the previous joystick. Would be handy if you played with a joystick for a while, unplugged it, set up the configuration to use the keyboard, then re-plugged in the joystick. Or if you moved the joystick from one USB port to another.
Maybe it would be possible to check if a controller matches a previously inserted-and-removed controller and auto-map the buttons to the previous joystick. Would be handy if you played with a joystick for a while, unplugged it, set up the configuration to use the keyboard, then re-plugged in the joystick. Or if you moved the joystick from one USB port to another.
"We are merely sprites that dance at the beck and call of our button pressing overlord."
-
- ZSNES Developer
- Posts: 6747
- Joined: Tue Dec 28, 2004 6:47 am
That "might" be done when we rework joystick support. On the other hand, that doesn't quite solve how it will properly interface with joystick->key/button mapping. It should be plugged in when you start ZSNES regardless.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
-
- ZSNES Developer
- Posts: 6747
- Joined: Tue Dec 28, 2004 6:47 am
I think that's already emulated, but nevertheless, I don't see any reason why one would want to hot plugging a different controller, while running an app that is using the controller. In most of those apps, they do the gampad detection on load, not while the app is running. I can understand if the gamepad is loose, and stops getting detected.. that would be worthwhile to fix.Panzer88 wrote:maybe you could emulate an unplugged controller too. Like some games say, "Please insert controller 1"
However, with the current system, it is very difficult to implement a hot-swap controller option. It just simply won't work (read the source if you wish, so this becomes clearer to you).
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
-
- ZSNES Developer
- Posts: 6747
- Joined: Tue Dec 28, 2004 6:47 am
Enumeration of joypads is a difficult thing to do at runtime, and is very expensive timewise. You technically can do it, but you'd need a special event timer so that it's only done once every few seconds.
And then there's the problem of what to do when joypad IDs change. It's even more difficult to identify which joypad was plugged in and map keys appropriately. Most likely what would happen if you switched joypads would be that the key mapping would change and your buttons would be out of order. The best you could do is store joypad configuration data with the unique ID of the gamepad and rely on that for joypad key transformation.
So it would require two very annoying to implement functions, but is technically possible.
And then there's the problem of what to do when joypad IDs change. It's even more difficult to identify which joypad was plugged in and map keys appropriately. Most likely what would happen if you switched joypads would be that the key mapping would change and your buttons would be out of order. The best you could do is store joypad configuration data with the unique ID of the gamepad and rely on that for joypad key transformation.
So it would require two very annoying to implement functions, but is technically possible.
but... you would normally expect different joysticks to set there buttons up differently so you shouldnt need to combat this...And then there's the problem of what to do when joypad IDs change. It's even more difficult to identify which joypad was plugged in and map keys appropriately. Most likely what would happen if you switched joypads would be that the key mapping would change and your buttons would be out of order.
all we want is for it to not require us to restart it to detect joypads... it doesnt matter if there different cause then yes they get buttons assigned based on another controllers layout and this is a problem, but it is a expected problem that doesnt need to be resolved...
Core i7 920 @ 2.66GHZ | ASUS P6T Motherboard | 8GB DDR3 1600 RAM | Gigabyte Geforce 760 4GB | Windows 10 Pro x64
-
- Inmate
- Posts: 1751
- Joined: Mon Dec 06, 2004 7:47 am
- Location: WA
-
- Veteran
- Posts: 970
- Joined: Fri Jan 21, 2005 11:15 am
- Location: Montana, United States
I have to agree there.sweener2001 wrote:i don't see this as a problem.
i personally don't think the devs should bother themselves too much with this one.
I know of plenty of commercial games that you have to restart if a controller is unplugged while in play. Hell I used to have wireless controls that were a bitch if they lost signal for a second, then I'd have to sync up again and restart the game.
-
- ZSNES Developer
- Posts: 6747
- Joined: Tue Dec 28, 2004 6:47 am
Uh, yes you do have to combat that. You cannot always guarentee that two controllers have the same button configuration being processed. If it happens that they are the same controller(or similar), well then, it doesn't really matter.franpa wrote:but... you would normally expect different joysticks to set there buttons up differently so you shouldnt need to combat this...And then there's the problem of what to do when joypad IDs change. It's even more difficult to identify which joypad was plugged in and map keys appropriately. Most likely what would happen if you switched joypads would be that the key mapping would change and your buttons would be out of order.
It's not even factoring layout, it has more to do with how the joystick enumeration maps to internal keypressing in ZSNES. As I said, read the source as it will make this clear to you (or if you can't, just stop complaining).all we want is for it to not require us to restart it to detect joypads... it doesnt matter if there different cause then yes they get buttons assigned based on another controllers layout and this is a problem, but it is a expected problem that doesnt need to be resolved...
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...