#[non_exhaustive]
pub struct Options { pub tickrate: Option<u16>, pub max_size: Option<u16>, pub screen_rotation: ScreenRotation, pub font_style: Font, pub touch_input_mode: TouchMode, pub start_address: Option<u16>, pub colors: Colors, pub quirks: Quirks, }
Expand description

Representation of Octo options.

Fields (Non-exhaustive)

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
tickrate: Option<u16>

The number of CHIP-8 instructions executed per 60Hz frame, ie. the “speed” of the virtual CPU. These are all approximations of hardware limitations, because on real hardware different instructions execute in different times, but it’s a conventional middle ground.

Common values:

  • 7–15 (approximate speed of the original interpreter for the COSMAC VIP)
  • 20–30 (approximate speed of the SUPER-CHIP interpreters for the HP 48 calculators)
  • 10000 (Octo’s “Ludicrous speed” setting)
max_size: Option<u16>

The maximum amount of virtual memory, in bytes, that is available to the program. If the CHIP-8 program is larger than this, the interpreter should give an error.

At least 512 bytes are always reserved for the CHIP-8 interpreter and unavailable to the CHIP-8 game; see the field start_address.

This is mostly relevant when developing CHIP-8 games for real hardware, as an assertion that the game will fit in the target platform’s memory. Most CHIP-8 interpreters can ignore this value without consequence.

Common values:

  • 3216 (original interpreter for the COSMAC VIP with 4K RAM)
  • 3583 (SUPER-CHIP interpreter for the HP 48)
  • 3584 (Octo)
  • 65024 (XO-CHIP interpreters)

Other values might be used for games for more obscure platforms, games that were designed to run on a COSMAC VIP with only 2K RAM, etc.

screen_rotation: ScreenRotation

The orientation of the display.

font_style: Font

The font style expected by the game.

touch_input_mode: TouchMode

The touch controls this game supports.

start_address: Option<u16>

The memory address in the virtual RAM that this game should be loaded from. On legacy hardware, the interpreter itself was loaded into the lower memory addresses, and then the game was loaded after it (usually at address 0x200, ie. 512).

Common values:

  • 512 (original interpreter for the COSMAC VIP, DREAM 6800, HP 48, etc)
  • 1536 (interpreter for the ETI-660)
colors: Colors

Custom colors this game would like to use, if possible. It’s not important for a CHIP-8 interpreter to support custom colors although not doing so might impact the creator’s artistic vision, especially for XO-CHIP games that use more than two colors.

quirks: Quirks

Specific behaviors this game expects from the interpreter in order to run properly. See [OctoQuirks] for specifics.

Implementations

Deserializes Options from an INI string.

Errors

Returns an Err if deserialization from the INI failed.

Serializes Options to an INI string.

Get a preset set of Options based on a target Platform.

Trait Implementations

Formats the value using the given formatter. Read more

Returns a default with a pretty fast tickrate, the maximum ROM size possible, and no quirks enabled except that the LoResDxy0Behavior assumes Octo behavior.

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Serializes Options into a JSON string.

This format is used by Octo in Octocarts and HTML exports, as well as the Chip-8 Archive.

Formats the value using the given formatter. Read more

Deserializes Options from a JSON string.

This format is used by Octo in Octocarts and HTML exports, as well as the Chip-8 Archive.

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.