Closed jsm174 closed 3 years ago
Two questions:
GameOn
coil we could also let pass, since it's always the same, no? Or delay it until after the startup delay if it comes before.
- Wasn't there a global flag in PinMAME to disable any mech simulation?
Not exactly.. Let me try to explain g_fHandleMechanics
with psuedo code.
if VPINMAME
if g_fHandleMechanics
update mechs 0 - 4
update simulation
else
update mechs 5 - 9
do not update simulation
if NOT VPINMAME
update mechs 0 - 4
if g_fHandleMechanics
update simulation
From the VPinball side, any calls to vp_setMechData
use a 1 index, but internally sets mechs 5 - 9
vp_setMechData(1, ...)
sets mech 5
vp_setMechData(2, ...)
sets mech 6
From the VPinball side, and calls to vp_getMechData
use a 1 index, but internally gets mechs 5 - 9
vp_getMechData(-1)
gets the speed for mech 5
vp_getMechData(-2)
gets the speed for mech 6
vp_getMechData(1)
gets the position for mech 5
vp_getMechData(2)
gets the position for mech 6
Should I make libpinmame
work like vpinmame
?
Oh okay. So by "update simulation" you mean trigger switches within PinMAME directly, right? So in any case we'll get mech events (which in the cannon case is the rotation step?).
I don't know the difference between updating mechs 0-4 versus 5-9, so I can't answer your question. What are the pros & contras?
Oh okay. So by "update simulation" you mean trigger switches within PinMAME directly, right? So in any case we'll get mech events (which in the cannon case is the rotation step?).
Not exactly. Crazy I know.. Stick with me:
Update simulation is like when you run pinmame standalone and it pretends to have a ball, working trough, etc.
Lets take T2:
if NOT VPINMAME
update mechs 0 - 4
if g_fHandleMechanics
update simulation
1) update mech 0 will calculate the speed and position of gun motor if solenoid is active, and set gun home and gun mark switches based on position
2) if g_fHandleMechanics
, update simulation by calling t2_handleMech()
.
Finally, lets take vpinmame / vpinball and go through g5k_002:
if VPINMAME
if g_fHandleMechanics
update mechs 0 - 4
update simulation
else
update mechs 5 - 9
do not update simulation
vp_setMechData(1, ...
which internally sets mech 5g_fHandleMechanics
to 01) update mech 5 will calculate the speed and position of gun motor if solenoid is active, and set gun home and gun mark switches based on position
2) g_fHandleMechanics
is 0, so no simulation called, no other switches are effected
I think the best course of action, to reduce confusion, is to just make it work like vpinmame
.
libpinmame
and pinmame-dot
were updated to support the above discussion.
built in mechs are now disabled when g_fHandleMechanics
is 0.
I found and instance where Bride of Pinbot uses different int values with g_fHandleMechanics
, so I switched it from bool
to int
.
The PR adds the following options to the PinMAME game logic engine:
Disable mechs will set all pinmame mechs to null, basically disabling any built in mech, such as the gun motor on T2.
Note, there is no
getMaxMechs
exposed byPinmame-dotnet
, so currently we have it hardcoded to10
. The next time I updatepinmame-dotnet
, I will add this.The Solenoid startup delay will disable any
OnSolenoid
messages from being delivered until the delay has passed. We have noticed that System 80 games, the outhole coil is fired for a 65ms within the first 200ms after pinmame starts. This is causing the ball to automatically be in the shooter lane on startup.A couple things about this approach:
GameOn
coil.DateTimeOffset.Now.ToUnixTimeMilliseconds()
. There has to be a unity way to do this. Since this occurs as a callback from C to C# and is happening in a thread, we don't have access toTime.delta