From 9644c3d29fc1ac961ad46ebac1e987dbe1e9eada Mon Sep 17 00:00:00 2001 From: adelikat Date: Mon, 14 Jul 2014 16:24:28 +0000 Subject: [PATCH] Lua - memory library - populate the default memory with the MainMemory defined for that core, as opposed to null, which results in silent crashes --- BizHawk.Client.Common/lua/EmuLuaLibrary.Memory.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.Memory.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.Memory.cs index 4d1dda5112..1c9e001c0a 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.Memory.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.Memory.cs @@ -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 logOutputCallback) - : base(lua, logOutputCallback) { } + : base(lua, logOutputCallback) + { + _currentMemoryDomain = Global.Emulator.MemoryDomains.IndexOf(Global.Emulator.MemoryDomains.MainMemory); + } public override string Name { get { return "memory"; } }