Advertisement
djvj

Old Pinball FX2 module

Oct 14th, 2016
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.60 KB | None | 0 0
  1. MEmu = Pinball FX2
  2. MEmuV = N/A
  3. MURL = http://www.pinballfx.com/
  4. MAuthor = djvj,bleasby
  5. MVersion = 2.0.8
  6. MCRC = 5B89702C
  7. iCRC = 28ABC285
  8. mId = 635244873683327779
  9. MSystem = "Pinball FX2","Pinball"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; If launching as a Steam game:
  13. ; When setting this up in RocketLauncherUI under the global emulators tab, make sure to select it as a Virtual Emulator. Also no rom extensions, executable, or rom paths need to be defined.
  14. ; Set Skip Checks to "Rom and Emu" when using this module as roms do not exist.
  15. ;
  16. ; If not launching through Steam:
  17. ; Add this as any other standard emulator and define the PInball FX2.exe as your executable, but still select Virtual Emulator as you do not need rom extensions or rom paths
  18. ; Set Skip Checks to "Rom and Emu" when using this module as roms do not exist.
  19. ;
  20. ;This module requires BlockInput.exe to exist in your Module Extensions folder. It is used to prevent users from messing up the table selection routine.
  21. ;
  22. ;Windowed mode:
  23. ; - To hide the game selection behind fade the game needs to be run in Windowed mode. The original game does not support windowed mode, therefore it is necessary to use the dxwnd for forcing this mode. Use this option at your own risk, as this could be eventually considered as an injected code and may end up in a banned licence (I did not had any problem in this subject until now).
  24. ; - Windowed mode requires to set the dxwnd to run as admin. Go to the folder RocketLauncher\Module Extensions\dxwnd\dxwnd.exe and righht click the executable to set it to run as admin.
  25. ; - If dxwnd is not closing, that is because dxwnd cannot be closed by a script not also running as admin. So make sure RocketLauncher.exe is set to run as admin also by right clicking it and going to Properties -> Compatibility -> Run as Administrator should be checked.
  26. ; - It is also required to set on the modules options the WindowedResolution to match your Pinball FX2 game resolution. If you don't do it, the game will crash as dxwnd will not be able to set the windowed mode.
  27. ;
  28. ; Optional Fade recomended settings:
  29. ; - On Windowed mode you can use these settings: Progress Bar - Enable = true, Progress Bar - Non 7z Progress Bar Time = 21500 (adjust this to the average time that it takes for getting to the table on your computer, mine was 21,5 secds), Fade In - Exit Delay = 3500 (time that the Pinball FX2 takes for loading the selected table. RocketLauncher will know when Pinball FX2 reaches this screen but if you want to hide it also, you will need to set this option). This will give the user a approximate measure of how much time it takes for the table be ready to be played and the fade screen will only disapears after the Pinball FX2 table is ready to be played.
  30. ;
  31. ; Bezel:
  32. ; Bezel uses the fixResMode and requires the use of windowed mode, therefore you need to set the resolution on the module options to the same resolution that you set in Pinball FX2.
  33. ; By default, the module will use the resolution of your desktop. Your bezel is most likely smaller, so make sure to set the correct windowed resolution in RocketLauncherUI for this module.
  34. ;
  35. ; DMD (Dot Matrix Display)
  36. ; The module will support and hide the window components of detached DMD
  37. ; To see it, you must have a 2nd monitor connected as an extension of your desktop, and placement will be on that monitor
  38. ; To Detach:
  39. ; Run Pinball FX2 manually, and goto Help & Options -> Settings -> Video
  40. ; Set Dot Matrix Size to Off, and close Pinball FX2
  41. ; The module will automatically create the dotmatrix.cfg file in the same folder of the "Pinball FX2.exe" (your installation folder) for you
  42. ; Edit the module's settings in RLUI to customize the DMD size and placement of this window
  43. ;----------------------------------------------------------------------------
  44. StartModule()
  45. BezelGUI()
  46.  
  47. settingsFile := modulePath . "\" . moduleName . ".ini"
  48. multiplayerMenu := IniReadCheck(settingsFile, "Settings|" . romName, "Multiplayer_Menu","false",,1)
  49. If (multiplayerMenu = "true")
  50. SelectedNumberofPlayers := NumberOfPlayersSelectionMenu(4)
  51.  
  52. FadeInStart()
  53.  
  54. pinballTitleClass := "Pinball FX2 ahk_class PxWindowClass"
  55. Fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1)
  56. nagScreen := IniReadCheck(settingsFile, "Settings", "Nag_Screen","false")
  57. WindowedResolution := IniReadCheck(settingsFile, "Settings", "Windowed_Resolution",A_ScreenWidth . "x" . A_ScreenHeight,,1)
  58. initialTableX := IniReadCheck(settingsFile, "Settings", "Initial_Table_X",1,,1)
  59. initialTableY := IniReadCheck(settingsFile, "Settings", "Initial_Table_Y",1,,1)
  60. sleepLogo := IniReadCheck(settingsFile, "Settings", "Sleep_Until_Logo",12000,,1)
  61. sleepMenu := IniReadCheck(settingsFile, "Settings", "Sleep_Until_Main_Menu",1500,,1)
  62. sleepBaseTime := IniReadCheck(settingsFile, "Settings", "Sleep_Base_Time",1,,1)
  63. externalDMD := IniReadCheck(settingsFile, "Settings", "External_DMD","false",,1)
  64. dmdX := IniReadCheck(settingsFile, "Settings", "DMD_X",A_ScreenWidth,,1)
  65. dmdY := IniReadCheck(settingsFile, "Settings", "DMD_Y",0,,1)
  66. dmdW := IniReadCheck(settingsFile, "Settings", "DMD_Width",0,,1)
  67. dmdH := IniReadCheck(settingsFile, "Settings", "DMD_Height",0,,1)
  68. tableNavX := IniReadCheck(settingsFile, romName, "x",,,1)
  69. tableNavY := IniReadCheck(settingsFile, romName, "y",,,1)
  70. tableNavX2 := IniReadCheck(settingsFile, romName, "x2",,,1)
  71. tableNavY2 := IniReadCheck(settingsFile, romName, "y2",,,1)
  72.  
  73. BezelStart("fixResMode")
  74.  
  75. CheckFile(moduleExtensionsPath . "\BlockInput.exe")
  76.  
  77. If (tableNavX = "" || tableNavY = "")
  78. ScriptError("This game is not configured in the module ini. Please set the grid coordinates in RocketLauncherUI so RocketLauncher can launch the game for you")
  79.  
  80. DXWndGame :=
  81. If (!Fullscreen || Fullscreen = "false"){
  82. StringSplit, WindowedResolution, WindowedResolution, x
  83. DxwndIniRW("target", "sizx", WindowedResolution1,, "Pinball FX2")
  84. DxwndIniRW("target", "sizy", WindowedResolution2,, "Pinball FX2")
  85. If executable
  86. DxwndIniRW("target", "path", emuPath . "\" . executable,, "Pinball FX2")
  87. If !executable {
  88. If !steamPath
  89. GetSteamPath()
  90. DxwndIniRW("target", "path", steamPath . "\SteamApps\common\Pinball FX2\Pinball FX2.exe",, "Pinball FX2")
  91. }
  92. DxwndRun()
  93. DXWndGame := 1
  94. }
  95.  
  96. If (externalDMD = "true") {
  97. Log("Module - Updating external DMD window placement values",4)
  98. If !executable
  99. If !steamPath
  100. GetSteamPath()
  101. dotmatrixCFGFile := If executable ? emuPath . "\dotmatrix.cfg" : steamPath . "\SteamApps\common\Pinball FX2\dotmatrix.cfg"
  102. IfNotExist, %dotmatrixCFGFile%
  103. FileAppend, %dotmatrixCFGFile% ; create a new blank file if one does not exist
  104. Log("Module - Using this dotmatrix.cfg: " . dotmatrixCFGFile,4)
  105. dotmatrixCFG := LoadProperties(dotmatrixCFGFile)
  106. WriteProperty(dotmatrixCFG, "x", dmdX, 1)
  107. WriteProperty(dotmatrixCFG, "y", dmdY, 1)
  108. WriteProperty(dotmatrixCFG, "width", dmdW, 1)
  109. WriteProperty(dotmatrixCFG, "height", dmdH, 1)
  110. SaveProperties(dotmatrixCFGFile, dotmatrixCFG)
  111. }
  112.  
  113. hideEmuObj := Object(pinballTitleClass,1) ; Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
  114. HideEmuStart()
  115.  
  116. If executable {
  117. Log("Module - Running Pinball FX2 as a stand alone game and not through Steam as an executable was defined.")
  118. Run(executable, emuPath)
  119. } Else {
  120. Log("Module - Running Pinball FX2 through Steam.")
  121. Steam(226980)
  122. }
  123.  
  124. WinWait(pinballTitleClass)
  125. WinWaitActive(pinballTitleClass)
  126.  
  127. ; Attempt to hide window components of the detached DMD
  128. If (externalDMD = "true") {
  129. Gui +LastFound
  130. hWnd := WinExist()
  131. DllCall("RegisterShellHookWindow", UInt,hWnd)
  132. MsgNum := DllCall("RegisterWindowMessage", Str,"SHELLHOOK")
  133. OnMessage(MsgNum, "ShellMessage")
  134. }
  135.  
  136. Run("BlockInput.exe 30", moduleExtensionsPath) ; start the tool that blocks all input so user cannot interrupt the launch process for 30 seconds
  137. SetKeyDelay(50*sleepBaseTime) ; required otherwise pinball fx2 does not respond to the keys
  138. Sleep, %sleepLogo% ; sleep till Pinball FX2 logo appears
  139. ControlSend,, {Esc Down}{Esc Up}, %pinballTitleClass%
  140. Sleep, % 200*sleepBaseTime
  141. ControlSend,, {Enter Down}{Enter Up}, %pinballTitleClass% ; cancel pinball fx2 logo
  142. If nagScreen = true
  143. { Sleep, % 300*sleepBaseTime
  144. ControlSend,, {Enter Down}{Enter Up}, %pinballTitleClass% ; clear away the nag screen
  145. }
  146. Sleep, %sleepMenu% ; sleep till table select window appears
  147.  
  148. tableNavX := tableNavX - initialTableX
  149. tableNavY := tableNavY - initialTableY
  150. If (tableNavX<0){
  151. Loop % -tableNavX
  152. { ControlSend,, {Left Down}{Left Up}, %pinballTitleClass%
  153. Sleep, % 50*sleepBaseTime
  154. }
  155. } Else {
  156. Loop % tableNavX
  157. { ControlSend,, {Right Down}{Right Up}, %pinballTitleClass%
  158. Sleep, % 50*sleepBaseTime
  159. }
  160. }
  161. If (tableNavY<0){
  162. Loop % -tableNavY
  163. { ControlSend,, {Up Down}{Up Up}, %pinballTitleClass%
  164. Sleep, % 50*sleepBaseTime
  165. }
  166. } Else {
  167. Loop % tableNavY
  168. { ControlSend,, {Down Down}{Down Up}, %pinballTitleClass%
  169. Sleep, % 50*sleepBaseTime
  170. }
  171. }
  172.  
  173. If (tableNavX2) and (tableNavY2)
  174. { IniRead,currentFootballTable, %settingsFile%, Settings, Current_Football_Table
  175. If !(currentFootballTable=romName){
  176. ControlSend,, {Enter Down}{Enter Up}, %pinballTitleClass% ; select game
  177. Sleep, % 500*sleepBaseTime
  178. ControlSend,, {Up Down}{Up Up}, %pinballTitleClass% ; Move up
  179. Sleep, % 50*sleepBaseTime
  180. ControlSend,, {Enter Down}{Enter Up}, %pinballTitleClass% ; select team
  181. iniRead,initialX,%settingsFile%,%currentFootballTable%,X2, 1
  182. iniRead,initialY,%settingsFile%,%currentFootballTable%,Y2, 1
  183. NavX2 := tableNavX2 - initialX
  184. NavY2 := tableNavY2 - initialY
  185. Sleep, % 500*sleepBaseTime
  186. If (NavX2<0){
  187. Loop % -NavX2
  188. { ControlSend,, {Left Down}{Left Up}, %pinballTitleClass%
  189. Sleep, % 50*sleepBaseTime
  190. }
  191. } Else {
  192. Loop % NavX2
  193. { ControlSend,, {Right Down}{Right Up}, %pinballTitleClass%
  194. Sleep, % 50*sleepBaseTime
  195. }
  196. }
  197. If (NavY2<0){
  198. Loop % -NavY2
  199. { ControlSend,, {Up Down}{Up Up}, %pinballTitleClass%
  200. Sleep, % 50*sleepBaseTime
  201. }
  202. } Else {
  203. Loop % NavY2
  204. { ControlSend,, {Down Down}{Down Up}, %pinballTitleClass%
  205. Sleep, % 50*sleepBaseTime
  206. }
  207. }
  208. IniWrite, %romName%, %settingsFile%, Settings, Current_Football_Table
  209. }
  210. }
  211.  
  212. ControlSend,, {Enter Down}{Enter Up}, %pinballTitleClass% ; select team or game
  213. Sleep, % 750*sleepBaseTime
  214.  
  215. If (tableNavX2 && tableNavY2)
  216. If !(currentFootballTable = romName)
  217. ControlSend,, {Down Down}{Down Up}, %pinballTitleClass% ; down to play single game
  218.  
  219. If (SelectedNumberofPlayers > 1) ; select number of players
  220. { Sleep, % 50*sleepBaseTime
  221. ControlSend,, {Down Down}{Down Up}, %pinballTitleClass% ; down to hot seat
  222. ControlSend,, {Enter Down}{Enter Up}, %pinballTitleClass% ; select hot seat
  223. Sleep, % 500*sleepBaseTime
  224. Loop % SelectedNumberofPlayers-2
  225. { ControlSend,, {Down Down}{Down Up}, %pinballTitleClass% ;select number of players
  226. Sleep, % 50*sleepBaseTime
  227. }
  228. }
  229.  
  230. ControlSend,, {Enter Down}{Enter Up}, %pinballTitleClass% ; start game
  231.  
  232. Process("Close", "BlockInput.exe") ; end script that blocks all input
  233.  
  234. BezelDraw()
  235. HideEmuEnd()
  236. FadeInExit()
  237. Process("WaitClose", "Pinball FX2.exe")
  238. BezelExit()
  239. FadeOutExit()
  240. ExitModule()
  241.  
  242.  
  243. ShellMessage(wParam, lParam) {
  244. Log("Module - DMD external window - " . wParam,4)
  245. If (wParam = 1)
  246. IfWinExist Pinball FX2 DotMatrix ahk_class PxWindowClass
  247. {
  248. WinSet, Style, -0xC00000 ; hide title bar
  249. WinSet, Style, -0x800000 ; hide thin-line border
  250. WinSet, Style, -0x400000 ; hide dialog frame
  251. WinSet, Style, -0x40000 ; hide thickframe/sizebox
  252. ;WinMove, , , 0, 0, 1920, 1080
  253. }
  254. }
  255.  
  256. CloseProcess:
  257. FadeOutStart()
  258. WinClose(pinballTitleClass)
  259. If DXWndGame
  260. DxwndClose()
  261. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement