19 releases (1 stable)

1.0.0 Aug 9, 2022
0.1.5 Jul 25, 2022
0.1.3 Nov 9, 2021
0.0.12 Nov 4, 2021
0.0.10 Oct 24, 2021

#519 in Configuration

Download history 6/week @ 2024-05-21 1/week @ 2024-06-04 3/week @ 2024-06-11 2/week @ 2024-06-18

71 downloads per month
Used in 3 crates

MIT license

67KB
1K SLoC

octopt

crates.io docs.rs dependency status

octopt is a library for handling CHIP-8 configuration settings.

It contains Rust data structures that aim to represent all possible CHIP-8 options. It can also serialize and deserialize these structures from and into Octo's standard JSON format and C-Octo's INI-like format.

See the octopt documentation for details. The documentation is fairly verbose.

Rationale

CHIP-8 is a virtual machine for playing simple computer games written in interpreted bytecode. It has been around since 1977, and has many slightly incompatible implementations.

CHIP-8 games often require specific behavior from its emulator (actually, interpreter) to run correctly, but since it's impossible to know what behavior it expects just by looking at the game's bytecode, additional metadata is required to instruct the emulator how to run the game. This metadata can come in the form of JSON – as is the case with Octocarts (see decart) and the CHIP-8 Community Archive – or an INI file, as is the case for C-Octo.

Use cases

There are many CHIP-8 emulators out there (and many made in Rust), but most only support the same set of a couple of dozen games made during the 90s because they followed a non-comprehensive tutorial. (Shameless plug: I've written a tutorial that covers the important CHIP-8 varities out there.)

If you're making a CHIP-8 emulator in Rust, you could use this library as a guide to what configuration options you should (or could) include to support most of the CHIP-8 games that have been made during the last 44 years.

You could allow the user to provide a CHIP-8 game as well as an associated .octo.rc file (which C-Octo uses) with settings required for the game to run, and you could parse that file with octopt.

Or you could use the library decart, which uses octopt, in order to let users load Octocarts which come with the settings baked in with the game.

Let me know if you figure out a cool use case!

See also

  • Octo and C-Octo, integrated development environments for CHIP-8 games
  • CHIP-8 Community Archive, a database of public domain CHIP-8 games and metadata
  • decart, a Rust library for encoding and decoding CHIP-8 metadata from Octocarts
  • deca, a CHIP-8 emulator that uses this library to support a wide variety of CHIP-8 games
  • termin-8, a terminal frontend to deca

Dependencies

~5–7MB
~129K SLoC