Advertisement
djvj

Untitled

Jan 27th, 2015
845
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.77 KB | None | 0 0
  1. MEmu = RetroArch
  2. MEmuV = v12-25-2014 Nightly
  3. MURL = http://themaister.net/retroarch.html
  4. MAuthor = djvj,zerojay
  5. MVersion = 2.2.3
  6. MCRC = 4A285F6E
  7. iCRC = A130BB6E
  8. MID = 635038268922229162
  9. MSystem = "AAE","Amstrad CPC","Amstrad GX4000","APF Imagination Machine","Atari 2600","Atari 5200","Atari 7800","Atari Jaguar","Atari Lynx","Atari ST","Bally Astrocade","Bandai Super Vision 8000","Bandai Wonderswan","Bandai Wonderswan Color","Casio PV-1000","Casio PV-2000","ColecoVision","Commodore Amiga","Creatronic Mega Duck","Dragon 64","Emerson Arcadia 2001","Entex Adventure Vision","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","JungleTac Sport Vii","MAME","Magnavox Odyssey 2","Microsoft MSX","Microsoft MSX2","Matra & Hachette Alice","Mattel Aquarius","Mattel Intellivision","NEC PC Engine","NEC PC Engine-CD","NEC PC-FX","NEC TurboGrafx-16","NEC SuperGrafx","NEC TurboGrafx-CD","Nintendo 64","Nintendo Arcade Systems","Nintendo DS","Nintendo Entertainment System","Nintendo Famicom","Nintendo Famicom Disk System","Nintendo Game Boy","Nintendo Game Boy Color","Nintendo Game Boy Japan","Nintendo Game Boy Advance","Nintendo Super Game Boy","Nintendo Pokemon Mini","Nintendo Virtual Boy","Nintendo Super Famicom","Nintendo Super Famicom Satellaview","Panasonic 3DO","Elektronska Industrija Pecom 64","Philips CD-i","Philips Videopac","RCA Studio II","Sega 32X","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","Sinclair ZX Spectrum","Sony PlayStation","Sony PocketStation","Sony PSP","Sord M5","SNK Neo Geo","SNK Neo Geo MVS","SNK Neo Geo AES","SNK Neo Geo Pocket","SNK Neo Geo CD","SNK Neo Geo Pocket Color","Spectravideo","Super Nintendo Entertainment System","Tandy TRS-80 Color Computer","Texas Instruments TI 99-4A","Thomson MO5","Tomy Tutor","VTech CreatiVision","Watara Supervision"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; If the emu doesn't load and you get no error, usually this means the LibRetro DLL is not working!
  13. ; Devs stated they will never add support for mounted images (like via DT)
  14. ; Fullscreen is controlled via the module setting in HLHQ
  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. ; RetroArch will use per-system cfg files named to match your System Name. The global one is "retroarch.cfg" but the module will search for cfg files in any of the emu's subfolders. If system ones exist, they take precedence over retroarch.cfg.
  34. ; This allows different settings for each system you use this emulator for. If you want all systems to use the same retroarch.cfg, do not have any system named cfg files, or just create ones for the systems you want custom settings.
  35. ;
  36. ; MESS:
  37. ; MESS BIOS roms should be placed in the system\mess folder
  38. ;
  39. ; System Specific Notes:
  40. ; 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.
  41. ; Nintendo Famicom Disk System - Requires disksys.rom be placed in the folder you define as system_directory in the RetroArch's cfg.
  42. ; 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.
  43. ; 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.
  44. ; NEC TurboGrafx-CD - Requires "syscard3.pce" be placed in the folder you define as system_directory in the RetroArch's cfg.
  45. ; Nintendo Super Game Boy - Set the Module setting in HLHQ 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.
  46. ; MAME: Turn off the nag screen by running a game, then press F1 and go to core options and switch off the nag screen there.
  47. ;----------------------------------------------------------------------------
  48. StartModule()
  49. BezelGUI()
  50. FadeInStart()
  51.  
  52. ; 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.
  53. mType := Object("AAE","LibRetro_AAE","Amstrad CPC","LibRetro_CPC","Amstrad GX4000","LibRetro_GX4K","APF Imagination Machine","LibRetro_APF","Atari 2600","LibRetro_2600","Atari 5200","LibRetro_5200","Atari 7800","LibRetro_7800","Atari Jaguar","LibRetro_JAG","Atari Lynx","LibRetro_LYNX","Atari ST","LibRetro_ST","Bally Astrocade","LibRetro_BAST","Bandai Super Vision 8000","LibRetro_SV8K","Bandai Wonderswan","LibRetro_WSAN","Bandai Wonderswan Color","LibRetro_WSANC","Casio PV-1000","LibRetro_CAS1K","Casio PV-2000","LibRetro_CAS2K","ColecoVision","LibRetro_COLEC","Commodore Amiga","LibRetro_PUAE","Creatronic Mega Duck","LibRetro_DUCK","Dragon 64","LibRetro_DRAG64","Emerson Arcadia 2001","LibRetro_A2001","Entex Adventure Vision","LibRetro_AVISION","Epoch Game Pocket Computer","LibRetro_GPCKET","Epoch Super Cassette Vision","LibRetro_SCV","Exidy Sorcerer","LibRetro_SORCR","Fairchild Channel F","LibRetro_CHANF","Final Burn Alpha","LibRetro_FBA","Funtech Super Acan","LibRetro_SACAN","GamePark 32","LibRetro_GP32","GCE Vectrex","LibRetro_VECTX","Hartung Game Master","LibRetro_GMASTR","JungleTac Sport Vii","LibRddetro_SPORTV","MAME","LibRetro_MAME","Magnavox Odyssey 2","LibRetro_ODYS2","Mattel Aquarius","LibRetro_AQUA","Mattel Intellivision","LibRetro_INTV","MGT Sam Coupe","LibRetro_SAMCP","Microsoft MS-DOS","LibRetro_MSDOS","Microsoft MSX","LibRetro_MSX","Microsoft MSX2","LibRetro_MSX2","Microsoft Windows 3.x","LibRetro_WIN3X","Matra & Hachette Alice","LibRetro_ALICE","NEC PC Engine","LibRetro_PCE","NEC PC Engine-CD","LibRetro_PCECD","NEC PC-FX","LibRetro_PCFX","NEC SuperGrafx","LibRetro_SGFX","NEC TurboGrafx-16","LibRetro_TG16","NEC TurboGrafx-CD","LibRetro_TGCD","Nintendo 64","LibRetro_N64","Nintendo Arcade Systems","LibRetro_NINARC","Nintendo DS","LibRetro_DS","Nintendo Entertainment System","LibRetro_NES","Nintendo Famicom","LibRetro_NFAM","Nintendo Famicom Disk System","LibRetro_NFDS","Nintendo Game Boy","LibRetro_GB","Nintendo Game Boy Color","LibRetro_GBC","Nintendo Game Boy Japan","LibRetro_GBJ","Nintendo Game Boy Advance","LibRetro_GBA","Nintendo Pokemon Mini","LibRetro_POKE","Nintendo Super Famicom","LibRetro_NSF","Nintendo Super Famicom Satellaview","LibRetro_NSFS","Nintendo Super Game Boy","LibRetro_SGB","Nintendo Virtual Boy","LibRetro_NVB","Panasonic 3DO","LibRetro_3DO","Elektronska Industrija Pecom 64","LibRetro_P64","Philips CD-i","LibRetro_CDI","Philips Videopac","LibRetro_PVID","RCA Studio II","LibRetro_STUD2","SCUMMVM","LibRetro_SCUMM","Sega 32X","LibRetro_32X","Sega CD","LibRetro_SCD","Sega Game Gear","LibRetro_GG","Sega Genesis","LibRetro_GEN","Sega Mega Drive","LibRetro_GEN","Sega Master System","LibRetro_SMS","Sega Pico","LibRetro_PICO","Sega VMU","LibRetro_SVMU","Sony PlayStation","LibRetro_PSX","Sony PocketStation","LibRetro_POCKS","Sony PSP","LibRetro_PSP","Sega Saturn","LibRetro_SAT","Sega Saturn Japan","LibRetro_SAT","Sega SG-1000","LibRetro_SG1K","Sega SC-3000","LibRetro_SC3K","Sega ST-V","LibRetro_STV","SNK Neo Geo","LibRetro_NEO","SNK Neo Geo AES","LibRetro_NEOAES","SNK Neo Geo MVS","LibRetro_NEOMVS","SNK Neo Geo Pocket","LibRetro_NGP","SNK Neo Geo Pocket Color","LibRetro_NGPC","SNK Neo Geo CD","LibRetro_NEOCD","Sord M5","LibRetro_SORD","Spectravideo","LibRetro_SV328","Super Nintendo Entertainment System","LibRetro_SNES","Sinclair ZX Spectrum","LibRetro_SPECZX","Tandy TRS-80 Color Computer","LibRetro_TRS80","Texas Instruments TI 99-4A","LibRetro_TI99","Thomson MO5","LibRetro_MO5","Tomy Tutor","LibRetro_TOMY","VTech CreatiVision","LibRetro_VTECH","Watara Supervision","LibRetro_SUPRV")
  54. ident := mType[systemName] ; search object for the systemName identifier Retroarch uses for its cores
  55. If !ident
  56. ScriptError("Your systemName is: " . systemName . "`nIt is not one of the known supported systems for this " . MEmu . " module: " . moduleName)
  57.  
  58. coreTypes := Object("LibRetro_2600","stella_libretro","LibRetro_5200","mess_libretro","LibRetro_7800","prosystem_libretro","LibRetro_32X","picodrive_libretro","LibRetro_3DO","4do_libretro","LibRetro_A2001","mess_libretro","LibRetro_AAE","mame_libretro","LibRetro_ALICE","mess_libretro","LibRetro_APF","mess_libretro","LibRetro_AQUA","mess_libretro","LibRetro_AVISION","mess_libretro","LibRetro_BAST","mess_libretro","LibRetro_CAS1K","mess_libretro","LibRetro_CAS2K","mess_libretro","LibRetro_CDI","mess_libretro","LibRetro_CHANF","mess_libretro","LibRetro_COLEC","mess_libretro","LibRetro_CPC","mess_libretro","LibRetro_DRAG64","mess_libretro","LibRetro_DS","desmume_libretro","LibRetro_DUCK","mess_libretro","LibRetro_FBA","fb_alpha_libretro","LibRetro_GB","gambatte_libretro","LibRetro_GBC","gambatte_libretro","LibRetro_GBA","vba_next_libretro","LibRetro_GBJ","gambatte_libretro","LibRetro_GEN","genesis_plus_gx_libretro","LibRetro_GG","genesis_plus_gx_libretro","LibRetro_GMASTR","mess_libretro","LibRetro_GP32","mess_libretro","LibRetro_GPCKET","mess_libretro","LibRetro_GX4K","mess_libretro","LibRetro_INTV","mess_libretro","LibRetro_JAG","virtualjaguar_libretro","LibRetro_LYNX","handy_libretro","LibRetro_MAME","mame_libretro","LibRetro_MO5","mess_libretro","LibRetro_MSDOS","dosbox_libretro","LibRetro_MSX","bluemsx_libretro","LibRetro_MSX2","bluemsx_libretro","LibRetro_N64","mupen64plus_libretro","LibRetro_NEO","fb_alpha_libretro","LibRetro_NEOCD","mess_libretro","LibRetro_NEOAES","mess_libretro","LibRetro_NEOMVS","mame_libretro","LibRetro_NES","nestopia_libretro","LibRetro_NFAM","nestopia_libretro","LibRetro_NFDS","nestopia_libretro","LibRetro_NSF","bsnes_balanced_libretro","LibRetro_NSFS","snes9x_libretro","LibRetro_NVB","mednafen_vb_libretro","LibRetro_NGP","mednafen_ngp_libretro","LibRetro_NGPC","mednafen_ngp_libretro","LibRetro_NINARC","mame_libretro","LibRetro_ODYS2","mess_libretro","LibRetro_P64","mess_libretro","LibRetro_PCE","mednafen_pce_fast_libretro","LibRetro_PCECD","mednafen_pce_fast_libretro","LibRetro_PCFX","mednafen_pcfx_libretro","LibRetro_PICO","picodrive_libretro","LibRetro_POCKS","mess_libretro","LibRetro_POKE","mess_libretro","LibRetro_PSP","ppsspp_libretro","LibRetro_PSX","mednafen_psx_libretro","LibRetro_PUAE","puae_libretro","LibRetro_PVID","mess_libretro","LibRetro_SACAN","mess_libretro","LibRetro_SAMCP","mess_libretro","LibRetro_SAT","yabause_libretro","LibRetro_SC3K","mess_libretro","LibRetro_SCD","genesis_plus_gx_libretro","LibRetro_SCV","mess_libretro","LibRetro_SCUMM","scummvm_libretro","LibRetro_SG1K","genesis_plus_gx_libretro","LibRetro_SGB","bsnes_balanced_libretro","LibRetro_SGFX","mednafen_supergrafx_libretro","LibRetro_SMS","genesis_plus_gx_libretro","LibRetro_SNES","bsnes_balanced_libretro","LibRetro_SORCR","mess_libretro","LibRetro_SORD","mess_libretro","LibRetro_SPECZX","mess_libretro","LibRetro_SPORTV","mess_libretro","LibRetro_ST","hatari_libretro","LibRetro_STUD2","mess_libretro","LibRetro_STV","mame_libretro","LibRetro_SV328","mess_libretro","LibRetro_SV8K","mess_libretro","LibRetro_SVMU","mess_libretro","LibRetro_SUPRV","mess_libretro","LibRetro_TG16","mednafen_pce_fast_libretro","LibRetro_TGCD","mednafen_pce_fast_libretro","LibRetro_TI99","mess_libretro","LibRetro_TOMY","mess_libretro","LibRetro_TRS80","mess_libretro","LibRetro_VECTX","mess_libretro","LibRetro_VTECH","mess_libretro","LibRetro_WIN3X","dosbox_libretro","LibRetro_WSAN","mednafen_wswan_libretro","LibRetro_WSANC","mednafen_wswan_libretro")
  59. libRetroCore := coreTypes[ident] ; search object for the default core for this ident
  60. If !libRetroCore
  61. ScriptError("Your Core ID is: " . ident . "`nCould not find a default core to use. Please update the module with a default core.")
  62.  
  63. settingsFile := modulePath . "\" . moduleName . ".ini"
  64. core := IniReadCheck(settingsFile, systemName, "LibRetro_Core",libRetroCore,,1)
  65. Fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1)
  66. configFolder := IniReadCheck(settingsFile, "Settings", "ConfigFolder",emuPath . "\config",,1)
  67. messRomPath := IniReadCheck(settingsFile, "Settings", "MESS_BIOS_Roms_Folder",,,1)
  68. hideConsole := IniReadCheck(settingsFile, "Settings", "HideConsole","true",,1)
  69. superGB := IniReadCheck(settingsFile, systemName . "|" . romName, "SuperGameBoy","false",,1)
  70. enableNetworkPlay := IniReadCheck(settingsFile, "Network|" . romName, "Enable_Network_Play","false",,1)
  71. overlay := IniReadCheck(settingsFile, systemName . "|" . romName, "Overlay",,,1)
  72. videoShader := IniReadCheck(settingsFile, systemName . "|" . romName, "VideoShader",,,1)
  73. aspectRatioIndex := IniReadCheck(settingsFile, systemName . "|" . romName, "AspectRatioIndex",,,1)
  74. customViewportWidth := IniReadCheck(settingsFile, systemName . "|" . romName, "CustomViewportWidth",,,1)
  75. customViewportHeight := IniReadCheck(settingsFile, systemName . "|" . romName, "CustomViewportHeight",,,1)
  76. customViewportX := IniReadCheck(settingsFile, systemName . "|" . romName, "CustomViewportX",,,1)
  77. customViewportY := IniReadCheck(settingsFile, systemName . "|" . romName, "CustomViewportY",,,1)
  78. rotateScreen := IniReadCheck(settingsFile, systemName . "|" . romName, "Rotation",0,,1)
  79. cropOverscan := IniReadCheck(settingsFile, systemName . "|" . romName, "CropOverscan",,,1)
  80. threadedVideo := IniReadCheck(settingsFile, systemName . "|" . romName, "ThreadedVideo",,,1)
  81. vSync := IniReadCheck(settingsFile, systemName . "|" . romName, "VSync",,,1)
  82. integerScale := IniReadCheck(settingsFile, systemName . "|" . romName, "IntegerScale",,,1)
  83. configFolder := GetFullName(configFolder)
  84. messRomPath := GetFullName(messRomPath)
  85. overlay := GetFullName(overlay)
  86. videoShader := GetFullName(videoShader)
  87.  
  88. retroArchSystem := systemName
  89.  
  90. If (ident = "LibRetro_SGB" || superGB = "true") ; if system or rom is set to use Super Game Boy
  91. { superGB = true ; setting this just in case it's false and the system is Nintendo Super Game Boy
  92. 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")
  93. 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")
  94. ident := "LibRetro_SGB" ; switching to Super Game Boy mode
  95. retroArchSystem := "Nintendo Super Game Boy"
  96. }
  97.  
  98. ; Find the dll for this system
  99. libDll := CheckFile(emuPath . "\cores\" . core . ".dll", "Your " . ident . " dll is set to " . core . " but could not locate this file:`n" . emuPath . "\cores\" . core . ".dll")
  100.  
  101. ; Find the cfg file to use
  102. If !FileExist(configFolder)
  103. ScriptError("You need to make sure ""ConfigFolder"" is pointing to your RetroArch config folder. By default it is looking here: """ . configFolder . """")
  104. globalRetroCfg := emuPath . "\retroarch.cfg"
  105. systemRetroCfg := configFolder . "\" . retroArchSystem . ".cfg"
  106. coreRetroCfg := configFolder . "\" . core . ".dll.cfg"
  107. Log("Module - Global cfg should be: " . globalRetroCfg,4)
  108. Log("Module - System cfg should be: " . systemRetroCfg,4)
  109. Log("Module - Core cfg should be: " . coreRetroCfg,4)
  110. foundCfg :=
  111. If FileExist(systemRetroCfg) { ; check for system cfg first
  112. retroCFGFile := systemRetroCfg
  113. foundCfg := 1
  114. Log("Module - Found a System cfg!",4)
  115. } Else If FileExist(coreRetroCfg) { ; 2nd option is a core config
  116. retroCFGFile := coreRetroCfg
  117. foundCfg := 1
  118. Log("Module - Found a Core cfg!",4)
  119. } Else If FileExist(globalRetroCfg) { ; 3rd is global cfg
  120. retroCFGFile := globalRetroCfg
  121. foundCfg := 1
  122. Log("Module - Found a Global cfg!",4)
  123. }
  124. If !foundCfg
  125. Log("Module - Could not find a cfg file to update settings. RetroArch will make one for you.",2)
  126. Else
  127. Log("Module - " . MEmu . " is using " . retroCFGFile . " as its config file.")
  128.  
  129. If foundCfg {
  130. retroCFG := LoadProperties(retroCFGFile) ; load the config into memory
  131. raCfgHasChanges :=
  132. WriteRetroProperty("input_overlay", overlay)
  133. WriteRetroProperty("video_shader", videoShader)
  134. WriteRetroProperty("aspect_ratio_index", aspectRatioIndex)
  135. WriteRetroProperty("custom_viewport_width", customViewportWidth)
  136. WriteRetroProperty("custom_viewport_height", customViewportHeight)
  137. WriteRetroProperty("custom_viewport_x", customViewportX)
  138. WriteRetroProperty("custom_viewport_y", customViewportY)
  139. WriteRetroProperty("video_rotation", rotateScreen)
  140. WriteRetroProperty("video_crop_overscan", cropOverscan)
  141. WriteRetroProperty("video_threaded", threadedVideo)
  142. WriteRetroProperty("video_vsync", vSync)
  143. WriteRetroProperty("video_scale_integer", integerScale)
  144.  
  145. If InStr(ident, "LibRetro_PSX") {
  146. Loop, 8 ; loop 8 times for 8 controllers
  147. { p%A_Index%ControllerType := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "P" . A_Index . "_Controller_Type", 517,,1)
  148. WriteRetroProperty("input_libretro_device_p" . A_Index, p%A_Index%ControllerType)
  149. }
  150. }
  151.  
  152. If raCfgHasChanges {
  153. Log("Module - Saving changed settings to: """ . retroCFGFile . """")
  154. SaveProperties(retroCFGFile, retroCFG)
  155. }
  156. }
  157.  
  158. If RegExMatch(ident, "LibRetro_NFDS|LibRetro_SCD|LibRetro_TGCD|LibRetro_PCECD|LibRetro_PCFX") { ; these systems require the retroarch settings to be read
  159. retroSysDir := ReadProperty(retroCFG,"system_directory") ; read value
  160. retroSysDir := ConvertRetroCFGKey(retroSysDir) ; remove dbl quotes
  161. StringLeft, retroSysDirLeft, retroSysDir, 2
  162. If (retroSysDirLeft = ":\") { ; if retroarch is set to use a default folder
  163. StringTrimLeft, retroSysDir, retroSysDir, 1
  164. Log("Module - RetroArch is using a relative system path: """ . retroSysDir . """")
  165. retroSysDir := emuPath . retroSysDir
  166. }
  167. If !retroSysDir
  168. ScriptError("RetroArch requires you to set your system_directory and place bios rom(s) in there for """ . retroArchSystem . """ to function. Please do this first by running ""retroarch-phoenix.exe"" manually.")
  169. StringRight, checkForSlash, retroSysDir, 1
  170. If (checkForSlash = "\") ; check if a backslash is the last character. If it is, remove it, as this is non-standard method to define folders
  171. StringTrimRight, retroSysDir, retroSysDir, 1
  172. }
  173.  
  174. If (RegExMatch(ident, "LibRetro_N64|LibRetro_NES|LibRetro_LYNX|LibRetro_PSX") || RegExMatch(ident, "LibRetro_NES") && (InStr(core, "nestopia_libretro"))) { ; these systems will use an ini to store game specific settings
  175. sysSettingsFile := CheckSysFile(modulePath . "\" . systemName . ".ini") ; create the ini if it does not exist
  176. coreOptionsCFGFile := CheckFile(emuPath . "\retroarch-core-options.cfg", "Could not find retroarch-core-options.cfg in retroarch directory: """ . emuPath . """")
  177. coreOptionsCFG := LoadProperties(coreOptionsCFGFile)
  178. If InStr(ident, "LibRetro_N64") { ; Nintendo 64
  179. mupenGfx := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Gfx_Plugin", "auto",,1)
  180. mupenRsp := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_RSP_Plugin", "auto",,1)
  181. mupenCpu := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_CPU_Core", "dynamic_recompiler",,1)
  182. mupenPak1 := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Pak_1", "memory",,1)
  183. mupenPak2 := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Pak_2", "memory",,1)
  184. mupenPak3 := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Pak_3", "memory",,1)
  185. mupenPak4 := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Pak_4", "memory",,1)
  186. mupenGfxAccur := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Gfx_Accuracy", "high",,1)
  187. mupenExpMem := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Disable_Exp_Memory", "no",,1)
  188. mupenTexturFilt := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Texture_Filtering", "nearest",,1)
  189. mupenViRefresh := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_VI_Refresh", "2200",,1)
  190. mupenFramerate := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Framerate", "fullspeed",,1)
  191. mupenResolution := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Resolution", "640x480",,1)
  192. mupenPolyOffstFctr := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Polygon_Offset_Factor", "-3.0",,1)
  193. mupenPolyOffstUnts := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Polygon_Offset_Units", "-3.0",,1)
  194. mupenViOverlay := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_VI_Overlay", "disabled",,1)
  195. mupenAnalogDzone := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Mupen_Analog_Deadzone", "15",,1)
  196.  
  197. WriteProperty(coreOptionsCFG, "mupen64-gfxplugin", mupenGfx, 1)
  198. WriteProperty(coreOptionsCFG, "mupen64-rspplugin", mupenRsp, 1)
  199. WriteProperty(coreOptionsCFG, "mupen64-cpucore", mupenCpu, 1)
  200. WriteProperty(coreOptionsCFG, "mupen64-pak1", mupenPak1, 1)
  201. WriteProperty(coreOptionsCFG, "mupen64-pak2", mupenPak2, 1)
  202. WriteProperty(coreOptionsCFG, "mupen64-pak3", mupenPak3, 1)
  203. WriteProperty(coreOptionsCFG, "mupen64-pak4", mupenPak4, 1)
  204. WriteProperty(coreOptionsCFG, "mupen64-gfxplugin-accuracy", mupenGfxAccur, 1)
  205. WriteProperty(coreOptionsCFG, "mupen64-disableexpmem", mupenExpMem, 1)
  206. WriteProperty(coreOptionsCFG, "mupen64-filtering", mupenTexturFilt, 1)
  207. WriteProperty(coreOptionsCFG, "mupen64-virefresh", mupenViRefresh, 1)
  208. WriteProperty(coreOptionsCFG, "mupen64-framerate", mupenFramerate, 1)
  209. WriteProperty(coreOptionsCFG, "mupen64-screensize", mupenResolution, 1)
  210. WriteProperty(coreOptionsCFG, "mupen64-polyoffset-factor", mupenPolyOffstFctr, 1)
  211. WriteProperty(coreOptionsCFG, "mupen64-polyoffset-units", mupenPolyOffstUnts, 1)
  212. WriteProperty(coreOptionsCFG, "mupen64-angrylion-vioverlay", mupenViOverlay, 1)
  213. WriteProperty(coreOptionsCFG, "mupen64-astick-deadzone", mupenAnalogDzone, 1)
  214. } Else If InStr(ident, "LibRetro_NES") { ; these systems will use an ini to store game specific settings
  215. If InStr(core, "nestopia_libretro") { ; Nestopia
  216. nestopiaBlargg := IniReadCheck(sysSettingsFile, "Nestopia" . "|" . romName, "Nestopia_Blargg_NTSC_Filter", "disabled",,1)
  217. nestopiaPalette := IniReadCheck(sysSettingsFile, "Nestopia" . "|" . romName, "Nestopia_Palette", "canonical",,1)
  218. nestopiaNoSprteLimit := IniReadCheck(sysSettingsFile, "Nestopia" . "|" . romName, "Nestopia_Remove_Sprites_Limit", "disabled",,1)
  219.  
  220. WriteProperty(coreOptionsCFG, "nestopia_blargg_ntsc_filter", nestopiaBlargg, 1)
  221. WriteProperty(coreOptionsCFG, "nestopia_palette", nestopiaPalette, 1)
  222. WriteProperty(coreOptionsCFG, "nestopia_nospritelimit", nestopiaNoSprteLimit, 1)
  223. }
  224. } Else If InStr(ident, "LibRetro_LYNX") { ; Atari Lynx
  225. If InStr(core, "handy_libretro") { ; Handy
  226. handyRotate := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "Handy_Rotation", "None",,1)
  227. WriteProperty(coreOptionsCFG, "handy_rot", handyRotate, 1)
  228. }
  229. } Else If InStr(ident, "LibRetro_PSX") { ; Sony PlayStation
  230. psxCdImageCache := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "PSX_CD_Image_Cache", """enabled""",,1)
  231. psxMemcardHandling := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "PSX_Memcard_Handling", """libretro""",,1)
  232. psxDualshockAnalogToggle := IniReadCheck(sysSettingsFile, systemName . "|" . romName, "PSX_Dualshock_Analog_Toggle", """enabled""",,1)
  233.  
  234. WriteProperty(coreOptionsCFG, "beetle_psx_cdimagecache", psxCdImageCache, 1)
  235. WriteProperty(coreOptionsCFG, "beetle_psx_use_mednafen_memcard0_method", psxMemcardHandling, 1)
  236. WriteProperty(coreOptionsCFG, "beetle_psx_analog_toggle", psxDualshockAnalogToggle, 1)
  237. }
  238. SaveProperties(coreOptionsCFGFile, coreOptionsCFG)
  239. }
  240.  
  241. 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
  242. 7z(romPath, romName, romExtension, 7zExtractPath)
  243.  
  244. ; MESS core options
  245. messIdent :=
  246. messParam1 :=
  247. messParam2 :=
  248. messParam3 :=
  249. If InStr(core, "mess") { ; if a mess core is used
  250. Log("Module - Retroarch MESS mode enabled")
  251. ; the messType object links the system name to the name mess recognizes
  252. messType := Object("Amstrad CPC","cpc464","Amstrad GX4000","gx4000","APF Imagination Machine","apfimag","Apple IIGS","apple2gs","Atari 8-bit","a800","Atari 2600","a2600","Atari 5200","a5200","Atari 7800","a7800","Atari Jaguar","jaguar","Atari Lynx","lynx","Bally Astrocade","astrocde","Bandai Super Vision 8000","sv8000","Bandai WonderSwan","wswan","Bandai WonderSwan Color","wscolor","Casio PV-1000","pv1000","Casio PV-2000","pv2000","Coleco ADAM","adam","ColecoVision","coleco","Creatronic Mega Duck","megaduck","Dragon 64","dragon64","Emerson Arcadia 2001","arcadia","Entex Adventure Vision","advision","Epoch Game Pocket Computer","gamepock","Epoch Super Cassette Vision","scv","Exidy Sorcerer","sorcerer","Fairchild Channel F","channelf","Funtech Super Acan","supracan","GCE Vectrex","vectrex","Hartung Game Master","gmaster","GamePark 32","gp32","Interton VC 4000","vc4000","JungleTac Sport Vii","vii","Magnavox Odyssey 2","odyssey2","Matra & Hachette Alice","alice32","Mattel Aquarius","aquarius","Mattel Intellivision","intv","NEC PC Engine","pce","NEC PC Engine-CD","pce","NEC SuperGrafx","sgx","NEC TurboGrafx-16","tg16","NEC TurboGrafx-CD","tg16","Nintendo 64","n64","Nintendo Entertainment System","nes","Nintendo Famicom Disk System","famicom","Nintendo Game Boy","gameboy","Nintendo Game Boy Advance","gba","Nintendo Game Boy Color","gbcolor","Nintendo Game Boy Japan","gameboy","Nintendo Pokemon Mini","pokemini","Nintendo Virtual Boy","vboy","Elektronska Industrija Pecom 64","pecom64","Philips CD-i","cdimono1","Philips Videopac","videopac","RCA Studio II","studio2","Sega 32X","32x","Sega SC-3000","sc3000","Sega CD","segacd","Sega Game Gear","gamegear","Sega Genesis","genesis","Sega Master System","sms","Sega Mega Drive","megadriv","Sega VMU","svmu","Sinclair ZX Spectrum","spectrum","SNK Neo Geo AES","aes","SNK Neo Geo CD","neocdz","SNK Neo Geo Pocket","ngp","SNK Neo Geo Pocket Color","ngpc","Sony PlayStation","psx","Sony PocketStation","pockstat","Sord M5","m5","Spectravideo","svi328n","Super Nintendo Entertainment System","snes","Tandy TRS-80 Color Computer","coco3","Texas Instruments TI 99-4A","ti99_4a","Tiger Game.com","gamecom","Thomson MO5","mo5","Tomy Tutor","tutor","VTech CreatiVision","crvision","Watara Supervision","svision")
  253. messIdent := messType[systemName] ; search object for the systemName identifier Retroarch uses for its cores
  254. If !messIdent
  255. ScriptError("Your systemName is: " . systemName . "`nIt is not one of the known supported systems for the MESS LibRetro core")
  256. Else
  257. Log("Module - MESS mode using a known ident: " . messIdent)
  258.  
  259. If !messRomPath
  260. 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.")
  261.  
  262. messParam1 :=
  263. messParam2 := " -rompath \" . """" . messRomPath . "\" . """"
  264.  
  265. ; Build a key/value object containing the different messParam3 choices
  266. messP3 := Object("alice32","cass1","gp32","memc","cpc464","cass","spectrum","cass","dragon64","cass","cdimono1","cdrom","neocd","cdrom","neocdz","cdrom","svi328n","cass","pecom64","cass","svmu","quik")
  267. messParam3 := messP3[messIdent] ; search object for the messIdent pair
  268. messParam3 := " -" . (If messParam3 ? messParam3 : "cart") . " \" . """" . romPath . "\" . romName . romExtension . "\" . """"
  269.  
  270. fullRomPath := messParam1 . messParam2 . messParam3
  271. } Else If (superGB = "true") {
  272. Log("Module - Retroarch Super Game Boy mode enabled")
  273. fullRomPath := " """ . sgbRomPath . """ --subsystem sgb """ . romPath . "\" . romName . romExtension . """"
  274. } Else {
  275. Log("Module - Retroarch standard mode enabled")
  276. fullRomPath := " """ . romPath . "\" . romName . romExtension . """"
  277. }
  278.  
  279. If ident = LibRetro_NFDS ; Nintendo Famicom Disk System
  280. { IfNotExist, %retroSysDir%\disksys.rom
  281. ScriptError("RetroArch requires ""disksys.rom"" for " . retroArchSystem . " but could not find it in your system_directory: """ . retroSysDir . """")
  282. } Else If ident = LibRetro_SCD ; Sega CD
  283. { If romExtension Not In .bin,.cue,.iso
  284. ScriptError("RetroArch only supports Sega CD games in bin|cue|iso format. It does not support:`n" . romExtension)
  285. IfNotExist, %retroSysDir%\bios_CD_E.bin
  286. ScriptError("RetroArch requires ""bios_CD_E.bin"" for " . retroArchSystem . " but could not find it in your system_directory: """ . retroSysDir . """")
  287. IfNotExist, %retroSysDir%\bios_CD_U.bin
  288. ScriptError("RetroArch requires ""bios_CD_U.bin"" for " . retroArchSystem . " but could not find it in your system_directory: """ . retroSysDir . """")
  289. IfNotExist, %retroSysDir%\bios_CD_J.bin
  290. ScriptError("RetroArch requires ""bios_CD_J.bin"" for " . retroArchSystem . " but could not find it in your system_directory: """ . retroSysDir . """")
  291. } Else If ident in LibRetro_PCECD,LibRetro_TGCD ; NEC PC Engine-CD and NEC TurboGrafx-CD
  292. { If romExtension Not In .ccd,.cue
  293. ScriptError("RetroArch only supports " . retroArchSystem . " games in ccd or cue format. It does not support:`n" . romExtension)
  294. IfNotExist, %retroSysDir%\syscard3.pce
  295. ScriptError("RetroArch requires ""syscard3.pce"" for " . retroArchSystem . " but could not find it in your system_directory: """ . retroSysDir . """")
  296. } Else If ident = LibRetro_PCFX
  297. { If romExtension Not In .ccd,.cue
  298. ScriptError("RetroArch only supports " . retroArchSystem . " games in ccd or cue format. It does not support:`n" . romExtension)
  299. IfNotExist, %retroSysDir%\pcfxbios.bin
  300. ScriptError("RetroArch requires ""pcfxbios.bin"" for " . retroArchSystem . " but could not find it in your system_directory: """ . retroSysDir . """")
  301. }
  302.  
  303.  
  304. networkSession :=
  305. If (enableNetworkPlay = "true") {
  306. Log("Module - Network Multi-Player is an available option for " . dbName,4)
  307.  
  308. netplayNickname := IniReadCheck(settingsFile, "Network", "NetPlay_Nickname","Player",,1)
  309. getWANIP := IniReadCheck(settingsFile, "Network", "Get_WAN_IP","false",,1)
  310.  
  311. If (getWANIP = "true")
  312. myPublicIP := GetPublicIP()
  313.  
  314. Log("Module - CAREFUL WHEN POSTING THIS LOG PUBLICLY AS IT CONTAINS YOUR IP ON THE NEXT LINE",2)
  315. defaultServerIP := IniReadCheck(settingsFile, "Network", "Default_Server_IP", myPublicIP,,1)
  316. defaultServerPort := IniReadCheck(settingsFile, "Network", "Default_Server_Port",,,1)
  317. lastIP := IniReadCheck(settingsFile, "Network", "Last_IP", defaultServerIP,,1) ; does not need to be on the ISD
  318. lastPort := IniReadCheck(settingsFile, "Network", "Last_Port", defaultServerPort,,1) ; does not need to be on the ISD
  319.  
  320. mpMenuStatus := MultiPlayerMenu(lastIP,lastPort,networkType,,0)
  321. If (mpMenuStatus = -1) { ; if user exited menu early
  322. Log("Module - Cancelled MultiPlayer Menu. Exiting module.",2)
  323. ExitModule()
  324. }
  325. If networkSession {
  326. Log("Module - Using a Network for " . dbName,4)
  327. IniWrite, %networkPort%, %settingsFile%, Network, Last_Port
  328. ; msgbox lastIP: %lastIP%`nlastPort: %lastPort%`nnetworkIP: %networkIP%`nnetworkPort: %networkPort%
  329. If (networkType = "client") {
  330. IniWrite, %networkIP%, %settingsFile%, Network, Last_IP ; Save last used IP and Port for quicker launching next time
  331. netCommand := " -C " . networkIP . " --port " . networkPort . " --nick """ . netplayNickname . """" ; -C = connect as client
  332. } Else { ; server
  333. netCommand := " -H --port " . networkPort . " --nick """ . netplayNickname . """" ; -H = host as server
  334. }
  335. Log("Module - CAREFUL WHEN POSTING THIS LOG PUBLICLY AS IT CONTAINS YOUR IP ON THE NEXT LINE",2)
  336. Log("Module - Starting a network session using the IP """ . networkIP . """ and PORT """ . networkPort . """",4)
  337. } Else
  338. Log("Module - User chose Single Player mode for this session",4)
  339. }
  340.  
  341. BezelStart()
  342.  
  343. fullscreen := If fullscreen = "true" ? " -f" : ""
  344. srmPath := emuPath . "\srm\" . retroArchSystem ; path for this system's srm files
  345. saveStatePath := emuPath . "\save\" . retroArchSystem ; path for this system's save state files
  346. retroCFGFile := If foundCfg ? " -c """ . retroCFGFile . """" : ""
  347.  
  348. IfNotExist, %srmPath%
  349. FileCreateDir, %srmPath% ; creating srm dir if it doesn't exist
  350. IfNotExist, %saveStatePath%
  351. FileCreateDir, %saveStatePath% ; creating save dir if it doesn't exist
  352.  
  353. HideEmuStart() ; This fully ensures windows are completely hidden even faster than winwait
  354.  
  355. If InStr(core, "mess") { ; if a mess core is used
  356. Run(executable . " """ . (messIdent ? messIdent : "") . fullRomPath . """ " . fullscreen . retroCFGFile . " -L """ . libDll . """ -s """ . srmPath . "\" . romName . ".srm"" -S """ . saveStatePath . "\" . romName . ".state""" . netCommand, emuPath, "Hide")
  357. } Else If (ident = "LibRetro_SGB" || If superGB = "true") { ; For some reason, the order of our command line matters in this particular case.
  358. Run(executable . " " . fullscreen . retroCFGFile . " -L """ . libDll . """ -s """ . srmPath . "\" . romName . ".srm"" -S """ . saveStatePath . "\" . romName . ".state""" . fullRomPath . netCommand, emuPath, "Hide")
  359. } Else {
  360. Run(executable . " " . fullRomPath . fullscreen . retroCFGFile . " -L """ . libDll . """ -s """ . srmPath . "\" . romName . ".srm"" -S """ . saveStatePath . "\" . romName . ".state""" . netCommand, emuPath, "Hide")
  361. }
  362.  
  363. mpMenuStatus :=
  364. If networkSession {
  365. canceledServerWait := false
  366. multiplayerMenuExit := false
  367. SetTimer, NetworkConnectedCheck, 500
  368.  
  369. If (networkType = "server") {
  370. Log("Module - Waiting for a client to connect to your server")
  371. mpMenuStatus := MultiPlayerMenu(,,,,,,,,"You are the server. Please wait for your client to connect.")
  372. } Else { ; client
  373. Log("Module - Trying to contact the server to establish a connection.")
  374. mpMenuStatus := MultiPlayerMenu(,,,,,,,,"Attempting to connect to the server...")
  375. }
  376.  
  377. If (mpMenuStatus = -1) { ; if user exited menu early before a client connected
  378. Log("Module - Cancelled waiting for the " . If (networkType = "server") ? "client to connect" : "server to respond" . ". Exiting module.",2)
  379. If Process("Exist", executable)
  380. Process("Close", executable) ; must close process as the exe is waiting for a client to connect and no window was drawn yet
  381. ExitModule()
  382. } Else { ; blank response from MultiPlayerMenu, exited properly
  383. Log("Module - " . If (networkType = "server") ? "Client has connected" : "Connected to the server")
  384. WinWait("RetroArch ahk_class RetroArch")
  385. WinWaitActive("RetroArch ahk_class RetroArch")
  386. }
  387. SetTimer, NetworkConnectedCheck, Off
  388. } Else { ; single player
  389. WinWait("RetroArch ahk_class RetroArch")
  390. WinWaitActive("RetroArch ahk_class RetroArch")
  391. }
  392.  
  393. If hideConsole = true
  394. WinSet, Transparent, On, ahk_class ConsoleWindowClass ; makes the console window transparent so you don't see it on exit
  395.  
  396. BezelDraw()
  397. HideEmuEnd()
  398. FadeInExit()
  399. Process("WaitClose", executable)
  400. 7zCleanUp()
  401. BezelExit()
  402. FadeOutExit()
  403. ExitModule()
  404.  
  405.  
  406. ; Writes new properties into the retroCFG if defined by user
  407. WriteRetroProperty(key,value="") {
  408. If (value != "") {
  409. Global retroCFG,raCfgHasChanges
  410. WriteProperty(retroCFG, key, value,1,1)
  411. raCfgHasChanges := 1
  412. }
  413. }
  414.  
  415. ; Used to convert between RetroArch keys and usable data
  416. ConvertRetroCFGKey(txt,direction="read"){
  417. Global emuPath
  418. If direction = read
  419. { StringTrimLeft,newtxt,txt,1 ; removes the " from the left of the txt
  420. StringTrimRight,newtxt,newtxt,1 ; removes the " from the right of the txt
  421. If InStr(newtxt,":") { ; if the path contains a ":" then it is a relative path
  422. Log("ConvertRetroCFGKey - " . newtxt . " is a relative path",4)
  423. StringTrimLeft,newtxt,newtxt,1 ; removes the : from the left of the txt
  424. newtxt := AbsoluteFromRelative(emuPath, "." . newtxt) ; convert relative to absolute
  425. }
  426. If InStr(newtxt,"/")
  427. StringReplace,newtxt,newtxt,/,\,1 ; replaces all forward slashes with backslashes
  428. } Else If direction = write
  429. { newtxt = "%txt%" ; wraps the txt with ""
  430. If InStr(newtxt,"\")
  431. StringReplace,newtxt,newtxt,\,/,1 ; replaces all backslashes with forward slashes
  432. } Else
  433. ScriptError("Not a valid use of ConvertRetroCFGKey. Only ""read"" or ""write"" are supported.")
  434. Log("ConvertRetroCFGKey - Converted " . txt . " to " . newtxt,4)
  435. Return newtxt
  436. }
  437.  
  438. ; This will simply create a new blank ini if one does not exist
  439. CheckSysFile(file){
  440. IfNotExist, %file%
  441. FileAppend,, %file%
  442. Return file
  443. }
  444.  
  445. NetworkConnectedCheck:
  446. If clientConnected
  447. multiplayerMenuExit := true
  448. Else If WinExist("RetroArch ahk_class RetroArch") {
  449. Log("Module - RetroArch session started, closing the MultiPlayer menu",4)
  450. multiplayerMenuExit := true
  451. }
  452. Return
  453.  
  454. CloseProcess:
  455. FadeOutStart()
  456. WinClose("RetroArch ahk_class RetroArch")
  457. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement