Skip to content

Commit

Permalink
Add emu.atinput()
Browse files Browse the repository at this point in the history
  • Loading branch information
Aurumaker72 committed Aug 17, 2023
1 parent 3346c1e commit 345ea0f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions M64RPFW.Models/Scripting/LuaEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public LuaFunctionAttribute(string path)

private SKCanvas? _skCanvas;
private LuaFunction? _viCallback;
private LuaFunction? _inputCallback;
private LuaFunction? _stopCallback;
private LuaFunction? _updateScreenCallback;

Expand All @@ -59,6 +60,7 @@ static LuaEnvironment()
using (env._luaLock.ReadLock())
{
env._viCallback?.Call();
env._inputCallback?.Call();
}
if (!env._isActive)
env.TryDisposeLock();
Expand Down Expand Up @@ -187,6 +189,7 @@ public void Dispose()

_stopCallback = null;
_viCallback = null;
_inputCallback = null;
_updateScreenCallback = null;

_lua.Dispose();
Expand Down
6 changes: 6 additions & 0 deletions M64RPFW.Models/Scripting/LuaEnvironment_Emulator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ private void RegisterAtStop(LuaFunction luaFunction)
{
_stopCallback = luaFunction;
}

[LuaFunction("emu.atinput")]
private void RegisterAtInput(LuaFunction luaFunction)
{
_inputCallback = luaFunction;
}

[LuaFunction("emu.atupdatescreen")]
private void RegisterAtUpdateScreen(LuaFunction luaFunction)
Expand Down

0 comments on commit 345ea0f

Please sign in to comment.