Advertisement
djvj

Untitled

Jan 6th, 2015
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.84 KB | None | 0 0
  1. MEmu = ScummVM
  2. MEmuV = v1.7.0
  3. MURL = http://scummvm.org/
  4. MAuthor = djvj, brolly
  5. MVersion = 2.0.6
  6. MCRC = 8D08D806
  7. iCRC = 3ADCD646
  8. MID = 635038268922749586
  9. MSystem = "ScummVM","Microsoft MS-DOS"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; If your games are compressed archives, set your Rom_Path to the folder with all your games and Rom_Extension to just the archive type.
  13. ; Set Skipchecks to "Rom Extension" for this system If your roms are compressed archives and also turn on 7z support.
  14. ; If your games are already uncompressed into their own folders, set Skipchecks to "Rom Only" so HL knows not to look for rom files.
  15. ;
  16. ; You can set your Save/Load/Menu hotkeys below to access them in game.
  17. ; The hotkeys will be processed by xHotkey, so they can be defined just like you would your Exit_Emulator_Key (like with delays or multiple sets of keys)
  18. ;
  19. ; If you prefer a portable ScummVM, place your scummvm.ini somewhere Else, like in the emulator's folder and set CustomConfig's path to this file. It will work with the ini from there instead of your appdata folder.
  20. ; http://www.hyperspin-fe.com/forum/showpost.php?p=52295&postcount=81
  21. ;
  22. ; You can manually map your database rom names to archive files If you keep your games compressed and have the files named differently from your database by putting a file named ZipMapping.ini in the modules folder (or ZipMapping - SystemName.ini), this file contents should be as follows:
  23. ; [mapping]
  24. ; romName=zipFileName
  25. ;
  26. ; Launch Method 1 - Rom_Path has archived games inside a zip, 7z, rar, etc
  27. ; Set Skipchecks to Rom Extension and enable 7z
  28. ; Launch Method 2 - Rom_Path has each game inside its own folder and uncompressed
  29. ; Set Skipchecks to Rom Only and disable 7z
  30. ; Launch Method 3 - Rom_Path has archived games inside a zip, 7z, rar, etc, all named from the scummvm torrent that does not match the names on your xml
  31. ; Set Skipchecks to Rom Extension, enable 7z, enable Rom Mapping. Make sure a proper mapping ini exists in the appropriate settings Rom Mapping folder and it contains all the correct mapping info.
  32. ;----------------------------------------------------------------------------
  33. StartModule()
  34. BezelGUI()
  35. FadeInStart()
  36.  
  37. settingsFile := modulePath . "\" . (If FileExist(modulePath . "\" . systemName . ".ini") ? systemName : moduleName) . ".ini" ; use a custom systemName ini If it exists
  38. scummDefaultConfigFile := A_AppData . "\ScummVM\scummvm.ini" ; ScummVM's default ini file it creates on first launch
  39. customConfigFile := IniReadCheck(settingsFile, "Settings", "CustomConfig","",,1) ; Set the path to a custom config file and the module will use this instead of the ScummVM's default one
  40. customConfigFile := GetFullName(customConfigFile) ; convert relative path to absolute
  41. configFile := CheckFile(If customConfigFile ? customConfigFile : scummDefaultConfigFile) ; checks If either the default config file or the custom one exists
  42. Fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1)
  43. LaunchMode := IniReadCheck(settingsFile, "Settings|" . romName, "LaunchMode", "Auto",,1)
  44. TargetName := IniReadCheck(settingsFile, romName, "Target", romName,,1)
  45. ForceExtractionToRomPath := IniReadCheck(settingsFile, "Settings" . "|" . romName, "ForceExtractionToRomPath", "false",,1)
  46.  
  47. SaveKey := IniReadCheck(settingsFile, "Settings", "SaveKey","1",,1) ; hotkey to save state
  48. LoadKey := IniReadCheck(settingsFile, "Settings", "LoadKey","2",,1) ; hotkey to load state
  49. MenuKey := IniReadCheck(settingsFile, "Settings", "MenuKey","p",,1) ; hotkey to access the ScummVM menu
  50.  
  51. BezelStart()
  52.  
  53. If 7zEnabled != true
  54. If romExtension in %7zFormats%
  55. ScriptError("Your rom """ . romName . """ is a compressed archive`, but you have 7z support disabled. ScummVM does not support launching compressed roms directly. Enable 7z or extract your rom.",8)
  56.  
  57. ;Find the zip filename by looking it up in the ZipMapping.ini file or ZipMapping - SystemName.ini If one exists
  58. IfExist, % modulePath . "\ZipMapping - " . systemName ".ini"
  59. ZipMappingFile := modulePath . "\ZipMapping - " . systemName ".ini"
  60. Else
  61. ZipMappingFile := modulePath . "\ZipMapping.ini"
  62.  
  63. ZipName := IniReadCheck(ZipMappingFile, "mapping", romname, romname . (If romExtension ? romExtension : ".zip"),,1)
  64.  
  65. If (LaunchMode = "eXoDOS") {
  66. ;Find and set the romPath in case we have several
  67. romPathFound := "false"
  68. If (7zEnabled = "true")
  69. {
  70. Loop, Parse, romPath, |
  71. {
  72. currentPath := A_LoopField
  73. Log("Module - Searching for rom " . ZipName . " in " . currentPath,4)
  74. If FileExist(currentPath . "\" . ZipName)
  75. {
  76. romPath := currentPath
  77. romPathFound := "true"
  78. }
  79. }
  80. If (romPathFound != "true")
  81. ScriptError("Couldn't find rom " . ZipName . " in any of the defined rom paths")
  82. } Else {
  83. Loop, Parse, romPath, |
  84. {
  85. currentPath := A_LoopField
  86. Log("Module - Searching for rom " . romname . " in " . currentPath,4)
  87. If InStr(FileExist(currentPath . "\" . romname), "D")
  88. {
  89. romPath := currentPath
  90. romPathFound := "true"
  91. }
  92. }
  93. If (romPathFound != "true")
  94. ScriptError("Couldn't find rom " . romname . " in any of the defined rom paths")
  95. }
  96.  
  97. If (ForceExtractionToRomPath = "true") {
  98. Log("Module - ForceExtractionToRomPath is set to true, setting 7zExtractPath to " . romPath . ". Careful when using this setting!",4)
  99. 7zExtractPath := romPath
  100. }
  101. }
  102.  
  103. ;Lets split filename and extension
  104. SplitPath, ZipName,,,zipExtension,zipFileName
  105.  
  106. hideEmuObj := Object("ahk_class SDL_app",1) ; Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
  107. ;7z(romPath, romName, romExtension, 7zExtractPath)
  108. 7z(romPath,zipFileName,"." . zipExtension,7zExtractPath,,If LaunchMode = "eXoDOS" ? "false" : "true")
  109.  
  110. ; Send ScummVM hotkeys through xHotkey so they are linked to the labels below
  111. SaveKey := xHotKeyVarEdit(SaveKey,"SaveKey","~","Add")
  112. LoadKey := xHotKeyVarEdit(LoadKey,"LoadKey","~","Add")
  113. MenuKey := xHotKeyVarEdit(MenuKey,"MenuKey","~","Add")
  114. xHotKeywrapper(SaveKey,"ScummvmSave")
  115. xHotKeywrapper(LoadKey,"ScummvmLoad")
  116. xHotKeywrapper(MenuKey,"ScummvmMenu")
  117.  
  118. If (LaunchMode = "ParseIni")
  119. { Log("Module - Launch mode: ParseIni")
  120. ;Try parsing the scummvm config ini file for the path
  121. StringReplace, romNameChanged, TargetName, %A_Space%, _, All ; replace all spaces in the name we lookup in ScummVM's ini because ScummVM does not support spaces in the section name
  122. romNameChanged := RegExReplace(romNameChanged, "\(|\)", "_") ; replaces all parenthesis with underscores
  123. If (TargetName != romNameChanged)
  124. Log("Module - Removed all unsupported characters from """ . TargetName . """ and using this to search for a section in ScummVM's ini: """ . romNameChanged . """")
  125.  
  126. scummRomPath := IniReadCheck(configFile, romNameChanged, "path",,,1) ; Grab the path in ScummVM's config
  127. ; msgbox % scummRomPath
  128. If (SubStr(scummRomPath, 0, 1) = "\") ; scummvm doesn't like sending it paths with a \ as the last character. If it exists, remove it.
  129. StringTrimRight, scummRomPath, scummRomPath, 1
  130. ; msgbox % scummRomPath
  131. If !scummRomPath {
  132. Log("Module - Could not locate a path in ScummVM's ini for section """ . romNameChanged . """. Checking If a path exists for the dbName instead: """ . dbName . """",2)
  133. scummRomPath := IniReadCheck(configFile, dbName, "path",,,1) ; If the romName, after removing all unsupporting characters to meet ScummVM's section name requirements, could not be found, try looking up the dbName instead
  134. }
  135. If !FileExist(scummRomPath) ; If user does not have a path set to this game in the ScummVM ini or the path does not exist that is set, attempt to send a proper one in CLI
  136. { Log("Module - " . (If !scummRomPath ? "No path defined in ScummVM's ini" : ("The path defined in ScummVM's ini does not exist : " . scummRomPath)) . ". Attempting to find a correct path to your rom and sending that to ScummVM.",2)
  137. If (InStr(romPath, romName) && FileExist(romPath)) { ; If the romName is already in the path of the romPath and that path exists, attempt to set that as the path we send to ScummVM
  138. scummRomPath := romPath
  139. Log("Module - Changing " . romName . " path to: " . scummRomPath,2)
  140. } Else If (FileExist(romPath . "\" . romName)) { ; If the romPath doesn't have the romName in the path, let's add it to check If that exists and send that.
  141. scummRomPath := romPath . "\" . romName
  142. Log("Module - Changing " . romName . " path to: " . scummRomPath,2)
  143. } Else
  144. ScriptError("The path to """ . romName . """ was not found. Please set it correctly by manually launching ScummVM and editing this rom's path to where it can be found.")
  145. }
  146. } Else If (LaunchMode = "eXoDOS") {
  147. Log("Module - Launch mode: eXoDOS")
  148. ;On eXoDOS sets game MUST be at this folder
  149. scummRomPath := CheckFile(romPath . "\" . romName)
  150. romNameChanged := TargetName
  151. } Else {
  152. Log("Module - Launch mode: Standard")
  153. ;Auto mode, scummRomPath will be empty here as everything will be read from the scummvm config ini file
  154. romNameChanged := """" . TargetName . """"
  155. }
  156.  
  157. options := " --no-console"
  158. configFile := If customConfigFile ? " -c""" . configFile . """" : "" ; If user set a path to a custom config file
  159. fullscreen := If Fullscreen = "true" ? " -f" : " -F"
  160. scummRomPath := If scummRomPath ? " -p""" . scummRomPath . """" : ""
  161.  
  162. HideEmuStart()
  163. Run(executable . options . fullscreen . configFile . scummRomPath . " " . romNameChanged, emuPath)
  164.  
  165. WinWait("ahk_class SDL_app")
  166. WinWaitActive("ahk_class SDL_app")
  167.  
  168. Sleep, 700 ; Necessary otherwise the HyperSpin window flashes back into view
  169.  
  170. BezelDraw()
  171. HideEmuEnd()
  172. FadeInExit()
  173. Process("WaitClose", executable)
  174. 7zCleanUp(If LaunchMode = "eXoDOS" ? 7zExtractPath . "\" . romName : "")
  175. BezelExit()
  176. FadeOutExit()
  177. ExitModule()
  178.  
  179.  
  180. ScummvmSave:
  181. Send, !1
  182. Return
  183. ScummvmLoad:
  184. Send, ^1
  185. Return
  186. ScummvmMenu:
  187. Send, ^{F5}
  188. Return
  189.  
  190. CloseProcess:
  191. FadeOutStart()
  192. WinClose("ahk_class SDL_app")
  193. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement