rfancella

Project Tempest.ahk

Jul 30th, 2014
674
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.06 KB | None | 0 0
  1. MEmu = Project Tempest
  2. MEmuV = v0.95
  3. MURL = http://pt.emuunlim.com/
  4. MAuthor = djvj/faahrev
  5. MVersion = 2.0.1
  6. MCRC = E2FBD8F1
  7. iCRC = 6FD26605
  8. mId = 635224813748790881
  9. MSystem = "Atari Jaguar","Atari Jaguar CD"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; Fullscreen mode controlled in HQ
  13. ; In the emu's gui, keep fullscreen off, otherwise the module will put it to windowed on launch.
  14. ; Set SelectGameMode if you have any problems with the emu opening the game
  15. ; Emu stores joypad config in registry (64-bit OS) @ HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Project Tempest
  16. ; Some games may not work correctly with PT and will popup with an address box. If this happens, try a different emu like Virtual Jaguar.
  17. ;----------------------------------------------------------------------------
  18. StartModule()
  19. BezelGui()
  20. FadeInStart()
  21.  
  22. settingsFile := modulePath . "\" . moduleName . ".ini"
  23. Fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1)
  24. SelectGameMode := IniReadCheck(settingsFile, "Settings", "SelectGameMode","1",,1) ; 1 = Uses a loop to detect the Edit Box has the romname and path in it. This doesn't work on all PCs, so if you get stuck at the open rom window, use mode 2. 2 = Uses a simple Ctrl+v to paste the romname and path, then press Enter to load the game.
  25. ControlDelay := IniReadCheck(settingsFile, "Settings", "ControlDelay","40",,1) ; raise this if the module is getting stuck using SelectGameMode 1
  26. KeyDelay := IniReadCheck(settingsFile, "Settings", "KeyDelay","-1",,1) ; raise this if the module is getting stuck using SelectGameMode 2
  27.  
  28. BezelStart()
  29. hideEmuObj := Object("ROM",0,"download",0) ;Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
  30. 7z(romPath, romName, romExtension, 7zExtractPath)
  31.  
  32. SetControlDelay, %ControlDelay%
  33. SetKeyDelay, %KeyDelay%
  34.  
  35. SetWinDelay, 10
  36.  
  37. Run(executable,emuPath)
  38.  
  39. WinWait("Project Tempest ahk_class PT")
  40. WinWaitActive("Project Tempest ahk_class PT")
  41.  
  42.  
  43. If ( romExtension = ".cdi" ) {
  44. WinMenuSelectItem, Project Tempest ahk_class PT,, File, Open CD Image
  45. HideEmuStart() ; This fully ensures windows are completely hidden even faster than winwait
  46. WindowText := "Open CD Image"
  47. WinWaitActive("Open CD Image ahk_class #32770")
  48. } Else {
  49. WinMenuSelectItem, Project Tempest ahk_class PT,, File, Open ROM
  50. HideEmuStart() ; This fully ensures windows are completely hidden even faster than winwait
  51. WindowText := "Open ROM File"
  52. WinWaitActive("Open ROM File ahk_class #32770")
  53. }
  54. ;Sleep just to ensure controls are accessible
  55. Sleep,1000
  56.  
  57. If ( SelectGameMode = 1 ) {
  58. Loop {
  59. ControlGetText, edit1Text, Edit1, %WindowText% ahk_class #32770
  60. ; ControlGet, Txt, Line, 1, Edit1, %WindowText% ahk_class #32770
  61. If ( edit1Text = romPath . "\" . romName . romExtension )
  62. Break
  63. Sleep, 100
  64. ControlSetText, Edit1, %romPath%\%romName%%romExtension%, Open ahk_class #32770
  65. ; WinActivate, Open ROM File ahk_class #32770
  66. }
  67. ControlSend, Button2, {Enter}, Open ahk_class #32770 ; Select Open
  68. } Else If ( SelectGameMode = 2 ) {
  69. Clipboard := romPath . "\" . romName . romExtension
  70. Send, ^v{Enter}
  71. } Else
  72. ScriptError("You did not choose a valid SelectGameMode.`nOpen the module and set the mode at the top.")
  73.  
  74. Sleep, 1000
  75.  
  76. HideEmuEnd()
  77.  
  78. ;Some roms might display download screen
  79. IfWinActive, download
  80. { ControlClick, Cancel, download
  81. Goto Error
  82. }
  83.  
  84. If Fullscreen = true
  85. Send, {Esc}
  86.  
  87. BezelDraw()
  88. FadeInExit()
  89. Process("WaitClose", executable)
  90. 7zCleanUp()
  91. BezelExit()
  92. FadeOutExit()
  93. ExitModule()
  94.  
  95.  
  96. Error:
  97. MsgBox, 0, Error, There was an error.`nTry running outside HL to see error., 2
  98. Goto CloseProcess
  99. Return
  100.  
  101. HaltEmu:
  102. Send, {Esc}
  103. Sleep, 200
  104. Return
  105. RestoreEmu:
  106. WinActivate, ahk_id %emulatorID%
  107. Send, {Esc}
  108. Return
  109.  
  110. CloseProcess:
  111. FadeOutStart()
  112. WinClose("Project Tempest ahk_class PT")
  113. Return
Advertisement
Add Comment
Please, Sign In to add comment