Desktop Version - moonbench/catode32 GitHub Wiki

The game can be run on your computer, which allows you to experiment with it without needing to setup an ESP32. The desktop emulator lives in the catode32-desktop crate.

Requirements

  • Rust
  • SDL2

The emulator uses SDL2 to render the same 128x64 framebuffer that would normally render to the hardware screen to a desktop window instead.

On macOS:

brew install sdl2

On Debian/Ubuntu:

sudo apt install libsdl2-dev

Running the emulator

The default target when building is for ESP32 (riscv32imac-unknown-none-elf). To run it on desktop instead you need to pass --target with your host triple when building the desktop crate.

Examples:

Apple Silicon:

cargo run -p catode32-desktop --target aarch64-apple-darwin

Intel Mac:

cargo run -p catode32-desktop --target x86_64-apple-darwin

Linux:

cargo run -p catode32-desktop --target x86_64-unknown-linux-gnu

Controls

Key Action
Arrow keys D-pad
A A (Select)
S B (Back/Cancel)
Q Menu 1
W Menu 2
Esc Quit Emulator

Custom colors

You can change the screen colors when you launch the emulator. Put the options after -- so cargo passes them through to the program:

For example, when running on linux:

cargo run -p catode32-desktop --target x86_64-unknown-linux-gnu -- --fg 33ff66 --bg 000000
Option Sets Default
--fg RRGGBB Lit pixel color 23A5CC
--bg RRGGBB Background color 0A0A0A

Colors are 6-digit hex. The leading # is optional (quote it in the shell, e.g. --fg '#33ff66'), and --fg=33ff66 also works. Run with --help to see all options.

Save file

The desktop save is stored at ./catode32-save.json in the current working directory. It is separate from the device save, which lives on the ESP32's nvs flash partition.