TeamMidnightDust / MidnightControls

A Minecraft mod adding controller support and enhanced controls overall.
https://midnightdust.eu/midnightcontrols/
MIT License
179 stars 28 forks source link

Breaking key binding bug #235

Closed Pointlesstrfx closed 9 months ago

Pointlesstrfx commented 11 months ago

Describe the bug First none of the binds I put in saved. Second and worst is that the last key bind you input in is stuck on and keeps inputting, making the the controller unresponsive.

To Reproduce Steps to reproduce the behavior:

  1. Go into controller bindings
  2. Change any key bind
  3. try using any buttons or inputs
  4. See error; inputs additional key binds and unable to exit

Expected behavior That inputting the intended key bind and exiting the input means it no longer accepts additional inputs.

Screenshots

Screenshot 2023-10-20 211124

Desktop (please complete the following information):

Additional context It works perfectly fine in 1.20, I don't know how it broke so badly now.

Techcraft7 commented 10 months ago

I am having this same problem. The keybinds in the config file do not appear to be properly saving:

"BINDING": {
    "controller.controls.forward": "101",
    "controller.controls.debug_screen": "-1",
    "controller.controls.pick_block": "14",
    "controller.controls.screenshot": "-1",
    "controller.controls.controls_ring": "-1",
    "controller.controls.chat": "-1",
    "controller.controls.key.command": "-1",
    "controller.controls.key.modmenu.open_menu": "-1",
    "controller.controls.key.boosted-brightness.select2": "-1",
    "controller.controls.key.boosted-brightness.next": "-1",
    "controller.controls.key.boosted-brightness.lower": "-1",
    "controller.controls.player_list": "-1",
    "controller.controls.key.keyboard.apostrophe": "-1"
  },

This could be one possible cause but further digging is required

Techcraft7 commented 10 months ago

Ok so I think the problem might be caused by this line not getting called: https://github.com/TeamMidnightDust/MidnightControls/blob/afee0b407de30d8bfddbbe3e8107d7845081097e/src/main/java/eu/midnightdust/midnightcontrols/client/MidnightInput.java#L159

If this line does not get calls then I think it will keep adding buttons into the controlsInput.currentButtons list

Unrelated, but why is it converting it into an array and passing it into finishBindingEdit when the array is just a carbon copy of currentButtons which is accessible in ControllerControlsWidget. I don't think that's what's causing the issue but it was the only thing that looked odd to me.

I can't figure it out from the code alone I'd need a debugger

Motschen commented 9 months ago

This is actually caused by the trigger buttons outputting a negative state when idle, which results in them being set as REPEAT in the "handleAxe" method and therefore not allowing the code @Techcraft7 mentioned to be executed. Thank you very much for your help!

Kichura commented 9 months ago

For some reason, this causes the left click keybind to assume it's always in touch mode when it shouldn't be.

Motschen commented 9 months ago

Fixed in 1.9.1 and higher