SDK crate

psx-settings

Versioned preferences and optional persistence

On this page

Use psx-settings for common game preferences, action bindings and high scores. Keep game-specific simulation state in your own save format.

How the crate is organized

The root defines Profile<ACTIONS, SCORES>, validation, encoding/decoding and error types. The default card feature adds save/load helpers over psx-mc; disabling default features leaves the profile and codec available without card persistence.

Integration notes

Initialize a profile from your action map, sanitize user-adjustable values, then encode into a caller-owned buffer. The record includes an explicit version and checksum. Handle missing, incompatible or corrupt records by restoring your chosen defaults. You still choose the filename and save policy for the card helpers, and they don't give the game ownership of every file on a card.

Profile also carries GAME_BYTES_LEN (8) bytes, game_bytes, reserved for settings only your game understands, such as a field-of-view step. They start at zero, the SDK stores them verbatim and never validates them, so name each slot with a constant index in your game, treat 0 as "default" and range-check what you read. Records written by earlier SDK versions load with these bytes zeroed. An executable built before the field existed refuses the newer record and falls back to its defaults.

Study the controller example for input handling and the memory-card diagnostic for storage behavior. Neither example uses psx-settings directly.

API, dependencies and source structure

SDK revision 80d1c329e977. Structure, dependencies and features below come from this revision.

The PS1 reference includes all Cargo features. The manifest below shows which features are enabled by default.

Dependencies

Cargo features

FeatureEnables
carddep:psx-mc
defaultcard

Read the complete manifest and feature comments.

Source layout

The list includes internal implementation and test files. Public modules, types, functions and their signatures are indexed in the API reference above.

2 source and manifest files