Skip to content

Commit

Permalink
Improve error message when core does not implement mem callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
YoshiRulz committed Apr 7, 2023
1 parent fbe1f9b commit 6e77c73
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions src/BizHawk.Client.Common/lua/LuaHelperLibs/EventsLuaLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,11 @@ public EventsLuaLibrary(ILuaLibraries luaLibsImpl, ApiContainer apiContainer, Ac

public override string Name => "event";

private void LogMemoryCallbacksNotImplemented()
{
Log($"{Emulator.Attributes().CoreName} does not implement memory callbacks");
}
private void LogMemoryCallbacksNotImplemented(bool isWildcard)
=> Log($"{Emulator.Attributes().CoreName} does not implement {(isWildcard ? "wildcard " : string.Empty)}memory callbacks");

private void LogMemoryExecuteCallbacksNotImplemented()
{
Log($"{Emulator.Attributes().CoreName} does not implement memory execute callbacks");
}
private void LogMemoryExecuteCallbacksNotImplemented(bool isWildcard)
=> Log($"{Emulator.Attributes().CoreName} does not implement {(isWildcard ? "wildcard " : string.Empty)}memory execute callbacks");

private void LogScopeNotAvailable(string scope)
{
Expand Down Expand Up @@ -136,11 +132,11 @@ public string OnBusExec(
}
catch (NotImplementedException)
{
LogMemoryExecuteCallbacksNotImplemented();
LogMemoryExecuteCallbacksNotImplemented(isWildcard: false);
return Guid.Empty.ToString();
}

LogMemoryExecuteCallbacksNotImplemented();
LogMemoryExecuteCallbacksNotImplemented(isWildcard: false);
return Guid.Empty.ToString();
}

Expand Down Expand Up @@ -190,7 +186,7 @@ public string OnBusExecAny(
{
// fall through
}
LogMemoryExecuteCallbacksNotImplemented();
LogMemoryExecuteCallbacksNotImplemented(isWildcard: true);
return Guid.Empty.ToString();
}

Expand Down Expand Up @@ -232,11 +228,11 @@ public string OnBusRead(
}
catch (NotImplementedException)
{
LogMemoryCallbacksNotImplemented();
LogMemoryCallbacksNotImplemented(isWildcard: address is null);
return Guid.Empty.ToString();
}

LogMemoryCallbacksNotImplemented();
LogMemoryCallbacksNotImplemented(isWildcard: address is null);
return Guid.Empty.ToString();
}

Expand Down Expand Up @@ -278,11 +274,11 @@ public string OnBusWrite(
}
catch (NotImplementedException)
{
LogMemoryCallbacksNotImplemented();
LogMemoryCallbacksNotImplemented(isWildcard: address is null);
return Guid.Empty.ToString();
}

LogMemoryCallbacksNotImplemented();
LogMemoryCallbacksNotImplemented(isWildcard: address is null);
return Guid.Empty.ToString();
}

Expand Down

0 comments on commit 6e77c73

Please sign in to comment.