diff options
| author | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-23 17:24:53 -0500 |
|---|---|---|
| committer | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-23 17:24:53 -0500 |
| commit | 2f6aa6fb5b0909e76abb8e3ca78a23dbe3804128 (patch) | |
| tree | 7fb1cfdfdd0bf7ab52b0eb6f0826e2a40658a73c /runtime/shims/gameinput.cpp | |
| parent | 8b878766bc5eb0c31edcaa438cbfacad502cf31e (diff) | |
| parent | 29bd7a11a68574e1aa79908805ee6f56a8ae8e76 (diff) | |
Merge remote-tracking branch 'origin/pr/9765'
Diffstat (limited to 'runtime/shims/gameinput.cpp')
| -rw-r--r-- | runtime/shims/gameinput.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/runtime/shims/gameinput.cpp b/runtime/shims/gameinput.cpp index 002966306..47ee190e3 100644 --- a/runtime/shims/gameinput.cpp +++ b/runtime/shims/gameinput.cpp | |||
| @@ -1196,7 +1196,40 @@ void fill_info(Device* d, SDL_Gamepad* p, const AppLocalDeviceId& id) { | |||
| 1196 | d->button_info[b].mappedInputKinds = GameInputKindGamepad; | 1196 | d->button_info[b].mappedInputKinds = GameInputKindGamepad; |
| 1197 | d->button_info[b].legacyHidIndex = static_cast<uint16_t>(b); | 1197 | d->button_info[b].legacyHidIndex = static_cast<uint16_t>(b); |
| 1198 | d->button_info[b].legacyDInputIndex = static_cast<uint16_t>(b); | 1198 | d->button_info[b].legacyDInputIndex = static_cast<uint16_t>(b); |
| 1199 | } | 1199 | d->button_info[b].label = GameInputLabelUnknown; // paddles, touchpad, misc: no gamepad meaning to name |
| 1200 | } | ||
| 1201 | // Labels. Every pad is presented as an Xbox One pad (docs/gameinput.md), so every control carries the Xbox label | ||
| 1202 | // of its position, whatever is printed on the pad in the player's hands. A stick axis has no label in v0, so | ||
| 1203 | // only the triggers are named. UI navigation names the controls read_pad reads it from; scrolling is the right | ||
| 1204 | // stick, which has none. | ||
| 1205 | const GameInputLabel face[4] = {GameInputLabelXboxA, GameInputLabelXboxB, GameInputLabelXboxX, | ||
| 1206 | GameInputLabelXboxY}; | ||
| 1207 | const GameInputLabel menu = GameInputLabelXboxMenu, view = GameInputLabelXboxView; | ||
| 1208 | const GameInputLabel up = GameInputLabelXboxDPadUp, down = GameInputLabelXboxDPadDown; | ||
| 1209 | const GameInputLabel left = GameInputLabelXboxDPadLeft, right = GameInputLabelXboxDPadRight; | ||
| 1210 | const GameInputLabel lb = GameInputLabelXboxLeftShoulder, rb = GameInputLabelXboxRightShoulder; | ||
| 1211 | const GameInputLabel ls = GameInputLabelXboxLeftStickButton, rs = GameInputLabelXboxRightStickButton; | ||
| 1212 | const GameInputLabel lt = GameInputLabelXboxLeftTrigger, rt = GameInputLabelXboxRightTrigger; | ||
| 1213 | const GameInputLabel none = GameInputLabelNone; | ||
| 1214 | d->gamepad_info = {menu, view, face[0], face[1], face[2], face[3], up, down, left, right, lb, rb, ls, rs}; | ||
| 1215 | d->ui_info = {menu, view, face[0], face[1], up, down, left, right, face[2], face[3], ls, rs, lt, rt, lb, rb, | ||
| 1216 | none, none, none, none, GameInputLabelXboxGuide}; | ||
| 1217 | d->axis_info[4].label = lt; | ||
| 1218 | d->axis_info[5].label = rt; | ||
| 1219 | const struct { | ||
| 1220 | SDL_GamepadButton sdl; | ||
| 1221 | GameInputLabel label; | ||
| 1222 | } labelled[] = { | ||
| 1223 | {SDL_GAMEPAD_BUTTON_SOUTH, face[0]}, {SDL_GAMEPAD_BUTTON_EAST, face[1]}, | ||
| 1224 | {SDL_GAMEPAD_BUTTON_WEST, face[2]}, {SDL_GAMEPAD_BUTTON_NORTH, face[3]}, | ||
| 1225 | {SDL_GAMEPAD_BUTTON_BACK, view}, {SDL_GAMEPAD_BUTTON_GUIDE, GameInputLabelXboxGuide}, | ||
| 1226 | {SDL_GAMEPAD_BUTTON_START, menu}, {SDL_GAMEPAD_BUTTON_LEFT_STICK, ls}, | ||
| 1227 | {SDL_GAMEPAD_BUTTON_RIGHT_STICK, rs}, {SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, lb}, | ||
| 1228 | {SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, rb}, {SDL_GAMEPAD_BUTTON_DPAD_UP, up}, | ||
| 1229 | {SDL_GAMEPAD_BUTTON_DPAD_DOWN, down}, {SDL_GAMEPAD_BUTTON_DPAD_LEFT, left}, | ||
| 1230 | {SDL_GAMEPAD_BUTTON_DPAD_RIGHT, right}, | ||
| 1231 | }; | ||
| 1232 | for (const auto& l : labelled) d->button_info[l.sdl].label = l.label; | ||
| 1200 | i.controllerAxisInfo = d->axis_info; | 1233 | i.controllerAxisInfo = d->axis_info; |
| 1201 | i.controllerButtonInfo = d->button_info; | 1234 | i.controllerButtonInfo = d->button_info; |
| 1202 | i.gamepadInfo = &d->gamepad_info; | 1235 | i.gamepadInfo = &d->gamepad_info; |