Advertisement
djvj

retroarch

Apr 30th, 2016
808
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 50.76 KB | None | 0 0
  1. MEmu = RetroArch
  2. MEmuV = v05-11-2015 Nightly
  3. MURL = http://themaister.net/retroarch.html
  4. MAuthor = djvj,zerojay
  5. MVersion = 2.3.9
  6. MCRC = 3C635251
  7. iCRC = F7B77133
  8. MID = 635038268922229162
  9. MSystem = "Acorn BBC Micro","AAE","Amstrad CPC","Amstrad GX4000","APF Imagination Machine","Applied Technology MicroBee","Apple IIGS","Atari 2600","Atari 5200","Atari 7800","Atari 8-Bit","Atari Classics","Atari Jaguar","Atari Lynx","Atari ST","Atari XEGS","Bally Astrocade","Bandai Gundam RX-78","Bandai Super Vision 8000","Bandai Wonderswan","Bandai Wonderswan Color","Canon X07","Capcom Classics","Capcom Play System","Capcom Play System II","Capcom Play System III","Casio PV-1000","Casio PV-2000","Cave","Coleco ADAM","ColecoVision","Commodore MAX Machine","Commodore Amiga","Creatronic Mega Duck","Data East Classics","Dragon Data Dragon","Emerson Arcadia 2001","Entex Adventure Vision","Elektronika BK","Epoch Game Pocket Computer","Epoch Super Cassette Vision","Exidy Sorcerer","Fairchild Channel F","Final Burn Alpha","Funtech Super Acan","GamePark 32","GCE Vectrex","Hartung Game Master","Interton VC 4000","Irem Classics","JungleTac Sport Vii","Konami Classics","MAME","Magnavox Odyssey 2","Microsoft MSX","Microsoft MSX2","Matra & Hachette Alice","Mattel Aquarius","Mattel Intellivision","Midway Classics","Namco Classics","Namco System 22","NEC PC Engine","NEC PC Engine-CD","NEC PC-FX","NEC TurboGrafx-16","NEC SuperGrafx","NEC TurboGrafx-CD","Nintendo 64","Nintendo 64DD","Nintendo Arcade Systems","Nintendo Classics","Nintendo DS","Nintendo Entertainment System","Nintendo Famicom","Nintendo Famicom Disk System","Nintendo Game Boy","Nintendo Game Boy Color","Nintendo Game Boy Japan","Nintendo Game Boy Advance","Nintendo Game & Watch","Nintendo Super Game Boy","Nintendo Pokemon Mini","Nintendo Virtual Boy","Nintendo Super Famicom","Nintendo Satellaview","Nintendo SuFami Turbo","Panasonic 3DO","Elektronska Industrija Pecom 64","Philips CD-i","Philips Videopac","RCA Studio II","ScummVM","Sega 32X","Sega Classics","Sega Mega Drive 32X","Sega Mark III","Sega SC-3000","Sega SG-1000","Sega CD","Sega Dreamcast","Sega Game Gear","Sega Genesis","Sega Master System","Sega Mega Drive","Sega Meganet","Sega Nomad","Sega Pico","Sega Saturn","Sega Saturn Japan","Sega VMU","Sega ST-V","Sharp X1","Sinclair ZX Spectrum","Sony PlayStation","Sony PlayStation Minis","Sony PocketStation","Sony PSP","Sord M5","SNK Classics","SNK Neo Geo","SNK Neo Geo AES","SNK Neo Geo MVS","SNK Neo Geo Pocket","SNK Neo Geo CD","SNK Neo Geo Pocket Color","Spectravideo","Super Nintendo Entertainment System","Taito Classics","Tandy TRS-80 Color Computer","Technos","Texas Instruments TI 99-4A","Thomson MO5","Thomson TO7","Tiger Game.com","Tiki-100","Tomy Tutor","VTech CreatiVision","Watara Supervision","Williams Classics"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; If the emu doesn't load and you get no error, usually this means the LibRetro DLL is not working!
  13. ; Devs stated they will never add support for mounted images (like via DT)
  14. ; Fullscreen is controlled via the module setting in RocketLauncherUI
  15. ; This module uses the CLI version of RetroArch (retroarch.exe), not the GUI (retroarch-phoenix.exe).
  16. ; The emu may make a mouse cursor appear momentarily during launch, MouseMove and hide_cursor seem to have no effect
  17. ; Enable 7z support for archived roms
  18. ; Available CLI options: https://github.com/PyroFilmsFX/iOS/blob/master/docs/retroarch.1
  19. ;
  20. ; LibRetro DLLs:
  21. ; LibRetro DLLs come with the emu, but here is another source for them: http://forum.themaister.net/
  22. ; Whatever cores you decide to use, make sure they are extracted anywhere in your Emu_Path\cores folder. The module will find and load the default core unless you choose a custom one for each system.
  23. ; You can find supported cores that Retroarch supports simply by downloading them from the "retroarch-phoenix.exe" or by visiting here: https://github.com/libretro/libretro.github.com/wiki/Supported-cores
  24. ; Some good discussion on cores and filters: http://forum.themaister.net/viewtopic.php?id=270
  25. ;
  26. ; SRM files:
  27. ; srm are stored in a "srm" dir in the emu folder. Each system ran through retroarch gets its own folder inside srm
  28. ;
  29. ; Save states:
  30. ; Save states are stored in a "save" dir in the emu folder. Each system ran through retroarch gets its own folder inside save
  31. ;
  32. ; Config files:
  33. ; By default, the module looks for config files in a folder called config in the RetroArch folder. Example: C:\emus\RetroArch\config. You can change this folder to anything you like by changing the module's ConfigFolder setting in RocketLauncherUI.
  34. ; RetroArch's global config file is called "retroarch.cfg". RetroArch will use a system cfg file named to match your System Name (example: Nintendo Entertainment System.cfg).
  35. ; RetroArch will also load core config files named after the core name. Example: nestopia_libretro.cfg
  36. ; This allows different settings globally, for each system, and for each core. If you want all systems to use the same retroarch.cfg, do not have any system or core cfg files, only have the retroarch.cfg.
  37. ; If a core config exists, it takes precedence over the global config. And if a system config exists, it takes precedence over the core config.
  38. ;
  39. ; MultiGame:
  40. ; MultiGame support is currently only available for the Mednafen PSX core. Retroarch uses the same method as Mednafen to load multi-disc games. This method involves m3u playlists which are commonly used for music. The m3u files needed to load multi-disc games are generated for you by the module when you launch a multi-disc game and are saved to your corresponding rom directory. Due to m3u limitations, your multi-disc roms/images cannot be archived -- they must be unzipped. All single disc games can remain archived and you can still enable 7z under system settings. If you do not wish to use MultiGame support you can archive your roms/images and m3u generation will be skipped on launch.
  41. ; The m3u files generated by the module contain a list of paths to all roms/images in the multi-disc set. Retroarch automatically loads the first path in the m3u so the first path will always be the disc you are loading. For example, Final Fantasy VII has 3 discs and if you load Disc 2 first, the order of the paths in the m3u will be disc 2, disc 3, disc 1. If you load Disc 3 first, the order will be disc 3, disc 1, disc 2. The module anticipates this and will load the correct disk, selected from the Pause/MultiDisk menus. However if you choose to manually use Retroarch's UI or disk swap keys to change discs, you will need to keep this in mind.
  42. ; In order for RocketLauncher's MultiGame UI to swap discs, you must define Eject_Toggle_Key, Next_Disk_Key, and Previous_Disk_Key under global settings for the emulator in RocketLauncher. Because AHK and Retroarch use different naming conventions for some keyboard keys, it is best to use a letter, a number, or F1-F12.
  43. ;
  44. ; MAME:
  45. ; MAME BIOS roms should be placed in the system\mame folder
  46. ;
  47. ; System Specific Notes:
  48. ; Microsoft MSX/MSX2: Launch an MSX game and in the core options, set the console to be an MSX2 and it will play both just fine.
  49. ; Nintendo Famicom Disk System - Requires disksys.rom be placed in the folder you define as system_directory in the RetroArch's cfg.
  50. ; Sega CD - Requires "bios_CD_E.bin", "bios_CD_J.bin", "bios_CD_U.bin" all be placed in the folder you define as system_directory in the RetroArch's cfg.
  51. ; Super Nintendo Entertainment System - requires split all 10 dsp# & st### roms all be placed in the folder you define as system_directory in the RetroArch's cfg. Many games, like Super Mario Kart require these.
  52. ; NEC TurboGrafx-CD (using pce fast core) - Requires "syscard3.pce" be placed in the folder you define as system_directory in the RetroArch's cfg.
  53. ; NEC TurboGrafx-CD (using MAME core)
  54. ; - You'll need to update a couple mame specific options in the Retroarch core options file to get it to boot from the cli. These should probably be updated automagically by the module. Turning softlists off, but might not need to.
  55. ; mame_boot_from_cli = "enabled"
  56. ; mame_softlists_enable = "disabled"
  57. ; mame_softlists_auto_media = "disabled"
  58. ; - Requires hash folder from MAME/MESS/UME, either from the source or release package. Save this in the system_directory you've defined for RetroArch. Something like \RetroArch\system\mame\hash\
  59. ; - Requires the CD bios file(s) saved in the mame bios folder you've defined. Usually \RetroArch\system\mame\bios\
  60. ; For PC Engine-CD you'll need the file "[cd] cd-rom system (japan) (v2.1).pce" zipped as cdsys.zip and saved in a pce subfolder in your bios path, so \RetroArch\system\mame\bios\pce\cdsys.zip
  61. ; For PC Engine SuperGrafx-CD you'll need the file "[cd] super cd-rom system (japan) (v3.0).pce" zipped as scdsys.zip and saved in a pce subfolder in your bios path, so \RetroArch\system\mame\bios\pce\scdsys.zip
  62. ; For TurboGrafx-CD you'll need the file "[cd] turbografx cd system card (usa) (v2.0).pce" zipped as cdsys.zip and saved in a tg16 subfolder in your bios path, so \RetroArch\system\mame\bios\tg16\cdsys.zip
  63. ; For TurboDuo you'll need the file "[cd] turbografx cd super system card (usa) (v3.0).pce" zipped as scdsys.zip and saved in a tg16 subfolder in your bios path, so \RetroArch\system\mame\bios\tg16\scdsys.zip
  64. ; Nintendo Super Game Boy - Set the Module setting in RocketLauncherUI SuperGameBoy to true to enable a system or only a rom to use SGB mode. This is not needed if your systemName is set to the official name of "Nintendo Super Game Boy". Requires "sgb.boot.rom" and "Super Game Boy (World).sfc" to be placed in the folder you define as system_directory in the RetroArch's cfg. This is needed if you want to use Super game boy mode and color palettes. Also requires using the latest bsnes core. Not all games support SGB mode.
  65. ; MAME: The nag screen patch has been removed from the MAME core as of some point in March. We will be investigating our options for this. For MAME-based systems, make sure to set 7z use to false as MAME needs zip files.
  66. ; Sony PSP/PlayStation Minis: To avoid the dialog box complaining about ppge_atlas.zim, download it from https://github.com/libretro/libretro-ppsspp/blob/master/assets/ppge_atlas.zim and place it in your Retroarch/system/PPSSPP/ directory.
  67. ;----------------------------------------------------------------------------
  68. StartModule()
  69. BezelGUI()
  70. FadeInStart()
  71.  
  72. primaryExe := new Process(emuPath . "\" . executable) ; instantiate emulator executable object
  73. emuPrimaryWindow := new Window(new WindowTitle("RetroArch","RetroArch")) ; instantiate primary emulator window object
  74. emuConsoleWindow := new Window(new WindowTitle("","ConsoleWindowClass")) ; instantiate emulator console window object
  75.  
  76. ; Here we define all supported systems for this module. This object controls how the module reacts to different systems. RetroArch can play a lot of systems, but needs to know what system you want to run, so this module has to adapt.
  77. ; 1 - Official System Name in RocketLauncher
  78. ; 2 - Short name used only for easy referencing within module
  79. ; 3 - Default core
  80. ; 4 - The system ID MAME core recognizes
  81. RLLog.Debug("Module - Started building the " . MEmu . " object")
  82. mTypeVar:="
  83. ( LTrim
  84. AAE|LibRetro_AAE|mame_libretro
  85. Acorn BBC Micro|LibRetro_BBCB|mess_libretro|bbcb
  86. Amstrad CPC|LibRetro_CPC|mess_libretro|cpc464
  87. Amstrad GX4000|LibRetro_GX4K|mess_libretro|gx4000
  88. APF Imagination Machine|LibRetro_APF|mess_libretro|apfimag
  89. Apple IIGS|LibRetro_AIIGS|mess_libretro|apple2gs
  90. Applied Technology MicroBee|LibRetro_MBEE|mess_libretro|mbeeic
  91. Atari 2600|LibRetro_2600|stella_libretro|a2600
  92. Atari 5200|LibRetro_5200|mess_libretro|a5200
  93. Atari 7800|LibRetro_7800|prosystem_libretro|a7800
  94. Atari 8-Bit|LibRetro_ATARI8|mess_libretro|a800
  95. Atari Classics|LibRetro_ACLS|mame_libretro
  96. Atari Jaguar|LibRetro_JAG|virtualjaguar_libretro|jaguar
  97. Atari Lynx|LibRetro_LYNX|handy_libretro|lynx
  98. Atari ST|LibRetro_ST|hatari_libretro
  99. Atari XEGS|LibRetro_XEGS|mess_libretro|xegs
  100. Bally Astrocade|LibRetro_BAST|mess_libretro|astrocde
  101. Bandai Gundam RX-78|LibRetro_BGRX|mess_libretro|rx78
  102. Bandai Super Vision 8000|LibRetro_SV8K|mess_libretro|sv8000
  103. Bandai Wonderswan|LibRetro_WSAN|mednafen_wswan_libretro|wswan
  104. Bandai Wonderswan Color|LibRetro_WSANC|mednafen_wswan_libretro|wscolor
  105. Canon X07|LibRetro_CX07|mess_libretro|x07
  106. Capcom Classics|LibRetro_CAPC|mame_libretro
  107. Capcom Play System|LibRetro_CPS1|fba_cores_cps1_libretro
  108. Capcom Play System II|LibRetro_CPS2|fba_cores_cps2_libretro
  109. Capcom Play System III|LibRetro_CPS3|mame_libretro
  110. Casio PV-1000|LibRetro_CAS1K|mess_libretro|pv1000
  111. Casio PV-2000|LibRetro_CAS2K|mess_libretro|pv2000
  112. Cave|LibRetro_CAVE|mame_libretro
  113. Coleco ADAM|LibRetro_ADAM|mess_libretro|adam
  114. ColecoVision|LibRetro_COLEC|mess_libretro|coleco
  115. Commodore Amiga|LibRetro_PUAE|puae_libretro
  116. Commodore Max Machine|LibRetro_CMAX|mess_libretro|vic10
  117. Creatronic Mega Duck|LibRetro_DUCK|mess_libretro|megaduck
  118. Data East Classics|LibRetro_DATA|mame_libretro
  119. Dragon Data Dragon|LibRetro_DRAG64|mess_libretro|dragon64
  120. Elektronika BK|LibRetro_EBK|mess_libretro|bk0010
  121. Elektronska Industrija Pecom 64|LibRetro_P64|mess_libretro|pecom64
  122. Emerson Arcadia 2001|LibRetro_A2001|mess_libretro|arcadia
  123. Entex Adventure Vision|LibRetro_AVISION|mess_libretro|advision
  124. Epoch Game Pocket Computer|LibRetro_GPCKET|mess_libretro|gamepock
  125. Epoch Super Cassette Vision|LibRetro_SCV|mess_libretro|scv
  126. Exidy Sorcerer|LibRetro_SORCR|mess_libretro|sorcerer
  127. Fairchild Channel F|LibRetro_CHANF|mess_libretro|channelf
  128. Final Burn Alpha|LibRetro_FBA|fb_alpha_libretro
  129. Funtech Super Acan|LibRetro_SACAN|mess_libretro|supracan
  130. GamePark 32|LibRetro_GP32|mess_libretro|gp32
  131. GCE Vectrex|LibRetro_VECTX|mess_libretro|vectrex
  132. Hartung Game Master|LibRetro_GMASTR|mess_libretro|gmaster
  133. Interton VC 4000|LibRetro_VC4K|mess_libretro|vc4000
  134. Irem Classics|LibRetro_IREM|mame_libretro
  135. JungleTac Sport Vii|LibRetro_SPORTV|mess_libretro|vii
  136. Konami Classics|LibRetro_KONC|mame_libretro
  137. Magnavox Odyssey 2|LibRetro_ODYS2|mess_libretro|odyssey2
  138. MAME|LibRetro_MAME|mame_libretro|mame
  139. Matra & Hachette Alice|LibRetro_ALICE|mess_libretro|alice32
  140. Mattel Aquarius|LibRetro_AQUA|mess_libretro|aquarius
  141. Mattel Intellivision|LibRetro_INTV|mess_libretro|intv
  142. MGT Sam Coupe|LibRetro_SAMCP|mess_libretro|
  143. Microsoft MS-DOS|LibRetro_MSDOS|dosbox_libretro
  144. Microsoft MSX|LibRetro_MSX|bluemsx_libretro
  145. Microsoft MSX2|LibRetro_MSX2|bluemsx_libretro
  146. Microsoft Windows 3.x|LibRetro_WIN3X|dosbox_libretro
  147. Midway Classics|LibRetro_MIDC|mame_libretro
  148. Namco Classics|LibRetro_NAMC|mame_libretro
  149. Namco System 22|LibRetro_NAM2|mame_libretro
  150. NEC PC Engine|LibRetro_PCE|mednafen_pce_fast_libretro|pce,cart
  151. NEC PC Engine-CD|LibRetro_PCECD|mednafen_pce_fast_libretro|pce,cdrom
  152. NEC PC-FX|LibRetro_PCFX|mednafen_pcfx_libretro
  153. NEC SuperGrafx|LibRetro_SGFX|mednafen_supergrafx_libretro|sgx,cart
  154. NEC TurboGrafx-16|LibRetro_TG16|mednafen_pce_fast_libretro|tg16,cart
  155. NEC TurboGrafx-CD|LibRetro_TGCD|mednafen_pce_fast_libretro|tg16,cdrom
  156. Nintendo 64|LibRetro_N64|mupen64plus_libretro|n64
  157. Nintendo 64DD|LibRetro_N64|mupen64plus_libretro
  158. Nintendo Arcade Systems|LibRetro_NINARC|mame_libretro
  159. Nintendo Classics|LibRetro_NINC|mame_libretro
  160. Nintendo DS|LibRetro_DS|desmume_libretro
  161. Nintendo Entertainment System|LibRetro_NES|nestopia_libretro|nes
  162. Nintendo Famicom|LibRetro_NFAM|nestopia_libretro
  163. Nintendo Famicom Disk System|LibRetro_NFDS|nestopia_libretro|famicom
  164. Nintendo Game Boy|LibRetro_GB|gambatte_libretro|gameboy
  165. Nintendo Game Boy Advance|LibRetro_GBA|vba_next_libretro|gba
  166. Nintendo Game Boy Color|LibRetro_GBC|gambatte_libretro|gbcolor
  167. Nintendo Game Boy Japan|LibRetro_GBJ|gambatte_libretro|gameboy
  168. Nintendo Game & Watch|LibRetro_GW|gw_libretro
  169. Nintendo Pokemon Mini|LibRetro_POKE|mess_libretro|pokemini
  170. Nintendo Satellaview|LibRetro_NSFS|snes9x_libretro
  171. Nintendo SuFami Turbo|LibRetro_NSFST|snes9x_libretro
  172. Nintendo Super Famicom|LibRetro_NSF|bsnes_balanced_libretro
  173. Nintendo Super Game Boy|LibRetro_SGB|bsnes_balanced_libretro
  174. Nintendo Virtual Boy|LibRetro_NVB|mednafen_vb_libretro|vboy
  175. Othello Multivision|LibRetro_OTHO|genesis_plus_gx_libretro
  176. Panasonic 3DO|LibRetro_3DO|4do_libretro
  177. Philips CD-i|LibRetro_CDI|mess_libretro|cdimono1
  178. Philips Videopac|LibRetro_PVID|mess_libretro|videopac
  179. RCA Studio II|LibRetro_STUD2|mess_libretro|studio2
  180. SCUMMVM|LibRetro_SCUMM|scummvm_libretro
  181. Sega 32X|LibRetro_32X|picodrive_libretro|32x
  182. Sega CD|LibRetro_SCD|genesis_plus_gx_libretro|segacd
  183. Sega Classics|LibRetro_SEGC|mame_libretro
  184. Sega Dreamcast|LibRetro_DCAST|reicast_libretro
  185. Sega Game Gear|LibRetro_GG|genesis_plus_gx_libretro|gamegear
  186. Sega Genesis|LibRetro_GEN|genesis_plus_gx_libretro|genesis
  187. Sega Mark III|Libretro_SM3|genesis_plus_gx_libretro
  188. Sega Master System|LibRetro_SMS|genesis_plus_gx_libretro|sms
  189. Sega Mega Drive|LibRetro_GEN|genesis_plus_gx_libretro|megadriv
  190. Sega Mega Drive 32X|LibRetro_MD32X|picodrive_libretro
  191. Sega Meganet|LibRetro_GEN|genesis_plus_gx_libretro|genesis
  192. Sega Nomad|LibRetro_GEN|genesis_plus_gx_libretro|genesis
  193. Sega Pico|LibRetro_PICO|picodrive_libretro
  194. Sega Saturn|LibRetro_SAT|yabause_libretro|saturn
  195. Sega Saturn Japan|LibRetro_SAT|yabause_libretro|saturnjp
  196. Sega SC-3000|LibRetro_SC3K|mess_libretro|sc3000
  197. Sega SG-1000|LibRetro_SG1K|genesis_plus_gx_libretro
  198. Sega ST-V|LibRetro_STV|mame_libretro
  199. Sega VMU|LibRetro_SVMU|mess_libretro|svmu
  200. Sharp X1|LibRetro_SX1|mess_libretro|x1
  201. Sinclair ZX Spectrum|LibRetro_SPECZX|mess_libretro|spectrum
  202. SNK Classics|LibRetro_SNKC|mame_libretro
  203. SNK Neo Geo|LibRetro_NEO|fb_alpha_libretro
  204. SNK Neo Geo AES|LibRetro_NEOAES|mame_libretro|aes
  205. SNK Neo Geo CD|LibRetro_NEOCD|mess_libretro|neocdz
  206. SNK Neo Geo MVS|LibRetro_NEOMVS|mame_libretro
  207. SNK Neo Geo Pocket|LibRetro_NGP|mednafen_ngp_libretro|ngp
  208. SNK Neo Geo Pocket Color|LibRetro_NGPC|mednafen_ngp_libretro|ngpc
  209. Sony PlayStation|LibRetro_PSX|mednafen_psx_libretro|psu
  210. Sony PlayStation Minis|LibRetro_PSXMIN|ppsspp_libretro
  211. Sony PocketStation|LibRetro_POCKS|mess_libretro|pockstat
  212. Sony PSP|LibRetro_PSP|ppsspp_libretro
  213. Sord M5|LibRetro_SORD|mess_libretro|m5
  214. Spectravideo|LibRetro_SV328|mess_libretro|svi328n
  215. Super Nintendo Entertainment System|LibRetro_SNES|bsnes_balanced_libretro|snes
  216. Taito Classics|LibRetro_TAIC|mame_libretro
  217. Tandy TRS-80 Color Computer|LibRetro_TRS80|mess_libretro|coco3
  218. Technos|LibRetro_TECHN|mame_libretro
  219. Texas Instruments TI 99-4A|LibRetro_TI99|mess_libretro|ti99_4a
  220. Thomson MO5|LibRetro_MO5|mess_libretro|mo5
  221. Thomson TO7|LibRetro_TO7|mess_libretro|to7
  222. Tiger Game.com|LibRetro_TCOM|mess_libretro|gamecom
  223. Tiki-100|LibRetro_TIKI|mess_libretro|kontiki
  224. Tomy Tutor|LibRetro_TOMY|mess_libretro|tutor
  225. VTech CreatiVision|LibRetro_VTECH|mess_libretro|crvision
  226. Watara Supervision|LibRetro_SUPRV|mess_libretro|svision
  227. Williams Classics|LibRetro_WILLS|mame_libretro
  228. )"
  229. mType := Object()
  230. Loop, Parse, mTypeVar, `n, `r
  231. {
  232. obj := {}
  233. Loop, Parse, A_LoopField, |
  234. {
  235. If (A_Index = 1)
  236. obj.System := A_LoopField
  237. Else If (A_Index = 2)
  238. obj.ID := A_LoopField
  239. Else If (A_Index = 3)
  240. obj.Core := A_LoopField
  241. Else { ; 4
  242. StringSplit, tmp, A_LoopField, `,
  243. obj.MAMEID := tmp1
  244. obj.MAMEMedia := tmp2
  245. }
  246. }
  247. mType.Insert(obj["System"], obj)
  248. }
  249. RLLog.Debug("Module - Finished building the " . MEmu . " object")
  250. ; For easier use throughout the module
  251. retroSystem := mType[systemName].System
  252. retroID := mType[systemName].ID
  253. retroCore := mType[systemName].Core
  254. retroMAMEID := mType[systemName].MAMEID
  255. retroMAMEMedia := mType[systemName].MAMEMedia
  256. RLLog.Info("Module - Using these system variables:")
  257. RLLog.Info("Module - retroSystem: " . retroSystem)
  258. RLLog.Info("Module - retroID: " . retroID)
  259. RLLog.Info("Module - retroCore: " . retroCore)
  260. RLLog.Info("Module - retroMAMEID: " . retroMAMEID)
  261. RLLog.Info("Module - retroMAMEMedia: " . retroMAMEMedia)
  262. If !retroSystem
  263. ScriptError("Your systemName is: " . systemName . "`nIt is not one of the known supported systems for this " . MEmu . " module: " . moduleName)
  264. If !retroCore
  265. ScriptError("Your Core ID is: " . retroID . "`nCould not find a default core to use. Please update the module with a default core.")
  266.  
  267. Fullscreen := moduleIni.ReadCheck("Settings", "Fullscreen","true","",1)
  268. configFolder := moduleIni.ReadCheck("Settings", "ConfigFolder",emuPath . "\config","",1)
  269. mameRomPath := moduleIni.ReadCheck("MAME", "BIOS_Roms_Folder","","",1)
  270. mameHideNag := If moduleIni.ReadCheck("MAME", "Hide_Nag_Screen","false","",1) = "true" ? "enabled" : "disabled"
  271. mameHideInfo := If moduleIni.ReadCheck("MAME", "Hide_Info_Screen","false","",1) = "true" ? "enabled" : "disabled"
  272. mameHideWarn := If moduleIni.ReadCheck("MAME", "Hide_Warning_Screen","false","",1) = "true" ? "enabled" : "disabled"
  273. hideConsole := moduleIni.ReadCheck("Settings", "HideConsole","true","",1)
  274. ejectToggleKey := moduleIni.ReadCheck("Settings", "Eject_Toggle_Key","","",1)
  275. nextDiskKey := moduleIni.ReadCheck("Settings", "Next_Disk_Key","","",1)
  276. prevDiskKey := moduleIni.ReadCheck("Settings", "Previous_Disk_Key","","",1)
  277. core := moduleIni.ReadCheck(systemName . "|" . romName, "LibRetro_Core",retroCore,"",1)
  278. superGB := moduleIni.ReadCheck(systemName . "|" . romName, "SuperGameBoy","false","",1)
  279. enableNetworkPlay := moduleIni.ReadCheck("Network|" . romName, "Enable_Network_Play","false","",1)
  280. overlay := moduleIni.ReadCheck(systemName . "|" . romName, "Overlay","","",1)
  281. videoShader := moduleIni.ReadCheck(systemName . "|" . romName, "VideoShader","","",1)
  282. aspectRatioIndex := moduleIni.ReadCheck(systemName . "|" . romName, "AspectRatioIndex","","",1)
  283. customViewportWidth := moduleIni.ReadCheck(systemName . "|" . romName, "CustomViewportWidth","","",1)
  284. customViewportHeight := moduleIni.ReadCheck(systemName . "|" . romName, "CustomViewportHeight","","",1)
  285. customViewportX := moduleIni.ReadCheck(systemName . "|" . romName, "CustomViewportX","","",1)
  286. customViewportY := moduleIni.ReadCheck(systemName . "|" . romName, "CustomViewportY","","",1)
  287. stretchToFillBezel := moduleIni.ReadCheck(systemName . "|" . romName, "StretchToFillBezel","false","",1)
  288. rotation := moduleIni.ReadCheck(systemName . "|" . romName, "Rotation",0,"",1)
  289. cropOverscan := moduleIni.ReadCheck(systemName . "|" . romName, "CropOverscan","","",1)
  290. threadedVideo := moduleIni.ReadCheck(systemName . "|" . romName, "ThreadedVideo","","",1)
  291. vSync := moduleIni.ReadCheck(systemName . "|" . romName, "VSync","","",1)
  292. integerScale := moduleIni.ReadCheck(systemName . "|" . romName, "IntegerScale","","",1)
  293. configurationPerCore := moduleIni.ReadCheck(systemName . "|" . romName, "ConfigurationPerCore","false","",1)
  294.  
  295. configFolder := RLObject.getFullPathFromRelative(rlPath,configFolder)
  296. mameRomPath := If mameRomPath ? RLObject.getFullPathFromRelative(rlPath,mameRomPath) : romPath
  297. overlay := RLObject.getFullPathFromRelative(rlPath,overlay)
  298. videoShader := RLObject.getFullPathFromRelative(rlPath,videoShader)
  299. rotateBezel := false
  300.  
  301. configFolder := new Folder(configFolder)
  302.  
  303. If (retroID = "LibRetro_SGB" || superGB = "true") ; if system or rom is set to use Super Game Boy
  304. { superGB := "true" ; setting this just in case it's false and the system is Nintendo Super Game Boy
  305. sgbRomPath := CheckFile(emuPath . "\system\Super Game Boy (World).sfc","Could not find the rom required for Super Game Boy support. Make sure the rom ""Super Game Boy (World).sfc"" is located in: " . emuPath . "\system")
  306. CheckFile(emuPath . "\system\sgb.boot.rom","Could not find the bios required for Super Game Boy support. Make sure the bios ""sgb.boot.rom"" is located in: " . emuPath . "\system")
  307. retroID := "LibRetro_SGB" ; switching to Super Game Boy mode
  308. retroSystem := "Nintendo Super Game Boy"
  309. }
  310.  
  311. ; Find the dll for this system
  312. libDll := CheckFile(emuPath . "\cores\" . core . ".dll", "Your " . retroID . " dll is set to " . core . " but could not locate this file:`n" . emuPath . "\cores\" . core . ".dll")
  313.  
  314. ; Find the cfg file to use
  315. If !configFolder.Exist()
  316. ScriptError("You need to make sure ""ConfigFolder"" is pointing to your RetroArch config folder. By default it is looking here: """ . configFolder.FilePath . """")
  317. globalRetroCfg := emuPath . "\retroarch.cfg"
  318. systemRetroCfg := configFolder.FilePath . "\" . retroSystem . ".cfg"
  319. coreRetroCfg := configFolder.FilePath . "\" . core . ".dll.cfg"
  320. RLLog.Info("Module - Global cfg should be: " . globalRetroCfg)
  321. RLLog.Info("Module - System cfg should be: " . systemRetroCfg)
  322. RLLog.Info("Module - Core cfg should be: " . coreRetroCfg)
  323. foundCfg := ""
  324.  
  325. systemRetroCfg := new File(systemRetroCfg)
  326. coreRetroCfg := new File(coreRetroCfg)
  327. globalRetroCfg := new File(globalRetroCfg)
  328.  
  329. If systemRetroCfg.Exist() { ; check for system cfg first
  330. retroCFGFile := systemRetroCfg
  331. foundCfg := 1
  332. RLLog.Info("Module - Found a System cfg!")
  333. } Else If coreRetroCfg.Exist() { ; 2nd option is a core config
  334. retroCFGFile := coreRetroCfg
  335. foundCfg := 1
  336. RLLog.Info("Module - Found a Core cfg!")
  337. } Else If globalRetroCfg.Exist() { ; 3rd is global cfg
  338. retroCFGFile := globalRetroCfg
  339. foundCfg := 1
  340. RLLog.Info("Module - Found a Global cfg!")
  341. }
  342. If foundCfg {
  343. RLLog.Info("Module - " . MEmu . " is using " . retroCFGFile.FileFullPath . " as its config file.")
  344. retroCFG := LoadProperties(retroCFGFile.FileFullPath)
  345. } Else
  346. RLLog.Warning("Module - Could not find a cfg file to update settings. RetroArch will make one for you.")
  347.  
  348. If StringUtils.Contains(rotation,"1|3") ; use vertical bezel if RA rotation is set to 90 or 270 degrees
  349. rotateBezel := true
  350.  
  351. If StringUtils.Contains(retroID, "LibRetro_NFDS|LibRetro_SCD|LibRetro_TGCD|LibRetro_PCECD|LibRetro_PCFX") { ; these systems require the retroarch settings to be read
  352. retroSysDir := ReadProperty(retroCFG,"system_directory") ; read value
  353. retroSysDir := ConvertRetroCFGKey(retroSysDir) ; remove dbl quotes
  354. retroSysDirLeft := StringUtils.Left(retroSysDir, 2)
  355. If (retroSysDirLeft = ":\") { ; if retroarch is set to use a default folder
  356. retroSysDir := StringUtils.TrimLeft(retroSysDir, 1)
  357. RLLog.Info("Module - RetroArch is using a relative system path: """ . retroSysDir . """")
  358. retroSysDir := emuPath . retroSysDir
  359. }
  360. If !retroSysDir
  361. ScriptError("RetroArch requires you to set your system_directory and place bios rom(s) in there for """ . retroSystem . """ to function. Please do this first by running ""retroarch-phoenix.exe"" manually.")
  362. checkForSlash := StringUtils.Right(retroSysDir, 1)
  363. If (checkForSlash = "\") ; check if a backslash is the last character. If it is, remove it, as this is non-standard method to define folders
  364. retroSysDir := StringUtils.TrimRight(retroSysDir, 1)
  365. }
  366.  
  367. If (StringUtils.Contains(core, "^(mame|mess|ume)")) || (StringUtils.Contains(retroID, "LibRetro_N64|LibRetro_NES|LibRetro_LYNX|LibRetro_PSX")) || (StringUtils.Contains(retroID, "LibRetro_NES") && (StringUtils.Contains(core, "nestopia_libretro"))) { ; these systems will use an ini to store game specific settings
  368. RLLog.Info("Module - Reading / creating system ini for specific settings.")
  369. If !StringUtils.Contains(core, "^(mame|mess|ume)") {
  370. If !SystemModuleIni.Exist()
  371. SystemModuleIni.Append ; create a new blank ini file if one does not exist
  372. }
  373.  
  374. If (configurationPerCore = "true")
  375. coreOptionsCFGFile := coreOptionsCFGFile.CheckFile(new File(configFolder.FilePath . "\retroarch-core-options.cfg"), "Could not find retroarch-core-options.cfg in retroarch directory: """ . configFolder.FilePath . """")
  376. Else
  377. coreOptionsCFGFile := coreOptionsCFGFile.CheckFile(new File(emuPath . "\retroarch-core-options.cfg"), "Could not find retroarch-core-options.cfg in retroarch directory: """ . emuPath . """")
  378. coreOptionsCFG := LoadProperties(coreOptionsCFGFile.FileFullPath)
  379.  
  380. If StringUtils.Contains(core, "^(mame|mess|ume)") { ; Set some MAME/MESS/UME core options.
  381. tmpCore := If StringUtils.Contains(core, "mame") ? "mame" : "mess"
  382. WriteProperty(coreOptionsCFG, tmpCore . "_read_config", """enabled""", 1)
  383. WriteProperty(coreOptionsCFG, tmpCore . "_boot_from_cli", """enabled""", 1) ; This needs to be enabled in order to run games with RLauncher
  384. WriteProperty(coreOptionsCFG, tmpCore . "_hide_nagscreen", "" . mameHideNag . "", 1)
  385. WriteProperty(coreOptionsCFG, tmpCore . "_hide_infoscreen", "" . mameHideInfo . "", 1)
  386. WriteProperty(coreOptionsCFG, tmpCore . "_hide_warnings", "" . mameHideWarn . "", 1)
  387. } Else If StringUtils.Contains(retroID, "LibRetro_N64") { ; Nintendo 64
  388. mupenGfx := moduleIni.ReadCheck(systemName . "|" . romName, "Mupen_Gfx_Plugin", "auto","",1)
  389. mupenRsp := moduleIni.ReadCheck(systemName . "|" . romName, "Mupen_RSP_Plugin", "auto","",1)
  390. mupenCpu := moduleIni.ReadCheck(systemName . "|" . romName, "Mupen_CPU_Core", "dynamic_recompiler","",1)
  391. mupenPak1 := moduleIni.ReadCheck(systemName . "|" . romName, "Mupen_Pak_1", "memory","",1)
  392. mupenPak2 := moduleIni.ReadCheck(systemName . "|" . romName, "Mupen_Pak_2", "memory","",1)
  393. mupenPak3 := moduleIni.ReadCheck(systemName . "|" . romName, "Mupen_Pak_3", "memory","",1)
  394. mupenPak4 := moduleIni.ReadCheck(systemName . "|" . romName, "Mupen_Pak_4", "memory","",1)
  395. mupenGfxAccur := moduleIni.ReadCheck(systemName . "|" . romName, "Mupen_Gfx_Accuracy", "high","",1)
  396. mupenExpMem := moduleIni.ReadCheck(systemName . "|" . romName, "Mupen_Disable_Exp_Memory", "no","",1)
  397. mupenTexturFilt := moduleIni.ReadCheck(systemName . "|" . romName, "Mupen_Texture_Filtering", "nearest","",1)
  398. mupenViRefresh := moduleIni.ReadCheck(systemName . "|" . romName, "Mupen_VI_Refresh", "2200","",1)
  399. mupenFramerate := moduleIni.ReadCheck(systemName . "|" . romName, "Mupen_Framerate", "fullspeed","",1)
  400. mupenResolution := moduleIni.ReadCheck(systemName . "|" . romName, "Mupen_Resolution", "640x480","",1)
  401. mupenPolyOffstFctr := moduleIni.ReadCheck(systemName . "|" . romName, "Mupen_Polygon_Offset_Factor", "-3.0","",1)
  402. mupenPolyOffstUnts := moduleIni.ReadCheck(systemName . "|" . romName, "Mupen_Polygon_Offset_Units", "-3.0","",1)
  403. mupenViOverlay := moduleIni.ReadCheck(systemName . "|" . romName, "Mupen_VI_Overlay", "disabled","",1)
  404. mupenAnalogDzone := moduleIni.ReadCheck(systemName . "|" . romName, "Mupen_Analog_Deadzone", "15","",1)
  405.  
  406. WriteProperty(coreOptionsCFG, "mupen64-gfxplugin", mupenGfx, 1)
  407. WriteProperty(coreOptionsCFG, "mupen64-rspplugin", mupenRsp, 1)
  408. WriteProperty(coreOptionsCFG, "mupen64-cpucore", mupenCpu, 1)
  409. WriteProperty(coreOptionsCFG, "mupen64-pak1", mupenPak1, 1)
  410. WriteProperty(coreOptionsCFG, "mupen64-pak2", mupenPak2, 1)
  411. WriteProperty(coreOptionsCFG, "mupen64-pak3", mupenPak3, 1)
  412. WriteProperty(coreOptionsCFG, "mupen64-pak4", mupenPak4, 1)
  413. WriteProperty(coreOptionsCFG, "mupen64-gfxplugin-accuracy", mupenGfxAccur, 1)
  414. WriteProperty(coreOptionsCFG, "mupen64-disableexpmem", mupenExpMem, 1)
  415. WriteProperty(coreOptionsCFG, "mupen64-filtering", mupenTexturFilt, 1)
  416. WriteProperty(coreOptionsCFG, "mupen64-virefresh", mupenViRefresh, 1)
  417. WriteProperty(coreOptionsCFG, "mupen64-framerate", mupenFramerate, 1)
  418. WriteProperty(coreOptionsCFG, "mupen64-screensize", mupenResolution, 1)
  419. WriteProperty(coreOptionsCFG, "mupen64-polyoffset-factor", mupenPolyOffstFctr, 1)
  420. WriteProperty(coreOptionsCFG, "mupen64-polyoffset-units", mupenPolyOffstUnts, 1)
  421. WriteProperty(coreOptionsCFG, "mupen64-angrylion-vioverlay", mupenViOverlay, 1)
  422. WriteProperty(coreOptionsCFG, "mupen64-astick-deadzone", mupenAnalogDzone, 1)
  423. } Else If StringUtils.Contains(retroID, "LibRetro_NES") { ; these systems will use an ini to store game specific settings
  424. If StringUtils.Contains(core, "nestopia_libretro") { ; Nestopia
  425. nestopiaBlargg := moduleIni.ReadCheck("Nestopia" . "|" . romName, "Nestopia_Blargg_NTSC_Filter", "disabled","",1)
  426. nestopiaPalette := moduleIni.ReadCheck("Nestopia" . "|" . romName, "Nestopia_Palette", "canonical","",1)
  427. nestopiaNoSprteLimit := moduleIni.ReadCheck("Nestopia" . "|" . romName, "Nestopia_Remove_Sprites_Limit", "disabled","",1)
  428.  
  429. WriteProperty(coreOptionsCFG, "nestopia_blargg_ntsc_filter", nestopiaBlargg, 1)
  430. WriteProperty(coreOptionsCFG, "nestopia_palette", nestopiaPalette, 1)
  431. WriteProperty(coreOptionsCFG, "nestopia_nospritelimit", nestopiaNoSprteLimit, 1)
  432. }
  433. } Else If StringUtils.Contains(retroID, "LibRetro_LYNX") { ; Atari Lynx
  434. If StringUtils.Contains(core, "handy_libretro") { ; Handy
  435. handyRotate := moduleIni.ReadCheck(systemName . "|" . romName, "Handy_Rotation", "None","",1)
  436. If StringUtils.Contains(handyRotate, "240") or StringUtils.Contains(handyRotate, "90")
  437. rotateBezel := true
  438. WriteProperty(coreOptionsCFG, "handy_rot", handyRotate, 1)
  439. }
  440. } Else If StringUtils.Contains(retroID, "LibRetro_PSX") { ; Sony PlayStation
  441. psxCdImageCache := moduleIni.ReadCheck(systemName . "|" . romName, "PSX_CD_Image_Cache", """enabled""","",1)
  442. psxMemcardHandling := moduleIni.ReadCheck(systemName . "|" . romName, "PSX_Memcard_Handling", """libretro""","",1)
  443. psxDualshockAnalogToggle := moduleIni.ReadCheck(systemName . "|" . romName, "PSX_Dualshock_Analog_Toggle", """enabled""","",1)
  444.  
  445. WriteProperty(coreOptionsCFG, "beetle_psx_cdimagecache", psxCdImageCache, 1)
  446. WriteProperty(coreOptionsCFG, "beetle_psx_use_mednafen_memcard0_method", psxMemcardHandling, 1)
  447. WriteProperty(coreOptionsCFG, "beetle_psx_analog_toggle", psxDualshockAnalogToggle, 1)
  448. }
  449. SaveProperties(coreOptionsCFGFile.FileFullPath, coreOptionsCFG)
  450. }
  451.  
  452. hideEmuObj := Object(emuConsoleWindow,0,emuPrimaryWindow,1)
  453. 7z(romPath, romName, romExtension, sevenZExtractPath)
  454.  
  455. mgM3UFile := new File(romPath . "\" . romTable[1,4] . ".m3u")
  456.  
  457. mgRomExtensions := "cue|iso|ccd"
  458. mgValidExtension := false
  459.  
  460. Loop, Parse, mgRomExtensions, |
  461. If (romExtension = "." . A_LoopField)
  462. mgValidExtension := true
  463.  
  464. If (StringUtils.Contains(retroID, "LibRetro_PSX") && romTable.MaxIndex() && mgValidExtension) { ; See if MultiGame table is populated
  465. m3uRomIndex := Object()
  466. mgType := romTable[1,6] . " "
  467. mgMaxIndex := romTable.MaxIndex()
  468. mgRomIndex := 0
  469.  
  470. If mgM3UFile.Exist()
  471. mgM3UFile.Delete()
  472.  
  473. Loop % mgMaxIndex
  474. {
  475. If (romTable[A_Index, 3] = romName) {
  476. tempType := romTable[A_Index, 5]
  477. mgRomIndex := StringUtils.TrimLeft(tempType, StringUtils.StringLength(mgType))
  478. RLLog.Info("Found rom index in rom set in romTable: " . mgRomIndex)
  479. Break
  480. }
  481. }
  482.  
  483. If (mgRomIndex > 0) {
  484. tempRomIndex := mgRomIndex
  485. Loop % mgMaxIndex
  486. {
  487. mgTypeIndex := mgType . tempRomIndex
  488. m3uRomIndex.Insert(tempRomIndex)
  489.  
  490. Loop % mgMaxIndex
  491. {
  492. If (romTable[A_Index, 5] = mgTypeIndex) {
  493. tempRomPath := romTable[A_Index, 1]
  494. mgM3UFile.Append(tempRomPath . "`n")
  495. RLLog.Info("Module - Appending rom path to m3u: " . tempRomPath)
  496. Break
  497. }
  498. }
  499.  
  500. If (tempRomIndex < mgMaxIndex)
  501. tempRomIndex++
  502. Else
  503. tempRomIndex := 1
  504. }
  505. }
  506. }
  507.  
  508. ; MAME/MESS/UME core options
  509. MAMEParam1 := ""
  510. MAMEParam2 := ""
  511. MAMEParam3 := ""
  512. If StringUtils.Contains(core, "^(mame|mess|ume)") { ; if a MAME/MESS/UME core is used
  513. If !retroMAMEID
  514. ScriptError("Your systemName is: " . systemName . "`nIt is not one of the known supported systems for the MAME/MESS/UME LibRetro core")
  515. Else
  516. RLLog.Info("Module - MAME/MESS/UME mode using a known ident: " . retroMAMEID)
  517.  
  518. If !mameRomPath
  519. ScriptError("Please set the RetroArch module setting ""BIOS_Roms_Folder"" to the folder that contains your MAME/MESS/UME BIOS roms to use with RetroArch.")
  520.  
  521. If (retroMAMEID = "mame") { ; don't want the following block for arcade mame
  522. RLLog.Info("Module - Retroarch MAME/MESS/UME Arcade mode enabled")
  523. fullRomPath := " """ . romPath . "\" . romName . romExtension . """"
  524. } Else {
  525. RLLog.Info("Module - Retroarch MAME/MESS/UME Console/PC mode enabled")
  526. MAMEParam1 := ""
  527. MAMEParam2 := " -rompath \""" . mameRomPath . "\"""
  528.  
  529. ; If we already have a media type, then use it.
  530. If (StringUtils.Contains(retroMAMEID, "tg16|pce") && retroMAMEMedia = "cart") {
  531. ;MAMEParam3 := " -cart \" . """" . romPath . "\" . romName . romExtension . "\" . """"
  532. MAMEParam3 := " -cart \""" . romPath . "\" . romName . romExtension . "\"""""
  533. ; TODO: This needs a better way to handle the cdrom bios files, in my opinion. As it is, there's no clean way to pick between the v2.00 or v3.00 bios.
  534. ; Defaulting to the TurboDuo cdrom bios since it will play 2.00 or 3.00 games.
  535. } Else If (StringUtils.Contains(retroMAMEID, "tg16|pce") && retroMAMEMedia = "cdrom") {
  536. ;MAMEParam3 := " -cart cdsys -cdrm \" . """" . romPath . "\" . romName . romExtension . "\" . """"
  537. MAMEParam3 := " -cart scdsys -cdrm \""" . romPath . "\" . romName . romExtension . "\"""""
  538. } Else {
  539. ; Build a key/value object containing the different MAMEParam3 choices
  540. MAMEP3 := Object("alice32","cass1","gp32","memc","cpc464","cass","spectrum","cass","dragon64","cass","cdimono1","cdrom","bk0010","cass","neocd","cdrom","neocdz","cdrom","saturn","cdrm","saturnjp","cdrm","svi328n","cass","pecom64","cass","psu","cdrm","svmu","quik","gamecom","cart1","mbeeic","quik1")
  541. MAMEParam3 := MAMEP3[retroMAMEID] ; search object for the retroMAMEID pair
  542. MAMEParam3 := " -" . (If MAMEParam3 ? MAMEParam3 : "cart") . " \" . """" . romPath . "\" . romName . romExtension . "\" . """"
  543. }
  544.  
  545. If (retroMAMEID = "mbeeic") ; Applied Technology MicroBee
  546. { microbeeModel := IniReadCheck(MAMESysINI, romName, "MicroBee_Model","mbeeic","",1)
  547. If microbeeModel not in mbee,mbeeic,mbeepc,mbeepc85,mbee56
  548. ScriptError("This is not a known MicroBee model value: " . microbeeModel)
  549. Else If (microbeeModel != "mbeeic")
  550. retroMAMEID := microbeeModel
  551. If romExtension in .mwb,.com,.bee
  552. mediaDeviceType := "quik1"
  553. Else If romExtension in .wav,.tap
  554. mediaDeviceType := "cass"
  555. Else If romExtension in .rom
  556. mediaDeviceType := "cart"
  557. Else If romExtension in .dsk
  558. mediaDeviceType := "flop1"
  559. Else ; .bin format
  560. mediaDeviceType := "quik2"
  561. MAMEParam3 := " -" . mediaDeviceType . " \" . """" . romPath . "\" . romName . romExtension . "\" . """"
  562. }
  563.  
  564. fullRomPath := MAMEParam1 . MAMEParam2 . MAMEParam3
  565. }
  566. } Else If (superGB = "true") {
  567. RLLog.Info("Module - Retroarch Super Game Boy mode enabled")
  568. fullRomPath := " """ . sgbRomPath . """ --subsystem sgb """ . romPath . "\" . romName . romExtension . """"
  569. } Else {
  570. RLLog.Info("Module - Retroarch standard mode enabled")
  571. fullRomPath := " """ . romPath . "\" . romName . romExtension . """"
  572. }
  573.  
  574. If (retroID = "LibRetro_NFDS") ; Nintendo Famicom Disk System
  575. { disksysRom := new File(retroSysDir . "\disksys.rom")
  576. If !disksysRom.Exist()
  577. ScriptError("RetroArch requires ""disksys.rom"" for " . retroSystem . " but could not find it in your system_directory: """ . retroSysDir . """")
  578. } Else If (retroID = "LibRetro_SCD") ; Sega CD
  579. { If !StringUtils.Contains(romExtension, "\.bin|\.cue|\.iso")
  580. ScriptError("RetroArch only supports Sega CD games in bin|cue|iso format. It does not support:`n" . romExtension)
  581. biosCDEBin := new File(retroSysDir . "\bios_CD_E.bin")
  582. biosCDUBin := new File(retroSysDir . "\bios_CD_U.bin")
  583. biosCDJBin := new File(retroSysDir . "\bios_CD_J.bin")
  584. If !biosCDEBin.Exist()
  585. ScriptError("RetroArch requires ""bios_CD_E.bin"" for " . retroSystem . " but could not find it in your system_directory: """ . retroSysDir . """")
  586. If !biosCDUBin.Exist()
  587. ScriptError("RetroArch requires ""bios_CD_U.bin"" for " . retroSystem . " but could not find it in your system_directory: """ . retroSysDir . """")
  588. If !biosCDJBin.Exist()
  589. ScriptError("RetroArch requires ""bios_CD_J.bin"" for " . retroSystem . " but could not find it in your system_directory: """ . retroSysDir . """")
  590. } Else If StringUtils.Contains(retroID,"LibRetro_PCECD|LibRetro_TGCD") ; NEC PC Engine-CD and NEC TurboGrafx-CD
  591. { If !StringUtils.Contains(romExtension,"\.ccd|\.cue")
  592. ScriptError("RetroArch only supports " . retroSystem . " games in ccd or cue format. It does not support:`n" . romExtension)
  593. sysCard3Pce := new File(retroSysDir . "\syscard3.pce")
  594. If !sysCard3Pce.Exist()
  595. ScriptError("RetroArch requires ""syscard3.pce"" for " . retroSystem . " but could not find it in your system_directory: """ . retroSysDir . """")
  596. } Else If (retroID = "LibRetro_PCFX")
  597. { If !StringUtils.Contains(romExtension,"\.ccd|\.cue")
  598. ScriptError("RetroArch only supports " . retroSystem . " games in ccd or cue format. It does not support:`n" . romExtension)
  599. pcfxBios := new File(retroSysDir . "\pcfx.bios")
  600. If !pcfxBios.Exist()
  601. ScriptError("RetroArch requires ""pcfx.bios"" for " . retroSystem . " but could not find it in your system_directory: """ . retroSysDir . """")
  602. } Else If (retroID = "LibRetro_SCUMM")
  603. {
  604. scummFile := new File(romPath . "\" . romName . ".scummvm")
  605. If !scummFile.Exist()
  606. scummFile.Append("""" . romName . """")
  607. }
  608.  
  609. networkSession := ""
  610. If (enableNetworkPlay = "true") {
  611. RLLog.Info("Module - Network Multi-Player is an available option for " . dbName)
  612.  
  613. netplayNickname := moduleIni.ReadCheck("Network", "NetPlay_Nickname","Player","",1)
  614. getWANIP := moduleIni.ReadCheck("Network", "Get_WAN_IP","false","",1)
  615.  
  616. If (getWANIP = "true")
  617. myPublicIP := GetPublicIP()
  618.  
  619. RLLog.Warning("Module - CAREFUL WHEN POSTING THIS LOG PUBLICLY AS IT CONTAINS YOUR IP ON THE NEXT LINE")
  620. defaultServerIP := moduleIni.ReadCheck("Network", "Default_Server_IP", myPublicIP,"",1)
  621. defaultServerPort := moduleIni.ReadCheck("Network", "Default_Server_Port","","",1)
  622. lastIP := moduleIni.ReadCheck("Network", "Last_IP", defaultServerIP,"",1) ; does not need to be on the ISD
  623. lastPort := moduleIni.ReadCheck("Network", "Last_Port", defaultServerPort,"",1) ; does not need to be on the ISD
  624.  
  625. mpMenuStatus := MultiPlayerMenu(lastIP,lastPort,networkType,"",0)
  626. If (mpMenuStatus = -1) { ; if user exited menu early
  627. RLLog.Warning("Module - Cancelled MultiPlayer Menu. Exiting module.")
  628. ExitModule()
  629. }
  630. If networkSession {
  631. RLLog.Info("Module - Using a Network for " . dbName)
  632. moduleIni.Write(networkPort, "Network", "Last_Port")
  633. ; msgbox lastIP: %lastIP%`nlastPort: %lastPort%`nnetworkIP: %networkIP%`nnetworkPort: %networkPort%
  634. If (networkType = "client") {
  635. moduleIni.Write(networkIP, "Network", "Last_IP") ; Save last used IP and Port for quicker launching next time
  636. netCommand := " -C " . networkIP . " --port " . networkPort . " --nick """ . netplayNickname . """" ; -C = connect as client
  637. } Else { ; server
  638. netCommand := " -H --port " . networkPort . " --nick """ . netplayNickname . """" ; -H = host as server
  639. }
  640. RLLog.Warning("Module - CAREFUL WHEN POSTING THIS LOG PUBLICLY AS IT CONTAINS YOUR IP ON THE NEXT LINE")
  641. RLLog.Info("Module - Starting a network session using the IP """ . networkIP . """ and PORT """ . networkPort . """")
  642. } Else
  643. RLLog.Info("Module - User chose Single Player mode for this session")
  644. }
  645.  
  646. BezelStart(,,(If rotateBezel ? 1:""))
  647.  
  648. If foundCfg {
  649. If (stretchToFillBezel = "true" and bezelEnabled = "true" and bezelPath)
  650. {
  651. customViewportWidth := bezelScreenWidth
  652. customViewportHeight := bezelScreenHeight
  653. customViewportX := 0
  654. customViewportY := 0
  655. aspectRatioIndex := 22
  656. RLLog.Info("Stretching viewport to fit bezel")
  657. }
  658.  
  659. raCfgHasChanges := ""
  660. WriteRetroProperty("input_overlay", overlay)
  661. WriteRetroProperty("video_shader", videoShader)
  662. WriteRetroProperty("aspect_ratio_index", aspectRatioIndex)
  663. WriteRetroProperty("custom_viewport_width", customViewportWidth)
  664. WriteRetroProperty("custom_viewport_height", customViewportHeight)
  665. WriteRetroProperty("custom_viewport_x", customViewportX)
  666. WriteRetroProperty("custom_viewport_y", customViewportY)
  667. WriteRetroProperty("video_rotation", rotation)
  668. WriteRetroProperty("video_crop_overscan", cropOverscan)
  669. WriteRetroProperty("video_threaded", threadedVideo)
  670. WriteRetroProperty("video_vsync", vSync)
  671. WriteRetroProperty("video_scale_integer", integerScale)
  672. WriteRetroProperty("input_disk_eject_toggle", ejectToggleKey)
  673. WriteRetroProperty("input_disk_next", nextDiskKey)
  674. WriteRetroProperty("input_disk_prev", prevDiskKey)
  675. If StringUtils.Contains(retroID, "LibRetro_PSX") {
  676. Loop, 8 ; Loop 8 times for 8 controllers
  677. { p%A_Index%ControllerType := moduleIni.ReadCheck(systemName . "|" . romName, "P" . A_Index . "_Controller_Type", 517,"",1)
  678. WriteRetroProperty("input_libretro_device_p" . A_Index, p%A_Index%ControllerType)
  679. }
  680. }
  681.  
  682. If raCfgHasChanges {
  683. RLLog.Info("Module - Saving changed settings to: """ . retroCFGFile.FileFullPath . """")
  684. SaveProperties(retroCFGFile.FileFullPath, retroCFG)
  685. }
  686. }
  687.  
  688. fullscreen := If fullscreen = "true" ? " -f" : ""
  689. srmPath := new Folder(emuPath . "\srm\" . retroSystem) ; path for this system's srm files
  690. saveStatePath := new Folder(emuPath . "\save\" . retroSystem) ; path for this system's save state files
  691. retroCFGFileCLI := If foundCfg ? " -c """ . retroCFGFile.FileFullPath . """" : ""
  692.  
  693. If !srmPath.Exist("folder")
  694. srmPath.CreateDir() ; creating srm dir if it doesn't exist
  695. If !saveStatePath.Exist("folder")
  696. saveStatePath.CreateDir() ; creating save dir if it doesn't exist
  697.  
  698. HideAppStart(hideEmuObj,hideEmu)
  699.  
  700. If (StringUtils.Contains(core, "^(mame|mess|ume)") && (retroMAMEID != "mame")) { ; if a MAME/MESS/UME core is used
  701. primaryExe.Run(" """ . (retroMAMEID ? retroMAMEID : "") . fullRomPath . """ " . fullscreen . retroCFGFileCLI . " -L """ . libDll . """ -s """ . srmPath.FilePath . "\" . romName . ".srm"" -S """ . saveStatePath.FilePath . "\" . romName . ".state""" . netCommand, "Hide")
  702. } Else If (retroID = "LibRetro_SCUMM") {
  703. primaryExe.Run(" """ . scummFile . """" . fullscreen . retroCFGFileCLI . " -L """ . libDll . """ -s """ . srmPath.FilePath . "\" . romName . ".srm"" -S """ . saveStatePath.FilePath . "\" . romName . ".state""" . netCommand, "Hide")
  704. } Else If (retroID = "LibRetro_SGB" || If superGB = "true") { ; For some reason, the order of our command line matters in this particular case.
  705. primaryExe.Run(fullscreen . retroCFGFileCLI . " -L """ . libDll . """ -s """ . srmPath.FilePath . "\" . romName . ".srm"" -S """ . saveStatePath.FilePath . "\" . romName . ".state""" . fullRomPath . netCommand, "Hide")
  706. } Else If mgM3UFile.Exist() {
  707. primaryExe.Run(" """ . mgM3UFile.FileFullPath . """" . fullscreen . retroCFGFileCLI . " -L """ . libDll . """ -s """ . srmPath.FilePath . "\" . romName . ".srm"" -S """ . saveStatePath.FilePath . "\" . romName . ".state""" . netCommand, "Hide")
  708. } Else {
  709. primaryExe.Run(" " . fullRomPath . fullscreen . retroCFGFileCLI . " -L """ . libDll . """ -s """ . srmPath.FilePath . "\" . romName . ".srm"" -S """ . saveStatePath.FilePath . "\" . romName . ".state""" . netCommand, "Hide")
  710. }
  711.  
  712. mpMenuStatus := ""
  713. If networkSession {
  714. canceledServerWait := false
  715. multiplayerMenuExit := false
  716. TimerUtils.SetTimer("NetworkConnectedCheck", 500)
  717.  
  718. If (networkType = "server") {
  719. RLLog.Info("Module - Waiting for a client to connect to your server")
  720. mpMenuStatus := MultiPlayerMenu(,,,,,,,,"You are the server. Please wait for your client to connect.")
  721. } Else { ; client
  722. RLLog.Info("Module - Trying to contact the server to establish a connection.")
  723. mpMenuStatus := MultiPlayerMenu(,,,,,,,,"Attempting to connect to the server...")
  724. }
  725.  
  726. If (mpMenuStatus = -1) { ; if user exited menu early before a client connected
  727. RLLog.Warning("Module - Cancelled waiting for the " . If (networkType = "server") ? "client to connect" : "server to respond" . ". Exiting module.")
  728. If primaryExe.Process("Exist")
  729. primaryExe.Process("Close") ; must close process as the exe is waiting for a client to connect and no window was drawn yet
  730. ExitModule()
  731. } Else { ; blank response from MultiPlayerMenu, exited properly
  732. RLLog.Info("Module - " . If (networkType = "server") ? "Client has connected" : "Connected to the server")
  733. emuPrimaryWindow.Wait()
  734. emuPrimaryWindow.WaitActive()
  735. }
  736. TimerUtils.SetTimer("NetworkConnectedCheck", "Off")
  737. } Else { ; single player
  738. emuPrimaryWindow.Wait()
  739. emuPrimaryWindow.WaitActive()
  740. }
  741.  
  742. If (hideConsole = "true")
  743. emuConsoleWindow.Set("Transparent", "On") ; makes the console window transparent so you don't see it on exit
  744.  
  745. BezelDraw()
  746. HideAppEnd(hideEmuObj,hideEmu)
  747. FadeInExit()
  748. primaryExe.Process("WaitClose")
  749. 7zCleanUp()
  750. BezelExit()
  751. FadeOutExit()
  752. ExitModule()
  753.  
  754.  
  755. ; Writes new properties into the retroCFG if defined by user
  756. WriteRetroProperty(key,value="") {
  757. If (value != "") {
  758. Global retroCFG,raCfgHasChanges
  759. WriteProperty(retroCFG, key, value,1,1)
  760. raCfgHasChanges := 1
  761. }
  762. }
  763.  
  764. ; Used to convert between RetroArch keys and usable data
  765. ConvertRetroCFGKey(txt,direction="read"){
  766. Global emuPath,RLLog
  767. If (direction = "read")
  768. { newtxt := StringUtils.TrimLeft(txt,1,0) ; removes the " from the left of the txt
  769. newtxt := StringUtils.TrimRight(newtxt,1,0) ; removes the " from the right of the txt
  770. relativeCheck := StringUtils.SubStr(newtxt,1,1,0)
  771. If StringUtils.Contains(relativeCheck,":",0) { ; if the path contains a ":" then it is a relative path
  772. RLLog.Debug("ConvertRetroCFGKey - " . newtxt . " is a relative path")
  773. newtxt := StringUtils.TrimLeft(newtxt,1,0) ; removes the : from the left of the txt
  774. newtxt := AbsoluteFromRelative(emuPath, "." . newtxt) ; convert relative to absolute
  775. }
  776. If StringUtils.Contains(newtxt,"/",0)
  777. newtxt := StringUtils.Replace(newtxt,"/","\",1,"",0) ; replaces all forward slashes with backslashes
  778. } Else If (direction = "write")
  779. { newtxt := """" . txt . """" ; wraps the txt with ""
  780. If StringUtils.Contains(newtxt,"\\",0)
  781. newtxt := StringUtils.Replace(newtxt,"\","/",1,"",0) ; replaces all backslashes with forward slashes
  782. } Else
  783. ScriptError("Not a valid use of ConvertRetroCFGKey. Only ""read"" or ""write"" are supported.")
  784. RLLog.Debug("ConvertRetroCFGKey - Converted " . txt . " to " . newtxt)
  785. Return newtxt
  786. }
  787.  
  788. MultiGame:
  789. KeyUtils.SetKeyDelay(100)
  790. emuPrimaryWindow.Activate()
  791. KeyUtils.Send("{" . ejectToggleKey . " down}{" . ejectToggleKey . " up}") ; eject disc in Retroarch
  792. If (!mgLastRomIndex) {
  793. mgLastRomIndex := mgRomIndex
  794. }
  795. selectedRomIndex := 0
  796. selectedRomIndex := StringUtils.TrimLeft(selectedRomNum, StringUtils.StringLength(mgType,0))
  797.  
  798. Loop % mgMaxIndex
  799. {
  800. If (m3uRomIndex[A_index] = mgLastRomIndex) {
  801. tempLastRomIndex := A_index
  802. RLLog.Debug("Module - Last index: " . tempLastRomIndex)
  803. }
  804. If (m3uRomIndex[A_index] = selectedRomIndex) {
  805. tempSelectedRomIndex := A_index
  806. RLLog.Debug("Module - Selected index: " . tempSelectedRomIndex)
  807. }
  808. }
  809.  
  810. mgNewIndex := tempLastRomIndex - tempSelectedRomIndex
  811.  
  812. If (mgNewIndex < 0) {
  813. mgNewIndex := mgNewIndex * -1
  814. Loop % mgNewIndex
  815. {
  816. RLLog.Debug("Module - Sending the next disk key: " . nextDiskKey)
  817. KeyUtils.Send("{" . nextDiskKey . " down}{" . nextDiskKey . " up}")
  818. }
  819. } Else If (mgNewIndex > 0) {
  820. Loop % mgNewIndex
  821. {
  822. RLLog.Debug("Module - Sending the previous disk key: " . mgNewIndex)
  823. KeyUtils.Send("{" . prevDiskKey . " down}{" . prevDiskKey . " up}")
  824. }
  825. }
  826.  
  827. KeyUtils.Send("{" . ejectToggleKey . " down}{" . ejectToggleKey . " up}") ; close disc in Retroarch
  828. mgLastRomIndex := selectedRomIndex
  829. Return
  830.  
  831. NetworkConnectedCheck:
  832. If clientConnected
  833. multiplayerMenuExit := true
  834. Else If emuPrimaryWindow.Exist() {
  835. RLLog.Info("Module - RetroArch session started, closing the MultiPlayer menu")
  836. multiplayerMenuExit := true
  837. }
  838. Return
  839.  
  840. CloseProcess:
  841. FadeOutStart()
  842. emuPrimaryWindow.Close()
  843. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement