Skip to content
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

Added config and handling for special game controller buttons to quit and reset display. #77

Merged
merged 11 commits into from
Jul 1, 2022
Merged

Conversation

smootalicious
Copy link
Contributor

@smootalicious smootalicious commented Jun 13, 2022

On a game controller, using the M8 defined buttons can cause conflicts with defined M8 functionality, or simply fail to quit in the case of no attached keyboard to execute a quit. I added special game controller configs to quit and reset the display using any of the unused/unmapped to M8 buttons in combination with the defined "Select" button. The defaults are quit = select + SDL_CONTROLLER_BUTTON_RIGHTSTICK and reset display = select + SDL_CONTROLLER_BUTTON_LEFTSTICK.

@smootalicious
Copy link
Contributor Author

I ended up reverting the removal of the original key combo for reset display since it may be (and probably is) used by users of the M8.

…rts. Read the database BEFORE trying to read the game controller. Check for the user's game controller db if found, or fall back to the one included in the m8c directory.
@smootalicious
Copy link
Contributor Author

Added the game controller definitions from @jasonporrit's scripts
(de383da)

@smootalicious
Copy link
Contributor Author

Initialize the game controllers if they are plugged in before m8c starts. Read the database BEFORE trying to read the game controller - Basically, reading the database has to happen before assigning the joystick or it doesn't register as a gamepad. Check for the user's game controller db if found in their config dir, or fall back to the one included in the m8c directory.

(f7cf5e2)
f7cf5e2

@smootalicious
Copy link
Contributor Author

smootalicious commented Jun 14, 2022

Changed strategy to use SDL functions only and removed stat.h strategy because it is not cross-platform.

(a839ff9)

Ideally what should happen here is : try to get the gamecontroller db from the user pref directory; If it doesn't exist, then create it from the included one, and then try to open it. If that fails, then read the included db file.
I haven't implemented this, but it seems like the right way..

@smootalicious
Copy link
Contributor Author

RE: device disconnect detection. For some reason, the Effects Help screen causes the m8 (or headless) to send zero bytes and appear disconnected. One workaround by setting wait_for_device in the config file = true, but I had to reset the zero byte counter in the device disconnect code block, otherwise the zero counter would cause a display reset repeatedly with no delay. The other was to add a longer disconnect timeout, which I defaulted to 15 seconds and made configurable.

…o not start device disconnect detection while user is pressing buttons. This allows the user to stay on the Effect Help screen indefinitely, since thay have the 'EDIT' button pressed the whole time. If unit is disconnected, m8c shutsdown after ~2 seconds.
@smootalicious
Copy link
Contributor Author

I'm really sorry if I am overwhelming you with changes.

@smootalicious
Copy link
Contributor Author

Maybe adding a config parameter for the zero byte timeout is overkill, but the changes to reset the zero byte counter while the user has a button pressed does keep the m8c from shutting down on the Effects Help screen.

@laamaa
Copy link
Owner

laamaa commented Jul 1, 2022

Sorry for the delay with checking this - work, family and weekly beats have taken all my time lately :)
I read through the PR and the changes make sense to me. I'll give it a little test and merge if it works ok for me!

@laamaa
Copy link
Owner

laamaa commented Jul 1, 2022

Looks like the fx palette reset still happens when using M8 hw buttons for navigation. It probably needs a better check for timeout than the current 0byte system, this is probably best addressed in a separate issue...

I didn't have a gamepad to test the quit buttons with but I'll assume it works :)

@laamaa laamaa merged commit e5df913 into laamaa:main Jul 1, 2022
@smootalicious
Copy link
Contributor Author

Sorry, I'm still awaiting my hardware M8 in the next shipment, so I couldn't test the zerobyte behavior with one. :(

@laamaa
Copy link
Owner

laamaa commented Jul 1, 2022

No worries :) The HW unit sends packets that contain the keypress+ID of the current view. That could be used with the current solution but it's probably a better idea to find some other way.

@smootalicious
Copy link
Contributor Author

I found some other way - see new PR with just a tiny change I believe should work in all cases due to the port reset behavior on entering the loop when port==null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants