LaunchBoxContributors
On this page

EmulatorSaveAddRequest14.1

Class in Unbroken.LaunchBox.Plugins.Components.Emulators

C#
public sealed class EmulatorSaveAddRequest
Provides the context for adding a save file to an emulator.

Constructors

EmulatorSaveAddRequest

C#
public EmulatorSaveAddRequest()

A summary has not been written for this member.

Properties

  • DestinationFileLocationGets or sets the exact file, folder, or memory card to restore into, or null to let the plugin choose.
  • EmulatorGets or sets the configured emulator to restore the save into.
  • SaveToAddGets or sets the save to add.
  • ShouldReplaceSaveFuncGets or sets the callback used to confirm and back up the existing save that the add would replace.

DestinationFileLocation

C#
public string? DestinationFileLocation { get; set; }
Gets or sets the exact file, folder, or memory card to restore into, or null to let the plugin choose.

Remarks

LaunchBox sets this when it puts back a save that a failed restore replaced, using the GameSaveBase.FileLocation the plugin passed to EmulatorSaveAddRequest.ShouldReplaceSaveFunc. When it is set, write only to that location.

Emulator

C#
public required IEmulator Emulator { get; set; }
Gets or sets the configured emulator to restore the save into.

Remarks

LaunchBox always supplies this. It is the emulator that created the save when LaunchBox can identify it, and otherwise the emulator assigned to the save's game or additional application. Restore into this emulator's save locations, using GameSaveBase.EmulatorCore from EmulatorSaveAddRequest.SaveToAdd when the emulator separates saves by core.

SaveToAdd

C#
public required GameSaveBase SaveToAdd { get; set; }
Gets or sets the save to add.

ShouldReplaceSaveFunc

C#
public required Func<GameSaveBase, bool> ShouldReplaceSaveFunc { get; set; }
Gets or sets the callback used to confirm and back up the existing save that the add would replace.

Remarks

LaunchBox always supplies this callback. Call it before replacing existing save data, and do not call it when nothing would be replaced. Pass a new GameSaveState or GameSaveGame that describes the data about to be replaced: GameSaveBase.GameId and GameSaveBase.AdditionalApplicationId; GameSaveBase.FileLocation set to the file or folder that will be replaced, or to the memory card for saves stored inside a container; GameSaveState.Slot for save states; GameSaveBase.SaveGroupId for saves stored inside a container; and GameSaveBase.EmulatorFileName and GameSaveBase.EmulatorCore when known. LaunchBox asks the user, backs up that data, and returns true only when the user agreed and the backup succeeded. When it returns false, write nothing and return a failed result.