Guest User

yuzu module - ahk

a guest
Jan 21st, 2018
143
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. MEmu := "yuzu"
  2. MEmuV := "20180119-c8a094e"
  3. MURL := ["https://github.com/yuzu-emu/yuzu"]
  4. MAuthor := ["djvj","bleasby","tonesmalone"]
  5. MVersion := "1.0"
  6. MCRC := "9EF66675"
  7. iCRC := "86DE2C7A"
  8. MID := "635038268916444338"
  9. MSystem := ["Nintendo Switch"]
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; GitHub: https://github.com/yuzu-emu/yuzu
  13. ;
  14. ; Set the emulator exe to 'yuzu-cmd.exe'
  15. ;----------------------------------------------------------------------------
  16. StartModule()
  17. BezelGUI()
  18. FadeInStart()
  19.  
  20. primaryExe := new Emulator(emuPath . "\" . executable) ; instantiate emulator executable object
  21. primaryWindowClassName := "Qt5QWindowIcon"
  22. emuPrimaryWindow := new Window(new WindowTitle("yuzu Nightly",primaryWindowClassName)) ; instantiate primary emulator window object
  23. emuConsoleWindow := new Window(new WindowTitle(,"ConsoleWindowClass"))
  24.  
  25. Fullscreen := moduleIni.Read("Settings", "Fullscreen","true",,1)
  26.  
  27. YuzuIni := new IniFile(A_AppData . "\yuzu\config\qt-config.ini")
  28. YuzuIni.CheckFile("Could not find Yuzu's ini file. Please run Yuzu manually first and make sure that you use the module recommended emulator version.")
  29.  
  30. ; Disabling the emu exit confirmation
  31. confirmClose := YuzuIni.Read("UI", "confirmClose")
  32. If (confirmClose = "true")
  33. YuzuIni.Write("false", "UI", "confirmClose")
  34.  
  35. ; Setting the game to launch on an extra window.
  36. singleWindowMode := YuzuIni.Read("UI", "singleWindowMode")
  37. If (singleWindowMode = "true")
  38. YuzuIni.Write("false", "UI", "singleWindowMode")
  39.  
  40. BezelStart()
  41.  
  42. hideEmuObj := Object(emuConsoleWindow,0,emuPrimaryWindow,1)
  43.  
  44. 7z(romPath, romName, romExtension, SevenZExtractPath)
  45.  
  46. HideAppStart(hideEmuObj,hideEmu)
  47. primaryExe.Run("""" . romPath . "\" . romName . romExtension . """")
  48.  
  49. ; Waiting for main emu window
  50. emuPrimaryWindow.Wait()
  51. emuPrimaryWindow.WaitActive()
  52.  
  53. ; Hiding yuzu console window
  54. emuConsoleWindow.Set("Transparent",0)
  55.  
  56. ; Waiting for game to load
  57. TimeOut := 3000
  58. StartTime := A_TickCount
  59. Loop, {
  60. WinGet, IDList, List, ahk_class %primaryWindowClassName% ; get a list of all windows which match this windowTitle
  61. Loop, % IDList ; IDList set to number of matches found
  62. { id := IDList%A_Index%
  63. ControlGet, OutputVar, Hwnd,, Qt5QWindowOwnDCIcon1, ahk_id %id%
  64. If !ErrorLevel
  65. { gameWindowID := id
  66. Break
  67. }
  68. }
  69. If (TimeOut && A_TickCount - StartTime > TimeOut)
  70. Break
  71. }
  72. ; Saving id of extra emulator window to be hidden
  73. WinGet, IDList, List, ahk_class %primaryWindowClassName% ; Get a list of all windows which match this windowTitle
  74. Loop, % IDList ; IDList set to number of matches found
  75. { id := IDList%A_Index%
  76. If !(id = gameWindowID) {
  77. launchWindowID := id
  78. launchWindow := new Window(new WindowTitle(,,,launchWindowID))
  79. Break
  80. }
  81. }
  82.  
  83. ; Hiding extra emulator window
  84. If (launchWindowID) {
  85. launchWindow.Hide()
  86. }
  87.  
  88. ; Waiting for game window to be active if it is not
  89. gameWindow := new Window(new WindowTitle(,,,gameWindowID))
  90. gameWindow.WaitActive()
  91.  
  92. if (Fullscreen = "true"){ ; Creating fake full screen as the emu always launches in windowed mode
  93. WinGet emulatorID, ID, A
  94. emulatorWindow := new Window(new WindowTitle(,,,emulatorID))
  95. RLObject.hideWindowTitleBar(emulatorID)
  96. RLObject.hideWindowBorder(emulatorID)
  97. emulatorWindow.Move(0,0,A_screenWidth,A_screenHeight + 38)
  98. }
  99.  
  100. BezelDraw()
  101. HideAppEnd(hideEmuObj,hideEmu)
  102. FadeInExit()
  103. primaryExe.Process("WaitClose")
  104. 7zCleanUp()
  105. BezelExit()
  106. FadeOutExit()
  107. ExitModule()
  108.  
  109. CloseProcess:
  110. FadeOutStart()
  111. If (launchWindowID)
  112. launchWindow.Close()
  113. Else
  114. gameWindow.Close()
  115. Return
  116.  
  117. BezelLabel:
  118. disableHideBorder := "true"
  119. disableHideTitleBar := "true"
  120. disableHideToggleMenu := "true"
  121. Return
RAW Paste Data