Add PinMAME support to any .NET application
This NuGet package provides a .NET binding for PinMAME, an emulator for solid state pinball machines. It uses the cross-platform LibPinMAME.
This package is automatically built and published when the main project, PinMAME, is updated.
- .NET Core (.NETStandard 2.1 and higher on Windows, Linux and macOS)
- Mono
The native wrapper is a different package and contains pre-compiled binaries of LibPinMAME.
NuGet Package | |
---|---|
Windows 64-bit | |
Windows 32-bit | |
macOS x64 | |
macOS arm64 | |
macOS x64/arm64 | |
iOS arm64 | |
Linux x64 | |
Android arm64-v8a |
To install this package with the native dependency of your current platform, run:
Install-Package PinMame
Install-Package PinMame-Native
Create a PinMame
instance, and then start a game.
using PinMame;
var _pinMame = PinMame.PinMame.Instance();
_pinMame.StartGame("t2_l8");
You can add event handlers for:
OnGameStarted
OnDisplayAvailable
OnDisplayUpdated
OnAudioAvailable
OnAudioUpdated
OnMechAvailable
OnMechUpdated
OnSolenoidUpdated
OnConsoleDataUpdated
OnGameEnded
IsKeyPressed
To process display data, in your OnDisplayUpdated
callback:
void OnDisplayUpdated(int index, IntPtr framePtr, PinMameDisplayLayout displayLayout)
{
if (displayLayout.IsDmd)
{
// Handle DMD displays (framePtr is byte*)
}
else
{
// Handle Alphanumeric displays (framePtr is ushort*)
}
};
To add or update a mech:
_pinMame.SetHandleMechanics(0);
PinMameMechConfig mechConfig = new PinMameMechConfig(
(uint)(PinMameMechFlag.NonLinear | PinMameMechFlag.Reverse | PinMameMechFlag.OneSol),
11,
240,
240,
0,
0,
0);
mechConfig.AddSwitch(new PinMameMechSwitchConfig(33, 0, 5));
mechConfig.AddSwitch(new PinMameMechSwitchConfig(32, 98, 105));
_pinMame.SetMech(0, mechConfig);
To remove a mech:
_pinMame.SetMech(0, null);
See the example project for more information.