Lua - memory library - populate the default memory with the MainMemory defined for that core, as opposed to null, which results in silent crashes

This commit is contained in:
adelikat 2014-07-14 16:24:28 +00:00
parent fb133da0c5
commit 9644c3d29f
1 changed files with 8 additions and 2 deletions

View File

@ -12,10 +12,16 @@ namespace BizHawk.Client.Common
private int _currentMemoryDomain; // Main memory by default probably (index 0 is currently always main memory but may never be)
public MemoryLuaLibrary(Lua lua)
: base(lua) { }
: base(lua)
{
_currentMemoryDomain = Global.Emulator.MemoryDomains.IndexOf(Global.Emulator.MemoryDomains.MainMemory);
}
public MemoryLuaLibrary(Lua lua, Action<string> logOutputCallback)
: base(lua, logOutputCallback) { }
: base(lua, logOutputCallback)
{
_currentMemoryDomain = Global.Emulator.MemoryDomains.IndexOf(Global.Emulator.MemoryDomains.MainMemory);
}
public override string Name { get { return "memory"; } }