fix bugs in lua's memorysavestate apis (fixes #565)

This commit is contained in:
zeromus 2016-02-08 01:28:26 -06:00
parent 86a8c1dfd4
commit 97998071a7
1 changed files with 6 additions and 6 deletions

View File

@ -24,21 +24,21 @@ namespace BizHawk.Client.Common
"savecorestate", "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" "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"
)] )]
public Guid SaveCoreStateToMemory() public string SaveCoreStateToMemory()
{ {
if (Global.Emulator.HasSavestates()) if (Global.Emulator.HasSavestates())
{ {
var guid = Guid.NewGuid(); var guid = Guid.NewGuid();
var bytes = Global.Emulator.AsStatable().SaveStateBinary(); var bytes = (byte[])Global.Emulator.AsStatable().SaveStateBinary().Clone();
MemorySavestates.Add(guid, bytes); MemorySavestates.Add(guid, bytes);
return guid; return guid.ToString();
} }
else else
{ {
Log("Savestates not supported on this core"); Log("Savestates not supported on this core");
return Guid.Empty; return Guid.Empty.ToString();
} }
} }