2017-04-14 19:59:01 +00:00
using System ;
using System.Collections.Generic ;
using System.IO ;
2017-07-10 04:51:02 +00:00
using NLua ;
2017-04-14 19:59:01 +00:00
using BizHawk.Emulation.Common ;
2019-11-29 22:35:21 +00:00
// ReSharper disable UnusedMember.Global
// ReSharper disable UnusedAutoPropertyAccessor.Local
2017-04-14 19:59:01 +00:00
namespace BizHawk.Client.Common
{
2019-11-16 11:32:48 +00:00
public sealed class MemorySavestateEmuLuaLibrary : DelegatingLuaLibrary
2017-04-14 19:59:01 +00:00
{
public MemorySavestateEmuLuaLibrary ( Lua lua )
: base ( lua ) { }
public MemorySavestateEmuLuaLibrary ( Lua lua , Action < string > logOutputCallback )
: base ( lua , logOutputCallback ) { }
public override string Name = > "memorysavestate" ;
2018-03-14 01:05:30 +00:00
[LuaMethodExample("local mmsvstsvcst = memorysavestate.savecorestate( );")]
2017-07-10 19:02:00 +00:00
[LuaMethod("savecorestate", "creates a core savestate and stores it in memory. Note: a core savestate is only the raw data from the core, and not extras such as movie input logs, or framebuffers. Returns a unique identifer for the savestate")]
2019-11-16 11:32:48 +00:00
public string SaveCoreStateToMemory ( ) = > APIs . MemorySaveState . SaveCoreStateToMemory ( ) ;
2017-04-14 19:59:01 +00:00
2018-03-14 01:05:30 +00:00
[LuaMethodExample("memorysavestate.loadcorestate( \"3fcf120f-0778-43fd-b2c5-460fb7d34184\" );")]
2017-07-10 19:02:00 +00:00
[LuaMethod("loadcorestate", "loads an in memory state with the given identifier")]
2019-11-16 11:32:48 +00:00
public void LoadCoreStateFromMemory ( string identifier ) = > APIs . MemorySaveState . LoadCoreStateFromMemory ( identifier ) ;
2017-04-14 19:59:01 +00:00
2018-03-14 01:05:30 +00:00
[LuaMethodExample("memorysavestate.removestate( \"3fcf120f-0778-43fd-b2c5-460fb7d34184\" );")]
2017-07-10 19:02:00 +00:00
[LuaMethod("removestate", "removes the savestate with the given identifier from memory")]
2019-11-16 11:32:48 +00:00
public void DeleteState ( string identifier ) = > APIs . MemorySaveState . DeleteState ( identifier ) ;
2017-04-14 19:59:01 +00:00
2018-03-14 01:05:30 +00:00
[LuaMethodExample("memorysavestate.clearstatesfrommemory( );")]
2017-07-10 19:02:00 +00:00
[LuaMethod("clearstatesfrommemory", "clears all savestates stored in memory")]
2019-11-16 11:32:48 +00:00
public void ClearInMemoryStates ( ) = > APIs . MemorySaveState . ClearInMemoryStates ( ) ;
2017-04-14 19:59:01 +00:00
}
}