-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assigning Joystick to BBC Keyboard #87
Conversation
- Assigning host joystick axes and buttons to BBC keyboard (up to 2 joysticks or gamepads separately). - New human readable file format for joystick mapping (see Documents/JoystickMap.txt) - Option to automatically load image-specific joystick mapping file (same as disk name, but .jmap extension) - Fixed displaying keys assigned to Shift in User Mapping dialog - Added "Unassign" to keyboard and joystick mapping dialog - Joystick mapping table is separate from key mapping table - Mapping joysticks is done separately from keyboard (but using the same dialog code) - Highlight assigned keys in joystick mapping dialog Squashed commit of the following: commit 2385678 commit b4933de commit c79db73 commit caf3afa commit a3f332c commit cad97af commit fe0adbf commit 33be28f commit 7aed289 commit ddd2a6c commit 0362437 commit da6c911 commit 2c8ee02 commit ebe5247 commit 25fcda4 commit 3ae3f27 commit 79b300b commit 8d6b625 commit 5b1ae01 commit a1b76c8 commit 0f53c4d commit cc09240 commit 2568d2a commit 9924f48 commit aa51f77 commit 926e6c4 commit c680917 commit ae74380 commit 1eac76b
It's been waiting a long time, but finally it's 100% done. Joystick mapping is completely separate from user keyboard mapping, loaded, saved and configured separately. Grab it while it's hot. Code reviews are welcome. Don't hesitate to change or rewrite my additions to help pages - I'm not a native speaker and I may have made some stylistic or other mistakes. |
Map first two PC joystick or gamepad fire buttons to two BBC joystick buttons separately. Fixes stardot#74
Also replace -> with right-arrow symbol
Moved SetDlgItemChecked() and IsDlgItemChecked() to new files, Dialog.cpp and Dialog.h
- Moved joystick state to JoystickState struct - Removed ResetJoystick - Fixed some signedness warnings - Unmute when keyboard mapping dialog is closed
- Simplfied code a bit - Added CaptureJoystick() function to remove duplication - Renamed MaybeEnableInitJoystick() function for consistency
Long names are OK, and this makes it easier to search the code for related variables
- Maps from ... to BBCKey are now const - Functions GetBBCKeyBy... return pointer instead of reference
- Display checkmark next to 'Initialise Joystick' menu item if first joystick initialised OK. - Display warning message only if explicit initialisation failed.
I didn't see q mapping for the POV, which on my current favourite arcade stick (PS3 HORI Fighting stick mini) is where the digital joystick maps. |
@richard-broadhurst Hello :), It's there, named "hat" in the JoystickMap.txt, Axis7 and Axis8. Diagonals work too. if (joyInfoEx.dwPOV != JOY_POVCENTERED)
{
if (joyInfoEx.dwPOV >= 29250 || joyInfoEx.dwPOV < 6750)
axes |= (1 << BEEB_JOY_AX_HAT_UP);
if (joyInfoEx.dwPOV >= 2250 && joyInfoEx.dwPOV < 15750)
axes |= (1 << BEEB_JOY_AX_HAT_RIGHT);
if (joyInfoEx.dwPOV >= 11250 && joyInfoEx.dwPOV < 24750)
axes |= (1 << BEEB_JOY_AX_HAT_DOWN);
if (joyInfoEx.dwPOV >= 20250 && joyInfoEx.dwPOV < 33750)
axes |= (1 << BEEB_JOY_AX_HAT_LEFT);
} |
I'm really sorry, I missed that, next time I'll do it on the PC, not a phone! |
Sorry for the delay. An interesting question was raised on Stardot about the joystick numbering. If we have different joysticks connected, is there a way to know which one maps to Joy1 or Joy2 in the config? Or I wonder if we should add UI to allow the user to easily remap them? |
Yeah, I was thinking about it too. It's just like Coeus said - windows will assign joystick number based on the order in which they appear in the system, so they can change between reboots, or just by disconnecting and reconnecting usb joysticks. I think that we could store joystick order in preferences e.g. like this:
and provide simple UI to change the order. You just have to keep in mind that there may be several joysticks with the same manufacturer and product id connected. Actually I'm thinking that maybe I should just go ahead and merge two-joysticks branch to this, because there is already part of the functionality there and otherwise I will just duplicate the job and will have to fix the conflicts later. |
Yes, let's do that. It'll be easier to work on a single branch, I think. |
- Added second BBC joystick support - Select PC joystick and axes for each BBC joystick
This option disabled the ADC and Serial interface, presumably to make the emulator run faster. I've removed this option as it doesn't affect performance particularly, and simplifies joystick handling.
This fixes an issue where the joystick position would never be centred. With this change, the joystick is centred when the mouse is in the centre of the BeebEm window.
- Moved joystick handling to separate class and files - Up to 4 joysticks mapped to keyboard
This is somewhat experimental and may be changed or removed in the future
- Autodetect secondary thumbstick axes - Display joystick names in menu - More user friendly axis names - Map right thumbstick axes Z/RZ to RX/RY in joystick to keyboard mapping if those axes are not present to make mapping files more portable - Changed axes order, old mapping files may need to be updated
and removed unneeded backward compatiblity for jmap files
Summary of changes so far: Second joystick and Joystick to keyboard mapping
|
Moving to PR #95 |
This is redo of PR #44