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