Hi all,
I have the source code opened in Xcode and I'm trying to figure out the best place to make a change to how the gamepads are mapped. What I want is for the gamepad mapped to player 2 to suddenly be mapped to player 1, based on the value of a flag I have added to Settings that's flipped on a timer. I've got most of the changes working, but it's confusing trying to find where the input polling is happening and how to intercept the player 2 commands and reroute them to player 1.
I feel like I'm on the right track with some of the functions in mac-os.mm. Can anybody better at Objective-C and C++ than me point me in the right direction?
Thanks for your help
Swap controller mappings
-
- Snes9x White Belt
- Posts: 3
- Joined: Wed Dec 09, 2020 6:22 pm
Re: Swap controller mappings
Update: I got it working. I changed controls.cpp. In the S9xSetJoypadLatch function I swapped the 0 and 1 based on the flag in Settings. The Mac version of the app seems to have trouble with gamepads, as player 2 controller constantly moves left (even without my changes). So I redid it in Windows and it seems to work. I've put it on Github if anyone else wants to play around with it.
Thanks again
Thanks again
My fork of Snes9x: https://github.com/cptnoremac/snes9x
Re: Swap controller mappings
There is already an existing function to swap input between port 1 and 2 (by default mapped to number key 6 in the windows version):
You could simply call this in your timer.
Code: Select all
S9xApplyCommand(S9xGetCommandT("SwapJoypads"),1,0);
-
- Snes9x White Belt
- Posts: 3
- Joined: Wed Dec 09, 2020 6:22 pm
Re: Swap controller mappings
Awesome. I'll try that out. Thank you.
My fork of Snes9x: https://github.com/cptnoremac/snes9x