diff --git a/Assets/dll/libmgba.dll.so b/Assets/dll/libmgba.dll.so index fabc6f9c05..1861f8a77e 100644 Binary files a/Assets/dll/libmgba.dll.so and b/Assets/dll/libmgba.dll.so differ diff --git a/Assets/dll/mgba.dll b/Assets/dll/mgba.dll index a3f77ca30f..56f16190e1 100644 Binary files a/Assets/dll/mgba.dll and b/Assets/dll/mgba.dll differ diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/LibmGBA.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/LibmGBA.cs index 2530480a9b..0d4e5de8b7 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/LibmGBA.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/LibmGBA.cs @@ -180,6 +180,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA [BizImport(cc, Compatibility = true)] public abstract byte BizReadBus(IntPtr ctx, uint addr); + [UnmanagedFunctionPointer(cc)] + public delegate void InputCallback(); + [BizImport(cc, Compatibility = true)] + public abstract void BizSetInputCallback(IntPtr ctx, InputCallback cb); + [UnmanagedFunctionPointer(cc)] public delegate void TraceCallback(string msg); [BizImport(cc, Compatibility = true)] diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.IInputPollable.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.IInputPollable.cs index 024bf22d82..748ba40738 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.IInputPollable.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.IInputPollable.cs @@ -4,10 +4,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA { public partial class MGBAHawk : IInputPollable { + private readonly LibmGBA.InputCallback InputCallback; public int LagCount { get; set; } public bool IsLagFrame { get; set; } - - [FeatureNotImplemented] - public IInputCallbackSystem InputCallbacks { get; private set; } + private void InputCb() + { + // most things are already handled in the core, this is just for event.oninputpoll + InputCallbacks.Call(); + } + private InputCallbackSystem _inputCallbacks = new InputCallbackSystem(); + public IInputCallbackSystem InputCallbacks => _inputCallbacks; } } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.cs index 958e551612..249769df95 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.cs @@ -78,7 +78,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA throw; } - InputCallbacks = new MemoryBasedInputCallbackSystem(this, "System Bus", new[] { 0x4000130u }); + InputCallback = new LibmGBA.InputCallback(InputCb); + LibmGBA.BizSetInputCallback(Core, InputCallback); } public IEmulatorServiceProvider ServiceProvider { get; } diff --git a/submodules/mgba b/submodules/mgba index 751a87dd3a..ade176cfba 160000 --- a/submodules/mgba +++ b/submodules/mgba @@ -1 +1 @@ -Subproject commit 751a87dd3a7b4bdc2b2b00fa89ace69b685529ce +Subproject commit ade176cfbaca2903ab40d998287f9eb1e84624b5