-
-
Save Olian04/10e74574b0fb7365b4f9848be4f38f13 to your computer and use it in GitHub Desktop.
Automatically update ArcDps and BuildTemplates from deltaconnected for Guild Wars 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
::[CmdletBinding(SupportsShouldProcess)] | |
::# Update these values for wherever you have GW2 installed. | |
::# The arguments only get passed if you do not have a Settings.json file | |
::Param( | |
:: $Gw2Root = 'M:\Guild Wars 2', | |
:: $Gw2Exe = 'Gw2-64.exe', | |
:: $Gw2Arguments = @( | |
:: '-mapLoadinfo' | |
:: '-bmp' | |
:: '-fps','144' | |
:: ) | |
::) | |
::<# | |
@ECHO OFF | |
REM https://stackoverflow.com/questions/3759456/create-a-executable-exe-file-from-powershell-script#answer-4629494 | |
REM https://blogs.msdn.microsoft.com/zainala/2008/08/05/using-0-inside-the-batch-file-to-get-the-file-info/ | |
REM https://gist.github.com/TheIncorrigible1/b9dd802e56e5889a62d1c1d3bc9761e6 | |
SET "pwsh=%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe" | |
SET "args=-NoProfile -NoLogo -ExecutionPolicy Bypass -Command" | |
SET "cmd="@(Get-Content -Path '%~f0') -replace '^^::'^|Set-Content -Path '%~dpn0.ps1';. '%~dpn0.ps1' %*"" | |
%pwsh% %args% %cmd% | |
DEL "%~dpn0.ps1" /Q /F | |
EXIT | |
::#> | |
$ErrorActionPreference = [System.Management.Automation.ActionPreference]::SilentlyContinue | |
If (Get-Process -Name $Gw2Exe) { Exit } | |
$RemoteHash = (((Invoke-WebRequest -Uri 'https://www.deltaconnected.com/arcdps/x64/d3d9.dll.md5sum' | | |
Select-Object -ExpandProperty 'RawContent') -split "`n" | | |
Where-Object {$_})[-1] -split '\s')[0] | |
If ($RemoteHash.Length -ne 32) | |
{ | |
Write-Host "Invalid MD5 hash: $RemoteHash`n" | |
Pause | |
Exit | |
} | |
#region ArcDPS/BuildTemplates download | |
$ArcDPS_Path = "$Gw2Root\bin64\d3d9.dll" | |
$ArcDPS_URL = 'https://www.deltaconnected.com/arcdps/x64/d3d9.dll' | |
$BuildTemplates_Path = "$Gw2Root\bin64\d3d9_arcdps_buildtemplates.dll" | |
$BuildTemplates_URL = 'https://www.deltaconnected.com/arcdps/x64/buildtemplates/d3d9_arcdps_buildtemplates.dll' | |
If (Test-Path -Path $ArcDPS_Path) | |
{ | |
If ((Get-FileHash -Path $ArcDPS_Path -Algorithm 'MD5').Hash -ne $RemoteHash) | |
{ | |
Write-Host 'ArcDPS is out-of-date.' | |
Rename-Item -Path $ArcDPS_Path -NewName "$ArcDPS_Path.bak" -Force | |
Rename-Item -Path $BuildTemplates_Path -NewName "$BuildTemplates_Path.bak" -Force | |
Invoke-WebRequest -Uri $ArcDPS_URL -OutFile $ArcDPS_Path | |
Invoke-WebRequest -Uri $BuildTemplates_URL -OutFile $BuildTemplates_Path | |
Write-Host 'ArcDPS install complete.' | |
} | |
Else | |
{ | |
Write-Host 'ArcDPS is up-to-date.' | |
} | |
} | |
Else | |
{ | |
Invoke-WebRequest -Uri $ArcDPS_URL -OutFile $ArcDPS_Path | |
Invoke-WebRequest -Uri $BuildTemplates_URL -OutFile $BuildTemplates_Path | |
Write-Host 'ArcDPS install complete.' | |
} | |
#endregion | |
#region Start GW2 | |
$StartParams = @{ 'FilePath' = "$Gw2Root\$Gw2Exe" } | |
If (-not (Test-Path -Path "$Env:AppData\Guild Wars 2\Settings.json")) { $StartParams['ArgumentList'] = $Gw2Arguments } | |
Start-Process @StartParams | |
#endregion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Forked just for backup