lua - implement memory.getcurrentmemorydomain(), memory.getmemorydomainlist(), memory.usememorydomain()

This commit is contained in:
andres.delikat 2012-01-28 22:30:04 +00:00
parent 2a86660466
commit c7cc0ee203
2 changed files with 37 additions and 4 deletions

View File

@ -152,9 +152,9 @@ namespace BizHawk.MultiClient
public static string[] MemoryFunctions = new string[] public static string[] MemoryFunctions = new string[]
{ {
//"usememorydomain", "usememorydomain",
//"getmemorydomainlist", "getmemorydomainlist",
//"getcurrentmemorydomain", "getcurrentmemorydomain",
"readbyte" "readbyte"
//"readbytesigned", //"readbytesigned",
//"readword", //"readword",
@ -236,7 +236,6 @@ namespace BizHawk.MultiClient
return LuaLibraryList; return LuaLibraryList;
} }
//---------------------------------------------------- //----------------------------------------------------
//Emu library //Emu library
//---------------------------------------------------- //----------------------------------------------------
@ -285,6 +284,38 @@ namespace BizHawk.MultiClient
//Memory library //Memory library
//---------------------------------------------------- //----------------------------------------------------
public bool memory_usememorydomain(object lua_input)
{
if (lua_input.GetType() != typeof(string))
return false;
for (int x = 0; x < Global.Emulator.MemoryDomains.Count; x++)
{
if (Global.Emulator.MemoryDomains[x].Name == lua_input.ToString())
{
CurrentMemoryDomain = x;
return true;
}
}
return false;
}
public string memory_getmemorydomainlist()
{
string list = "";
for (int x = 0; x < Global.Emulator.MemoryDomains.Count; x++)
{
list += Global.Emulator.MemoryDomains[x].Name + '\n';
}
return list;
}
public string memory_getcurrentmemorydomain()
{
return Global.Emulator.MemoryDomains[CurrentMemoryDomain].Name;
}
public string memory_readbyte(object lua_input) public string memory_readbyte(object lua_input)
{ {

View File

@ -94,6 +94,8 @@ namespace BizHawk.MultiClient
{ {
for (int x = 0; x < luaList.Count; x++) for (int x = 0; x < luaList.Count; x++)
luaList[x].Enabled = false; luaList[x].Enabled = false;
LuaImp.Close();
LuaImp = new LuaImplementation(this);
} }
public void Restart() public void Restart()