vpinball / pinmame

PinMAME - Pinball Multiple Arcade Machine Emulator
https://www.vpforums.org
Other
189 stars 51 forks source link

Flipper issues on WOF (was: Lamps above 400 on Wheel of Fortune) #196

Closed francisdb closed 8 months ago

francisdb commented 10 months ago

First, is there a better place to ask these questions?

This table used to play without issues but Controller.ChangedLamps now seems to return lamps over 400 where the table code has only 400 entries in the arrays. Is this expected as it might break more tables?

2024-01-18 09:46:07.837 INFO  [28830] [DebuggerModule::Print@4232] Script.Print 'lamp 580 state 255'
2024-01-18 09:46:07.847 INFO  [28830] [DebuggerModule::Print@4232] Script.Print 'lamp 583 state 255'
2024-01-18 09:46:07.866 INFO  [28830] [DebuggerModule::Print@4232] Script.Print 'lamp 581 state 255'
2024-01-18 09:46:07.886 INFO  [28830] [DebuggerModule::Print@4232] Script.Print 'lamp 582 state 255'
2024-01-18 09:46:11.757 INFO  [28830] [DebuggerModule::Print@4232] Script.Print 'lamp 580 state 0'
2024-01-18 09:46:11.788 INFO  [28830] [DebuggerModule::Print@4232] Script.Print 'lamp 583 state 0'
2024-01-18 09:46:11.916 INFO  [28830] [DebuggerModule::Print@4232] Script.Print 'lamp 581 state 0'
2024-01-18 09:46:12.167 INFO  [28830] [DebuggerModule::Print@4232] Script.Print 'lamp 582 state 0'
2024-01-18 09:46:40.307 INFO  [28830] [DebuggerModule::Print@4232] Script.Print 'lamp 601 state 0'
2024-01-18 09:46:36.137 INFO  [28830] [DebuggerModule::Print@4232] Script.Print 'lamp 609 state 255'
2024-01-18 09:46:40.317 INFO  [28830] [DebuggerModule::Print@4232] Script.Print 'lamp 595 state 247'
2024-01-18 09:46:40.338 INFO  [28830] [DebuggerModule::Print@4232] Script.Print 'lamp 595 state 121'
2024-01-18 09:46:40.357 INFO  [28830] [DebuggerModule::Print@4232] Script.Print 'lamp 588 state 0'

PINMAME_SHA beec0c3cda92d3df1caeeb8af83ef14b05e1cf06

vbousquet commented 10 months ago

This is intended and is only for WOF and WPT. It happens that these tables have LED matrices which seem to be PWMed so I added them as such.

francisdb commented 10 months ago

Ok, I guess it's then up to the table writers to account for these new lamps.

For reference the required diff to fix this (along with some other standalone fixes)

--- "Wheel of Fortune (Stern 2007) 1.0.vbs.original.tmp"        2024-01-19 10:24:05.222749595 +0100
+++ "Wheel of Fortune (Stern 2007) 1.0.vbs"     2024-01-19 10:23:58.334543589 +0100
@@ -10,6 +10,8 @@
 If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
 On Error Goto 0

+Const cGameName = "wof_500"
+
 Const Ballsize = 52
 Const BallMass = 1.5

@@ -43,8 +45,6 @@
 '                                               INIT TABLE
 '************************************************************************

-Const cGameName = "wof_500"
-
 Dim bsTrough, PlungerIM, DTBank

 Sub Table1_Init
@@ -567,8 +567,8 @@
 ' SetLamp 1 is On
 ' fading for non opacity objects is 4 steps
 '***************************************************
-Dim LampState(400), FadingLevel(400)
-Dim FlashSpeedUp(400), FlashSpeedDown(400), FlashMin(400), FlashMax(400), FlashLevel(400)
+Dim LampState(610), FadingLevel(610)
+Dim FlashSpeedUp(610), FlashSpeedDown(610), FlashMin(610), FlashMax(610), FlashLevel(610)

 InitLamps()             ' turn off the lights and flashers and reset them to the default parameters
 LampTimer.Interval = 10 'lamp fading speed
@@ -913,7 +913,7 @@

 Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
     Vol = Csng(BallVel(ball) ^2 / 5000)
-       Debug.Print Vol
+       'Debug.Print Vol
 End Function

 Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
toxieainc commented 10 months ago

@vbousquet Is this something that should also be added to the whatsnew?

toxieainc commented 10 months ago

Sidenote: As mentioned above, a similar patch is needed for WPT.

francisdb commented 10 months ago

@vbousquet I also have issues with the flippers on WOF, sometimes they don't react or are stuck in the up position. Looks like some events get lost. Does that ring a bell?

toxieainc commented 10 months ago

Is this with 10.8.0 or 10.8.1?

francisdb commented 10 months ago

For now I can only reproduce it on standalone branch or 10.8.1 standalone, works fine on windows. And only for this table which is strange.

jsm174 commented 10 months ago

Your windows pinmame is on the absolute latest?

francisdb commented 10 months ago

Latest pre-release vpinmame downloaded yesterday.

francisdb commented 10 months ago

Can I test this in xpinmame without table?

jsm174 commented 10 months ago

I'm at a loss, as to why this only a standalone issue. libpinmame is not doing anything to the data. (it was previously to support RGBs with VPE, but all that was reverted). Its running through all the same code as the win32com.

Maybe I missed a core_request_pwm_output_update();

Maybe a second set of eyes could compare:

https://github.com/vpinball/pinmame/blob/699fabce6fb0f96ea0d8d31fa44ae3b92f45cc08/src/libpinmame/libpinmame.cpp#L1008-L1189

to

https://github.com/vpinball/pinmame/blob/699fabce6fb0f96ea0d8d31fa44ae3b92f45cc08/src/win32com/Controller.cpp#L1459-L1733

francisdb commented 10 months ago

Can you reproduce the issue on mac? Haven't tried that yet.

toxieainc commented 10 months ago

I think that we still have some issues/regressions here and there with 10.8.1, compared to 10.8.0, so maybe this is related??

toxieainc commented 10 months ago

@vbousquet Any idea maybe??

francisdb commented 10 months ago

Made some progress as to find the cause of the issue

Commenting out Controller.ChangedLamps in the LampTimer_Timer solves the flipper issue. (with of course lamps no longer working).

francisdb commented 10 months ago

Should I move this over to a new issue?

mazjohn commented 9 months ago

WOF -Table lighting/ lamps do not work or flash at all in vpinmame latest builds. Flippers erratic/get stuck - cannot isolate. Tested with 10.73 x86 final and 10.8 rc1 with same results...intermittant script errors: Runtime error

Line: 593 Subscript out of range: 'chgLamp(...)'

Edit/ Update: reverted back to build 720 dated DEC31 release and the issues are gone. I'm not a programmer- So dumb question: will all table scripts that do not get updated be broken moving forwards or will this below fix make its way into a future build to ensure backwards compatibility? respect// thank you for bringing these amazing works to this hobby.

francisdb commented 9 months ago

That specific issue is fixed by changing the array declarations from capacity 400 to 610 in the script.

See https://github.com/jsm174/vpx-standalone-scripts/pull/251

toxieainc commented 9 months ago

Flipper issues could be fixed now, please test @francisdb

toxieainc commented 9 months ago

Doesn't work for me yet, so far, so reopening. @vbousquet for vis

francisdb commented 9 months ago

Probably stupid question: what do you mean with "for vis"?

toxieainc commented 9 months ago

I'm never 100% sure if Vince gets the PinMAME issue mails, so pinging him explicitly for stuff that is related to his changes.

vbousquet commented 9 months ago

I keep an eye on Github only (I also have a look from time to time to discord / VPF but the feedback is usually too largely spread and not enough cleanly reported to be usable) but I miss things. There are just too much. So no problem.

Regarding the SAM emulation issues. I have just pushed a new PR for these bugs which improves flipper emulation (lower latency, hack designed around IJ4 emulation bug only). The original implementation also used some nasty hacks to keep things running so it is a bit difficult to identify what should be removed since some hacks were only needed due to the lack of PWM support, other are needed due to emulation issue (like IJ4).

For WOF, I was not able to reproduce the issue (on the latest with teh latest fix), so I would need some more hints to have a look.

francisdb commented 9 months ago

I'm never 100% sure if Vince gets the PinMAME issue mails, so pinging him explicitly for stuff that is related to his changes.

Got that part but I suppose that's some kind of abbreviation?

Screenshot_20240224-103847

toxieainc commented 9 months ago

Simpler.. _vis_ibility

toxieainc commented 9 months ago

WOF flippers now seem to consistently work with the latest commit 544085ba91e581ccff1566616b521b3560d7d242, @francisdb please also verify

francisdb commented 9 months ago

Issue still there for me with latest pinmame on standalone linux 10.8.1 and 7b0aafb49b6dbe7127261e3ba3737afe76e88e8 Still fixes itself by commenting out Controller.ChangedLamps

    ' chgLamp = Controller.ChangedLamps
    ' If Not IsEmpty(chgLamp) Then
    '     For ii = 0 To UBound(chgLamp)
    '         LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1)       'keep the real state in an array
    '         FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4 'actual fading step
    '     Next
    ' End If
francisdb commented 9 months ago

@toxieainc why can't I reopen this issue?

toxieainc commented 9 months ago

No clue, reopening

vbousquet commented 8 months ago

This is the latest issue (beside improving filtering) following the PWM changes but I still can't reproduce it. Reading from the above, I'm not sure:

@francisdb could you confirm if the bug is still there for you ? If so, could you provide a link to the offending table (to check if it is maybe a table script bug) ?

francisdb commented 8 months ago

For now I can only reproduce it on standalone branch or 10.8.1 standalone, works fine on windows. And only for this table which is strange.

https://vpuniverse.com/files/file/5501-wheel-of-fortune-stern-2007/

With patched script from https://github.com/jsm174/vpx-standalone-scripts/tree/master/Wheel%20of%20Fortune%20(Stern%202007)%201.0 (increased array sizes)

Still have flippers not always reacting or being stuck in up position with latest 10.8.1 branch but happens less often than before.

Not calling Controller.ChangedLamps still fixes the issue or makes it much less likely to happen.

@jsm174 can you reproduce this one on mac/linux?

toxieainc commented 8 months ago

@francisdb Can you please test again with the latest build?

francisdb commented 8 months ago

Issue persists with b06d8d4d48f9e2e9f3638a3f469002cb64035f0a Do we have anybody else who can reproduce this issue?

embryodead commented 8 months ago

As previous user say lastest vpx 10.8 build on windows with the lastest vpinmame build from yesterday. wpt, wof and also big buck hunter, no insert on playfield even with the fix in the script and flipper stuck on wof(flippers are fine in indy and wpt).

francisdb commented 8 months ago

Confirming this is fixed. Thanks @vbousquet !