Ability to setup hotkeys to cycle through controllers #166

Open
SomeoneIsWorking wants to merge 1 commits from SomeoneIsWorking/feature/input-switch into master
SomeoneIsWorking commented 2024-11-02 18:18:54 +00:00 (Migrated from github.com)

What this does is you can add/remove hotkeys for players to cycle through controllers.
Reasons I made this.

  • Sometimes Player 1 is set to disabled by itself (when started with controller off, Isaac had a fix PR for this but I don't know if it's implemented).
  • My son sometimes plays co-op with a single controller and sometimes plays co-op with us so we can cycle Player 2 based on it.
  • On ROG Ally, I can easily switch between handheld controller and external controller.

KNOWN ISSUES

  • Toast message not displaying when game is being rendered. I don't know how to fix it. I think it's related to Avalonia and the render component and the render component is rendering on top of the toast.

NOTES

  • Hotkeys don't work before starting a game. The only time where both this works and the toast is visible is if you press it while the emulator is loading the game. The keys will work during gameplay but toast won't be visible due to the issue.

UPDATES NEEDED

  • "Player X" isn't localized.
  • Layout could be better.

POSSIBLE OTHER UPDATES

  • Currently this relies on calling a ViewModel because controller logic is tied into it which is not 100% ideal so maybe that can be decoupled.

Edits

Screenshot from latest build

image

What this does is you can add/remove hotkeys for players to cycle through controllers. Reasons I made this. - Sometimes Player 1 is set to disabled by itself (when started with controller off, Isaac had a fix PR for this but I don't know if it's implemented). - My son sometimes plays co-op with a single controller and sometimes plays co-op with us so we can cycle Player 2 based on it. - On ROG Ally, I can easily switch between handheld controller and external controller. **KNOWN ISSUES** - Toast message not displaying when game is being rendered. I don't know how to fix it. I think it's related to Avalonia and the render component and the render component is rendering on top of the toast. **NOTES** - Hotkeys don't work before starting a game. The only time where both this works and the toast is visible is if you press it while the emulator is loading the game. The keys will work during gameplay but toast won't be visible due to the issue. **UPDATES NEEDED** - [x] "Player X" isn't localized. - [x] Layout could be better. **POSSIBLE OTHER UPDATES** - Currently this relies on calling a ViewModel because controller logic is tied into it which is not 100% ideal so maybe that can be decoupled. **Edits** Screenshot from latest build ![image](https://github.com/user-attachments/assets/4ed95e3f-6c20-411a-a78e-23ad44494c49)
github-actions[bot] commented 2024-11-02 18:28:16 +00:00 (Migrated from github.com)
Download the artifacts for this pull request: * [ryujinx-Release-1.2.0+9a7f560-macos_universal](https://nightly.link/Ryubing/Ryujinx/actions/artifacts/2525305919.zip) * [ryujinx-Release-1.2.0+9a7f560-linux_arm64](https://nightly.link/Ryubing/Ryujinx/actions/artifacts/2525307388.zip) * [ryujinx-Release-1.2.0+9a7f560-linux_arm64-AppImage](https://nightly.link/Ryubing/Ryujinx/actions/artifacts/2525307500.zip) * [ryujinx-Release-1.2.0+9a7f560-linux_x64](https://nightly.link/Ryubing/Ryujinx/actions/artifacts/2525313078.zip) * [ryujinx-Release-1.2.0+9a7f560-linux_x64-AppImage](https://nightly.link/Ryubing/Ryujinx/actions/artifacts/2525313167.zip) * [ryujinx-Release-1.2.0+9a7f560-win_x64](https://nightly.link/Ryubing/Ryujinx/actions/artifacts/2525326413.zip) <details><summary>Only for Developers</summary> * [ryujinx-Debug-1.2.0+9a7f560-linux_arm64](https://nightly.link/Ryubing/Ryujinx/actions/artifacts/2525301206.zip) * [ryujinx-Debug-1.2.0+9a7f560-linux_arm64-AppImage](https://nightly.link/Ryubing/Ryujinx/actions/artifacts/2525301284.zip) * [ryujinx-Debug-1.2.0+9a7f560-macos_universal](https://nightly.link/Ryubing/Ryujinx/actions/artifacts/2525306955.zip) * [ryujinx-Debug-1.2.0+9a7f560-linux_x64](https://nightly.link/Ryubing/Ryujinx/actions/artifacts/2525307304.zip) * [ryujinx-Debug-1.2.0+9a7f560-linux_x64-AppImage](https://nightly.link/Ryubing/Ryujinx/actions/artifacts/2525307392.zip) * [ryujinx-Debug-1.2.0+9a7f560-win_x64](https://nightly.link/Ryubing/Ryujinx/actions/artifacts/2525319159.zip) </details>
VeraPhobia commented 2024-11-03 07:53:13 +00:00 (Migrated from github.com)

i downloaded the artifact but i cant find the option to test it out

image

i downloaded the artifact but i cant find the option to test it out ![image](https://github.com/user-attachments/assets/14967955-367f-4f77-83a9-4fe833bc55ad)
SomeoneIsWorking commented 2024-11-03 11:42:38 +00:00 (Migrated from github.com)

@VeraPhobia Yes, I just noticed, I think I messed up the rebase and I can't get the code back anymore so I'll try to do it again.

Edit: Thank VSCode local history, I was able to restore it.

image

This is how it should look like now.

@VeraPhobia Yes, I just noticed, I think I messed up the rebase and I can't get the code back anymore so I'll try to do it again. Edit: Thank VSCode local history, I was able to restore it. <img width="496" alt="image" src="https://github.com/user-attachments/assets/2c5d0541-bf66-488a-abe8-c61475888c61"> This is how it should look like now.
VeraPhobia commented 2024-11-03 11:55:11 +00:00 (Migrated from github.com)

extremely minor details but it would look better if the text and fields were in one line, right now they are kind of not.

and thank you for the great work

extremely minor details but it would look better if the text and fields were in one line, right now they are kind of not. and thank you for the great work
SomeoneIsWorking commented 2024-11-17 18:49:01 +00:00 (Migrated from github.com)

Okay, I got some drops of motivation to update it, also like to play with Copilot Edits.

Okay, I got some drops of motivation to update it, also like to play with Copilot Edits.
SomeoneIsWorking commented 2024-12-22 20:59:36 +00:00 (Migrated from github.com)

Rebased

Rebased
RickAndTired commented 2025-01-28 06:34:03 +00:00 (Migrated from github.com)

Is there a way to have the github-actions bot to create another updated appimage?
I'd love to try this feature

Also will this have hotkeys for all players or just 1 and 2?

Is there a way to have the github-actions bot to create another updated appimage? I'd love to try this feature Also will this have hotkeys for all players or just 1 and 2?
GreemDev commented 2025-01-28 06:35:24 +00:00 (Migrated from github.com)

Is there a way to have the github-actions bot to create another updated appimage? I'd love to try this feature

Also will this have hotkeys for all players or just 1 and 2?

Someone has to fix the merge conflicts this has before the appimage can be compiled again.

> Is there a way to have the github-actions bot to create another updated appimage? I'd love to try this feature > > Also will this have hotkeys for all players or just 1 and 2? Someone has to fix the merge conflicts this has before the appimage can be compiled again.
SomeoneIsWorking commented 2025-01-29 15:49:20 +00:00 (Migrated from github.com)

Also will this have hotkeys for all players or just 1 and 2?

You can add remove with "Add" "Remove", up to 8 players

Someone has to fix the merge conflicts this has before the appimage can be compiled again.

I'll rebase again soon(tm)

> Also will this have hotkeys for all players or just 1 and 2? You can add remove with "Add" "Remove", up to 8 players > Someone has to fix the merge conflicts this has before the appimage can be compiled again. I'll rebase again soon(tm)
SomeoneIsWorking commented 2025-01-29 16:59:14 +00:00 (Migrated from github.com)

I rebased it and ran the app, tested around the hotkey settings.
I don't know if the keys still work in game but no reason they shouldn't because the hard part was getting the menu working again.

image
I rebased it and ran the app, tested around the hotkey settings. I don't know if the keys still work in game but no reason they shouldn't because the hard part was getting the menu working again. <img width="665" alt="image" src="https://github.com/user-attachments/assets/499b13a6-d40d-4f40-a20a-e50dfec8fe6a" />
RickAndTired commented 2025-02-08 02:50:24 +00:00 (Migrated from github.com)

Pressing a hotkey to cycle controllers in game crashes Ryujinx

Ryujinx_1.2.0+9a7f560_2025-02-07_18-37-03 F1.log

Pressing a hotkey to cycle controllers in game crashes Ryujinx [Ryujinx_1.2.0+9a7f560_2025-02-07_18-37-03 F1.log](https://github.com/user-attachments/files/18716587/Ryujinx_1.2.0%2B9a7f560_2025-02-07_18-37-03.F1.log)
SomeoneIsWorking commented 2025-02-11 15:14:16 +00:00 (Migrated from github.com)

Pressing a hotkey to cycle controllers in game crashes Ryujinx

Sorry, I'll try to replicate.
Just that the stack trace in the log makes no sense.

InputViewModel.cs:line 903

This line is empty

InputViewModel.cs:line 466

This line is ending brace
I tried subtracting 7 from both because in that way the stack trace makes some sense.
Then it would end up a null error here which I didn't write but nvm that

_mainWindow.InputManager.KeyboardDriver.GamepadsIds

Then it's weird and it looks like you have no gamepads attached. I never tested that case.

Edit: I tried without a controller, it doesn't crash for me.

> Pressing a hotkey to cycle controllers in game crashes Ryujinx Sorry, I'll try to replicate. Just that the stack trace in the log makes no sense. > InputViewModel.cs:line 903 This line is empty > InputViewModel.cs:line 466 This line is ending brace I tried subtracting 7 from both because in that way the stack trace makes some sense. Then it would end up a null error here which I didn't write but nvm that > _mainWindow.InputManager.KeyboardDriver.GamepadsIds Then it's weird and it looks like you have no gamepads attached. I never tested that case. Edit: I tried without a controller, it doesn't crash for me.
RickAndTired commented 2025-02-13 08:43:55 +00:00 (Migrated from github.com)

I tried the linux non appimage version
Same crashes

I tried with both a controller plugged in and also without a controller plugged in
Tried multiple games
Hotkey crashes on players 1-8, but not 9+
Not sure it matters, but looks like there is no limit on adding players (got to 200)

Ryujinx_1.2.0+9a7f560_2025-02-13_00-33-44 NA1.log

I tried the linux non appimage version Same crashes I tried with both a controller plugged in and also without a controller plugged in Tried multiple games Hotkey crashes on players 1-8, but not 9+ Not sure it matters, but looks like there is no limit on adding players (got to 200) [Ryujinx_1.2.0+9a7f560_2025-02-13_00-33-44 NA1.log](https://github.com/user-attachments/files/18780619/Ryujinx_1.2.0%2B9a7f560_2025-02-13_00-33-44.NA1.log)
SomeoneIsWorking commented 2025-02-23 17:10:16 +00:00 (Migrated from github.com)

@RickAndTired I'm very sorry, I'll try to debug on a linux if I can, I only debugged this version on macOS.
I also debugged (and regularly use) the previous version from the original repo on Windows.

@RickAndTired I'm very sorry, I'll try to debug on a linux if I can, I only debugged this version on macOS. I also debugged (and regularly use) the previous version from the original repo on Windows.
RickAndTired commented 2025-02-23 21:43:55 +00:00 (Migrated from github.com)

No worries, let me know if there's anything I can try to do to help.

No worries, let me know if there's anything I can try to do to help.
This pull request has changes conflicting with the target branch.
  • src/Ryujinx/AppHost.cs
  • src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin SomeoneIsWorking/feature/input-switch:SomeoneIsWorking/feature/input-switch
git checkout SomeoneIsWorking/feature/input-switch
Sign in to join this conversation.
No description provided.