Advertisement
djvj

BlueStacks Module

Jan 8th, 2017
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.17 KB | None | 0 0
  1. MEmu := "BlueStacks"
  2. MEmuV := "v0.7.10.869"
  3. MURL := ["http://www.bluestacks.com/"]
  4. MAuthor := ["djvj"]
  5. MVersion := "2.0.1"
  6. MCRC := "A606F2C1"
  7. iCRC := "79D03371"
  8. MID := "635038268876501094"
  9. MSystem := ["Android"]
  10. ;----------------------------------------------------------------------------
  11. ; Notes:
  12. ; Set your Emu_Path to "PATH\HD-Frontend.exe" where bluestacks is installed, something like this: C:\Program Files (x86)\BlueStacks\HD-Frontend.exe
  13. ; Rom_Extension should be set to lnk
  14. ; Each game you install in BlueStacks will have a lnk shortcut made in your C:\ProgramData\BlueStacks\UserData\Library\My Apps
  15. ; Rom_Path should point to this Library folder
  16. ; If the HD-Agent does not quit after you exit a game, the next time you launch you will be back in the same Android Virtual Environment and the previous game will have crashed
  17. ; Due to this, some games may not save settings when you quit. It is advised you close the game in Android by normal means, then exit.
  18. ; BlueStacks stores its config in the registry @ HKEY_LOCAL_MACHINE\SOFTWARE\BlueStacks
  19. ;----------------------------------------------------------------------------
  20. StartModule()
  21. BezelGUI()
  22. FadeInStart()
  23.  
  24. primaryExe := new Process(emuPath . "\" . executable) ; instantiate emulator executable object
  25. bsLnk := new Process(romPath . "\" . romName . romExtension)
  26. emuQuitExe := new Process(emuPath . "\HD-Quit.exe")
  27. emuPrimaryWindow := new Window(new WindowTitle("BlueStacks App Player","")) ; instantiate primary emulator window object
  28. hideEmuObj := Object(emuPrimaryWindow,1)
  29.  
  30. Fullscreen := moduleIni.Read("settings", "Fullscreen","true",,1)
  31. userWidth := moduleIni.Read("settings", "Width","1600",,1)
  32. emuHeight := moduleIni.Read("settings", "Height","900",,1)
  33. WindowedWidth := moduleIni.Read("Settings", "WindowedWidth","750",,1)
  34. WindowedHeight := moduleIni.Read("Settings", "WindowedHeight","450",,1)
  35.  
  36. BezelStart("FixResMode")
  37.  
  38. regLoc := "SOFTWARE\BlueStacks\Guests\Android\FrameBuffer\0"
  39. currentFullScreen := Registry.Read("HKLM",regLoc,"FullScreen")
  40. If (Fullscreen != "true" And currentFullScreen = 1)
  41. Registry.Write("REG_DWORD","HKLM",regLoc,"FullScreen",0)
  42. Else If (Fullscreen = "true" And currentFullScreen = 0)
  43. Registry.Write("REG_DWORD","HKLM",regLoc,"FullScreen",1)
  44.  
  45. If bezelPath { ; Setting windowed mode resolution
  46. userWidth := WindowedWidth
  47. userHeight := WindowedHeight
  48. }
  49.  
  50. currentWidth := Registry.Read("HKLM",regLoc,"Width") ; update width if desired width does not match current
  51. If (userWidth != currentWidth and userWidth != "")
  52. Registry.Write("REG_DWORD","HKLM",regLoc,"Width",userWidth)
  53. currentHeight := Registry.Read("HKLM",regLoc,"Height") ; update height if desired width does not match current
  54. If (userHeight != currentHeight and userHeight != "")
  55. Registry.Write("REG_DWORD","HKLM",regLoc,"Height",userHeight)
  56.  
  57. ; This makes sure there is no warning on exit
  58. bsCloseWarning := Registry.Read("HKLM","SOFTWARE\BlueStacks\BlueStacksGameManager\Preferences","BlueStacksCloseWarning")
  59. If (bsCloseWarning = 0)
  60. Registry.Write("REG_DWORD","HKLM","SOFTWARE\BlueStacks\BlueStacksGameManager\Preferences","BlueStacksCloseWarning",0)
  61. ; This makes sure TV window doesn't show
  62. bsTVWindow := Registry.Read("HKLM","SOFTWARE\BlueStacks\BlueStacksGameManager\Preferences","HideBTVWindow")
  63. If (bsTVWindow != 1)
  64. Registry.Write("REG_DWORD","HKLM","SOFTWARE\BlueStacks\BlueStacksGameManager\Preferences","HideBTVWindow",1)
  65.  
  66. HideAppStart(hideEmuObj,hideEmu)
  67. bsLnk.Run()
  68.  
  69. emuPrimaryWindow.Wait()
  70. emuPrimaryWindow.WaitActive()
  71.  
  72. BezelDraw()
  73. HideAppEnd(hideEmuObj,hideEmu)
  74. FadeInExit()
  75. emuPrimaryWindow.WaitClose()
  76.  
  77. TimerUtils.Sleep(100)
  78. emuQuitExe.Run() ; this is the provided exe to quit BlueStacks Agent
  79. TrayRefresh() ; attempts to prevent dead icons from building up on your tray
  80.  
  81. BezelExit()
  82. FadeOutExit()
  83. ExitModule()
  84.  
  85.  
  86. TrayRefresh() {
  87. Static WM_MOUSEMOVE := 0x200
  88. ControlGetPos,,,w,h,ToolbarWindow321, AHK_class Shell_TrayWnd
  89. width:=w, hight:=h
  90. while ((h:=h-5)>0 and w:=width)
  91. while ((w:=w-5)>0)
  92. PostMessage, WM_MOUSEMOVE,0, ((hight-h) >> 16)+width-w, ToolbarWindow321, AHK_class Shell_TrayWnd
  93. }
  94.  
  95. CloseProcess:
  96. FadeOutStart()
  97. emuPrimaryWindow.Close()
  98. primaryExe.Process("Close")
  99. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement