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

Switch DirectInput to SDL #1768

Merged
merged 8 commits into from
Oct 31, 2024
Merged

Switch DirectInput to SDL #1768

merged 8 commits into from
Oct 31, 2024

Conversation

rr-
Copy link
Collaborator

@rr- rr- commented Oct 28, 2024

Checklist

  • I have read the coding conventions
  • I have added a changelog entry about what my pull request accomplishes, or it is an internal change

Description

Resolves #1695. Can cause regressions in TR1.

I still need to add an UI for the controller settings, but other than that, the code for the entire thing is out there.

@rr- rr- added Internal The invisible stuff TR2 labels Oct 28, 2024
@rr- rr- self-assigned this Oct 28, 2024
Copy link

github-actions bot commented Oct 28, 2024

Copy link
Collaborator

@walkawayy walkawayy left a comment

Choose a reason for hiding this comment

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

Everything LGTM in TR1.

In TR2, everything seems to work except there seems to be a bug with the console. Try doing:

  1. New game or play 1
  2. Open inventory and go the controls menu. You don't even have to change anything.
  3. Exit the controls menu and go back to the game.
  4. Open the console.

You should now be stuck in a state where no inputs register except oddly up and down to scroll past console commands. You can't type, enter doesn't work, etc. You have to force quit the game.

I still need to add an UI for the controller settings, but other than that, the code for the entire thing is out there.
Also, my PS5 controller did not work in TR2. Idk if it should be or not? I reading this as the UI isn't done but the functionality should be working. LMK if I read it wrong.

@rr- rr- force-pushed the inputs branch 2 times, most recently from c48fd5f to fde6822 Compare October 29, 2024 21:31
@walkawayy
Copy link
Collaborator

walkawayy commented Oct 29, 2024

[258/269] Compiling C object TR2X.dll.p/game_ui_controllers_controls.c.obj
../../../src/tr2/game/ui/controllers/controls.c: In function ‘M_NavigateInputsDebounce’:
../../../src/tr2/game/ui/controllers/controls.c:118:5: warning: implicit declaration of function ‘Shell_ProcessEvents’ [-Wimplicit-function-declaration]
  118 |     Shell_ProcessEvents();

Getting this build issue. I think controls.c needs shell.h included.

@rr- rr- force-pushed the inputs branch 2 times, most recently from e4df814 to 629ef3e Compare October 29, 2024 21:36
@rr-
Copy link
Collaborator Author

rr- commented Oct 29, 2024

[258/269] Compiling C object TR2X.dll.p/game_ui_controllers_controls.c.obj
../../../src/tr2/game/ui/controllers/controls.c: In function ‘M_NavigateInputsDebounce’:
../../../src/tr2/game/ui/controllers/controls.c:118:5: warning: implicit declaration of function ‘Shell_ProcessEvents’ [-Wimplicit-function-declaration]
  118 |     Shell_ProcessEvents();

Getting this build issue. I think controls.c needs shell.h included.

Thanks. Rebased + fixed.

@walkawayy
Copy link
Collaborator

Nice the console soft lock is fixed.

Two things:

  1. Backspace in the console is deleting two characters instead of 1.
  2. This may be a separate PR, but we talked about possibly changing the flare key from period . to comma , to match TR3/4/5. TR2 used the slash / key which we now use for console.

@walkawayy
Copy link
Collaborator

walkawayy commented Oct 29, 2024

Controller is working well on W11.

Stella's TR2 site:
https://tombraiders.net/stella/walks/controls/TR2controls.html

Right now, the controller's L2/R2 buttons are working like TR1X. L2 is sidestep left and R2 is sidestep right. Stella says for PS1 TR2, R2 + D-pad left/right is sidestep, and L2 is flare.

@rr-
Copy link
Collaborator Author

rr- commented Oct 30, 2024

@walkawayy updated the UI to offer editing controller layouts. It suffers from bad text overlaps due to the two-column layout and lengthy controller key names. I'd like to tackle this before merging as it feels unfinished as it is. At the same time, I'd like to keep the current two-column UI layout to avoid too many changes as this PR is already too big. Can you help me shorten the names in libtrx/game/input/backends/controller.c? CC @lahm86
I believe we can use at most 5 characters. Also, with the injection framework, we could inject new sprites, even non-existing ones.

@rr- rr- marked this pull request as ready for review October 30, 2024 01:33
@rr- rr- requested review from a team as code owners October 30, 2024 01:33
@rr- rr- requested review from lahm86, walkawayy and aredfan and removed request for a team October 30, 2024 01:33
@Richard-L
Copy link
Collaborator

There are 4 control schemes available in PS1 TR2, of which one is the one you quoted above. If you use the scheme where sidesteps are still available from both shoulder buttons, you are forced to use flares from the inventory.

TR3 remedied this by introducing a shortcut of WALK+SELECT to use a flare directly, while maintaining shoulder button sidesteps. I think it'd be a worthwhile addition to TRX.

@rr-
Copy link
Collaborator Author

rr- commented Oct 30, 2024

There are 4 control schemes available in PS1 TR2, of which one is the one you quoted above. If you use the scheme where sidesteps are still available from both shoulder buttons, you are forced to use flares from the inventory.

TR3 remedied this by introducing a shortcut of WALK+SELECT to use a flare directly, while maintaining shoulder button sidesteps. I think it'd be a worthwhile addition to TRX.

Correct – my plan is to add TR3 sidesteps in a follow-up PR as this one is already massive.

@rr-
Copy link
Collaborator Author

rr- commented Oct 30, 2024

Nice the console soft lock is fixed.

Two things:

  1. Backspace in the console is deleting two characters instead of 1.
  2. This may be a separate PR, but we talked about possibly changing the flare key from period . to comma , to match TR3/4/5. TR2 used the slash / key which we now use for console.

1 – Thanks – fixed.
2 – This PR already switches flares to , as per our internal conversation on Discord.

@rr- rr- force-pushed the inputs branch 2 times, most recently from 9f137ac to add35aa Compare October 30, 2024 08:22
@rr-
Copy link
Collaborator Author

rr- commented Oct 30, 2024

Alright – I've shortened the names. While they're not the prettiest, we're eventually going to inject icons for the other buttons anyway.

@rr- rr- merged commit b56ccd9 into develop Oct 31, 2024
7 checks passed
@rr- rr- deleted the inputs branch October 31, 2024 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Internal The invisible stuff TR2
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Switch DirectInput to SDL
5 participants