Advertisement
djvj

Untitled

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