Expand description
Player profiles: a profile holds a player’s options, keys and saves,
whatever the game keeps for each player. Each of those keeps the
Storage key it would have without profiles, inside the profile: a
profile’s key is its id’s prefix and that key (p1-settings,
p2-slot_03, ProfileId::key). ProfileStore is the Storage
of the current profile, and the computer’s own storage under it.
The list of profiles and which one was used last stay with the computer,
under PROFILES_KEY (Profiles::to_ron). load reads it, makes
the first profile on a first launch, and moves a player’s keys from
before a game had profiles into it (migrate).
Structs§
- Profile
- One profile in the list.
- Profile
Id - A profile’s number. Never reused: a deleted profile’s number is never given to a new one, so nothing it left behind can turn up in another.
- Profile
Store - The
Storageof the profile in use: each key is read and written as that profile’s (ProfileId::key), andlistlists only its keys, without their prefix. What stays with the computer (the list of profiles, whatever the game keeps per computer) goes throughcomputer. - Profiles
- The list of profiles, in the order they were made, and the one in use.
Enums§
- Profile
Error - Why a change to the list of profiles was refused.
Constants§
- MAX_
NAME_ CHARS - The longest profile name, in characters.
- MAX_
PROFILES - The most profiles there can be.
- PROFILES_
KEY Storagekey of the list of profiles, kept per computer.- PROFILES_
VERSION - The saved list’s format version.
Functions§
- delete_
keys - Deletes every key of the profile
idfrom the computer’sstorage. Tries them all; the first error, if any. - fits_
every_ profile - Whether
keycan be a key of any profile: whether the largest profile’s key for it (ProfileId::key) is a validStoragekey. A key a game keeps per player must be. - load
- The list of profiles in
storage, and warnings for the platform to log. - migrate
- Makes the first profile, called
name, and moves the player’s keys from before profiles (old_keys) into it, once.