Skip to content

Add a button to switch between fixed and floating joystick modes#179

Merged
TheMoonThatRises merged 1 commit intoPlayCover:masterfrom
viatearz:joystick-mode
Jan 28, 2025
Merged

Add a button to switch between fixed and floating joystick modes#179
TheMoonThatRises merged 1 commit intoPlayCover:masterfrom
viatearz:joystick-mode

Conversation

@viatearz
Copy link
Copy Markdown
Contributor

@viatearz viatearz commented Jan 17, 2025

Summary

Some games only support floating joystick (also called dynamic joystick or free joystick), but PlayTools currently defaults to a fixed joystick, causing it to not work properly in certain games.
Although increasing the size of joystick element in the keymapping editor can make it work, many users don't know this workaround.

Explanation

File Changes
Elements.swift Added a mode field in struct Joystick, use Optional type to ensure compatibility with older keymapping configuration files.
PlayAction.swift Simulate touches for both fixed and floating joystick modes.
EditorController.swift Joystick.swift JoystickElement.swift Added a button UI in the mapping editor to switch joystick modes. To prevent accidental clicks, the button only appears when the joystick element is focused.
PlayTools.strings Added keys keymappingEditor.joystickMode.fixed and keymappingEditor.joystickMode.floating.

Screenshot

1 2 3 4

Related Links

@TheMoonThatRises
Copy link
Copy Markdown
Member

Since this change updates the structure of keymappings, can you also make a PR that reflects the changes in the PlayCover app too? If not, thats fine, I can do it.

@viatearz
Copy link
Copy Markdown
Contributor Author

Since this change updates the structure of keymappings, can you also make a PR that reflects the changes in the PlayCover app too? If not, thats fine, I can do it.

Alright, I have done it. Please take a look.

Copy link
Copy Markdown
Member

@XuYicong XuYicong left a comment

Choose a reason for hiding this comment

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

Good job! I'm concerned of the keymap compatibility tho. People may open an old keymap with the new software, or open a new keymap with an old software. I'm not sure if that could cause problems, but if you think that's not a big case then I'll just let it be.

@TheMoonThatRises
Copy link
Copy Markdown
Member

I think keymap compatibility is outside the scope of this PR, as PlayTools usually relies on PlayCover to update the keymap format. But a later PR can be created so that PlayTools has a proper decoder similar to how PlayCover does it.

@TheMoonThatRises TheMoonThatRises merged commit 26b76b8 into PlayCover:master Jan 28, 2025
@viatearz viatearz deleted the joystick-mode branch January 31, 2025 13:57
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.

[Bug]: The key mapping does not work in the game with joystick following the finger

3 participants