rfancella

Project64 (v2.2.x).ahk

Apr 13th, 2015
1,542
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.94 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.1
  6. MCRC = 880A4F
  7. iCRC = 1E716C97
  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.  
  32. hideEmuObj := Object("ahk_class Project64 "EmuVersion,1) ; Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
  33. 7z(romPath, romName, romExtension, 7zExtractPath)
  34.  
  35. BezelStart("FixResMode")
  36.  
  37. emuCfg := CheckFile(emuPath . "\Config\Project64.cfg") ; check for emu's settings file
  38. currentFullScreen := IniReadCheck(emuCfg,"default","Auto Full Screen")
  39. If ( Fullscreen != "true" And currentFullScreen = 1 )
  40. IniWrite, 0, %emuCfg%, default, Auto Full Screen
  41. Else If ( Fullscreen = "true" And currentFullScreen = 0 )
  42. IniWrite, 1, %emuCfg%, default, Auto Full Screen
  43.  
  44. HideEmuStart() ; This fully ensures windows are completely hidden even faster than winwait
  45. Run(executable . " """ . romPath . "\" . romName . romExtension . """", emuPath)
  46.  
  47. WinWait("ahk_class Project64 "EmuVersion)
  48. WinWaitActive("ahk_class Project64 "EmuVersion)
  49.  
  50. If (bezelEnabled = "true")
  51. Control, Hide,, msctls_statusbar321, ahk_class Project64 %EmuVersion% ; Removes the StatusBar
  52.  
  53. Sleep, 1000 ; required otherwise bezels don't get drawn correctly
  54.  
  55. BezelDraw()
  56. HideEmuEnd()
  57. FadeInExit()
  58. Process("WaitClose", executable)
  59. 7zCleanUp()
  60. BezelExit()
  61. FadeOutExit()
  62. ExitModule()
  63.  
  64.  
  65. HaltEmu:
  66. PostMessage, 0x111, 4152,,, ahk_class %EmulatorClass% ; Pause/Resume emulation
  67. If (fullscreen = "true") {
  68. PostMessage, 0x111, 4172,,, ahk_class %EmulatorClass% ; fullscreen part1
  69. PostMessage, 0x111, 4173,,, ahk_class %EmulatorClass% ; fullscreen part2
  70. }
  71. Return
  72. RestoreEmu:
  73. Winrestore, ahk_class %EmulatorClass%
  74. If (fullscreen = "true") {
  75. Sleep, 1000 ; couple required sleeps otherwise the emu doesn't always return to Fullscreen state
  76. PostMessage, 0x111, 4172,,, ahk_class %EmulatorClass% ; fullscreen part1
  77. Sleep, 500
  78. PostMessage, 0x111, 4173,,, ahk_class %EmulatorClass% ; fullscreen part2
  79. }
  80. PostMessage, 0x111, 4152,,, ahk_class %EmulatorClass% ; Pause/Resume emulation
  81. Return
  82.  
  83. CloseProcess:
  84. FadeOutStart()
  85. PostMessage, 0x111, 4003,,, ahk_class Project64 %EmuVersion% ; End emulation
  86. Sleep, 500
  87. ; WinClose("ahk_class Project64 2.0") ; Often leaves the process running
  88. PostMessage, 0x111, 4006,,, ahk_class Project64 %EmuVersion% ; Exit Emu
  89. Return
Advertisement
Add Comment
Please, Sign In to add comment