diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesApi.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesApi.cs index cc4ae5b64d..741b8044d0 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesApi.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesApi.cs @@ -33,12 +33,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES } } - private PeRunner _exe; private CoreImpl _core; private bool _disposed; private CommStruct* _comm; private readonly Dictionary _sharedMemoryBlocks = new Dictionary(); + private bool _sealed = false; public void Enter() { @@ -110,6 +110,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES /// public void SetBytes(int id, byte[] bytes, Action andThen) { + if (_sealed) + throw new InvalidOperationException("Init period is over"); fixed (byte* bp = bytes) { _core.SetBuffer(id, bp, bytes.Length); @@ -122,6 +124,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES /// public void SetAscii(int id, string str, Action andThen) { + if (_sealed) + throw new InvalidOperationException("Init period is over"); fixed (byte* cp = System.Text.Encoding.ASCII.GetBytes(str + "\0")) { _core.SetBuffer(id, cp, str.Length + 1); @@ -345,7 +349,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES public void Seal() { + _core.SetBuffer(0, null, 0); + _core.SetBuffer(1, null, 0); + _core.SetBuffer(2, null, 0); _exe.Seal(); + _sealed = true; } public void SaveStateBinary(BinaryWriter writer) diff --git a/waterbox/libsnes/bsnes/target-libsnes/libsnes_pwrap.cpp b/waterbox/libsnes/bsnes/target-libsnes/libsnes_pwrap.cpp index 05ba922708..237b789ecc 100644 --- a/waterbox/libsnes/bsnes/target-libsnes/libsnes_pwrap.cpp +++ b/waterbox/libsnes/bsnes/target-libsnes/libsnes_pwrap.cpp @@ -173,7 +173,7 @@ struct CommStruct //=========================================================== //private stuff - void* privbuf[2]; //TODO remember to tidy this.. + void* privbuf[3]; //TODO remember to tidy this.. void CopyBuffer(int id, void* ptr, int32 size) {