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

Controller Mapping - Part 1 #39

Merged
merged 11 commits into from
Nov 13, 2022

Conversation

XuYicong
Copy link
Member

@XuYicong XuYicong commented Sep 14, 2022

Addresses #17

This is the part 1 out of 2, to add support of mapping controller buttons & thumbsticks to touchscreen actions.

In this part, PlayMice has been refactored to add support of thumbstick mapping. As this refactor changes a lot of how PlayMice works, it would be better to merge this earlier, so as to avoid potential conflicts later.

What This PR Has Done

  • Mapping thumbsticks to camera control and joystick control and draggable button
  • Mapping controller keys except LS/RS/D-PAD
  • Changed joystick mapping's appearence under editor mode to distinguish with camera control
  • Added new item to circle menu for mouse-controled joystick.
  • Deleted useless circle menu items (aka adding mouse buttons, since mouse buttons can now be added just like other keys)
  • Removed UwU (That event handler is now occupied)

What Are Left For Part 2

  • Sensitivity adjustment of thumbstick mapping
  • D-PAD/LS/RS mapping
  • Map controller keys to draggable buttons
  • Font size of controller keynames should be fixed (some names are too long)
  • Bind current configuration "sensitivity" to action's displayed size

@amirsaam
Copy link
Member

You are my hero buddy <3

@XuYicong XuYicong marked this pull request as ready for review October 4, 2022 07:32
@amirsaam
Copy link
Member

amirsaam commented Oct 5, 2022

how can I test it?

@XuYicong
Copy link
Member Author

XuYicong commented Oct 6, 2022

@amirsaam Before you build playcover, in carthage config file, set playtools revision as this branch. Then when you build playcover, it will be built with this branch's playtools.

@amirsaam
Copy link
Member

amirsaam commented Oct 6, 2022

@XuYicong sorry I'm not familiar with carthage, did I do it wrong?

git "https://github.com/XuYicong/PlayTools" "feat/controller-mapping"

in input file

@XuYicong
Copy link
Member Author

XuYicong commented Oct 6, 2022

@amirsaam I don't mean a input file. I mean the Cartfile file in root directory of playcover repository.
Change the content of it to github "XuYicong/PlayTools" "feat/controller-mapping"

@amirsaam
Copy link
Member

amirsaam commented Oct 6, 2022

oh, my bad. didn't pay attention to that. I figured it out with your help.

there are couple of problems:

  1. RSB and LSB do not care if the stick returned to original state on releasing the sticks (and no matter what, any mouse movement would end as keybind like the LMB)
Screen.Recording.1401-07-14.at.09.58.40.mp4
  1. D-PAD keys do not answer at all no matter if they are as D-PAD or just individual keys (tbh I duuno if they can work as individual at all because I couldn't test, but if they are not planned like that, they should be)
Screen.Recording.1401-07-14.at.10.04.17.mp4

NOTE: In the video I didn't changed the D-PAD keys from WASD to D keys, but I actually did that but didn't record it.
other keys as far as I tested worked fine.

for the records my controller is MFI type Backbone One

@XuYicong
Copy link
Member Author

XuYicong commented Oct 6, 2022

RSB and LSB do not care if the stick returned to original state (and no matter what, any mouse movement would end as keybind like the LMB)

For LSB and RSB mapping, there are two modes. They can be mapped to a mouse area or a joystick. In your case, you should map it to a joystick, rather than mouse area. Mouse area is designed for camera control.

For mouse movement mapping, yes, it becomes keybind once mouse moved. It is currently so designed. Do you have a better idea how should that work?

D-PAD keys do not answer at all no matter if they are as D-PAD or just individual keys (tbh I duuno if they can work as individual at all because I couldn't test, but if they are not planned like that, they should be)

D-PAD keys are expected to work as individual keys, but they may currently have bugs. But they are not expected to be mapped to WASD control. You can instead map a LSB or RSB to that.

@amirsaam
Copy link
Member

amirsaam commented Oct 6, 2022

For LSB and RSB mapping, there are two modes. They can be mapped to a mouse area or a joystick. In your case, you should map it to a joystick, rather than mouse area. Mouse area is designed for camera control.

I see, I should create a WASD (Directional Move) then map it to LSB. But will RSB work as camera while it is keybinded to Directional Move? Because mapping it to mouse area will result to that issue

For mouse movement mapping, yes, it becomes keybind once mouse moved. It is currently so designed. Do you have a better idea how should that work?

It could be better to have it's own designated create option like there is a mouse area option already there, why not just limit mouse to that? Right now releasing this like that would create a lot of UX issues

D-PAD keys are expected to work as individual keys, but they may currently have bugs. But they are not expected to be mapped to WASD control. You can instead map a LSB or RSB to that.

I was just testing D-PAD, while you use a controller you would never want D-PAD as move control.

Btw looks like you didn't implemented R3 (RS) or L3 (LS) buttons (pressing down L&R sticks), am I right?

@XuYicong
Copy link
Member Author

XuYicong commented Oct 6, 2022

Btw looks like you didn't implemented R3 (RS) or L3 (LS) buttons (pushing down L&R sticks), am I right?

Yes. I was expecting they could work automatically but it seems they don't. I don't have device to test them so I nearly forgot their existence.

I see, I should create a WASD (Directional Move) then map it to LSB. But will RSB work as camera while it is keybinded to Directional Move? Because mapping it to mouse area will result to that issue

LSB and RSB are treated equivalently. Either LSB or RSB can be mapped to Directional Move then should work as Directional Move.

It could be better to have it's own designated create option like there is a mouse area option already there, why not just limit mouse to that? Right now releasing this like that would create a lot of UX issues

Good idea. I remember Isaac was making a new editor UI? If he has not given up yet, I think it's better to leave this to his new editor UI.

@amirsaam
Copy link
Member

amirsaam commented Oct 6, 2022

LSB and RSB are treated equivalently. Either LSB or RSB can be mapped to Directional Move then should work as Directional Move.

I didn't get this right, so if I map RSB as camera control, what is expected behaviour?

Good idea. I remember Isaac was making a new editor UI? If he has not given up yet, I think it's better to leave this to his new editor UI.

Yeah I tried to mention his work and tell that exactly but looks like he didn't create a PR yet.

@XuYicong
Copy link
Member Author

XuYicong commented Oct 6, 2022

I didn't get this right, so if I map RSB as camera control, what is expected behaviour?

RSB then works as camera control.

More specifically, when RSB works as camera control, whenever RSB is not in center, the touch point is moving towards corresponding direction. When RSB is back to center, the touch point stops moving, and releases (lift off, cease pressing).

@XuYicong XuYicong changed the base branch from 2.0-UI to master October 29, 2022 12:45
@amirsaam
Copy link
Member

amirsaam commented Nov 1, 2022

Can I ask when (approximately) it will be ready?

@XuYicong
Copy link
Member Author

XuYicong commented Nov 4, 2022

Sorry I have not got time to continue with this recently. If others want to contribute to this, you are free to take it. I will not have time for this again until the end of November.

@Depal1 Depal1 marked this pull request as draft November 9, 2022 03:39
@XuYicong XuYicong changed the title Feat: map controller controls to touchscreen actions Controller Mapping - Part 1 Nov 13, 2022
@XuYicong XuYicong marked this pull request as ready for review November 13, 2022 09:54
Copy link
Member

@Depal1 Depal1 left a comment

Choose a reason for hiding this comment

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

Everything works as stated in the pull request's description. GC buttons can be mapped, including the ones from IOkit devices with a GC wrapper. This was tested for GC controllers too, DS4 and Xbox One. Mouse and keyboard maps were verified to work after the changes.

@Depal1 Depal1 merged commit 320d5f3 into PlayCover:master Nov 13, 2022
Copy link
Member

@Depal1 Depal1 left a comment

Choose a reason for hiding this comment

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

PlayCover/PlayCover#515 restores compatibility with PlayTools' keymaps.

XuYicong pushed a commit to XuYicong/PlayTools that referenced this pull request Mar 4, 2023
@XuYicong XuYicong deleted the feat/controller-mapping branch March 17, 2023 17:52
@MemoryYiJun
Copy link

您好 我在使用joystick映射时无法直接触发45°方向

@XuYicong
Copy link
Member Author

XuYicong commented Mar 25, 2023

@MemoryYiJun Hello, I'm not sure what exactly do you mean by "joystick 映射". This PR is about mapping controller(手柄) to touches, but I think you are referring to something related to WASD. If this is the case, re-create the mapping by choosing the approriate mapping type. You can read our docs for detailed guide. If you have more questions you can also join the discord server or QQ群(767242941)for help.

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

Successfully merging this pull request may close these issues.

4 participants