Advertisement
djvj

Untitled

Jan 28th, 2015
642
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.32 KB | None | 0 0
  1. MEmu = NullDC
  2. MEmuV = r141
  3. MURL = https://code.google.com/p/nulldc/
  4. MAuthor = djvj & bleasby
  5. MVersion = 2.0.4
  6. MCRC = E1BED80E
  7. iCRC = 2454AF41
  8. MID = 635038268910409317
  9. MSystem = "Sega Dreamcast"
  10. ;----------------------------------------------------------------------------
  11. ; NullDC works with these disc images:
  12. ; - CDI: Padus DiscJuggler image
  13. ; - MDS: Alcohol 120% Media Descriptor image (must be accompanied by a MDF file)
  14. ; - NRG: Nero Burning ROM image
  15. ; - GDI: Raw GDI dump
  16. ; - CHD: MAME's Compressed Hunk of Data
  17.  
  18. ; Helpful guide for getting the basics setup for NullDC: http://www.dgemu.com/forums/index.php/topic/474318-guide-configuring-nulldc-104-r136/
  19. ; If you want to use specific configs per game, create a folder called Cfg inside nullDC folder and copy your nullDC.cfg
  20. ; config files into it naming them to match the database names. Make sure you keep a copy of nullDC.cfg on the Cfg folder as well.
  21. ;
  22. ; If you want to convert your roms from gdi to chd, see here: http://www.emutalk.net/showthread.php?t=51502
  23. ; 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.
  24. ;
  25. ; Setup the user settings in the moduleName ini to your liking
  26. ; Games can have a custom Cable Type (per game). Not all games work on VGA, so use the below option in the ini
  27. ; Cable can be 0 (VGA(0)(RGB)), 1 (VGA(1)(RGB)), 2 (TV(RGB)) or 3 (TV(VBS/Y+S/C)), default is 0.
  28. ;
  29. ; For additional setup steps prior to running, see this link: http://www.hyperspin-fe.com/forum/showpost.php?p=99852&postcount=138
  30. ; Not all builds work with swapping discs, it's mostly broken and is a nulldc problem, not HyperLaunch's. See here: http://code.google.com/p/nulldc/issues/detail?id=264
  31. ;----------------------------------------------------------------------------
  32. StartModule()
  33. BezelGUI()
  34. ExtraFixedResBezelGUI()
  35.  
  36. If systemName not contains dreamcast,dc
  37. ScriptError(systemName . " is not a supported system for this module. Only " . MSystem . " is supported.")
  38.  
  39. FadeInStart()
  40.  
  41. settingsFile := modulePath . "\" . moduleName . ".ini"
  42. nullDCcfg := checkFile(emuPath . "\nullDC.cfg")
  43.  
  44. fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1)
  45. dualMonitors := IniReadCheck(settingsFile, "NullDC", "DualMonitors","false",,1)
  46. autoStart := IniReadCheck(settingsFile, "NullDC", "autoStart","1",,1)
  47. noConsole := IniReadCheck(settingsFile, "NullDC", "noConsole","1",,1)
  48. autoHideMenu := IniReadCheck(settingsFile, "NullDC", "autoHideMenu","0",,1)
  49. alwaysOnTop := IniReadCheck(settingsFile, "NullDC", "alwaysOnTop","1",,1)
  50. showVMU := IniReadCheck(settingsFile, "NullDC", "showVMU","0",,1)
  51. VMU1Pos := IniReadCheck(settingsFile, "NullDC", "VMU1Pos","topLeft",,1) ; topRight, topCenter, topLeft, leftCenter, bottomLeft, bottomCenter, bottomRight, rightCenter
  52. VMU2Pos := IniReadCheck(settingsFile, "NullDC", "VMU2Pos","topRight",,1) ; topRight, topCenter, topLeft, leftCenter, bottomLeft, bottomCenter, bottomRight, rightCenter
  53. VMU3Pos := IniReadCheck(settingsFile, "NullDC", "VMU3Pos","bottomLeft",,1) ; topRight, topCenter, topLeft, leftCenter, bottomLeft, bottomCenter, bottomRight, rightCenter
  54. VMU4Pos := IniReadCheck(settingsFile, "NullDC", "VMU4Pos","bottomRight",,1) ; topRight, topCenter, topLeft, leftCenter, bottomLeft, bottomCenter, bottomRight, rightCenter
  55. VMUHideKey := IniReadCheck(settingsFile, "Settings", "VMUHideKey","F10",,1)
  56. loadDefaultImage := IniReadCheck(settingsFile, "NullDC", "loadDefaultImage","1",,1)
  57. patchRegion := IniReadCheck(settingsFile, "NullDC", "patchRegion","1",,1)
  58. cable := IniReadCheck(settingsFile, romName, "Cable","0",,1)
  59.  
  60. hideEmuObj := Object("ahk_class ConsoleWindowClass",0,"nullDC ahk_class ndc_main_window",1) ; Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
  61. 7z(romPath, romName, romExtension, 7zExtractPath)
  62.  
  63. specialCfg = %emuPath%\cfg\%romName%.cfg
  64. defaultCfg = %emuPath%\cfg\nullDC.cfg
  65. If ( FileExist(specialCfg) && FileExist(defaultCfg))
  66. FileCopy, %specialCfg%, %emuPath%\nullDC.cfg, 1
  67. Else If (FileExist(defaultCfg))
  68. FileCopy, %defaultCfg%, %emuPath%\nullDC.cfg, 1
  69.  
  70. ;Detect game region based on rom name
  71. IfInString, romName, (Europe)
  72. region = 2
  73. Else IfInString, romName, (Japan)
  74. region = 0
  75. Else IfInString, romName, (World)
  76. region = 2
  77. Else
  78. region = 1
  79.  
  80. If romExtension In %7zformats%
  81. ScriptError(MEmu . " does not support compressed formats. Please extract your images first or enable 7z.")
  82.  
  83. BezelStart()
  84.  
  85. ;Write Settings
  86. IniWrite, % (If (Fullscreen = "true" )?("1"):("0")), %nullDCcfg%, nullDC_GUI, Fullscreen
  87. IniWrite, %autoStart%, %nullDCcfg%, nullDC, Emulator.AutoStart
  88. IniWrite, %noConsole%, %nullDCcfg%, nullDC, Emulator.NoConsole
  89. IniWrite, %autoHideMenu%, %nullDCcfg%, nullDC_GUI, AutoHideMenu
  90. IniWrite, %alwaysOnTop%, %nullDCcfg%, nullDC_GUI, AlwaysOnTop
  91. IniWrite, %showVMU%, %nullDCcfg%, drkMaple, VMU.Show
  92. IniWrite, %loadDefaultImage%, %nullDCcfg%, ImageReader, LoadDefaultImage
  93. IniWrite, %patchRegion%, %nullDCcfg%, ImageReader, PatchRegion
  94. IniWrite, %region%, %nullDCcfg%, nullDC, Dreamcast.Region
  95. IniWrite, %cable%, %nullDCcfg%, nullDC, Dreamcast.Cable
  96. Log("Module - Telling ImageReader plugin to load this game: """ . romPath . "\" . romname . RomExtension)
  97. IniWrite, %romPath%\%romname%%RomExtension%, %nullDCcfg%, ImageReader, DefaultImage
  98.  
  99. ;Fixes hanging previous nullDC on bad exits or loads
  100. Process("Exist", executable)
  101. If !ErrorLevel = 0
  102. Process("Close", executable)
  103.  
  104. ; This hides nullDC's menu when running dual screens
  105. If dualMonitors = true
  106. { MouseGetPos X, Y
  107. SetDefaultMouseSpeed, 0
  108. MouseMove %A_ScreenWidth%,%A_ScreenHeight%
  109. }
  110.  
  111. HideEmuStart() ; This fully ensures windows are completely hidden even faster than winwait
  112.  
  113. Run(executable, emuPath)
  114.  
  115. ; TESTING TO HIDE THE CONSOLE WINDOW POPUP, NOTHING WORKS
  116. ; WinWait("nullDC ahk_class ndc_main_window")
  117. ; WinSet, Transparent, On, nullDC ahk_class ndc_main_window
  118. ; WinSet, Transparent, On, ahk_class ConsoleWindowClass ; makes the console window transparent so you don't see it on exit
  119. ; Sleep, 2000 ; Enough to hide the startup logo
  120. ; WinHide, ahk_class ConsoleWindowClass
  121.  
  122. WinWait("nullDC ahk_class ndc_main_window")
  123. WinWaitActive("nullDC ahk_class ndc_main_window")
  124.  
  125. ndcID:=WinExist("A") ; storing the window's PID so we can toggle it later
  126. ToggleMenu(ndcID) ; Removes the MenuBar
  127. ; DllCall("SetMenu", uint, WinActive( "A" ), uint, 0) ; Removes the MenuBar
  128.  
  129. ;Let's completely hide the menu by slighly moving the window off screen
  130. ;nullDC will self adjust once the menu autohides
  131. If fullScreen = true
  132. { yOffset = -20
  133. winHeight := A_ScreenHeight - yOffset
  134. WinMove, nullDC,, 0, %yOffset%, %A_ScreenWidth%, %winHeight%
  135. }
  136.  
  137. ; WinShow, nullDC ahk_class ndc_main_window ; without these, nullDC may stay hidden behind HS
  138. ; WinActivate, nullDC ahk_class ndc_main_window
  139. HideEmuEnd()
  140. BezelDraw()
  141. If !(showVMU="0")
  142. SetTimer, CheckforVMU, 10000
  143. FadeInExit()
  144. WinSet, Transparent, Off, nullDC ahk_class ndc_main_window
  145. Process("WaitClose", executable)
  146. 7zCleanUp()
  147. BezelExit()
  148. ExtraFixedResBezelExit()
  149. FadeOutExit()
  150. ExitModule()
  151.  
  152.  
  153. ; Toggle the MenuBar
  154. !a::
  155. ToggleMenu(ndcID)
  156. Return
  157.  
  158. MultiGame:
  159. ; msgbox % "selectedRom = " . selectedRom . "`nselected game = " . currentButton . "`nmgRomPath = " . mgRomPath . "`nmgRomExt = " . mgRomExt . "`nmgRomName = " . mgRomName
  160. ToggleMenu(ndcID) ; Restore the MenuBar
  161. Loop {
  162. WinMenuSelectItem,nullDC ahk_class ndc_main_window,,Options,GDRom,Select Default Image
  163. WinWait("Select Image File ahk_class #32770")
  164. WinWaitActive("Select Image File ahk_class #32770")
  165. If WinActive("Select Image File ahk_class #32770")
  166. Break
  167. }
  168. OpenROM("Select Image File ahk_class #32770", mgRomPath . "\" . mgRomName . "." . mgRomExt) ; unsure if Select Image File needs to be translated via i18n
  169. WinWaitActive("nullDC ahk_class ndc_main_window")
  170. Sleep, 300 ; giving time for emu to mount the new image
  171. WinMenuSelectItem,nullDC ahk_class ndc_main_window,,Options,GDRom,Swap Disc ; DC does not support swapping discs on-the-fly like psx because the console reset when the drive was opened. This basically tells the emu to reset.
  172. ToggleMenu(ndcID) ; Removes the MenuBar
  173. Return
  174.  
  175. BezelLabel:
  176. disableHideToggleMenu := true
  177. Return
  178.  
  179. HaltEmu:
  180. If VMUHideKey
  181. XHotKeywrapper(VMUHideKey,"VMUHide","OFF")
  182. Return
  183.  
  184. RestoreEmu:
  185. If VMULoaded
  186. { Loop, 4
  187. { WinSet, Transparent, 0, % "ahk_ID " . VMUScreenID%A_Index%
  188. WinSet, AlwaysOnTop, On, % "ahk_ID " . VMUScreenID%A_Index%
  189. WinShow, % "ahk_ID " . VMUScreenID%A_Index%
  190. }
  191. WinSet, AlwaysOnTop, On, ahk_ID %extraFixedRes_Bezel_hwnd%
  192. WinShow, ahk_ID %extraFixedRes_Bezel_hwnd%
  193. If !(VMUHidden)
  194. Loop, 4
  195. WinSet, Transparent, off, % "ahk_ID " . VMUScreenID%A_Index%
  196. }
  197. If VMUHideKey
  198. XHotKeywrapper(VMUHideKey,"VMUHide","ON")
  199. Return
  200.  
  201. CheckforVMU:
  202. Loop, 4
  203. { Transform, letter, Chr, % A_Index + asc("A") - 1 ; transform number to letter
  204. If ((!(VMU%A_Index%Draw)) and (VMUScreenID%A_Index%:=WinExist("nullDC VMU " . letter . "0 ahk_class #32770")))
  205. { WinSet, Transparent, 0, % "ahk_ID " . VMUScreenID%A_Index%
  206. WinSet, AlwaysOnTop, On, % "ahk_ID " . VMUScreenID%A_Index%
  207. ExtraFixedResBezelDraw(VMUScreenID%A_Index%, "VMU",VMU%A_Index%Pos, 144, 96, 8, 8, 28, 8)
  208. WinShow, % "ahk_ID " . VMUScreenID%A_Index%
  209. WinSet, AlwaysOnTop, On, ahk_ID %extraFixedRes_Bezel_hwnd%
  210. WinShow, ahk_ID %extraFixedRes_Bezel_hwnd%
  211. WinSet, Transparent, off, % "ahk_ID " . VMUScreenID%A_Index%
  212. VMU%A_Index%Draw := true
  213. If !(VMULoaded){
  214. VMUHideKey := xHotKeyVarEdit(VMUHideKey,"VMUHideKey","~","Add")
  215. xHotKeywrapper(VMUHideKey,"VMUHide")
  216. VMULoaded := true
  217. }
  218. }
  219. }
  220. If ((VMU1Draw) and (VMU2Draw) and (VMU3Draw) and (VMU4Draw))
  221. SetTimer, CheckforVMU, off
  222. Return
  223.  
  224. VMUHide:
  225. If (VMUHidden)
  226. { Loop, 4
  227. WinSet, Transparent, off, % "ahk_ID " . VMUScreenID%A_Index%
  228. UpdateLayeredWindow(extraFixedRes_Bezel_hwnd, extraFixedRes_Bezel_hdc,0,0, A_ScreenWidth, A_ScreenHeight,255)
  229. VMUHidden := false
  230. } Else {
  231. Loop, 4
  232. WinSet, Transparent, 0, % "ahk_ID " . VMUScreenID%A_Index%
  233. UpdateLayeredWindow(extraFixedRes_Bezel_hwnd, extraFixedRes_Bezel_hdc,0,0, A_ScreenWidth, A_ScreenHeight,0)
  234. VMUHidden := true
  235. }
  236. Return
  237.  
  238. CloseProcess:
  239. If VMULoaded
  240. SetTimer, checkforVMU, off
  241. FadeOutStart()
  242. ; WinClose("ahk_class ConsoleWindowClass")
  243. WinClose("nullDC ahk_class ndc_main_window")
  244. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement