Advertisement
djvj

Untitled

Feb 1st, 2015
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.18 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.2
  6. MCRC = DF1AB8F1
  7. iCRC = E55FC3CA
  8. mId = 635244873683327779
  9. MSystem = "Pinball FX2","Pinball"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; If launching as a Steam game:
  13. ; When setting this up in HLHQ 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 HyperLaunch\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 HyperLaunch.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. HL 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 HLHQ 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", "Multiplayer_Menu","true",,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. WindowedResolution := IniReadCheck(settingsFile, "Settings", "Windowed_Resolution",A_ScreenWidth . "x" . A_ScreenHeight,,1)
  57. initialTableX := IniReadCheck(settingsFile, "Settings", "Initial_Table_X",1,,1)
  58. initialTableY := IniReadCheck(settingsFile, "Settings", "Initial_Table_Y",1,,1)
  59. sleepLogo := IniReadCheck(settingsFile, "Settings", "Sleep_Until_Logo",12000,,1)
  60. sleepMenu := IniReadCheck(settingsFile, "Settings", "Sleep_Until_Main_Menu",1500,,1)
  61. sleepBaseTime := IniReadCheck(settingsFile, "Settings", "Sleep_Base_Time",1,,1)
  62. externalDMD := IniReadCheck(settingsFile, "Settings", "External_DMD","false",,1)
  63. dmdX := IniReadCheck(settingsFile, "Settings", "DMD_X",A_ScreenWidth,,1)
  64. dmdY := IniReadCheck(settingsFile, "Settings", "DMD_Y",0,,1)
  65. dmdW := IniReadCheck(settingsFile, "Settings", "DMD_Width",0,,1)
  66. dmdH := IniReadCheck(settingsFile, "Settings", "DMD_Height",0,,1)
  67. tableNavX := IniReadCheck(settingsFile, romName, "x",,,1)
  68. tableNavY := IniReadCheck(settingsFile, romName, "y",,,1)
  69. tableNavX2 := IniReadCheck(settingsFile, romName, "x2",,,1)
  70. tableNavY2 := IniReadCheck(settingsFile, romName, "y2",,,1)
  71.  
  72. BezelStart("fixResMode")
  73.  
  74. CheckFile(moduleExtensionsPath . "\BlockInput.exe")
  75.  
  76. If (tableNavX = "" || tableNavY = "")
  77. ScriptError("This game is not configured in the module ini. Please set the grid coordinates in HyperLaunchHQ so HyperLaunch can launch the game for you")
  78.  
  79. DXWndGame :=
  80. If (!Fullscreen || Fullscreen = "false"){
  81. StringSplit, WindowedResolution, WindowedResolution, x
  82. DxwndIniRW("target", "sizx", WindowedResolution1,, "Pinball FX2")
  83. DxwndIniRW("target", "sizy", WindowedResolution2,, "Pinball FX2")
  84. If executable
  85. DxwndIniRW("target", "path", emuPath . "\" . executable,, "Pinball FX2")
  86. If !executable {
  87. If !steamPath
  88. GetSteamPath()
  89. DxwndIniRW("target", "path", steamPath . "\SteamApps\common\Pinball FX2\Pinball FX2.exe",, "Pinball FX2")
  90. }
  91. DxwndRun()
  92. DXWndGame := 1
  93. }
  94.  
  95. If (externalDMD = "true") {
  96. Log("Module - Updating external DMD window placement values",4)
  97. If !executable
  98. If !steamPath
  99. GetSteamPath()
  100. dotmatrixCFGFile := If executable ? emuPath . "\dotmatrix.cfg" : steamPath . "\SteamApps\common\Pinball FX2\dotmatrix.cfg"
  101. IfNotExist, %dotmatrixCFGFile%
  102. FileAppend, %dotmatrixCFGFile% ; create a new blank file if one does not exist
  103. Log("Module - Using this dotmatrix.cfg: " . dotmatrixCFGFile,4)
  104. dotmatrixCFG := LoadProperties(dotmatrixCFGFile)
  105. WriteProperty(dotmatrixCFG, "x", dmdX, 1)
  106. WriteProperty(dotmatrixCFG, "y", dmdY, 1)
  107. WriteProperty(dotmatrixCFG, "width", dmdW, 1)
  108. WriteProperty(dotmatrixCFG, "height", dmdH, 1)
  109. SaveProperties(dotmatrixCFGFile, dotmatrixCFG)
  110. }
  111.  
  112. If executable {
  113. Log("Module - Running Pinball FX2 as a stand alone game and not through Steam as an executable was defined.")
  114. Run(executable, emuPath)
  115. } Else {
  116. Log("Module - Running Pinball FX2 through Steam.")
  117. Steam(226980)
  118. }
  119.  
  120. WinWait(pinballTitleClass)
  121. WinWaitActive(pinballTitleClass)
  122.  
  123. ; Attempt to hide window components of the detached DMD
  124. If (externalDMD = "true") {
  125. Gui +LastFound
  126. hWnd := WinExist()
  127. DllCall("RegisterShellHookWindow", UInt,hWnd)
  128. MsgNum := DllCall("RegisterWindowMessage", Str,"SHELLHOOK")
  129. OnMessage(MsgNum, "ShellMessage")
  130. }
  131.  
  132. Run("BlockInput.exe 30", moduleExtensionsPath) ; start the tool that blocks all input so user cannot interrupt the launch process for 30 seconds
  133. SetKeyDelay(50*sleepBaseTime) ; required otherwise pinball fx2 does not respond to the keys
  134. Sleep, %sleepLogo% ; sleep till Pinball FX2 logo appears
  135. ControlSend,, {Esc Down}{Esc Up}, %pinballTitleClass%
  136. Sleep, % 200*sleepBaseTime
  137. ControlSend,, {Enter Down}{Enter Up}, %pinballTitleClass% ; cancel pinball fx2 logo
  138. Sleep, %sleepMenu% ; sleep till table select window appears
  139.  
  140. tableNavX := tableNavX - initialTableX
  141. tableNavY := tableNavY - initialTableY
  142. If (tableNavX<0){
  143. Loop % -tableNavX
  144. { ControlSend,, {Left Down}{Left Up}, %pinballTitleClass%
  145. Sleep, % 50*sleepBaseTime
  146. }
  147. } Else {
  148. Loop % tableNavX
  149. { ControlSend,, {Right Down}{Right Up}, %pinballTitleClass%
  150. Sleep, % 50*sleepBaseTime
  151. }
  152. }
  153. If (tableNavY<0){
  154. Loop % -tableNavY
  155. { ControlSend,, {Up Down}{Up Up}, %pinballTitleClass%
  156. Sleep, % 50*sleepBaseTime
  157. }
  158. } Else {
  159. Loop % tableNavY
  160. { ControlSend,, {Down Down}{Down Up}, %pinballTitleClass%
  161. Sleep, % 50*sleepBaseTime
  162. }
  163. }
  164.  
  165. If (tableNavX2) and (tableNavY2)
  166. { IniRead,currentFootballTable, %settingsFile%, Settings, Current_Football_Table
  167. If !(currentFootballTable=romName){
  168. ControlSend,, {Enter Down}{Enter Up}, %pinballTitleClass% ; select game
  169. Sleep, % 500*sleepBaseTime
  170. ControlSend,, {Up Down}{Up Up}, %pinballTitleClass% ; Move up
  171. Sleep, % 50*sleepBaseTime
  172. ControlSend,, {Enter Down}{Enter Up}, %pinballTitleClass% ; select team
  173. iniRead,initialX,%settingsFile%,%currentFootballTable%,X2, 1
  174. iniRead,initialY,%settingsFile%,%currentFootballTable%,Y2, 1
  175. NavX2 := tableNavX2 - initialX
  176. NavY2 := tableNavY2 - initialY
  177. Sleep, % 500*sleepBaseTime
  178. If (NavX2<0){
  179. Loop % -NavX2
  180. { ControlSend,, {Left Down}{Left Up}, %pinballTitleClass%
  181. Sleep, % 50*sleepBaseTime
  182. }
  183. } Else {
  184. Loop % NavX2
  185. { ControlSend,, {Right Down}{Right Up}, %pinballTitleClass%
  186. Sleep, % 50*sleepBaseTime
  187. }
  188. }
  189. If (NavY2<0){
  190. Loop % -NavY2
  191. { ControlSend,, {Up Down}{Up Up}, %pinballTitleClass%
  192. Sleep, % 50*sleepBaseTime
  193. }
  194. } Else {
  195. Loop % NavY2
  196. { ControlSend,, {Down Down}{Down Up}, %pinballTitleClass%
  197. Sleep, % 50*sleepBaseTime
  198. }
  199. }
  200. IniWrite, %romName%, %settingsFile%, Settings, Current_Football_Table
  201. }
  202. }
  203.  
  204. ControlSend,, {Enter Down}{Enter Up}, %pinballTitleClass% ; select team or game
  205. Sleep, % 750*sleepBaseTime
  206.  
  207. If (tableNavX2 && tableNavY2)
  208. If !(currentFootballTable = romName)
  209. ControlSend,, {Down Down}{Down Up}, %pinballTitleClass% ; down to play single game
  210.  
  211. If (SelectedNumberofPlayers > 1) ; select number of players
  212. { Sleep, % 50*sleepBaseTime
  213. ControlSend,, {Down Down}{Down Up}, %pinballTitleClass% ; down to hot seat
  214. ControlSend,, {Enter Down}{Enter Up}, %pinballTitleClass% ; select hot seat
  215. Sleep, % 500*sleepBaseTime
  216. Loop % SelectedNumberofPlayers-2
  217. { ControlSend,, {Down Down}{Down Up}, %pinballTitleClass% ;select number of players
  218. Sleep, % 50*sleepBaseTime
  219. }
  220. }
  221.  
  222. ControlSend,, {Enter Down}{Enter Up}, %pinballTitleClass% ; start game
  223.  
  224. Process("Close", "BlockInput.exe") ; end script that blocks all input
  225.  
  226. BezelDraw()
  227. FadeInExit()
  228.  
  229. Process("WaitClose", "Pinball FX2.exe")
  230. BezelExit()
  231. FadeOutExit()
  232. ExitModule()
  233.  
  234.  
  235. ShellMessage(wParam, lParam) {
  236. Log("Module - DMD external window - " . wParam,4)
  237. If (wParam = 1)
  238. IfWinExist Pinball FX2 DotMatrix ahk_class PxWindowClass
  239. {
  240. WinSet, Style, -0xC00000 ; hide title bar
  241. WinSet, Style, -0x800000 ; hide thin-line border
  242. WinSet, Style, -0x400000 ; hide dialog frame
  243. WinSet, Style, -0x40000 ; hide thickframe/sizebox
  244. ;WinMove, , , 0, 0, 1920, 1080
  245. }
  246. }
  247.  
  248. CloseProcess:
  249. FadeOutStart()
  250. WinClose(pinballTitleClass)
  251. If DXWndGame
  252. DxwndClose()
  253. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement