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

CLI port: Allow to map NDS keys to joystick buttons. #822

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MasterEnoc
Copy link

  • It allows to map NDS key to joystick buttons. Keys were mapped and
    then restored with load_default_config(), thus I remove it, however,
    looks like gtk frontends have a different keycode for joystick
    buttons, thus a user of both frontends will have to rewrite the
    config each time it uses one frontend or the other.

  • it fixes config file processing, it now continues even when
    errors are found. Previously, mapping a NDS button to a joysticks
    buttons had to be sequencially, I. e. A, then B, then Select, etc. If
    any key was skipped in the corresponding order desmume would stop from
    mapping the keys.

  • Add boost support for joysticks, currently it works in a hold
    fashion, I do not know if it should be changed to toggle, or
    both. Additionally, I implemented this in a very cheap way, I did not want
    to make big chances in the codebase, nonetheless, I could try to fix it in other
    way if you do not like it.

case SDL_JOYBUTTONUP:
key_code = ((event->jbutton.which & 15) << 12) | JOY_BUTTON << 8 | (event->jbutton.button & 255);
key = lookup_joy_key( key_code );
if (key == 0x2000)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's that magic constant ?

@@ -427,7 +427,7 @@ int main(int argc, char ** argv) {
slot2_device_type = NDS_SLOT2_NONE;
break;
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

likewise, etc

@MasterEnoc
Copy link
Author

I fixed whitespace issues, and added a comment about the magic number in ctrlssdl.cpp.

@MasterEnoc
Copy link
Author

I missed one whitespace, all should be fixed now.

@zeromus
Copy link
Contributor

zeromus commented Aug 8, 2024

Fixing a pointless whitespace commit with another commit defeats the purpose, unless the PR is squashed. The right way to do this would be to rebuild the patch as a single commit. It's a good exercise for the future if you do that with git tools (soft reset to master on the commit prior to your work, then commit the current differences as a new commit) because it's helpful for cleaning up more severe changes, but you get the same result if you clone the repo again and paste your working copy on top and create a new commit. In either case once done you would have to force push it to the PR branch.

Also process config file correctly even when errors are found. Previously,
mapping a NDS button to a joysticks buttons had to be sequencially, I. e. A,
then B, then Select, etc. If any key was skipped in the corresponding order
desmume would stop from mapping the keys.
@MasterEnoc
Copy link
Author

MasterEnoc commented Aug 9, 2024

Fixed, I just rebased the branch on master and squashed the last two commits (the ones about whitespace).

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.

3 participants