LaunchBoxContributors
On this page

IEmulatorSaveCapability14.1

Interface in Unbroken.LaunchBox.Plugins.Components.Emulators

C#
public interface IEmulatorSaveCapability
Discovers, adds, removes, groups, and backs up save files owned by an external emulator.

Methods

AddSaveFile

Adds a save file to the emulator for a game.

Remarks

Before replacing existing save data, call EmulatorSaveAddRequest.ShouldReplaceSaveFunc with the save that would be replaced, and write nothing when it returns false.
request
The save to restore, including its source file, target slot, and the emulator file name and core that created it, and the configured emulator in EmulatorSaveAddRequest.Emulator to restore into.

Returns

The add-save result.

GetCompanionSaveFiles

C#
IReadOnlyList<string> GetCompanionSaveFiles(string primaryFilePath)
Gets additional files that must be handled with a primary save file.
primaryFilePath
The primary save-file path.

Returns

The companion save-file paths.

GetPotentialSaveSlots

C#
IReadOnlyDictionary<int, string> GetPotentialSaveSlots()
Gets the save-slot identifiers and display labels supported by the emulator.

Returns

A mapping from slot number to display label.

GetSaves

Gets the save files associated with a game and emulator.
request
The games, additional applications, and configured emulator to scan. When EmulatorSaveDiscoveryRequest.CommandLine is set, it is the command line used for the play session and takes precedence over the games' own command lines.

Returns

The save-discovery result.

IsSaveActive

C#
bool IsSaveActive(GameSaveBase save, string emulatorApplicationPath)
Determines whether a save is the emulator's active copy.
save
The save to inspect.
emulatorApplicationPath
The path to the emulator executable.

Returns

true when the save is active.

IsSaveContainer

C#
bool IsSaveContainer(GameSaveBase save)
Determines whether a save represents a container whose contents must be handled together.
save
The save to inspect.

Returns

true when the save is a container.

IsSecondarySaveFile

C#
bool IsSecondarySaveFile(string filePath)
Determines whether a path is a secondary file belonging to another primary save.
filePath
The file path to inspect.

Returns

true when the path is a secondary save file.

RemoveSave

C#
PluginResponse RemoveSave(GameSaveBase save)
Removes a save from the emulator.
save
The save to remove.

Returns

Whether the save was removed successfully.

TryBackupSave

C#
bool TryBackupSave(
    GameSaveBase save,
    string emulatorApplicationPath,
    string destinationFolder,
    out string? error
)
Attempts to copy a save and related files into a backup folder.
save
The save to back up.
emulatorApplicationPath
The path to the emulator executable.
destinationFolder
The destination folder for the backup.
error
An error message when the backup fails.

Returns

true when the backup was created.

TryComputeSaveSignature

C#
bool TryComputeSaveSignature(
    GameSaveBase save,
    string emulatorApplicationPath,
    out string? signature
)
Attempts to compute a stable signature for a save's current contents.
save
The save to inspect.
emulatorApplicationPath
The path to the emulator executable.
signature
The computed signature when successful.

Returns

true when a signature was computed.

TryGetSaveGroupInfo

C#
bool TryGetSaveGroupInfo(
    GameSaveBase save,
    string primaryFilePath,
    out string? saveGroupId,
    out string? saveGroupName
)
Attempts to resolve grouping information for a primary save file.
save
The save to inspect.
primaryFilePath
The primary save-file path.
saveGroupId
The stable group identifier when successful.
saveGroupName
The display name for the group when successful.

Returns

true when grouping information was resolved.

UseSaveGroupIdForPersistedMatch

C#
bool UseSaveGroupIdForPersistedMatch(GameSaveBase save)
Determines whether persisted matching should use the save's group identifier.
save
The save to inspect.

Returns

true when persisted matching should use the group identifier.