Advertisement
djvj

Untitled

Dec 29th, 2014
516
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.76 KB | None | 0 0
  1. MEmu = Demul
  2. MEmuV = v0.5.8.2
  3. MURL = http://demul.emulation64.com/
  4. MAuthor = djvj
  5. MVersion = 2.0.4 BETA
  6. MCRC = EFEE7501
  7. iCRC = F43FB746
  8. mId = 635211874656892855
  9. MSystem = "Gaelco","Sammy Atomiswave","Sega Dreamcast","Sega Hikaru","Sega Naomi","Sega Naomi 2"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; Required - control and nvram files can be found in my user dir on the FTP at /Upload Here/djvj/Sega Naomi\Emulators. Additonal instructions from my orignal HL1.0 script at http://www.hyperspin-fe.com/forum/showpost.php?p=86093&postcount=104
  13. ; Required - moduleName ini example can be found on GIT in the Demul module folder
  14. ; moduleName ini must be placed in same folder as this module if you use the provided example, just be sure to rename it to just Demul.ini first so it matches the module's name
  15. ; GDI images must match mame zip names and be extracted and have a .dat extension
  16. ; Rom_Extension should include 7z|zip|gdi|cue|cdi|chd|mds|ccd|nrg
  17. ; Module will automatically set your rom path for you on first launch
  18. ;
  19. ; Make sure the awbios, dc, hikaru, naomi, naomi2, saturn.zip bios archives are in any of your rom paths as they are needed to play all the games.
  20. ; Set your Video Plugin to gpuDX11 and set your desired resolution there
  21. ; In case your control codes do not match mine, set your desired control type in demul, then open the demul.ini and find section PORTB and look for the device key. Use this number instead of the one I provided
  22. ; gpuDX10 and gpuDX11 are the only supported plugins. You can define what plugin you want to use for each game in the module settings in HLHQ
  23. ; Read the tooltip for the Fullscreen module setting in HLHQ on how to control windowed fullscreen, true fullscreen, or windowed mode
  24. ; Windowed fullscreen will take effect the 2nd time you run the emu. It has to calculate your resolution on first run.
  25. ;
  26. ; Controls:
  27. ; Start a game of each control type (look in the HLHQ's module settings for these types, they all have their own tabs) and configure your controls to play the game. After configuring your controls manually in Demul, open padDemul.ini and Copy/paste the JAMMA0_0 and JAMMA0_1 (for naomi) or the ATOMISWAVE0_0 and ATOMISWAVE0_1 (for atomiswave) into HLHQ's module settings for each controls tab (standard, sfstyle, etc).
  28. ; Each pair of control tabs designates another real arcade control schema for a grouping of games. Demul does not handle this like MAME, so the module does instead.
  29. ;
  30. ; Troubleshooting:
  31. ; For some reason demul's ini files can get corrupted and ahk can't read/write to them correctly.
  32. ; If your ini keys are not being read or not writing to their existing keys in the demul inis, create a new file and copy/paste everything from the old ini into the new one and save.
  33. ; If you use Fade_Out, the module will disable it. Demul crashes when Fade tries to draw on top of it in windowed and fullscreen modes.
  34. ;----------------------------------------------------------------------------
  35. StartModule()
  36. BezelGUI()
  37. FadeInStart()
  38.  
  39. ; This object controls how the module reacts to different systems. Demul can play a few systems, but needs to know what system you want to run, so this module has to adapt.
  40. mType := Object("Gaelco","gaelco","Sammy Atomiswave","atomiswave","Sega Dreamcast","dc","Sega Hikaru","hikaru","Sega Naomi","naomi","Sega Naomi 2","naomi2")
  41. ident := mType[systemName] ; search object for the systemName identifier Demul uses
  42. If !ident
  43. ScriptError("Your systemName is: " . systemName . "`nIt is not one of the known supported systems for this Demul module: " . moduleName)
  44.  
  45. settingsFile := modulePath . "\" . moduleName . ".ini"
  46. demulFile := CheckFile(emuPath . "\Demul.ini", "Could not find Demul's ini. Please run Demul manually first and each of it's settings sections so the appropriate inis are created for you: " . emuPath . "\Demul.ini")
  47. padFile := CheckFile(emuPath . "\padDemul.ini", "Could not find Demul's control ini. Please run Demul manually first and set up your controls so this file is created for you: " . emuPath . "\padDemul.ini")
  48.  
  49. maxHideTaskbar := IniReadCheck(settingsFile, "Settings", "MaxHideTaskbar", "true",,1)
  50. controllerCode := IniReadCheck(settingsFile, "Settings", "ControllerCode", "16777216",,1)
  51. mouseCode := IniReadCheck(settingsFile, "Settings", "MouseCode", "131072",,1)
  52. keyboardCode := IniReadCheck(settingsFile, "Settings", "KeyboardCode", "1073741824",,1)
  53. lightgunCode := IniReadCheck(settingsFile, "Settings", "LightgunCode", "-2147483648",,1)
  54. lastControlUsed := IniReadCheck(settingsFile, "Settings", "LastControlUsed",,,1)
  55. hideDemulGUI := IniReadCheck(settingsFile, "Settings", "HideDemulGUI", "true",,1)
  56.  
  57. fullscreen := IniReadCheck(settingsFile, "Settings|" . romName, "Fullscreen", "windowedfullscreen",,1)
  58. plugin := IniReadCheck(settingsFile, "Settings|" . romName, "Plugin", "gpuDX11",,1)
  59. shaderUsePass1 := IniReadCheck(settingsFile, "Settings|" . romName, "ShaderUsePass1", "false",,1)
  60. shaderUsePass2 := IniReadCheck(settingsFile, "Settings|" . romName, "ShaderUsePass2", "false",,1)
  61. shaderNamePass1 := IniReadCheck(settingsFile, "Settings|" . romName, "ShaderNamePass1",,,1)
  62. shaderNamePass2 := IniReadCheck(settingsFile, "Settings|" . romName, "ShaderNamePass2",,,1)
  63. listSorting := IniReadCheck(settingsFile, "Settings|" . romName, "ListSorting", "true",,1)
  64. internalResolutionScale := IniReadCheck(settingsFile, "Settings|" . romName, "InternalResolutionScale", "1",,1)
  65.  
  66. Bios := IniReadCheck(settingsFile, romName, "Bios",,,1)
  67. LoadDecrypted := IniReadCheck(settingsFile, romName, "LoadDecrypted",,,1) ; not currently supported
  68.  
  69. ; Read all the control values
  70. controls := IniReadCheck(settingsFile, romname, "Controls", "standard",,1) ; have to read this first so the below ini reads work
  71. push1_0 := IniReadCheck(settingsFile, controls . "_JAMMA0_0", "push1",,,1)
  72. push2_0 := IniReadCheck(settingsFile, controls . "_JAMMA0_0", "push2",,,1)
  73. push3_0 := IniReadCheck(settingsFile, controls . "_JAMMA0_0", "push3",,,1)
  74. push4_0 := IniReadCheck(settingsFile, controls . "_JAMMA0_0", "push4",,,1)
  75. push5_0 := IniReadCheck(settingsFile, controls . "_JAMMA0_0", "push5",,,1)
  76. push6_0 := IniReadCheck(settingsFile, controls . "_JAMMA0_0", "push6",,,1)
  77. push7_0 := IniReadCheck(settingsFile, controls . "_JAMMA0_0", "push7",,,1)
  78. push8_0 := IniReadCheck(settingsFile, controls . "_JAMMA0_0", "push8",,,1)
  79. service_0 := IniReadCheck(settingsFile, controls . "_JAMMA0_0", "SERVICE",,,1)
  80. start_0 := IniReadCheck(settingsFile, controls . "_JAMMA0_0", "START",,,1)
  81. coin_0 := IniReadCheck(settingsFile, controls . "_JAMMA0_0", "COIN",,,1)
  82. digitalup_0 := IniReadCheck(settingsFile, controls . "_JAMMA0_0", "DIGITALUP",,,1)
  83. digitaldown_0 := IniReadCheck(settingsFile, controls . "_JAMMA0_0", "DIGITALDOWN",,,1)
  84. digitalleft_0 := IniReadCheck(settingsFile, controls . "_JAMMA0_0", "DIGITALLEFT",,,1)
  85. digitalright_0 := IniReadCheck(settingsFile, controls . "_JAMMA0_0", "DIGITALRIGHT",,,1)
  86. analogup_0 := IniReadCheck(settingsFile, controls . "_JAMMA0_0", "ANALOGUP",,,1)
  87. analogdown_0 := IniReadCheck(settingsFile, controls . "_JAMMA0_0", "ANALOGDOWN",,,1)
  88. analogleft_0 := IniReadCheck(settingsFile, controls . "_JAMMA0_0", "ANALOGLEFT",,,1)
  89. analogright_0 := IniReadCheck(settingsFile, controls . "_JAMMA0_0", "ANALOGRIGHT",,,1)
  90. analogup2_0 := IniReadCheck(settingsFile, controls . "_JAMMA0_0", "ANALOGUP2",,,1)
  91. analogdown2_0 := IniReadCheck(settingsFile, controls . "_JAMMA0_0", "ANALOGDOWN2",,,1)
  92. analogleft2_0 := IniReadCheck(settingsFile, controls . "_JAMMA0_0", "ANALOGLEFT2",,,1)
  93. analogright2_0 := IniReadCheck(settingsFile, controls . "_JAMMA0_0", "ANALOGRIGHT2",,,1)
  94. push1_1 := IniReadCheck(settingsFile, controls . "_JAMMA0_1", "push1",,,1)
  95. push2_1 := IniReadCheck(settingsFile, controls . "_JAMMA0_1", "push2",,,1)
  96. push3_1 := IniReadCheck(settingsFile, controls . "_JAMMA0_1", "push3",,,1)
  97. push4_1 := IniReadCheck(settingsFile, controls . "_JAMMA0_1", "push4",,,1)
  98. push5_1 := IniReadCheck(settingsFile, controls . "_JAMMA0_1", "push5",,,1)
  99. push6_1 := IniReadCheck(settingsFile, controls . "_JAMMA0_1", "push6",,,1)
  100. push7_1 := IniReadCheck(settingsFile, controls . "_JAMMA0_1", "push7",,,1)
  101. push8_1 := IniReadCheck(settingsFile, controls . "_JAMMA0_1", "push8",,,1)
  102. service_1 := IniReadCheck(settingsFile, controls . "_JAMMA0_1", "SERVICE",,,1)
  103. start_1 := IniReadCheck(settingsFile, controls . "_JAMMA0_1", "START",,,1)
  104. coin_1 := IniReadCheck(settingsFile, controls . "_JAMMA0_1", "COIN",,,1)
  105. digitalup_1 := IniReadCheck(settingsFile, controls . "_JAMMA0_1", "DIGITALUP",,,1)
  106. digitaldown_1 := IniReadCheck(settingsFile, controls . "_JAMMA0_1", "DIGITALDOWN",,,1)
  107. digitalleft_1 := IniReadCheck(settingsFile, controls . "_JAMMA0_1", "DIGITALLEFT",,,1)
  108. digitalright_1 := IniReadCheck(settingsFile, controls . "_JAMMA0_1", "DIGITALRIGHT",,,1)
  109. analogup_1 := IniReadCheck(settingsFile, controls . "_JAMMA0_1", "ANALOGUP",,,1)
  110. analogdown_1 := IniReadCheck(settingsFile, controls . "_JAMMA0_1", "ANALOGDOWN",,,1)
  111. analogleft_1 := IniReadCheck(settingsFile, controls . "_JAMMA0_1", "ANALOGLEFT",,,1)
  112. analogright_1 := IniReadCheck(settingsFile, controls . "_JAMMA0_1", "ANALOGRIGHT",,,1)
  113. analogup2_1 := IniReadCheck(settingsFile, controls . "_JAMMA0_1", "ANALOGUP2",,,1)
  114. analogdown2_1 := IniReadCheck(settingsFile, controls . "_JAMMA0_1", "ANALOGDOWN2",,,1)
  115. analogleft2_1 := IniReadCheck(settingsFile, controls . "_JAMMA0_1", "ANALOGLEFT2",,,1)
  116. analogright2_1 := IniReadCheck(settingsFile, controls . "_JAMMA0_1", "ANALOGRIGHT2",,,1)
  117.  
  118. ; Verify user set desired gpu plugin name correctly
  119. If ( plugin != "gpuDX11" && plugin != "gpuDX10" && plugin != "")
  120. ScriptError(plugin . " is not a supported gpu plugin.`nLeave the plugin blank to use the default ""gpuDX11"".`nValid options are gpuDX11 or gpuDX10.")
  121.  
  122. ; Handle Demul's rom paths so the user doesn't have to
  123. IniRead, romPathCount, %demulFile%, files, romsPathsCount
  124. Log("Module - Demul is configured with " . romPathCount . " rom path(s). Scanning these for a romPath to this rom.")
  125. Loop, %romPathCount%
  126. { demulRomPath := A_Index - 1 ; rompaths in demul start with 0
  127. IniRead, path%A_Index%, %demulFile%, files, roms%demulRomPath%
  128. Log("Module - Path" . demulRomPath . ": " . path%A_Index%)
  129. ; msgbox % path%A_Index%
  130. If (path%A_Index% = romPath . "\") ; demul tacks on the backslash at the end
  131. { romPathFound := 1 ; flag that demul has this romPath in its config and no need to add it
  132. Log("Module - Stopping search because Demul is already configured with the correct romPath to this rom: " . path%A_Index%)
  133. Break ; stop looking for a correct romPath
  134. }
  135. }
  136. If !romPathFound ; if demul doesn't have the romPath in its ini, add it
  137. { Log("Module - Demul does not have this romPath in Demul.ini, adding it for you.",2)
  138. nextPath := romPathCount + 1 ; add 1 to the romPathCount and write that to the ini
  139. IniWrite, %nextPath%, %demulFile%, files, romsPathsCount
  140. IniWrite, %romPath%\, %demulFile%, files, % "roms" . romPathCount ; write the rompath to the ini
  141. }
  142.  
  143. BezelStart("FixResMode")
  144.  
  145. ; Force Fade_Out to disabled as it causes demul to not close properly
  146. fadeOut = false
  147. Log("Module - Turning off Fade_Out because it doesn't let Demul exit properly.",2)
  148.  
  149. ; check for the specified gpu plugin
  150. gpuFile := CheckFile(emuPath . "\" . plugin . ".ini")
  151.  
  152. ; This updates the DX11gpu ini file to turn List Sorting on or off. Depending on the games, turning this on for some games may remedy missing graphics, having it off on other games may fix corrupted graphics. Untill they improve the DX11gpu, this is the best it's gonna get.
  153. If ListSorting = true
  154. IniWrite, 0, %gpuFile%, main, AutoSort
  155. Else
  156. IniWrite, 1, %gpuFile%, main, AutoSort
  157.  
  158. ; This updates the DX10gpu or DX11gpu ini file to the scale you want to use for this game
  159. IniWrite, %InternalResolutionScale%, %gpuFile%, main, scaling
  160.  
  161. ; This updates the demul.ini with your gpu plugin choice for the selected rom
  162. IniWrite, %plugin%.dll, %demulFile%, plugins, gpu
  163.  
  164. ; Shader Effects
  165. Loop, 2 {
  166. shaderUsePass%A_Index% := If (ShaderUsePass%A_Index% != "" and ShaderUsePass%A_Index% != "ERROR" ? (ShaderUsePass%A_Index%) : (GlobalShaderUsePass%A_Index%)) ; determine what shaderUsePass to use
  167. IniRead, currentusePass%A_Index%, %gpuFile%, shaders, usePass%A_Index%
  168. If (shaderUsePass%A_Index% = "true")
  169. {
  170. shaderNamePass%A_Index% := If (ShaderNamePass%A_Index% != "" and ShaderNamePass%A_Index% != "ERROR" ? (ShaderNamePass%A_Index%) : (GlobalShaderNamePass%A_Index%)) ; determine what shaderNamePass to use
  171. If shaderNamePass%A_Index% not in FXAA,HDR-TV,SCANLINES,CARTOON,RGB DOT(MICRO),RGB DOT(TINY),BLUR
  172. ScriptError(shaderNamePass%A_Index% . " is not a valid choice for a shader. Your options are FXAA, HDR-TV, SCANLINES, CARTOON, RGB DOT(MICRO), RGB DOT(TINY), or BLUR.")
  173. If (currentusePass%A_Index% = 0)
  174. IniWrite, 1, %gpuFile%, shaders, usePass%A_Index% ; turn shader on in gpuDX11 ini
  175. IniWrite, % shaderNamePass%A_Index%, %gpuFile%, shaders, shaderPass%A_Index% ; update gpuDX11 ini with the shader name to use
  176. }Else If (shaderUsePass%A_Index% != "true" and currentusePass%A_Index% = 1)
  177. IniWrite, 0, %gpuFile%, shaders, usePass%A_Index% ; turn shader off in gpuDX11 ini
  178. }
  179.  
  180. If ident = dc
  181. {
  182. 7z(romPath, romName, romExtension, 7zExtractPath)
  183. If ( romExtension = ".cdi" || romExtension = ".mds" || romExtension = ".ccd" || romExtension = ".nrg" || romExtension = ".gdi" || romExtension = ".cue" ) {
  184. gdrImageFile := CreateDefaultGDROMIni("image")
  185. FileDelete, %gdrImageFile%
  186. Sleep, 500
  187. IniWrite, gdrImage.dll, %demulFile%, plugins, gdr
  188. IniWrite, false, %gdrImageFile%, Main, openDialog
  189. IniWrite, %romPath%\%romName%%romExtension%, %gdrImageFile%, Main, imagefilename
  190. } Else If romExtension = .chd
  191. {
  192. gdrCHDFile := CreateDefaultGDROMIni("chd")
  193. FileDelete, %gdrCHDFile%
  194. Sleep, 500
  195. IniWrite, false, %gdrCHDFile%, Main, openDialog
  196. IniWrite, gdrCHD.dll, %demulFile%, plugins, gdr
  197. IniWrite, %romPath%\%romName%%romExtension%, %gdrCHDFile%, Main, imagefilename
  198. } Else
  199. ScriptError(romExtension . " is not a supported file type for this " . moduleName . " module.")
  200.  
  201. IniWrite, 1, %demulFile%, main, region ; Set BIOS to Auto Region
  202. } Else { ; all other systems, Naomi and Atomiswave
  203. ; This updates the demul.ini with your Bios choice for the selected rom
  204. If ( Bios != "" && Bios != "ERROR" ) {
  205. Bios := RegExReplace(Bios,"\s.*") ; Cleans off the added text from the key's value so only the number is left
  206. IniWrite, false, %demulFile%, main, naomiBiosAuto ; turning auto bios off so we can use a specific one instead
  207. IniWrite, %Bios%, %demulFile%, main, naomiBios ; setting specific bios user has set from the moduleName ini
  208. } Else
  209. IniWrite, true, %demulFile%, main, naomiBiosAuto ; turning auto bios on if user did not specify a specific one
  210. }
  211.  
  212. ; This section writes your custom keys to the padDemul.ini. Naomi games had many control panel layouts. The only way we can accomodate these differing controls, is to keep track of them all and write them to the ini at the launch of each game.
  213. ; First we check if the last controls used are the same as the game we want to play, so we don't waste time updating the ini if it is not necessary. For example playing 2 sfstyle type games in a row, we wouldn't need to write to the ini.
  214.  
  215. ; This section tells demul what arcade control type should be connected to the game. Options are standard (aka controller), mouse, lightgun, or keyboard
  216. If ( controls = "lightgun" || controls = "mouse" ) {
  217. Log("Module - This game uses a Mouse or Lightgun control type.")
  218. IniWrite, %MouseCode%, %demulFile%, PORTB, device
  219. } Else If ( controls = "keyboard" ) {
  220. Log("Module - This game uses a Keyboard control type.")
  221. IniWrite, %KeyboardCode%, %demulFile%, PORTB, device
  222. } Else { ; accounts for all other control types
  223. Log("Module - This game uses a standard (controller) control type.")
  224. IniWrite, %ControllerCode%, %demulFile%, PORTB, device
  225. }
  226.  
  227. Log("Module - Last control scheme used was """ . lastControlUsed . """ and this game requires """ . controls . """")
  228. If ( LastControlUsed != controls ) { ; find out last controls used for the system we are launching
  229. WriteControls(padFile, 0,push1_0,push2_0,push3_0,push4_0,push5_0,push6_0,push7_0,push8_0,SERVICE_0,START_0,COIN_0,DIGITALUP_0,DIGITALDOWN_0,DIGITALLEFT_0,DIGITALRIGHT_0,ANALOGUP_0,ANALOGDOWN_0,ANALOGLEFT_0,ANALOGRIGHT_0,ANALOGUP2_0,ANALOGDOWN2_0,ANALOGLEFT2_0,ANALOGRIGHT2_0)
  230. WriteControls(padFile, 1,push1_1,push2_1,push3_1,push4_1,push5_1,push6_1,push7_1,push8_1,SERVICE_1,START_1,COIN_1,DIGITALUP_1,DIGITALDOWN_1,DIGITALLEFT_1,DIGITALRIGHT_1,ANALOGUP_1,ANALOGDOWN_1,ANALOGLEFT_1,ANALOGRIGHT_1,ANALOGUP2_1,ANALOGDOWN2_1,ANALOGLEFT2_1,ANALOGRIGHT2_1)
  231. IniWrite, %controls%, %settingsFile%, Settings, LastControlUsed
  232. Log("Module - Wrote " . controls . " controls to padDemul.ini.")
  233. } Else
  234. Log("Module - Not changing controls because the currently configured controls are the same for this game.")
  235.  
  236. ; Setting demul to use true fullscreen if defined in settings.ini, otherwise sets demul to run windowed. This is for gpuDX11 plugin only
  237. If plugin = gpuDX11
  238. If fullscreen = truefullscreen
  239. IniWrite, 1, %gpuFile%, main, UseFullscreen
  240. Else
  241. IniWrite, 0, %gpuFile%, main, UseFullscreen
  242.  
  243. If fullscreen = windowedfullscreen
  244. {
  245. If maxHideTaskbar = true
  246. {
  247. Log("Module - Hiding Taskbar and Start Button.")
  248. WinHide, ahk_class Shell_TrayWnd
  249. WinHide, Start ahk_class Button
  250. }
  251. ; Create black background to give the emu the fullscreen look
  252. Log("Module - Creating black background to simulate a fullscreen look.")
  253. Gui demulGUI: -Caption +ToolWindow
  254. Gui demulGUI: Color, Black
  255. Gui demulGUI: Show, x0 y0 h%A_ScreenHeight% w%A_ScreenWidth%
  256. }
  257.  
  258. Sleep, 250
  259.  
  260. ; Construct the CLI for demul and send romName if naomi or atomiswave. Dreamcast needs a full path and romName.
  261. If LoadDecrypted = true ; decrypted naomi rom
  262. romCLI := "-customrom=" . """" . romPath . "\" . romName . ".bin"""
  263. Else If ident = dc ; dreamcast game
  264. romCLI := " -image=" . """" . romPath . "\" . romName . romExtension . """"
  265. Else ; standard naomi rom
  266. romCLI := "-rom=" . romName
  267.  
  268. If hideDemulGUI = true
  269. SetTimer, HideGUIWindow, 50 ; start watching for gui window so it can be completely hidden
  270.  
  271. ; Run(executable . " -run=" . ident . " " . romCLI, emuPath,, emuPID)
  272. Run(executable . " -run=" . ident . " " . romCLI, emuPath, (If hideDemulGUI = "true" ? "min" : ""), emuPID) ; launching minimized, then restoring later hides the launch completely
  273. Sleep, 1000 ; Need a second for demul to launch, increase if yours takes longer and the emu is NOT appearing and staying minimized. This is required otherwise bezel backgrounds do not appear
  274.  
  275. DetectHiddenWindows, On
  276. Log("Module - Waiting for Demul to finish loading game.")
  277. Loop { ; looping until demul is done loading rom and gpu starts showing frames
  278. Sleep, 200
  279. WinGetTitle, winTitle, ahk_class window
  280. StringSplit, winTextSplit, winTitle, %A_Space%
  281. If ( winTextSplit5 = "gpu:" And winTextSplit6 != "0" And winTextSplit6 != "1" )
  282. Break
  283. }
  284. Log("Module - Demul finished loading game.")
  285.  
  286. If (InStr(systemName, "Gaelco") && fullscreen = "truefullscreen")
  287. Send !{Enter} ; Automatic fullscreen seems to be broken in the Gaelco driver, must alt+Enter to get fullscreen
  288.  
  289. ; This is where we calculate and maximize demul's window using our pseudo fullscreen code
  290. If fullscreen = windowedfullscreen
  291. {
  292. WinSet, Style, -0x40000, ahk_class window ; Removes the border of the game window
  293. WinSet, Style, -0xC00000, ahk_class window ; Removes the TitleBar
  294. Send, {F3} ; Removes the MenuBar
  295. MaximizeWindow("ahk_class window") ; this will take effect after you run demul once because we cannot stretch demul's screen while it is running.
  296. }
  297.  
  298. If hideDemulGUI = true
  299. { SetTimer, HideGUIWindow, Off
  300. WinSet, Transparent, Off, ahk_class window
  301. }
  302.  
  303. BezelDraw()
  304. FadeInExit()
  305. Process("WaitClose", executable)
  306.  
  307. If fullscreen = windowedfullscreen
  308. { Gui demulGUI: Destroy
  309. Log("Module - Destroyed black gui background.")
  310. }
  311.  
  312. BezelExit()
  313. FadeOutExit()
  314.  
  315. If (fullscreen = "windowedfullscreen" && maxHideTaskbar = "true") {
  316. Log("Module - Showing Taskbar and Start Button.")
  317. WinShow,ahk_class Shell_TrayWnd
  318. WinShow,Start ahk_class Button
  319. }
  320.  
  321. ExitModule()
  322.  
  323.  
  324. ; Write new controls to padDemul.ini
  325. WriteControls(file, player,push1,push2,push3,push4,push5,push6,push7,push8,service,start,coin,digitalup,digitaldown,digitalleft,digitalright,analogup,analogdown,analogleft,analogright,analogup2,analogdown2,analogleft2,analogright2) {
  326. IniWrite, %push1%, %file%, JAMMA0_%player%, PUSH1
  327. IniWrite, %push2%, %file%, JAMMA0_%player%, PUSH2
  328. IniWrite, %push3%, %file%, JAMMA0_%player%, PUSH3
  329. IniWrite, %push4%, %file%, JAMMA0_%player%, PUSH4
  330. IniWrite, %push5%, %file%, JAMMA0_%player%, PUSH5
  331. IniWrite, %push6%, %file%, JAMMA0_%player%, PUSH6
  332. IniWrite, %push7%, %file%, JAMMA0_%player%, PUSH7
  333. IniWrite, %push8%, %file%, JAMMA0_%player%, PUSH8
  334. IniWrite, %service%, %file%, JAMMA0_%player%, SERVICE
  335. IniWrite, %start%, %file%, JAMMA0_%player%, START
  336. IniWrite, %coin%, %file%, JAMMA0_%player%, COIN
  337. IniWrite, %digitalup%, %file%, JAMMA0_%player%, DIGITALUP
  338. IniWrite, %digitaldown%, %file%, JAMMA0_%player%, DIGITALDOWN
  339. IniWrite, %digitalleft%, %file%, JAMMA0_%player%, DIGITALLEFT
  340. IniWrite, %digitalright%, %file%, JAMMA0_%player%, DIGITALRIGHT
  341. IniWrite, %analogup%, %file%, JAMMA0_%player%, ANALOGUP
  342. IniWrite, %analogdown%, %file%, JAMMA0_%player%, ANALOGDOWN
  343. IniWrite, %analogleft%, %file%, JAMMA0_%player%, ANALOGLEFT
  344. IniWrite, %analogright%, %file%, JAMMA0_%player%, ANALOGRIGHT
  345. IniWrite, %analogup2%, %file%, JAMMA0_%player%, ANALOGUP2
  346. IniWrite, %analogdown2%, %file%, JAMMA0_%player%, ANALOGDOWN2
  347. IniWrite, %analogleft2%, %file%, JAMMA0_%player%, ANALOGLEFT2
  348. IniWrite, %analogright2%, %file%, JAMMA0_%player%, ANALOGRIGHT2
  349. }
  350.  
  351. MaximizeWindow(class) {
  352. Global MEmu,plugin,gpuFile
  353. Log("MaximizeWindow - Started")
  354. WinGetPos, appX, appY, appWidth, appHeight, %class%
  355. Log("MaximizeWindow - " . MEmu . " is currently x: " . appX . " y: " . appY . " w: " . appWidth . " h: " . appHeight,4)
  356. widthMaxPercenty := ( A_ScreenWidth / appWidth )
  357. heightMaxPercenty := ( A_ScreenHeight / appHeight )
  358.  
  359. If ( widthMaxPercenty < heightMaxPercenty )
  360. percentToEnlarge := widthMaxPercenty
  361. Else
  362. percentToEnlarge := heightMaxPercenty
  363.  
  364. appWidthNew := appWidth * percentToEnlarge
  365. appHeightNew := appHeight * percentToEnlarge
  366. Transform, appX, Round, %appX%
  367. Transform, appY, Round, %appY%
  368. Transform, appWidthNew, Round, %appWidthNew%
  369. Transform, appHeightNew, Round, %appHeightNew%
  370. appXPos := ( A_ScreenWidth / 2 ) - ( appWidthNew / 2 )
  371. appYPos := ( A_ScreenHeight / 2 ) - ( appHeightNew / 2 )
  372. If ( plugin = "gpuDX11" ) {
  373. IniWrite, %appWidthNew%, %gpuFile%, resolution, Width
  374. IniWrite, %appHeightNew%, %gpuFile%, resolution, Height
  375. } Else {
  376. IniWrite, %appWidthNew%, %gpuFile%, resolution, wWidth
  377. IniWrite, %appHeightNew%, %gpuFile%, resolution, wHeight
  378. }
  379. WinMove, %class%,, appXPos, appYPos
  380. Log("MaximizeWindow - " . MEmu . " resized to x: " . appX . " y: " . appY . " w: " . appWidthNew . " h: " . appHeightNew,4)
  381. Log("MaximizeWindow - Ended")
  382. }
  383.  
  384. ; Creates a default gdrCHD.ini or gdrImage.ini in your emu folder if one does not exist already.
  385. CreateDefaultGDROMIni(type) {
  386. Global emuPath
  387. defaultIni := "[main]`r`nimageFileName = `r`nopenDialog = false"
  388. IniType := If type = "chd" ? "gdrCHD.ini" : "gdrImage.ini"
  389. FileAppend, %defaultIni%, % emuPath . "\" . IniType
  390. Return emuPath . "\" . IniType
  391. }
  392.  
  393. HaltEmu:
  394. If fullscreen = truefullscreen
  395. Send !{ENTER}
  396. Return
  397. RestoreEmu:
  398. If fullscreen = truefullscreen
  399. Send !{ENTER}
  400. Return
  401.  
  402. HideGUIWindow:
  403. WinSet, Transparent, On, ahk_class window
  404. WinActivate ahk_class window ; once activated, demul starts loading the rom
  405. Return
  406.  
  407. CloseProcess:
  408. FadeOutStart()
  409. PostMessage, 0x111, 40085,,,ahk_class window ; Stop emulation first for a clean exit
  410. Sleep, 5 ; just like to give a little time before closing
  411. PostMessage, 0x111, 40080,,,ahk_class window ; Exit
  412. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement