rfancella

WinUAEBeta.ahk

Oct 7th, 2014
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.69 KB | None | 0 0
  1. MEmu = WinUAE
  2. MEmuV = v2.6.0
  3. MURL = http://www.winuae.net/
  4. MAuthor = brolly
  5. MVersion = 2.0.3
  6. MCRC = 3F1F9640
  7. iCRC = AD202C6E
  8. mId = 635138307631183750
  9. MSystem = "Commodore Amiga","Commodore Amiga CD32","Commodore CDTV","Commodore Amiga CD","Commodore Amiga Demos"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; You can have specific configuration files inside a Configurations folder on WinUAE main dir.
  13. ; Just name them the same as the game name on the XML file.
  14. ; Make sure you create a host config files with these names:
  15. ; CD32 : cd32host.uae and cd32mousehost.uae;
  16. ; CDTV : cdtvhost.uae and cdtvmousehost.uae;
  17. ; Amiga : amigahost.uae;
  18. ; Amiga CD : amigacdhost.uae;
  19. ; cd32mouse and cdtvmouse are for mouse controlled games on these systems, you should configure
  20. ; Windows Mouse on Port1 and a CD32 pad on Port2. For Amiga and Amiga CD make sure you set both
  21. ; a joystick and a mouse on Port1 and only a joystick on Port2.
  22. ; Set all your other preferences like video display settings. And make sure you are saving a HOST
  23. ; configuration file and not a general configuration file.
  24. ;
  25. ; If you want to configure an exit key through WinUAE:
  26. ; Host-Input-Configuration #1-RAW Keyboard and then remap the desired key to Quit Emulator.
  27. ; If you want to configure a key to toggle fullscreen/windowed mode:
  28. ; Host-Input-Configuration #1-RAW Keyboard and then remap the desired key to Toggle windowed/fullscreen.
  29. ;
  30. ; CD32 and CDTV:
  31. ; A settings file called System_Name.ini should be placed on your module dir. on that file you can define if a
  32. ; game uses mouse or if it needs the special delay hack loading method amongst other things. Example of such a file:
  33. ;
  34. ; [Lemmings (Europe)]
  35. ; UseMouse=true
  36. ;
  37. ; [Project-X & F17 Challenge (Europe)]
  38. ; DelayHack=true
  39. ;
  40. ; Amiga:
  41. ; For MultiGame support make sure you don't change the default WinUAE diskswapper keys which are:
  42. ; END+1-0 (not numeric keypad) = insert image from swapper slot 1-10
  43. ; END+SHIFT+1-0 = insert image from swapper slot 11-20
  44. ; END+CTRL+1-4 = select drive
  45. ;
  46. ; To do that follow the same procedure as above for the exit
  47. ; key, but on F11 set it to Toggle windowed/fullscreen. Make sure you save your configuration afterwards.
  48. ; Note : If you want to use Send commands to WinUAE for any keys that you configured through Input-Configuration panel make sure you
  49. ; set those keys for Null Keyboard! This is a virtual keyboard that collects all input events that don't come from physical
  50. ; keyboards. This applies to the exit or windowed/fullscreen keys mentioned above.
  51. ;
  52. ; If you are using WHDLoad games, but want to keep your default user-startup file after exiting then make a copy of it in the
  53. ; WHDFolder\S (Set in PathToWHDFolder) and name it default-user-startup. This file will then be copied over S\user-startup on exit.
  54. ;----------------------------------------------------------------------------
  55. StartModule()
  56. BezelGUI()
  57. FadeInStart()
  58.  
  59. settingsFile := modulePath . "\" . systemName . ".ini"
  60. fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1)
  61. PathToWHDFolder := IniReadCheck(settingsFile, "Settings", "PathToWHDFolder", emuPath . "\HDD\WHD",,1)
  62. PathToWorkBenchBase := IniReadCheck(settingsFile, "Settings", "PathToWorkBenchBase", emuPath . "\HDD\Workbench31_Lite.vhd",,1)
  63.  
  64. PathToWHDFolder := AbsoluteFromRelative(emuPath, PathToWHDFolder)
  65. PathToWorkBenchBase := AbsoluteFromRelative(emuPath, PathToWorkBenchBase)
  66.  
  67. bezelTopOffset := IniReadCheck(settingsFile, "Settings", "bezelTopOffset",16,,1)
  68. bezelBottomOffset := IniReadCheck(settingsFile, "Settings", "bezelBottomOffset",26,,1)
  69. bezelLeftOffset := IniReadCheck(settingsFile, "Settings", "bezelLeftOffset",7,,1)
  70. bezelRightOffset := IniReadCheck(settingsFile, "Settings", "bezelRightOffset",7,,1)
  71.  
  72. ; This object controls how the module reacts to different systems. MESS can play a lot of systems, but needs to know what system you want to run, so this module has to adapt.
  73. mType := Object("Commodore Amiga","a500","Commodore Amiga CD32","cd32","Commodore CDTV","cdtv","Commodore Amiga CD","amigacd","Commodore Amiga Demos","a1200")
  74. ident := mType[systemName] ; search object for the systemName identifier MESS uses
  75. If !ident
  76. ScriptError("Your systemName is: " . systemName . "`nIt is not one of the known supported systems for this WinUAE module: " . moduleName)
  77.  
  78. BezelStart()
  79. windowClass = PCsuxRox ;Class name is different depending on if the game is being run windowed or fullscreen
  80. If (fullscreen = "true")
  81. windowClass = AmigaPowah
  82.  
  83. specialcfg = %emuPath%\Configurations\%romName%.uae
  84.  
  85. If romExtension in .hdf,.vhd
  86. DefaultRequireWB := "true"
  87. Else
  88. DefaultRequireWB := "false"
  89.  
  90. If romExtension in .zip,.lha,.rar,.7z
  91. {
  92. SlaveFile := COM_Invoke(HLObject, "findByExtension", romPath . "\" . romName . romExtension, "slave")
  93. If (SlaveFile)
  94. {
  95. If romName contains (AGA)
  96. DefaultOptions := "-s cycle_exact=false " . "-s immediate_blits=false " . "-s cpu_compatible=false " . "-s cpu_speed=max " . "-s cachesize=8192" ;AGA
  97. Else
  98. DefaultOptions := "-s cycle_exact=true " . "-s immediate_blits=false " . "-s cpu_compatible=false " . "-s cpu_speed=real " . "-s cachesize=8192 " ;Non-AGA
  99. }
  100. }
  101.  
  102. usemouse := IniReadCheck(settingsFile, romName, "UseMouse","false",,1)
  103. delayhack := IniReadCheck(settingsFile, romName, "DelayHack","false",,1)
  104. options := IniReadCheck(settingsFile, romName, "Options",DefaultOptions,,1)
  105. videomode := IniReadCheck(settingsFile, romName, "VideoMode","PAL",,1)
  106.  
  107. floppyspeed := IniReadCheck(settingsFile, romName, "FloppySpeed","turbo",,1)
  108. quickstartmode := IniReadCheck(settingsFile, romName, "QuickStartMode",A_Space,,1)
  109. immediateblitter := IniReadCheck(settingsFile, romName, "ImmediateBlitter","false",,1)
  110. requireswb := IniReadCheck(settingsFile, romName, "RequiresWB",DefaultRequireWB,,1)
  111. customwb := IniReadCheck(settingsFile, romName, "CustomWB",A_Space,,1)
  112. whdloadoptions := IniReadCheck(settingsFile, romName, "WHDLoadOptions","PRELOAD",,1)
  113. neverextract := IniReadCheck(settingsFile, romName, "NeverExtract","false",,1)
  114.  
  115. fs := If fullscreen = "true" ? "true" : "false"
  116. videomode := If videomode = "NTSC" ? " -s ntsc=true" : ""
  117. floppyspeed := If floppyspeed ? " -s floppy_speed=" . floppyspeed : ""
  118.  
  119. If (requireswb = "true")
  120. {
  121. ident := "a1200"
  122. If (customwb)
  123. PathToWorkBenchBase := %emuPath% . "\" . customwb
  124. CheckFile(PathToWorkBenchBase)
  125. wbDrive := " -s hardfile=rw,32,1,2,512," . """" . PathToWorkBenchBase . """"
  126. }
  127. If romExtension in .hdf,.vhd
  128. {
  129. ident := "a1200"
  130. gameDrive := " -s hardfile=rw,32,1,2,512," . """" . romPath . "\" . romName . romExtension . """"
  131. }
  132. If (immediateblitter = "true")
  133. options := options . " -s immediate_blits=true"
  134.  
  135. options := options . " " . videomode
  136.  
  137. If (ident = "a500" or ident = "a1200")
  138. {
  139. If romName contains (AGA),(LW)
  140. ident := "a1200"
  141. If (SlaveFile)
  142. {
  143. CheckFile(PathToWHDFolder,,,,,,1)
  144. ident := "a1200"
  145. ;Create the user-startup file to launch the game
  146. WHDUserStartupFile := PathToWHDFolder . "\S\user-startup"
  147. SplitPath, SlaveFile, SlaveName, SlaveFolder
  148.  
  149. FileDelete, %WHDUserStartupFile%
  150. FileAppend, echo "";`n, %WHDUserStartupFile%
  151. FileAppend, echo "Running: %SlaveName%";`n, %WHDUserStartupFile%
  152. FileAppend, echo "";`n, %WHDUserStartupFile%
  153. FileAppend, cd dh1:%SlaveFolder%;`n, %WHDUserStartupFile%
  154. FileAppend, whdload %SlaveName% %whdloadoptions%;`n, %WHDUserStartupFile%
  155. }
  156. }
  157.  
  158. hideEmuObj := Object("ahk_class " . windowClass,1) ; Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
  159. 7z(romPath, romName, romExtension, 7zExtractPath)
  160.  
  161. If FileExist(specialcfg)
  162. { ;Game specific configuration file exists
  163. configFile = %romName%.uae
  164. } Else {
  165. ;Game specific configuration file doesn't exist
  166. If (ident = "cd32" or ident = "cdtv")
  167. {
  168. configFile := If (usemouse = "true") ? ("host\" . ident . "mousehost.uae") : ("host\" . ident . "host.uae")
  169. quickcfg := If (ident = "cd32") ? ("-s quickstart=" . ident . "`,0 -s chipmem_size=8") : ("-s quickstart=" . ident . "`,0")
  170. If (delayhack = "true")
  171. options := options . " -s cdimage0=" . """" . romPath . "\" . romName . romExtension . """" . "`,delay"
  172. Else
  173. options := options . " -cdimage=" . """" . romPath . "\" . romName . romExtension . """"
  174. } Else {
  175. ;Amiga or Amiga CD game
  176.  
  177. configFile := If systemName = "Commodore Amiga CD" ? "host\amigacdhost.uae" : "host\amigahost.uae"
  178. If quickstartmode
  179. quickcfg := "-s quickstart=" . quickstartmode
  180. Else
  181. quickcfg := If (ident = "a500") ? "-s quickstart=a500`,1" : "-s quickstart=a1200`,1"
  182.  
  183. If (SlaveFile) ; WHDLoad Game
  184. options := options . " -s filesystem=rw,WHD:" . """" . PathToWHDFolder . """" . " -s filesystem=ro,Games:" . """" . romPath . "\" . romName . romExtension . """"
  185. Else If (gameDrive) ; HDD Game
  186. options := options . " " . wbDrive . " " . gameDrive
  187. Else If romExtension in .cue,.iso ; Amiga CD game
  188. options := options . " " . wbDrive . " -cdimage=" . """" . romPath . "\" . romName . romExtension . """" . " -s win32.map_cd_drives=true -s scsi=true"
  189. Else { ; Floppy Game
  190. ;MultiDisk loading, this will load the first 2 disks into drives 0 and 1 since some games can read from both drives and therefore
  191. ;the user won't need to change disks through the MG menu. We can have up to 4 drives, but most of the games will only support 2 drives
  192. ;so disks are only loaded into the first 2 for better compatibility. Remaining drives will be loaded into quick disk slots.
  193.  
  194. romCount = % romTable.MaxIndex()
  195. If romName contains (Disk 1)
  196. {
  197. ;If the user boots any disk rather than the first one, multi disk support must be done through HyperLaunch MG menu
  198. if romCount > 1
  199. {
  200. options := options . " -s nr_floppies=2"
  201. mgoptions := " -s floppy1=" . """" . romTable[2,1] . """"
  202. }
  203. }
  204. options := options . " " . floppyspeed . " -s floppy0=" . """" . romPath . "\" . romName . romExtension . """" . mgoptions
  205.  
  206. if romCount > 1
  207. {
  208. ;DiskSwapper
  209. ;diskswapper := " -diskswapper "
  210. Loop % romTable.MaxIndex() ; loop each item in our array
  211. {
  212. ;diskswapper := diskswapper . """" . romTable[A_Index,1] . ""","
  213. diskswapper := diskswapper . " -s diskimage" . (A_Index-1) . "=" . """" . romTable[A_Index,1] . """"
  214. }
  215. options := options . diskswapper
  216. }
  217. }
  218. }
  219. }
  220.  
  221. param1 := " -f " . """" . emuPath . "\Configurations\" . configFile . """" . " " . quickcfg
  222. param2 := " -s use_gui=no -s gfx_fullscreen_amiga=" . fs
  223. param3 := options
  224.  
  225. ;MsgBox, %param1% %param2% %param3% %param4% %param5% %param6%
  226. ;ExitApp
  227.  
  228. ;disableActivateBlackScreen = true
  229.  
  230. HideEmuStart() ; This fully ensures windows are completely hidden even faster than winwait
  231.  
  232. Run(Executable . param1 . param2 . A_Space . param3 . " -portable", emuPath)
  233.  
  234. WinWait("ahk_class " . windowClass)
  235. disableHideTitleBar := true
  236. disableHideToggleMenu := true
  237. ;disableHideBorder := true
  238. BezelDraw()
  239. WinWaitActive("ahk_class " . windowClass)
  240.  
  241. HideEmuEnd()
  242. FadeInExit()
  243. Process("WaitClose", executable)
  244. 7zCleanUp()
  245. FadeOutExit()
  246. ExitModule()
  247.  
  248.  
  249. MultiGame:
  250. If currentButton = 10
  251. diskslot = 0
  252. Else If currentButton > 10
  253. diskslot := currentButton - 10
  254. Else
  255. diskslot := currentButton
  256.  
  257. If currentButton > 10
  258. Send, {End Down}{Shift Down}%diskslot%{Shift Up}{End Up}
  259. Else
  260. Send, {End Down}%diskslot%{End Up}
  261. Return
  262.  
  263. CloseProcess:
  264. If (ident = "a500" or ident = "a1200") {
  265. If (SlaveFile) {
  266. CheckFile(PathToWHDFolder,,,,,,1)
  267. ;Copy default-user-startup to user-startup if file exists
  268. IfExist, %PathToWHDFolder%\S\default-user-startup
  269. FileCopy,%PathToWHDFolder%\S\default-user-startup, %PathToWHDFolder%\S\user-startup, 1
  270. }
  271. }
  272. FadeOutStart()
  273. BezelExit()
  274. WinClose, ahk_class %windowClass%
  275. Return
Add Comment
Please, Sign In to add comment