IEmulatorSaveCapability14.1
Interface in Unbroken.LaunchBox.Plugins.Components.Emulators
public interface IEmulatorSaveCapabilityDiscovers, adds, removes, groups, and backs up save files owned by an external emulator.
Methods
AddSaveFileAdds a save file to the emulator for a game.GetCompanionSaveFilesGets additional files that must be handled with a primary save file.GetPotentialSaveSlotsGets the save-slot identifiers and display labels supported by the emulator.GetSavesGets the save files associated with a game and emulator.IsSaveActiveDetermines whether a save is the emulator's active copy.IsSaveContainerDetermines whether a save represents a container whose contents must be handled together.IsSecondarySaveFileDetermines whether a path is a secondary file belonging to another primary save.RemoveSaveRemoves a save from the emulator.TryBackupSaveAttempts to copy a save and related files into a backup folder.TryComputeSaveSignatureAttempts to compute a stable signature for a save's current contents.TryGetSaveGroupInfoAttempts to resolve grouping information for a primary save file.UseSaveGroupIdForPersistedMatchDetermines whether persisted matching should use the save's group identifier.
AddSaveFile
EmulatorSaveAddResult AddSaveFile(EmulatorSaveAddRequest request)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 returnsfalse.
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
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
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
EmulatorSaveDiscoveryResult GetSaves(EmulatorSaveDiscoveryRequest request)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
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
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
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
PluginResponse RemoveSave(GameSaveBase save)Removes a save from the emulator.
save- The save to remove.
Returns
Whether the save was removed successfully.TryBackupSave
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
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
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
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.