rfancella

Xebra.ahk

Mar 10th, 2015
469
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.64 KB | None | 0 0
  1. MEmu = Xebra
  2. MEmuV = v08/15/2013
  3. MURL = http://drhell.web.fc2.com/ps1/
  4. MAuthor = djvj
  5. MVersion = 2.0.1
  6. MCRC = 30A312BA
  7. iCRC = AAB5A3D7
  8. MID = 635038268936701199
  9. MSystem = "Sony PlayStation"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; Make sure you have a Playstation BIOS file in your emulator directory. The BIOS must be named OSROM with no extension.
  13. ; On first time use, 2 memory card files will be created (BU00 and BU01)
  14. ; Will load CUE and CCD files automatically, no Daemon Tools needed, but built-in image is buggy and not suggested to use it.
  15. ; Bios will load first, then the game (takes about 5 seconds)
  16. ; If you get nothing but a black screen at boot, make sure the OSROM file is an actual BIOS. If this file is not correct, no games will work.
  17. ; The suggested bios to rename to OSROM is SCPH7502 as it is the only bios that Legend of Dragoon works with.
  18. ;
  19. ; Press F12 to enable / disable gui, change video and controller settings
  20. ; F1 Save state
  21. ; F7 Load state
  22. ; If a game does not work for you, try a different RUN setting by adding it to the Settings.ini
  23. ;
  24. ; Per-Game Run setting:
  25. ; Use HyperLaunchHQ to set module and per-game settings.
  26. ;
  27. ; Per-Game XEBRA.INI setup:
  28. ; On first run of this module, it will create the GameINIPath defined below and copy your XEBRA.INI there as your Default
  29. ; If you want different emu settings for a specific game, play the game and make your changes. After you exit, copy the XEBRA.INI to your GameINIPath and rename it to match the gam name in your xml.
  30. ; Example, if your game name is Final Fantasy VII (USA) (Disc 1), then you will name it Final Fantasy VII (USA) (Disc 1).INI
  31. ; Next time you play the game, the module will overwrite your XEBRA,INI with the new ini you made.
  32. ; If you want to reset your default INI, just delete it. The next time you run the module, it will create a new default INI for you.
  33. ;----------------------------------------------------------------------------
  34. StartModule()
  35. BezelGUI()
  36. FadeInStart()
  37.  
  38. settingsFile := modulePath . "\" . moduleName . ".ini"
  39. Fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1)
  40. GameINIPath := IniReadCheck(settingsFile, "Settings", "GameINIPath",emuPath . "\GameINIs",,1) ; This is the path to your per-game XEBRA.INI(s). (default is %emuPath%\GameINIs)
  41. defXebraINI := IniReadCheck(settingsFile, "Settings", "defXebraINI","XEBRA.default.INI",,1) ; Your default XEBRA.INI you want to use
  42. AutoGameINIs := IniReadCheck(settingsFile, "Settings", "AutoGameINIs","false",,1) ; If true, will auto-backup your XEBRA.INI to the GameINIPath and rename it to match your game. This aids in creating per-game modules quickly. WARNING, this WILL overwrite existing backed-up game INIs.
  43. perGameMemCards := IniReadCheck(settingsFile, "Settings", "PerGameMemoryCards","true",,1)
  44. memCardPath := IniReadCheck(settingsFile, "Settings", "memCardPath", EmuPath . "\memcards",,1)
  45. memCardPath := AbsoluteFromRelative(EmuPath, memCardPath)
  46. vRun := IniReadCheck(settingsFile, romName, "run","1",,1) ; default is 1 (interprete)
  47.  
  48. BezelStart()
  49.  
  50. Fullscreen := If Fullscreen = "true" ? "-FULL" : ""
  51. vRun := vRun=3 ? "-RUN3" : (vRun=2 ? "-RUN2" : "-RUN1")
  52.  
  53. ; Per-Game INIs
  54. IfNotExist, %GameINIPath%\%defXebraINI%
  55. { FileCreateDir, %GameINIPath%
  56. FileCopy, %emuPath%\XEBRA.INI, %GameINIPath%\%defXebraINI%, 1
  57. }
  58. gameINI := "-INI """ . GameINIPath . "\" . (If FileExist(GameINIPath . "\" . romName . ".INI") ? (romName . ".INI""") : (defXebraINI . """"))
  59.  
  60. ; Memory Cards
  61. If perGameMemCards = true
  62. { defaultMemCard1 := memCardPath . "\_default.BU00" ; defining default blank memory card for slot 1
  63. defaultMemCard2 := memCardPath . "\_default.BU10" ; defining default blank memory card for slot 2
  64. memCardName := If romTable[1,5] ? romTable[1,4] : romName ; defining rom name for multi disc rom
  65. romMemCard1 := memCardPath . "\" . memCardName . ".BU00" ; defining name for rom's memory card for slot 1
  66. romMemCard2 := memCardPath . "\" . memCardName . ".BU10" ; defining name for rom's memory card for slot 2
  67. memCard1 := emuPath . "\BU00"
  68. memCard2 := emuPath . "\BU10"
  69. IfNotExist, %memCardPath%
  70. FileCreateDir, %memCardPath% ; create memcard folder if it doesn't exist
  71. Loop 2 {
  72. IfNotExist, % defaultMemCard%A_Index%
  73. FileCopy, % memCard%A_Index%, % defaultMemCard%A_Index% ; if default cards do not exist, create them from the current memory cards
  74. IfExist, % romMemCard%A_Index%
  75. { FileCopy, % romMemCard%A_Index%, % memCard%A_Index% ; if rom mem cards exist, copy them over to the emuPath so they can be used in game
  76. Log("Module - Switched memory card in Slot " . A_Index . " to: " . romMemCard%A_Index%)
  77. }
  78. }
  79. }
  80.  
  81. 7z(romPath, romName, romExtension, 7zExtractPath)
  82.  
  83. ; Mount the CD using DaemonTools
  84. If ((romExtension = ".cue" || romExtension = ".ccd") && dtEnabled = "true" ) {
  85. DaemonTools("get")
  86. DaemonTools("mount",romPath . "\" . romName . romExtension)
  87. usedDT := 1
  88. Run(executable . " " . gameINI . " " . Fullscreen . " -SPTI " . dtDriveLetter . " " . vRun, emuPath)
  89. } Else
  90. Run(executable . " " . gameINI . " " . Fullscreen . " """ . romPath . "\" . romName . romExtension . """", emuPath)
  91.  
  92. WinWait("XEBRA ahk_class #32770")
  93. WinWaitActive("XEBRA ahk_class #32770")
  94.  
  95. BezelDraw()
  96. FadeInExit()
  97. Process("WaitClose",executable)
  98.  
  99. If usedDT
  100. DaemonTools("unmount")
  101.  
  102. If AutoGameINIs = true
  103. FileCopy, %emuPath%\XEBRA.INI, %GameINIPath%\%romName%.INI, 1
  104.  
  105. If perGameMemCards = true
  106. Loop 2
  107. { FileCopy, % memCard%A_Index%, % romMemCard%A_Index%, 1 ; Backup (overwrite) the mem cards to the mem card folder for next time this game is launched
  108. Log("Module - Backing up Slot " . A_Index . " memory card to: " . romMemCard%A_Index%)
  109. }
  110.  
  111. 7zCleanUp()
  112. BezelExit()
  113. FadeOutExit()
  114. ExitModule()
  115.  
  116.  
  117. MultiGame:
  118. ; msgbox % "selectedRom = " . selectedRom . "`nselected game = " . currentButton . "`nmgRomPath = " . mgRomPath . "`nmgRomExt = " . mgRomExt . "`nmgRomName = " . mgRomName
  119. ; Unmount the CD from DaemonTools
  120. If usedDT
  121. DaemonTools("unmount")
  122. Sleep, 500 ; Required to prevent DT from bugging
  123. ; Mount the CD using DaemonTools
  124. If usedDT
  125. DaemonTools("mount",selectedRom)
  126. Return
  127.  
  128. CloseProcess:
  129. FadeOutStart()
  130. ; PostMessage, 0x111, 00276,,,XEBRA ahk_class #32770 ; 2011 xebra uses this control
  131. PostMessage, 0x111, 00278,,,XEBRA ahk_class #32770 ; if we don't pause it first, xebra does not know how to exit properly.
  132. Log("Module - Sent command to pause Xebra so it can exit cleanly")
  133. Sleep, 1000
  134. ; PostMessage, 0x111, 00272,,,XEBRA ahk_class #32770 ; 2011 xebra uses this control
  135. PostMessage, 0x111, 00273,,,XEBRA ahk_class #32770 ; Exit
  136. Log("Module - Sent command to exit Xebra")
  137. Return
Advertisement
Add Comment
Please, Sign In to add comment