Advertisement
Guest User

Untitled

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