Advertisement
djvj

Untitled

Jan 10th, 2016
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.32 KB | None | 0 0
  1. MEmu = ePSXe
  2. MEmuV = v1.9.0
  3. MURL = http://www.epsxe.com/
  4. MAuthor = djvj & Shateredsoul & brolly
  5. MVersion = 2.1.2
  6. MCRC = 6CCA82E7
  7. iCRC = 5C02FF87
  8. MID = 635038268888210842
  9. MSystem = "Sony PlayStation"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; epsxe can't deal with bin/cue dumps with more than one audio track if you load the cue file directly.
  13. ; For these to work you must mount the cue on Virtual Drive and let epsxe boot the game from there.
  14. ; You need to make sure you have a SCSI virtual drive on Daemon Tools, NOT a DT one.
  15. ; On first time use, 2 default memory card files will be created called _default_001.mcr and _default_002.mcr in emuPath\memcards
  16. ;
  17. ; Extract all your BIOS files to the bios subfolder. Then goto Config->Bios and select the bios you wish to use.
  18. ;
  19. ; Go to Config->Video then choose a plugin. Pete's OpenGL line is preffered
  20. ; Click Configure (under video plugin) and choose fullscreen and set your desired resolution. Video options/results will vary based on the plugin you choose.
  21. ;
  22. ; If you are using images with multiple tracks, set your extension to cue (make sure all your cues are correctly pointing to their tracks).
  23. ; Go to Config->Cdrom->Configure button and select the drive letter associated with your Virtual Drive virtual drive.
  24. ;
  25. ; ePSXe will ONLY close via Escape, it will bug out with all other forms of closing a normal program. Do not edit CloseProcess!
  26. ;
  27. ; TurboButton will only work with DX7 video plugin. Turbo key by Hypnoziz
  28. ;
  29. ; Requires at least Libs\Shared.ahk v1.1.3
  30. ;
  31. ; epsxe stores its settings in the registry @ HKEY_CURRENT_USER\Software\epsxe\config
  32. ; plugins store their settings in the registry @ HKEY_CURRENT_USER\Software\Vision Thing\PSEmu Pro
  33. ;----------------------------------------------------------------------------
  34. StartModule()
  35. BezelGUI()
  36. FadeInStart()
  37.  
  38. settingsFile := modulePath . "\" . moduleName . ".ini"
  39.  
  40. ; Plugin settings are overridable per rom.
  41. GfxPlugin := IniReadCheck(settingsFile, "Pete's OpenGL2 GPU Plugin|" . romName, "Graphics_Plugin","PeteOpenGL2",,1) ; Use the gfx plugin name
  42. HiresX := IniReadCheck(settingsFile, "Pete's OpenGL2 GPU Plugin|" . romName, "Internal_X_Resolution",0,,1)
  43. HiresY := IniReadCheck(settingsFile, "Pete's OpenGL2 GPU Plugin|" . romName, "Internal_Y_Resolution",0,,1)
  44. KeepRatio := IniReadCheck(settingsFile, "Pete's OpenGL2 GPU Plugin|" . romName, "Stretching_Mode",0,,1)
  45. NoRenderTexture := IniReadCheck(settingsFile, "Pete's OpenGL2 GPU Plugin|" . romName, "Render_Mode",0,,1)
  46. FilterType := IniReadCheck(settingsFile, "Pete's OpenGL2 GPU Plugin|" . romName, "Texture_Filtering",0,,1)
  47. HiResTextures := IniReadCheck(settingsFile, "Pete's OpenGL2 GPU Plugin|" . romName, "Hi-Res_Textures",0,,1)
  48. TWinShader := IniReadCheck(settingsFile, "Pete's OpenGL2 GPU Plugin|" . romName, "Pixel_Shader","false",,1)
  49. OffscreenDrawing := IniReadCheck(settingsFile, "Pete's OpenGL2 GPU Plugin|" . romName, "Offscreen_Drawing",0,,1)
  50. FrameTexType := IniReadCheck(settingsFile, "Pete's OpenGL2 GPU Plugin|" . romName, "Framebuffer_Effects",0,,1)
  51. FrameUpload := IniReadCheck(settingsFile, "Pete's OpenGL2 GPU Plugin|" . romName, "Framebuffer_Uploads",0,,1)
  52. ShaderDir := IniReadCheck(settingsFile, "Pete's OpenGL2 GPU Plugin|" . romName, "Shader_Dir",,,1)
  53. FullscreenShader := IniReadCheck(settingsFile, "Pete's OpenGL2 GPU Plugin|" . romName, "Fullscreen_Shader",0,,1)
  54. FSShaderLevel := IniReadCheck(settingsFile, "Pete's OpenGL2 GPU Plugin|" . romName, "Shader_Level",1,,1)
  55.  
  56. Fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1)
  57. turboButton := IniReadCheck(settingsFile, "Settings", "turboButton","F12",,1) ; Key mapping for turbo button assignment
  58. slowBoot := IniReadCheck(settingsFile, "Settings", "slowBoot","false",,1) ; If true, force emulator to show bios screen at boot
  59. enableAnalog := IniReadCheck(settingsFile, "Settings|" . romName, "EnableAnalog","true",,1) ; If true, enables analog controls at start of game for you, so you don't have to press F5
  60. hideEpsxeGUIs := IniReadCheck(settingsFile, "Settings", "HideePSXeGUIs","true",,1)
  61. perGameMemCards := IniReadCheck(settingsFile, "Settings", "PerGameMemoryCards","true",,1)
  62. disableMemoryCard1 := IniReadCheck(settingsFile, romName, "DisableMemoryCard1","false",,1) ; If true, disables memory card 1 for this game. Some games may not boot if both memory cards are inserted.
  63. disableMemoryCard2 := IniReadCheck(settingsFile, romName, "DisableMemoryCard2","false",,1) ; If true, disables memory card 2 for this game. Some games may not boot if both memory cards are inserted.
  64. memCardPath := IniReadCheck(settingsFile, "Settings", "MemCardPath", emuPath . "\memcards",,1)
  65. memCardPath := AbsoluteFromRelative(emuPath, memCardPath)
  66.  
  67. ; dialogOpen := i18n("dialog.open") ; Looking up local translation
  68. dialogOpen := "Open" ; apparently ePSXe doesnt support multiple languages, forcing this until it does
  69.  
  70. BezelStart()
  71.  
  72. ; Set the GPU plugin and it's settings.
  73. WriteReg("SZ", "epsxe\config", "VideoPlugin", "gpu" . GfxPlugin . ".dll")
  74.  
  75. ; TODO: The other video plugins might use the same settings and even if they don't, it probably won't hurt
  76. ; to have these values in the registry for the selected plugin.
  77. ; Only apply these settings if the user selected the OpenGL2 plugin.
  78. If (GfxPlugin = "PeteOpenGL2") {
  79. WriteReg("DWORD", "Vision Thing\PSEmu Pro\GPU\" . GfxPlugin, "HiresX", HiresX)
  80. WriteReg("DWORD", "Vision Thing\PSEmu Pro\GPU\" . GfxPlugin, "HiresY", HiresY)
  81. WriteReg("DWORD", "Vision Thing\PSEmu Pro\GPU\" . GfxPlugin, "KeepRatio", KeepRatio)
  82. WriteReg("DWORD", "Vision Thing\PSEmu Pro\GPU\" . GfxPlugin, "NoRenderTexture", NoRenderTexture)
  83. WriteReg("DWORD", "Vision Thing\PSEmu Pro\GPU\" . GfxPlugin, "FilterType", FilterType)
  84. WriteReg("DWORD", "Vision Thing\PSEmu Pro\GPU\" . GfxPlugin, "HiResTextures", HiResTextures)
  85. TWinShader := If TWinShader = "true" ? 1 : 0 ; Convert texture shader bool into an int before writing to the registry
  86. WriteReg("DWORD", "Vision Thing\PSEmu Pro\GPU\" . GfxPlugin, "TWinShader", TWinShader)
  87. WriteReg("DWORD", "Vision Thing\PSEmu Pro\GPU\" . GfxPlugin, "OffscreenDrawing", OffscreenDrawing)
  88. WriteReg("DWORD", "Vision Thing\PSEmu Pro\GPU\" . GfxPlugin, "FrameTexType", FrameTexType)
  89. WriteReg("DWORD", "Vision Thing\PSEmu Pro\GPU\" . GfxPlugin, "FrameUpload", FrameUpload)
  90.  
  91. ; If the shader directory isn't set then disable the other shader settings if the fullscreen shader is 3 or 5.
  92. If (ShaderDir = "") {
  93. If (FullscreenShader in 3, 5) {
  94. WriteReg("DWORD", "Vision Thing\PSEmu Pro\GPU\" . GfxPlugin, "FullscreenShader", 0)
  95. WriteReg("DWORD", "Vision Thing\PSEmu Pro\GPU\" . GfxPlugin, "FSShaderLevel", 0)
  96. } Else {
  97. WriteReg("DWORD", "Vision Thing\PSEmu Pro\GPU\" . GfxPlugin, "FullscreenShader", FullscreenShader)
  98. WriteReg("DWORD", "Vision Thing\PSEmu Pro\GPU\" . GfxPlugin, "FSShaderLevel", FSShaderLevel)
  99. }
  100. } Else {
  101. ShaderDir := GetFullName(ShaderDir) . "\"
  102. ; TODO: Should check that the shader folder/files exist.
  103. WriteReg("SZ", "Vision Thing\PSEmu Pro\GPU\" . GfxPlugin, "ShaderDir", ShaderDir)
  104. ; TODO: Probably should check that FullscreenShader is set to 3 or 5.
  105. WriteReg("DWORD", "Vision Thing\PSEmu Pro\GPU\" . GfxPlugin, "FullscreenShader", FullscreenShader)
  106. WriteReg("DWORD", "Vision Thing\PSEmu Pro\GPU\" . GfxPlugin, "FSShaderLevel", FSShaderLevel)
  107.  
  108. ; Turn these settings off because they'll blur/alter the image before it gets to the shader.
  109. WriteReg("DWORD", "Vision Thing\PSEmu Pro\GPU\" . GfxPlugin, "FilterType", 0)
  110. WriteReg("DWORD", "Vision Thing\PSEmu Pro\GPU\" . GfxPlugin, "HiResTextures", 0)
  111. WriteReg("DWORD", "Vision Thing\PSEmu Pro\GPU\" . GfxPlugin, "FullscreenBlur", 0)
  112. }
  113. }
  114.  
  115. ; Changes fullscreen setting for the gpu plugin.
  116. If (Fullscreen = "true") {
  117. WriteReg("DWORD", "Vision Thing\PSEmu Pro\GPU\" . GfxPlugin, "WindowMode", 0)
  118. } Else {
  119. WriteReg("DWORD", "Vision Thing\PSEmu Pro\GPU\" . GfxPlugin, "WindowMode", 1)
  120.  
  121. If (bezelEnabled = "true") {
  122. winSize := bezelScreenHeight * 65536 + bezelScreenWidth ; convert desired windowed resolution to Decimal
  123. WriteReg("DWORD", "Vision Thing\PSEmu Pro\GPU\" . GfxPlugin, "WinSize", winSize)
  124. }
  125. }
  126.  
  127. ; Memory Cards
  128.  
  129. defaultMemCard1 := memCardPath . "\_default_001.mcr" ; defining default blank memory card for slot 1
  130. defaultMemCard2 := memCardPath . "\_default_002.mcr" ; defining default blank memory card for slot 2
  131. memCardName := If romTable[1,5] ? romTable[1,4] : romName ; defining rom name for multi disc rom
  132. romMemCard1 := memCardPath . "\" . memCardName . "_001.mcr" ; defining name for rom's memory card for slot 1
  133. romMemCard2 := memCardPath . "\" . memCardName . "_002.mcr" ; defining name for rom's memory card for slot 2
  134. memcardType := If perGameMemCards = "true" ? "rom" : "default" ; define the type of memory card we will create in the below loop
  135. If !FileExist(memCardPath)
  136. FileCreateDir, %memCardPath% ; create memcard folder if it doesn't exist
  137. Loop 2
  138. { If !FileExist(%memcardType%MemCard%A_Index%)
  139. { FileAppend,, % %memcardType%MemCard%A_Index% ; create a new blank memory card if one does not exist
  140. Log("Module - Created a new blank memory card in Slot " . A_Index . ":" . %memcardType%MemCard%A_Index%)
  141. }
  142. WriteReg("SZ", "epsxe\config", "Memcard" . A_Index, %memcardType%MemCard%A_Index%)
  143.  
  144. ; Now disable a memory card if required for the game to boot properly
  145. memcard%A_Index%Enable := ReadReg("epsxe\config", "Memcard" . A_Index . "Enable")
  146. If (disableMemoryCard%A_Index% = "true")
  147. WriteReg("SZ", "epsxe\config", "Memcard" . A_Index . "Enable", 0)
  148. Else
  149. WriteReg("SZ", "epsxe\config", "Memcard" . A_Index . "Enable", 1)
  150. }
  151.  
  152. hideEmuObj := Object(dialogOpen . " PSX ISO ahk_class #32770",0,"ahk_class EPSXGUI",0,"ePSXe ahk_class EPSX",1) ; Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
  153. 7z(romPath, romName, romExtension, 7zExtractPath)
  154.  
  155. epsxeExtension := InStr(".ccd|.cue|.mds|.img|.iso|.pbp",romExtension) ; the psx extensions supported by the emu
  156.  
  157. SetKeyDelay(50)
  158. ; turboButton := xHotKeyVarEdit(turboButton,"turboButton","~","Add")
  159. xHotKeywrapper(turboButton,"TurboProcess")
  160. turboEnabled := 0 ; Initialize turbo state
  161.  
  162. RomTableCheck() ; make sure romTable is created already so the next line can calculate correctly
  163. noGUI := If romTable.MaxIndex() ? "" : " -nogui" ; multidisc games will not use nogui because we need to select an option in epsxe's gui to swap discs
  164. slowBoot := If slowBoot = "true" ? " -slowboot" : ""
  165.  
  166. If (noGUI = "" && hideEpsxeGUIs = "true") { ; for multi disc games only
  167. Log("Module - Starting the HideGUIWindow timer to prevent them from showing")
  168. SetTimer, HideGUIWindow, 10 ; start watching for gui window so it can be completely hidden
  169. }
  170.  
  171. ; Mount the CD using Virtual Drive
  172. If (epsxeExtension && vdEnabled = "true") {
  173. Log("Module - Virtual Drive is enabled and " . romExtension . " is a supported Virtual Drive extension")
  174.  
  175. VirtualDrive("get") ; populates the vdDriveLetter variable with the drive letter to your scsi or dt virtual drive
  176. currentCDRomAscii := ReadReg("epsxe\config", "CdromLetter") ; read the current setting for ePSXe's cdrom it is using
  177. currentCDRomLetter := Chr(currentCDRomAscii) ; converts the ascii code to a letter
  178.  
  179. If (currentCDRomLetter = "")
  180. Log("Module - " . MEmu . " is not configured with a CDRom Drive")
  181. Else If (currentCDRomAscii = 48)
  182. Log("Module - " . MEmu . " is configured to read from the FirstCdrom Drive and will be updated to a proper letter instead")
  183. Else
  184. Log("Module - " . MEmu . " is configured to read from Drive " . currentCDRomLetter . ":")
  185.  
  186. If (currentCDRomLetter != vdDriveLetter) {
  187. newCDRomAscii := Asc(vdDriveLetter) ; converts the letter to an ascii code
  188. WriteReg("SZ", "epsxe\config", "CdromLetter", newCDRomAscii)
  189. Log("Module - Updated " . MEmu . " to use Drive " . vdDriveLetter . ": for all future launches.",2)
  190. } Else
  191. Log("Module - " . MEmu . " is configured to use the correct drive already")
  192.  
  193. VirtualDrive("mount",romPath . "\" . romName . romExtension)
  194. HideEmuStart() ; This fully ensures windows are completely hidden even faster than winwait
  195. errorLvl := Run(executable . noGUI . slowBoot, emuPath)
  196. usedVD := 1
  197. } Else {
  198. If (romExtension = ".pbp") {
  199. Log("Module - Sending rom to emu directly with the load binary directive.")
  200. HideEmuStart() ; This fully ensures windows are completely hidden even faster than winwait
  201. errorLvl := Run(executable . noGUI . slowBoot . " -loadbin """ . romPath . "\" . romName . romExtension . """", emuPath)
  202. } Else {
  203. Log("Module - Sending rom to emu directly as Virtual Drive is not enabled or " . romExtension . " is not a supported Virtual Drive extension.")
  204. HideEmuStart() ; This fully ensures windows are completely hidden even faster than winwait
  205. errorLvl := Run(executable . noGUI . slowBoot . " -loadiso """ . romPath . "\" . romName . romExtension . """", emuPath)
  206. }
  207. }
  208. If errorLvl
  209. ScriptError("Error launching " . executable . "`, closing module.")
  210.  
  211. epsxeLaunchType := If usedVD ? "CDROM" : "ISO" ; determines which command gets sent to epsxe
  212.  
  213. If (noGUI = "") { ; for multi disc games only
  214. Log("Module - " . romName . " is a multi-disc game, so launching " . MEmu . " with GUI enabled so swapping can occur.")
  215. WinWait("ePSXe ahk_class EPSXGUI")
  216. If (epsxeLaunchType = "CDROM") {
  217. Log("Module - Telling ePSXe to run a CDROM")
  218. PostMessage, 0x111, 40001,,,ahk_class EPSXGUI ; Run CDROM
  219. } Else {
  220. Log("Module - Telling ePSXe to run an ISO")
  221. PostMessage, 0x111, 40003,,,ahk_class EPSXGUI ; Run ISO
  222. }
  223. } Else
  224. Log("Module - " . romName . " is not a multi-disc game, so launching " . MEmu . " with GUI disabled.")
  225.  
  226. If (!usedVD && noGUI = "") { ; for some reason, epsxe still shows an open psx iso box even though it was provided on the run command when we don't also send -nogui. This handles loading the rom.
  227. Log("Module - " . MEmu . " GUI and DT support are both disabled. Loading rom via the Open PSX ISO window.")
  228. OpenROM(dialogOpen . " PSX ISO ahk_class #32770", romPath . "\" . romName . romExtension)
  229. }
  230.  
  231. WinWait("ePSXe ahk_class EPSX")
  232. WinWaitActive("ePSXe ahk_class EPSX")
  233.  
  234. If (noGUI = "" && hideEpsxeGUIs = "true") { ; for multi disc games only
  235. Log("Module - Stopping the HideGUIWindow timer")
  236. SetTimer, HideGUIWindow, Off
  237. }
  238.  
  239. BezelDraw()
  240. HideEmuEnd()
  241. FadeInExit()
  242.  
  243. If (enableAnalog = "true")
  244. { Sleep, 1500 ; necessary otherwise epsxe doesn't register the key
  245. Send, {F5 down}{F5 up}
  246. }
  247.  
  248. Process("WaitClose", executable)
  249.  
  250. If usedVD
  251. VirtualDrive("unmount")
  252.  
  253. 7zCleanUp()
  254. BezelExit()
  255. FadeOutExit()
  256. ExitModule()
  257.  
  258.  
  259. ReadReg(var1, var2) {
  260. RegRead, regValue, HKEY_CURRENT_USER, Software\%var1%, %var2%
  261. Return %regValue%
  262. }
  263.  
  264. WriteReg(type, var1, var2, var3) {
  265. RegWrite, REG_%type%, HKEY_CURRENT_USER, Software\%var1%, %var2%, %var3%
  266. }
  267.  
  268. TurboProcess:
  269. If (turboEnabled = 0) {
  270. Send, {Delete}{End}{End}{Delete}
  271. turboEnabled := 1
  272. } Else {
  273. Send, {Delete}{End}{Delete}
  274. turboEnabled := 0
  275. }
  276. Return
  277.  
  278. HaltEmu:
  279. If (Fullscreen = "true")
  280. { PostMessage, 0x111, 40001,,,ahk_class EPSXGUI ; Go fullscreen, same as alt+enter
  281. Sleep, 200
  282. }
  283. Return
  284.  
  285. MultiGame:
  286. ; msgbox % "selectedRom = " . selectedRom . "`nselected game = " . currentButton . "`nmgRomPath = " . mgRomPath . "`nmgRomExt = " . mgRomExt . "`nmgRomName = " . mgRomName
  287. SetKeyDelay(50)
  288. If usedVD
  289. { VirtualDrive("unmount") ; Unmount the CD from Virtual Drive
  290. Sleep, 500 ; Required to prevent your Virtual Drive app from bugging
  291. VirtualDrive("mount",selectedRom) ; Mount the CD using Virtual Drive
  292. }
  293. ControlSend,, {ESC down}{ESC Up}, ahk_class EPSX ; this exits the game window and brings back ePSXe's gui menu window
  294. If (hideEpsxeGUIs = "true")
  295. { Log("Module - Starting the HideGUIWindow timer to prevent them from showing")
  296. SetTimer, HideGUIWindow, 10
  297. }
  298.  
  299. If (epsxeLaunchType = "CDROM") {
  300. Log("Module - Telling ePSXe to swap to another CDROM")
  301. PostMessage, 0x111, 40005,,,ahk_class EPSXGUI ; Change Disc CDROM
  302. } Else {
  303. Log("Module - Telling ePSXe to swap to another ISO")
  304. PostMessage, 0x111, 40006,,,ahk_class EPSXGUI ; Change Disc ISO
  305. }
  306.  
  307. If usedVD
  308. { WinWait("Change Disc Option ahk_class #32770")
  309. ControlSend,Button1,{Enter},Change Disc Option ahk_class #32770
  310. } Else {
  311. OpenROM(dialogOpen . " PSX ISO ahk_class #32770", selectedRom)
  312. }
  313. If hideEpsxeGUIs := "true"
  314. { Log("Module - Stopping the HideGUIWindow timer")
  315. SetTimer, HideGUIWindow, off
  316. }
  317. ; If BezelEnabled
  318. ; BezelDraw()
  319. Return
  320.  
  321. RestoreEmu:
  322. WinActivate, ahk_id %emulatorID%
  323. If (Fullscreen = "true")
  324. PostMessage, 0x111, 40001,,,ahk_class EPSXGUI ; Go fullscreen, same as alt+enter
  325. Return
  326.  
  327. HideGUIWindow:
  328. WinSet, Transparent, On, ePSXe ahk_class EPSXGUI
  329. WinSet, Transparent, On, Open PSX ISO ahk_class #32770 ; when not using DT
  330. WinSet, Transparent, On, Change Disc Option ahk_class #32770 ; when using DT
  331. Return
  332.  
  333. CloseProcess:
  334. FadeOutStart()
  335. SetWinDelay, 50
  336. Log("Module - Sending Escape to close emulator")
  337. If (noGUI = "") { ; for multi disc games only
  338. PostMessage, 0x111, 40007,,,ahk_class EPSX ; Exit ePSXe, only works when guis are used though, basically when multigame supported games are launched
  339. WinWait("ePSXe ahk_class EPSXGUI")
  340. WinClose("ePSXe ahk_class EPSXGUI")
  341. } Else
  342. ControlSend,, {Esc down}{Esc up}, ePSXe ahk_class EPSX ; DO NOT CHANGE
  343. Return
  344.  
  345. ; PostMessage, 0x111, 40008,,,ahk_class EPSXGUI ; Continue
  346. ; PostMessage, 0x111, 40009,,,ahk_class EPSXGUI ; Reset
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement