Advertisement
djvj

Untitled

Jul 17th, 2015
807
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.61 KB | None | 0 0
  1. MEmu = Pinball Arcade
  2. MEmuV = v1.37.8
  3. MURL = http://www.pinballarcade.com/
  4. MAuthor = djvj
  5. MVersion = 2.0.3
  6. MCRC = 9CC7A29
  7. iCRC = E71D284
  8. mId = 635589857631115764
  9. MSystem = "Pinball Arcade","Pinball"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; Initial setup:
  13. ; Manually run Pinball Arcade. If you own all the games and they can all be found in the My Tables folder, Simply Enter the My Tables folder and browse to the first table (alphabetically) and exit Pinball Arcade.
  14. ; The module comes default with all the available tables (as of 1/14/2014) alphabetically sorted in the module setting My_Tables.
  15. ; It will parse this setting and assume you own all the games. If you do not own all the games, recreate this setting in RocketLauncherUI with all the games you own, and separate each one with a |
  16. ; The My_Tables names match the names from your FE's database.
  17. ;
  18. ; If launching as a Steam game:
  19. ; 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.
  20. ; Set Skip Checks to "Rom and Emu" when using this module as roms do not exist.
  21. ;
  22. ; If not launching through Steam:
  23. ; Add this as any other standard emulator and define the PinballArcade.exe as your executable, but still select Virtual Emulator as you do not need rom extensions or rom paths
  24. ; Set Skip Checks to "Rom and Emu" when using this module as roms do not exist.
  25. ;
  26. ; 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.
  27. ; If BlockInput is not actually blocking input, it's due to not having admin credentials, which you will need to set this exe to run as admin.
  28. ; However, this also means RocketLauncher needs to be set to run as admin as well, keep this in mind.
  29. ;
  30. ; If you want bezel support set to the game be played in windowed mode
  31. ;
  32. ; How to run vertical games on a standard monitor:
  33. ; There are 3 methods supported by this module to rotate your desktop. Windows shortcuts, display.exe and irotate.exe. If one method does not work on your computer, try another.
  34. ;
  35. ; If the key sends are not working, make sure your RocketLauncher is set to run as administrator.
  36. ;
  37. ; Pinball Arcade stores some settings in your registry @ HKEY_CURRENT_USER\Software\PinballArcade\PinballArcade
  38. ;----------------------------------------------------------------------------
  39. StartModule()
  40.  
  41. settingsFile := modulePath . "\" . moduleName . ".ini"
  42. rotateMethod := IniReadCheck(settingsFile, "settings", "Rotate_Method", rotateMethod,,1) ; Shortcut, Display, iRotate
  43. rotateDisplay := IniReadCheck(settingsFile, "settings", "Rotate_Display", 0,,1) ; 0, 90, 180, 270
  44. moduleDebugging := IniReadCheck(settingsFile, "settings", "Module_Debugging", "false",,1)
  45. selectKey := IniReadCheck(settingsFile, "settings", "Select_Key", navSelectKey,,1)
  46.  
  47. If (RotateDisplay > 0) {
  48. Res := (A_ScreenWidth>A_ScreenWidth) ? A_ScreenWidth : A_ScreenWidth
  49. Gui 1: Color, 000000
  50. Gui 1: -Caption +ToolWindow
  51. Gui 1: Show, x0 y0 W%Res% H%Res%, BlackScreen ; experimental to hide entire desktop and windows
  52. Rotate(rotateMethod, rotateDisplay)
  53. }
  54.  
  55. BezelGUI()
  56. FadeInStart()
  57.  
  58. fullscreen := IniReadCheck(settingsFile, "settings", "Fullscreen", "true",,1) ; 0, Shortcut, Display, iRotate
  59. startGame := IniReadCheck(settingsFile, "settings", "Start_Game","true",,1)
  60. pinballVersion := IniReadCheck(settingsFile, "settings", "Pinball_Version", "DX11",,1)
  61. sleepLogo := IniReadCheck(settingsFile, "Settings", "Sleep_Until_Logo",7000,,1)
  62. sleepBaseTime := IniReadCheck(settingsFile, "Settings", "Sleep_Base_Time",1,,1)
  63. lastMyTable := "Addams Family, The (Bally)" ; Mytables always starts on The Addams Family
  64. ; myTables := IniReadCheck(settingsFile, "Settings", "My_Tables","Attack From Mars|Big Shot|Black Hole|Black Knight|Bride of Pin-Bot|Cactus Canyon|Centaur|Central Park|Champion Pub|Cirqus Voltaire|Class of 1812|Creature from the Black Lagoon|Cue Ball Wizard|Dr. Dude|El Dorado - City of Gold|Elvira|Firepower|Fish Tales|Flight 2000|Funhouse|Genie|Goin' Nuts|Gorgar|Harley-Davidson|Haunted House|Medieval Madness|Monster Bash|No Good Gofers|Pin-Bot|Ripley's Believe It or Not|Scared Stiff|Space Shuttle|Star Trek|Tales of the Arabian Nights|Taxi|Tee'd Off|Terminator 2|Theatre of Magic|Twilight Zone|Victory|Whirlwind|White Water",,1) ; | separated list of the tables I own
  65. ; myTables := IniReadCheck(settingsFile, "Settings", "My_Tables","Attack from Mars (Bally)|Big Shot (Gottlieb)|Black Hole (Gottlieb)|Black Knight 2000 (Williams)|Black Knight (Williams)|Black Rose (Bally)|Bram Stoker's Dracula (Williams)|Machine - Bride of Pin Bot, The (Williams)|Cactus Canyon (Bally)|Centaur (Bally)|Central Park (Gottlieb)|Champion Pub, The (Bally)|Cirqus Voltaire (Bally)|Class of 1812 (Gottlieb)|Creature from the Black Lagoon (Bally)|Cue Ball Wizard (Gottlieb)|Diner (Williams)|Dr. Dude & His Excellent Ray (Bally)|El Dorado - City Of Gold (Gottlieb)|Elvira and the Party Monsters (Bally)|Firepower (Williams)|Fish Tales (Williams)|Flight 2000 (Stern)|FunHouse (Williams)|Genie (Gottlieb)|Goin' Nuts (Gottlieb)|Gorgar (Williams)|Harley-Davidson, 3rd Edition (Stern)|Haunted House (Gottlieb)|High Roller Casino (Stern)|High Speed (Williams)|Junk Yard (Williams)|Lights... Camera... Action! (Gottlieb)|Medieval Madness (Williams)|Monster Bash (Williams)|No Good Gofers (Williams)|Phantom of the Opera, The (Stern)|Pin Bot (Williams)|Ripley's Believe It or Not! (Stern)|Scared Stiff (Bally)|Space Shuttle (Williams)|Star Trek - The Next Generation (Williams)|Tales of the Arabian Nights (Williams)|Taxi (Williams)|Tee'd Off (Gottlieb)|Terminator 2 - Judgment Day (Williams)|Theatre of Magic (Bally)|Twilight Zone (Bally)|Victory (Gottlieb)|Whirlwind (Williams)|White Water (Williams)|WHO Dunnit (Bally)",,1) ; | v1.31.8 separated list of the tables user owns
  66. myTables := IniReadCheck(settingsFile, "Settings", "My_Tables","Addams Family, The (Bally)|Attack from Mars (Bally)|Big Shot (Gottlieb)|Black Hole (Gottlieb)|Black Knight (Williams)|Black Knight 2000 (Williams)|Black Rose (Bally)|Bram Stoker's Dracula (Williams)|Bride of Pin-Bot (Williams)|Cactus Canyon (Bally)|Centaur (Bally)|Central Park (Gottlieb)|Champion Pub, The (Bally)|Cirqus Voltaire (Bally)|Class of 1812 (Gottlieb)|Creature from the Black Lagoon (Bally)|Cue Ball Wizard (Gottlieb)|Cyclone (Williams)|Diner (Williams)|Dr. Dude & His Excellent Ray (Bally)|Earthshaker (Williams)|El Dorado - City Of Gold (Gottlieb)|Elvira and the Party Monsters (Bally)|Firepower (Williams)|Fish Tales (Williams)|Flight 2000 (Stern)|FunHouse (Williams)|Genie (Gottlieb)|Goin' Nuts (Gottlieb)|Gorgar (Williams)|Harley-Davidson, 3rd Edition (Stern)|Haunted House (Gottlieb)|High Roller Casino (Stern)|High Speed (Williams)|Jack-Bot (Williams)|Junk Yard (Williams)|Lights... Camera... Action! (Gottlieb)|Medieval Madness (Williams)|Monster Bash (Williams)|No Good Gofers (Williams)|Party Zone (Bally)|Phantom of the Opera, The (Data East)|Pin-Bot (Williams)|Ripley's Believe It or Not! (Stern)|Scared Stiff (Bally)|Space Shuttle (Williams)|Star Trek - The Next Generation (Williams)|Starship Troopers (Stern)|Tales of the Arabian Nights (Williams)|Taxi (Williams)|Tee'd Off (Gottlieb)|Terminator 2 - Judgment Day (Williams)|Theatre of Magic (Bally)|Twilight Zone (Bally)|Victory (Gottlieb)|Whirlwind (Williams)|White Water (Williams)|WHO Dunnit (Bally)",,1) ; | v1.37.8 separated list of the tables user owns
  67.  
  68. pinballTitleClass := "Pinball Arcade ahk_class " . (If pinballVersion = "DX11" ? "GameWindowClass" : "Pinball Arcade")
  69.  
  70. BezelStart()
  71.  
  72. ; get user's save path
  73. paUserPath := RegRead("HKCU", "Software\PinballArcade\PinballArcade", "SavePath", "Auto")
  74. pinballArcadeDat := CheckFile(paUserPath . "settings.dat")
  75.  
  76. ; Update fullscreen setting
  77. res := BinRead(pinballArcadeDat,pinballArcadeDatData,1,8) ; read current fullscreen setting
  78. Bin2Hex(hexData,pinballArcadeDatData,res)
  79. If (fullscreen = "true" && hexData != "02") {
  80. Hex2Bin(binData,"02")
  81. res := BinWrite(pinballArcadeDat,binData,1,8)
  82. } Else If (fullscreen != "true" && hexData != "00") {
  83. Hex2Bin(binData,"00")
  84. res := BinWrite(pinballArcadeDat,binData,1,8)
  85. }
  86.  
  87. ; Convert myTables into a real array
  88. myTablesArray := []
  89. Loop, Parse, myTables, |
  90. {
  91. myTablesArray[A_Index] := A_Loopfield
  92. If (romName = A_Loopfield) {
  93. thisTablePos := A_Index ; store the position (in the array) this table was found
  94. thisTableArray := "myTablesArray" ; save the array this table was found in
  95. lastTable := lastMyTable ; store the last table loaded for the same array as this table
  96. Log("Module - Found """ . romName . """ at position " . thisTablePos . " in MyTables")
  97. }
  98. }
  99.  
  100. CheckFile(moduleExtensionsPath . "\BlockInput.exe")
  101.  
  102. If !thisTableArray
  103. ScriptError("This table """ . romName . """ was not found in My Tables folder. Please check its name that it matches what the module recognizes.")
  104. Log("Module - Table """ . romName . """ was found in array """ . thisTableArray . """ at position " . thisTablePos)
  105. Log("Module - Last Table of array """ . thisTableArray . """ left off at """ . lastTable . """ which was found at position " . lastTablePos)
  106.  
  107. ; Calculate the shortest distance to this table from the lastTable
  108. max := %thisTableArray%.MaxIndex()
  109. a := 1
  110. b := thisTablePos
  111. If (a > b) {
  112. moveDown := a - b
  113. moveUp := (max - a) + b
  114. } Else If (b > a) {
  115. moveDown := b - a
  116. moveUp := (max - b) + a
  117. } Else { ; a=b
  118. moveDown := 0
  119. moveUp := 0
  120. }
  121. moveDirection := If moveUp < moveDown ? "moveUp" : "moveDown"
  122. Log("Module - The array """ . thisTableArray . """ has " . max . " tables in it and shortest distance to this table is " . %moveDirection% . " in direction " . moveDirection)
  123.  
  124. hideEmuObj := Object(pinballTitleClass,1) ; Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
  125. HideEmuStart()
  126.  
  127. If executable {
  128. Log("Module - Running Pinball Arcade as a stand alone game and not through Steam as an executable was defined.")
  129. Run(executable, emuPath)
  130. } Else {
  131. If !steamPath
  132. GetSteamPath()
  133. Log("Module - Running Pinball Arcade through Steam.")
  134. Steam(238260,,"skipwhatsnew")
  135. }
  136.  
  137. WinWait(pinballTitleClass)
  138. WinWaitActive(pinballTitleClass)
  139.  
  140. BezelDraw()
  141. Run("BlockInput.exe 30", moduleExtensionsPath) ; start the tool that blocks all input so user cannot interrupt the launch process for 30 seconds
  142. If moduleDebugging = true
  143. Tooltip, waiting %sleepLogo% seconds for logo
  144. SetKeyDelay(80*sleepBaseTime)
  145. Sleep % sleepLogo ; sleep till Pinball FX2 logo appears
  146.  
  147. If moduleDebugging = true
  148. Tooltip, sending %selectKey% to get to the main menu
  149. ; Send, {%selectKey% Down}{%selectKey% Up}300{Down Down}{Down Up}100{%selectKey% Down}{%selectKey% Up} ; use this line to navigate the Main menu if you don't own all tables/all seasons. comment this line out if you don't
  150. Send, {%selectKey% Down}{%selectKey% Up}300{%selectKey% Down}{%selectKey% Up} ; use this line instead to navigate the Main menu if you do own all tables/all seasons. comment this line out if you don't
  151.  
  152. If moduleDebugging = true
  153. Tooltip, entering MyTable folder
  154. Sleep % 2000*sleepBaseTime ; wait for folder to load
  155.  
  156. If moduleDebugging = true
  157. Tooltip, navigating to %romName%
  158. SetKeyDelay(80*sleepBaseTime)
  159. If (moveDirection = "moveUp") {
  160. Loop % %moveDirection%
  161. { If moduleDebugging = true
  162. Tooltip % "Index: " . A_Index . " | Game: " . %thisTableArray%[A_Index]
  163. Send, {Up Down}{Up Up}
  164. Sleep % 100*sleepBaseTime
  165. }
  166. } Else { ; moveDown
  167. Loop % %moveDirection%
  168. { If moduleDebugging = true
  169. Tooltip % "Index: " . A_Index . " | Game: " . %thisTableArray%[A_Index]
  170. Send, {Down Down}{Down Up}
  171. Sleep % 100*sleepBaseTime
  172. }
  173. }
  174. Send, {%selectKey% Down}{%selectKey% Up} ; select game
  175. Sleep % 500*sleepBaseTime
  176.  
  177. If moduleDebugging = true
  178. Tooltip, waiting for game to load
  179. Send, {%selectKey% Down}{%selectKey% Up}80{%selectKey% Down}{%selectKey% Up} ; select game
  180. If (startGame = "true") {
  181. Sleep % 4800*sleepBaseTime ; waiting for table to load
  182. Send, {%selectKey% Down}{%selectKey% Up}80{%selectKey% Down}{%selectKey% Up} ; start game
  183. }
  184. If moduleDebugging = true
  185. Tooltip, Finished
  186.  
  187. Process("Close", "BlockInput.exe") ; end script that blocks all input
  188.  
  189. HideEmuEnd()
  190. FadeInExit()
  191. Process("WaitClose", "PinballArcade.exe")
  192. BezelExit()
  193. FadeOutExit()
  194.  
  195. If (RotateDisplay > 0) {
  196. Gui 1: Show
  197. Rotate(rotateMethod, 0)
  198. Sleep % 200*sleepBaseTime
  199. Gui 1: Destroy
  200. }
  201.  
  202. ExitModule()
  203.  
  204.  
  205. HaltEmu:
  206. disableSuspendEmu := true
  207. Send, {ESC down}{ESC up}
  208. Return
  209. RestoreEmu:
  210. Send, {ESC down}{ESC up}
  211. Return
  212.  
  213. CloseProcess:
  214. FadeOutStart()
  215. WinClose(pinballTitleClass)
  216. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement