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 rework #354

Merged
merged 248 commits into from
Nov 8, 2023
Merged

controller rework #354

merged 248 commits into from
Nov 8, 2023

Conversation

briaguya-ai
Copy link
Collaborator

@briaguya-ai briaguya-ai commented Oct 2, 2023

soh PRs to get builds:
Single Player Mode: HarbourMasters/Shipwright#3331
Multiplayer Mode: HarbourMasters/Shipwright#3354

todo:

  • set defaults on reorder after clear even if we already have a device index mapping i think clear isn't clearing the device index mapping ids? pressing clear all and then reorder isn't setting defaults
  • handle using controller to nav imgui and map controllers
  • axis -> axis raw press mapping
  • sdl button to axis
  • keyboard
  • rumble
  • wii u
    • figure out why release mode is being wonky (issue with newer devkit pro, it's a problem on latest dev too, resolved by not upgrading devkitpro for now)
  • analog deadzone and notch angles (save/load config and use those values)
  • set defaults button (with controller selection popup) controller rework #354 (comment)
  • save device name to sdl mapping along with guid (so we can see "xbox controller (disconnected)")
  • clear all does more than just buttons
  • reset to default buttons for all non-mapping options (rumble strength, analog deadzone, etc.)
  • do uuids in a good way don't use uuids
  • use colors to show which device index mappings are from
    • show details about mappings on hover
  • stuff from 8a69f24
  • move mapping creation into factories
  • clean up game input blocking
  • deadzone for buttons (AxisDirectionToButtonMapping) - the current implementation has "use axis deadzone for buttons" but that feels kinda messy and it won't work with the new architecture. a global threshold for presses is probably a good thing to have, but that doesn't take into account different thresholds for triggers vs sticks, so just allowing the user to configure one value isn't quite good enough.
    • cog on mappings
      • slider
  • led
  • gyro
  • remove use of + to mean dpad [WIP] controller rework HarbourMasters/Shipwright#3230 (comment)
  • put color around controller name text in rumble options
  • add colored font awesome icon for each controller with a mapping in a section
  • add modal warning users that everything will be cleared (be explicit) for clear all
  • analog x and y under preview for analog sticks (just ints)
  • devices tab
    • list of all devices and associated color
  • handle controller connect/disconnect events on directx
  • decide on UX for showing reorder button on disconnected screen when only 1 physical device connected
  • fix keyboard mapping to multiple buttons (1 key to multiple n64 inputs) 0f2b706
  • some wonkyness with connecting/disconnecting - need to do more investigation
  • handle mutliple controllers disconnected when window up
  • get singleplayer mode working well

v2 todo (decided it's out of scope for this PR but it'd still be cool):

  • figure out wonkyness with wiimote+nunchuk mappings (it seems nunchuck buttons aren't getting set but the wiimote equivalent are - this is happening in KPadStatus - hold vs nunchuck.hold)
  • pressing the menubar toggle button on a controller toggles it twice
    • imgui logic for reading from controllers feels kind of wonky in general, i tried a few things here and nothing felt consistent, i think a true solution to this issue will come with remappable hotkeys outside of imgui (i'm thinking another tab like ports that has hotkey config, then we can use the controldeck and controller and read from the devices with a ___ToHotkeyMapping (this would get us remappable hotkeys)
  • game pausing for disconnect/remap screens
  • disconnected controllers as vector to show which ports are disconnected when multiple disconnected
  • add colored font awesome icon for each controller with a mapping in a port tab
  • persist controller button names when controller is disconnected
  • handle disconnected controller mappings more elegantly, right now they just fill up the config (this might become an issue with manual clearing, in which case it'll move up to v1)
  • move some of the shared logic out of ControllerStick/ControllerButton/ControllerGyro/ControllerRumble/ControllerLED (maybe just wait and do this as part of attachments)
  • attachments
    • i see the reasoning here, but i don't see a clear path forward for this given the current limitations in how we handle "controller output." i plan to build things in a modular way that should make moving to an attachment system straightforward, but i think it makes sense to make those architectural decisions in a PR separate from this one
  • "chord" style mapping - make it possible to require multiple physical buttons be pressed to activate a virtual button/axis
  • deadzone math #351
  • (super nitpicky, might ignore this) get it so the controller config menu remembers the ordering of mappings when closing and opening the game (see nitpick appendix)
  • mapping stuff when imgui controller nav is enabled. it's currently really messy and i don't feel like diving into it
    • pressing "A" on something to start mapping maps A to it
    • clicking on something to map and then pressing "B" just closes the popup and doesn't map it
  • wrap mappings to next line instead of overflowing to the right, put analog stick preview to the right
  • advanced devices tab functionality
    • show buttons pressed
    • button to force rumble
    • button to force LED
    • sticks
    • gyro
  • TAS
    • flag on controller that short circuits ReadToPad and reads from tas instead
    • flag on controller that writes to tas file
    • need to byteswap KiritoDv@bd01dd7
    • ui needs to make it clear that restarting is needed (maybe force now?)

migrate from old configs

nitpick appendix:

current behavior:
image
then quit and restart game and sometimes see
image
i know this has to do with UpdateBitmaskToMappingUuids in InputEditorWindow.cpp not having any sense of the order they were added in, not sure how much complexity this would add/if it's worth it

@briaguya-ai briaguya-ai marked this pull request as ready for review November 5, 2023 03:14
@briaguya-ai briaguya-ai changed the base branch from next to main November 7, 2023 03:18
@Kenix3 Kenix3 merged commit 3411d24 into Kenix3:main Nov 8, 2023
4 checks passed
@briaguya-ai briaguya-ai deleted the decouple-controllers branch November 19, 2023 21:30
@briaguya-ai briaguya-ai restored the decouple-controllers branch January 4, 2025 01:35
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.

3 participants