rfancella

PSXfin.ahk

Mar 10th, 2015
512
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.70 KB | None | 0 0
  1. iCRC = 1E716C97
  2. MEmu = PSXfin
  3. MEmuV = v1.13
  4. MURL = http://psxemulator.gazaxian.com/
  5. MAuthor = brolly & djvj
  6. MVersion = 2.0.2
  7. MCRC = 7D7FF096
  8. MID = 635038268919606980
  9. MSystem = "Sony PlayStation"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ;----------------------------------------------------------------------------
  13. StartModule()
  14. BezelGUI()
  15. FadeInStart()
  16.  
  17. settingsFile := modulePath . "\" . moduleName . ".ini"
  18. fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1)
  19. perGameMemCards := IniReadCheck(settingsFile, "Settings", "PerGameMemoryCards","true",,1)
  20. 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.
  21. 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.
  22. memCardPath := IniReadCheck(settingsFile, "Settings", "memCardPath", EmuPath . "\cards",,1)
  23. memCardPath := AbsoluteFromRelative(EmuPath, memCardPath)
  24.  
  25. PSXfincfg := checkFile(emuPath . "\psx.ini", "Could not find PSXfin ini. Please run PSXfin manually first and each of it's settings sections so the appropriate inis are created for you: " . emuPath . "\psx.ini")
  26.  
  27. If dtEnabled = true
  28. DaemonTools("get") ; populates the dtDriveLetter variable with the drive letter to your scsi or dt virtual drive
  29.  
  30. BezelStart()
  31.  
  32. ; Memory Cards
  33. defaultMemCard1 := memCardPath . "\_default_001.mcr" ; defining default blank memory card for slot 1
  34. defaultMemCard2 := memCardPath . "\_default_002.mcr" ; defining default blank memory card for slot 2
  35. memCardName := If romTable[1,5] ? romTable[1,4] : romName ; defining rom name for multi disc rom
  36. romMemCard1 := memCardPath . "\" . memCardName . "_001.mcr" ; defining name for rom's memory card for slot 1
  37. romMemCard2 := memCardPath . "\" . memCardName . "_002.mcr" ; defining name for rom's memory card for slot 2
  38. memcardType := If perGameMemCards = "true" ? "rom" : "default" ; define the type of memory card we will create in the below loop
  39. IfNotExist, %memCardPath%
  40. FileCreateDir, %memCardPath% ; create memcard folder if it doesn't exist
  41.  
  42. Loop 2
  43. { IfNotExist, % %memcardType%MemCard%A_Index%
  44. { FileAppend,, % %memcardType%MemCard%A_Index% ; create a new blank memory card if one does not exist
  45. Log("Module - Created a new blank memory card in Slot " . A_Index . ":" . %memcardType%MemCard%A_Index%)
  46. }
  47. ; Now disable a memory card if required for the game to boot properly
  48. If (disableMemoryCard%A_Index% = "true")
  49. {
  50. IniWrite, "", %PSXfincfg%, Cards, Card%A_Index%
  51. } ELSE {
  52. memcardOut := %memcardType%MemCard%A_Index%
  53. IniWrite, %memcardOut%, %PSXfincfg%, Cards, Card%A_Index%
  54. }
  55. }
  56.  
  57. hideEmuObj := Object("ahk_class ConsoleWindowClass",0,"pSX ahk_class pSX",1) ; Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
  58. 7z(romPath, romName, romExtension, 7zExtractPath)
  59.  
  60. fullscreen := If fullscreen = "true" ? " -f" : ""
  61.  
  62. HideEmuStart() ; This fully ensures windows are completely hidden even faster than winwait
  63.  
  64. ; Mount the CD using DaemonTools
  65. If ( romExtension = ".cue" && dtEnabled = "true" )
  66. { DaemonTools("mount",romPath . "\" . romName . romExtension)
  67. Run(executable . fullscreen . " " . dtDriveLetter . ":", emuPath)
  68. } Else {
  69. Log("Module RunWait - " . emuPath "\" . executable . " -f """ . romPath . "\" . romName . romExtension . """")
  70. Run(executable . fullscreen . " """ . romPath . "\" . romName . romExtension . """", emuPath)
  71. }
  72.  
  73. SetTitleMatchMode, slow
  74. WinWait("pSX ahk_class pSX")
  75. WinWaitActive("pSX ahk_class pSX")
  76.  
  77. If fullscreen = true
  78. { SetKeyDelay(50)
  79. Send, {Alt Down}{Enter Down}{Enter Up}{Alt Up}
  80. }
  81.  
  82. BezelDraw()
  83. HideEmuEnd()
  84. FadeInExit()
  85. Process("WaitClose", executable)
  86.  
  87. If ( romExtension = ".cue" && dtEnabled = "true" )
  88. DaemonTools("unmount")
  89.  
  90. 7zCleanUp()
  91. BezelExit()
  92. FadeOutExit()
  93. ExitModule()
  94.  
  95.  
  96. MultiGame:
  97. ; msgbox % "selectedRom = " . selectedRom . "`nselected game = " . currentButton . "`nmgRomPath = " . mgRomPath . "`nmgRomExt = " . mgRomExt . "`nmgRomName = " . mgRomName
  98. ; Unmount the CD from DaemonTools
  99. If ( romExtension = ".cue" && dtEnabled = "true" )
  100. DaemonTools("unmount")
  101. Sleep, 500 ; Required to prevent DT from bugging
  102. ; Mount the CD using DaemonTools
  103. If ( romExtension = ".cue" && dtEnabled = "true" )
  104. DaemonTools("mount",selectedRom)
  105. Return
  106.  
  107. RestoreEmu:
  108. SetWinDelay, 50
  109. If fullscreen = true
  110. { SetKeyDelay(50)
  111. Send, {Alt Down}{Enter Down}{Enter Up}{Alt Up}
  112. }
  113. Return
  114.  
  115. CloseProcess:
  116. FadeOutStart()
  117. WinClose("pSX ahk_class pSX")
  118. Return
Advertisement
Add Comment
Please, Sign In to add comment