Advertisement
djvj

Untitled

May 18th, 2015
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 40.71 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.2.8
  6. MCRC = D91F6BB0
  7. iCRC = A130BB6E
  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 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 2","Capcom Play System 3","Casio PV-1000","Casio PV-2000","Cave","Coleco ADAM","ColecoVision","Commodore MAX Machine","Commodore Amiga","Creatronic Mega Duck","Data East Classics","Dragon 64","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","NEC PC Engine","NEC PC Engine-CD","NEC PC-FX","NEC TurboGrafx-16","NEC SuperGrafx","NEC TurboGrafx-CD","Nintendo 64","Nintendo Arcade Systems","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 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","Sega 32X","Sega Mega Drive 32X","Sega Mark III","Sega SC-3000","Sega SG-1000","Sega CD","Sega Game Gear","Sega Genesis","Sega Master System","Sega Mega Drive","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 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","Tandy TRS-80 Color Computer","Texas Instruments TI 99-4A","Thomson MO5","Thomson TO7","Tiger Game.com","Tiki-100","Tomy Tutor","VTech CreatiVision","Watara Supervision"
  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. ; MESS:
  40. ; MESS BIOS roms should be placed in the system\mess folder
  41. ;
  42. ; System Specific Notes:
  43. ; 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.
  44. ; Nintendo Famicom Disk System - Requires disksys.rom be placed in the folder you define as system_directory in the RetroArch's cfg.
  45. ; 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.
  46. ; 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.
  47. ; NEC TurboGrafx-CD - Requires "syscard3.pce" be placed in the folder you define as system_directory in the RetroArch's cfg.
  48. ; 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.
  49. ; MAME: Turn off the nag screen by running a game, then press F1 and go to core options and switch off the nag screen there.
  50. ; 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.
  51. ;----------------------------------------------------------------------------
  52. StartModule()
  53. BezelGUI()
  54. FadeInStart()
  55.  
  56. ; 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.
  57. Log("Module - Started building the " . MEmu . " object",4)
  58. mTypeVar=
  59. ( LTrim
  60. AAE|LibRetro_AAE|mame_libretro
  61. Acorn BBC Micro|LibRetro_BBCB|mess_libretro
  62. Amstrad CPC|LibRetro_CPC|mess_libretro
  63. Amstrad GX4000|LibRetro_GX4K|mess_libretro
  64. APF Imagination Machine|LibRetro_APF|mess_libretro
  65. Apple IIGS|LibRetro_AIIGS|mess_libretro
  66. Applied Technology MicroBee|LibRetro_MBEE|mess_libretro
  67. Atari 2600|LibRetro_2600|stella_libretro
  68. Atari 5200|LibRetro_5200|mess_libretro
  69. Atari 7800|LibRetro_7800|prosystem_libretro
  70. Atari Classics|LibRetro_ACLS|mame_libretro
  71. Atari Jaguar|LibRetro_JAG|virtualjaguar_libretro
  72. Atari Lynx|LibRetro_LYNX|handy_libretro
  73. Atari ST|LibRetro_ST|hatari_libretro
  74. Atari XEGS|LibRetro_XEGS|mess_libretro
  75. Bally Astrocade|LibRetro_BAST|mess_libretro
  76. Bandai Gundam RX-78|LibRetro_BGRX|mess_libretro
  77. Bandai Super Vision 8000|LibRetro_SV8K|mess_libretro
  78. Bandai Wonderswan|LibRetro_WSAN|mednafen_wswan_libretro
  79. Bandai Wonderswan Color|LibRetro_WSANC|mednafen_wswan_libretro
  80. Canon X07|LibRetro_CX07|mess_libretro
  81. Capcom Classics|LibRetro_CAPC|mame_libretro
  82. Capcom Play System|LibRetro_CPS1|fba_cores_cps1_libretro
  83. Capcom Play System 2|LibRetro_CPS2|fba_cores_cps2_libretro
  84. Capcom Play System 3|LibRetro_CPS3|mame_libretro
  85. Casio PV-1000|LibRetro_CAS1K|mess_libretro
  86. Casio PV-2000|LibRetro_CAS2K|mess_libretro
  87. Cave|LibRetro_CAVE|mame_libretro
  88. Coleco ADAM|LibRetro_ADAM|mess_libretro
  89. ColecoVision|LibRetro_COLEC|mess_libretro
  90. Commodore Amiga|LibRetro_PUAE|puae_libretro
  91. Commodore Max Machine|LibRetro_CMAX|mess_libretro
  92. Creatronic Mega Duck|LibRetro_DUCK|mess_libretro
  93. Data East Classics|LibRetro_DATA|mame_libretro
  94. Dragon 64|LibRetro_DRAG64|mess_libretro
  95. Elektronika BK|LibRetro_EBK|mess_libretro
  96. Elektronska Industrija Pecom 64|LibRetro_P64|mess_libretro
  97. Emerson Arcadia 2001|LibRetro_A2001|mess_libretro
  98. Entex Adventure Vision|LibRetro_AVISION|mess_libretro
  99. Epoch Game Pocket Computer|LibRetro_GPCKET|mess_libretro
  100. Epoch Super Cassette Vision|LibRetro_SCV|mess_libretro
  101. Exidy Sorcerer|LibRetro_SORCR|mess_libretro
  102. Fairchild Channel F|LibRetro_CHANF|mess_libretro
  103. Final Burn Alpha|LibRetro_FBA|fb_alpha_libretro
  104. Funtech Super Acan|LibRetro_SACAN|mess_libretro
  105. GamePark 32|LibRetro_GP32|mess_libretro
  106. GCE Vectrex|LibRetro_VECTX|mess_libretro
  107. Hartung Game Master|LibRetro_GMASTR|mess_libretro
  108. Interton VC 4000|LibRetro_VC4K|mess_libretro
  109. Irem Classics|LibRetro_IREM|mame_libretro
  110. JungleTac Sport Vii|LibRetro_SPORTV|mess_libretro
  111. Konami Classics|LibRetro_KONC|mame_libretro
  112. Magnavox Odyssey 2|LibRetro_ODYS2|mess_libretro
  113. MAME|LibRetro_MAME|mame_libretro
  114. Mattel Aquarius|LibRetro_AQUA|mess_libretro
  115. Mattel Intellivision|LibRetro_INTV|mess_libretro
  116. MGT Sam Coupe|LibRetro_SAMCP|mess_libretro
  117. Microsoft MS-DOS|LibRetro_MSDOS|dosbox_libretro
  118. Microsoft MSX|LibRetro_MSX|bluemsx_libretro
  119. Microsoft MSX2|LibRetro_MSX2|bluemsx_libretro
  120. Microsoft Windows 3.x|LibRetro_WIN3X|dosbox_libretro
  121. Matra & Hachette Alice|LibRetro_ALICE|mess_libretro
  122. Midway Classics|LibRetro_MIDC|mame_libretro
  123. NEC PC Engine|LibRetro_PCE|mednafen_pce_fast_libretro
  124. NEC PC Engine-CD|LibRetro_PCECD|mednafen_pce_fast_libretro
  125. NEC PC-FX|LibRetro_PCFX|mednafen_pcfx_libretro
  126. NEC SuperGrafx|LibRetro_SGFX|mednafen_supergrafx_libretro
  127. NEC TurboGrafx-16|LibRetro_TG16|mednafen_pce_fast_libretro
  128. NEC TurboGrafx-CD|LibRetro_TGCD|mednafen_pce_fast_libretro
  129. Nintendo 64|LibRetro_N64|mupen64plus_libretro
  130. Nintendo Arcade Systems|LibRetro_NINARC|mame_libretro
  131. Nintendo DS|LibRetro_DS|desmume_libretro
  132. Nintendo Entertainment System|LibRetro_NES|nestopia_libretro
  133. Nintendo Famicom|LibRetro_NFAM|nestopia_libretro
  134. Nintendo Famicom Disk System|LibRetro_NFDS|nestopia_libretro
  135. Nintendo Game Boy|LibRetro_GB|gambatte_libretro
  136. Nintendo Game Boy Advance|LibRetro_GBA|vba_next_libretro
  137. Nintendo Game Boy Color|LibRetro_GBC|gambatte_libretro
  138. Nintendo Game Boy Japan|LibRetro_GBJ|gambatte_libretro
  139. Nintendo Pokemon Mini|LibRetro_POKE|mess_libretro
  140. Nintendo Satellaview|LibRetro_NSFS|snes9x_libretro
  141. Nintendo SuFami Turbo|LibRetro_NSFST|snes9x_libretro
  142. Nintendo Super Famicom|LibRetro_NSF|bsnes_balanced_libretro
  143. Nintendo Super Game Boy|LibRetro_SGB|bsnes_balanced_libretro
  144. Nintendo Virtual Boy|LibRetro_NVB|mednafen_vb_libretro
  145. Othello Multivision|LibRetro_OTHO|genesis_plus_gx_libretro
  146. Panasonic 3DO|LibRetro_3DO|4do_libretro
  147. Philips CD-i|LibRetro_CDI|mess_libretro
  148. Philips Videopac|LibRetro_PVID|mess_libretro
  149. RCA Studio II|LibRetro_STUD2|mess_libretro
  150. SCUMMVM|LibRetro_SCUMM|scummvm_libretro
  151. Sega 32X|LibRetro_32X|picodrive_libretro
  152. Sega CD|LibRetro_SCD|genesis_plus_gx_libretro
  153. Sega Game Gear|LibRetro_GG|genesis_plus_gx_libretro
  154. Sega Genesis|LibRetro_GEN|genesis_plus_gx_libretro
  155. Sega Mark III|Libretro_SM3|genesis_plus_gx_libretro
  156. Sega Master System|LibRetro_SMS|genesis_plus_gx_libretro
  157. Sega Mega Drive|LibRetro_GEN|genesis_plus_gx_libretro
  158. Sega Mega Drive 32X|LibRetro_MD32X|picodrive_libretro
  159. Sega Pico|LibRetro_PICO|picodrive_libretro
  160. Sega VMU|LibRetro_SVMU|mess_libretro
  161. Sony PlayStation|LibRetro_PSX|mednafen_psx_libretro
  162. Sony PlayStation Minis|LibRetro_PSXMIN|ppsspp_libretro
  163. Sony PocketStation|LibRetro_POCKS|mess_libretro
  164. Sony PSP|LibRetro_PSP|ppsspp_libretro
  165. Sega Saturn|LibRetro_SAT|yabause_libretro
  166. Sega Saturn Japan|LibRetro_SAT|yabause_libretro
  167. Sega SC-3000|LibRetro_SC3K|mess_libretro
  168. Sega SG-1000|LibRetro_SG1K|genesis_plus_gx_libretro
  169. Sega ST-V|LibRetro_STV|mame_libretro
  170. Sharp X1|LibRetro_SX1|mess_libretro
  171. Sinclair ZX Spectrum|LibRetro_SPECZX|mess_libretro
  172. SNK Neo Geo|LibRetro_NEO|fb_alpha_libretro
  173. SNK Neo Geo AES|LibRetro_NEOAES|mess_libretro
  174. SNK Neo Geo CD|LibRetro_NEOCD|mess_libretro
  175. SNK Neo Geo MVS|LibRetro_NEOMVS|mame_libretro
  176. SNK Neo Geo Pocket|LibRetro_NGP|mednafen_ngp_libretro
  177. SNK Neo Geo Pocket Color|LibRetro_NGPC|mednafen_ngp_libretro
  178. Sord M5|LibRetro_SORD|mess_libretro
  179. Spectravideo|LibRetro_SV328|mess_libretro
  180. Super Nintendo Entertainment System|LibRetro_SNES|bsnes_balanced_libretro
  181. Tandy TRS-80 Color Computer|LibRetro_TRS80|mess_libretro
  182. Texas Instruments TI 99-4A|LibRetro_TI99|mess_libretro
  183. Thomson MO5|LibRetro_MO5|mess_libretro
  184. Thomson TO7|LibRetro_TO7|mess_libretro
  185. Tiger Game.com|LibRetro_TCOM|mess_libretro
  186. Tiki-100|LibRetro_TIKI|mess_libretro
  187. Tomy Tutor|LibRetro_TOMY|mess_libretro
  188. VTech CreatiVision|LibRetro_VTECH|mess_libretro
  189. Watara Supervision|LibRetro_SUPRV|mess_libretro
  190. )
  191. mType := Object()
  192. Loop, Parse, mTypeVar, `n, `r
  193. {
  194. obj := {}
  195. Loop, Parse, A_LoopField, |
  196. If A_Index = 1
  197. obj.System := A_LoopField
  198. Else If A_Index = 2
  199. obj.ID := A_LoopField
  200. Else ; 3
  201. obj.Core := A_LoopField
  202. mType.Insert(obj["System"], obj)
  203. }
  204. Log("Module - Finished building the " . MEmu . " object",4)
  205. ; For easier use throughout the module
  206. retroSystem := mType[systemName].System
  207. retroID := mType[systemName].ID
  208. retroCore := mType[systemName].Core
  209.  
  210. If !retroSystem
  211. ScriptError("Your systemName is: " . systemName . "`nIt is not one of the known supported systems for this " . MEmu . " module: " . moduleName)
  212. If !retroCore
  213. ScriptError("Your Core ID is: " . retroID . "`nCould not find a default core to use. Please update the module with a default core.")
  214.  
  215. settingsFile := modulePath . "\" . moduleName . ".ini"
  216. core := IniReadCheck(settingsFile, systemName, "LibRetro_Core",retroCore,,1)
  217. Fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1)
  218. configFolder := IniReadCheck(settingsFile, "Settings", "ConfigFolder",emuPath . "\config",,1)
  219. messRomPath := IniReadCheck(settingsFile, "Settings", "MESS_BIOS_Roms_Folder",,,1)
  220. hideConsole := IniReadCheck(settingsFile, "Settings", "HideConsole","true",,1)
  221. superGB := IniReadCheck(settingsFile, systemName . "|" . romName, "SuperGameBoy","false",,1)
  222. enableNetworkPlay := IniReadCheck(settingsFile, "Network|" . romName, "Enable_Network_Play","false",,1)
  223. overlay := IniReadCheck(settingsFile, systemName . "|" . romName, "Overlay",,,1)
  224. videoShader := IniReadCheck(settingsFile, systemName . "|" . romName, "VideoShader",,,1)
  225. aspectRatioIndex := IniReadCheck(settingsFile, systemName . "|" . romName, "AspectRatioIndex",,,1)
  226. customViewportWidth := IniReadCheck(settingsFile, systemName . "|" . romName, "CustomViewportWidth",,,1)
  227. customViewportHeight := IniReadCheck(settingsFile, systemName . "|" . romName, "CustomViewportHeight",,,1)
  228. customViewportX := IniReadCheck(settingsFile, systemName . "|" . romName, "CustomViewportX",,,1)
  229. customViewportY := IniReadCheck(settingsFile, systemName . "|" . romName, "CustomViewportY",,,1)
  230. stretchToFillBezel := IniReadCheck(settingsFile, systemName . "|" . romName, "StretchToFillBezel","false",,1)
  231. rotation := IniReadCheck(settingsFile, systemName . "|" . romName, "Rotation",0,,1)
  232. cropOverscan := IniReadCheck(settingsFile, systemName . "|" . romName, "CropOverscan",,,1)
  233. threadedVideo := IniReadCheck(settingsFile, systemName . "|" . romName, "ThreadedVideo",,,1)
  234. vSync := IniReadCheck(settingsFile, systemName . "|" . romName, "VSync",,,1)
  235. integerScale := IniReadCheck(settingsFile, systemName . "|" . romName, "IntegerScale",,,1)
  236. configurationPerCore := IniReadCheck(settingsFile, systemName . "|" . romName, "ConfigurationPerCore","false",,1)
  237.  
  238. configFolder := GetFullName(configFolder)
  239. messRomPath := GetFullName(messRomPath)
  240. overlay := GetFullName(overlay)
  241. videoShader := GetFullName(videoShader)
  242. rotateBezel := false
  243.  
  244. If (retroID = "LibRetro_SGB" || superGB = "true") ; if system or rom is set to use Super Game Boy
  245. { superGB = true ; setting this just in case it's false and the system is Nintendo Super Game Boy
  246. 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")
  247. 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")
  248. retroID := "LibRetro_SGB" ; switching to Super Game Boy mode
  249. retroSystem := "Nintendo Super Game Boy"
  250. }
  251.  
  252. ; Find the dll for this system
  253. libDll := CheckFile(emuPath . "\cores\" . core . ".dll", "Your " . retroID . " dll is set to " . core . " but could not locate this file:`n" . emuPath . "\cores\" . core . ".dll")
  254.  
  255. ; Find the cfg file to use
  256. If !FileExist(configFolder)
  257. ScriptError("You need to make sure ""ConfigFolder"" is pointing to your RetroArch config folder. By default it is looking here: """ . configFolder . """")
  258. globalRetroCfg := emuPath . "\retroarch.cfg"
  259. systemRetroCfg := configFolder . "\" . retroSystem . ".cfg"
  260. coreRetroCfg := configFolder . "\" . core . ".dll.cfg"
  261. Log("Module - Global cfg should be: " . globalRetroCfg,4)
  262. Log("Module - System cfg should be: " . systemRetroCfg,4)
  263. Log("Module - Core cfg should be: " . coreRetroCfg,4)
  264. foundCfg :=
  265. If FileExist(systemRetroCfg) { ; check for system cfg first
  266. retroCFGFile := systemRetroCfg
  267. foundCfg := 1
  268. Log("Module - Found a System cfg!",4)
  269. } Else If FileExist(coreRetroCfg) { ; 2nd option is a core config
  270. retroCFGFile := coreRetroCfg
  271. foundCfg := 1
  272. Log("Module - Found a Core cfg!",4)
  273. } Else If FileExist(globalRetroCfg) { ; 3rd is global cfg
  274. retroCFGFile := globalRetroCfg
  275. foundCfg := 1
  276. Log("Module - Found a Global cfg!",4)
  277. }
  278. If !foundCfg
  279. Log("Module - Could not find a cfg file to update settings. RetroArch will make one for you.",2)
  280. Else
  281. Log("Module - " . MEmu . " is using " . retroCFGFile . " as its config file.")
  282.  
  283. If rotation in 1,3 ; use vertical bezel if RA rotation is set to 90 or 270 degrees
  284. {
  285. rotateBezel := true
  286. }
  287.  
  288. If RegExMatch(retroID, "LibRetro_NFDS|LibRetro_SCD|LibRetro_TGCD|LibRetro_PCECD|LibRetro_PCFX") { ; these systems require the retroarch settings to be read
  289. retroSysDir := ReadProperty(retroCFG,"system_directory") ; read value
  290. retroSysDir := ConvertRetroCFGKey(retroSysDir) ; remove dbl quotes
  291. StringLeft, retroSysDirLeft, retroSysDir, 2
  292. If (retroSysDirLeft = ":\") { ; if retroarch is set to use a default folder
  293. StringTrimLeft, retroSysDir, retroSysDir, 1
  294. Log("Module - RetroArch is using a relative system path: """ . retroSysDir . """")
  295. retroSysDir := emuPath . retroSysDir
  296. }
  297. If !retroSysDir
  298. 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.")
  299. StringRight, checkForSlash, retroSysDir, 1
  300. If (checkForSlash = "\") ; check if a backslash is the last character. If it is, remove it, as this is non-standard method to define folders
  301. StringTrimRight, retroSysDir, retroSysDir, 1
  302. }
  303.  
  304. If (RegExMatch(retroID, "LibRetro_N64|LibRetro_NES|LibRetro_LYNX|LibRetro_PSX") || RegExMatch(retroID, "LibRetro_NES") && (InStr(core, "nestopia_libretro"))) { ; these systems will use an ini to store game specific settings
  305. sysSettingsFile := CheckSysFile(modulePath . "\" . systemName . ".ini") ; create the ini if it does not exist
  306. coreOptionsCFGFile := CheckFile((configurationPerCore ? configFolder . "\retroarch-core-options.cfg" : emuPath . "\retroarch-core-options.cfg"), "Could not find retroarch-core-options.cfg in retroarch directory: """ . (configurationPerCore ? configFolder : emuPath) . """")
  307. coreOptionsCFG := LoadProperties(coreOptionsCFGFile)
  308. If InStr(retroID, "LibRetro_N64") { ; Nintendo 64
  309. mupenGfx := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Gfx_Plugin", "auto",,1)
  310. mupenRsp := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_RSP_Plugin", "auto",,1)
  311. mupenCpu := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_CPU_Core", "dynamic_recompiler",,1)
  312. mupenPak1 := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Pak_1", "memory",,1)
  313. mupenPak2 := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Pak_2", "memory",,1)
  314. mupenPak3 := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Pak_3", "memory",,1)
  315. mupenPak4 := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Pak_4", "memory",,1)
  316. mupenGfxAccur := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Gfx_Accuracy", "high",,1)
  317. mupenExpMem := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Disable_Exp_Memory", "no",,1)
  318. mupenTexturFilt := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Texture_Filtering", "nearest",,1)
  319. mupenViRefresh := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_VI_Refresh", "2200",,1)
  320. mupenFramerate := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Framerate", "fullspeed",,1)
  321. mupenResolution := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Resolution", "640x480",,1)
  322. mupenPolyOffstFctr := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Polygon_Offset_Factor", "-3.0",,1)
  323. mupenPolyOffstUnts := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Polygon_Offset_Units", "-3.0",,1)
  324. mupenViOverlay := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_VI_Overlay", "disabled",,1)
  325. mupenAnalogDzone := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Analog_Deadzone", "15",,1)
  326.  
  327. WriteProperty(coreOptionsCFG, "mupen64-gfxplugin", mupenGfx, 1)
  328. WriteProperty(coreOptionsCFG, "mupen64-rspplugin", mupenRsp, 1)
  329. WriteProperty(coreOptionsCFG, "mupen64-cpucore", mupenCpu, 1)
  330. WriteProperty(coreOptionsCFG, "mupen64-pak1", mupenPak1, 1)
  331. WriteProperty(coreOptionsCFG, "mupen64-pak2", mupenPak2, 1)
  332. WriteProperty(coreOptionsCFG, "mupen64-pak3", mupenPak3, 1)
  333. WriteProperty(coreOptionsCFG, "mupen64-pak4", mupenPak4, 1)
  334. WriteProperty(coreOptionsCFG, "mupen64-gfxplugin-accuracy", mupenGfxAccur, 1)
  335. WriteProperty(coreOptionsCFG, "mupen64-disableexpmem", mupenExpMem, 1)
  336. WriteProperty(coreOptionsCFG, "mupen64-filtering", mupenTexturFilt, 1)
  337. WriteProperty(coreOptionsCFG, "mupen64-virefresh", mupenViRefresh, 1)
  338. WriteProperty(coreOptionsCFG, "mupen64-framerate", mupenFramerate, 1)
  339. WriteProperty(coreOptionsCFG, "mupen64-screensize", mupenResolution, 1)
  340. WriteProperty(coreOptionsCFG, "mupen64-polyoffset-factor", mupenPolyOffstFctr, 1)
  341. WriteProperty(coreOptionsCFG, "mupen64-polyoffset-units", mupenPolyOffstUnts, 1)
  342. WriteProperty(coreOptionsCFG, "mupen64-angrylion-vioverlay", mupenViOverlay, 1)
  343. WriteProperty(coreOptionsCFG, "mupen64-astick-deadzone", mupenAnalogDzone, 1)
  344. } Else If InStr(retroID, "LibRetro_NES") { ; these systems will use an ini to store game specific settings
  345. If InStr(core, "nestopia_libretro") { ; Nestopia
  346. nestopiaBlargg := IniReadCheck(sysSettingsFile, "Nestopia" . "|" . romName, "Nestopia_Blargg_NTSC_Filter", "disabled",,1)
  347. nestopiaPalette := IniReadCheck(sysSettingsFile, "Nestopia" . "|" . romName, "Nestopia_Palette", "canonical",,1)
  348. nestopiaNoSprteLimit := IniReadCheck(sysSettingsFile, "Nestopia" . "|" . romName, "Nestopia_Remove_Sprites_Limit", "disabled",,1)
  349.  
  350. WriteProperty(coreOptionsCFG, "nestopia_blargg_ntsc_filter", nestopiaBlargg, 1)
  351. WriteProperty(coreOptionsCFG, "nestopia_palette", nestopiaPalette, 1)
  352. WriteProperty(coreOptionsCFG, "nestopia_nospritelimit", nestopiaNoSprteLimit, 1)
  353. }
  354. } Else If InStr(retroID, "LibRetro_LYNX") { ; Atari Lynx
  355. If InStr(core, "handy_libretro") { ; Handy
  356. handyRotate := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Handy_Rotation", "None",,1)
  357. If InStr(handyRotate, "240") or InStr(handyRotate, "90")
  358. rotateBezel := true
  359. WriteProperty(coreOptionsCFG, "handy_rot", handyRotate, 1)
  360. }
  361. } Else If InStr(retroID, "LibRetro_PSX") { ; Sony PlayStation
  362. psxCdImageCache := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "PSX_CD_Image_Cache", """enabled""",,1)
  363. psxMemcardHandling := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "PSX_Memcard_Handling", """libretro""",,1)
  364. psxDualshockAnalogToggle := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "PSX_Dualshock_Analog_Toggle", """enabled""",,1)
  365.  
  366. WriteProperty(coreOptionsCFG, "beetle_psx_cdimagecache", psxCdImageCache, 1)
  367. WriteProperty(coreOptionsCFG, "beetle_psx_use_mednafen_memcard0_method", psxMemcardHandling, 1)
  368. WriteProperty(coreOptionsCFG, "beetle_psx_analog_toggle", psxDualshockAnalogToggle, 1)
  369. }
  370. SaveProperties(coreOptionsCFGFile, coreOptionsCFG)
  371. }
  372.  
  373. hideEmuObj := Object("ahk_class ConsoleWindowClass",0,"RetroArch ahk_class RetroArch",1) ; Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
  374. 7z(romPath, romName, romExtension, 7zExtractPath)
  375.  
  376. ; MESS core options
  377. messIdent :=
  378. messParam1 :=
  379. messParam2 :=
  380. messParam3 :=
  381. If InStr(core, "mess") { ; if a mess core is used
  382. Log("Module - Retroarch MESS mode enabled")
  383. ; the messType object links the system name to the name mess recognizes
  384. messType := Object("Acorn BBC Micro", "bbcb","Amstrad CPC","cpc464","Amstrad GX4000","gx4000","APF Imagination Machine","apfimag","Applied Technology MicroBee","mbeeic","Apple IIGS","apple2gs","Atari 8-bit","a800","Atari 2600","a2600","Atari 5200","a5200"
  385. ,"Atari 7800","a7800","Atari Jaguar","jaguar","Atari Lynx","lynx","Atari XEGS","xegs","Bally Astrocade","astrocde","Bandai Gundam RX-78","rx78","Bandai Super Vision 8000","sv8000"
  386. ,"Bandai WonderSwan","wswan","Bandai WonderSwan Color","wscolor","Canon X07","x07","Casio PV-1000","pv1000","Casio PV-2000","pv2000","Coleco ADAM","adam","ColecoVision"
  387. ,"coleco","Commodore Max Machine","vic10","Creatronic Mega Duck","megaduck","Dragon 64","dragon64","Elektronika BK","bk0010","Emerson Arcadia 2001","arcadia","Entex Adventure Vision","advision"
  388. ,"Epoch Game Pocket Computer","gamepock","Epoch Super Cassette Vision","scv","Exidy Sorcerer","sorcerer","Fairchild Channel F","channelf"
  389. ,"Funtech Super Acan","supracan","GCE Vectrex","vectrex","Hartung Game Master","gmaster","GamePark 32","gp32","Interton VC 4000","vc4000"
  390. ,"JungleTac Sport Vii","vii","Magnavox Odyssey 2","odyssey2","Matra & Hachette Alice","alice32","Mattel Aquarius","aquarius","Mattel Intellivision"
  391. ,"intv","NEC PC Engine","pce","NEC PC Engine-CD","pce","NEC SuperGrafx","sgx","NEC TurboGrafx-16","tg16","NEC TurboGrafx-CD","tg16","Nintendo 64"
  392. ,"n64","Nintendo Entertainment System","nes","Nintendo Famicom Disk System","famicom","Nintendo Game Boy","gameboy","Nintendo Game Boy Advance","gba"
  393. ,"Nintendo Game Boy Color","gbcolor","Nintendo Game Boy Japan","gameboy","Nintendo Pokemon Mini","pokemini","Nintendo Virtual Boy","vboy"
  394. ,"Elektronska Industrija Pecom 64","pecom64","Philips CD-i","cdimono1","Philips Videopac","videopac","RCA Studio II","studio2","Sega 32X","32x"
  395. ,"Sega SC-3000","sc3000","Sega CD","segacd","Sega Game Gear","gamegear","Sega Genesis","genesis","Sega Master System","sms","Sega Mega Drive"
  396. ,"megadriv","Sega VMU","svmu","Sharp X1","x1","Sinclair ZX Spectrum","spectrum","SNK Neo Geo AES","aes","SNK Neo Geo CD","neocdz","SNK Neo Geo Pocket","ngp"
  397. ,"SNK Neo Geo Pocket Color","ngpc","Sony PlayStation","psx","Sony PocketStation","pockstat","Sord M5","m5","Spectravideo","svi328n"
  398. ,"Super Nintendo Entertainment System","snes","Tandy TRS-80 Color Computer","coco3","Texas Instruments TI 99-4A","ti99_4a","Tiger Game.com","gamecom"
  399. ,"Thomson MO5","mo5","Thomson TO7","to7","Tiki-100","kontiki","Tomy Tutor","tutor","VTech CreatiVision","crvision","Watara Supervision","svision")
  400. messIdent := messType[systemName] ; search object for the systemName identifier Retroarch uses for its cores
  401. If !messIdent
  402. ScriptError("Your systemName is: " . systemName . "`nIt is not one of the known supported systems for the MESS LibRetro core")
  403. Else
  404. Log("Module - MESS mode using a known ident: " . messIdent)
  405.  
  406. If !messRomPath
  407. ScriptError("Please set the RetroArch module setting ""MESS_BIOS_Roms_Folder"" to the folder that contains your MESS BIOS roms to use MESS with RetroArch.")
  408.  
  409. messParam1 :=
  410. messParam2 := " -rompath \" . """" . messRomPath . "\" . """"
  411.  
  412. ; Build a key/value object containing the different messParam3 choices
  413. messP3 := Object("alice32","cass1","gp32","memc","cpc464","cass","spectrum","cass","dragon64","cass","cdimono1","cdrom","bk0010","cass","neocd","cdrom","neocdz","cdrom","svi328n","cass","pecom64","cass","svmu","quik","gamecom","cart1","mbeeic","quik1")
  414. messParam3 := messP3[messIdent] ; search object for the messIdent pair
  415. messParam3 := " -" . (If messParam3 ? messParam3 : "cart") . " \" . """" . romPath . "\" . romName . romExtension . "\" . """"
  416.  
  417. If messIdent = mbeeic ; Applied Technology MicroBee
  418. { microbeeModel := IniReadCheck(messSysINI, romName, "MicroBee_Model","mbeeic",,1)
  419. If microbeeModel not in mbee,mbeeic,mbeepc,mbeepc85,mbee56
  420. ScriptError("This is not a known MicroBee model value: " . microbeeModel)
  421. Else If (microbeeModel != "mbeeic")
  422. messIdent := microbeeModel
  423. If romExtension in .mwb,.com,.bee
  424. mediaDeviceType := "quik1"
  425. Else If romExtension in .wav,.tap
  426. mediaDeviceType := "cass"
  427. Else If romExtension in .rom
  428. mediaDeviceType := "cart"
  429. Else If romExtension in .dsk
  430. mediaDeviceType := "flop1"
  431. Else ; .bin format
  432. mediaDeviceType := "quik2"
  433. messParam3 := " -" . mediaDeviceType . " \" . """" . romPath . "\" . romName . romExtension . "\" . """"
  434. }
  435.  
  436. fullRomPath := messParam1 . messParam2 . messParam3
  437. } Else If (superGB = "true") {
  438. Log("Module - Retroarch Super Game Boy mode enabled")
  439. fullRomPath := " """ . sgbRomPath . """ --subsystem sgb """ . romPath . "\" . romName . romExtension . """"
  440. } Else {
  441. Log("Module - Retroarch standard mode enabled")
  442. fullRomPath := " """ . romPath . "\" . romName . romExtension . """"
  443. }
  444.  
  445. If retroID = LibRetro_NFDS ; Nintendo Famicom Disk System
  446. { IfNotExist, %retroSysDir%\disksys.rom
  447. ScriptError("RetroArch requires ""disksys.rom"" for " . retroSystem . " but could not find it in your system_directory: """ . retroSysDir . """")
  448. } Else If retroID = LibRetro_SCD ; Sega CD
  449. { If romExtension Not In .bin,.cue,.iso
  450. ScriptError("RetroArch only supports Sega CD games in bin|cue|iso format. It does not support:`n" . romExtension)
  451. IfNotExist, %retroSysDir%\bios_CD_E.bin
  452. ScriptError("RetroArch requires ""bios_CD_E.bin"" for " . retroSystem . " but could not find it in your system_directory: """ . retroSysDir . """")
  453. IfNotExist, %retroSysDir%\bios_CD_U.bin
  454. ScriptError("RetroArch requires ""bios_CD_U.bin"" for " . retroSystem . " but could not find it in your system_directory: """ . retroSysDir . """")
  455. IfNotExist, %retroSysDir%\bios_CD_J.bin
  456. ScriptError("RetroArch requires ""bios_CD_J.bin"" for " . retroSystem . " but could not find it in your system_directory: """ . retroSysDir . """")
  457. } Else If retroID in LibRetro_PCECD,LibRetro_TGCD ; NEC PC Engine-CD and NEC TurboGrafx-CD
  458. { If romExtension Not In .ccd,.cue
  459. ScriptError("RetroArch only supports " . retroSystem . " games in ccd or cue format. It does not support:`n" . romExtension)
  460. IfNotExist, %retroSysDir%\syscard3.pce
  461. ScriptError("RetroArch requires ""syscard3.pce"" for " . retroSystem . " but could not find it in your system_directory: """ . retroSysDir . """")
  462. } Else If retroID = LibRetro_PCFX
  463. { If romExtension Not In .ccd,.cue
  464. ScriptError("RetroArch only supports " . retroSystem . " games in ccd or cue format. It does not support:`n" . romExtension)
  465. IfNotExist, %retroSysDir%\pcfx.bios
  466. ScriptError("RetroArch requires ""pcfx.bios"" for " . retroSystem . " but could not find it in your system_directory: """ . retroSysDir . """")
  467. }
  468.  
  469. networkSession :=
  470. If (enableNetworkPlay = "true") {
  471. Log("Module - Network Multi-Player is an available option for " . dbName,4)
  472.  
  473. netplayNickname := IniReadCheck(settingsFile, "Network", "NetPlay_Nickname","Player",,1)
  474. getWANIP := IniReadCheck(settingsFile, "Network", "Get_WAN_IP","false",,1)
  475.  
  476. If (getWANIP = "true")
  477. myPublicIP := GetPublicIP()
  478.  
  479. Log("Module - CAREFUL WHEN POSTING THIS LOG PUBLICLY AS IT CONTAINS YOUR IP ON THE NEXT LINE",2)
  480. defaultServerIP := IniReadCheck(settingsFile, "Network", "Default_Server_IP", myPublicIP,,1)
  481. defaultServerPort := IniReadCheck(settingsFile, "Network", "Default_Server_Port",,,1)
  482. lastIP := IniReadCheck(settingsFile, "Network", "Last_IP", defaultServerIP,,1) ; does not need to be on the ISD
  483. lastPort := IniReadCheck(settingsFile, "Network", "Last_Port", defaultServerPort,,1) ; does not need to be on the ISD
  484.  
  485. mpMenuStatus := MultiPlayerMenu(lastIP,lastPort,networkType,,0)
  486. If (mpMenuStatus = -1) { ; if user exited menu early
  487. Log("Module - Cancelled MultiPlayer Menu. Exiting module.",2)
  488. ExitModule()
  489. }
  490. If networkSession {
  491. Log("Module - Using a Network for " . dbName,4)
  492. IniWrite, %networkPort%, %settingsFile%, Network, Last_Port
  493. ; msgbox lastIP: %lastIP%`nlastPort: %lastPort%`nnetworkIP: %networkIP%`nnetworkPort: %networkPort%
  494. If (networkType = "client") {
  495. IniWrite, %networkIP%, %settingsFile%, Network, Last_IP ; Save last used IP and Port for quicker launching next time
  496. netCommand := " -C " . networkIP . " --port " . networkPort . " --nick """ . netplayNickname . """" ; -C = connect as client
  497. } Else { ; server
  498. netCommand := " -H --port " . networkPort . " --nick """ . netplayNickname . """" ; -H = host as server
  499. }
  500. Log("Module - CAREFUL WHEN POSTING THIS LOG PUBLICLY AS IT CONTAINS YOUR IP ON THE NEXT LINE",2)
  501. Log("Module - Starting a network session using the IP """ . networkIP . """ and PORT """ . networkPort . """",4)
  502. } Else
  503. Log("Module - User chose Single Player mode for this session",4)
  504. }
  505.  
  506. BezelStart(,,(If rotateBezel ? 1:""))
  507.  
  508. If foundCfg {
  509. if (stretchToFillBezel = "true" and bezelEnabled = "true" and bezelPath)
  510. {
  511. customViewportWidth := bezelScreenWidth
  512. customViewportHeight := bezelScreenHeight
  513. customViewportX := 0
  514. customViewportY := 0
  515. aspectRatioIndex := 22
  516. Log("Stretching viewport to fit bezel")
  517. }
  518.  
  519. retroCFG := LoadProperties(retroCFGFile) ; load the config into memory
  520. raCfgHasChanges :=
  521. WriteRetroProperty("input_overlay", overlay)
  522. WriteRetroProperty("video_shader", videoShader)
  523. WriteRetroProperty("aspect_ratio_index", aspectRatioIndex)
  524. WriteRetroProperty("custom_viewport_width", customViewportWidth)
  525. WriteRetroProperty("custom_viewport_height", customViewportHeight)
  526. WriteRetroProperty("custom_viewport_x", customViewportX)
  527. WriteRetroProperty("custom_viewport_y", customViewportY)
  528. WriteRetroProperty("video_rotation", rotation)
  529. WriteRetroProperty("video_crop_overscan", cropOverscan)
  530. WriteRetroProperty("video_threaded", threadedVideo)
  531. WriteRetroProperty("video_vsync", vSync)
  532. WriteRetroProperty("video_scale_integer", integerScale)
  533.  
  534. If InStr(retroID, "LibRetro_PSX") {
  535. Loop, 8 ; loop 8 times for 8 controllers
  536. { p%A_Index%ControllerType := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "P" . A_Index . "_Controller_Type", 517,,1)
  537. WriteRetroProperty("input_libretro_device_p" . A_Index, p%A_Index%ControllerType)
  538. }
  539. }
  540.  
  541. If raCfgHasChanges {
  542. Log("Module - Saving changed settings to: """ . retroCFGFile . """")
  543. SaveProperties(retroCFGFile, retroCFG)
  544. }
  545. }
  546.  
  547. fullscreen := If fullscreen = "true" ? " -f" : ""
  548. srmPath := emuPath . "\srm\" . retroSystem ; path for this system's srm files
  549. saveStatePath := emuPath . "\save\" . retroSystem ; path for this system's save state files
  550. retroCFGFile := If foundCfg ? " -c """ . retroCFGFile . """" : ""
  551.  
  552. IfNotExist, %srmPath%
  553. FileCreateDir, %srmPath% ; creating srm dir if it doesn't exist
  554. IfNotExist, %saveStatePath%
  555. FileCreateDir, %saveStatePath% ; creating save dir if it doesn't exist
  556.  
  557. HideEmuStart() ; This fully ensures windows are completely hidden even faster than winwait
  558.  
  559. If InStr(core, "mess") { ; if a mess core is used
  560. Run(executable . " """ . (messIdent ? messIdent : "") . fullRomPath . """ " . fullscreen . retroCFGFile . " -L """ . libDll . """ -s """ . srmPath . "\" . romName . ".srm"" -S """ . saveStatePath . "\" . romName . ".state""" . netCommand, emuPath, "Hide")
  561. } Else If (retroID = "LibRetro_SGB" || If superGB = "true") { ; For some reason, the order of our command line matters in this particular case.
  562. Run(executable . " " . fullscreen . retroCFGFile . " -L """ . libDll . """ -s """ . srmPath . "\" . romName . ".srm"" -S """ . saveStatePath . "\" . romName . ".state""" . fullRomPath . netCommand, emuPath, "Hide")
  563. } Else {
  564. Run(executable . " " . fullRomPath . fullscreen . retroCFGFile . " -L """ . libDll . """ -s """ . srmPath . "\" . romName . ".srm"" -S """ . saveStatePath . "\" . romName . ".state""" . netCommand, emuPath, "Hide")
  565. }
  566.  
  567. mpMenuStatus :=
  568. If networkSession {
  569. canceledServerWait := false
  570. multiplayerMenuExit := false
  571. SetTimer, NetworkConnectedCheck, 500
  572.  
  573. If (networkType = "server") {
  574. Log("Module - Waiting for a client to connect to your server")
  575. mpMenuStatus := MultiPlayerMenu(,,,,,,,,"You are the server. Please wait for your client to connect.")
  576. } Else { ; client
  577. Log("Module - Trying to contact the server to establish a connection.")
  578. mpMenuStatus := MultiPlayerMenu(,,,,,,,,"Attempting to connect to the server...")
  579. }
  580.  
  581. If (mpMenuStatus = -1) { ; if user exited menu early before a client connected
  582. Log("Module - Cancelled waiting for the " . If (networkType = "server") ? "client to connect" : "server to respond" . ". Exiting module.",2)
  583. If Process("Exist", executable)
  584. Process("Close", executable) ; must close process as the exe is waiting for a client to connect and no window was drawn yet
  585. ExitModule()
  586. } Else { ; blank response from MultiPlayerMenu, exited properly
  587. Log("Module - " . If (networkType = "server") ? "Client has connected" : "Connected to the server")
  588. WinWait("RetroArch ahk_class RetroArch")
  589. WinWaitActive("RetroArch ahk_class RetroArch")
  590. }
  591. SetTimer, NetworkConnectedCheck, Off
  592. } Else { ; single player
  593. WinWait("RetroArch ahk_class RetroArch")
  594. WinWaitActive("RetroArch ahk_class RetroArch")
  595. }
  596.  
  597. If hideConsole = true
  598. WinSet, Transparent, On, ahk_class ConsoleWindowClass ; makes the console window transparent so you don't see it on exit
  599.  
  600. BezelDraw()
  601. HideEmuEnd()
  602. FadeInExit()
  603. Process("WaitClose", executable)
  604. 7zCleanUp()
  605. BezelExit()
  606. FadeOutExit()
  607. ExitModule()
  608.  
  609.  
  610. ; Writes new properties into the retroCFG if defined by user
  611. WriteRetroProperty(key,value="") {
  612. If (value != "") {
  613. Global retroCFG,raCfgHasChanges
  614. WriteProperty(retroCFG, key, value,1,1)
  615. raCfgHasChanges := 1
  616. }
  617. }
  618.  
  619. ; Used to convert between RetroArch keys and usable data
  620. ConvertRetroCFGKey(txt,direction="read"){
  621. Global emuPath
  622. If direction = read
  623. { StringTrimLeft,newtxt,txt,1 ; removes the " from the left of the txt
  624. StringTrimRight,newtxt,newtxt,1 ; removes the " from the right of the txt
  625. If InStr(newtxt,":") { ; if the path contains a ":" then it is a relative path
  626. Log("ConvertRetroCFGKey - " . newtxt . " is a relative path",4)
  627. StringTrimLeft,newtxt,newtxt,1 ; removes the : from the left of the txt
  628. newtxt := AbsoluteFromRelative(emuPath, "." . newtxt) ; convert relative to absolute
  629. }
  630. If InStr(newtxt,"/")
  631. StringReplace,newtxt,newtxt,/,\,1 ; replaces all forward slashes with backslashes
  632. } Else If direction = write
  633. { newtxt = "%txt%" ; wraps the txt with ""
  634. If InStr(newtxt,"\")
  635. StringReplace,newtxt,newtxt,\,/,1 ; replaces all backslashes with forward slashes
  636. } Else
  637. ScriptError("Not a valid use of ConvertRetroCFGKey. Only ""read"" or ""write"" are supported.")
  638. Log("ConvertRetroCFGKey - Converted " . txt . " to " . newtxt,4)
  639. Return newtxt
  640. }
  641.  
  642. ; This will simply create a new blank ini if one does not exist
  643. CheckSysFile(file){
  644. IfNotExist, %file%
  645. FileAppend,, %file%
  646. Return file
  647. }
  648.  
  649. NetworkConnectedCheck:
  650. If clientConnected
  651. multiplayerMenuExit := true
  652. Else If WinExist("RetroArch ahk_class RetroArch") {
  653. Log("Module - RetroArch session started, closing the MultiPlayer menu",4)
  654. multiplayerMenuExit := true
  655. }
  656. Return
  657.  
  658. CloseProcess:
  659. FadeOutStart()
  660. WinClose("RetroArch ahk_class RetroArch")
  661. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement