Advertisement
djvj

Citra Module

Feb 12th, 2017
1,562
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.47 KB | None | 0 0
  1. MEmu := "Citra"
  2. MEmuV := "2016-11-23"
  3. MURL := ["http://citra-emu.org/"]
  4. MAuthor := ["djvj","bleasby"]
  5. MVersion := "1.0.1"
  6. MCRC := "B2CEA0A2"
  7. iCRC := "8131AB6F"
  8. MID := "635740704032217117"
  9. MSystem := ["Nintendo 3DS"]
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; Roms must be decrypted to run in the emu
  13. ; See here for a guide on decrypting games you own: https://gbatemp.net/threads/tutorial-how-to-decrypt-extract-rebuild-3ds-roms-run-xy-oras-without-update.383055/
  14. ;----------------------------------------------------------------------------
  15. StartModule()
  16. BezelGUI()
  17. FadeInStart()
  18.  
  19. primaryExe := new Emulator(emuPath . "\" . executable) ; instantiate emulator executable object
  20. primaryWindowClassName := "Qt5QWindowIcon"
  21. emuPrimaryWindow := new Window(new WindowTitle("Citra",primaryWindowClassName)) ; instantiate primary emulator window object
  22. emuConsoleWindow := new Window(new WindowTitle(,"ConsoleWindowClass"))
  23.  
  24. Fullscreen := moduleIni.Read("Settings", "Fullscreen","true",,1)
  25. bezelTopOffset := moduleIni.Read("Settings", "Bezel_Top_Offset","30",,1)
  26. bezelBottomOffset := moduleIni.Read("Settings", "Bezel_Bottom_Offset","8",,1)
  27. bezelRightOffset := moduleIni.Read("Settings", "Bezel_Right_Offset", "8",,1)
  28. bezelLeftOffset := moduleIni.Read("Settings", "Bezel_Left_Offset", "8",,1)
  29.  
  30. CitraUserFolder := new Folder(emuPath . "\user")
  31. If CitraUserFolder.Exist() {
  32. RLLog.Info("Module - Citra is using portable mode due to the ""user"" folder that exists in the emu directory: " . CitraUserFolder.FilePath)
  33. CitraIni := new IniFile(emuPath . "\user\config\qt-config.ini")
  34. } Else {
  35. RLLog.Info("Module - Citra is not using portable mode due to no ""user"" folder existing in the emu directory.")
  36. CitraIni := new IniFile(A_AppData . "\Citra\config\qt-config.ini")
  37. }
  38. CitraIni.CheckFile("Could not find Citra's ini file. Please run Citra manually first and make sure that you use the module recomended emulator version.")
  39.  
  40. ; Disabling the emu exit confirmation
  41. confirmClose := CitraIni.Read("UI", "confirmClose")
  42. If (confirmClose = "true")
  43. CitraIni.Write("false", "UI", "confirmClose")
  44.  
  45. ; Setting the game to launch on an extra window.
  46. singleWindowMode := CitraIni.Read("UI", "singleWindowMode")
  47. If (singleWindowMode = "true")
  48. CitraIni.Write("false", "UI", "singleWindowMode")
  49.  
  50. BezelStart()
  51.  
  52. hideEmuObj := Object(emuConsoleWindow,0,emuPrimaryWindow,1)
  53. 7z(romPath, romName, romExtension, SevenZExtractPath)
  54.  
  55. HideAppStart(hideEmuObj,hideEmu)
  56. primaryExe.Run("""" . romPath . "\" . romName . romExtension . """")
  57.  
  58. ; Waiting for main emu window
  59. emuPrimaryWindow.Wait()
  60. emuPrimaryWindow.WaitActive()
  61.  
  62. ; Hiding citra console window
  63. emuConsoleWindow.Set("Transparent",0)
  64.  
  65. ; Waiting for game to load
  66. TimeOut := 3000
  67. StartTime := A_TickCount
  68. Loop, {
  69. WinGet, IDList, List, ahk_class %primaryWindowClassName% ; get a list of all windows which match this windowTitle
  70. Loop, % IDList ; IDList set to number of matches found
  71. { id := IDList%A_Index%
  72. ControlGet, OutputVar, Hwnd,, Qt5QWindowOwnDCIcon1, ahk_id %id%
  73. If !ErrorLevel
  74. { gameWindowID := id
  75. Break
  76. }
  77. }
  78. If (TimeOut && A_TickCount - StartTime > TimeOut)
  79. Break
  80. }
  81. ; Saving id of extra emulator window to be hidden
  82. WinGet, IDList, List, ahk_class %primaryWindowClassName% ; Get a list of all windows which match this windowTitle
  83. Loop, % IDList ; IDList set to number of matches found
  84. { id := IDList%A_Index%
  85. If !(id = gameWindowID) {
  86. launchWindowID := id
  87. launchWindow := new Window(new WindowTitle(,,,launchWindowID))
  88. Break
  89. }
  90. }
  91.  
  92. ; Hiding extra emulator window
  93. If (launchWindowID) {
  94. launchWindow.Hide()
  95. }
  96.  
  97. ; Waiting for game window to be active if it is not
  98. gameWindow := new Window(new WindowTitle(,,,gameWindowID))
  99. gameWindow.WaitActive()
  100.  
  101. if (Fullscreen = "true"){ ; Creating fake full screen as the emu always launches in windowed mode
  102. WinGet emulatorID, ID, A
  103. emulatorWindow := new Window(new WindowTitle(,,,emulatorID))
  104. RLObject.hideWindowTitleBar(emulatorID)
  105. RLObject.hideWindowBorder(emulatorID)
  106. emulatorWindow.Move(0,0,A_screenWidth,A_screenHeight + 38)
  107. }
  108.  
  109. BezelDraw()
  110. HideAppEnd(hideEmuObj,hideEmu)
  111. FadeInExit()
  112. primaryExe.Process("WaitClose")
  113. 7zCleanUp()
  114. BezelExit()
  115. FadeOutExit()
  116. ExitModule()
  117.  
  118.  
  119. CloseProcess:
  120. FadeOutStart()
  121. If (launchWindowID)
  122. launchWindow.Close()
  123. Else
  124. gameWindow.Close()
  125. Return
  126.  
  127. BezelLabel:
  128. disableHideBorder := "true"
  129. disableHideTitleBar := "true"
  130. disableHideToggleMenu := "true"
  131. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement