Skip to content

Mac: DM_ARROWS=camera puts the right stick on the arrow keys - #356

Closed
lipceanu wants to merge 2 commits into
seedds:mainfrom
lipceanu:mac-arrow-camera-keys
Closed

lipceanu wants to merge 2 commits into
seedds:mainfrom
lipceanu:mac-arrow-camera-keys

Conversation

@lipceanu

Copy link
Copy Markdown

Summary

An opt-in keyboard layout for the Mac window, DM_ARROWS=camera: the arrow keys become the right stick (the camera in most 3D games), the D-pad moves to F T H G (left, up, right, down) and the stick presses to V and B. Without the switch, the keyboard is unchanged.

Split out of #301 at the reviewers' request.

Why

Without a controller, the Mac keyboard has no right stick: the arrow keys are the D-pad and the mouse is the touch screen, so in 3D games (Breath of the Wild, Tears of the Kingdom, Odyssey…) the camera can't be turned freely from the keyboard. The new layout puts the camera on the arrow keys, as MacNativeGames' keyboard layout does, while keeping the default layout for games that need the D-pad there.

How

dm/host/front_mac.m only:

  • DM_ARROWS=camera is read at start, next to DM_PAD_MERGE / DM_KBD_PLAYER;
  • key_bit remaps F T H G to the D-pad and V B to the stick presses;
  • on_key holds the arrows as the right stick's axes, passed to dm_input_set's rx / ry;
  • the arrow keys held as the stick are released with the other keys when the window loses focus or the system text box opens.

Testing

  • Mac, Breath of the Wild 1.9.0: several play sessions with DM_ARROWS=camera; the log line front end: the arrow keys are the right stick… confirms the switch, and no input problems came up. The individual key mappings were not checked one by one in game.
  • The file passes clang -fsyntax-only -Wall on the current main; the one warning, activity, is in existing code.
  • Controllers are untouched: they don't go through key_bit / on_key.

🤖 Generated with Claude Code

lipceanu and others added 2 commits October 28, 2026 09:50
With DM_ARROWS=camera the arrow keys are the right stick (the camera in most 3D games), the D-pad moves to
F T H G (left up right down) and the stick presses to V and B. Without it the keyboard is as before. The
arrow keys held as the stick are released with the other keys when the window loses focus or the text box
opens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lipceanu
lipceanu force-pushed the mac-arrow-camera-keys branch from 4dba64a to 5552bfb Compare October 28, 2026 00:51
@github-actions github-actions Bot added host The Horizon host: SVCs, services, threads, memory (dm/host) mac The Mac front end and app (dm/mac, front_mac.m) docs Documentation labels Nov 3, 2026
@seedds

seedds commented Nov 29, 2026

Copy link
Copy Markdown
Owner

Thanks @lipceanu for splitting out this keyboard camera layout and testing it in Breath of the Wild!

Closing this PR because dm/host/front_mac.m on main now provides the right stick on Shift + arrow keys with independent key release tracking, and customizable keyboard layouts are being handled through the broader configurable controls PRs (#386, #2781, #3141) rather than adding a separate fixed DM_ARROWS=camera layout. We checked dm/host/front_mac.m on current main and those open PRs.

Still open: landing configurable keyboard remapping so players can map the camera directly to plain arrow keys if they prefer.

@seedds seedds closed this Nov 29, 2026
chgpalmer added a commit to chgpalmer/nxnative that referenced this pull request Nov 29, 2026
The Mac front end's half of the controller mapping (host/input: keymap.h, the remap in
hle_hid.c):

- In the game (front_mac.m, keyboard_mac.h): the keyboard goes through the map in
  place of the fixed key table, Shift, Control and Option keys included (flagsChanged).
  Each player's controller table goes to the host (dm_pad_map_set) at the start and
  after every change.
- The mouse (mouselook_mac.h): with a mouse direction bound, a click on the game
  captures the pointer and its movement goes through keymap_mouse.h at 120 Hz, to
  player 1's sticks and buttons, or to the motion sensor as a controller turned in the
  hands (dm_motion_set_switch: upright in handheld mode, flat docked). Esc, a focus
  loss or the panel lets it go.
- The settings window (Launcher.swift): Controls › Controller mapping › Customize…:
  a tab per player 1-8; player 1 has its keyboard and mouse or its controller;
  click a row and press a key or chord, click a mouse button, or press a controller's
  button or push its stick; right-click for Clear, Add Input… or a mouse direction;
  Mouse and trackpad puts the mouse on a stick or the motion controls with its
  sensitivity and Invert Y axis; a Preset menu per device (keymap_presets.h). Kept as
  the saved choice launcher.DM_KEYMAP, which launcher.c checks with the host's parser.
- In the game, Window › Controller Mapping… (⌘⇧K, keymap_panel_mac.h) is the same map
  while playing: a change applies at once and is saved for the next start.
- pad_apple.h's dm_pad_state is now the one reading of a GameController pad as the
  Switch's, used by the host's pad_read and the settings window's press-to-bind
  (pad_bridge.m).

Covers seedds#2346 (mouse as a stick), seedds#2392's and seedds#356's asks (mouse look, the camera on
plain arrows), the keyboard part of seedds#386 and seedds#2006's modifier keys; keys are tracked
as pressed, so Shift let go before an arrow does not leave the right stick held (seedds#1535).

Tests: test_launcher_storage (the window with the sheet's model), test_nsp_mac_app,
test_docs, test_env_switches.

Front-ends: new: launcher.DM_KEYMAP is a saved choice, checked by the host's parser (docs/frontends.md, Saved choices)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation host The Horizon host: SVCs, services, threads, memory (dm/host) mac The Mac front end and app (dm/mac, front_mac.m)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants