Guest User

Odyssey G9 Fake-Fullscreen Valorant

a guest
Jan 3rd, 2021
4,409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 6.43 KB | None | 0 0
  1. ;-Code by Leaves (reddit: vismxownz)
  2. ;-Includes
  3. #include <MsgBoxConstants.au3>
  4. #include <Array.au3>
  5. #include <String.au3>
  6. #include <WinAPI.au3>
  7. #include <WindowsConstants.au3>
  8. #include <FileConstants.au3>
  9.  
  10. $AlreadyRunning = MsgBox(4, "Is Valorant already running in Windowed mode?", "Is Valorant already running in Windowed mode?" & @CRLF & @CRLF & "If you click 'Yes', make shure the Game is started already and running in windowed mode" & @CRLF & "If not, just click no to proceed with the Autolaunch of Valorant")
  11.  
  12. If $AlreadyRunning = 4 Then
  13.    $Title = "VALORANT" ;--Set Application-Title (Window Title)
  14.    WinWaitActive($Title) ;--Wait for Window to become active
  15.  
  16.    If Not WinExists($Title) Then ;-- If Window was Active, but does not exist anymore, give Error and Quit
  17.        MsgBox(0, "ERROR", "Valorant not launched") ;-Give Errormessage
  18.        Exit ;-End Program
  19.     EndIf ;- End If Win Not Exist Check
  20.  
  21.    $hWnd = WinGetHandle($Title) ;-Get Handle Adress by Title of Window
  22.  
  23.    Local $iStyle = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE) ;-Set Style of Window
  24.  
  25.    $iStyle = BitOR(BitXOR($iStyle, $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_CAPTION, $WS_BORDER, $WS_SIZEBOX), $WS_POPUP) ;- Change Windowstyle to Fullscreen, while removing Border, Options, set Window as Popup
  26.  
  27.    _WinAPI_SetWindowLong($hWnd, $GWL_STYLE, $iStyle) ;-Set WindowLong Style
  28.    _WinAPI_SetWindowPos($hWnd, $HWND_TOP, -1, -1, @DesktopWidth+2, @DesktopHeight+2, $SWP_FRAMECHANGED) ;-Resize Window to -1 Pixel on X und Y Axis, to hide 1px white Bar around the Window, Overstretch by 2px each to hide white Bar around outer Edges
  29. EndIf
  30.  
  31. ;-Set Dims to check back if files do not exist
  32. Dim $ClearLocation, $ArrayType, $CFG_File
  33.  
  34. ;Check if Valorant is installed
  35. $RiotClientDestination = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\riotclient\DefaultIcon", "") ;Registrylocation for RiotClient
  36. $ClearLocation = _StringBetween($RiotClientDestination, '"', '"') ;Give Direct Path by extracting String between quotations
  37. $ArrayType = 1 ;Change ArrayType to indicate if Location is a String or Array ( 1 = Array; 0 = String)
  38. If Not FileExists(_ArrayToString($ClearLocation)) Then ;--If RiotClient does not exist, give Option to manually select it
  39.    MsgBox(0, "ERROR", "Valorant was not found!" & @CRLF & @CRLF & "Usually located at:" & @CRLF & "C:\Riot Games\Riot Client\...") ;-Give Errormessage
  40.    $sFileOpenDialog = FileOpenDialog("Select RiotGameServices.exe...", @HomeDrive & "\", "RiotGameServices.exe (*.exe)", $FD_FILEMUSTEXIST) ;-Open Dialog to manually select RiotGamesSerivces.exe
  41.    $ClearLocation = $sFileOpenDialog ;-Set New Location instead of Registrydefault Location
  42.    $ArrayType = 0 ;-Change Location Type from Array to String ( 1 = Array; 0 = String)
  43. EndIf ;--End Check for Existence of RiotGamesServices.exe
  44.  
  45. ;Check if Valorant Config exists
  46. $CFG_DirName = IniRead(@LocalAppDataDir & "\VALORANT\Saved\Config\Windows\RiotLocalMachine.ini", "UserInfo", "LastKnownUser", "") ;-Check on Defaultlocation for Valorant Last Logged in Users Folder
  47. $CFG_File = @LocalAppDataDir & "\VALORANT\Saved\Config\" & $CFG_DirName & "\Windows\GameUserSettings.ini" ;-Read UserID and Open Gamesettings from last logged in User
  48. $CFG_File_Section = "/Script/ShooterGame.ShooterGameUserSettings" ;-Jump to Section in GameSettings
  49.  
  50. If Not FileExists($CFG_File) Then ;If Config does not exists - give option to manually select it
  51.    Msgbox(0, "ERROR", "Valorant Config not found!" & @CRLF & @CRLF &"It's usually located at:" & @CRLF & "%LocalAppData%\VALORANT\Saved\Config\Windows") ;-Give Errormessage
  52.    $sFileOpenDir = FileOpenDialog("Select RiotLocalMachine.ini... - Usually: '%LocalAppData%\VALORANT\Saved\Config\Windows'", @LocalAppDataDir, "RiotLocalMachine.ini (*.ini)", $FD_FILEMUSTEXIST) ;-Open Dialog to manually select RiotLocalMachine.ini
  53.    $CFG_File = $sFileOpenDir ;-Set New Location for Riot Config
  54.  
  55.    IniWrite($CFG_File, $CFG_File_Section, "FullScreenMode", "2") ;-Change Whatever Screenmode is selected to Windowed
  56.    IniWrite($CFG_File, $CFG_File_Section, "WindowPosX", ((@DesktopWidth/2)-IniRead($CFG_File, $CFG_File_Section, "DesiredScreenWidth", "")/2)) ;-Set Windowposition on X-Axis to Middle of Screen
  57.    IniWrite($CFG_File, $CFG_File_Section, "WindowPosY", ((@DesktopHeight/2)-IniRead($CFG_File, $CFG_File_Section, "DesiredScreenHeight", "")/2)) ;-Set Windowposition on Y-Axis to Middle of Screen
  58. Else ;-- If Config was found by default, do the same
  59.    IniWrite($CFG_File, $CFG_File_Section, "FullScreenMode", "2") ;-Change Whatever Screenmode is selected to Windowed
  60.    IniWrite($CFG_File, $CFG_File_Section, "WindowPosX", ((@DesktopWidth/2)-IniRead($CFG_File, $CFG_File_Section, "DesiredScreenWidth", "")/2)) ;-Set Windowposition on X-Axis to Middle of Screen
  61.    IniWrite($CFG_File, $CFG_File_Section, "WindowPosY", ((@DesktopHeight/2)-IniRead($CFG_File, $CFG_File_Section, "DesiredScreenHeight", "")/2)) ;-Set Windowposition on Y-Axis to Middle of Screen
  62. EndIf
  63.  
  64. ;Launch Valorant
  65. $Parameters = "--launch-product=valorant --launch-patchline=live" ;--Set Launchparameters to Launch ValorantGame through RiotClient
  66. If $ArrayType = 1 Then ;--If Gamelocation is an Array (Array = 1; String = 0) Launch using an Array
  67.    ShellExecute(_ArrayToString($ClearLocation), $Parameters) ;-Launch Game by Array
  68. Else ;--If Gamelocation is a String (Array = 1; String = 0) Launch using a String
  69.    ShellExecute($ClearLocation, $Parameters) ;-Launch Game by String
  70. EndIf ;- End of Launchprocess
  71.  
  72. $Title = "VALORANT" ;--Set Application-Title (Window Title)
  73. WinWaitActive($Title) ;--Wait for Window to become active
  74.  
  75. If Not WinExists($Title) Then ;-- If Window was Active, but does not exist anymore, give Error and Quit
  76.     MsgBox(0, "ERROR", "Valorant not launched") ;-Give Errormessage
  77.     Exit ;-End Program
  78.  EndIf ;- End If Win Not Exist Check
  79.  
  80. $hWnd = WinGetHandle($Title) ;-Get Handle Adress by Title of Window
  81.  
  82. Local $iStyle = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE) ;-Set Style of Window
  83.  
  84. $iStyle = BitOR(BitXOR($iStyle, $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_CAPTION, $WS_BORDER, $WS_SIZEBOX), $WS_POPUP) ;- Change Windowstyle to Fullscreen, while removing Border, Options, set Window as Popup
  85.  
  86. _WinAPI_SetWindowLong($hWnd, $GWL_STYLE, $iStyle) ;-Set WindowLong Style
  87. _WinAPI_SetWindowPos($hWnd, $HWND_TOP, -1, -1, @DesktopWidth+2, @DesktopHeight+2, $SWP_FRAMECHANGED) ;-Resize Window to -1 Pixel on X und Y Axis, to hide 1px white Bar around the Window, Overstretch by 2px each to hide white Bar around outer Edges
  88.  
Advertisement
Add Comment
Please, Sign In to add comment