Skip to content

Commit 32f2d2f

Browse files
committed
Update controls and README
1 parent 5286261 commit 32f2d2f

2 files changed

Lines changed: 30 additions & 30 deletions

File tree

README.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -169,24 +169,27 @@ The emulator uses a single character on screen to display two vertically aligned
169169
Keyboard, game controller and file inputs
170170
-----------------------------------------
171171

172-
Keyboard controls are enabled by default, while game controller controls have to be enabled using `--enable-controller` or `--ec`. The key bindings are not configurable at the moment:
172+
Keyboard controls are enabled by default, while game controller controls have to be enabled using `--enable-controller` or `--ec`.
173173

174-
| Buttons | Keyboard | Controller |
175-
|------------|----------------------|-----------------------|
176-
| Directions | Arrows | Left hat / Left stick |
177-
| A | F / V / Space | Button 0 / Button 3 |
178-
| B | D / C / Alt | Button 1 / Button 2 |
179-
| Start | Right Ctrl / Enter | Button 7 |
180-
| Select | Right Shift / Delete | Button 6 |
174+
The key bindings are not configurable at the moment:
181175

182-
Key releases, which are usually mandatory to play games, cannot be detected through `stdin`. It is then required to access the window system to get access to the key presses. There are a couple of problems with that:
176+
| Buttons | Keyboard with arrows | Keyboard with WASD | Controller |
177+
|------------|----------------------|--------------------|-----------------------|
178+
| Directions | Arrows | W A S D | Left hat / Left stick |
179+
| A | Z | K | Button 0 / Button 3 |
180+
| B | X | J | Button 1 / Button 2 |
181+
| Start | Enter | Enter | Button 7 |
182+
| Select | Right Shift | Right Shift | Button 6 |
183183

184-
- It can be hard to detect the window corresponding to the terminal. With X11, the best solution is to look for the current focused window. For other systems, the fallback solution is to use global hotkeys.
185184

186-
- It only works through SSH for clients with X servers using `ssh -X`, meaning it requires Windows and MacOS users to run an X server. Moreover, it's a bad idea to connect with `-X` to an untrusted server.
185+
| Save state commands | Keyboard |
186+
|---------------------|----------|
187+
| Select slot | 0 to 9 |
188+
| Save state | `[` |
189+
| Load state | `]` |
187190

188-
- Additional permissions might be required to access the window system, especially on MacOS (see [this guide](https://inputs.readthedocs.io/en/latest/user/install.html#mac-permissions))
189191

192+
Since `gambaterm` detects physical key presses, this table indicates the keys [as seen on a QWERTY keyboard](https://www.w3.org/TR/uievents-code/#key-alphanumeric-writing-system). In particular, AZERTY or Bépo user won't need to change their keyboard layout in order to play.
190193
It is also possible to use a bizhawk BK2 input file to play tool-assisted speedruns using the `--input-file` (or `-i`) option.
191194

192195

gambaterm/keyboard_input.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,23 @@
3535

3636
def get_input_mapping(console: Console) -> dict[DomCode, Console.Input]:
3737
return {
38-
# Directions
38+
# Generic start/select
39+
DomCode.ENTER: console.Input.START,
40+
DomCode.SHIFT_RIGHT: console.Input.SELECT,
41+
# Arrow controls
3942
DomCode.ARROW_UP: console.Input.UP,
4043
DomCode.ARROW_DOWN: console.Input.DOWN,
4144
DomCode.ARROW_LEFT: console.Input.LEFT,
4245
DomCode.ARROW_RIGHT: console.Input.RIGHT,
43-
# A button
44-
DomCode.US_F: console.Input.A,
45-
DomCode.US_V: console.Input.A,
46-
DomCode.SPACE: console.Input.A,
47-
# B button
48-
DomCode.US_D: console.Input.B,
49-
DomCode.US_C: console.Input.B,
50-
DomCode.ALT_LEFT: console.Input.B,
51-
DomCode.ALT_RIGHT: console.Input.B,
52-
# Start button
53-
DomCode.ENTER: console.Input.START,
54-
DomCode.CONTROL_RIGHT: console.Input.START,
55-
# Select button
56-
DomCode.SHIFT_RIGHT: console.Input.SELECT,
57-
DomCode.BACKSPACE: console.Input.SELECT,
46+
DomCode.US_Z: console.Input.A,
47+
DomCode.US_X: console.Input.B,
48+
# WASD controls
49+
DomCode.US_W: console.Input.UP,
50+
DomCode.US_S: console.Input.DOWN,
51+
DomCode.US_A: console.Input.LEFT,
52+
DomCode.US_D: console.Input.RIGHT,
53+
DomCode.US_K: console.Input.A,
54+
DomCode.US_J: console.Input.B,
5855
}
5956

6057

@@ -70,8 +67,8 @@ def get_event_mapping(console: Console) -> dict[DomCode, Console.Event]:
7067
DomCode.DIGIT7: console.Event.SELECT_STATE_7,
7168
DomCode.DIGIT8: console.Event.SELECT_STATE_8,
7269
DomCode.DIGIT9: console.Event.SELECT_STATE_9,
73-
DomCode.US_L: console.Event.LOAD_STATE,
74-
DomCode.US_K: console.Event.SAVE_STATE,
70+
DomCode.BRACKET_LEFT: console.Event.SAVE_STATE,
71+
DomCode.BRACKET_RIGHT: console.Event.LOAD_STATE,
7572
}
7673

7774

0 commit comments

Comments
 (0)