Advertisement
djvj

Untitled

Oct 12th, 2015
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 50.85 KB | None | 0 0
  1. MEmu = MAME
  2. MEmuV = v0.163
  3. MURL = http://www.mame.net/
  4. MAuthor = djvj,faahrev,brolly,Tomkun
  5. MVersion = 2.2.2
  6. MCRC = 99BD11E0
  7. iCRC = BCD207F4
  8. mId = 635746812784197028
  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 Super Vision 8000","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","GamePark 32","GCE Vectrex","Hartung Game Master","HBMAME","Interton VC 4000","Irem Classics","JungleTac Sport Vii","Konami Classics","LaserDisc","Magnavox Odyssey 2","MAME","Matra & Hachette Alice","Mattel Aquarius","Mattel Intellivision","MGT Sam Coupe","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 Pokemon Mini","Nintendo Satellaview","Nintendo Super Famicom","Nintendo Super Game Boy","Nintendo Virtual Boy","Othello Multivision","PacMAME","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","Williams Classics"
  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. ; Aamber Pegasus - pegasus
  29. ; Acorn Electron - electron
  30. ; Amstrad GX4000 - gx4000
  31. ; APF Imagination Machine - apfimag (tape games), apfm1000 (cart games)
  32. ; Apple IIGS - apple2gs
  33. ; Atari 8-bit - a800
  34. ; Atari 2600 - a2600
  35. ; Atari 5200 - a5200
  36. ; Atari 7800 - a7800
  37. ; Atari Jaguar - jaguar
  38. ; Atari Lynx - lynx
  39. ; Bally Astrocade - astrocde
  40. ; Bandai Super Vision 8000 - sv8000
  41. ; Bandai WonderSwan - wswan
  42. ; Bandai WonderSwan Color - wscolor
  43. ; Casio PV-1000 - pv1000
  44. ; Casio PV-2000 - pv2000
  45. ; Coleco ADAM - adam, adam_ddp, adam_fdc, adam_kb, adam_prn, adam_spi
  46. ; ColecoVision - coleco
  47. ; Creatronic Mega Duck - megaduck
  48. ; Emerson Arcadia 2001 - arcadia
  49. ; Entex Adventure Vision - advision
  50. ; Epoch Game Pocket Computer - gamepock
  51. ; Epoch Super Cassette Vision - scv
  52. ; Exidy Sorcerer - sorcerer
  53. ; Fairchild Channel F - channelf
  54. ; Funtech Super ACan - supracan
  55. ; GamePark 32 - gp32
  56. ; GCE Vectrex - vextrex
  57. ; Hartung Game Master - gmaster
  58. ; Interton VC 4000 - vc4000
  59. ; JungleTac Sport Vii - vii
  60. ; Magnavox Odyssey 2 - odyssey2
  61. ; Matra & Hachette Alice - alice32
  62. ; Mattel Aquarius - aquarius
  63. ; Mattel Intellivision - intv ("exec.bin" [8,192 bytes] & "grom.bin" [2,048 bytes])
  64. ; Applied Technology MicroBee - mbeeic
  65. ; MGT Sam Coupe - samcoupe
  66. ; NEC PC Engine - pce
  67. ; NEC PC Engine-CD - pce
  68. ; NEC SuperGrafx - sgx
  69. ; NEC TurboGrafx-16 - tg16
  70. ; NEC TurboGrafx-CD - "Super CD-ROM2 System V3.01 (U).pce" [262,144 bytes] (placed in the roms subfolder in the emuPath)
  71. ; Nintendo 64 - n64
  72. ; Nintendo Entertainment System - nes
  73. ; Nintendo Famicom - famicom
  74. ; Nintendo Famicom Disk System - fds
  75. ; Nintendo Game Boy - gameboy
  76. ; Nintendo Game Boy Advance - gba
  77. ; Nintendo Game Boy Color - gbcolor
  78. ; Nintendo Pokemon Mini - pokemini
  79. ; Nintendo Satellaview - snes
  80. ; Nintendo Super Famicom - snes
  81. ; Nintendo Super Game Boy - supergb
  82. ; Nintendo Virtual Boy - vboy
  83. ; Othello Multivision - omv1000
  84. ; Philips CD-i - the cdimono1
  85. ; RCA Studio II - studio2
  86. ; Sega 32X - 32x
  87. ; Sega CD - segacd, megacd, megacd2j (megacd2j seems to be more compatible over megacdj)
  88. ; Sega Game Gear - gamegear
  89. ; Sega Genesis - genesis
  90. ; Sega Master System - sms
  91. ; Sega Mega Drive - megadriv
  92. ; Sega SG-1000 - sg1000
  93. ; Sinclair ZX81 - zx81
  94. ; SNK Neo Geo AES - aes
  95. ; SNK Neo Geo CD - neocd
  96. ; SNK Neo Geo Pocket - ngp
  97. ; SNK Neo Geo Pocket Color - ngpc
  98. ; Sony PlayStation - psa, pse, psj, psu
  99. ; Sony PocketStation - pockstat
  100. ; Sord M5 - m5
  101. ; Super Nintendo Entertainment System - snes
  102. ; Tandy TRS-80 Color Computer - coco3
  103. ; Texas Instruments TI 99-4A - ti99_4a
  104. ; Tiger Game.com - gamecom
  105. ; Tomy Tutor - tutor
  106. ; VTech CreatiVision - crvision
  107. ; Watara Supervision - svision
  108. ;
  109. ; Custom Configuration Files:
  110. ; 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:
  111. ; cfg\mame_system_name\database_rom_name\mame_system_name.cfg
  112. ; An example of a game that requires specific settings is ICBM Attack for the Bally Astrocade, in this case special cfg file should be:
  113. ; cfg\astrocde\I.C.B.M. Attack (USA) (Unl)\astrocde.cfg
  114. ;
  115. ; Ini Files:
  116. ; 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
  117. ; those. MAME supports a hierarchical ini file structure and will load settings from several ini files following a specific order:
  118. ;- mame.ini
  119. ;- <mymame>.ini (i.e. if MAME was renamed mame060.exe, MAME parses mame060.ini here)
  120. ;- debug.ini (if the debugger is enabled)
  121. ;- <parent>.ini (for clones only, may be called recursively)
  122. ;- <gamename>.ini
  123. ;- vertical.ini (for games with vertical monitor orientation)
  124. ;- horizont.ini (for games with horizontal monitor orientation)
  125. ;- vector.ini (for vector games only)
  126. ;- <driver>.ini (based on the source filename of the driver)
  127. ;
  128. ; The settings in the later ini's override those in the earlier ini's.
  129. ;
  130. ; It's highly recommended that you set skipchecks to 'Rom Only" for MAME otherwise RocketLauncher won't be able to launch several games due
  131. ; to the way MAME roms are packaged. This will be even more noticeable for those using merged sets.
  132. ;
  133. ; Bally Astrocade:
  134. ; 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
  135. ; Other games might require this as well, you can enable this in the module's settings so the machine is reset automatically on launch, otherwise you need to press F3 to start the game.
  136. ; Also ICBM Attack 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.
  137. ;
  138. ; GCE Vectrex:
  139. ; Requires a vectrex.lay and a png overlay for each game. These all need to be placed in the MAME\artwork\vectrex folder.
  140. ; 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.
  141. ;
  142. ; Magnavox Odyssey 2:
  143. ; Euro games should use the videopac bios instead of the odyssey2 one or you'll get some timing issues.
  144. ; Use the systemName ini file in the folder with this module for this, example:
  145. ; [Moto-Crash (France)]
  146. ; Bios=videopac
  147. ;
  148. ; Texas Instruments TI 99/4A:
  149. ; This system requires full keyboard emulation to work properly
  150. ; 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)
  151. ; You can check how to convert split cart dumps to RPK here:
  152. ; http://www.ninerpedia.org/index.php/MESS_multicart_system
  153. ; 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"
  154.  
  155. ; Bezels:
  156. ; Module settings control whether RocketLauncher or MAME bezels are shown
  157. ; In the bezel normal mode only RocketLauncher Bezels will be show and the MAME use_bezels option will be forced disbaled
  158. ; 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
  159. ;
  160. ; ServoStik:
  161. ; The module will automatically control any connected ServoStiks found on the system.
  162. ; 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.
  163. ;
  164. ; Per game controller types:
  165. ; 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
  166. ; system so to avoid adding a huge complexity to the module this must be done through the Parameters settings.
  167. ; 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
  168. ; 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.
  169. ; This is an example for Atari 2600 for a game using wheel controllers on both joy ports:
  170. ; #
  171. ; # SLOT DEVICES
  172. ; #
  173. ; joyport1 wheel
  174. ; joyport2 wheel
  175. ; 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
  176. ; set Parameters=-joyport1 joy -joyport2 joy
  177. ; 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
  178. ; Parameters=-joyport1 wheel -joyport2 wheel
  179. ;
  180. ; Another option is to set the default values in the MAME ini file and make sure you also set writeconfig to 0.
  181. ; 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,
  182. ; ensure you set your controls in the main MAME config file (MAME.ini), not the system one (ex. Atari 2600.ini).
  183. ;----------------------------------------------------------------------------
  184. StartModule()
  185. BezelGUI()
  186.  
  187. ; 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.
  188. mTypeVar=
  189. ( LTrim
  190. Aamber Pegasus|pegasus
  191. Acorn Electron|electron
  192. Amstrad GX4000|gx4000
  193. APF Imagination Machine|apfimag
  194. Apple IIGS|apple2gs
  195. Atari 8-bit|a800
  196. Atari 2600|a2600
  197. Atari 5200|a5200
  198. Atari 7800|a7800
  199. Atari Jaguar|jaguar
  200. Atari Lynx|lynx
  201. Bally Astrocade|astrocde
  202. Bandai Super Vision 8000|sv8000
  203. Bandai WonderSwan|wswan
  204. Bandai WonderSwan Color|wscolor
  205. Casio PV-1000|pv1000
  206. Casio PV-2000|pv2000
  207. Coleco ADAM|adam
  208. ColecoVision|coleco
  209. Creatronic Mega Duck|megaduck
  210. Emerson Arcadia 2001|arcadia
  211. Entex Adventure Vision|advision
  212. Epoch Game Pocket Computer|gamepock
  213. Epoch Super Cassette Vision|scv
  214. Exidy Sorcerer|sorcerer
  215. Fairchild Channel F|channelf
  216. Funtech Super Acan|supracan
  217. GamePark 32|gp32
  218. GCE Vectrex|vectrex
  219. Hartung Game Master|gmaster
  220. Interton VC 4000|vc4000
  221. JungleTac Sport Vii|vii
  222. Magnavox Odyssey 2|odyssey2
  223. Matra & Hachette Alice|alice32
  224. Mattel Aquarius|aquarius
  225. Mattel Intellivision|intv
  226. MGT Sam Coupe|samcoupe
  227. Applied Technology MicroBee|mbeeic
  228. NEC PC Engine|pce
  229. NEC PC Engine-CD|pce
  230. NEC SuperGrafx|sgx
  231. NEC TurboGrafx-16|tg16
  232. NEC TurboGrafx-CD|tg16
  233. Nintendo 64|n64
  234. Nintendo Entertainment System|nes
  235. Nintendo Famicom|famicom
  236. Nintendo Famicom Disk System|fds
  237. Nintendo Game Boy|gameboy
  238. Nintendo Game Boy Advance|gba
  239. Nintendo Game Boy Color|gbcolor
  240. Nintendo Pokemon Mini|pokemini
  241. Nintendo Satellaview|snes
  242. Nintendo Super Famicom|snes
  243. Nintendo Super Game Boy|supergb
  244. Nintendo Virtual Boy|vboy
  245. Othello Multivision|omv1000
  246. Philips CD-i|cdimono1
  247. RCA Studio II|studio2
  248. Sega 32X|32x
  249. Sega CD|segacd
  250. Sega Game Gear|gamegear
  251. Sega Genesis|genesis
  252. Sega Master System|sms
  253. Sega Mega Drive|megadriv
  254. Sega SG-1000|sg1000
  255. Sinclair ZX81|zx81
  256. SNK Neo Geo AES|aes
  257. SNK Neo Geo CD|neocdz
  258. SNK Neo Geo Pocket|ngp
  259. SNK Neo Geo Pocket Color|ngpc
  260. Sony PlayStation|psx
  261. Sony PocketStation|pockstat
  262. Sord M5|m5
  263. Super Nintendo Entertainment System|snes
  264. Tandy TRS-80 Color Computer|coco3
  265. Texas Instruments TI 99-4A|ti99_4a
  266. Tiger Game.com|gamecom
  267. Tomy Tutor|tutor
  268. VTech CreatiVision|crvision
  269. Watara Supervision|svision
  270. )
  271. mType := Object()
  272. Loop, Parse, mTypeVar, `n, `r
  273. {
  274. obj := {}
  275. Loop, Parse, A_LoopField, |
  276. If A_Index = 1
  277. obj.System := A_LoopField
  278. Else ; 2
  279. obj.mameID := A_LoopField
  280. mType.Insert(obj["System"], obj)
  281. }
  282. Log("Module - Finished building the " . MEmu . " object",4)
  283. ; For easier use throughout the module
  284. mameSystem := mType[systemName].System
  285. mameID := mType[systemName].mameID
  286.  
  287. If !mameSystem {
  288. 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)
  289. mameSystem := systemName
  290. mameID := "MAME"
  291. }
  292.  
  293. settingsFile := modulePath . "\" . moduleName . ".ini"
  294. Fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1) ; Set fullscreen mode
  295. legacyMode := IniReadCheck(settingsFile, "Settings|" . systemName . "|" . romName, "LegacyMode","false",,1)
  296. mameBiosPath := IniReadCheck(settingsFile, "Settings", "MAME_BIOS_Path", emuPath . "\roms",,1)
  297. Videomode := IniReadCheck(settingsFile, "Settings", "Videomode","d3d",,1) ; Choices are gdi,ddraw,d3d. If left blank, MAME uses d3d by default
  298. 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
  299. bilinearFilter := IniReadCheck(settingsFile, "Settings|" . mameSystem, "BilinearFilter","false",,1)
  300. hlsl := IniReadCheck(settingsFile, "Settings|" . mameSystem . "|" . romName, "HLSL","false",,1)
  301. glsl := IniReadCheck(settingsFile, "Settings|" . mameSystem . "|" . romName, "GLSL","false",,1)
  302. bezelMode := IniReadCheck(settingsFile, "Settings|" . systemName . "|" . romName, "BezelMode","layout",,1) ; "layout" or "normal"
  303. verticalRotationMode := IniReadCheck(settingsFile, "Settings|" . mameSystem . "|" . romName, "VerticalRotationMode","none",,1)
  304. cheatMode := IniReadCheck(settingsFile, "Settings", "CheatMode","false",,1)
  305. cheatModeKey := IniReadCheck(settingsFile, "Settings", "CheatModeKey",A_Space,,1) ; user defined key to be held down before launching a mame rom.
  306. UseSoftwareList := IniReadCheck(settingsFile, mameSystem, "UseSoftwareList","false",,1)
  307. sysStaticParams := IniReadCheck(settingsFile, mameSystem, "StaticParameters", A_Space,,1)
  308. sysParams := IniReadCheck(settingsFile, mameSystem, "Parameters", A_Space,,1)
  309. romParams := IniReadCheck(settingsFile, romName, "Parameters", sysParams,,1)
  310. mameRomName := IniReadCheck(settingsFile, romName, "MameRomName", A_Space,,1)
  311. autosave := IniReadCheck(settingsFile, systemName . "|" . romName, "Autosave", "false",,1)
  312. volume := IniReadCheck(settingsFile, "Settings|" . systemName . "|" . romName, "Volume",,,1)
  313. Artwork_Crop := IniReadCheck(settingsFile, mameSystem . "|" . romName, "Artwork_Crop", "true",,1)
  314. Use_Bezels := IniReadCheck(settingsFile, mameSystem . "|" . romName, "Use_Bezels", "false",,1)
  315. Use_Overlays := IniReadCheck(settingsFile, mameSystem . "|" . romName, "Use_Overlays", "true",,1)
  316. Use_Backdrops := IniReadCheck(settingsFile, mameSystem . "|" . romName, "Use_Backdrops", "true",,1)
  317. Use_Cpanels := IniReadCheck(settingsFile, mameSystem . "|" . romName, "Use_Cpanels", "false",,1)
  318. Use_Marquees := IniReadCheck(settingsFile, mameSystem . "|" . romName, "Use_Marquees", "false",,1)
  319. inipath := IniReadCheck(settingsFile, mameSystem, "IniPath", "",,1)
  320. mameBiosPath := GetFullName(mameBiosPath)
  321.  
  322. ; Update Link setting
  323. ; linkType := "Slave" ; set to desired link mode
  324. ; nvramObj := Object() ; initialize object to store the nvram options
  325. ; nvramObj["Name"] := romName
  326. ; nvramObj["Link","Position"] := "24"
  327. ; nvramObj["Link","None"] := "00"
  328. ; nvramObj["Link","Master"] := "01"
  329. ; nvramObj["Link","Slave"] := "02"
  330. ; nvramObj["Link","Live"] := "03"
  331.  
  332. ; nvramFile := emuPath . "\nvram2\" . romName . "\nvram"
  333. ; If FileExist(nvramFile) {
  334. ; linkBin := BinRead(nvramFile,nvramData,1,nvramObj.Link["Position"]) ; read current link mode as binary
  335. ; Bin2Hex(linkHex,nvramData,linkBin) ; convert current link mode to hex
  336. ; If (linkHex != nvramObj.Link[linkType]) {
  337. ; Log("Module - Setting nvram to " . linkType . " for " . romName,4)
  338. ; Hex2Bin(binData,nvramObj.Link[linkType]),BinWrite(nvramFile,binData,1,nvramObj.Link["Position"])
  339. ; } Else
  340. ; Log("Module - " . romName . " already set to " . linkType,4)
  341. ; }
  342.  
  343. enableLinkPlay := IniReadCheck(settingsFile, "Link/Network|" . romName, "Enable_Link_Play", "false",,1)
  344. networkSession :=
  345. If (enableLinkPlay != "false") {
  346. Log("Module - Link/Network Multi-Player is an available option for " . romName,4)
  347. getWANIP := IniReadCheck(settingsFile, "Link/Network", "Get_WAN_IP","false",,1)
  348. myIP := If getWANIP = "true" ? GetPublicIP() : "127.0.0.1" ; use local ip by default if user does not want to get the WAN IP as MAME needs this for linked games
  349. networkPlayers := enableLinkPlay ; Max amount of networkable players
  350. localLink := 1 ; Tell Multiplayer menu to enable menu option for local linking
  351.  
  352. splitScreen2PlayersMode := IniReadCheck(settingsFile, "Link/Network|" . romName, "SplitScreen_2_Players","Vertical",,1) ;horizontal or vertical
  353. splitScreen3PlayersMode := IniReadCheck(settingsFile, "Link/Network|" . romName, "SplitScreen_3_Players","P1top",,1) ; For Player1 screen to be on left: P1left. For Player1 screen to be on top: P1top. For Player1 screen to be on bottom: P1bottom. For Player1 screen to be on right: P1right.
  354. ; localHost := IniReadCheck(settingsFile, "Link/Network", "Local_Host","0.0.0.0",,1) ; localhost is always 0.0.0.0 so no need to change
  355. localPort := IniReadCheck(settingsFile, "Link/Network", "Local_Port","15111",,1)
  356. ; remoteHost := IniReadCheck(settingsFile, "Link/Network", "Remote_Host","127.0.0.1",,1)
  357. ; remotePort := IniReadCheck(settingsFile, "Link/Network", "Remote_Port","15111",,1)
  358.  
  359. defaultServerIP := IniReadCheck(settingsFile, "Link/Network", "Default_Server_IP", myIP,,1)
  360. defaultServerPort := IniReadCheck(settingsFile, "Link/Network", "Default_Server_Port","15111",,1)
  361. lastIP := IniReadCheck(settingsFile, "Link/Network", "Last_IP", defaultServerIP,,1) ; also known as the Remote IP in mame. Does not need to be on the ISD
  362. lastPort := IniReadCheck(settingsFile, "Link/Network", "Last_Port", defaultServerPort,,1) ; also known as the Remote Port in mame. Does not need to be on the ISD
  363. MultiplayerMenu(lastIP, lastPort, networkType, networkPlayers,,,,,,localLink)
  364.  
  365. ;MultiPlayer Menu Result
  366. ; If !(networkType)
  367. ; MsgBox, % "Single Player Game"
  368. ; Else If (networkType="localLink")
  369. ; MsgBox, % "Local Link selected with the number of players equal to: " . networkPlayers
  370. ; Else If (networkType="server")
  371. ; MsgBox, % "WAN IP Address=" . networkIP . " | LAN IP Address=" . localIP[1,2] . " | Port=" . networkPort . " | networkPlayers=" . networkPlayers . " | networkRequiresSetup=" . networkRequiresSetup
  372. ; Else If (networkType="client")
  373. ; MsgBox, % "NetworkIP=" . networkIP . " | Port Number=" . networkPort . " | networkRequiresSetup=" . networkRequiresSetup
  374.  
  375. If networkSession {
  376. Log("Module - Using a Network for " . romName,4)
  377. multiPlayerObj := Object() ; initialize object to store the multiplayer options
  378. If (networkType="localLink") {
  379. Log("Module - Setting remote host to 127.0.0.1 to support local link mode as it is running on this PC.")
  380. If networkPlayers > 1
  381. { Log("Module - Local link mode was selected and " . networkPlayers . " sessions will be launched.")
  382. linkEnabledGame := 1
  383. ; remoteIsLocal := 1 ; this will determine if the module needs to handle multiple copies of mame or not
  384. fullscreen := "false" ; must turn off fullscreen if running multiple MAMEs on the same machine
  385. Loop % networkPlayers {
  386. player := A_Index
  387. multiPlayerObj[A_Index,"Number"] := player
  388. multiPlayerObj[A_Index,"CfgDir"] := " -cfg_directory cfg" . (If A_Index = 1 ? "" : A_Index)
  389. multiPlayerObj[A_Index,"NvramDir"] := " -nvram_directory nvram" . (If A_Index = 1 ? "" : A_Index)
  390. If (A_Index = 1) { ; Player 1
  391. multiPlayerObj[A_Index,"LocalHost"] := " -comm_localhost 0.0.0.0"
  392. multiPlayerObj[A_Index,"LocalPort"] := " -comm_localport " . localPort
  393. } Else { ; Players 2+
  394. multiPlayerObj[A_Index,"RemoteHost"] := " -comm_remotehost 127.0.0.1"
  395. multiPlayerObj[A_Index,"RemotePort"] := " -comm_remoteport " . localPort
  396. }
  397. ; msgbox % "Player: " . multiPlayerObj[A_Index]["Number"] . "`nLocalHost: " . multiPlayerObj[A_Index]["LocalHost"] . "`nLocalPort: " . multiPlayerObj[A_Index]["LocalPort"] . "`nRemoteHost: " . multiPlayerObj[A_Index]["RemoteHost"] . "`nRemotePort: " . multiPlayerObj[A_Index]["RemotePort"] . "`nCfgDir: " . multiPlayerObj[A_Index]["CfgDir"] . "`nNvramDir: " . multiPlayerObj[A_Index]["NvramDir"]
  398. }
  399. } Else
  400. Log("Module - Local link mode was selected but user only chose 1 player. Launch will be a normal session.")
  401. } Else If (networkType = "client") {
  402. Log("Module - Remote host is running on another PC, module will use remote link mode.")
  403. IniWrite, %lastIP%, %settingsFile%, Link/Network, Last_IP ; Save last used IP and Port for quicker launching next time
  404. IniWrite, %lastPort%, %settingsFile%, Link/Network, Last_Port
  405. linkType := "Slave"
  406. multiPlayerObj[A_Index,"Number"] := 1
  407. multiPlayerObj[A_Index,"CfgDir"] := " -cfg_directory cfg"
  408. multiPlayerObj[A_Index,"NvramDir"] := " -nvram_directory nvram"
  409. multiPlayerObj[A_Index,"LocalPort"] := " -comm_localport " . localPort
  410. multiPlayerObj[A_Index,"RemoteHost"] := " -comm_remotehost " . lastIP
  411. multiPlayerObj[A_Index,"RemotePort"] := " -comm_remoteport " . lastPort
  412. } Else { ; server
  413. linkType := "Master"
  414. multiPlayerObj[A_Index,"Number"] := 1
  415. multiPlayerObj[A_Index,"CfgDir"] := " -cfg_directory cfg"
  416. multiPlayerObj[A_Index,"NvramDir"] := " -nvram_directory nvram"
  417. multiPlayerObj[A_Index,"LocalHost"] := " -comm_localhost 0.0.0.0"
  418. multiPlayerObj[A_Index,"LocalPort"] := " -comm_localport " . localPort
  419. IniWrite, %lastPort%, %settingsFile%, Link/Network, Last_Port
  420. }
  421. Log("Module - Starting a network session using the IP """ . networkIP . """ and PORT """ . networkPort . """",4)
  422. } Else {
  423. Log("Module - User chose Single Player mode for this session",4)
  424. }
  425. }
  426.  
  427. FadeInStart()
  428.  
  429. ;Read settings from system name ini file
  430. sysSettingsFile := modulePath . "\" . mameSystem . ".ini"
  431. IfExist, %sysSettingsFile%
  432. {
  433. romParams := IniReadCheck(sysSettingsFile, romName, "Parameters", romParams,,1)
  434. hlsl := IniReadCheck(sysSettingsFile, romName, "HLSL",hlsl,,1)
  435. glsl := IniReadCheck(sysSettingsFile, romName, "GLSL",glsl,,1)
  436. Artwork_Crop := IniReadCheck(sysSettingsFile, romName, "Artwork_Crop", Artwork_Crop,,1)
  437. Use_Bezels := IniReadCheck(sysSettingsFile, romName, "Use_Bezels", Use_Bezels,,1)
  438. Use_Overlays := IniReadCheck(sysSettingsFile, romName, "Use_Overlays", Use_Overlays,,1)
  439. Use_Backdrops := IniReadCheck(sysSettingsFile, romName, "Use_Backdrops", Use_Backdrops,,1)
  440. Use_Cpanels := IniReadCheck(sysSettingsFile, romName, "Use_Cpanels", Use_Cpanels,,1)
  441. Use_Marquees := IniReadCheck(sysSettingsFile, romName, "Use_Marquees", Use_Marquees,,1)
  442. }
  443.  
  444. artworkCrop := If (Artwork_Crop = "true") ? " -artwork_crop" : " -noartwork_crop"
  445. useBezels := If (Use_Bezels = "true") ? " -use_bezels" : " -nouse_bezels"
  446. useOverlays := If (Use_Overlays = "true") ? " -use_overlays" : " -nouse_overlays"
  447. useBackdrops := If (Use_Backdrops = "true") ? " -use_backdrops" : " -nouse_backdrops"
  448. useCpanels := If (Use_Cpanels = "true") ? " -use_cpanels" : " -nouse_cpanels"
  449. useMarquees := If (Use_Marquees = "true") ? " -use_marquees" : " -nouse_marquees"
  450.  
  451. ; Get MAME version from executable, this is needed since some CLI switches are not available in older MAME versions
  452. exeAtrib := FileGetVersionInfo_AW( EmuPath . "\" . executable, "FileVersion|ProductVersion", "|" )
  453. Loop, Parse, exeAtrib, |%A_Tab%, %A_Space%
  454. A_Index & 1 ? ( _ := A_LoopField ) : ( %_% := A_LoopField )
  455. If (ProductVersion)
  456. StringRight, MAMEVersion, ProductVersion, StrLen(ProductVersion) - 2
  457. Log("Module - Detected MAME Product Version from '" . EmuPath . "\" . executable . "' is " . MAMEVersion)
  458.  
  459. If inipath
  460. inipath := AbsoluteFromRelative(EmuPath, inipath)
  461.  
  462. If (verticalRotationMode = "none")
  463. verticalRotationMode := ""
  464.  
  465. hideEmuObj := Object(dialogOpen . " ahk_class ConsoleWindowClass",0,"ahk_class MAMEDebugWindow",0,"ahk_class MAMEOutput",0,"ahk_class MAME",1) ;Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
  466.  
  467. ; Process mame's ListXML for certain features
  468. If (bezelEnabled = "true" || servoStikEnabled = "auto" || verticalRotationMode) {
  469. ListXMLObject := Object()
  470. ListXMLObject := ListXMLInfo(romName)
  471. If (bezelEnabled = "true") {
  472. If (networkPlayers > 1) {
  473. useBezels := " -nouse_bezels" ; force disabling MAME built-in bezels
  474. BezelStart(networkPlayers)
  475. } Else {
  476. If (bezelMode = "layout"){
  477. BezelStart("layout",ListXMLObject["Parent"].Value,ListXMLObject["Angle"].Value,romName)
  478. } Else { ;bezel mode = normal
  479. useBezels := " -nouse_bezels" ; force disabling MAME built-in bezels
  480. BezelStart(,,ListXMLObject["Angle"].Value)
  481. }
  482. }
  483. }
  484. If (servoStikEnabled = "auto") {
  485. 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
  486. }
  487. If (verticalRotationMode && ListXMLObject["Angle"].Value) {
  488. If (verticalRotationMode = "original")
  489. verticalRotationMode := " -norotate"
  490. Else If (verticalRotationMode = "right")
  491. verticalRotationMode := " -ror"
  492. Else If (verticalRotationMode = "left")
  493. verticalRotationMode := " -rol"
  494. Else
  495. verticalRotationMode := ""
  496. }
  497. Else
  498. verticalRotationMode := ""
  499. }
  500.  
  501. 7z(romPath, romName, romExtension, 7zExtractPath)
  502.  
  503. winstate := If (Fullscreen = "true") ? "Hide UseErrorLevel" : "UseErrorLevel"
  504. fullscreen := If (Fullscreen = "true") ? " -nowindow" : " -window"
  505. If (Videomode = "opengl")
  506. {
  507. hlsl := " -nohlsl_enable"
  508. If (MAMEVersion > 159)
  509. glsl := If glsl = "true" ? " -gl_glsl" : (If glsl = "ini" ? "" : " -nogl_glsl")
  510. Else
  511. glsl := ""
  512. }
  513. Else
  514. {
  515. hlsl := If hlsl = "true" ? " -hlsl_enable" : (If hlsl = "ini" ? "" : " -nohlsl_enable")
  516. If (MAMEVersion > 159)
  517. glsl := If Videomode = "ini" ? "" : " -nogl_glsl"
  518. Else
  519. glsl := ""
  520.  
  521. If (Videomode = "ini")
  522. Videomode := ""
  523. }
  524. videomode := If (Videomode != "" ) ? " -video " . videomode : ""
  525. param1 := " -cart """ . romPath . "\" . romName . romExtension . """" ; default param1 used for launching most systems.
  526. autosave := If autosave = "true" ? " -autosave" : ""
  527. volume := If volume != "" ? " -volume " . volume : ""
  528. inipath := If inipath != "" ? " -inipath """ . inipath . """" : ""
  529.  
  530. If romExtension = .txt ; This can be applied to all systems
  531. param1:=
  532.  
  533. If mameID = apfimag ; APF Imagination Machine
  534. If romExtension != .tap
  535. mameID = apfm1000 ; cart games for APF Imagination Machine require a different bios to be loaded
  536.  
  537. If UseSoftwareList != true
  538. { ; 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.
  539. If mameID in ti99_4a,aes,apple2gs,electron,mbeeic,odyssey2,astrocde ; these systems will use an ini to store game specific settings
  540. { mameSysINI := CheckFileMAME(modulePath . "\" . mameSystem . ".ini") ; create the ini if it does not exist
  541. If mameID = ti99_4a ; Texas Instruments TI 99-4A
  542. { mainCart := IniReadCheck(mameSysINI, romName, "Main_Cart",A_Space,,1)
  543. basicCart := IniReadCheck(mameSysINI, romName, "Basic_Cart","extended_basic.rpk",,1) ; user can specify a rom specific cart instead of the default basic one
  544. expansionLocation := IniReadCheck(mameSysINI, romName, "Expansion_Location","extended_basic.rpk",,1)
  545. ; Now set the parameters to send to MAME
  546. If romExtension = .dsk ; Expansion Disk
  547. ; 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
  548. 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 . """"
  549. Else If romExtension = .rpk ; Cart Game (RPK Format)
  550. param1 := " -gromport single -cart1", param2:=" """ . romPath . "\" . romName . romExtension . """", param3:=" -peb:slot3 speech" ;-cart will also work here
  551. param6 := " -ui_active" ;Enable partial keyboard mode at startup
  552. } Else If mameID = aes ; SNK Neo Geo AES
  553. { biosRegion := IniReadCheck(mameSysINI, romName, "BIOS_Region","asia",,1)
  554. param1 := " -bios " . biosRegion ; can also be japan, but the asian one has english menus for most games
  555. param2 := " -cart " . romName
  556. }Else if mameID = apple2gs ; Apple IIGS
  557. { externalOS := IniReadCheck(mameSysINI, romName, "External_OS","false",,1)
  558. 2gsSystemFile := "System6.2mg" ;For games without OS included, always force this name and error out if not found
  559. multipartTable := CreateRomTable(multipartTable)
  560.  
  561. If externalOS = true
  562. { CheckFile(romPath . "\" . 2gsSystemFile)
  563. param1 := " -flop3", param2:=" """ . romPath . "\" . 2gsSystemFile . """", param3:=" -flop4", param4:=" """ . romPath . "\" . romName . romExtension . """"
  564. }Else{
  565. param1 := " -flop3", param2:=" """ . romPath . "\" . romName . romExtension . """"
  566. If (multipartTable.MaxIndex() > 1)
  567. param3:=" -flop4", param4 := " """ . multipartTable[2,1] . """"
  568. }
  569. param5 := " -ui_active" ;Enable partial keyboard mode at startup
  570. }Else If mameID = electron ; Acorn Electron
  571. { AutoBootDelay := IniReadCheck(mameSysINI, "Settings", "AutoBootDelay","2",,1) ; Read delay from config.
  572. AutoBootDelay := " -autoboot_delay " . AutoBootDelay
  573. If romExtension = .bin
  574. mediaDeviceType := "cart"
  575. Else ; any other format
  576. mediaDeviceType := "cass"
  577. param1 := " -" . mediaDeviceType . " """ . romPath . "\" . romName . romExtension . """ -autoboot_command ""chain""""""""""""\n""" . AutoBootDelay . ""
  578. }Else If mameID = mbeeic ; Applied Technology MicroBee
  579. { microbeeModel := IniReadCheck(mameSysINI, romName, "MicroBee_Model","mbeeic",,1)
  580. If microbeeModel not in mbee,mbeeic,mbeepc,mbeepc85,mbee56
  581. ScriptError("This is not a known MicroBee model value: " . microbeeModel)
  582. Else If (microbeeModel != "mbeeic")
  583. mameID := microbeeModel
  584. If romExtension in .mwb,.com,.bee
  585. mediaDeviceType := "quik1"
  586. Else If romExtension in .wav,.tap
  587. mediaDeviceType := "cass"
  588. Else If romExtension in .rom
  589. mediaDeviceType := "cart"
  590. Else If romExtension in .dsk
  591. mediaDeviceType := "flop1"
  592. Else ; .bin format
  593. mediaDeviceType := "quik2"
  594. param1 := " -" . mediaDeviceType . " """ . romPath . "\" . romName . romExtension . """"
  595. }Else if mameID = odyssey2 ; Magnavox Odyssey 2
  596. { param2 := " -ui_active" ;Enable partial keyboard mode at startup
  597. }Else if mameID = astrocde ; Bally Astrocade
  598. {
  599. BlueRAMBasicRom := IniReadCheck(mameSysINI, "Settings", "BlueRAMBasicRom","Blue RAM Basic v1.1 (USA).bin",,1) ; Blue RAM Basic rom
  600. RequiresReset := IniReadCheck(mameSysINI, romname, "RequiresReset","false",,1) ; Check if game requires a reset
  601.  
  602. BlueRAMBasicRomPath := romPath . "\" . BlueRAMBasicRom
  603. If (romExtension = .script) {
  604. ;Will require blue ram basic
  605. If !FileExist(BlueRAMBasicRomPath) {
  606. ;Blue RAM Basic games might be in their own sub-folders since they have several files, so let's try to find the Blue RAM cart in the parent folder as well
  607. SplitPath,romPath,,romBasePath
  608. BlueRAMBasicRomPath := CheckFile(romBasePath . "\" . BlueRAMBasicRom, "Couldn't find " . BlueRAMBasicRom . " on any of these paths:" . romBasePath . "|" . romPath)
  609. }
  610.  
  611. scriptFile := romPath . "\" . romName . romExtension
  612. param1 := " -cart """ . BlueRAMBasicRomPath . """"
  613.  
  614. ;Replace rompath variable in script
  615. FileRead, scriptData, %scriptFile%
  616. StringReplace, scriptData, scriptData, {romPath}, %romPath%, all
  617.  
  618. ;Create cmd file to send to MESS
  619. FileDelete, %romPath% . "\" . %romName% . ".cmd"
  620. FileAppend, %scriptData%, %romPath%\%romName%.cmd
  621. param2 := " -exp blue_ram_16k -debug -debugscript """ . romPath . "\" . romName . ".cmd"""
  622.  
  623. closeDebugWindow := "true"
  624. }
  625. }
  626.  
  627. ;Use a different bios if needed (This must be done after the above if conditions since the mameID will change)
  628. 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
  629. If (iniBios != "")
  630. mameID := iniBios ; need to change the bios name for some games
  631. }
  632.  
  633. ; These systems don't use an ini, but do require parameters to be changed from the default method of launching MAME
  634. 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
  635. { If romExtension not in .chd,.cue
  636. ScriptError("MAME only supports " . mameSystem . " games in chd and cue format. It does not support:`n" . romExtension)
  637. If (mameSystem = "NEC TurboGrafx-CD") { ; NEC TurboGrafx-CD needs an additional bios mounted as a cart to run
  638. ; tgcdBios := CheckFile(emuPath . "\roms\CD-ROM System V2.01 (U).pce") ; older bios that doesn't seem to work with many games
  639. tgcdBios := CheckFile(emuPath . "\roms\Super CD-ROM2 System V3.01 (U).pce")
  640. param2 := " -cart " . """" . tgcdBios . """"
  641. } Else If (mameSystem = "NEC PC Engine-CD") { ; NEC PC Engine-CD needs an additional bios mounted as a cart to run
  642. pcecdBios := CheckFile(emuPath . "\roms\Super CD-ROM2 System V3.0 (J).pce")
  643. param2 := " -cart " . """" . pcecdBios . """"
  644. } Else If (mameID = "psx") { ; Sony PlayStation
  645. mameID = psu ; changing mameID sent to MAME to use the USA bios
  646. ; SelectMemCard() ; future function to swap around memcards
  647. ; Usage: mc1 "J:\MAME\software\psu\card1.mc"
  648. } If (mameSystem = "Sega CD") { ;
  649. If InStr(romName,"(Jap") ; Mega CD Japanese v2
  650. mameID = megacd2j
  651. Else If InStr(romName,"(Euro") ; Mega CD European (PAL)
  652. mameID = megacd
  653. }
  654. param1 := " -cdrm """ . romPath . "\" . romName . romExtension . """"
  655. }Else If mameID = gamecom ; Tiger Game.com
  656. { If romExtension != .txt
  657. param1 := " -cart1 """ . romPath . "\" . romName . romExtension . """"
  658. }Else If mameID = genesis ; Sega Genesis
  659. { If (InStr(romName, "(Europe") || InStr(romName, "(PAL")) ; if rom is from europe, tell MAME to boot a Mega Drive instead
  660. mameID = megadriv
  661. }Else If mameID = megadriv ; Sega Mega Drive
  662. { If (InStr(romName, "(USA") || InStr(romName, "(NTSC")) ; if rom is from America, tell MAME to boot a Genesis instead
  663. mameID = genesis
  664. }Else If mameID = vii ; JungleTac Sport Vii
  665. { If romName = Built-In Games (China) ; Has some built-in games, gotta launch just BIOS for it.
  666. param1:=
  667. }Else If mameID = alice32 ; Matra & Hachette Alice
  668. { If romExtension != .txt
  669. param1 := " -cass1 """ . romPath . "\" . romName . romExtension . """"
  670. }Else If mameID = pockstat ; Sony PocketStation
  671. { If romExtension != .gme
  672. param1 := " -cart1 """ . romPath . "\" . romName . romExtension . """"
  673. }Else If mameID = coco3 ; Tandy TRS-80 Color Computer
  674. { If romExtension != .txt
  675. param1 := " -cart """ . romPath . "\" . romName . romExtension . """"
  676. }Else If mameID = zx81 ; Sinclair ZX81
  677. { If romExtension != .txt
  678. param1 := " -cass1 """ . romPath . "\" . romName . romExtension . """"
  679. }Else If mameID = sorcerer ; Exidy Sorcerer
  680. { If romExtension = .snp ; Snapshot file
  681. param1 := " -dump """ . romPath . "\" . romName . romExtension . """"
  682. Else If romExtension = .bin
  683. param1 := " -quik """ . romPath . "\" . romName . romExtension . """"
  684. }Else If (mameID = "a800" || mameID = "fds" || mameID = "samcoupe") ; Atari 8-bit, Nintendo Famicom Disk System, and MGT Sam Coupe
  685. { If romExtension != .txt
  686. param1 := " -flop1 """ . romPath . "\" . romName . romExtension . """"
  687. }Else If mameID = vectrex ; GCE Vectrex
  688. { 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)
  689. param1:=
  690. }Else If mameID = apfm1000 ; APF Imagination Machine/APF M1000
  691. { If romName = Rocket Patrol (USA) ; Rocket Patrol is built into the APF M1000 ROM.
  692. param1:=
  693. }Else If mameID = adam ; Coleco ADAM
  694. param1 := (If romExtension = ".ddp" ? " -cass1" : " -floppydisk") . " """ . romPath . "\" . romName . romExtension . """" ; Decide if disk or ddp game
  695. Else If mameID = pegasus ; Aamber Pegasus
  696. { If romExtension != .txt
  697. param1 := " -cart1 """ . romPath . "\" . romName . romExtension . """"
  698. }
  699. Else If mameID = gp32 ; GamePark 32
  700. { If romExtension != .txt
  701. param1 := " -memc """ . romPath . "\" . romName . romExtension . """"
  702. }
  703. }Else{ ; Use Software List
  704. hashname := mameID
  705. param1 := " " . romName ; param1 used for launching from software lists
  706.  
  707. If mameID = aes ; SNK Neo Geo AES
  708. { hashname := "neogeo"
  709. biosRegion := IniReadCheck(mameSysINI, romName, "BIOS_Region","asia",,1)
  710. param2 := " -bios " . biosRegion ; can also be japan, but the asian one has english menus for most games
  711. }
  712. CheckFile(emuPath . "\hash\" . hashname . ".xml","Could not find a software list for the system " . mameID) ;Check if software list for selected system exists
  713. }
  714.  
  715. If mameID = vectrex ; GCE Vectrex
  716. param2 := " -view " . (If (FileExist(emuPath . "\artwork\Vectrex\" . romName . ".png"))?("""" . romName . """"):"standard") ; need overlays extracted in the artwork\vectres folder. PNGs must match romName
  717.  
  718. sysStaticParams := If sysStaticParams != "" ? A_Space . sysStaticParams : "" ; tacking on a space in case user forgot to add one
  719. romParams := If romParams != "" ? A_Space . romParams : "" ; tacking on a space in case user forgot to add one
  720.  
  721. 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
  722. 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
  723.  
  724. If InStr(romParams,"-rompath")
  725. 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.")
  726. If InStr(sysStaticParams,"-rompath")
  727. 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.")
  728.  
  729. ; use a custom rom name, not the one from the db
  730. If mameRomName {
  731. FileMove, %romPath%\%romName%%romExtension%, %romPath%\%mameRomName%%romExtension% ; rename rom to match what mame needs
  732. originalRomName := romName ; store romName from database so we know what to rename it back to later
  733. romName := mameRomName
  734. If ErrorLevel
  735. 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)
  736. Else ; if rename was successful, set var so we know to move it back later
  737. fileRenamed = 1
  738. }
  739.  
  740. ; use a custom cfg file if it exists and append it to param1
  741. IfExist, % emuPath . "\cfg\" . mameID . "\" . dbName
  742. param1 := " -cfg_directory " . """" . emuPath . "\cfg\" . mameID . "\" . dbName . """" . param1
  743.  
  744. If bilinearFilter = true
  745. bilinearEnabled := " -filter"
  746. Else
  747. bilinearEnabled := " -nofilter"
  748.  
  749. If cheatMode = true
  750. { If (!FileExist(emuPath . "\cheat.zip") && !FileExist(emuPath . "\cheat.7z"))
  751. ScriptError("You have cheats enabled for " . MEmu . " but could not locate a ""cheat.zip"" or ""cheat.7z"" in " . emuPath)
  752. Else
  753. Log("Module - Cheat file found in " . emuPath,4)
  754. If cheatModeKey ; if user wants to use a key to enable CheatMode
  755. cheatEnabled := If XHotkeyAllKeysPressed(cheatModeKey) ? " -cheat" : "" ; only enables cheatMode when key is held down on launch
  756. Else ; no cheat mode key defined
  757. cheatEnabled := " -cheat"
  758. }
  759.  
  760. If (RequiresReset = "true")
  761. {
  762. ; Generate a lua script to send a system soft reset
  763. ScriptFileName := GenerateSoftResetScript()
  764. bootscript := " -script """ . ScriptFileName . """ -autoboot_delay 1"
  765. }
  766.  
  767. HideEmuStart()
  768.  
  769. If legacyMode = true
  770. { Log("Module - Running MAME in legacy Mode")
  771. errLvl := Run("""" . executable . """ " . (If mameID = "MAME" ? romName : mameID . param1 . param2 . param3 . param4 . param5 . param6) . fullscreen . cheatEnabled . volume . mameRomPaths . sysStaticParams . romParams, emuPath, winstate)
  772. } Else {
  773. Log("Module - Running MAME in non-legacy mode")
  774. If (networkPlayers = 1 || !linkEnabledGame) {
  775. errLvl := Run("""" . executable . """ " . (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 . bootscript . bilinearEnabled . " -skip_gameinfo", emuPath, winstate)
  776. } Else { ; multiplayer game run
  777. ;screen positions
  778. screenPosMode := If (networkPlayers = 2) ? splitScreen2PlayersMode : If (networkPlayers = 2) ? splitScreen3PlayersMode : ""
  779. screenPos := SplitScreenPos(networkPlayers,screenPosMode)
  780. globalInputs := " -global_inputs" ; tell mame to accept inputs when its window is not focused
  781. Loop, %networkPlayers%
  782. {
  783. ;;Run Line for each of the multiplayer MAME instances using the nvramPath and cfgPath variables to the extra mames
  784. errLvl := Run("""" . executable . """ " . (If mameID = "MAME" ? romName : mameID . param1 . param2 . param3 . param4 . param5 . param6) . mameRomPaths . multiPlayerObj[A_Index]["CfgDir"] . multiPlayerObj[A_Index]["NvramDir"] . globalInputs . multiPlayerObj[A_Index]["LocalHost"] . multiPlayerObj[A_Index]["LocalPort"] . multiPlayerObj[A_Index]["RemoteHost"] . multiPlayerObj[A_Index]["RemotePort"] . sysStaticParams . romParams . fullscreen . hlsl . glsl . cheatEnabled . volume . inipath . verticalRotationMode . videomode . artworkCrop . useBezels . useOverlays . useBackdrops . useCpanels . useMarquees . autosave . bootscript . bilinearEnabled . " -skip_gameinfo", emuPath, winstate, Screen%A_Index%PID)
  785. WinWait("ahk_pid " . Screen%A_Index%PID)
  786. }
  787.  
  788. ignoreWindows := "MAMEOutput" ; ignore the mame debug window
  789. Loop, %networkPlayers%
  790. {
  791. WinGet, Screen%A_Index%ID, ID, % "ahk_pid " . Screen%A_Index%PID,, %ignoreWindows%
  792. WinSet, Style, -0xC00000, % "ahk_id " . Screen%A_Index%ID,, %ignoreWindows%
  793. ToggleMenu(Screen%A_Index%ID)
  794. WinSet, Style, -0xC40000, % "ahk_id " . Screen%A_Index%ID,, %ignoreWindows%
  795. MoveWindow("ahk_id " . Screen%A_Index%ID, screenPos[A_Index].X, screenPos[A_Index].Y, screenPos[A_Index].W, screenPos[A_Index].H,,ignoreWindows)
  796. Sleep, 50
  797. }
  798. }
  799. }
  800.  
  801. If errLvl {
  802. If (errLvl = 1)
  803. Error = Failed Validity
  804. Else If(errLvl = 2)
  805. Error = Missing Files
  806. Else If(errLvl = 3)
  807. Error = Fatal Error
  808. Else If(errLvl = 4)
  809. Error = Device Error
  810. Else If(errLvl = 5)
  811. Error = Game Does Not Exist
  812. Else If(errLvl = 6)
  813. Error = Invalid Config
  814. Else If errLvl in 7,8,9
  815. Error = Identification Error
  816. Else
  817. Error = MAME Error
  818. Log("MAME Error - " . Error,3)
  819. }
  820.  
  821. WinWait("ahk_class MAME")
  822. WinWaitActive("ahk_class MAME")
  823.  
  824. ;Close the debugger window if exists
  825. If (closeDebugWindow = "true") {
  826. WinWait("ahk_class MAMEDebugWindow",,2)
  827. WinClose("ahk_class MAMEDebugWindow")
  828. }
  829.  
  830. BezelDraw()
  831. HideEmuEnd()
  832.  
  833. If (networkPlayers = 1 || !linkEnabledGame) {
  834. WinShow, ahk_class MAME ; Show the emulator
  835. } Else {
  836. Loop %networkPlayers%
  837. WinShow, % "ahk_id " . Screen%a_index%ID ; Show the emulator
  838. WinActivate, ahk_id %Screen1ID% ; activate first player window so that first player can use keyboard instead of last player
  839. }
  840.  
  841. FadeInExit()
  842. Process("WaitClose", executable)
  843. 7zCleanUp()
  844. BezelExit()
  845.  
  846. If fileRenamed { ; rename file back to alternate name for next launch
  847. FileMove, %romPath%\%romName%%romExtension%, %romPath%\%originalRomName%%romExtension%
  848. If ErrorLevel ; if rename was successful, set var so we know to move it back later
  849. ScriptError("There was a problem renaming " . romName . " back to " . originalRomName)
  850. }
  851.  
  852. FadeOutExit()
  853. ExitModule()
  854.  
  855.  
  856. ; This will simply create a new blank ini if one does not exist
  857. CheckFileMAME(file){
  858. IfNotExist, %file%
  859. FileAppend,, %file%
  860. Return file
  861. }
  862.  
  863. ListXMLInfo(rom){ ; returns MAME info about parent rom, orientation angle, resolution
  864. Global emuFullPath, emuPath
  865. ListXMLObject := Object()
  866. listXMLVarLog :=
  867. RunWait, % comspec . " /c " . """" . emuFullPath . """" . " -listxml " . rom . " > tempBezel.txt", %emuPath%, Hide
  868. Fileread, ListxmlContents, %emuPath%\tempBezel.txt
  869. RegExMatch(ListxmlContents, "s)<game.*name=" . """" . rom . """" . ".*" . "cloneof=" . """" . "[^""""]*", parent)
  870. RegExMatch(parent,"cloneof=" . """" . ".*", parent)
  871. RegExMatch(parent,"""" . ".*", parent)
  872. StringTrimLeft, parent, parent, 1
  873. RegExMatch(ListxmlContents, "s)<display.*rotate=" . """" . "[0-9]+" . """", angle)
  874. RegExMatch(angle,"[0-9]+", angle, "-6")
  875. RegExMatch(ListxmlContents, "s)<display.*width=" . """" . "[0-9]+" . """", width)
  876. RegExMatch(width,"[0-9]+", width, "-6")
  877. RegExMatch(ListxmlContents, "s)<display.*height=" . """" . "[0-9]+" . """", Height)
  878. RegExMatch(Height,"[0-9]+", Height, "-6")
  879. RegExMatch(ListxmlContents, "s)<control.*ways=" . """" . "[0-9]+" . """", Ways)
  880. RegExMatch(Ways,"[0-9]+", Ways, "-6")
  881. logVars := "Parent|Angle|Height|Width|Ways"
  882. Loop, Parse, logVars, |
  883. {
  884. currentobj:={}
  885. currentobj.Label := A_Loopfield
  886. currentobj.Value := %A_Loopfield%
  887. ListXMLObject.Insert(currentobj["Label"], currentobj)
  888. listXMLLog .= "`r`n`t`t`t`t`t" . currentobj["Label"] . " = " . currentobj["Value"]
  889. }
  890. Log("Module - MAME ListXML values: " . listXMLLog,5)
  891. If (ListXMLObject["Height"].Value > ListXMLObject["Width"].Value) {
  892. ListXMLObject["Angle"].Value := true
  893. Log("Module - This game's height is greater than its width, forcing vertical mode",5)
  894. }
  895. FileDelete, %emuPath%\tempBezel.txt
  896. Return ListXMLObject
  897. }
  898.  
  899. GenerateSoftResetScript(){ ; Generates a lua script to send a soft reset to MAME
  900. Global emuPath
  901.  
  902. ScriptFileName := emuPath . "\soft_reset.lua"
  903. FileDelete, %ScriptFileName%
  904. FileAppend,
  905. (
  906. local function reset_machine()
  907. if resetcounter == nil then
  908. manager:machine():soft_reset();
  909. resetcounter = 1;
  910. end
  911. end
  912. if resetcounter == nil then
  913. emu.wait(1);
  914. reset_machine();
  915. end
  916. ), %ScriptFileName%
  917.  
  918. Return, ScriptFileName
  919. }
  920.  
  921. BezelLabel:
  922. WinSet, Transparent, 0, ahk_class ConsoleWindowClass
  923. Return
  924.  
  925. HaltEmu:
  926. If pauseMethod = 1
  927. { disableSuspendEmu = true
  928. disableRestoreEmu = true
  929. PostMessage,0x211, 1, , , ahk_class MAME
  930. } Else If pauseMethod = 2
  931. { disableSuspendEmu = true
  932. PostMessage,0x211, 1, , , ahk_class MAME
  933. } Else If pauseMethod = 3
  934. { disableSuspendEmu = true
  935. disableRestoreEmu = true
  936. PostMessage,% 0x0400+6, 1, , , ahk_class MAME
  937. } Else If pauseMethod = 4
  938. { disableSuspendEmu = true
  939. PostMessage,% 0x0400+6, 1, , , ahk_class MAME
  940. } Else If pauseMethod = 5
  941. { disableSuspendEmu = true
  942. Send, {P down}
  943. Sleep, 1000
  944. Send, {P up}
  945. }
  946. Return
  947. RestoreEmu:
  948. If pauseMethod = 1
  949. { PostMessage,0x212, 1, , , ahk_class MAME
  950. WinActivate, ahk_class MAME
  951. } Else If pauseMethod = 2
  952. { PostMessage,0x212, 1, , , ahk_class MAME
  953. WinActivate, ahk_class MAME
  954. } Else If pauseMethod = 3
  955. { PostMessage,% 0x0400+6, 0, , , ahk_class MAME
  956. WinActivate, ahk_class MAME
  957. } Else If pauseMethod = 4
  958. { PostMessage,% 0x0400+6, 0, , , ahk_class MAME
  959. WinActivate, ahk_class MAME
  960. } Else If pauseMethod = 5
  961. { disableSuspendEmu = true
  962. Send, {P down}
  963. Sleep, 1000
  964. Send, {P up}
  965. WinActivate, ahk_class MAME
  966. } Else If pauseMethod = 6
  967. WinActivate, ahk_class MAME
  968. Return
  969.  
  970. CloseProcess:
  971. FadeOutStart()
  972. If (networkPlayers > 1) {
  973. Loop % networkPlayers
  974. { WinClose("ahk_id " . Screen%A_Index%ID)
  975. WinWaitClose("ahk_id " . Screen%A_Index%ID)
  976. }
  977. } Else
  978. WinClose("ahk_class MAME")
  979. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement