SHARE
TWEET

Untitled

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