Jump to content



Photo
- - - - -

How to modify fplaunch for game specific settings


  • Please log in to reply
10 replies to this topic

#1 BigBoss

BigBoss

    Pinball Fan

  • VP Dev Team
  • PipPipPipPip
  • 750 posts

  • Flag: ---------

  • Favorite Pinball: Attack From Mars, Metallica, Theatre Of Magic, Shadow, Star Trek

Posted 27 February 2011 - 08:30 AM

This topic is mainly geared towards you cabinet users running Visual Pinball and experiencing issues like some tables are too loud, but do not have a volume adjustment (dr dude, earthshaker, elvira, f14, funhouse, bally game show etc), some tables require vp9.08 or vp8 to run, some tables work best with hdrender off. This will hopefully teach you how to modify your fplaunch.ahk script to install table specific workarounds.

My fplaunch script currently has 3 workaround sections:
1) VP9.08 tables - these tables run best in vp9.08. I created this originally when 9.10 came out with the labels bug. Still use it for scarred stiff which shows no flippers on vp 9.1.1
2) Sound mod tables - in these, I adjust the system sound volume before launching the vp executable so that all tables are the same volume and I'm not reaching for a vol knob
3) HD Render off tables - I use this for bally gameshow which stutters a bit with HD render option checked.

You could use these patterns and create other exceptions though.

First, a quick disclaimer. I really don't know anything about autohotkey scripting. I struggle with simple things still and everytime I make a change, I have to read the autohotkey docs. Therefore, there may be more efficient ways of doing these things. If you know them already, you probably don't need this topic anyways smile.gif

For anyone that doesn't understand FPLaunch or doesn't care how this works and just wants to add this functionality, you can skip the rest of this and just rename your existing fplaunch.exe and fplaunch.ahk, download the included zip file, extract it to your Hyperpin directory, and read the readme.txt for how it works. I have already set up all the tables I believed were too loud on my set up and disabled HDRender only on The Bally Game Show, which stutters for me with the new ramps.

The file is too big to upload so here it is at my server: http://thebigboss.or...ss_fplaunch.zip

----------------------------------------------------------

Details for anyone that wants them:

The general approach I took was that I added the ability to insert a text file for each ability you want modified on a table-by-table basis in the HyperPin/Databases/Visual Pinball directory. The files I created are:
1) hdrenderofftables.txt. In this file, you just list each table name (minus the .vpt) that you wish to render without HD.
2) soundmodtables.txt - In this file, you just list the table name one one line. On the next line, the number of "clicks" to reduce volume. On my system, 1 unit equals 2% volume reduction. So 30% volume reduction is a value of 15. So in this file you list the table name followed by the vol reduction x 2%.
3) vp908tables.txt - This file just lists each table that you want run in vp9.08 instead of the latest visual pinball. The VPinball908.exe file must be present next to VPinball.exe for this to work. You could also modify this to be vp8 tables with a VPinball8.exe file.

Then when you launch this table from hyperpin, the visual pinball registry key will be updated disabling this feature, the table run, when you exit out the hdrender registry key will be restored so that the next table does render in HD. Here is the added fplaunch.ahk code:

At the top of the PFLaunch.ahk file add:
systemName = %1%
tableName = %2%
extraVPConfigDir = %A_ScriptDir%\Databases\Visual Pinball
picDir = %A_ScriptDir%\Media\HyperPin\Images\
loadingSpashVP = %picDir%\loadingsplashVP.png
loadingSpashFP = %picDir%\loadingsplashFP.png


Inside the virtual pinball run loop change it to:

else if (systemName = "Visual Pinball" && (executable = "VPinball.exe"))
{
Hotkey, $%exitEmulatorKey%, CloseVP

; Array examples: http://www.autohotke...misc/Arrays.htm
; Read config file for vp9.08 tables
vp908count = 0
; This loop retrieves each line from the file, one at a time.
Loop, Read, %extraVPConfigDir%\vp908tables.txt
{
vp908count += 1 ; Keep track of how many items are in the array.
vp908array%vp908count% := A_LoopReadLine ; Store this line in the next array element.
}

; Check if table is in the vp908tables array.
Loop %vp908count%
{
; The following line uses the := operator to retrieve an array element:
element := vp908array%A_Index% ; A_Index is a built-in variable.
if(tableName = element)
{
executable = VPinball908.exe
break
}
}

; Read config file for disable HD rendering tables since this is a global setting now.
HDRenderOffCount = 0
HDRenderOffChanged = 0
; This loop retrieves each line from the file, 1 at a time.
Loop, Read, %extraVPConfigDir%\hdrenderofftables.txt
{
HDRenderOffCount += 1 ; Keep track of how many items are in the array.
HDRenderOffArray%HDRenderOffCount% := A_LoopReadLine ; Store this line in the next array element.
}

; Check if table is in the no hdrender array and write the VP hardwarerender key to off.
Loop %HDRenderOffCount%
{
; The following line uses the := operator to retrieve an array element:
element := HDRenderOffArray%A_Index% ; A_Index is a built-in variable.
if(tableName = element)
{
HDRenderOffChanged = 1
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Visual Pinball\Player, HardwareRender, 0
break
}
}

; Read config for sound volume hard codes
SoundModCount = 0
SoundChangeAmount = 0
Loop, Read, %extraVPConfigDir%\soundmodtables.txt
{
SoundModCount += 1
SoundModCountArray%SoundModCount% := A_LoopReadLine
}

; Check if table is in the vp908tables array.
Loop %SoundModCount%
{
; The following line uses the := operator to retrieve an array element:
TableIndex = %A_Index%
SoundIndex = %TableIndex%
SoundIndex += 1
TheTable := SoundModCountArray%TableIndex%
TheSoundAmount := SoundModCountArray%SoundIndex%

if(tableName = TheTable)
{
; Set the new sound change amount. Should be a + or - number otherwise it needs a , SoundSet, absoluteamt
; SoundSet: http://www.autohotke...ds/SoundSet.htm
; SoundGet: http://www.autohotke...ds/SoundGet.htm
; For XP you could set absolute sound vol with something like: SoundSet, %TheSoundAmount%
Send {Volume_Down %TheSoundAmount%}
break
}
}

Run, "%emuPath%\%executable%" /play -"%tablePath%%tableName%.vpt",,UseErrorLevel
WinWait, ahk_class VPinball
WinHide, ahk_class VPinball
WinWait, ahk_Class VPPlayer
Gui, destroy
if(executable = "VPinball908.exe")
{
Process, WaitClose, VPinball908.exe
}
else
{
Process, WaitClose, VPinball.exe
}

if(%HDRenderOffChanged% != 0)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Visual Pinball\Player, HardwareRender, 1
}

}


; This part was here like before
Run, "%emuPath%\VPinball.exe" /play -"%tablePath%%tableName%.vpt",,UseErrorLevel
WinWait, ahk_class VPinball
WinHide, ahk_class VPinball
WinWait, ahk_Class VPPlayer
Gui, destroy
Process, WaitClose, VPinball.exe

; Add this to the end of the code block to reenable hardware render option for next table load
if(%HDRenderOffChanged% != 0)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Visual Pinball\Player, HardwareRender, 1
}
}

To restore the system volume level to what it was on exit, find the CloseVP: and change it to this:
CloseVP:
Hotkey, %exitScriptKey%, Off

; Restore master volume original value.
if(TheSoundAmount > 0)
{
Send {Volume_Up %TheSoundAmount%}
}


Ok for those of you that want this but really dont want to have to crack open your fplaunch.ahk or that dont understand what I'm doing above, I am attaching my fplaunch.ahk, my text files from my database directory, and my images. The other thing about my fplaunch.ahk is that it shows some images while loading vp or fp rather than a black screen. You can replace these images, change them, or replace them with images of all black if you would rather have the black screen. Sorry, but I have no other way to give you my predone file other than to also include these changes since at least this has been tested.

To use this you will also need to download vp9.08 raw executable and name it VPinball908.exe and put it into the same directory with your existing visual pinball executable. That, or just make sure vp908tables.txt is empty. (My guess is it should exist but be empty. If it doesn't exist you may also get an error in fplaunch).

Now, let's say you wanted to add a section for VP8 tables. You could copy this block of code that runs vp9.08 tables and modify it slightly. Something like this:
; Array examples: http://www.autohotke...misc/Arrays.htm
; Read config file for vp8 tables
vp8count = 0
; This loop retrieves each line from the file, one at a time.
Loop, Read, %extraVPConfigDir%\vp8tables.txt
{
vp8count += 1 ; Keep track of how many items are in the array.
vp8array%vp8count% := A_LoopReadLine ; Store this line in the next array element.
}

; Check if table is in the vp908tables array.
Loop %vp8count%
{
; The following line uses the := operator to retrieve an array element:
element := vp8array%A_Index% ; A_Index is a built-in variable.
if(tableName = element)
{
executable = VPinball8.exe
break
}
}

Then modify the exit section:
if(executable = "VPinball908.exe")
{
Process, WaitClose, VPinball908.exe
}
else if(executable = "VPinball8.exe")
{
Process, WaitClose, VPinball8.exe
}
else
{
Process, WaitClose, VPinball.exe
}

Note: Im sure the exit section could be fixed to use a variable so you dont have a big if-else, but I had some issues doing that and never finished debugging them. It looks a bit sloppy this way but works.

If there are other global settings you need to modify on a table-by-table basis and aren't sure how to do it, let me know by responding to this thread and I may have some suggestions. Also, I don't see why you couldnt run spanned vs rotated tables using this type of method and a command line tool to rotate the monitor.


#2 pinball buzz

pinball buzz

    Pinball Fan

  • VIP
  • 823 posts
  • Location:United Kingdom

  • Flag: United Kingdom

  • Favorite Pinball: TOM



Posted 05 March 2011 - 10:27 PM

Thanks for this Big Boss,

Been having issues with a few tables, which run better under 9.08 - just what i been looking for.

Cheers Buzz biggrin.gif

Just wondering is there a version available of the fplaunch .ahk file which also incorporates this, with Rosve`s FP Launch that is needed to run his backglasses ??


Edited by pinball buzz, 06 March 2011 - 08:06 PM.

Pinball Buzz - Builder of pinball cabs since May 2008.

See my cab pictures here

http://www.flickr.co...s/94649948@N00/
[/size][/size]

#3 danjimaru

danjimaru

    Neophyte

  • Members
  • Pip
  • 1 posts

  • Flag: Yemen

  • Favorite Pinball: Scared Stiff

Posted 07 March 2011 - 08:32 AM

Tried it and it doesn't work with 9.09 just changed all instances of 908.exe to 909.exe and it hangs upon loading a table
could any1 check that pls?

#4 rosve

rosve

    :)

  • VIP
  • 1,179 posts
  • Location:Always travelling around the world

  • Flag: Sweden

  • Favorite Pinball: Funhouse, Faces, Starship Troopers



Posted 07 March 2011 - 09:46 AM

QUOTE (pinball buzz @ Mar 5 2011, 11:27 PM) <{POST_SNAPBACK}>
Thanks for this Big Boss,

Been having issues with a few tables, which run better under 9.08 - just what i been looking for.

Cheers Buzz biggrin.gif

Just wondering is there a version available of the fplaunch .ahk file which also incorporates this, with Rosve`s FP Launch that is needed to run his backglasses ??


Check out the the FPLaunch that blur is working on. I think that it is available on the Hyperpin forum. Or ask blur where to find it.
I am using my own FPLaunch, It is specially adapted to run on my cab. A basic version of it is included with every FS table I upload.

/rosve

#5 pinball buzz

pinball buzz

    Pinball Fan

  • VIP
  • 823 posts
  • Location:United Kingdom

  • Flag: United Kingdom

  • Favorite Pinball: TOM



Posted 07 March 2011 - 07:43 PM

Thanks Rosve biggrin.gif

Posted over on the Hyperpin forum,

Cheers Buzz

Nice work on the tables BTW.
Pinball Buzz - Builder of pinball cabs since May 2008.

See my cab pictures here

http://www.flickr.co...s/94649948@N00/
[/size][/size]

#6 cupid

cupid

    Enthusiast

  • VP Dev Team
  • PipPipPip
  • 496 posts

  • Flag: Germany

  • Favorite Pinball: Dr Who

Posted 08 March 2011 - 09:40 AM

QUOTE (pinball buzz @ Mar 7 2011, 08:43 PM) <{POST_SNAPBACK}>
Thanks Rosve biggrin.gif

Posted over on the Hyperpin forum,

Cheers Buzz

Nice work on the tables BTW.

It would be nice, i you would add a alpha ramps accuracy per table option into the script. I think that a setting 1/4 to 1/2 from left is good for any table, but i heard there is demand for such an per table / per Computer option.

We did not add this to the table options, since it's mainly a graphic option and if it fits at 1/2 on one computer, it may not fit on another computer.

Cupid
The world is devided into people who think they are right.

#7 jdsabin1

jdsabin1

    Enthusiast

  • Silver Supporter
  • 220 posts
  • Location:Central USA

  • Flag: United States of America

  • Favorite Pinball: A sucker for EM tables....

Posted 16 March 2011 - 03:15 PM

QUOTE (pinball buzz @ Mar 5 2011, 05:27 PM) <{POST_SNAPBACK}>
Thanks for this Big Boss,

Been having issues with a few tables, which run better under 9.08 - just what i been looking for.

Cheers Buzz biggrin.gif

Just wondering is there a version available of the fplaunch .ahk file which also incorporates this, with Rosve`s FP Launch that is needed to run his backglasses ??

+1,000,000! I love the em reels and stuff that Rosve has done so cannot lose that functionality. However, Big Boss has got Big Score running on his cab as well which I wanted to do but I am so far out of my league here and I have no idea what I am doing. Is it as easy as taking the code that Rosve includes in his ahk file that he includes and adding that to the ahk file that Big Boss provides?

I like this stuff but it is still so far away from having an average person without a ton of technical skills to be able to figure it all out it's downright scary.

Edited by jdsabin1, 16 March 2011 - 03:16 PM.

'The ball is wild!' - Harry Williams

#8 Wm29671

Wm29671

    Enthusiast

  • Platinum Supporter
  • 98 posts
  • Favorite Pinball: Twilight Zone

Posted 16 March 2011 - 03:50 PM

Yes, could anybody who has Rosve's em tables/backglasses running as well BigBoss's scripting to allow 9.08 tables to run please share their AHK files with those of us who are scripting/compiling challenged? At least until there is another release official AHK release by Blur. Thanks!

#9 pinball buzz

pinball buzz

    Pinball Fan

  • VIP
  • 823 posts
  • Location:United Kingdom

  • Flag: United Kingdom

  • Favorite Pinball: TOM



Posted 17 March 2011 - 07:48 PM

Sounds good - if anyone can put this together, much appreciated.

Cheers Pinball Buzz
Pinball Buzz - Builder of pinball cabs since May 2008.

See my cab pictures here

http://www.flickr.co...s/94649948@N00/
[/size][/size]

#10 blur

blur

    Pinball Fan

  • VIP
  • 1,500 posts

  • Flag: Croatia

  • Favorite Pinball: Amazing Spiderman, Black Hole, Totem



Posted 21 March 2011 - 09:21 AM

there is a new release of fplaunch (1.295 wip2)
it has all these functionalities (several different exe files, hdrender off and sound levels)
and everything else from before (rosve backglass, loading screens, fp positioning, no nag screens, ...)

check it out at: http://www.hyperspin...ead.php?t=10935

Edited by blur, 21 March 2011 - 09:22 AM.


#11 pinball buzz

pinball buzz

    Pinball Fan

  • VIP
  • 823 posts
  • Location:United Kingdom

  • Flag: United Kingdom

  • Favorite Pinball: TOM



Posted 22 March 2011 - 06:42 AM

QUOTE (blur @ Mar 21 2011, 09:21 AM) <{POST_SNAPBACK}>
there is a new release of fplaunch (1.295 wip2)
it has all these functionalities (several different exe files, hdrender off and sound levels)
and everything else from before (rosve backglass, loading screens, fp positioning, no nag screens, ...)

check it out at: http://www.hyperspin...ead.php?t=10935



Thanks Blur,
Gonna be checking this out on the cab soon.

Your hard work is appreciated.

Pinball Buzz
Pinball Buzz - Builder of pinball cabs since May 2008.

See my cab pictures here

http://www.flickr.co...s/94649948@N00/
[/size][/size]