rfancella

WinUAE.ahk (PerGameCfg)

Nov 20th, 2014
525
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.43 KB | None | 0 0
  1. MEmu = WinUAE
  2. MEmuV = v2.6.0
  3. MURL = http://www.winuae.net/
  4. MAuthor = brolly
  5. MVersion = 2.1.0
  6. MCRC = 8A45B402
  7. iCRC = 16B46231
  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.  
  61. Fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1)
  62. PathToWHDFolder := IniReadCheck(settingsFile, "Settings", "PathToWHDFolder", EmuPath . "\HDD\WHD",,1)
  63. PathToWorkBenchBase := IniReadCheck(settingsFile, "Settings", "PathToWorkBenchBase", EmuPath . "\HDD\Workbench31_Lite.vhd",,1)
  64.  
  65. PathToWHDFolder := AbsoluteFromRelative(EmuPath, PathToWHDFolder)
  66. PathToWorkBenchBase := AbsoluteFromRelative(EmuPath, PathToWorkBenchBase)
  67.  
  68. ;Bezel settings
  69. bezelTopOffset := IniReadCheck(settingsFile, "Settings", "Bezel_Top_Offset","0",,1)
  70. bezelBottomOffset := IniReadCheck(settingsFile, "Settings", "Bezel_Bottom_Offset","0",,1)
  71. bezelRightOffset := IniReadCheck(settingsFile, "Settings", "Bezel_Right_Offset", "0",,1)
  72. bezelLeftOffset := IniReadCheck(settingsFile, "Settings", "Bezel_Left_Offset", "0",,1)
  73.  
  74. ; 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.
  75. mType := Object("Commodore Amiga","a500","Commodore Amiga CD32","cd32","Commodore CDTV","cdtv","Commodore Amiga CD","amigacd","Commodore Amiga Demos","a500")
  76. ident := mType[systemName] ; search object for the systemName identifier MESS uses
  77. If !ident
  78. ScriptError("Your systemName is: " . systemName . "`nIt is not one of the known supported systems for this WinUAE module: " . moduleName)
  79.  
  80. specialcfg = %emuPath%\Configurations\%romName%.uae
  81.  
  82. If romExtension in .hdf,.vhd
  83. DefaultRequireWB := "true"
  84. Else
  85. DefaultRequireWB := "false"
  86.  
  87. If romExtension in .zip,.lha,.rar,.7z
  88. {
  89. SlaveFile := COM_Invoke(HLObject, "findByExtension", romPath . "\" . romName . romExtension, "slave")
  90. If (SlaveFile) {
  91. If romName contains (AGA)
  92. {
  93. defaultCycleExact := "false"
  94. defaultCpuSpeed := "max"
  95. } Else {
  96. defaultCycleExact := "true"
  97. defaultCpuSpeed := "real"
  98. }
  99. defaultImmediateBlittler = "false"
  100. defaultCpuCompatible := "false"
  101. defaultCacheSize := "0" ;8192
  102. }
  103. }
  104.  
  105. usemouse := IniReadCheck(settingsFile, romName, "UseMouse","false",,1)
  106. delayhack := IniReadCheck(settingsFile, romName, "DelayHack","false",,1)
  107.  
  108. floppyspeed := IniReadCheck(settingsFile, romName, "FloppySpeed","turbo",,1)
  109. quickstartmode := IniReadCheck(settingsFile, romName, "QuickStartMode",A_Space,,1)
  110. options := IniReadCheck(settingsFile, romName, "Options","",,1)
  111. requireswb := IniReadCheck(settingsFile, romName, "RequiresWB",DefaultRequireWB,,1)
  112. customwb := IniReadCheck(settingsFile, romName, "CustomWB",A_Space,,1)
  113.  
  114. ;Chipset settings
  115. videomode := IniReadCheck(settingsFile, romName, "VideoMode","PAL",,1)
  116. immediateblitter := IniReadCheck(settingsFile, romName, "ImmediateBlitter",defaultImmediateBlittler,,1)
  117. collisionlevel := IniReadCheck(settingsFile, romName, "CollisionLevel","",,1)
  118.  
  119. ;CPU settings
  120. cycleexact := IniReadCheck(settingsFile, romName, "CycleExact",defaultCycleExact,,1)
  121. cpucycleexact := IniReadCheck(settingsFile, romName, "CpuCycleExact","",,1)
  122. blittercycleexact := IniReadCheck(settingsFile, romName, "BlitterCycleExact","",,1)
  123. cpucompatible := IniReadCheck(settingsFile, romName, "CpuCompatible",defaultCpuCompatible,,1)
  124. cpuspeed := IniReadCheck(settingsFile, romName, "CpuSpeed",defaultCpuSpeed,,1)
  125. cachesize := IniReadCheck(settingsFile, romName, "CacheSize",defaultCacheSize,,1)
  126.  
  127. ;RAM settings
  128. chipmemory := IniReadCheck(settingsFile, romName, "ChipMemory","",,1)
  129. fastmemory := IniReadCheck(settingsFile, romName, "FastMemory","",,1)
  130. autoconfigfastmemory := IniReadCheck(settingsFile, romName, "AutoConfigFastMemory","",,1)
  131. slowmemory := IniReadCheck(settingsFile, romName, "SlowMemory","",,1)
  132. z3fastmemory := IniReadCheck(settingsFile, romName, "Z3FastMemory","",,1)
  133. megachipmemory := IniReadCheck(settingsFile, romName, "MegaChipMemory","",,1)
  134.  
  135. ;WHDLoad settings
  136. whdloadoptions := IniReadCheck(settingsFile, romName, "WHDLoadOptions","PRELOAD",,1)
  137. neverextract := IniReadCheck(settingsFile, romName, "NeverExtract","false",,1)
  138.  
  139. BezelStart()
  140.  
  141. windowClass = PCsuxRox ;Class name is different depending on if the game is being run windowed or fullscreen
  142. If ( Fullscreen = "true" )
  143. windowClass = AmigaPowah
  144.  
  145. If (cpucycleexact and blittercycleexact)
  146. cycleexact := "" ;No need to set cycle exact if both cpu and blitter are set as it could lead to inconsistent states
  147.  
  148. ;Fill both z3 slots when amount of RAM requires it
  149. If (z3fastmemory = "384") {
  150. z3fastmemory = "256"
  151. z3fastmemoryb = "128"
  152. } Else If (z3fastmemory = "768") {
  153. z3fastmemory = "512"
  154. z3fastmemoryb = "256"
  155. } Else If (z3fastmemory = "1536") {
  156. z3fastmemory = "1024"
  157. z3fastmemoryb = "512"
  158. }
  159.  
  160. fs := If (Fullscreen = "true") ? "true" : "false"
  161. videomode := (If videomode = "NTSC" ? ("-s ntsc=true") : (""))
  162. floppyspeed := (If floppyspeed ? ("-s floppy_speed=" . floppyspeed) : (""))
  163.  
  164. If (requireswb = "true") {
  165. ident := "a1200"
  166.  
  167. If (customwb)
  168. PathToWorkBenchBase := %EmuPath% . "\" . customwb
  169. CheckFile(PathToWorkBenchBase)
  170. wbDrive := "-s hardfile=rw,32,1,2,512," . """" . PathToWorkBenchBase . """"
  171. }
  172.  
  173. If romExtension in .hdf,.vhd
  174. {
  175. ident := "a1200"
  176. gameDrive := "-s hardfile=rw,32,1,2,512," . """" . romPath . "\" . romName . romExtension . """"
  177. }
  178.  
  179. options := options . " " . videomode
  180.  
  181. If (ident = "a500" or ident = "a1200") {
  182. If romName contains (AGA),(LW)
  183. ident := "a1200"
  184.  
  185. If (SlaveFile) {
  186. CheckFolder(PathToWHDFolder)
  187.  
  188. ident := "a1200"
  189.  
  190. ;Create the user-startup file to launch the game
  191. WHDUserStartupFile := PathToWHDFolder . "\S\user-startup"
  192. SplitPath, SlaveFile, SlaveName, SlaveFolder
  193.  
  194. FileDelete, %WHDUserStartupFile%
  195. FileAppend, echo "";`n, %WHDUserStartupFile%
  196. FileAppend, echo "Running: %SlaveName%";`n, %WHDUserStartupFile%
  197. FileAppend, echo "";`n, %WHDUserStartupFile%
  198. FileAppend, cd dh1:%SlaveFolder%;`n, %WHDUserStartupFile%
  199. FileAppend, whdload %SlaveName% %whdloadoptions%;`n, %WHDUserStartupFile%
  200. }
  201. }
  202.  
  203. hideEmuObj := Object("ahk_class " . windowClass,1) ; Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
  204. 7z(romPath, romName, romExtension, 7zExtractPath)
  205.  
  206. ;--- Detecting what Configuration File to use (Or Quick Start Mode) ---
  207.  
  208. If FileExist(specialcfg) {
  209. ;Game specific configuration file exists
  210. configFile = %romName%.uae
  211. } Else {
  212. ;Game specific configuration file doesn't exist
  213. If (ident = "cd32" or ident = "cdtv") {
  214. configFile := If (usemouse = "true") ? ("host\" . ident . "mousehost.uae") : ("host\" . ident . "host.uae")
  215. quickcfg := If (ident = "cd32") ? ("-s quickstart=" . ident . "`,0 -s chipmem_size=8") : ("-s quickstart=" . ident . "`,0")
  216. } Else {
  217. ;Amiga or Amiga CD game
  218.  
  219. configFile := If systemName = "Commodore Amiga CD" ? "host\amigacdhost.uae" : "host\amigahost.uae"
  220. If quickstartmode
  221. quickcfg := "-s quickstart=" . quickstartmode
  222. Else
  223. quickcfg := If (ident = "a500") ? "-s quickstart=a500`,1" : "-s quickstart=a1200`,1"
  224. }
  225. }
  226.  
  227. ;--- Setting up command line arguments to use ---
  228.  
  229. If (ident = "cd32" or ident = "cdtv") {
  230. If (delayhack = "true")
  231. options := options . " -s cdimage0=" . """" . romPath . "\" . romName . romExtension . """" . "`,delay"
  232. Else
  233. options := options . " -cdimage=" . """" . romPath . "\" . romName . romExtension . """"
  234. } Else {
  235. If immediateblitter
  236. options := options . " -s immediate_blits=" . immediateblitter
  237. If cycleexact
  238. options := options . " -s cycle_exact=" . cycleexact
  239. If cpucycleexact
  240. options := options . " -s cpu_cycle_exact=" . cpucycleexact
  241. If blittercycleexact
  242. options := options . " -s blitter_cycle_exact=" . blittercycleexact
  243. If cpucompatible
  244. options := options . " -s cpu_compatible=" . cpucompatible
  245. If cpuspeed
  246. options := options . " -s cpu_speed=" . cpuspeed
  247. If cachesize
  248. options := options . " -s cachesize=" . cachesize
  249. If collisionlevel
  250. options := options . " -s collision_level=" . collisionlevel
  251. If chipmemory
  252. options := options . " -s chipmem_size=" . chipmemory
  253. If fastmemory
  254. options := options . " -s fastmem_size=" . fastmemory
  255. If autoconfigfastmemory
  256. options := options . " -s fastmem_autoconfig=" . autoconfigfastmemory
  257. If slowmemory
  258. options := options . " -s bogomem_size=" . slowmemory
  259. If z3fastmemory
  260. options := options . " -s z3mem_size=" . z3fastmemory
  261. If z3fastmemoryb
  262. options := options . " -s z3mem2_size=" . z3fastmemoryb
  263. If megachipmemory
  264. options := options . " -s megachipmem_size=" . megachipmemory
  265.  
  266. If (SlaveFile) {
  267. ;WHDLoad Game
  268. options := options . " -s filesystem=rw,WHD:" . """" . PathToWHDFolder . """" . " -s filesystem=ro,Games:" . """" . romPath . "\" . romName . romExtension . """"
  269. }
  270. Else If (gameDrive) {
  271. ;HDD Game
  272. options := options . " " . wbDrive . " " . gameDrive
  273. } Else If romExtension in .cue,.iso
  274. {
  275. ;Amiga CD game
  276. options := options . " " . wbDrive . " -cdimage=" . """" . romPath . "\" . romName . romExtension . """" . " -s win32.map_cd_drives=true -s scsi=true"
  277. } Else {
  278. ;Floppy Game
  279.  
  280. ;MultiDisk loading, this will load the first 2 disks into drives 0 and 1 since some games can read from both drives and therefore
  281. ;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
  282. ;so disks are only loaded into the first 2 for better compatibility. Remaining drives will be loaded into quick disk slots.
  283.  
  284. romCount = % romTable.MaxIndex()
  285. If romName contains (Disk 1)
  286. {
  287. ;If the user boots any disk rather than the first one, multi disk support must be done through HyperLaunch MG menu
  288. If romCount > 1
  289. {
  290. options := options . " -s nr_floppies=2"
  291. mgoptions := " -s floppy1=" . """" . romTable[2,1] . """"
  292. }
  293. }
  294. options := options . " " . floppyspeed . " -s floppy0=" . """" . romPath . "\" . romName . romExtension . """" . mgoptions
  295.  
  296. If romCount > 1
  297. {
  298. ;DiskSwapper
  299. ;diskswapper := " -diskswapper "
  300. Loop % romTable.MaxIndex() ; loop each item in our array
  301. {
  302. ;diskswapper := diskswapper . """" . romTable[A_Index,1] . ""","
  303. diskswapper := diskswapper . " -s diskimage" . (A_Index-1) . "=" . """" . romTable[A_Index,1] . """"
  304. }
  305. options := options . diskswapper
  306. }
  307. }
  308. }
  309.  
  310. param1 := "-f " . """" . EmuPath . "\Configurations\" . configFile . """" . " " . quickcfg
  311. param2 := "-s use_gui=no -s gfx_fullscreen_amiga=" . fs
  312. param3 := options
  313.  
  314. ;MsgBox, %param1% %param2% %param3%
  315. ;ExitApp
  316.  
  317. ;disableActivateBlackScreen = true
  318.  
  319. HideEmuStart()
  320. Run(Executable . A_Space . param1 . A_Space . param2 . A_Space . param3 . A_Space . " -portable", emuPath)
  321.  
  322. WinWait("ahk_class " . windowClass)
  323. WinWaitActive("ahk_class " . windowClass)
  324.  
  325. If bezelPath
  326. Control, Hide, , ahk_class msctls_statusbar32, ahk_class %windowClass% ;Hide status bar (Doesn't seem to work...)
  327.  
  328. BezelDraw()
  329. HideEmuEnd()
  330. FadeInExit()
  331. Process("WaitClose",executable)
  332. 7zCleanUp()
  333. BezelExit()
  334. FadeOutExit()
  335. ExitModule()
  336.  
  337. MultiGame:
  338. If currentButton = 10
  339. diskslot = 0
  340. Else If currentButton > 10
  341. diskslot := currentButton - 10
  342. Else
  343. diskslot := currentButton
  344.  
  345. If currentButton > 10
  346. Send, {End Down}{Shift Down}%diskslot%{Shift Up}{End Up}
  347. Else
  348. Send, {End Down}%diskslot%{End Up}
  349. return
  350.  
  351. CloseProcess:
  352. If (ident = "a500" or ident = "a1200") {
  353. If (SlaveFile) {
  354. CheckFolder(PathToWHDFolder)
  355. ;Copy default-user-startup to user-startup if file exists
  356. IfExist, %PathToWHDFolder%\S\default-user-startup
  357. FileCopy,%PathToWHDFolder%\S\default-user-startup, %PathToWHDFolder%\S\user-startup, 1
  358. }
  359. }
  360. FadeOutStart()
  361. WinClose, ahk_class %windowClass%
  362. Return
Add Comment
Please, Sign In to add comment