Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ private void OnEnable()
new MedievalMadness(),
new Terminator2(),
new FlashGordon(),
new StarTrekEnterprise(),
};
_gameNames = new[] {"-- none --"}
.Concat(_games.Select(g => g.Name))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ public class PinMameGamelogicEngine : MonoBehaviour, IGamelogicEngine
public const string DmdPrefix = "dmd";
public const string SegDispPrefix = "display";

public PinMameGame Game {
get => _game;
set => _game = value;
}
public PinMameGame Game { get => _game; set => _game = value; }

[HideInInspector]
public string romId = string.Empty;
Expand All @@ -69,6 +66,8 @@ public GamelogicEngineLamp[] AvailableLamps {
}
}

public GamelogicEngineWire[] AvailableWires => _game?.AvailableWires ?? Array.Empty<GamelogicEngineWire>();

public event EventHandler<CoilEventArgs> OnCoilChanged;
public event EventHandler<LampEventArgs> OnLampChanged;
public event EventHandler<LampsEventArgs> OnLampsChanged;
Expand Down Expand Up @@ -174,6 +173,16 @@ private void Update()
OnLampChanged?.Invoke(this, new LampEventArgs(_lamps[changedLamp.Id].Id, changedLamp.Value));
}
}

// gi
foreach (var changedGi in _pinMame.GetChangedGIs()) {
if (_lamps.ContainsKey(changedGi.Id)) {
Logger.Info($"[PinMAME] <= gi {changedGi.Id}: {changedGi.Value}");
OnLampChanged?.Invoke(this, new LampEventArgs(_lamps[changedGi.Id].Id, changedGi.Value, LampSource.GI));
} else {
Debug.Log($"No GI {changedGi.Id} found.");
}
}
}

private void OnDisplayAvailable(int index, int displayCount, PinMameDisplayLayout displayLayout)
Expand Down Expand Up @@ -277,7 +286,7 @@ private int OnAudioUpdated(IntPtr framePtr, int frameSize)
if (_audioNumSamplesInput > 100000) {
var delta = AudioSettings.dspTime - _audioInputStart;
var queueMs = System.Math.Round(_audioQueue.Count * (double)_audioInfo.SamplesPerFrame / _audioInfo.SampleRate * 1000);
Debug.Log($"INPUT: {System.Math.Round(_audioNumSamplesInput / delta)} - {_audioQueue.Count} in queue ({queueMs}ms)");
//Debug.Log($"INPUT: {System.Math.Round(_audioNumSamplesInput / delta)} - {_audioQueue.Count} in queue ({queueMs}ms)");
_audioInputStart = AudioSettings.dspTime;
_audioNumSamplesInput = 0;
}
Expand Down Expand Up @@ -328,7 +337,7 @@ private void OnAudioFilterRead(float[] data, int channels)
_audioNumSamplesOutput += data.Length / channels;
if (_audioNumSamplesOutput > 100000) {
var delta = AudioSettings.dspTime - _audioOutputStart;
Debug.Log($"OUTPUT: {System.Math.Round(_audioNumSamplesOutput / delta)}");
//Debug.Log($"OUTPUT: {System.Math.Round(_audioNumSamplesOutput / delta)}");
_audioOutputStart = AudioSettings.dspTime;
_audioNumSamplesOutput = 0;
}
Expand Down
10 changes: 5 additions & 5 deletions VisualPinball.Engine.PinMAME/Games/FlashGordon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ namespace VisualPinball.Engine.PinMAME.Games
[Serializable]
public class FlashGordon : Bally
{
public override string Name { get; } = "Flash Gordon";
public override string Id { get; } = "fg";
public override int Year { get; } = 1980;
public override string Manufacturer { get; } = "Bally";
public override int IpdbId { get; } = 874;
public override string Name => "Flash Gordon";
public override string Id => "fg";
public override int Year => 1980;
public override string Manufacturer => "Bally";
public override int IpdbId => 874;

public override PinMameRom[] Roms { get; } = {
new PinMameRom("flashgdn"),
Expand Down
1 change: 0 additions & 1 deletion VisualPinball.Engine.PinMAME/Games/MedievalMadness.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
using VisualPinball.Engine.Common;
using VisualPinball.Engine.Game.Engines;
using VisualPinball.Engine.PinMAME.MPUs;
using VisualPinball.Engine.VPT.Plunger;

namespace VisualPinball.Engine.PinMAME.Games
{
Expand Down
419 changes: 419 additions & 0 deletions VisualPinball.Engine.PinMAME/Games/StarTrekEnterprise.cs

Large diffs are not rendered by default.

52 changes: 29 additions & 23 deletions VisualPinball.Engine.PinMAME/Games/Terminator2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ namespace VisualPinball.Engine.PinMAME.Games
[Serializable]
public class Terminator2 : Wpc
{
public override string Name { get; } = "Terminator 2: Judgment Day";
public override string Id { get; } = "t2";
public override int Year { get; } = 1991;
public override string Manufacturer { get; } = "Williams";
public override int IpdbId { get; } = 2524;
public override string Name => "Terminator 2: Judgment Day";
public override string Id => "t2";
public override int Year => 1991;
public override string Manufacturer => "Williams";
public override int IpdbId => 2524;
public override PinMameRom[] Roms { get; } = {
new PinMameRom("t2_l2", "L-2"),
new PinMameRom("t2_l3", "L-3"),
Expand All @@ -46,10 +46,10 @@ public class Terminator2 : Wpc
protected override GamelogicEngineSwitch[] Switches { get; } = {
new GamelogicEngineSwitch("13") { Description = "Start Button", InputActionHint = InputConstants.ActionStartGame },
new GamelogicEngineSwitch("14") { Description = "Plumb Bob Tilt" },
new GamelogicEngineSwitch("15") { Description = "Trough Left", DeviceHint = "^Trough\\s*\\d?", DeviceItemHint = "2" },
new GamelogicEngineSwitch("16") { Description = "Trough Center", DeviceHint = "^Trough\\s*\\d?", DeviceItemHint = "3" },
new GamelogicEngineSwitch("17") { Description = "Trough Right", DeviceHint = "^Trough\\s*\\d?", DeviceItemHint = "4" },
new GamelogicEngineSwitch("18") { Description = "Outhole", DeviceHint = "^Trough\\s*\\d?", DeviceItemHint = "1" },
new GamelogicEngineSwitch("15") { Description = "Trough Left", DeviceHint = "^Trough\\s*\\d?", DeviceItemHint = "3" },
new GamelogicEngineSwitch("16") { Description = "Trough Center", DeviceHint = "^Trough\\s*\\d?", DeviceItemHint = "2" },
new GamelogicEngineSwitch("17") { Description = "Trough Right", DeviceHint = "^Trough\\s*\\d?", DeviceItemHint = "1" },
new GamelogicEngineSwitch("18") { Description = "Outhole", DeviceHint = "^Trough\\s*\\d?", DeviceItemHint = "drain_switch" },

//new GamelogicEngineSwitch("21") { Description = "Slam Tilt" },
new GamelogicEngineSwitch("22") { Description = "Coin Door Closed", NormallyClosed = true, InputActionHint = InputConstants.ActionCoinDoorOpenClose },
Expand Down Expand Up @@ -172,13 +172,19 @@ public class Terminator2 : Wpc
new GamelogicEngineLamp("85") { Description = "Drop Target" },
new GamelogicEngineLamp("86") { Description = "Top Lane Left" },
new GamelogicEngineLamp("87") { Description = "Top Lane Center" },
new GamelogicEngineLamp("88") { Description = "Top Lane Right" }
new GamelogicEngineLamp("88") { Description = "Top Lane Right" },

new GamelogicEngineLamp("0") { Description = "GI: Top Insert", Source = LampSource.GI, FadingSteps = 8 },
new GamelogicEngineLamp("1") { Description = "GI: Bottom Insert", Source = LampSource.GI, FadingSteps = 8 },
new GamelogicEngineLamp("2") { Description = "GI: Right Playfield", Source = LampSource.GI, FadingSteps = 8 },
new GamelogicEngineLamp("3") { Description = "GI: CPU String", Source = LampSource.GI, FadingSteps = 8 },
new GamelogicEngineLamp("4") { Description = "GI: Left Playfield", Source = LampSource.GI, FadingSteps = 8 },
};

protected override GamelogicEngineCoil[] GameCoils { get; } = {
new GamelogicEngineCoil("01") { Description = "Ball Popper" },
new GamelogicEngineCoil("02") { Description = "Gun Kicker" },
new GamelogicEngineCoil("03") { Description = "Outhole" },
new GamelogicEngineCoil("03") { Description = "Outhole", DeviceHint = "^Trough\\s*\\d?", DeviceItemHint = "entry_coil" },
new GamelogicEngineCoil("04") { Description = "Trough", DeviceHint = "^Trough\\s*\\d?", DeviceItemHint = "eject_coil" },
new GamelogicEngineCoil("05") { Description = "Right Sling" },
new GamelogicEngineCoil("06") { Description = "Left Sling" },
Expand All @@ -192,18 +198,18 @@ public class Terminator2 : Wpc
new GamelogicEngineCoil("14") { Description = "Right Jet" },
new GamelogicEngineCoil("15") { Description = "Bottom Jet" },
new GamelogicEngineCoil("16") { Description = "Left Lock" },
new GamelogicEngineCoil("17") { Description = "Hot Dog Flashlamps", IsLamp = true},
new GamelogicEngineCoil("18") { Description = "Right Sling Flashlamps", IsLamp = true },
new GamelogicEngineCoil("19") { Description = "Left Sling Flashlamps", IsLamp = true },
new GamelogicEngineCoil("20") { Description = "Left Lock Flashlamps", IsLamp = true },
new GamelogicEngineCoil("21") { Description = "Gun Flashlamps", IsLamp = true},
new GamelogicEngineCoil("22") { Description = "Right Ramp Flashlamps", IsLamp = true },
new GamelogicEngineCoil("23") { Description = "Left Ramp Flashlamps", IsLamp = true },
new GamelogicEngineCoil("24") { Description = "Backglass Flashlamp", IsLamp = true },
new GamelogicEngineCoil("25") { Description = "Targets Flashlamps", IsLamp = true },
new GamelogicEngineCoil("26") { Description = "Left Popper Flashlamps", IsLamp = true },
new GamelogicEngineCoil("27") { Description = "Right Popper" },
new GamelogicEngineCoil("28") { Description = "Flashlamps Drop Target" },
new GamelogicEngineCoil("17") { Description = "Hot Dog Flashlamps", IsLamp = true, DeviceHint = "^F1?17$"},
new GamelogicEngineCoil("18") { Description = "Right Sling Flashlamps", IsLamp = true, DeviceHint = "^F1?18$" },
new GamelogicEngineCoil("19") { Description = "Left Sling Flashlamps", IsLamp = true, DeviceHint = "^F1?19$" },
new GamelogicEngineCoil("20") { Description = "Left Lock Flashlamps", IsLamp = true, DeviceHint = "^F1?20$" },
new GamelogicEngineCoil("21") { Description = "Gun Flashlamps", IsLamp = true, DeviceHint = "^F1?21$" },
new GamelogicEngineCoil("22") { Description = "Right Ramp Flashlamps", IsLamp = true, DeviceHint = "^F1?22$" },
new GamelogicEngineCoil("23") { Description = "Left Ramp Flashlamps", IsLamp = true, DeviceHint = "^F1?23$" },
new GamelogicEngineCoil("24") { Description = "Backglass Flashlamp", IsLamp = true, DeviceHint = "^F1?24$" },
new GamelogicEngineCoil("25") { Description = "Targets Flashlamps", IsLamp = true, DeviceHint = "^F1?25$" },
new GamelogicEngineCoil("26") { Description = "Left Popper Flashlamps", IsLamp = true, DeviceHint = "^F1?26$" },
new GamelogicEngineCoil("27") { Description = "Right Popper Flashlamps", IsLamp = true, DeviceHint = "^F1?27$" },
new GamelogicEngineCoil("28") { Description = "Flashlamps Drop Target", IsLamp = true, DeviceHint = "^F1?28$" },

new GamelogicEngineCoil(CoilFlipperLowerRight, 46) { Description = "Lower Right Flipper", DeviceHint = "^RightFlipper$"},
new GamelogicEngineCoil(CoilFlipperLowerLeft, 48) { Description = "Lower Left Flipper", DeviceHint = "^LeftFlipper$"},
Expand Down
2 changes: 1 addition & 1 deletion VisualPinball.Engine.PinMAME/MPUs/Bally.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public abstract class Bally : PinMameGame
new GamelogicEngineSwitch(SwCpuDiagnose, -6) {Description = "CPU Diagnose"},
new GamelogicEngineSwitch(SwSoundDiagnose, -5) {Description = "Sound Diagnose"},
new GamelogicEngineSwitch(SwBallRollTilt, 2) {Description = "Ball Roll Tilt"},
new GamelogicEngineSwitch(SwStartButton, 06) {Description = "Start Button", InputActionHint = InputConstants.ActionStartGame, InputMapHint = InputConstants.MapCabinetSwitches },
new GamelogicEngineSwitch(SwStartButton, 6) {Description = "Start Button", InputActionHint = InputConstants.ActionStartGame, InputMapHint = InputConstants.MapCabinetSwitches },
new GamelogicEngineSwitch(SwTilt, 7) {Description = "Tilt" },
new GamelogicEngineSwitch(SwSlamTilt, 16) {Description = "Slam Tilt", InputActionHint = InputConstants.ActionSlamTilt, InputMapHint = InputConstants.MapCabinetSwitches },
new GamelogicEngineSwitch(SwCoin1, 11) {Description = "Coin Button 1", InputActionHint = InputConstants.ActionInsertCoin1, InputMapHint = InputConstants.MapCabinetSwitches },
Expand Down
7 changes: 7 additions & 0 deletions VisualPinball.Engine.PinMAME/PinMameGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ public abstract class PinMameGame

public abstract GamelogicEngineLamp[] AvailableLamps { get; }

public GamelogicEngineWire[] AvailableWires { get; } = {
new GamelogicEngineWire(SwFlipperLowerLeft, CoilFlipperLowerLeft, DestinationType.Coil, "Lower Left Flipper"),
new GamelogicEngineWire(SwFlipperLowerRight, CoilFlipperLowerRight, DestinationType.Coil, "Lower Right Flipper"),
new GamelogicEngineWire(SwFlipperUpperLeft, CoilFlipperUpperLeft, DestinationType.Coil, "Upper Left Flipper"),
new GamelogicEngineWire(SwFlipperUpperRight, CoilFlipperUpperRight, DestinationType.Coil, "Upper Right Flipper"),
};

/// <summary>
/// These coils are common to all games.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="PinMame" Version="0.1.0-preview.41" />
<PackageReference Include="PinMame.Native" Version="3.4.0-preview.280" />
<PackageReference Include="VisualPinball.Engine" Version="0.0.1-preview.57" />
<PackageReference Include="PinMame" Version="0.1.0-preview.42" />
<PackageReference Include="PinMame.Native" Version="3.4.0-preview.299" />
<PackageReference Include="VisualPinball.Engine" Version="0.0.1-preview.67" />
</ItemGroup>

<Target Name="PluginsDeploy" AfterTargets="Build">
Expand Down