fix lua memory callback functions on cores with no system bus such as PSX

This commit is contained in:
adelikat 2019-12-15 11:37:45 -06:00
parent b6df55bbf0
commit 250bd2087e
1 changed files with 26 additions and 3 deletions

View File

@ -201,6 +201,10 @@ namespace BizHawk.Client.Common
{
domain = Domains.SystemBus.Name;
}
else
{
domain = DebuggableCore.MemoryCallbacks.AvailableScopes.First();
}
}
DebuggableCore.MemoryCallbacks.Add(
@ -228,11 +232,22 @@ namespace BizHawk.Client.Common
&& DebuggableCore.MemoryCallbacks.ExecuteCallbacksAvailable)
{
var nlf = new NamedLuaFunction(luaf, "OnMemoryExecuteAny", LogOutputCallback, CurrentFile, name);
if (string.IsNullOrWhiteSpace(domain))
{
if (Domains != null && Domains.HasSystemBus)
{
domain = Domains.SystemBus.Name;
}
else
{
domain = DebuggableCore.MemoryCallbacks.AvailableScopes.First();
}
}
RegisteredFunctions.Add(nlf);
DebuggableCore.MemoryCallbacks.Add(new MemoryCallback(
string.IsNullOrWhiteSpace(domain) && Domains?.HasSystemBus == true
? Domains.SystemBus.Name
: domain,
domain,
MemoryCallbackType.Execute,
"Lua Hook",
nlf.MemCallback,
@ -268,6 +283,10 @@ namespace BizHawk.Client.Common
{
domain = Domains.SystemBus.Name;
}
else
{
domain = DebuggableCore.MemoryCallbacks.AvailableScopes.First();
}
}
DebuggableCore.MemoryCallbacks.Add(
@ -302,6 +321,10 @@ namespace BizHawk.Client.Common
{
domain = Domains.SystemBus.Name;
}
else
{
domain = DebuggableCore.MemoryCallbacks.AvailableScopes.First();
}
}
DebuggableCore.MemoryCallbacks.Add(