Advertisement
djvj

djvj dc multi

Jan 31st, 2012
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;----------------------------------------------------------------------------
  2. ; Sega Dreamcast
  3. ; Makaron T12-5, NullDC v1.0.4 r135, Demul v0.5.6
  4. ; by djvj/brolly
  5. ; 1.2
  6. ;
  7. ; Notes:
  8. ; ** Makaron **
  9. ; Extract all your DC bios bins into the ROM subdir of your emu
  10. ; Open the Makaron.ini and set your resolution and remove the # in front of the lines you want enabled, including fullscreen.
  11. ; This script supports the following DC images: GDI, CDI
  12. ; vJoy is required for joystick input for Makaron DC games: http://headsoft.com.au/index.php?category=vjoy
  13. ;
  14. ; ** Demul **
  15. ; This script supports the following DC images: GDI, CDI, CHD, MDS, CCD, NRG, CUE
  16. ; Place your dc.zip bios in the roms subdir of your emu
  17. ; Run demul manually and goto Config->Plugins->GD-ROM Plugin and set it to gdrImage
  18. ; Set your Video Plugin to gpuOglv3
  19. ; On first run of a game, demul will ask you to setup all your plugin choices if you haven't already.
  20. ;
  21. ; If you want to convert your roms from gdi to chd, see here: http://www.emutalk.net/showthread.php?t=51502
  22. ; FileDelete(s) are in the script because sometimes demul will corrupt the ini and make it crash. The script recreates a clean ini for you.
  23. ;
  24. ; Setup the user settings below to your liking
  25. ;
  26. ; For additional setup steps prior to running, see this link: http://www.hyperspin-fe.com/forum/showpost.php?p=99852&postcount=138
  27.  
  28. ; ToDo:
  29. ; brolly:  and some deal with some of the ini keys for makaron like keyboard
  30. ;----------------------------------------------------------------------------
  31.  
  32. settingsFile := checkFile(A_WorkingDir . "\Modules\" . systemName . "\Settings.ini")
  33.  
  34. IniRead, pathToNullDC, %settingsFile%, Settings, PathToNullDC
  35. IniRead, pathToMakaron, %settingsFile%, Settings, PathToMakaron
  36. IniRead, pathToDemul, %settingsFile%, Settings, PathToDemul
  37. IniRead, NullDCExe, %settingsFile%, Settings, NullDCExe
  38. IniRead, MakaronExe, %settingsFile%, Settings, MakaronExe
  39. IniRead, DemulExe, %settingsFile%, Settings, DemulExe
  40. IniRead, fullscreen, %settingsFile%, Settings, Fullscreen
  41. IniRead, useVJoy, %settingsFile%, Settings, useVJoy
  42.  
  43. IniRead, emulator, %settingsFile%, %romName%, Emulator
  44. IniRead, winCE, %settingsFile%, %romName%, WinCE
  45. IniRead, cable, %settingsFile%, %romName%, Cable
  46. IniRead, keyboard, %settingsFile%, %romName%, Keyboard
  47.  
  48. If ( emulator = "Demul" ) {
  49.         IniRead, useGlobalShaderEffects, %settingsFile%, Demul, useGlobalShaderEffects
  50.         IniRead, shaderMode, %settingsFile%, Demul, shaderMode
  51.         IniRead, shaderPath, %settingsFile%, Demul, shaderPath
  52.         IniRead, shaderName, %settingsFile%, Demul, shaderName
  53.     }
  54.  
  55. If  ( useVJoy = "true" ) {
  56.         IniRead, vJoyPath, %settingsFile%, Settings, vJoyPath
  57.         IniRead, vJoyExe, %settingsFile%, Settings, vJoyExe
  58.         IniRead, vJoyIni, %settingsFile%, Settings, vJoyIni
  59.         checkFile(vJoyIni)
  60.     }
  61.  
  62. If ( WinCE = "true" && emulator != "Makaron" )
  63.     ScriptError("You have WinCE set but Makaron is not your emulator. WinCE games only work on Makaron")
  64.  
  65. FadeInStart()
  66.  
  67. 7z(romPath, romName, romExtension, 7zExtractDir)
  68.  
  69. If ( emulator = "Makaron" ) {
  70.         CheckForSpaces(romName)
  71.  
  72.         makIni := checkFile(pathToMakaron . "Makaron.ini")
  73.         IniRead, MMU, %makIni%, SH4, MMU
  74.         IniRead, makFS, %makIni%, Settings, fullscreen
  75.         IniRead, currentCable, %makIni%, Settings, cable
  76.  
  77.          ; Running VJoy & checking to make sure it actually ran
  78.         If ( useVJoy = "true" ) {
  79.                 Run, %vJoyExe% -file "%vJoyIni%", %vJoyPath%
  80.                 CheckForVJoy(ByRef vJoyExe)
  81.             }
  82.  
  83.          ; Turning MMU on because WinCE games require this
  84.         If ( MMU != 1 $$ winCE = "true" )
  85.             IniWrite, 1, %makIni%, SH4, MMU
  86.  
  87.          ; Changing cable if it doesn't match current setting
  88.         If ( currentCable != cable )
  89.             IniWrite, %cable%, %makIni%, Settings, cable
  90.  
  91.          ; Setting fullscreen on or off
  92.         If ( makFS != 1 && Fullscreen = "true" )
  93.             IniWrite, 1, %makIni%, Settings, fullscreen
  94.         Else If ( makFS = 1 && Fullscreen != "true" )
  95.             IniWrite, 0, %makIni%, Settings, fullscreen
  96.  
  97.         Run, %MakaronExe% "%romPath%%romName%%romExtension%", %pathToMakaron%
  98.  
  99.         Sleep, 4000 ; adjust to your liking for how long you want to see the black screen
  100.  
  101.         FadeInExit()
  102.  
  103.         Process, WaitClose, %MakaronExe%
  104.  
  105. } Else If ( emulator = "Demul" ) {
  106.         If ( romExtension = ".cdi" || romExtension = ".mds" || romExtension = ".ccd" || romExtension = ".nrg" || romExtension = ".gdi" || romExtension = ".cue" )
  107.         {
  108.             FileDelete, %pathToDemul%gdrImage.ini
  109.             Sleep, 500
  110.             IniWrite, gdrImage.dll, %pathToDemul%Demul.ini, plugins, gdr
  111.             IniWrite, false, %pathToDemul%gdrImage.ini, Main, openDialog
  112.             IniWrite, %romPath%%romName%%romExtension%, %pathToDemul%gdrImage.ini, Main, imagefilename
  113.         }
  114.         Else If ( romExtension = ".chd" )
  115.         {
  116.             FileDelete, %pathToDemul%gdrCHD.ini
  117.             Sleep, 500
  118.             IniWrite, false, %pathToDemul%gdrCHD.ini, Main, openDialog
  119.             IniWrite, gdrCHD.dll, %pathToDemul%Demul.ini, plugins, gdr
  120.             IniWrite, %romPath%%romName%%romExtension%, %pathToDemul%gdrCHD.ini, Main, imagefilename
  121.         }
  122.  
  123.          ; Shader Effects
  124.         IniRead, currentShaderValue, %pathToDemul%gpuOglv3.ini, shader, effects
  125.         If ( useGlobalShaderEffects = "true" ){
  126.             If ( currentShaderValue = "false" ){
  127.                 IniWrite, true, %pathToDemul%gpuOglv3.ini, shader, effects
  128.             }
  129.             IniWrite, %shaderMode%, %pathToDemul%gpuOglv3.ini, shader, mode
  130.             IniWrite, %shaderPath%, %pathToDemul%gpuOglv3.ini, shader, path
  131.             IniWrite, %shaderName%, %pathToDemul%gpuOglv3.ini, shader, name
  132.         }
  133.         Else If ( useGlobalShaderEffects = "false" and currentShaderValue = "true" ){
  134.             IniWrite, false, %pathToDemul%gpuOglv3.ini, shader, effects
  135.         }
  136.  
  137.         Sleep, 250
  138.         Run, %executable% -run=dc, %pathToDemul%
  139.         Sleep, 4000 ; adjust to your liking for how long you want to see the black screen
  140.         If ( fullscreen = "true" )
  141.             Send !{Enter} ; fullscreen
  142.  
  143.         FadeInExit()
  144.  
  145.         Process, WaitClose, %DemulExe%
  146.  
  147. } Else { ; This will run NullDC and is the default for any game not defined in Settings.ini
  148.         ;Settings ** MOVE THESE TO SETTINGS.INI **
  149.         autoStart = 1
  150.         noConsole = 1
  151.         autoHideMenu = 1
  152.         ;fullScreen = 1
  153.         showVMU = 0
  154.         loadDefaultImage = 1
  155.         patchRegion = 1
  156.         nullDCcfg := checkFile(pathToNullDC . "nullDC.cfg")
  157.  
  158.         ;Write Settings
  159.         IniWrite, %autoStart%, %nullDCcfg%, nullDC, Emulator.AutoStart
  160.         IniWrite, %noConsole%, %nullDCcfg%, nullDC, Emulator.NoConsole
  161.         IniWrite, %autoHideMenu%, %nullDCcfg%, nullDC_GUI, AutoHideMenu
  162.         IniWrite, %fullScreen%, %nullDCcfg%, nullDC_GUI, Fullscreen
  163.         IniWrite, %showVMU%, %nullDCcfg%, drkMaple, VMU.Show
  164.         IniWrite, %loadDefaultImage%, %nullDCcfg%, ImageReader, LoadDefaultImage
  165.         IniWrite, %patchRegion%, %nullDCcfg%, ImageReader, PatchRegion
  166.         IniWrite, %romPath%%romname%%RomExtension%, %nullDCcfg%, ImageReader, DefaultImage
  167.  
  168.         ;Fixes hanging previous nullDC on bad exits or loads
  169.         Process, Exist, %executable%
  170.         if !ErrorLevel = 0
  171.         Process, Close, %executable%
  172.  
  173.         Run, %executable%, %pathToNullDC%, Hide
  174.         Sleep, 2000 ; Enough to hide the startup logo
  175.  
  176.         ;Let's completely hide the menu by slighly moving the window off screen
  177.         ;nullDC will self adjust once the menu autohides
  178.         If ( fullScreen = 1 ){
  179.           yOffset = -20
  180.           winHeight := A_ScreenHeight - yOffset
  181.           WinMove, nullDC,, 0, %yOffset%, %A_ScreenWidth%, %winHeight%
  182.         }
  183.  
  184.         WinShow, nullDC
  185.  
  186.         FadeInExit()
  187.  
  188.         Process, WaitClose, %NullDCExe%
  189.     }
  190.  
  191. ; Closing VJoy
  192. If ( useVJoy = "true" )
  193.     Run, %vJoyExe% -exit, %vJoyPath%
  194.  
  195. 7zCleanUp()
  196.  
  197. FadeOutExit()
  198.  
  199. WinActivate, Hyperspin
  200.  
  201. ExitApp
  202.  
  203. ;(¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯)
  204. ; Functions - DO NOT EDIT
  205. ;(_.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._)
  206.  
  207. CheckForVJoy(ByRef exe) {
  208.         Process, Wait, %exe%, 5
  209.         NewPID = %ErrorLevel%
  210.         If NewPID = 0
  211.         {
  212.             ScriptError("VJoy did not start. Check your VJoy path and Exe")
  213.             ExitApp
  214.         }
  215.     }
  216.  
  217. CheckForSpaces(name) {
  218.         IfInString, name, %A_Space%
  219.         {
  220.             ScriptError("Rom name contains a space.`nMakaron will not run games with spaces in their names")
  221.             ExitApp
  222.         }
  223.     }
  224.  
  225. CloseProcess:
  226.     FadeOutStart()
  227.     If ( emulator = "NullDC" )
  228.         WinClose, nullDC ahk_class ndc_main_window
  229.     Else If ( emulator = "Demul" )
  230.             Process, Close, %executable% ; we have to close this way otherwise demul crashes with WinClose
  231.     Else If ( emulator = "Makaron" ) {
  232.             Send, {F8}
  233.             Sleep, 1000
  234.             Send, !{F4}
  235.             Sleep, 500
  236.             Process, Close, %MakaronExe% ; Makaron doesn't end the exe sometimes, we must manually do it
  237.         }
  238. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement