Interface IGameEmulation
A single instance of emulation for a specific IGame, with a specific combination of configuration, input, and initial save game state.
A IGame
Namespace: Snowflake.Orchestration.Extensibility
Assembly: Snowflake.Framework.Primitives.dll
Syntax
public interface IGameEmulation
Properties
ControllerPorts
A list of IEmulated
Declaration
IEnumerable<IEmulatedController> ControllerPorts { get; }
Property Value
Type | Description |
---|---|
System. |
EmulationState
The current state of the game emulation. It is absolutely impervious that
implementations update this accordingly, or the IGame
Declaration
GameEmulationState EmulationState { get; }
Property Value
Type | Description |
---|---|
Game |
Game
The game that is being emulated in this instance.
Declaration
IGame Game { get; }
Property Value
Type | Description |
---|---|
IGame |
SaveProfile
The initial save game that should be copied into the working directory for this emulation instance.
If this is null, then the implementation is responsible for creating a blank initial save game state
in Restore
Declaration
ISaveProfile SaveProfile { get; }
Property Value
Type | Description |
---|---|
ISave |
Methods
CompileConfiguration()
Compiles relevant configuration into the working directory of the emulation instance, ready for use.
Declaration
Task CompileConfiguration()
Returns
Type | Description |
---|---|
System. |
An asynchronous task that signals the completion of the compilation. |
DisposeAsync()
Implements System.
This method must be idempotent. Repeated calls must be ignored.
Declaration
ValueTask DisposeAsync()
Returns
Type | Description |
---|---|
System. |
PersistSaveGame()
Persists the current state of the game's save information into a new immutable ISave
This can only be run if the game is not currently running, to avoid race conditions causing data corruption.
Declaration
Task<ISaveGame> PersistSaveGame()
Returns
Type | Description |
---|---|
System. |
A new ISave |
RestoreSaveGame()
Restores the save into the working directory save folder, or otherwise prepares
the folder for a new game if Save
This method must be idempotent. If the save game restore succeeds, calling this method again must do nothing.
Declaration
Task RestoreSaveGame()
Returns
Type | Description |
---|---|
System. |
An asynchronous task that signals the completion of the restore. |
SetupEnvironment()
Run any misceallenous tasks required to prepare the working directory, such as copying BIOS files to the working directory if necessary.
This method must be idempotent. If the environment setup succeeds, calling this method again must do nothing.
Declaration
Task SetupEnvironment()
Returns
Type | Description |
---|---|
System. |
An asynchronous task that signals the completion of the preparation. |
StartEmulation()
Begin the emulation instance (run the game).
This method must be idempotent. Once an emulation has started, this method must return the same cancellation token for the same process instance in future calls. If the emulation has stopped, this method must do nothing.
Implementations of IGame
Declaration
CancellationToken StartEmulation()
Returns
Type | Description |
---|---|
System. |
A cancellation token that indicates when the emulation is halted by the user, or programmatically. |
Exceptions
Type | Condition |
---|---|
System. |
If all hooks have not yet been called. |
StopEmulation()
As safely as possible, halt the currently running emulation instance forever.
Instead of calling this directly, consider calling Dispose
This method must be idempotent. Once an emulation has stopped, it can never be restarted, and calling this method again must do nothing. If the emulation has yet to be started, this method must do nothing.
Declaration
Task StopEmulation()
Returns
Type | Description |
---|---|
System. |
An asynchronous task that signals the completion of the instance halt. |