Advertisement
djvj

ssf

Jan 20th, 2016
442
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.05 KB | None | 0 0
  1. MEmu = SSF
  2. MEmuV = v0.12 beta R4
  3. MURL = http://www.geocities.jp/mj3kj8o5/ssf/index.html
  4. MAuthor = djvj,brolly
  5. MVersion = 2.1.4
  6. MCRC = EB14E0C5
  7. iCRC = 918A4E4C
  8. MID = 635038268924991452
  9. MSystem = "Sega Saturn","Sega ST-V"
  10. ;------------------------------------------------------------------------
  11. ; Notes:
  12. ; Sega Saturn:
  13. ; This only works with DTLite, not DTPro
  14. ; Make sure your Virtual Drive Path in RocketLauncherUI is correct
  15. ; romExtension should be ccd|mds|cue|iso|cdi|nrg
  16. ; You MUST set the path to the 3 different region BIOS files in RocketLauncherUI module's settings.
  17. ; If you prefer a region-free bios, extract this bios and set all 3 bios paths to this one file: http://theisozone.com/downloads/other-consoles/sega-saturn/sega-saturn-region-free-bios/
  18. ; Make sure you have your CDDrive set to whatever number you use for your games. 0 may be your hardware drive, while 1 may be your virtual drive (depending on how many you have). If you get a black screen, try different numbers starting from 0.
  19. ; If you keep getting the CD Player BIOS screen, you have the CDDrive variable set wrong below
  20. ; If you keep getting the CD Player screen with the message "Game disc unsuitable for this system", you have the incorrect bios set for the region game you are playing and or region is set wrong in the emu options. Or you can just turn off the BIOS below :)
  21. ; If your game's region is (USA), you must use a USA bios and set SSF Area Code to "America, Canada Brazil". For (Japan) games, bios must be a Japan one and SSF Area Code set to Japan. Use the same logic for European games. You will only see a black screen if wrong.
  22. ; SSF will use your desktop res as the emu's res if Stretch and EnforceAspectRatioFullscreen are both true when in fullscreen mode. If you turn Stretch off, it forces 1024x768 in fullscreen mode if your GPU supports pixel shader 3.0, otherwise it forces 640x480 if it does not.
  23. ; If you are getting clipping, set the vSync variable to true below
  24. ; For faster MultiGame switching, keep the BIOS off, otherwise you have to "play" the disc each time you switch discs
  25. ; Module will attempt to auto-detect the region for your game by using the region tags in parenthesis on your rom file and set SSF to use the appropriate region settings that match.
  26. ;
  27. ; Shining Force III - Scenario 2 & 3 (Japan) (Translated En) games crash at chapter 4 and when you use Marki Proserpina spell or using the Abyss Wand. Fix may be to use a different bios if this occurs, but this is untested. Read more about it here: http://forums.shiningforcecentral.com/viewtopic.php?f=34&t=14858&start=80
  28. ;
  29. ; Custom Config Files:
  30. ; You can use custom per game ini files. Just put them in a Configurations folder inside the emulator folder and name them after the rom name. Make sure you also put a file named Default.ini file in there with your default
  31. ; settings so the module can revert back to use those.
  32. ;
  33. ; Data Cartridges:
  34. ; These 2 games used a hardware cart in order to play the games, so the module will mount them if found within the same folder as the cd image and named the same as the xml game name with a "rom" extension.
  35. ; Ultraman - Hikari no Kyojin Densetsu (Japan) and King of Fighters '95, The (Europe)
  36. ; So something like this must exist: "King of Fighters '95, The (Europe).rom"
  37.  
  38. ; Sega ST-V:
  39. ; romExtension should be zip
  40. ; Extract the stv110.bin bios into the BIOS folder. Run SSF.exe and goto Option->Option and point ST-V BIOS to this file.
  41. ; Set fullscreen mode via the variable below
  42. ; If you are getting clipping, set the vSync variable to true below
  43. ;
  44. ; If it seems like it's taking a long time to load, it probably is. You are going to stare at the black screen while SSF is decoding the roms.
  45. ;------------------------------------------------------------------------
  46. StartModule()
  47. BezelGUI()
  48. FadeInStart()
  49.  
  50. settingsFile := modulePath . "\" . moduleName . ".ini"
  51. Fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1)
  52. UseBIOS := IniReadCheck(settingsFile, "Settings", "UseBIOS","false",,1)
  53. BilinearFiltering := IniReadCheck(settingsFile, "Settings", "BilinearFiltering","true",,1)
  54. WideScreen := IniReadCheck(settingsFile, "Settings", "WideScreen","false",,1)
  55. Stretch := IniReadCheck(settingsFile, "Settings", "Stretch","true",,1) ; default true because SSF will use your desktop res in fullscreen mode as long as EnforceAspectRatioFullscreen is also true
  56. AutoFieldSkip := IniReadCheck(settingsFile, "Settings", "AutoFieldSkip","true",,1)
  57. EnforceAspectRatioWindow := IniReadCheck(settingsFile, "Settings", "EnforceAspectRatioWindow","true",,1) ; enforces aspect even when stretch is true
  58. EnforceAspectRatioFullscreen := IniReadCheck(settingsFile, "Settings", "EnforceAspectRatioFullscreen","true",,1) ; enforces aspect even when stretch is true
  59. FixedWindowResolution := IniReadCheck(settingsFile, "Settings", "FixedWindowResolution","true",,1)
  60. FixedFullscreenResolution := IniReadCheck(settingsFile, "Settings", "FixedFullscreenResolution","false",,1)
  61. VSynchWaitWindow := IniReadCheck(settingsFile, "Settings", "VSynchWaitWindow","true",,1)
  62. VSynchWaitFullscreen := IniReadCheck(settingsFile, "Settings", "VSynchWaitFullscreen","true",,1)
  63. CDDrive := IniReadCheck(settingsFile, "Settings", "CDDrive","1",,1)
  64. defaultRegion := IniReadCheck(settingsFile, "Settings", "DefaultRegion","1",,1)
  65. WindowSize := IniReadCheck(settingsFile, "Settings", "WindowSize","2",,1)
  66. Scanlines := IniReadCheck(settingsFile, "Settings|" . romName, "Scanlines","false",,1)
  67. ScanlineRatio := IniReadCheck(settingsFile, "Settings|" . romName, "ScanlineRatio","70",,1)
  68. usBios := IniReadCheck(settingsFile, "Settings", "USBios","",,1)
  69. euBios := IniReadCheck(settingsFile, "Settings", "EUBios","",,1)
  70. jpBios := IniReadCheck(settingsFile, "Settings", "JPBios","",,1)
  71. worldBios := IniReadCheck(settingsFile, "Settings", "WorldBios","",,1)
  72. SH2enabled := IniReadCheck(settingsFile, romName, "SH2enabled","false",,1)
  73. deleteCachedSettings := IniReadCheck(settingsFile, "Settings|" . romName, "DeleteCachedSettings","false",,1)
  74. legacyMode := IniReadCheck(settingsFile, "Settings|" . romName, "LegacyMode","false",,1)
  75. bezelTopOffset := IniReadCheck(settingsFile, "Settings|" . romName, "bezelTopOffset","0",,1)
  76. bezelBottomOffset := IniReadCheck(settingsFile, "Settings|" . romName, "bezelBottomOffset","24",,1)
  77. bezelLeftOffset := IniReadCheck(settingsFile, "Settings|" . romName, "bezelLeftOffset","0",,1)
  78. bezelRightOffset := IniReadCheck(settingsFile, "Settings|" . romName, "bezelRightOffset","0",,1)
  79. forceRegion := IniReadCheck(settingsFile, romName, "ForceRegion","",,1)
  80. busWait := IniReadCheck(settingsFile, romName, "BusWait","false",,1)
  81. usBios := GetFullName(usBios) ; convert relative to absolute path
  82. euBios := GetFullName(euBios)
  83. jpBios := GetFullName(jpBios)
  84. worldBios := GetFullName(worldBios)
  85.  
  86. BezelStart("fixResMode")
  87. hideEmuObj := Object("Decoding ahk_class #32770",0,"Select ROM file ahk_class #32770",0,"SSF",1) ; Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
  88. 7z(romPath, romName, romExtension, sevenZExtractPath)
  89.  
  90. If InStr(systemName, "Saturn")
  91. If !RegExMatch(romExtension,"i)|\.ccd|\.mds|\.cue|\.iso|\.cdi|\.nrg")
  92. ScriptError("For Sega Saturn, SSF only supports extensions ""mds|cue|iso|cdi|nrg"" and you are trying to use """ . romExtension . """")
  93.  
  94. specialcfg := emuPath . "\Configurations\" . romName . ".ini"
  95. defaultcfg := emuPath . "\Configurations\Default.ini"
  96. If FileExist(specialcfg)
  97. Filecopy, %specialcfg%, %emuPath%\SSF.ini, 1
  98. Else If FileExist(defaultcfg)
  99. Filecopy, %specialcfg%, %emuPath%\SSF.ini, 1
  100.  
  101. SSFINI := CheckFile(emuPath . "\SSF.ini")
  102. mySW := A_ScreenWidth
  103. mySH := A_ScreenHeight
  104.  
  105. ; Now let's update all our keys if they differ in the ini
  106. Fullscreen := If Fullscreen = "true" ? "1" : "0"
  107. UseBIOS := If UseBIOS = "true" ? "0" : "1"
  108. BilinearFiltering := If BilinearFiltering = "true" ? "1" : "0"
  109. WideScreen := If WideScreen = "true" ? "1" : "0"
  110. Stretch := If Stretch = "true" ? "0" : "1" ; this setting uses 0 for stretch and 1 for not
  111. AutoFieldSkip := If AutoFieldSkip = "true" ? "1" : "0"
  112. EnforceAspectRatioWindow := If EnforceAspectRatioWindow = "true" ? "1" : "0"
  113. EnforceAspectRatioFullscreen := If EnforceAspectRatioFullscreen = "true" ? "1" : "0"
  114. FixedWindowResolution := If FixedWindowResolution = "true" ? "1" : "0"
  115. FixedFullscreenResolution := If FixedFullscreenResolution = "true" ? "1" : "0"
  116. VSynchWaitWindow := If VSynchWaitWindow = "true" ? "1" : "0"
  117. VSynchWaitFullscreen := If VSynchWaitFullscreen = "true" ? "1" : "0"
  118. Scanlines := If Scanlines = "true" ? "1" : "0"
  119. SH2enabled := If SH2enabled = "true" ? "1" : "0"
  120. busWait := If busWait = "true" ? "1" : "0"
  121.  
  122. If InStr(systemName, "Saturn")
  123. {
  124. regionName := romName
  125. If (forceRegion)
  126. regionName := If forceRegion = "1" ? "(USA)" : (If forceRegion = "2" ? "(Japan)" : (If forceRegion = "3" ? "(Europe)" : "(World)")) ; translating for easier use later
  127.  
  128. If RegExMatch(regionName, "\(U\)|\(USA\)|\(Braz")
  129. { Log("Module - This is an American rom. Setting SSF's settings to this region.")
  130. Areacode := "4" ; 1 = Japan, 2 = Taiwan/Korea/Philippines. 4 = America/Canada/Brazil, c = Europe/Australia/South Africa
  131. SaturnBIOS := usBios
  132. } Else If RegExMatch(regionName, "JP|\(J\)|\(Jap")
  133. { Log("Module - This is a Japanese rom. Setting SSF's settings to this region.")
  134. Areacode := "1"
  135. SaturnBIOS := jpBios
  136. } Else If RegExMatch(regionName, "\(Eu\)|\(Eur|\(German")
  137. { Log("Module - This is a European rom. Setting SSF's settings to this region.")
  138. Areacode := "c"
  139. SaturnBIOS := euBios
  140. } Else If RegExMatch(regionName, "\(Kore")
  141. { Log("Module - This is a Korean rom. Setting SSF's settings to this region.")
  142. Areacode := "2"
  143. SaturnBIOS := jpBios ; don't see a bios for this region, assuming it uses japanese one
  144. } Else If RegExMatch(regionName, "\(World")
  145. { Log("Module - This is a rom without region. Setting SSF's settings to this region.")
  146. Areacode := "4"
  147. SaturnBIOS := worldBios
  148. } Else
  149. { Log("Module - This rom has an UNKNOWN region. Reverting to use your default region. If you get a black screen, please rename your rom to add a proper (Region) tag.",2)
  150. Areacode := If defaultRegion = "1" ? "4" : If defaultRegion = "2" ? "1" : "c"
  151. SaturnBIOS := If defaultRegion = "1" ? usBios : If defaultRegion = "2" ? jpBios : euBios
  152. }
  153. CheckFile(SaturnBIOS)
  154.  
  155. DataCartridge := romPath . "\" . romName . ".rom"
  156. If FileExist(DataCartridge) { ; Only 2 known games need this, Ultraman - Hikari no Kyojin Densetsu (Japan) and King of Fighters '95, The (Europe).
  157. Log("Module - This game requires a data cart in order to play. Trying to mount the cart: """ . DataCartridge . """")
  158. If !FileExist(DataCartridge)
  159. ScriptError("Could not locate the Data Cart for this game. Please make sure one exists inside the archive of this game or in the folder this game resides and it is called: """ . romName . ".rom""")
  160. CartridgeID := "21"
  161. DataCartridgeEnable := "1"
  162. } Else { ; all other games
  163. Log("Module - This game does not require a data cart in order to play.")
  164. CartridgeID := "5c"
  165. DataCartridgeEnable := "0"
  166. DataCartridge := ""
  167. }
  168. }
  169.  
  170. If (legacyMode = "false")
  171. {
  172. ; Compare existing settings and if different then desired, write them to the SSF.ini
  173. ; Note: On older emulator versions NoBIOS is under Program3 instead of Program4 so we set it on both
  174. IniWrite("""" . Fullscreen . """", SSFINI, "Screen", "FullSize", 1)
  175. IniWrite("""" . BilinearFiltering . """", SSFINI, "Screen", "BilinearFiltering", 1)
  176. IniWrite("""" . WideScreen . """", SSFINI, "Screen", "WideScreen", 1)
  177. IniWrite("""" . Stretch . """", SSFINI, "Screen", "StretchScreen", 1)
  178. IniWrite("""" . AutoFieldSkip . """", SSFINI, "Screen", "AutoFieldSkip", 1)
  179. IniWrite("""" . EnforceAspectRatioWindow . """", SSFINI, "Screen", "EnforceAspectRatioWindow", 1)
  180. IniWrite("""" . EnforceAspectRatioFullscreen . """", SSFINI, "Screen", "EnforceAspectRatioFullscreen", 1)
  181. IniWrite("""" . FixedWindowResolution . """", SSFINI, "Screen", "FixedWindowResolution", 1)
  182. IniWrite("""" . FixedFullscreenResolution . """", SSFINI, "Screen", "FixedFullscreenResolution", 1)
  183. IniWrite("""" . VSynchWaitWindow . """", SSFINI, "Screen", "VSynchWaitWindow", 1)
  184. IniWrite("""" . VSynchWaitFullscreen . """", SSFINI, "Screen", "VSynchWaitFullscreen", 1)
  185. IniWrite("""" . Scanlines . """", SSFINI, "Screen", "Scanline", 1)
  186. IniWrite("""" . ScanlineRatio . """", SSFINI, "Screen", "ScanlineRatio", 1)
  187. IniWrite("""" . SaturnBIOS . """", SSFINI, "Screen", "SaturnBIOS", 1)
  188. IniWrite("""" . CDDrive . """", SSFINI, "Peripheral", "CDDrive", 1)
  189. IniWrite("""" . Areacode . """", SSFINI, "Peripheral", "Areacode", 1)
  190. IniWrite("""" . CartridgeID . """", SSFINI, "Peripheral", "CartridgeID", 1)
  191. IniWrite("""" . DataCartridgeEnable . """", SSFINI, "Peripheral", "DataCartridgeEnable", 1)
  192. IniWrite("""" . SH2enabled . """", SSFINI, "Program3", "SH2Cache", 1)
  193. IniWrite("""" . 0 . """", SSFINI, "Program3", "EnableInstructionCache", 1)
  194. IniWrite("""" . busWait . """", SSFINI, "Program3", "SCUDMADelayInterrupt", 1)
  195. IniWrite("""" . busWait . """", SSFINI, "Program3", "busWait", 1)
  196. IniWrite("""" . UseBIOS . """", SSFINI, "Program3", "NoBIOS", 1)
  197. IniWrite("""" . ShowBIOS . """", SSFINI, "Program4", "NoBIOS", 1)
  198. IniWrite("""" . Fullscreen . """", SSFINI, "Other", "ScreenMode", 1)
  199. IniWrite("""" . WindowSize . """", SSFINI, "Other", "WindowSize", 1)
  200. }
  201.  
  202. If InStr(systemName, "Saturn") {
  203. ;Delete cached settings if needed
  204. If (deleteCachedSettings = "true")
  205. {
  206. If (romExtension = ".iso" || romExtension = ".bin")
  207. {
  208. imagetoCheck := romPath . "\" . romName . romExtension
  209. }
  210. Else If (romExtension = ".mds")
  211. {
  212. imagetoCheck := romPath . "\" . romName . ".mdf"
  213. }
  214. Else If (romExtension = ".ccd")
  215. {
  216. imagetoCheck := romPath . "\" . romName . ".img"
  217. }
  218. Else If (romExtension = ".cue") {
  219. datatrack := RL_listCUEFiles(romPath . "\" . romName . romExtension,1)
  220. imagetoCheck := romPath . "\" . datatrack
  221. }
  222. If (imagetoCheck) {
  223. gameID := RL_readFileData(imagetoCheck,48,10,"UTF8")
  224. gameCode := RL_readFileData(imagetoCheck,112,16,"UTF8")
  225. gameID := gameID ;To trim leading spaces
  226. gameCode := gameCode
  227. cachedSettings := emuPath . "\Setting\Saturn\" . gameID . "_" . gameCode . ".ini"
  228. Log("Deleting cached settings file at '" . cachedSettings . "'")
  229. If FileExist(cachedSettings)
  230. FileDelete, %cachedSettings%
  231. }
  232. }
  233.  
  234. ;Setup Virtual Drive
  235. If (vdEnabled = "false")
  236. ScriptError("Virtual Drive must be enabled to use this SSF module")
  237. usedVD := 1
  238. VirtualDrive("mount",romPath . "\" . romName . romExtension)
  239. }
  240.  
  241. HideEmuStart() ; This fully ensures windows are completely hidden even faster than winwait
  242.  
  243. ; Run(executable,emuPath,(If Fullscreen = 1 ? ("Hide" ): ("")), ssfPID) ; Worked in R3, not in R4
  244. Run(executable,emuPath,, ssfPID)
  245.  
  246. If (systemName = "Sega ST-V")
  247. { Send, {SHIFTDOWN} ; this tells SSF we want to boot in ST-V mode
  248. WinWait("Select ROM file ahk_class #32770",,8) ; times out after 8 Seconds
  249. If ErrorLevel
  250. { Send, {SHIFTUP}
  251. WinClose, SSF
  252. ScriptError("Module timed out waiting for Select ROM file window. This probably means you did not set your ST-V bios or have an invalid ST-V bios file.")
  253. }
  254. If !WinActive("Select ROM file ahk_class #32770")
  255. WinActivate, Select ROM file
  256. WinWaitActive("Select ROM file ahk_class #32770")
  257. Send, {SHIFTUP}
  258. OpenROM("Select ROM file ahk_class #32770", romPath . "\" . romName . romExtension)
  259. WinWait("Decoding ahk_class #32770")
  260. }
  261.  
  262. WinWait("SSF")
  263. WinWaitActive("SSF")
  264.  
  265. If (bezelEnabled = "true")
  266. { timeout := A_TickCount
  267. Loop
  268. { Sleep, 20
  269. WinGetPos, , , , H, SSF
  270. If (H > 400)
  271. Break
  272. If (timeout < A_TickCount - 5000)
  273. Break
  274. }
  275. BezelDraw()
  276. } Else
  277. Sleep, 1000 ; SSF flashes in real fast before going fullscreen if this is not here
  278.  
  279. HideEmuEnd()
  280. FadeInExit()
  281.  
  282. ; WinMove,SSF,,0,0 ; uncomment me if you turned off fullscreen mode and cannot see the emu, but hear it in the background
  283.  
  284. Process("WaitClose", executable)
  285.  
  286. If usedVD
  287. VirtualDrive("unmount")
  288.  
  289. 7zCleanUp()
  290. BezelExit()
  291. FadeOutExit()
  292. ExitModule()
  293.  
  294.  
  295. HaltEmu:
  296. disableActivateBlackScreen := "true"
  297. If (Fullscreen = 1) ; only have to take the emu out of fullscreen we are using it
  298. { ; SSF cannot swap discs in fullscreen mode, so we have to go windowed first, swap, and restore fullscreen
  299. WinGet, ssfPID, ID, A
  300. WinGetPos,,,ssfW,ssfH,ahk_id %ssfPID%
  301. SetKeyDelay(,10) ; change only pressDuration
  302. Send, !{Enter}
  303. WinSet, Transparent, 0, ahk_id %ssfPID%
  304. If (mySW != ssfW || mySH != ssfH) { ; if our screen not the same size as SSF uses for it's fullscreen, we can detect when it changes
  305. While % ssfH = ssfHn
  306. { WinGetPos,,,,ssfHn,ahk_id %ssfPID%
  307. Sleep, 100
  308. }
  309. } Else ; if our screen is the same size as SSF uses for it's fullscreen, use a sleep instead
  310. Sleep, 3000 ; increase me if MG GUI is showing tiny instead of the full screen size
  311. tempgui()
  312. }
  313. Return
  314.  
  315. MultiGame:
  316. WinMenuSelectItem,ahk_id %ssfID%,,Hardware,CD Open
  317. VirtualDrive("unmount")
  318. Sleep, 200 ; just in case script moves too fast for DT
  319. VirtualDrive("mount",selectedRom)
  320. WinMenuSelectItem,ahk_id %ssfID%,,Hardware,CD Close
  321. If (Fullscreen = 1)
  322. {
  323. Loop { ; looping until SSF is done loading the new disc
  324. Sleep, 200
  325. WinGetTitle, winTitle, ahk_id %ssfID%
  326. StringSplit, T, winTitle, %A_Space%:
  327. ; ToolTip, %A_Index%`nT10=%T10%,0,0
  328. If !oldT10 ; get the current T10 as soon as it exists and store it
  329. oldT10:=T10
  330. If (T10 > oldT10) ; If T10 starts incrementing, we know SSF has a game loaded and can continue the script
  331. Break
  332. }
  333. WinActivate, ahk_id %ssfID%
  334. SetKeyDelay(,10) ; change only pressDuration
  335. Send, !{Enter}
  336. Sleep, 500
  337. Gui, 69: Destroy
  338. WinSet, Transparent, 255, ahk_id %ssfID%
  339. WinSet, Transparent, Off, ahk_id %ssfID%
  340. }
  341. Return
  342.  
  343. RestoreEmu:
  344. WinActivate, ahk_id %ssfID%
  345. Sleep, 500
  346. SetKeyDelay(,100) ; change only pressDuration
  347. Send, !{Enter}
  348. Return
  349.  
  350. BezelLabel:
  351. disableHideToggleMenuScreen := "true"
  352. Return
  353.  
  354. tempgui(){
  355. Gui, 69:Color, 000000
  356. Gui, 69:-Caption +ToolWindow
  357. Gui, 69:Show, x0 y0 W%A_ScreenWidth% H%A_ScreenHeight%, BlackScreen
  358. }
  359.  
  360. CloseProcess:
  361. FadeOutStart()
  362. WinClose("SSF")
  363. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement