Advertisement
djvj

Untitled

Jul 19th, 2015
761
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.52 KB | None | 0 0
  1. MEmu = MAMEMerge
  2. MEmuV = v0.163
  3. MURL = http://www.mame.net/
  4. MAuthor = djvj,faahrev,brolly,Tomkun
  5. MVersion = 2.3.6
  6. MCRC =
  7. iCRC =
  8. MID =
  9. MSystem = "AAE","Aamber Pegasus","Acorn Electron","Amstrad GX4000","APF Imagination Machine","Apple IIGS","Applied Technology MicroBee","Atari 8-bit","Atari 2600","Atari 5200","Atari 7800","Atari Classics","Atari Jaguar","Atari Lynx","Bally Astrocade","Bandai WonderSwan","Bandai WonderSwan Color","Capcom","Capcom Classics","Capcom Play System","Capcom Play System II","Capcom Play System III","Casio PV-1000","Casio PV-2000","Cave","Coleco ADAM","ColecoVision","Creatronic Mega Duck","Data East Classics","Emerson Arcadia 2001","Entex Adventure Vision","Epoch Game Pocket Computer","Epoch Super Cassette Vision","Exidy Sorcerer","Fairchild Channel F","Funtech Super Acan","GCE Vectrex","Hartung Game Master","Interton VC 4000","JungleTac Sport Vii","Konami Classics","LaserDisc","Magnavox Odyssey 2","MAME","Matra & Hachette Alice","Mattel Aquarius","Mattel Intellivision","Midway Classics","Namco Classics","Namco System 22","NEC PC Engine","NEC PC Engine-CD","NEC SuperGrafx","NEC TurboGrafx-16","NEC TurboGrafx-CD","Nintendo 64","Nintendo Arcade Systems","Nintendo Classics","Nintendo Entertainment System","Nintendo Famicom","Nintendo Famicom Disk System","Nintendo Game Boy","Nintendo Game Boy Advance","Nintendo Game Boy Color","Nintendo Super Game Boy","Nintendo Virtual Boy","Philips CD-i","RCA Studio II","Sega 32X","Sega CD","Sega Classics","Sega Game Gear","Sega Genesis","Sega Master System","Sega Mega Drive","Sega Model 1","Sega SG-1000","Sega ST-V","Sinclair ZX81","SNK Classics","SNK Neo Geo","SNK Neo Geo AES","SNK Neo Geo AES","SNK Neo Geo CD","SNK Neo Geo MVS","SNK Neo Geo Pocket","SNK Neo Geo Pocket Color","Sony PlayStation","Sony PocketStation","Sord M5","Super Nintendo Entertainment System","Taito Classics","Tandy TRS-80 Color Computer","Texas Instruments TI 99-4A","Tiger Game.com","Tomy Tutor","VTech CreatiVision","Watara Supervision"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; This module now includes everything from the legacy MAME and MESS modules, but combined to match the merge of the 2 emulators that occured on version 0.162.
  13. ;
  14. ; Exit fade will only work correctly if you don't have Esc, the default MAME exit key, as your exit key. If you use Esc, turn off the ExitScreen
  15. ; This module will set your rom paths on the fly via CLI, but you must make sure the RLUI module setting for this module "MAME_BIOS_Path" is correctly set. It defaults to your roms subfolder where MAME.exe is found.
  16. ; This module assumes you have bios zip in your MAME "roms" directory, which might be different than your actual roms directory, for each system you need this module for. All tested systems listed below
  17. ; If MAME has a problem reading the bios zips, try archving them with "no compression"
  18. ; This site can help a ton with details for the various systems supported: http://www.progettoemma.net/mess/index.html
  19. ; You may get a black screen or MAME may close w/o notice if you do not have a bios rom for your system when one is needed.
  20. ; If you use bezel, it is recommended to set the module bezel mode to normal, and go to your MAME.ini file, on your emulator folder, and choose these options: artwork_crop 1, use_backdrops 1, use_overlays 1, use_bezels 0
  21. ;
  22. ; Command Line Options - http://easyemu.mameworld.info/mameguide/mameguide-options.html
  23. ; High Scores DO NOT SAVE when cheats are enabled!
  24. ; HLSL Documentation: http://mamedev.org/source/docs/hlsl.txt.html
  25. ; If you use MAME for AAE, create a vector.ini in mame's ini subfolder and paste these HLSL settings in there: http://www.mameworld.info/ubbthreads/showflat.php?Cat=&Number=309968&page=&view=&sb=5&o=&vc=1
  26. ;
  27. ; Following systems require a BIOS zip with their roms inside, placed in the "MAME\Roms\" directory:
  28. ; Amstrad GX4000 - N/A
  29. ; APF Imagination Machine - apfimag (tape games), apfm1000 (cart games)
  30. ; Apple IIGS - apple2gs
  31. ; Atari 800 - a800
  32. ; Atari 5200 - a5200
  33. ; Atari 7800 - a7800
  34. ; Atari Jaguar - jaguar
  35. ; Atari Lynx - lynx
  36. ; Bally Astrocade - astrocde
  37. ; Bandai WonderSwan - N/A
  38. ; Bandai WonderSwan Color - N/A
  39. ; Casio PV-2000 - pv2000
  40. ; Coleco ADAM - adam, adam_ddp, adam_fdc, adam_kb, adam_prn, adam_spi
  41. ; ColecoVision - coleco
  42. ; Creatronic Mega Duck - N/A
  43. ; Emerson Arcadia 2001 - N/A
  44. ; Entex Adventure Vision - advision
  45. ; Epoch Game Pocket Computer - gamepock
  46. ; Epoch Super Cassette Vision - scv
  47. ; Exidy Sorcerer - sorcerer
  48. ; Fairchild Channel F - channelf
  49. ; Funtech Super ACan - supracan
  50. ; GCE Vectrex - vextrex
  51. ; Hartung Game Master - gmaster
  52. ; Interton VC 4000 - vc4000
  53. ; JungleTac Sport Vii - vii
  54. ; Magnavox Odyssey 2 - odyssey2
  55. ; Matra & Hachette Alice - alice32
  56. ; Mattel Aquarius - aquarius
  57. ; Mattel Intellivision - intv ("exec.bin" [8,192 bytes] & "grom.bin" [2,048 bytes])
  58. ; MGT Sam Coupe - samcoupe
  59. ; NEC PC Engine - N/A
  60. ; NEC PC Engine-CD - N/A
  61. ; NEC SuperGrafx - N/A
  62. ; NEC TurboGrafx-16 - N/A
  63. ; NEC TurboGrafx-CD - "Super CD-ROM2 System V3.01 (U).pce" [262,144 bytes] (placed in the roms subfolder in the emuPath)
  64. ; Nintendo 64 - n64
  65. ; Nintendo Entertainment System - N/A
  66. ; Nintendo Famicom Disk System - famicom
  67. ; Nintendo Game Boy - gameboy
  68. ; Nintendo Game Boy Advance - gba
  69. ; Nintendo Game Boy Color - gbcolor
  70. ; Nintendo Super Game Boy Color - supergb
  71. ; Nintendo Virtual Boy - N/A
  72. ; Philips CD-i - the cdimono1
  73. ; RCA Studio II - studio2
  74. ; Sega 32X - 32x
  75. ; Sega CD - segacd, megacd, megacd2j (megacd2j seems to be more compatible over megacdj)
  76. ; Sega Game Gear - gamegear
  77. ; Sega Genesis - N/A
  78. ; Sega Master System - sms
  79. ; Sega Mega Drive - N/A
  80. ; Sinclair ZX81 - zx81
  81. ; SNK Neo Geo AES - aes
  82. ; SNK Neo Geo CD - neocd
  83. ; SNK Neo Geo Pocket - ngp
  84. ; SNK Neo Geo Pocket Color - ngpc
  85. ; Sony PlayStation - psa, pse, psj, psu
  86. ; Sony PocketStation - pockstat
  87. ; Sord M5 - m5
  88. ; Super Nintendo Entertainment System - snes
  89. ; Tandy TRS-80 Color Computer - coco3
  90. ; Texas Instruments TI 99-4A - ti99_4a
  91. ; Tiger Game.com - gamecom
  92. ; Tomy Tutor - tutor
  93. ; VTech CreatiVision - crvision
  94. ; Watara Supervision - N/A
  95. ;
  96. ; Custom Configuration Files:
  97. ; If you want to use custom configuration files (.cfg files) for some games you will need to store them inside your MAME cfg folder using the following structure:
  98. ; cfg\mame_system_name\HS_XML_rom_name\mame_system_name.cfg
  99. ; An example of a game that requires specific settings is ICBM Attack for the Bally Astrocade, in this case special cfg file should be:
  100. ; cfg\astrocde\I.C.B.M. Attack (USA) (Unl)\astrocde.cfg
  101. ;
  102. ; Ini Files:
  103. ; Module will set most settings through command line which will override any settings you might have on your MAME ini files. Everything else will be read from
  104. ; those. MAME supports a hierarchical ini file structure and will load settings from several ini files following a specific order:
  105. ;- mame.ini
  106. ;- <mymame>.ini (i.e. if MAME was renamed mame060.exe, MAME parses mame060.ini here)
  107. ;- debug.ini (if the debugger is enabled)
  108. ;- <parent>.ini (for clones only, may be called recursively)
  109. ;- <gamename>.ini
  110. ;- vertical.ini (for games with vertical monitor orientation)
  111. ;- horizont.ini (for games with horizontal monitor orientation)
  112. ;- vector.ini (for vector games only)
  113. ;- <driver>.ini (based on the source filename of the driver)
  114. ;
  115. ; The settings in the later ini's override those in the earlier ini's.
  116. ;
  117. ; It's highly recommended that you set skipchecks to 'Rom Only" for MAME otherwise RocketLauncher won't be able to launch several games due
  118. ; to the way MAME roms are packaged. This will be even more noticeable for those using merged sets.
  119. ;
  120. ; Bally Astrocade:
  121. ; ICBM requires a soft reset (even on the real hardware) to launch. You can read about it here: http://www.ballyalley.com/ballyalley/articles/Playing_ICBM_Attack_Using_MESS.pdf
  122. ; A custom build of MAME is needed to play this game if you don't want to press F3 manually each time you play ICBM. The custom build enables DirectInput so it is possible to script a soft reset in.
  123. ; Also ICBM uses different controls then the rest of the games. Make sure you follow the procedure explained above under "Custom Configuration Files" to create such file.
  124. ; Rom extensions should be zip,bin,txt
  125. ; Create a txt file in your rom dir called "Gunfight+Checkmate+Calculator+Scribbling (USA).txt" This game is built into the system and no rom is required to play it.
  126. ;
  127. ; GCE Vectrex:
  128. ; Requires a vectrex.lay and a png overlay for each game. These all need to be placed in the MAME\artwork\vectrex folder.
  129. ; You can download all these pngs and the lay file in my ftp folder. You need to use the HyperList XML to match the pngs.
  130. ;
  131. ; Magnavox Odyssey 2:
  132. ; Euro games should use the videopac bios instead of the odyssey2 one or you'll get some timing issues.
  133. ; Use the systemName ini file in the folder with this module for this, example:
  134. ; [Moto-Crash (France)]
  135. ; Bios=videopac
  136. ;
  137. ; Texas Instruments TI 99/4A:
  138. ; This system requires full keyboard emulation to work properly
  139. ; Split cart dumps are not supported since MESS .145 so you'll have to convert them to RPK format or use an earlier version of MESS (and a different module)
  140. ; You can check how to convert split cart dumps to RPK here:
  141. ; http://www.ninerpedia.org/index.php/MESS_multicart_system
  142. ; For floppy games make sure you have a RPK dump of an extended basic rom on your roms folder. It should be named "extended_basic.rpk"
  143.  
  144. ; Bezels:
  145. ; Module settings control whether RocketLauncher or MAME bezels are shown
  146. ; In the bezel normal mode only RocketLauncher Bezels will be show and the MAME use_bezels option will be forced disbaled
  147. ; In the bezel layout mode, RocketLauncher Bezels will be drawn only when you do not have a layout file on your MAME folders for the current game
  148. ;
  149. ; ServoStik:
  150. ; The module will automatically control any connected ServoStiks found on the system.
  151. ; It does this by reading the xml info from MAME. If that XML info has directional info at 4 or less, 4-way mode will be enabled. All others get 8-way mode.
  152. ;
  153. ; Per game controller types:
  154. ; MAME allows you to change the controller type for each game by using slot devices. Slot devices are highly customizable and vary greatly from system to
  155. ; system so to avoid adding a huge complexity to the module this must be done through the Parameters settings.
  156. ; Slot devices are stored in the MAME ini file you are using, so the best way to find the command line you need to use is to start your game set the slot devices
  157. ; through the MAME UI (Press tab while in MAME) exit and then open the MAME ini file and search for a section named SLOT DEVICES.
  158. ; This is an example for Atari 2600 for a game using wheel controllers on both joy ports:
  159. ; #
  160. ; # SLOT DEVICES
  161. ; #
  162. ; joyport1 wheel
  163. ; joyport2 wheel
  164. ; The suggested method is to set the desired controllers you want to use by default in the Module Global Settings, in this case under the Atari 2600 tab you would
  165. ; set Parameters=-joyport1 joy -joyport2 joy
  166. ; And then for specific games do the same under Module Specific Settings for that system, if a game requires the wheel controller you'd set
  167. ; Parameters=-joyport1 wheel -joyport2 wheel
  168. ;
  169. ; Another option is to set the default values in the MAME ini file and make sure you also set writeconfig to 0.
  170. ; Swapping slot devices wipes out SYSTEM custom configs on the unplugged controllers, so to avoid any customised controls getting erased everytime you change slot devices,
  171. ; ensure you set your controls in the main MAME config file (MAME.ini), not the system one (ex. Atari 2600.ini).
  172. ;----------------------------------------------------------------------------
  173. StartModule()
  174. BezelGUI()
  175. FadeInStart()
  176.  
  177. ; This object controls how the module reacts to different systems. MAME can play a lot of systems, but needs to know what system you want to run, so this module has to adapt.
  178. mTypeVar=
  179. ( LTrim
  180. Aamber Pegasus|pegasus
  181. Acorn Electron|electron
  182. Amstrad GX4000|gx4000
  183. APF Imagination Machine|apfimag
  184. Apple IIGS|apple2gs
  185. Atari 8-bit|a800
  186. Atari 2600|a2600
  187. Atari 5200|a5200
  188. Atari 7800|a7800
  189. Atari Jaguar|jaguar
  190. Atari Lynx|lynx
  191. Bally Astrocade|astrocde
  192. Bandai WonderSwan|wswan
  193. Bandai WonderSwan Color|wscolor
  194. Casio PV-1000|pv1000
  195. Casio PV-2000|pv2000
  196. Coleco ADAM|adam
  197. ColecoVision|coleco
  198. Creatronic Mega Duck|megaduck
  199. Emerson Arcadia 2001|arcadia
  200. Entex Adventure Vision|advision
  201. Epoch Game Pocket Computer|gamepock
  202. Epoch Super Cassette Vision|scv
  203. Exidy Sorcerer|sorcerer
  204. Fairchild Channel F|channelf
  205. Funtech Super Acan|supracan
  206. GCE Vectrex|vectrex
  207. Hartung Game Master|gmaster
  208. Interton VC 4000|vc4000
  209. JungleTac Sport Vii|vii
  210. Magnavox Odyssey 2|odyssey2
  211. Matra & Hachette Alice|alice32
  212. Mattel Aquarius|aquarius
  213. Mattel Intellivision|intv
  214. Applied Technology MicroBee|mbeeic
  215. NEC PC Engine|pce
  216. NEC PC Engine-CD|pce
  217. NEC SuperGrafx|sgx
  218. NEC TurboGrafx-16|tg16
  219. NEC TurboGrafx-CD|tg16
  220. Nintendo 64|n64
  221. Nintendo Entertainment System|nes
  222. Nintendo Famicom|famicom
  223. Nintendo Famicom Disk System|fds
  224. Nintendo Game Boy|gameboy
  225. Nintendo Game Boy Advance|gba
  226. Nintendo Game Boy Color|gbcolor
  227. Nintendo Super Game Boy|supergb
  228. Nintendo Virtual Boy|vboy
  229. Philips CD-i|cdimono1
  230. RCA Studio II|studio2
  231. Sega 32X|32x
  232. Sega CD|segacd
  233. Sega Game Gear|gamegear
  234. Sega Genesis|genesis
  235. Sega Master System|sms
  236. Sega Mega Drive|megadriv
  237. Sega SG-1000|sg1000
  238. Sinclair ZX81|zx81
  239. SNK Neo Geo AES|aes
  240. SNK Neo Geo CD|neocdz
  241. SNK Neo Geo Pocket|ngp
  242. SNK Neo Geo Pocket Color|ngpc
  243. Sony PlayStation|psx
  244. Sony PocketStation|pockstat
  245. Sord M5|m5
  246. Super Nintendo Entertainment System|snes
  247. Tandy TRS-80 Color Computer|coco3
  248. Texas Instruments TI 99-4A|ti99_4a
  249. Tiger Game.com|gamecom
  250. Tomy Tutor|tutor
  251. VTech CreatiVision|crvision
  252. Watara Supervision|svision
  253. )
  254. mType := Object()
  255. Loop, Parse, mTypeVar, `n, `r
  256. {
  257. obj := {}
  258. Loop, Parse, A_LoopField, |
  259. If A_Index = 1
  260. obj.System := A_LoopField
  261. Else ; 2
  262. obj.mameID := A_LoopField
  263. mType.Insert(obj["System"], obj)
  264. }
  265. Log("Module - Finished building the " . MEmu . " object",4)
  266. ; For easier use throughout the module
  267. mameSystem := mType[systemName].System
  268. mameID := mType[systemName].mameID
  269.  
  270. If !mameSystem {
  271. Log("Module - """ . systemName . """ is not a known console or computer system. Defaulting to MAME's Arcade mode for the remainder of this " . MEmu . " module.",2)
  272. mameSystem := systemName
  273. mameID := "MAME"
  274. }
  275.  
  276. settingsFile := modulePath . "\" . moduleName . ".ini"
  277. Fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1) ; Set fullscreen mode
  278. legacyMode := IniReadCheck(settingsFile, "Settings|" . systemName . "|" . romName, "LegacyMode","false",,1)
  279. mameBiosPath := IniReadCheck(settingsFile, "Settings", "MAME_BIOS_Path", emuPath . "\roms",,1)
  280. Videomode := IniReadCheck(settingsFile, "Settings", "Videomode","d3d",,1) ; Choices are gdi,ddraw,d3d. If left blank, MAME uses d3d by default
  281. pauseMethod := IniReadCheck(settingsFile, "Settings", "PauseMethod",1,,1) ; set the pause method that works better on your machine (preferred methods 1 and 2) 1 = Win7 and Win8 OK - Problems with Win XP, 2 = preferred method for WinXP - Problems in Win7, 3 and 4 = same as 1 and 2, 5 = only use If you have a direct input version of mame, 6 = suspend mame process method, it could crash mame in some computers
  282. hlsl := IniReadCheck(settingsFile, "Settings|" . mameSystem . "|" . romName, "HLSL","false",,1)
  283. glsl := IniReadCheck(settingsFile, "Settings|" . mameSystem . "|" . romName, "GLSL","false",,1)
  284. bezelMode := IniReadCheck(settingsFile, "Settings|" . systemName . "|" . romName, "BezelMode","layout",,1) ; "layout" or "normal"
  285. verticalRotationMode := IniReadCheck(settingsFile, "Settings|" . mameSystem . "|" . romName, "VerticalRotationMode","none",,1)
  286. cheatMode := IniReadCheck(settingsFile, "Settings", "CheatMode","false",,1)
  287. cheatModeKey := IniReadCheck(settingsFile, "Settings", "CheatModeKey",A_Space,,1) ; user defined key to be held down before launching a mame rom.
  288. UseSoftwareList := IniReadCheck(settingsFile, mameSystem, "UseSoftwareList","false",,1)
  289. sysStaticParams := IniReadCheck(settingsFile, mameSystem, "StaticParameters", A_Space,,1)
  290. sysParams := IniReadCheck(settingsFile, mameSystem, "Parameters", A_Space,,1)
  291. romParams := IniReadCheck(settingsFile, romName, "Parameters", sysParams,,1)
  292. mameRomName := IniReadCheck(settingsFile, romName, "MameRomName", A_Space,,1)
  293. autosave := IniReadCheck(settingsFile, systemName . "|" . romName, "Autosave", "false",,1)
  294. volume := IniReadCheck(settingsFile, "Settings|" . systemName . "|" . romName, "Volume",,,1)
  295. Artwork_Crop := IniReadCheck(settingsFile, mameSystem . "|" . romName, "Artwork_Crop", "true",,1)
  296. Use_Bezels := IniReadCheck(settingsFile, mameSystem . "|" . romName, "Use_Bezels", "false",,1)
  297. Use_Overlays := IniReadCheck(settingsFile, mameSystem . "|" . romName, "Use_Overlays", "true",,1)
  298. Use_Backdrops := IniReadCheck(settingsFile, mameSystem . "|" . romName, "Use_Backdrops", "true",,1)
  299. Use_Cpanels := IniReadCheck(settingsFile, mameSystem . "|" . romName, "Use_Cpanels", "false",,1)
  300. Use_Marquees := IniReadCheck(settingsFile, mameSystem . "|" . romName, "Use_Marquees", "false",,1)
  301. inipath := IniReadCheck(settingsFile, mameSystem, "IniPath", "",,1)
  302. mameBiosPath := GetFullName(mameBiosPath)
  303.  
  304. ;Read settings from system name ini file
  305. sysSettingsFile := modulePath . "\" . mameSystem . ".ini"
  306. IfExist, %sysSettingsFile%
  307. {
  308. romParams := IniReadCheck(sysSettingsFile, romName, "Parameters", romParams,,1)
  309. hlsl := IniReadCheck(sysSettingsFile, romName, "HLSL",hlsl,,1)
  310. glsl := IniReadCheck(sysSettingsFile, romName, "GLSL",glsl,,1)
  311. Artwork_Crop := IniReadCheck(sysSettingsFile, romName, "Artwork_Crop", Artwork_Crop,,1)
  312. Use_Bezels := IniReadCheck(sysSettingsFile, romName, "Use_Bezels", Use_Bezels,,1)
  313. Use_Overlays := IniReadCheck(sysSettingsFile, romName, "Use_Overlays", Use_Overlays,,1)
  314. Use_Backdrops := IniReadCheck(sysSettingsFile, romName, "Use_Backdrops", Use_Backdrops,,1)
  315. Use_Cpanels := IniReadCheck(sysSettingsFile, romName, "Use_Cpanels", Use_Cpanels,,1)
  316. Use_Marquees := IniReadCheck(sysSettingsFile, romName, "Use_Marquees", Use_Marquees,,1)
  317. }
  318.  
  319. artworkCrop := If (Artwork_Crop = "true") ? " -artwork_crop" : " -noartwork_crop"
  320. useBezels := If (Use_Bezels = "true") ? " -use_bezels" : " -nouse_bezels"
  321. useOverlays := If (Use_Overlays = "true") ? " -use_overlays" : " -nouse_overlays"
  322. useBackdrops := If (Use_Backdrops = "true") ? " -use_backdrops" : " -nouse_backdrops"
  323. useCpanels := If (Use_Cpanels = "true") ? " -use_cpanels" : " -nouse_cpanels"
  324. useMarquees := If (Use_Marquees = "true") ? " -use_marquees" : " -nouse_marquees"
  325.  
  326. ; Get MAME version from executable, this is needed since some CLI switches are not available in older MAME versions
  327. exeAtrib := FileGetVersionInfo_AW( EmuPath . "\" . executable, "FileVersion|ProductVersion", "|" )
  328. Loop, Parse, exeAtrib, |%A_Tab%, %A_Space%
  329. A_Index & 1 ? ( _ := A_LoopField ) : ( %_% := A_LoopField )
  330. If (ProductVersion)
  331. StringRight, MAMEVersion, ProductVersion, StrLen(ProductVersion) - 2
  332. Log("Module - Detected MAME Product Version from '" . EmuPath . "\" . executable . "' is " . MAMEVersion)
  333.  
  334. If inipath
  335. inipath := AbsoluteFromRelative(EmuPath, inipath)
  336.  
  337. If (verticalRotationMode = "none")
  338. verticalRotationMode := ""
  339.  
  340. hideEmuObj := Object(dialogOpen . " ahk_class ConsoleWindowClass",0,"ahk_class MAME",1) ;Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
  341.  
  342. ; Process mame's ListXML for certain features
  343. If (bezelEnabled = "true" || servoStikEnabled != "false" || verticalRotationMode) {
  344. ListXMLObject := Object()
  345. ListXMLObject := ListXMLInfo(romName)
  346. If (bezelEnabled = "true") {
  347. If (bezelMode = "layout"){
  348. BezelStart("layout",ListXMLObject["Parent"].Value,ListXMLObject["Angle"].Value,romName)
  349. } Else { ;bezel mode = normal
  350. useBezels := " -nouse_bezels" ; force disabling MAME built-in bezels
  351. BezelStart(,,ListXMLObject["Angle"].Value)
  352. }
  353. }
  354. If (servoStikEnabled != "false") {
  355. ServoStik(If ListXMLObject["Ways"].Value <= 4 ? 4 : 8) ; If "ways" in the xml is set to 4 or less, the servo will go into 4-way mode, else 8-way mode will be enabled
  356. }
  357. If (verticalRotationMode && ListXMLObject["Angle"].Value) {
  358. If (verticalRotationMode = "original")
  359. verticalRotationMode := " -norotate"
  360. Else If (verticalRotationMode = "right")
  361. verticalRotationMode := " -ror"
  362. Else If (verticalRotationMode = "left")
  363. verticalRotationMode := " -rol"
  364. Else
  365. verticalRotationMode := ""
  366. }
  367. Else
  368. verticalRotationMode := ""
  369. }
  370.  
  371. 7z(romPath, romName, romExtension, 7zExtractPath)
  372.  
  373. winstate := If (Fullscreen = "true") ? "Hide UseErrorLevel" : "UseErrorLevel"
  374. fullscreen := If (Fullscreen = "true") ? " -nowindow" : " -window"
  375. If (Videomode = "opengl")
  376. {
  377. hlsl := " -nohlsl_enable"
  378. If (MAMEVersion > 159)
  379. glsl := If glsl = "true" ? " -gl_glsl" : (If glsl = "ini" ? "" : " -nogl_glsl")
  380. Else
  381. glsl := ""
  382. }
  383. Else
  384. {
  385. hlsl := If hlsl = "true" ? " -hlsl_enable" : (If hlsl = "ini" ? "" : " -nohlsl_enable")
  386. If (MAMEVersion > 159)
  387. glsl := If Videomode = "ini" ? "" : " -nogl_glsl"
  388. Else
  389. glsl := ""
  390.  
  391. If (Videomode = "ini")
  392. Videomode := ""
  393. }
  394. videomode := If (Videomode != "" ) ? " -video " . videomode : ""
  395. param1 := " -cart """ . romPath . "\" . romName . romExtension . """" ; default param1 used for launching most systems.
  396. autosave := If autosave = "true" ? " -autosave" : ""
  397. volume := If volume != "" ? " -volume " . volume : ""
  398. inipath := If inipath != "" ? " -inipath """ . inipath . """" : ""
  399.  
  400. If romExtension = .txt ; This can be applied to all systems
  401. param1:=
  402.  
  403. If mameID = apfimag ; APF Imagination Machine
  404. If romExtension != .tap
  405. mameID = apfm1000 ; cart games for APF Imagination Machine require a different bios to be loaded
  406.  
  407. If UseSoftwareList != true
  408. { ; Now that we know the system we are loading, determine if we use an ini assocated with that system for custom game configs a user might need. Then load the configs associated to that game.
  409. If mameID in ti99_4a,aes,apple2gs,electron,mbeeic,odyssey2 ; these systems will use an ini to store game specific settings
  410. { mameSysINI := CheckFileMAME(modulePath . "\" . mameSystem . ".ini") ; create the ini if it does not exist
  411. If mameID = ti99_4a ; Texas Instruments TI 99-4A
  412. { mainCart := IniReadCheck(mameSysINI, romName, "Main_Cart",A_Space,,1)
  413. basicCart := IniReadCheck(mameSysINI, romName, "Basic_Cart","extended_basic.rpk",,1) ; user can specify a rom specific cart instead of the default basic one
  414. expansionLocation := IniReadCheck(mameSysINI, romName, "Expansion_Location","extended_basic.rpk",,1)
  415. ; Now set the parameters to send to MAME
  416. If romExtension = .dsk ; Expansion Disk
  417. ; If using the mainCart , send expansionLocation to MAME. This will require DirectInput to be enabled on the MAME build! Else we are loading a Disk game
  418. param1 := " -gromport multi -cart1", param2:=" """ . romPath . "\" . (If mainCart ? (mainCart):(basicCart)) . """", param3:=" -peb:slot2 32kmem -peb:slot3 speech -peb:slot6 tirs232 -peb:slot8 hfdc", param4:=" -flop1", param5:=" """ . romPath . "\" . romName . romExtension . """"
  419. Else If romExtension = .rpk ; Cart Game (RPK Format)
  420. param1 := " -gromport single -cart1", param2:=" """ . romPath . "\" . romName . romExtension . """", param3:=" -peb:slot3 speech" ;-cart will also work here
  421. param6 := " -ui_active" ;Enable partial keyboard mode at startup
  422. } Else If mameID = aes ; SNK Neo Geo AES
  423. { biosRegion := IniReadCheck(mameSysINI, romName, "BIOS_Region","asia",,1)
  424. param1 := " -bios " . biosRegion ; can also be japan, but the asian one has english menus for most games
  425. param2 := " -cart " . romName
  426. }Else if mameID = apple2gs ; Apple IIGS
  427. { externalOS := IniReadCheck(mameSysINI, romName, "External_OS","false",,1)
  428. 2gsSystemFile := "System6.2mg" ;For games without OS included, always force this name and error out if not found
  429. multipartTable := CreateRomTable(multipartTable)
  430.  
  431. If externalOS = true
  432. { CheckFile(romPath . "\" . 2gsSystemFile)
  433. param1 := " -flop3", param2:=" """ . romPath . "\" . 2gsSystemFile . """", param3:=" -flop4", param4:=" """ . romPath . "\" . romName . romExtension . """"
  434. }Else{
  435. param1 := " -flop3", param2:=" """ . romPath . "\" . romName . romExtension . """"
  436. If (multipartTable.MaxIndex() > 1)
  437. param3:=" -flop4", param4 := " """ . multipartTable[2,1] . """"
  438. }
  439. param5 := " -ui_active" ;Enable partial keyboard mode at startup
  440. }Else If mameID = electron ; Acorn Electron
  441. { AutoBootDelay := IniReadCheck(mameSysINI, "Settings", "AutoBootDelay","2",,1) ; Read delay from config.
  442. AutoBootDelay := " -autoboot_delay " . AutoBootDelay
  443. If romExtension = .bin
  444. mediaDeviceType := "cart"
  445. Else ; any other format
  446. mediaDeviceType := "cass"
  447. param1 := " -" . mediaDeviceType . " """ . romPath . "\" . romName . romExtension . """ -autoboot_command ""chain""""""""""""\n""" . AutoBootDelay . ""
  448. }Else If mameID = mbeeic ; Applied Technology MicroBee
  449. { microbeeModel := IniReadCheck(mameSysINI, romName, "MicroBee_Model","mbeeic",,1)
  450. If microbeeModel not in mbee,mbeeic,mbeepc,mbeepc85,mbee56
  451. ScriptError("This is not a known MicroBee model value: " . microbeeModel)
  452. Else If (microbeeModel != "mbeeic")
  453. mameID := microbeeModel
  454. If romExtension in .mwb,.com,.bee
  455. mediaDeviceType := "quik1"
  456. Else If romExtension in .wav,.tap
  457. mediaDeviceType := "cass"
  458. Else If romExtension in .rom
  459. mediaDeviceType := "cart"
  460. Else If romExtension in .dsk
  461. mediaDeviceType := "flop1"
  462. Else ; .bin format
  463. mediaDeviceType := "quik2"
  464. param1 := " -" . mediaDeviceType . " """ . romPath . "\" . romName . romExtension . """"
  465. }Else if mameID = odyssey2 ; Magnavox Odyssey 2
  466. param2 := " -ui_active" ;Enable partial keyboard mode at startup
  467. ;Use a different bios if needed (This must be done after the above if conditions since the mameID will change)
  468. iniBios := IniReadCheck(mameSysINI, romName, "Bios",mameID,,1) ; for all games, we use the default bios. Some games might require different bios like Odyssey2's Jopac games use the videopac bios instead, which should be defined in the ini
  469. If (iniBios != "")
  470. mameID := iniBios ; need to change the bios name for some games
  471. }
  472.  
  473. ; These systems don't use an ini, but do require parameters to be changed from the default method of launching MAME
  474. If (mameID = "neocdz" || mameID = "cdimono1" || mameID = "segacd" || mameID = "psx" || (mameID = "tg16" && mameSystem = "NEC TurboGrafx-CD") || (mameID = "pce" && mameSystem = "NEC PC Engine-CD")) ; SNK Neo Geo CD, Philips CD-i, Sega CD, Sony PlayStation, NEC PC Engine-CD or NEC TurboGrafx-CD
  475. { If romExtension not in .chd,.cue
  476. ScriptError("MAME only supports " . mameSystem . " games in chd and cue format. It does not support:`n" . romExtension)
  477. If (mameSystem = "NEC TurboGrafx-CD") { ; NEC TurboGrafx-CD needs an additional bios mounted as a cart to run
  478. ; tgcdBios := CheckFile(emuPath . "\roms\CD-ROM System V2.01 (U).pce") ; older bios that doesn't seem to work with many games
  479. tgcdBios := CheckFile(emuPath . "\roms\Super CD-ROM2 System V3.01 (U).pce")
  480. param2 := " -cart " . """" . tgcdBios . """"
  481. } Else If (mameSystem = "NEC PC Engine-CD") { ; NEC PC Engine-CD needs an additional bios mounted as a cart to run
  482. pcecdBios := CheckFile(emuPath . "\roms\Super CD-ROM2 System V3.0 (J).pce")
  483. param2 := " -cart " . """" . pcecdBios . """"
  484. } Else If (mameID = "psx") { ; Sony PlayStation
  485. mameID = psu ; changing mameID sent to MAME to use the USA bios
  486. ; SelectMemCard() ; future function to swap around memcards
  487. ; Usage: mc1 "J:\MAME\software\psu\card1.mc"
  488. } If (mameSystem = "Sega CD") { ;
  489. If InStr(romName,"(Jap") ; Mega CD Japanese v2
  490. mameID = megacd2j
  491. Else If InStr(romName,"(Euro") ; Mega CD European (PAL)
  492. mameID = megacd
  493. }
  494. param1 := " -cdrm """ . romPath . "\" . romName . romExtension . """"
  495. }Else If mameID = gamecom ; Tiger Game.com
  496. { If romExtension != .txt
  497. param1 := " -cart1 """ . romPath . "\" . romName . romExtension . """"
  498. }Else If mameID = genesis ; Sega Genesis
  499. { If (InStr(romName, "(Europe") || InStr(romName, "(PAL")) ; if rom is from europe, tell MAME to boot a Mega Drive instead
  500. mameID = megadriv
  501. }Else If mameID = megadriv ; Sega Mega Drive
  502. { If (InStr(romName, "(USA") || InStr(romName, "(NTSC")) ; if rom is from America, tell MAME to boot a Genesis instead
  503. mameID = genesis
  504. }Else If mameID = vii ; JungleTac Sport Vii
  505. { If romName = Built-In Games (China) ; Has some built-in games, gotta launch just BIOS for it.
  506. param1:=
  507. }Else If mameID = alice32 ; Matra & Hachette Alice
  508. { If romExtension != .txt
  509. param1 := " -cass1 """ . romPath . "\" . romName . romExtension . """"
  510. }Else If mameID = pockstat ; Sony PocketStation
  511. { If romExtension != .gme
  512. param1 := " -cart1 """ . romPath . "\" . romName . romExtension . """"
  513. }Else If mameID = coco3 ; Tandy TRS-80 Color Computer
  514. { If romExtension != .txt
  515. param1 := " -cart """ . romPath . "\" . romName . romExtension . """"
  516. }Else If mameID = zx81 ; Sinclair ZX81
  517. { If romExtension != .txt
  518. param1 := " -cass1 """ . romPath . "\" . romName . romExtension . """"
  519. }Else If mameID = sorcerer ; Exidy Sorcerer
  520. { If romExtension = .snp ; Snapshot file
  521. param1 := " -dump """ . romPath . "\" . romName . romExtension . """"
  522. Else If romExtension = .bin
  523. param1 := " -quik """ . romPath . "\" . romName . romExtension . """"
  524. }Else If (mameID = "a800" || mameID = "fds" || mameID = "samcoupe") ; Atari 8-bit, Nintendo Famicom Disk System, and MGT Sam Coupe
  525. { If romExtension != .txt
  526. param1 := " -flop1 """ . romPath . "\" . romName . romExtension . """"
  527. }Else If mameID = vectrex ; GCE Vectrex
  528. { If romName = Mine Storm (World) ; MAME dumps an error if you try to launch Mine Storm using a rom instead of just booting vectrex w/o a game in it (Mine Storm is built into vectrex)
  529. param1:=
  530. }Else If mameID = apfm1000 ; APF Imagination Machine/APF M1000
  531. { If romName = Rocket Patrol (USA) ; Rocket Patrol is built into the APF M1000 ROM.
  532. param1:=
  533. }Else If mameID = adam ; Coleco ADAM
  534. param1 := (If romExtension = ".ddp" ? " -cass1" : " -floppydisk") . " """ . romPath . "\" . romName . romExtension . """" ; Decide if disk or ddp game
  535. Else If mameID = pegasus ; Aamber Pegasus
  536. { If romExtension != .txt
  537. param1 := " -cart1 """ . romPath . "\" . romName . romExtension . """"
  538. }
  539. }Else{ ; Use Software List
  540. hashname := mameID
  541. param1 := " " . romName ; param1 used for launching from software lists
  542.  
  543. If mameID = aes ; SNK Neo Geo AES
  544. { hashname := "neogeo"
  545. biosRegion := IniReadCheck(mameSysINI, romName, "BIOS_Region","asia",,1)
  546. param2 := " -bios " . biosRegion ; can also be japan, but the asian one has english menus for most games
  547. }
  548. CheckFile(emuPath . "\hash\" . hashname . ".xml","Could not find a software list for the system " . mameID) ;Check if software list for selected system exists
  549. }
  550.  
  551. If mameID = vectrex ; GCE Vectrex
  552. param2 := " -view " . (If (FileExist(emuPath . "\artwork\Vectrex\" . romName . ".png"))?("""" . romName . """"):"standard") ; need overlays extracted in the artwork\vectres folder. PNGs must match romName
  553.  
  554. sysStaticParams := If sysStaticParams != "" ? A_Space . sysStaticParams : "" ; tacking on a space in case user forgot to add one
  555. romParams := If romParams != "" ? A_Space . romParams : "" ; tacking on a space in case user forgot to add one
  556.  
  557. StringReplace,mameRomPaths,romPathFromIni,|,`"`;`",1 ; replace all instances of | to ; in the Rom_Path from RL's Emulators.ini so MAME knows where to find your roms
  558. mameRomPaths := " -rompath """ . (If mameRomName ? romPath : mameRomPaths) . (If mameBiosPath ? ";" . mameBiosPath : "") . """" ; If using an alt rom, only supply mame with the path to that rom so it doesn't try to use the original rom. If a bios path was supplied, add it into the rom paths sent to MAME
  559.  
  560. If InStr(romParams,"-rompath")
  561. ScriptError("""-rompath"" is defined as a parameter for " . romName . ". The MAME module fills this automatically so please remove this from Params in the module's settings.")
  562. If InStr(sysStaticParams,"-rompath")
  563. ScriptError("""-rompath"" is defined as a parameter for " . mameSystem . ". The MAME module fills this automatically so please remove this from Params in the module's settings.")
  564.  
  565. If mameRomName {
  566. FileMove, %romPath%\%romName%%romExtension%, %romPath%\%mameRomName%%romExtension% ; rename rom to match what mame needs
  567. originalRomName := romName ; store romName from database so we know what to rename it back to later
  568. romName := mameRomName
  569. If ErrorLevel
  570. ScriptError("There was a problem renaming " . romName . " to " . mameRomName . " in " . romPath . ". Please check you have write permission to this folder/file and you don't already have a file named """ . mameRomName . """ in your rom folder.",8)
  571. Else ; if rename was successful, set var so we know to move it back later
  572. fileRenamed = 1
  573. }
  574.  
  575. ; use a custom cfg file if it exists and append it to param1
  576. IfExist, % emuPath . "\cfg\" . mameID . "\" . dbName
  577. param1 := " -cfg_directory " . """" . emuPath . "\cfg\" . mameID . "\" . dbName . """" . param1
  578.  
  579. If cheatMode = true
  580. { If (!FileExist(emuPath . "\cheat.zip") && !FileExist(emuPath . "\cheat.7z"))
  581. ScriptError("You have cheats enabled for " . MEmu . " but could not locate a ""cheat.zip"" or ""cheat.7z"" in " . emuPath)
  582. If cheatModeKey ; if user wants to use a key to enable CheatMode
  583. cheatEnabled := If XHotkeyAllKeysPressed(cheatModeKey) ? " -cheat" : "" ; only enables cheatMode when key is held down on launch
  584. Else ; no cheat mode key defined
  585. cheatEnabled := " -cheat"
  586. }
  587.  
  588. HideEmuStart()
  589.  
  590. If legacyMode = true
  591. { Log("Module - Running MAME in legacy Mmde")
  592. errLvl := Run(executable . A_Space . (If mameID = "MAME" ? romName : mameID . param1 . param2 . param3 . param4 . param5 . param6) . fullscreen . cheatEnabled . volume . mameRomPaths . sysStaticParams . romParams, emuPath, winstate)
  593. } Else {
  594. Log("Module - Running MAME in non-legacy mode")
  595. errLvl := Run(executable . A_Space . (If mameID = "MAME" ? romName : mameID . param1 . param2 . param3 . param4 . param5 . param6) . mameRomPaths . sysStaticParams . romParams . fullscreen . hlsl . glsl . cheatEnabled . volume . inipath . verticalRotationMode . videomode . artworkCrop . useBezels . useOverlays . useBackdrops . useCpanels . useMarquees . autosave . " -skip_gameinfo", emuPath, winstate)
  596. }
  597.  
  598. If errLvl {
  599. If (errLvl = 1)
  600. Error = Failed Validity
  601. Else If(errLvl = 2)
  602. Error = Missing Files
  603. Else If(errLvl = 3)
  604. Error = Fatal Error
  605. Else If(errLvl = 4)
  606. Error = Device Error
  607. Else If(errLvl = 5)
  608. Error = Game Does Not Exist
  609. Else If(errLvl = 6)
  610. Error = Invalid Config
  611. Else If errLvl in 7,8,9
  612. Error = Identification Error
  613. Else
  614. Error = MAME Error
  615. Log("MAME Error - " . Error,3)
  616. }
  617.  
  618. WinWait("ahk_class MAME")
  619. WinWaitActive("ahk_class MAME")
  620.  
  621. BezelDraw()
  622.  
  623. If romName = ICBMromName ; for Bally Astrocade only
  624. { Sleep, 2000 ; increase if you don't see the title screen
  625. SetKeyDelay(50)
  626. Send, {F3 down}{F3 up} ; sends a reset to MAME, needed for ICBM to boot
  627. }
  628.  
  629. HideEmuEnd()
  630. FadeInExit()
  631. Process("WaitClose", executable)
  632. 7zCleanUp()
  633. BezelExit()
  634.  
  635. If fileRenamed { ; rename file back to alternate name for next launch
  636. FileMove, %romPath%\%romName%%romExtension%, %romPath%\%originalRomName%%romExtension%
  637. If ErrorLevel ; if rename was successful, set var so we know to move it back later
  638. ScriptError("There was a problem renaming " . romName . " back to " . originalRomName)
  639. }
  640.  
  641. FadeOutExit()
  642. ExitModule()
  643.  
  644.  
  645. ; This will simply create a new blank ini if one does not exist
  646. CheckFileMAME(file){
  647. IfNotExist, %file%
  648. FileAppend,, %file%
  649. Return file
  650. }
  651.  
  652. ListXMLInfo(rom){ ; returns MAME info about parent rom, orientation angle, resolution
  653. Global emuFullPath, emuPath
  654. ListXMLObject := Object()
  655. listXMLVarLog :=
  656. RunWait, % comspec . " /c " . """" . emuFullPath . """" . " -listxml " . rom . " > tempBezel.txt", %emuPath%, Hide
  657. Fileread, ListxmlContents, %emuPath%\tempBezel.txt
  658. RegExMatch(ListxmlContents, "s)<game.*name=" . """" . rom . """" . ".*" . "cloneof=" . """" . "[^""""]*", parent)
  659. RegExMatch(parent,"cloneof=" . """" . ".*", parent)
  660. RegExMatch(parent,"""" . ".*", parent)
  661. StringTrimLeft, parent, parent, 1
  662. RegExMatch(ListxmlContents, "s)<display.*rotate=" . """" . "[0-9]+" . """", angle)
  663. RegExMatch(angle,"[0-9]+", angle, "-6")
  664. RegExMatch(ListxmlContents, "s)<display.*width=" . """" . "[0-9]+" . """", width)
  665. RegExMatch(width,"[0-9]+", width, "-6")
  666. RegExMatch(ListxmlContents, "s)<display.*height=" . """" . "[0-9]+" . """", Height)
  667. RegExMatch(Height,"[0-9]+", Height, "-6")
  668. RegExMatch(ListxmlContents, "s)<control.*ways=" . """" . "[0-9]+" . """", Ways)
  669. RegExMatch(Ways,"[0-9]+", Ways, "-6")
  670. logVars := "Parent|Angle|Height|Width|Ways"
  671. Loop, Parse, logVars, |
  672. {
  673. currentobj:={}
  674. currentobj.Label := A_Loopfield
  675. currentobj.Value := %A_Loopfield%
  676. ListXMLObject.Insert(currentobj["Label"], currentobj)
  677. listXMLLog .= "`r`n`t`t`t`t`t" . currentobj["Label"] . " = " . currentobj["Value"]
  678. }
  679. Log("Module - MAME ListXML values: " . listXMLLog,5)
  680. If (ListXMLObject["Height"].Value > ListXMLObject["Width"].Value) {
  681. ListXMLObject["Angle"].Value := true
  682. Log("Module - This game's height is greater than its width, forcing vertical mode",5)
  683. }
  684. FileDelete, %emuPath%\tempBezel.txt
  685. Return ListXMLObject
  686. }
  687.  
  688. BezelLabel:
  689. WinSet, Transparent, 0, ahk_class ConsoleWindowClass
  690. Return
  691.  
  692. HaltEmu:
  693. If pauseMethod = 1
  694. { disableSuspendEmu = true
  695. disableRestoreEmu = true
  696. PostMessage,0x211, 1, , , ahk_class MAME
  697. } Else If pauseMethod = 2
  698. { disableSuspendEmu = true
  699. PostMessage,0x211, 1, , , ahk_class MAME
  700. } Else If pauseMethod = 3
  701. { disableSuspendEmu = true
  702. disableRestoreEmu = true
  703. PostMessage,% 0x0400+6, 1, , , ahk_class MAME
  704. } Else If pauseMethod = 4
  705. { disableSuspendEmu = true
  706. PostMessage,% 0x0400+6, 1, , , ahk_class MAME
  707. } Else If pauseMethod = 5
  708. { disableSuspendEmu = true
  709. Send, {P down}
  710. Sleep, 1000
  711. Send, {P up}
  712. }
  713. Return
  714. RestoreEmu:
  715. If pauseMethod = 1
  716. { PostMessage,0x212, 1, , , ahk_class MAME
  717. WinActivate, ahk_class MAME
  718. } Else If pauseMethod = 2
  719. { PostMessage,0x212, 1, , , ahk_class MAME
  720. WinActivate, ahk_class MAME
  721. } Else If pauseMethod = 3
  722. { PostMessage,% 0x0400+6, 0, , , ahk_class MAME
  723. WinActivate, ahk_class MAME
  724. } Else If pauseMethod = 4
  725. { PostMessage,% 0x0400+6, 0, , , ahk_class MAME
  726. WinActivate, ahk_class MAME
  727. } Else If pauseMethod = 5
  728. { disableSuspendEmu = true
  729. Send, {P down}
  730. Sleep, 1000
  731. Send, {P up}
  732. WinActivate, ahk_class MAME
  733. } Else If pauseMethod = 6
  734. WinActivate, ahk_class MAME
  735. Return
  736.  
  737. CloseProcess:
  738. FadeOutStart()
  739. WinClose("ahk_class MAME")
  740. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement