Advertisement
djvj

Untitled

Dec 17th, 2015
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.42 KB | None | 0 0
  1. MEmu = DOSBox
  2. MEmuV = v0.74
  3. MURL = http://www.dosbox.com/
  4. MAuthor = brolly,djvj
  5. MVersion = 2.0.6
  6. MCRC = 42E19E92
  7. iCRC = D28F1C57
  8. mId = 635535818862708645
  9. MSystem = "Microsoft MS-DOS","Microsoft Windows","Microsoft Windows 3.x"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; This module is geared to work with the eXoDOS sets and folder structure. If you have games not from this set, you will want to use the same structure he uses.
  13. ; You can find an Enhanced DOSBox (highly recommended) with many unofficial features on ykhwong's page @ http://ykhwong.x-y.net/
  14. ; This enhanced DOSBox is needed for full Microsoft Windows 3.x support. So just stick with that one version for both systems.
  15. ; This module is oriented to work with the eXoDOS sets, but it can work with any DOSBox configured game if you follow some guidelines.
  16. ; - Make sure you set Skip Checks to Rom Only
  17. ; - Rom Extensions should only be 7z|zip. Do not include any extensions that RocketLauncher will think is a rom, like bat|txt|exe.
  18. ; - Rom Path should point to the folder where you have all the .zip files if you have 7z enabled and the folder where you keep your extracted games
  19. ; if you keep your games extracted. If the games are extracted make sure you keep each game inside it's own sub-folder named after the romName
  20. ; - After downloading each eXoDOS set, run the "Setup eXoDOS.bat" manually, which will unpack and create the games\!dos folder. This folder contains all the dosbox conf files for each game.
  21. ; If you don't intend to use Meagre you can also simply extract each of the GamesXXX.zip files (GamesAct.zip, GamesAdv.zip, etc.)
  22. ; - Configure your rom paths in RocketLauncherUI to point to these "games" folders (one path for each eXoDOS torrent, you can also merge them all in one folder if you want).
  23. ; I suggest not changing the structure of these folders.
  24. ; - In your Rom Path you should also have the !dos folder that keeps your DOSBox conf files, but you can change the path to this folder in RocketLauncherUI, but
  25. ; your configuration files should ALWAYS be kept inside a sub-folder named after your rom name ex. .\Config\bargon\dosbox.conf, .\Config\KQ1\dosbox.conf
  26. ; - The DOSbox configuration files should be named dosbox.conf, you can change the name in RocketLauncherUI if you prefer
  27. ; - Skipchecks should also be set to Rom Only.
  28. ; - If your games are compressed an additional ZipMapping ini file is required and should also be placed on the module folder so you can map
  29. ; the long filenames to the short ones. Should be kept inside %ModulePath%\ZipMapping\%SystemName%.ini.
  30. ; When using 7z support, don't forget to set the 7z_Extract_Path on your ini file, if you are using the eXoDOS sets the last folder on this path must be a
  31. ; a folder named "Games" since the conf files for these sets require such a naming. Module will error out if this doesn't happen.
  32. ; Since eXoDOS sets rely on games being stored inside a folder named Games, if you want to use this module with other DOS sets, you might need to disable the
  33. ; setting that appends 'Games' automatically to your paths under RocketLauncherUI
  34. ; DOSBox as a nasty habit of getting on top of all windows which might make it appear on top of the fade screen. If you are having this behavior enable HideEmu in RocketLauncherUI
  35. ; Many old games place save games inside their own dirs, if you use 7z_Enable and 7z_Delete_Temp is true, you will delete these save games. Set 7z_Delete_Temp to false to prevent this.
  36. ; Shaders are only supported in the ykhwong's DOSBox builds and they will only work if you set the output mode to direct3d
  37. ;
  38. ; Controls are done via in-game options for each game.
  39. ; Dosbox.conf information can be found here: http://www.dosbox.com/wiki/Dosbox.conf
  40. ; DOSBox cli parameters: http://www.dosbox.com/wiki/Usage
  41. ; DOSBox Manual: http://www.dosbox.com/DOSBoxManual.html
  42. ; Compatibility List for DOSBox (often find game specific settings needed to get your games to launch): http://www.dosbox.com/comp_list.php?letter=a
  43. ;
  44. ; Useful DOSBox links:
  45. ; http://www.dosbox.com/wiki/Usage
  46. ; http://www.dosbox.com/wiki/Dosbox.conf
  47. ;
  48. ; Multi-PLayer Games info:
  49. ; List of multiplayer network dos games: http://web.archive.org/web/19970521185925/http://www.cs.uwm.edu/public/jimu/netgames.html
  50. ; GoG IPX list: http://www.gog.com/mix/dos_games_with_ipx_multiplayer
  51. ; MobyGames IPX list: http://www.mobygames.com/attribute/sheet/attributeId,82/p,2/
  52. ; MobyGames NetBios list: http://www.mobygames.com/attribute/sheet/attributeId,129/
  53. ; MobyGames Null Modem list: http://www.mobygames.com/attribute/sheet/attributeId,84/p,2/
  54. ; You can download NetBios from here: http://www.classicgamingarena.com/downloads/games/utilities/netbios
  55. ;
  56. ; Gravis Ultrasound Games:
  57. ; If you want to further Enhance the audio in many of the games, try setting these to use Ultrasound: http://www.mobygames.com/attribute/sheet/attributeId,20/
  58. ; Ultrasound Install Guide: http://www.vogons.org/viewtopic.php?t=16974
  59. ; Ultrasound recommended patches: http://www.dosgames.com/forum/about10574.html
  60. ; Extract the ULTRASNDPPL161 folder anywhere you want, default is %EmuPath%\Gravis_UltraSound, and rename it to ULTRAPRO
  61. ; Extract the ULTRASND411 to the same folder and rename it to ULTRASND
  62. ; If you did not use the default folder, in RocketLauncherUI's DOSBox module settings, change Gravis_Ultrasound_Folder to the folder you did.
  63. ; In DOSBox, these folders will be found in U:\ if done correctly. Do not try to use this drive for anything else in the DOS environment.
  64. ; Each game needs to be set up with the Midi and/or sound effects cards set to Gravis Ultrasound. This can only be done in the dosbox environment and running the game's setup executable. Usually this is setup.exe.
  65. ; If you set the proper Backup_Files in RocketLauncherUI, RocketLauncher will backup your settings and Ultrasound will work on next launch.
  66. ;----------------------------------------------------------------------------
  67. StartModule()
  68. BezelGUI()
  69. FadeInStart()
  70.  
  71. settingsFile := modulePath . "\" . moduleName . ".ini"
  72. fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","false",,1)
  73. hideConsole := IniReadCheck(settingsFile, "Settings", "Hide_Console","true",,1)
  74. gusFolder := IniReadCheck(settingsFile, "Settings", "Gravis_Ultrasound_Folder", emuPath . "\Gravis_UltraSound",,1)
  75. setupOnLaunch := IniReadCheck(settingsFile, "Settings|" . romName, "Setup_On_Launch", "false",,1)
  76. requireGamesFolder := IniReadCheck(settingsFile, "Settings|" . romName, "Require_Games_Folder", "true",,1)
  77. fullscreenResolution := IniReadCheck(settingsFile, "Settings|" . romName, "Fullscreen_Resolution", "original",,1)
  78. windowedResolution := IniReadCheck(settingsFile, "Settings|" . romName, "Windowed_Resolution", "original",,1)
  79. confFile := IniReadCheck(settingsFile, "Settings|" . romName, "Conf_File", "dosbox.conf",,1)
  80. enableUltrasound := IniReadCheck(settingsFile, "Settings|" . romName, "Enable_Ultrasound", "false",,1)
  81. scaler := IniReadCheck(settingsFile, "Settings|" . romName, "Scaler", "none",,1)
  82. shader := IniReadCheck(settingsFile, "Settings|" . romName, "Shader", "none",,1)
  83. aspect := IniReadCheck(settingsFile, "Settings|" . romName, "Aspect", "false",,1)
  84. output := IniReadCheck(settingsFile, "Settings|" . romName, "Output", "surface",,1)
  85. internalEmu := IniReadCheck(settingsFile, romName, "Internal_Emu","false",,1)
  86. internalEmuFolder := IniReadCheck(settingsFile, romName, "Internal_Emu_Folder","dosbox",,1)
  87. command := IniReadCheck(settingsFile, romName, "Command", "",,1)
  88. sendCommandDelay := IniReadCheck(settingsFile, "Settings" . "|" . romName, "Send_Command_Delay", "300",,1)
  89. forceExtractionToRomPath := IniReadCheck(settingsFile, "Settings" . "|" . romName, "Force_Extraction_To_Rom_Path", "false",,1)
  90. setupExecutable := IniReadCheck(settingsFile, dbName, "Setup_Executable", "setup.exe",,1)
  91. noMenu := IniReadCheck(settingsFile, romName, "No_Menu", "false",,1)
  92. enableNetworkPlay := IniReadCheck(settingsFile, romName, "Enable_Network_Play","false",,1)
  93. backupFiles := IniReadCheck(settingsFile, romName, "Backup_Files",,,1)
  94. gusFolder := GetFullName(gusFolder) ; convert relative to absolute
  95.  
  96. shortName := IniReadCheck(modulePath . "\ZipMapping\" . systemName . ".ini", "mapping", romName, romName,,1)
  97. gameExecutable := IniReadCheck(settingsFile, dbName, "Game_Executable", shortName . ".exe",,1)
  98. Log("Module - """ . romName . """ is using the mapped name: """ . shortName . """")
  99.  
  100. ; Following check is because RocketLauncher must have Skip Checks set to Rom Only but we still need a method for checking something exists that resembles your rom or correct romPath when multiples paths are defined
  101. romPathFound :=
  102. If (7zEnabled != "true") {
  103. Loop, Parse, romPath, |
  104. {
  105. currentPath := A_LoopField
  106. Log("Module - Searching for a folder: """ . currentPath . "\" . shortName . """",4)
  107. If InStr(FileExist(currentPath . "\" . shortName), "D") ; checking for a folder that might match
  108. {
  109. romPath := currentPath
  110. romPathFound := true
  111. Log("Module - romPath updated to: """ . romPath . """",4)
  112. }
  113. }
  114. If !romPathFound
  115. ScriptError("Couldn't find a folder " . shortName . " in any of these defined rom paths: " . romPath)
  116. } Else If !romExtension
  117. ScriptError("Couldn't find " . romName . " in any of these defined rom paths: " . romPath)
  118.  
  119. If (forceExtractionToRomPath = "true") {
  120. Log("Module - forceExtractionToRomPath is set to true, setting 7zExtractPath to " . romPath . ". Careful when using this setting!",4)
  121. 7zExtractPath := romPath
  122. Log("Module - 7zExtractPath updated to: """ . romPath . """",4)
  123. }
  124.  
  125. defaultConfigFolderName := "!dos"
  126. If InStr(systemName,"Windows")
  127. defaultConfigFolderName := "!win3x"
  128.  
  129. configFolder := IniReadCheck(settingsFile, "Settings", "Config_Folder", romPath . "\" . defaultConfigFolderName,,1)
  130. configFolder := GetFullName(configFolder)
  131. originalConfFile := CheckFile(configFolder . "\" . shortName . "\" . confFile)
  132.  
  133. ; Renaming conf file name so it is unique to this PC because on local networks this could have 2 pcs use the same conf which would be bad. Also we don't want to edit the orignal because that would mess up Meagre
  134. customConfCreated :=
  135. If (enableUltrasound ="true" || enableNetworkPlay = "true" || setupOnLaunch = "true") {
  136. SplitPath, originalConfFile,, tempConfPath, tempConfExt, tempConfFile
  137. FileCopy, %originalConfFile%, %tempConfPath%\%tempConfFile%.%A_ComputerName%.%tempConfExt%, 1 ; copy conf to new unique file name
  138. confFile := tempConfPath . "\" . tempConfFile . "." . A_ComputerName . "." . tempConfExt
  139. Log("Module - Conf file was changed to keep it unique to this PC: " . confFile,4)
  140. customConfCreated := true
  141. } Else
  142. confFile := originalConfFile
  143. Log("Module - Using conf: " . confFile)
  144.  
  145. BezelStart("fixResMode")
  146.  
  147. hideEmuObj := Object("DOSBox Status Window ahk_class ConsoleWindowClass",0,"DOSBox ahk_class SDL_app",1) ;Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
  148.  
  149. If (7zEnabled = "true") {
  150. ; 7zExtractPath .= "\" . systemName ; tacking on systemName because with rom checks set to Rom Only it won't have it on there
  151. If (requireGamesFolder = "true" && (SubStr(7zExtractPath,-5) != "\Games")) { ; check to see if your extractPath ends in \Games which is required by eXoDOS sets
  152. Log("Module - This game requires the final folder in your 7zExtractPath to be \Games for eXoDOS sets, but your path doesn't have that.",4)
  153. If (7zAttachSystemName = "true") {
  154. 7zExtractPath .= "\" . systemName
  155. 7zAttachSystemName := false ; this needs to be disabled because 7z will tack on the systemName after \Games, instead, we tack it on here before
  156. }
  157. 7zExtractPath .= "\Games"
  158. Log("Module - 7zExtractPath change to """ . 7zExtractPath . """",4)
  159. }
  160. gamePath := 7zExtractPath
  161. baseGamesFolder := 7zExtractPath ; baseGamesFolder is the relative folder sent to DOSBox, which becomes the root of your C drive
  162. If (requireGamesFolder = "true") {
  163. ;Check if extraction path ends in a folder named Games
  164. SplitPath, 7zExtractPath, gamesFolder, baseGamesFolder
  165. If (gamesFolder != "Games")
  166. ScriptError("Please change your 7z Extract Path. Doesn't end in a folder named Games : " . 7zExtractPath)
  167. If (7zAttachSystemName = "true")
  168. ScriptError("Please change your 7z Extract Path and disable 7zAttachSystemName as otherwise the path won't end in a folder named Games : " . 7zExtractPath . "\" . systemName)
  169. }
  170.  
  171. ;Let's make sure games won't be extracted to the same folder as your config files, as we don't want that
  172. SplitPath, romPath,, baseRomPath
  173. If (baseRomPath = configFolder)
  174. ScriptError("Please change your 7z Extract Path, or it would extract files to your DOSBox configuration files folder : " . configFolder)
  175.  
  176. 7z(romPath, romName, romExtension, 7zExtractPath,, (If requireGamesFolder = "true" ? 0 : 1),1) ; setting last switch to AllowLargerFolders when extracted paths may be larger due to save games kept in them
  177. } Else {
  178. baseGamesFolder := romPath
  179. If (requireGamesFolder = "true") {
  180. ;Check if rom path ends in a folder named Games
  181. SplitPath, romPath, gamesFolder, baseGamesFolder
  182. If (gamesFolder != "Games")
  183. ScriptError("Please change your Rom Path. Doesn't end in a folder named Games")
  184. }
  185. gamePath := romPath
  186. }
  187.  
  188. dosPath = %emuPath%
  189. if (internalEmu = "true")
  190. dosPath := CheckFile(gamePath . "\" . shortName . "\" . internalEmuFolder)
  191.  
  192. params := " -scaler " . scaler . " -exit"
  193. If (noMenu = "true")
  194. params .= " -nomenu" ; Should only be enabled with Taewoong's DOSBox
  195.  
  196. hideConsole := If hideConsole = "true" ? " -noconsole" : ""
  197.  
  198. If (fullscreen = "true")
  199. fullscreen := " -fullscreen"
  200. Else {
  201. fullscreen :=
  202. IniRead, currentfullscreen, %confFile%, sdl, fullscreen
  203. If (currentfullscreen != fullscreen)
  204. IniWrite, false, %confFile%, sdl, fullscreen
  205. }
  206.  
  207. ;Edit DOSBox conf file if necessary
  208. IniRead, currentaspect, %confFile%, render, aspect
  209. IniRead, currentoutput, %confFile%, sdl, output
  210. IniRead, currentfsresolution, %confFile%, sdl, fullresolution
  211. IniRead, currentwindresolution, %confFile%, sdl, windowresolution
  212. IniRead, currentshader, %confFile%, sdl, pixelshader
  213.  
  214. If (currentaspect != aspect)
  215. IniWrite, %aspect%, %confFile%, render, aspect
  216. If (currentoutput != output)
  217. IniWrite, %output%, %confFile%, sdl, output
  218. If (currentfsresolution != fullscreenResolution)
  219. IniWrite, %fullscreenResolution%, %confFile%, sdl, fullresolution
  220. If (currentwindresolution != windowedResolution)
  221. IniWrite, %windowedResolution%, %confFile%, sdl, windowresolution
  222. If (currentshader != shader)
  223. IniWrite, %shader%, %confFile%, sdl, pixelshader
  224.  
  225. deleteShadersFolder := "false"
  226. If (shader != "none") {
  227. dosboxShaderFolder := dosPath . "\SHADERS"
  228. dosboxShaderFile := dosboxShaderFolder . "\" . shader
  229. IfExist, %dosboxShaderFile%
  230. {
  231. shaderFolder := baseGamesFolder . "\SHADERS"
  232. shaderFile := shaderFolder . "\" . shader
  233. IfNotExist %shaderFolder%
  234. {
  235. Log("Module - Shaders folder doesn't exist, creating it at " . shaderFolder,4)
  236. FileCreateDir, %shaderFolder%
  237. deleteShadersFolder := "true"
  238. }
  239. IfNotExist, %shaderFile%
  240. FileCopy, %dosboxShaderFile%, %shaderFile%
  241. IfNotExist, %shaderFolder%\scaling.inc
  242. FileCopy, %dosboxShaderFolder%\scaling.inc, %shaderFolder%\scaling.inc
  243. IfNotExist, %shaderFolder%\shader.code
  244. FileCopy, %dosboxShaderFolder%\shader.code, %shaderFolder%\shader.code
  245. }
  246. }
  247.  
  248. restoreConf :=
  249. networkSession :=
  250. If (enableNetworkPlay = "true") {
  251. Log("Module - Network Multi-Player is an available option for " . dbName,4)
  252. networkProtocol := IniReadCheck(settingsFile, dbName, "Network_Protocol","IPX",,1)
  253. getWANIP := IniReadCheck(settingsFile, "Network", "Get_WAN_IP","false",,1)
  254. networkRequiresSetup := IniReadCheck(settingsFile, dbName, "Network_Requires_Setup",,,1)
  255. maxPlayers := IniReadCheck(settingsFile, dbName, "Maximum_Players",,,1)
  256. If (getWANIP = "true")
  257. myPublicIP := GetPublicIP()
  258. defaultServer%networkProtocol%IP := IniReadCheck(settingsFile, "Network", "Default_Server_" . networkProtocol . "_IP", myPublicIP,,1)
  259. defaultServer%networkProtocol%Port := IniReadCheck(settingsFile, "Network", "Default_Server_" . networkProtocol . "_Port", (If networkProtocol = "IPX" || networkProtocol = "NetBios" ? 213 : 23),,1)
  260. last%networkProtocol%IP := IniReadCheck(settingsFile, "Network", "Last_" . networkProtocol . "_IP", defaultServer%networkProtocol%IP,,1) ; does not need to be on the ISD
  261. last%networkProtocol%Port := IniReadCheck(settingsFile, "Network", "Last_" . networkProtocol . "_Port", defaultServer%networkProtocol%Port,,1) ; does not need to be on the ISD
  262.  
  263. ; Gosub, QuestionUserTemp
  264. mpMenuStatus := MultiplayerMenu(last%networkProtocol%IP, last%networkProtocol%Port, networkType, maxPlayers, (If networkRequiresSetup = "true" ? 1 : 0)) ; supplying the networkRequiresSetup here tells the MP menu to give the user a choice to setup the network first
  265. If (mpMenuStatus = -1) { ; if user exited menu early
  266. Log("Module - Cancelled MultiPlayer Menu. Exiting module.",2)
  267. ExitModule()
  268. }
  269.  
  270. If networkSession {
  271. Log("Module - Using an " . networkProtocol . " Network for " . dbName,4)
  272. ; Save last used IP and Port for quicker launching next time
  273. IniWrite, %networkPort%, %settingsFile%, Network, Last_%networkProtocol%_Port
  274. If (networkType = "client")
  275. IniWrite, %networkIP%, %settingsFile%, Network, Last_%networkProtocol%_IP
  276.  
  277. networkDirectExecutable := IniReadCheck(settingsFile, dbName, "Network_Direct_Executable",,,1)
  278. maximumPlayers := IniReadCheck(settingsFile, dbName, "Maximum_Players",,,1)
  279.  
  280. netBiosCommand :=
  281. thisLine :=
  282. parsedNetworkExecutable :=
  283. ipxClientCommand := "IPXNET CONNECT " . networkIP . " " . networkPort ; command for a client in an IPX network
  284. ipxServerCommand := "IPXNET STARTSERVER " . networkPort ; command for the server in an IPX network
  285. ipxSessionCommand := "`r`n" . (If networkType = "client" ? ipxClientCommand : ipxServerCommand)
  286.  
  287. If (networkProtocol = "NetBios") {
  288. netbiosFullPath := CheckFile(moduleExtensionsPath . "\novell\netbios.exe", "Could not find the netbios.exe, which is required for NetBios connections. Please download and place this file here: """ . moduleExtensionsPath . "\novell\netbios.exe""")
  289. SplitPath,netbiosFullPath,netbiosExe,netbiosPath
  290. netBiosCommand := "`r`nMount N """ . netbiosPath . """`r`nN:\" . netbiosExe ; Mount netbios.exe to the N drive and run it
  291. }
  292.  
  293. If networkRequiresSetup {
  294. Log("Module - User selected to run this game's Setup mode")
  295. networkExecutable := setupExecutable
  296. } Else
  297. networkExecutable := networkDirectExecutable
  298.  
  299. ; addIPXBlock :=
  300. If (networkProtocol = "IPX" || networkProtocol = "NetBios" || networkExecutable) { ; these all require the autoexec section to be updated to support network play
  301. addIPXBlock := true
  302. If (networkProtocol = "IPX" || networkProtocol = "NetBios") { ; both IPX and Netbios connection types require ipx to be enabled in the conf file so dosbox will mount the IPXNET executables
  303. ; IniRead, currentIPX, %confFile%, ipx, ipx ; for some reason ahk bugs out and returns an errorlevel if I do this iniread and condition and it's unable to write any settings to the conf file with iniwrite commands. Leaving this check disabled for now.
  304. ; If (currentIPX != "true") {
  305. ; Log("Module - IPX is not enabled in this conf file. Enabling it now for this MultiPlayer session: " . confFile)
  306. IniWrite, true, %confFile%, ipx, ipx
  307. ; }
  308. }
  309. }
  310.  
  311. If (networkProtocol = "modem" || networkProtocol = "nullmodem") {
  312. ; Modem settings: http://www.dosbox.com/wiki/Connectivity#Modem_emulation
  313. defaultServerSerialPort := IniReadCheck(settingsFile, "Network", "Default_Server_Serial_Port", 23,,1)
  314. serialRxDelay := IniReadCheck(settingsFile, "Network", "Serial_RxDelay",,,1)
  315. serialTxDelay := IniReadCheck(settingsFile, "Network", "Serial_TxDelay",,,1)
  316. serialInhSocket := IniReadCheck(settingsFile, dbName, "Serial_InhSocket",,,1)
  317. serialComPort := IniReadCheck(settingsFile, dbName, "Com_Port", "com1",,1)
  318.  
  319. If (networkProtocol = "modem") {
  320. If (networkType = "server") {
  321. IniWrite, %networkProtocol% listenport:%networkPort%, %confFile%, serial, serial1 ; MIGHT ONLY WORK ON ENHANCED DOSBOX
  322. } Else If (networkType = "client") {
  323. IniWrite, %networkProtocol% listenport:%networkPort%, %confFile%, serial, serial1
  324. IniWrite, %networkIP%:%networkPort%, %confFile%, serial, phone1
  325. }
  326. } Else If (networkProtocol = "nullmodem") { ; same as directserial
  327. If (networkType = "server") {
  328. nmValue := networkProtocol . " " . networkPort . (If serialRxDelay ? " " . serialRxDelay : "") . (If serialTxDelay ? " " . serialTxDelay : "")
  329. IniWrite, %networkProtocol% port:%networkPort%, %confFile%, serial, serial1
  330. } Else If (networkType = "client") {
  331. IniWrite, %networkProtocol% server:%networkIP% port:%networkPort%, %confFile%, serial, serial1
  332. }
  333. }
  334. }
  335. Log("Module - Starting a " . networkProtocol . " using the IP """ . networkIP . """ and PORT """ . networkPort . """",4)
  336. } Else
  337. Log("Module - User chose Single Player mode for this session",4)
  338. }
  339.  
  340. ; Ultrasound Support
  341. addedGUS :=
  342. If (enableUltrasound = "pro" || enableUltrasound = "standard") {
  343. gusPath := If enableUltrasound = "pro" ? "ULTRAPRO" : "ULTRASND"
  344. IniWrite, true, %confFile%, gus, gus ; enable ultrasound support
  345. IniWrite, U:\%gusPath%, %confFile%, gus, ultradir ; tell dosbox where to find Ultrasound, hardcoded to U:\
  346. addedGUS := true
  347. gusStartTag := "#---------------Ultrasound Start---------------"
  348. gusEndTag := "#---------------Ultrasound End---------------"
  349. Log("Module - Gravis Ultrasound has been enabled.",4)
  350. }
  351.  
  352. ; Restoring any backed up files prior to launch.
  353. If backupFiles {
  354. filesRestored :=
  355. Log("Module - Looking for backup files to restore for this game session",4)
  356. dosboxBackupFolder := emuPath . "\BackupFiles\" . dbName
  357. dosboxRestoreFolder := romPath . "\" . shortName
  358. Loop, Parse, backupFiles, |
  359. {
  360. If InStr(A_LoopField, "..\") {
  361. newRestorePath := AbsoluteFromRelative(dosboxRestoreFolder, A_LoopField)
  362. newBackupPath := AbsoluteFromRelative(dosboxBackupFolder, A_LoopField)
  363. ; msgbox newRestorePath: %newRestorePath%`nnewBackupPath: %newBackupPath%
  364. ; msgbox restore folder: %dosboxRestoreFolder%\%A_LoopField%`nbackup folder: %dosboxBackupFolder%\%A_LoopField%
  365. Continue ; do not support these files yet
  366. }
  367. Log("Module - Restoring """ . dosboxBackupFolder . "\" . A_LoopField . """ to """ . dosboxRestoreFolder . "\" . A_LoopField . """",4)
  368. FileCopy %dosboxBackupFolder%\%A_LoopField%, %dosboxRestoreFolder%\%A_LoopField%, 1 ; only supports files, not folders
  369. filesRestored++
  370. }
  371. Log("Module - Restored " . filesRestored . " backup files for this game session",4)
  372. }
  373.  
  374. ;----------------------------------------------------------------------------
  375. ; Rebuild eXo's conf file to add network block and mount the Ultrasound drive
  376. If (addedGUS || addIPXBlock || setupOnLaunch = "true") {
  377. Log("Module - Rebuilding the conf file.")
  378. rebuiltAutoexec :=
  379. confFileData :=
  380. ; removedGamesFolder :=
  381. replacedWithSetup :=
  382. replacedWithNet :=
  383. FileRead, confFileData, %confFile%
  384. sectionRegEx := "ms)(?<=^\[autoexec\])(?:(?!\r^\[).)*" ; Find from the end of the autoexec section to the next section or the end of file
  385. matchedPos := regexmatch(confFileData, sectionRegEx, sectionText) ; Get the key and the value whilst excluding the comments
  386. rebuiltAutoexec := sectionText ; only want to work with the new var, not the original
  387.  
  388. If (addedGUS && !InStr(sectionRegEx, gusStartTag)){ ; make sure GUS wasn't already added to the autoexec
  389. rebuiltAutoexec := "`r`n" . gusStartTag . "`r`nmount u """ . gusFolder . """`r`n" . gusEndTag . "`r`n" . rebuiltAutoexec ; mount Ultrasound folder to the U drive
  390. Log("Module - Autoexec updated in the conf file with the Ultrasound block.",4)
  391. } Else If addedGUS
  392. Log("Module - Autoexec already contains an Ultrasound block, no need to add it again.",4)
  393.  
  394. If (addIPXBlock || setupOnLaunch = "true") {
  395. parseThisText := rebuiltAutoexec
  396. ; parseThisText := sectionText
  397. rebuiltAutoexec :=
  398. If (gameExecutable = "")
  399. ScriptError("You need to set a Game_Executable for Setup_On_Launch or Networking to work. It is used to find the correct place in your dosbox conf for RocketLauncher to insert the Setup executable ot IPX initialization")
  400. Loop, Parse, parseThisText, `n, `r
  401. { thisLine := A_LoopField
  402. If InStr(thisLine, gameExecutable) {
  403. If (setupOnLaunch = "true") {
  404. Loop, Parse, setupExecutable, | ; allow multiple commands to be sent, when delimited by a |
  405. parsedSetupExecutable .= (If A_Index = 1 ? "" : "`r`n") . A_Loopfield
  406. thisLine := "`r`n" . parsedSetupExecutable
  407. replacedWithSetup := true
  408. Log("Module - Autoexec updated in the conf file with Setup Executable.",4)
  409. } Else If addIPXBlock {
  410. secNStart := "`r`n#---------------Network Start---------------"
  411. secNEnd := "`r`n#---------------Network End----------------`r`n"
  412. Loop, Parse, networkExecutable, | ; allow multiple commands to be sent, when delimited by a |
  413. parsedNetworkExecutable .= (If A_Index = 1 ? "" : "`r`n") . A_Loopfield
  414. thisLine := secNStart . (If networkProtocol = "IPX" || networkProtocol = "NetBios" ? ipxSessionCommand : "") . (If networkProtocol = "NetBios" ? netBiosCommand : "") . (If networkExecutable ? "`r`n" . parsedNetworkExecutable . secNEnd : secNEnd . A_LoopField)
  415. replacedWithNet := true
  416. Log("Module - Autoexec updated in the conf file with network connection block.",4)
  417. }
  418. }
  419. rebuiltAutoexec .= (If A_Index = 1 ? "" : "`r`n") . thisLine
  420. }
  421. If networkExecutable ; if user set a network executable for this game
  422. Log("Module - This game requires a different executable to be ran for Multi-Player games. Setting it to run: """ . networkExecutable . """ instead of """ . gameExecutable . """",4)
  423. }
  424.  
  425. If (setupOnLaunch = "true" && !replacedWithSetup)
  426. ScriptError("Tried searching for """ . gameExecutable . """ but could not locate correct section in """ . confFile . """ to use Setup_On_Launch. Please check your module settings in RocketLauncherUI that you entered the correct Game_Executable and Setup_Executable.",10)
  427. If (networkSession && !replacedWithNet)
  428. ScriptError("Tried searching for """ . gameExecutable . """ but could not locate correct section in """ . confFile . """ to inject network connection parameters. Please check your module settings in RocketLauncherUI that you entered the correct Game_Executable and Network_Executable.",10)
  429.  
  430. StringReplace, finalConfData, confFileData, %sectionText%, %rebuiltAutoexec%
  431. FileDelete, %confFile% ; delete old conf first
  432. FileAppend, %finalConfData%, %confFile% ; writing the new conf
  433. Log("Module - Recreated conf file with a new autoexec section: """ . confFile . """")
  434. }
  435. ;----------------------------------------------------------------------------
  436.  
  437. HideEmuStart()
  438.  
  439. Run("""" . dosPath . "\" . executable . """ -conf " . """" . confFile . """ " . fullscreen . hideConsole . params, baseGamesFolder)
  440.  
  441. WinWait("DOSBox ahk_class SDL_app")
  442. WinWaitActive("DOSBox ahk_class SDL_app")
  443.  
  444. WinGetActiveTitle, dosboxTitle
  445. If InStr(dosboxTitle, "Daum")
  446. Log("Module - This DOSBox is the ykhwong enhanced version")
  447. Else
  448. Log("Module - This DOSBox is the standard non-enhanced version")
  449. Sleep, 700 ; DOSBox gains focus before it goes fullscreen, this prevents HS from flashing back in due to this
  450.  
  451. SendCommand(command, sendCommandDelay)
  452. Sleep, 100 ;To allow the command to go through and resize the window if that's the case (Some commands will make the game change the window resolution on start, eg the cracked King's Quest 1)
  453.  
  454. BezelDraw()
  455. FadeInExit()
  456. HideEmuEnd()
  457. Process("WaitClose", executable)
  458.  
  459. ;Some games create this swap file on C:\ when the cwsdpmi runtime is used so we need to delete it if it exists
  460. IfExist, %gamePath%CWSDPMI.swp
  461. FileDelete, %gamePath%CWSDPMI.swp
  462.  
  463. If customConfCreated {
  464. FileDelete, %confFile%
  465. Log("Module - Deleted temporary conf: " . confFile,4)
  466. }
  467.  
  468. ; Backing up all defined files
  469. If backupFiles {
  470. filesBackedUp :=
  471. Log("Module - Looking for files to backup from this game session",4)
  472. If !FileExist(dosboxBackupFolder)
  473. FileCreateDir, %dosboxBackupFolder%
  474. Loop, Parse, backupFiles, |
  475. {
  476. SplitPath, A_LoopField, dsName, dsDir, dsExtension, dsNameNoExt
  477. Log("Module - Backing up """ . dosboxRestoreFolder . "\" . A_LoopField . """ to """ . dosboxBackupFolder . "\" . A_LoopField . """",4)
  478. If !FileExist(dosboxBackupFolder . "\" . dsDir)
  479. FileCreateDir, %dosboxBackupFolder%\%dsDir% ; make folder first
  480. FileCopy %dosboxRestoreFolder%\%A_LoopField%, %dosboxBackupFolder%\%A_LoopField%, 1 ; only supports files, not folders
  481. If ErrorLevel
  482. Log("Module - Error backing up """ . dosboxRestoreFolder . "\" . A_LoopField . """ to """ . dosboxBackupFolder . "\" . A_LoopField . """",3)
  483. filesBackedUp++
  484. }
  485. Log("Module - Backed up " . filesBackedUp . " files from this game session",4)
  486. }
  487.  
  488. ; Delete shaders if we had the shaders folder was created by the module
  489. If (deleteShadersFolder = "true") {
  490. FileRemoveDir, %shaderFolder%, 1
  491. Log("Module - Deleted shaders folder " . shaderFolder,4)
  492. }
  493.  
  494. ;If forceExtractionToRomPath is true we need to feed 7zCleanUp with the folder directly or the whole Games folder would be deleted
  495. 7zCleanUp(If forceExtractionToRomPath ? 7zExtractPath . "\" . shortName : "")
  496.  
  497. BezelExit()
  498. FadeOutExit()
  499. ExitModule()
  500.  
  501.  
  502. HaltEmu:
  503. If (fullscreen = " -fullscreen")
  504. WinMinimize, DOSBox ahk_class SDL_app
  505. Return
  506. RestoreEmu:
  507. If (fullscreen = " -fullscreen")
  508. WinMenuSelectItem, DOSBox ahk_class SDL_app, , Video, Fullscreen
  509. Return
  510.  
  511. CloseProcess:
  512. FadeOutStart()
  513. WinClose("ahk_class SDL_app")
  514. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement