rfancella

Project64 (v2.x).ahk

May 11th, 2015
1,061
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.03 KB | None | 0 0
  1. MEmu = Project64
  2. MEmuV = v2.2.x
  3. MURL = http://www.pj64-emu.com/
  4. MAuthor = djvj
  5. MVersion = 2.0.3
  6. MCRC = 686F57D4
  7. iCRC = C966C2
  8. MID = 635038268918025653
  9. MSystem = "Nintendo 64"
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; Run the emu manually and hit Ctrl+T to enter Settings. On Options, check "On loading a ROM go to full screen"
  13. ; If roms don't start automatically, enabled advanced settings, and go to the Advanced and check "Start Emulation when rom is opened?"
  14. ; I like to turn off the Rom Browser by going to Settings->Rom Selection and uncheck "Use Rom Browser" (advanced settings needs to be on to see this tab)
  15. ; If you use Esc as your exit key, it could crash the emu because it also takes the emu out of fullscreen,
  16. ; You can remove Esc as a key to change fullscreen mode in the Settings->Keyboard Shortcuts, change CPU State to Game Playing (fullscreen) then Options->Full Screen and remove Esc from Current Keys
  17. ; Suggested to use Glide64 Final plugin as your graphics plugin (it does not crash on exit): https://code.google.com/p/glidehqplusglitch64/downloads/detail?name=Glide64_Final.zip&can=2&q=
  18.  
  19. ; Project64 Plugins stores their settings in the registry @ HKEY_CURRENT_USER\Software\JaboSoft\Project64 DLL or HKEY_CURRENT_USER\Software\N64 Emulation
  20.  
  21. ; Known Plugin issues:
  22. ; Video - Rice: crashes with annoying msgbox on exiting from fullscreen
  23. ;----------------------------------------------------------------------------
  24. StartModule()
  25. BezelGUI()
  26. FadeInStart()
  27.  
  28. settingsFile := modulePath . "\" . moduleName . ".ini"
  29. Fullscreen := IniReadCheck(settingsFile, "Settings", "Fullscreen","true",,1) ; Controls if emu launches fullscreen or windowed
  30. EmuVersion := IniReadCheck(settingsFile, "Settings", "EmuVersion","2.2.0.3",,1)
  31. BezelDelay := IniReadCheck(settingsFile, "Settings", "BezelDelay","5000",,1)
  32.  
  33. hideEmuObj := Object("ahk_class Project64 " . EmuVersion,1) ; Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
  34. 7z(romPath, romName, romExtension, 7zExtractPath)
  35.  
  36. BezelStart("FixResMode")
  37.  
  38. emuCfg := CheckFile(emuPath . "\Config\Project64.cfg") ; check for emu's settings file
  39. currentFullScreen := IniReadCheck(emuCfg,"default","Auto Full Screen")
  40. If ( Fullscreen != "true" And currentFullScreen = 1 )
  41. IniWrite, 0, %emuCfg%, default, Auto Full Screen
  42. Else If ( Fullscreen = "true" And currentFullScreen = 0 )
  43. IniWrite, 1, %emuCfg%, default, Auto Full Screen
  44.  
  45. HideEmuStart() ; This fully ensures windows are completely hidden even faster than winwait
  46. Run(executable . " """ . romPath . "\" . romName . romExtension . """", emuPath)
  47.  
  48. WinWait("ahk_class Project64 " . EmuVersion)
  49. WinWaitActive("ahk_class Project64 " . EmuVersion)
  50.  
  51. If (bezelEnabled = "true")
  52. Control, Hide,, msctls_statusbar321, ahk_class Project64 %EmuVersion% ; Removes the StatusBar
  53.  
  54. Sleep, BezelDelay ; required otherwise bezels don't get drawn correctly
  55.  
  56. BezelDraw()
  57. HideEmuEnd()
  58. FadeInExit()
  59. Process("WaitClose", executable)
  60. 7zCleanUp()
  61. BezelExit()
  62. FadeOutExit()
  63. ExitModule()
  64.  
  65.  
  66. HaltEmu:
  67. PostMessage, 0x111, 4152,,, ahk_class %EmulatorClass% ; Pause/Resume emulation
  68. If (fullscreen = "true") {
  69. PostMessage, 0x111, 4172,,, ahk_class %EmulatorClass% ; fullscreen part1
  70. PostMessage, 0x111, 4173,,, ahk_class %EmulatorClass% ; fullscreen part2
  71. }
  72. Return
  73. RestoreEmu:
  74. Winrestore, ahk_class %EmulatorClass%
  75. If (fullscreen = "true") {
  76. Sleep, 1000 ; couple required sleeps otherwise the emu doesn't always return to Fullscreen state
  77. PostMessage, 0x111, 4172,,, ahk_class %EmulatorClass% ; fullscreen part1
  78. Sleep, 500
  79. PostMessage, 0x111, 4173,,, ahk_class %EmulatorClass% ; fullscreen part2
  80. }
  81. PostMessage, 0x111, 4152,,, ahk_class %EmulatorClass% ; Pause/Resume emulation
  82. Return
  83.  
  84. CloseProcess:
  85. FadeOutStart()
  86. PostMessage, 0x111, 4003,,, ahk_class Project64 %EmuVersion% ; End emulation
  87. Sleep, 500
  88. ; WinClose("ahk_class Project64 2.0") ; Often leaves the process running
  89. PostMessage, 0x111, 4006,,, ahk_class Project64 %EmuVersion% ; Exit Emu
  90. Return
Advertisement
Add Comment
Please, Sign In to add comment