-
Notifications
You must be signed in to change notification settings - Fork 0
Layer 2 Registration and Identity
Registration is how the library learns about a save file. Identity resolution determines what game a save belongs to.
sv_register() creates a new registration from a live_save_path (required) plus optional metadata:
-
rom_path— path to the ROM/disc image -
platform— target platform identifier -
emulator— emulator name/version -
product_version— emulator/core/backend version -
mode—SV_MODE_DEFAULTorSV_MODE_STRATEGY
Produces an opaque sv_registration_t* handle and a persistent 8-character unique ID.
sv_update_register() mutates an existing registration using an explicit set_mask bitfield. The bitfield distinguishes "leave unchanged" from "explicitly reset to default/empty," since update semantics can't rely on zero-default alone.
Includes a "poke check" against the destination path: reports SV_CONFLICT_EXISTING_DATA by default rather than guessing. Caller can pass SV_ON_CONFLICT_OVERRIDE or SV_ON_CONFLICT_ABORT_SILENT explicitly.
Relocation supports:
-
SV_RELOCATE_COPY(default, non-destructive) -
SV_RELOCATE_MOVE(copy-verify-then-delete-source, never delete-then-copy)
sv_unregister() drops the metadata record only — it never touches the magazine or live files. Entries under a removed registration become orphans (parent_id zeroed), not deleted.
In SV_MODE_STRATEGY, identity resolution uses a tiered approach:
-
Embedded serial extraction (zero external data needed): PSP/PS1/PS2
SYSTEM.CNF/PARAM.SFO, SaturnIP.BIN, GameCube/Wii boot headers - Header checksums: SNES/Genesis internal checksum + file size
- Pluggable hash-database module (optional, database-free core): for remaining edge cases
In SV_MODE_DEFAULT, none of this runs — it's a bare, generic file/folder tracker.
| Mode | Identity | Manifest | Use Case |
|---|---|---|---|
SV_MODE_DEFAULT |
None | None | Generic testing, simple sync |
SV_MODE_STRATEGY |
Tiered resolution | Per-platform/emulator | Real emulator save management |
See also: Architecture-Overview | Layer-3-Metadata-Store | API-Reference
libsavesync Wiki