Skip to content

Commit ffb4c2e

Browse files
committed
Merge remote-tracking branch 'upstream/main' into jq/sextants
# Conflicts: # gambaterm/keyboard_input.py # gambaterm/keyboard_protocol_input.py # gambaterm/main.py # gambaterm/run.py # tests/test_gambaterm.py
2 parents dd5c030 + 173c5d2 commit ffb4c2e

15 files changed

Lines changed: 811 additions & 1353 deletions

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repos:
2121
additional_dependencies: [
2222
"numpy>=1.20",
2323
"asyncssh>=2.9",
24-
"prompt_toolkit>=3.0.29",
24+
"blessed>=1.37.0",
2525
"types-setuptools",
2626
"pytest",
2727
]

README.md

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Optional arguments:
104104
SSH server
105105
----------
106106

107-
It is possible to serve the emulation though SSH, although clients won't be able to send input to the emulator without an X server and the `ssh -X` option. Use `gambaterm-ssh --help` for more information.
107+
It is possible to serve the emulation through SSH. Clients with terminals supporting the [kitty keyboard protocol](https://sw.kovidgoyal.net/kitty/keyboard-protocol/) can send input directly without X11 forwarding. Otherwise, X11 forwarding (`ssh -X`) can be used as a fallback. Use `gambaterm-ssh --help` for more information. 24-bit color is always true over ssh.
108108

109109

110110
Terminal support
@@ -132,7 +132,7 @@ Not all terminals will actually offer a pleasant experience. The main criteria a
132132
Terminal.app, and can be adjusted by vertical and horizontal spacing of font preferences.
133133

134134
- **Support for the [kitty keyboard protocol](https://sw.kovidgoyal.net/kitty/keyboard-protocol/)**
135-
This is mandatory if you're using Wayland, and recomended on every other platforms.
135+
This is mandatory if you're using Wayland, and recommended on every other platforms.
136136
In the case where the kitty keyboard protocol is not detected by `gambaterm`, the following fallbacks are implemented:
137137
* Linux: uses X11 through `python-xlib`
138138
* Macos: uses `pynput` (it requires granting specific authorizations to the terminal app)
@@ -143,36 +143,44 @@ Not all terminals will actually offer a pleasant experience. The main criteria a
143143
The terminal has to be able to process about 500KB of requests per seconds for a smooth rendering of "intense" frames.
144144
Typically, the most intense bursts happen during screen transitions of two detailed scenes.
145145

146-
The table below sums up my findings when I tried a the most common terminal emulators. Here's about linux:
147-
148-
| Linux | Status | Colors | Unicode rendering | Kitty keyboard protocol | Performance | Comments |
149-
|------------------|------------|---------------|------------------------|-------------------------|-------------|--------------------------|
150-
| Ghostty | Excellent | 24-bit colors | Good | Yes | 60 FPS | |
151-
| Kitty | Excellent | 24-bit colors | Good | Yes | 60 FPS | |
152-
| Gnome terminal | Good | 24-bit colors | Good | No | 60 FPS | |
153-
| Terminator | Good | 24-bit colors | Good | No | 60 FPS | |
154-
| XTerm | Good | 24-bit colors | Good | No | 60 FPS | No resize shortcuts |
155-
| Termit | Ok | 24-bit colors | Good | No | 60 FPS | No window title |
156-
| Rxvt | Ok | 256 colors | Good | No | 60 FPS | No resize shortcuts |
157-
| Mlterm | Ok | 24-bit colors | Light misalignments | No | 60 FPS | No resize shortcuts |
158-
| Terminology | Ok | 24-bit colors | Possible misalignments | No | 30 FPS | Weird colors |
146+
The table below sums up my findings when I tried the most common terminal emulators. Here's about linux:
147+
148+
| Linux | Status | Colors | Unicode rendering | Kitty keyboard protocol | Performance | Comments |
149+
|------------------|------------|---------------|------------------------|-------------------------|-------------|-------------------------------------------------------------|
150+
| Ghostty | Excellent | 24-bit colors | Good | Yes | 60 FPS | |
151+
| Kitty | Excellent | 24-bit colors | Good | Yes | 60 FPS | |
152+
| foot | Excellent | 24-bit colors | Good | Yes | 60 FPS | |
153+
| Alacritty | Excellent | 24-bit colors | Good | Yes | 60 FPS | |
154+
| Rio | Excellent | 24-bit colors | Good | Yes | 60 FPS | |
155+
| Konsole | Good | 24-bit colors | Good | No | 60 FPS | |
156+
| Gnome terminal | Good | 24-bit colors | Good | No | 60 FPS | |
157+
| Terminator | Good | 24-bit colors | Good | No | 60 FPS | |
158+
| XTerm | Good | 24-bit colors | Good | No | 60 FPS | No resize shortcuts, launch as ``xterm -tn xterm-256color`` |
159+
| Rxvt | Good | 24-bit colors | Good | No | 60 FPS | No resize shortcuts |
160+
| Termit | Ok | 24-bit colors | Good | No | 60 FPS | No window title |
161+
| Mlterm | Ok | 24-bit colors | Light misalignments | No | 60 FPS | No resize shortcuts |
162+
| Terminology | Ok | 24-bit colors | Possible misalignments | No | 30 FPS | Weird colors |
163+
| Contour | Bad | 24-bit colors | Good | Broken | 60 FPS | [Bug (no release event!)](https://github.com/contour-terminal/contour/pull/1924) |
159164

160165
About MacOS:
161166

162-
| MacOS | Status | Colors | Unicode rendering | Kitty keyboard protocol | Performance | Comments |
163-
|------------------|------------|---------------|------------------------|-------------------------|-------------|--------------------------|
164-
| iTerm2 | Good | 24-bit colors | Good | Yes | 30 FPS | |
165-
| Terminal | Unplayable | 256 colors | Misalignments | No | 20 FPS | |
167+
| MacOS | Status | Colors | Unicode rendering | Kitty keyboard protocol | Performance | Comments |
168+
|------------------|------------|---------------|---------------------------|-------------------------|-------------|--------------------------|
169+
| iTerm2 | Excellent | 24-bit colors | Good | Yes | 60 FPS | |
170+
| Terminal | Bad | 24-bit colors | Bad--adjust font spacing! | No | 30 FPS | A bit jittery |
166171

167172
About Windows:
168173

169-
| Windows | Status | Colors | Unicode rendering | Kitty keyboard protocol | Performance | Comments |
170-
|------------------|------------|---------------|------------------------|-------------------------|-------------|--------------------------|
171-
| Windows terminal | Good | 24-bit colors | Good | Soon | 60 FPS | |
172-
| Cmder | Unplayable | 24-bit colors | Good | Yes | 2 FPS | No window title |
173-
| Terminus | Unplayable | 24-bit colors | Misalignments | No | 10 FPS | |
174-
| Command prompt | Broken | N/A | N/A | No | N/A | No ANSI code support |
175-
| Git bash | Broken | N/A | N/A | No | N/A | Doesn't work with winpty |
174+
| Windows | Status | Colors | Unicode rendering | Kitty keyboard protocol | Performance | Comments |
175+
|--------------------|------------|---------------|------------------------|-------------------------|-------------|--------------------------|
176+
| Windows terminal | Good | 24-bit colors | Good | Coming Soon | 60 FPS | [Download Preview for kitty support)](https://github.com/microsoft/terminal/releases) |
177+
| Cmder | Unplayable | 24-bit colors | Good | Yes | 2 FPS | No window title |
178+
| Terminus | Unplayable | 24-bit colors | Misalignments | No | 10 FPS | |
179+
| Command prompt | Bad | 24-bit colors | Good | No | 1 FPS | Slow/Unresponsive |
180+
| Git bash (mingw64) | Ok | 24-bit colors | Good | No | N/A | |
181+
182+
183+
Terminals without Kitty keyboard protocol require X11 to play locally, or X11 forwarding to use over SSH.
176184

177185
Terminal size
178186
-------------
@@ -232,7 +240,7 @@ It is also possible to use a bizhawk BK2 input file to play tool-assisted speedr
232240
Motivation
233241
----------
234242

235-
To be honest there is no actual reason to use this gameboy emulator, other than you might find it fun or interesting. The motivation behind this project is simply to push the idea of running a video game console emulator in a terminal as far as possible. It seems like there has been a [similar attempt](https://github.com/gabrielrcouto/php-terminal-gameboy-emulator) that used a different approach for displaying the video stream. In any case I'm quite satisfied with this project, and also a bit surprised that I could push it to the point where playing games is actually enjoyable. In particular, I've been able to complete [The Bouncing Ball](https://gbhh.avivace.com/game/The-Bouncing-Ball) at 60 FPS in XTerm, and I'm now looking forward to playing more homebrew games :)
243+
To be honest there is no actual reason to use this gameboy emulator, other than you might find it fun or interesting. The motivation behind this project is simply to push the idea of running a video game console emulator in a terminal as far as possible. It seems like there has been a [similar attempt](https://github.com/gabrielrcouto/php-terminal-gameboy-emulator) that used a different approach for displaying the video stream. In any case I'm quite satisfied with this project, and also a bit surprised that I could push it to the point where playing games is actually enjoyable. In particular, I've been able to complete [The Bouncing Ball](https://hh.gbdev.io/game/the-bouncing-ball) at 60 FPS in XTerm, and I'm now looking forward to playing more homebrew games :)
236244

237245

238246

@@ -243,7 +251,7 @@ Here is the list of the dependencies used in this project, all great open source
243251

244252
- [gambatte-core](https://github.com/pokemon-speedrunning/gambatte-core) - Gameboy emulation
245253
- [Cython](https://cython.org/) - Binding to gambatte C++ API, and fast video frame conversion
246-
- [prompt-toolkit](https://github.com/prompt-toolkit/python-prompt-toolkit) - Cross-platform terminal handling
254+
- [blessed](https://github.com/jquast/blessed) - Cross-platform terminal handling and kitty keyboard protocol support
247255
- [samplerate](https://github.com/tuxu/python-samplerate) - Resampling the audio stream
248256
- [sounddevice](https://github.com/spatialaudio/python-sounddevice) - Playing the audio stream
249257
- [xlib](https://github.com/python-xlib/python-xlib)/[pynput](https://github.com/moses-palmer/pynput) - Getting keyboard inputs

0 commit comments

Comments
 (0)