Jump to content



Photo
- - - - -

A workaround for the VPX taito's Shark "missing ball" issue.


  • Please log in to reply
32 replies to this topic

#1 Pmax65

Pmax65

    Enthusiast

  • Platinum Supporter
  • 135 posts
  • Location:Romentino - Italy

  • Flag: Italy

  • Favorite Pinball: Addams Family

Posted 12 February 2019 - 12:52 AM

The following is a patch that I thought as a workaround for the missing ball issue for the Taito's Shark table.

At any game session beginning this patch makes a backup of the NVram file or replace it with the 

previous game session backup file.

For doing that, the backup file is deleted at the exit of the game session but only if the game-over lamp is active.

This way, every time the simulator is exited while a game is still running, on the next session the NVram file is substituted with the previous NVram backup executed after a correct game-over exited session.

In case the NVram and/or the NVram backup file became corrupt anyway and the missing ball issue returns, an emergency procedure to delete those files without the keyboard is provided too. 

In that case, you just have to press the Start button and holding it pressed you must put two coins into the first coin slit. This resets the Hi-scores and the credits counter of-course, but you don't need to install the keyboard in your cabinet. Note that after this emergency procedure the session is ended and VPX returns the control to its caller, you must re-enter the session after that.

 

This patch also fixes the NVram clearing that zeroes the hi-score and the credits counter in case the table was exited after a game-over but before the match procedure had ended.

This last bug happened only when the table was called outside the Pinball-X front-end. 

Using Pinball-X instead and exiting before the match procedure had ended, the pinball still lose the last session hi-score and the last session credits counter value (in this case the VpinMAME controller just has no time to write the new NVram file), this issue can't be fixed because Pinball-X forces the VPX to exit anyway after a certain time.

 

Here are the 4 parts of code to add to the table script:

 

################################################################################################################################################

1) Put this code somewhere at the beginning of the table script

################################################################################################################################################

 

' =============================================================================================================

' Subs and Functions for NVram patch

' =============================================================================================================

Const GameOverLampID = 149 ' set this constant to the ID number of the game over lamp defined in the B2S file

 

Dim NVramPatchCoinCnt

 

Function GetNVramPath()

        Dim WshShell

        Set WshShell = CreateObject("WScript.Shell")

        GetNVramPath = WshShell.RegRead ("HKCU\Software\Freeware\Visual PinMame\globals\nvram_directory")

End function

 

Function FileExists(FileName)

        DIM FSO

        FileExists = False

        On Error Resume Next

        Set FSO = CreateObject("Scripting.FileSystemObject")

        FileExists =FSO.FileExists(FileName)

        On Error Goto 0

        Set FSO = Nothing

End Function

 

Sub Kill(FileName)

        Dim ObjFile,FSO

        On Error Resume Next

        Set FSO = CreateObject("Scripting.FileSystemObject")

        Set ObjFile = FSO.GetFile (FileName)

        ObjFile.Delete

        On Error Goto 0

        Set FSO = Nothing

End Sub

 

Sub Copy(SourceFileName,DestFileName)

        Dim FSO

        On Error Resume Next

        Set FSO = CreateObject("Scripting.FileSystemObject")

        FSO.CopyFile SourceFileName,DestFileName,True

        On Error Goto 0

        Set FSO = Nothing

End Sub

 

Sub NVramPatchLoad

        NVramPatchCoinCnt = 0

        If FileExists(GetNVramPath + "\" + cGameName + ".nvb") Then

                Copy GetNVramPath + "\" + cGameName + ".nvb",GetNVramPath + "\" + cGameName + ".nv"

        Else

                Copy GetNVramPath + "\" + cGameName + ".nv",GetNVramPath + "\" + cGameName + ".nvb"

        End If

End Sub

 

Sub NVramPatchExit

        If LampState(GameOverLampID) Then 

                Kill GetNVramPath + "\" + cGameName + ".nvb"

                Do

                        LampTimer_Timer        ' This loop is need to avoid the NVram reset (losing the hi-score and credits) 

                Loop Until l20.State = 1        ' when the game is over but the match procedure isn't still ended 

                                                             ' (l20 in this table is just the first lamp that light on after the match procedure has ended)

        End If

End Sub

 

' NOTE:

' The following sub must exist otherwise it must be added with The LampTimer placed somewhere on the table

' Lamptimer.TimerInterval must be set not greater than 40ms

'Sub LampTimer_Timer()

'    Dim chgLamp, num, chg, ii

'    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

'  "  "  "  "  "  "  "  "  "  "

'  "  "  "  "  "  "  "  "  "  "

'  "  "  "  "  "  "  "  "  "  "

'End Sub

' =============================================================================================================

' =============================================================================================================

 

################################################################################################################################################

2) Put this statement into the table initialization subroutine (named table1_init), place it at the very first line of the routine

################################################################################################################################################

 

' =============================================================================================================

' =============================================================================================================

        NVramPatchLoad ' Must be placed before te VPinMAME controller initialization

' =============================================================================================================

' =============================================================================================================

 

################################################################################################################################################

3) Put this statement into the table exit subroutine (named table1_exit) just before the Controller.Stop statement

################################################################################################################################################

' =============================================================================================================

' =============================================================================================================

        NVramPatchExit ' Must be placed before the Controler.Stop statement into the Table_Exit Sub

' =============================================================================================================

' =============================================================================================================

 

################################################################################################################################################

4) Put this code into the LampTimer_Timer subroutine or any other subroutine called at least every 50ms

################################################################################################################################################

' =============================================================================================================

' NVram patch to completely erase the NVram files keeping the Start Game button pushed while inserting 

' two coins into the first coin slit (this resets the high scores too)

' =============================================================================================================

        If Controller.Switch(swStartButton) then

                If Controller.Switch(swCoin1) then

                        If NVramPatchCoinCnt = 2 Then

                                Controller.Stop

                                Kill GetNVramPath + "\" + cGameName + ".nv"

                                Kill GetNVramPath + "\" + cGameName + ".nvb"

                                QuitPlayer 2

                        Else

                                NVramPatchCoinCnt = 1

                        End If

                Else

                        If NVramPatchCoinCnt = 1 Then

                                NVramPatchCoinCnt = 2

                        End If

                End If

        Else

                NVramPatchCoinCnt = 0

        End If

' =============================================================================================================

' =============================================================================================================

 

This patch should be work on any other Taito's table with similar issues, but I still haven't check it.

To use this patch for other tables you must discover the game-over lamp ID and put it into the GameOverLampID  constant definition line (I used B2S Backglass designer V1.2 with the Shark (Taito 1982).directb2s file to discover the ID). 

 

I'm a newbie in this, I just started my home-brewed cabinet last July and finished last week to tune-up its table collection,  so maybe the code is not written the best way (it's the first time I use VBscript).

BTW, if someone knows a best way to know when the game is over I'll be glad to know.

 

Have a great day.

 

Massimo


Edited by Pmax65, 12 February 2019 - 08:37 AM.

Everywhere a ball rolls, there's fun!


#2 Thalamus

Thalamus

    Pinball Wizard

  • Platinum Supporter
  • 4,984 posts

  • Flag: Norway

  • Favorite Pinball: GOT, Alien Star, LOTR, TOM

Posted 12 February 2019 - 06:00 AM

What missing ball issue ? You have a link to where it is discussed ?


From now on. I won't help anyone here at VPF. Please ask Noah why that is.


#3 Pmax65

Pmax65

    Enthusiast

  • Platinum Supporter
  • 135 posts
  • Location:Romentino - Italy

  • Flag: Italy

  • Favorite Pinball: Addams Family

Posted 12 February 2019 - 07:57 AM

Hi Thalamus,

it is documented by the great jpsalas in the table description here:

 

https://www.vpforums...&showfile=13164

 

Have a great day.

 

Massimo


Everywhere a ball rolls, there's fun!


#4 STAT

STAT

    Pinball and Arcade Freak

  • VIP
  • 4,981 posts
  • Location:Wels - Austria

  • Flag: Austria

  • Favorite Pinball: Twilight Zone

Posted 12 February 2019 - 03:02 PM

Sounds good :tup: - but it is only "possible" after "Game Over", so there are no Troubles during 1 or more "normal" Game/s.

But you also will lost every Hiscore !


Edited by STAT, 12 February 2019 - 03:04 PM.


#5 Thalamus

Thalamus

    Pinball Wizard

  • Platinum Supporter
  • 4,984 posts

  • Flag: Norway

  • Favorite Pinball: GOT, Alien Star, LOTR, TOM

Posted 12 February 2019 - 03:04 PM

Interesting. I must have missed that info and for me it hasn't been a problem yet since I play those games to the end like any other :)

Seems like a fun project to try to resolve in another way. Appreciate the heads up.


Edited by Thalamus, 12 February 2019 - 03:06 PM.

From now on. I won't help anyone here at VPF. Please ask Noah why that is.


#6 Halen

Halen

    Enthusiast

  • Platinum Supporter
  • 238 posts
  • Location:Belo Horizonte - Brasil

  • Flag: Brazil

  • Favorite Pinball: Shark - Taito

Posted 12 February 2019 - 03:11 PM

Yes

This patch  work on any other Taito's table with similar issues, All Taito´s tables have the same game-over lamp ID. The constant definition is 149. I checked all tables taito.



#7 Pmax65

Pmax65

    Enthusiast

  • Platinum Supporter
  • 135 posts
  • Location:Romentino - Italy

  • Flag: Italy

  • Favorite Pinball: Addams Family

Posted 12 February 2019 - 03:55 PM

Sounds good  :tup: - but it is only "possible" after "Game Over", so there are no Troubles during 1 or more "normal" Game/s.

But you also will lost every Hiscore !

Hi STAT,
yes if you exit the game before the game over, and you get a new hi-score in that session, you still lost that hi-score because the previous session hi-score is retrieved.

 

Interesting. I must have missed that info and for me it hasn't been a problem yet since I play those games to the end like any other :)

Seems like a fun project to try to resolve in another way. Appreciate the heads up.

Hi Thalamus,

as you said, I think that there should be a better way to solve the issue, as said I'm a newbie and I don't know the VPinMAME controller in deep.

 

Yes

This patch  work on any other Taito's table with similar issues, All Taito´s tables have the same game-over lamp ID. The constant definition is 149. I checked all tables taito.

Hi Halen,

thank you for having checked the other tables.

I did it yesterday night on the shark table just because that jpsalas table was one of the pinball I used to play those times when I was young.

Jpsalas did  a great job with it and I was sorry for that minor issue, because I didn't want to open the coin door and install the keyboard every time I missed to end the game (as said above, I'm an irreducible forgetful  :wimper: ).

 

Have all a great day and enjoy your pinballs cabinets!

 

Massimo


Edited by Pmax65, 12 February 2019 - 03:58 PM.

Everywhere a ball rolls, there's fun!


#8 Halen

Halen

    Enthusiast

  • Platinum Supporter
  • 238 posts
  • Location:Belo Horizonte - Brasil

  • Flag: Brazil

  • Favorite Pinball: Shark - Taito

Posted 19 February 2019 - 01:06 PM

Pmax65 

 

is it possible to write the new Shark Taito´s script here?

 

I try to add the script and i dont have success.



#9 Pmax65

Pmax65

    Enthusiast

  • Platinum Supporter
  • 135 posts
  • Location:Romentino - Italy

  • Flag: Italy

  • Favorite Pinball: Addams Family

Posted 19 February 2019 - 02:12 PM

Hi Halen.

If I got you right, you want the full script attached to one message here.

 

Now I'm in office, but this night I'll place the script for sure.

 

Have a great day,

 

Massimo.


Everywhere a ball rolls, there's fun!


#10 Halen

Halen

    Enthusiast

  • Platinum Supporter
  • 238 posts
  • Location:Belo Horizonte - Brasil

  • Flag: Brazil

  • Favorite Pinball: Shark - Taito

Posted 19 February 2019 - 05:20 PM

Yes I want the full script. I'll wait for this

 

Thanks!!



#11 Pmax65

Pmax65

    Enthusiast

  • Platinum Supporter
  • 135 posts
  • Location:Romentino - Italy

  • Flag: Italy

  • Favorite Pinball: Addams Family

Posted 19 February 2019 - 09:11 PM

Hi Halen.

As promised, here you get the file.

 

Hope it fix the issue, let me know.

 

Massimo

 

Attached Files


Everywhere a ball rolls, there's fun!


#12 Halen

Halen

    Enthusiast

  • Platinum Supporter
  • 238 posts
  • Location:Belo Horizonte - Brasil

  • Flag: Brazil

  • Favorite Pinball: Shark - Taito

Posted 19 February 2019 - 10:10 PM

Thank you !!! Works like a charm!!!  I'll try to change the scripts of others Taito´s tables.



#13 Pmax65

Pmax65

    Enthusiast

  • Platinum Supporter
  • 135 posts
  • Location:Romentino - Italy

  • Flag: Italy

  • Favorite Pinball: Addams Family

Posted 19 February 2019 - 10:24 PM

Nice to read that you solved the issue.

 

Have great days enjoying your pinball cabinet.

 

I wish you all the best.

 

Massimo


Edited by Pmax65, 19 February 2019 - 10:25 PM.

Everywhere a ball rolls, there's fun!


#14 Halen

Halen

    Enthusiast

  • Platinum Supporter
  • 238 posts
  • Location:Belo Horizonte - Brasil

  • Flag: Brazil

  • Favorite Pinball: Shark - Taito

Posted 19 February 2019 - 10:47 PM

Pmax65

 

I change the script of Cosmic Taito Table and works great!!!

 

Thanks!!!



#15 Pmax65

Pmax65

    Enthusiast

  • Platinum Supporter
  • 135 posts
  • Location:Romentino - Italy

  • Flag: Italy

  • Favorite Pinball: Addams Family

Posted 19 February 2019 - 11:38 PM

I'm pleased to have been useful to you.


Everywhere a ball rolls, there's fun!


#16 Halen

Halen

    Enthusiast

  • Platinum Supporter
  • 238 posts
  • Location:Belo Horizonte - Brasil

  • Flag: Brazil

  • Favorite Pinball: Shark - Taito

Posted 20 February 2019 - 04:56 PM

Pmax65

 

I change all sccripts of Taito´s table but two tables i havent success. Drakor and Polar Explorer. Can you help me? 

https://mega.nz/#F!l...qI2BrnyJNqmfVHA

 

In Polar Explorer Table the last patch:' NVram patch to completely erase the NVram files keeping the Start Game button pushed while inserting ' two coins into the first coin slit (this resets the high scores too).

 

I write this patch in the line 654 in the end of "JP's Flasher Fading for VPX and Vpinmame v 2.0" and i have this message: variable not defined: 'LampState'.

 

The Drakor table I did not even try.


Edited by Halen, 20 February 2019 - 07:00 PM.


#17 Pmax65

Pmax65

    Enthusiast

  • Platinum Supporter
  • 135 posts
  • Location:Romentino - Italy

  • Flag: Italy

  • Favorite Pinball: Addams Family

Posted 20 February 2019 - 09:22 PM

Hi Halen,

 

I read your message while I was leaving the office, but now at home I'm unable to get the files from Mega.

It seems that they removed the files because of some kind of violation of their rules (I don't really understand why those files should have violated which rule indeed) .

 

So, I got the scripts extracting them from the tables downloaded from here.

 

Just one detail, is Polar Explorer the one from JPsalas or the one from 32assassin?

 

I ask because I don't find any "JP's Flasher Fading for VPX..." reference inside their scripts.

 

aren't those files from a VPX table?

 

Let me know.

 

Massimo


Everywhere a ball rolls, there's fun!


#18 Halen

Halen

    Enthusiast

  • Platinum Supporter
  • 238 posts
  • Location:Belo Horizonte - Brasil

  • Flag: Brazil

  • Favorite Pinball: Shark - Taito

Posted 20 February 2019 - 09:46 PM

Try this link: https://mega.nz/#F!t...WlSYxk7gpD9HKZA

 

Polar Explorer is from JPSalas. Line 386

 

'**********************************************************

'     JP's Flasher Fading for VPX and Vpinmame v 2.0
'       (Based on Pacdude's Fading Light System)
' This is a fast fading for the Flashers in vpinmame tables
'**********************************************************


#19 Pmax65

Pmax65

    Enthusiast

  • Platinum Supporter
  • 135 posts
  • Location:Romentino - Italy

  • Flag: Italy

  • Favorite Pinball: Addams Family

Posted 20 February 2019 - 10:05 PM

Ok, try this one attached.

 

Note that I added in line 484:

 

Dim LampState(200)

 

just after:

 

Dim FadingState(200)

 

This is to remove the error you had, but I also added in line 498:

 

        LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1)

 

This is needed to load the LampState array with the current on/off values of the VPinMAME lamp

signals.

 

Try it and let me know, it should work.

 

Massimo

 

Attached Files


Everywhere a ball rolls, there's fun!


#20 Halen

Halen

    Enthusiast

  • Platinum Supporter
  • 238 posts
  • Location:Belo Horizonte - Brasil

  • Flag: Brazil

  • Favorite Pinball: Shark - Taito

Posted 20 February 2019 - 11:06 PM

Yes!!!!!!! Works like a charm!!!!! is it possible to make this in Drakor table?