Partially revert #1754, add event.onmemoryexecuteany
This commit is contained in:
parent
bd7233f2cd
commit
3f9b51f565
|
@ -183,9 +183,9 @@ namespace BizHawk.Client.Common
|
||||||
return nlf.Guid.ToString();
|
return nlf.Guid.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
[LuaMethodExample("local steveonm = event.onmemoryexecute(\r\n\tfunction()\r\n\t\tconsole.log( \"Fires after the given address is executed by the core. If is explicitly nil, it will attach to every memory read\" );\r\n\tend\r\n\t, 0x200, \"Frame name\", \"System Bus\" );")]
|
[LuaMethodExample("local steveonm = event.onmemoryexecute(\r\n\tfunction()\r\n\t\tconsole.log( \"Fires after the given address is executed by the core\" );\r\n\tend\r\n\t, 0x200, \"Frame name\", \"System Bus\" );")]
|
||||||
[LuaMethod("onmemoryexecute", "Fires after the given address is executed by the core. If the address is explicitly nil, it will attach to every memory read")]
|
[LuaMethod("onmemoryexecute", "Fires after the given address is executed by the core")]
|
||||||
public string OnMemoryExecute(LuaFunction luaf, uint? address, string name = null, string domain = null)
|
public string OnMemoryExecute(LuaFunction luaf, uint address, string name = null, string domain = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -218,6 +218,39 @@ namespace BizHawk.Client.Common
|
||||||
return Guid.Empty.ToString();
|
return Guid.Empty.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[LuaMethodExample("local steveonm = event.onmemoryexecuteany(\r\n\tfunction()\r\n\t\tconsole.log( \"Fires after any address is executed by the core (CPU-intensive)\" );\r\n\tend\r\n\t, \"Frame name\", \"System Bus\" );")]
|
||||||
|
[LuaMethod("onmemoryexecuteany", "Fires after any address is executed by the core (CPU-intensive)")]
|
||||||
|
public string OnMemoryExecuteAny(LuaFunction luaf, string name = null, string domain = null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (DebuggableCore?.MemoryCallbacksAvailable() == true
|
||||||
|
&& DebuggableCore.MemoryCallbacks.ExecuteCallbacksAvailable)
|
||||||
|
{
|
||||||
|
var nlf = new NamedLuaFunction(luaf, "OnMemoryExecuteAny", LogOutputCallback, CurrentFile, name);
|
||||||
|
RegisteredFunctions.Add(nlf);
|
||||||
|
DebuggableCore.MemoryCallbacks.Add(new MemoryCallback(
|
||||||
|
string.IsNullOrWhiteSpace(domain) && Domains?.HasSystemBus == true
|
||||||
|
? Domains.SystemBus.Name
|
||||||
|
: domain,
|
||||||
|
MemoryCallbackType.Execute,
|
||||||
|
"Lua Hook",
|
||||||
|
nlf.MemCallback,
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
));
|
||||||
|
return nlf.Guid.ToString();
|
||||||
|
}
|
||||||
|
// fall through
|
||||||
|
}
|
||||||
|
catch (NotImplementedException)
|
||||||
|
{
|
||||||
|
// fall through
|
||||||
|
}
|
||||||
|
LogMemoryExecuteCallbacksNotImplemented();
|
||||||
|
return Guid.Empty.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
[LuaMethodExample("local steveonm = event.onmemoryread(\r\n\tfunction()\r\n\t\tconsole.log( \"Fires after the given address is read by the core. If no address is given, it will attach to every memory read\" );\r\n\tend\r\n\t, 0x200, \"Frame name\" );")]
|
[LuaMethodExample("local steveonm = event.onmemoryread(\r\n\tfunction()\r\n\t\tconsole.log( \"Fires after the given address is read by the core. If no address is given, it will attach to every memory read\" );\r\n\tend\r\n\t, 0x200, \"Frame name\" );")]
|
||||||
[LuaMethod("onmemoryread", "Fires after the given address is read by the core. If no address is given, it will attach to every memory read")]
|
[LuaMethod("onmemoryread", "Fires after the given address is read by the core. If no address is given, it will attach to every memory read")]
|
||||||
public string OnMemoryRead(LuaFunction luaf, uint? address = null, string name = null, string domain = null)
|
public string OnMemoryRead(LuaFunction luaf, uint? address = null, string name = null, string domain = null)
|
||||||
|
|
Loading…
Reference in New Issue