Last active
April 5, 2022 16:00
-
-
Save OneFaced/764f9c5c7bef1c49a31d928c223bcb24 to your computer and use it in GitHub Desktop.
GuildWars 2 ArcDps Update Script
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
REM <# | |
@echo off | |
copy UpdateArcDps.cmd UpdateArcDps.ps1 >NUL | |
PowerShell.exe -ExecutionPolicy Unrestricted -NoProfile -Command "&{Set-Alias REM Write-Host; .\UpdateArcDps.ps1}" | |
del UpdateArcDps.ps1 | |
exit | |
REM #> | |
#MakeCDDVDAgain (so toxic!) | |
#T4 Purgatory, T1 Pop | |
<# ---- Command Line Arguments ---- | |
Add any commandline arguments you need here separated by a comma and encloded in single quotes | |
List of arguments available at https://wiki.guildwars2.com/wiki/Command_line_arguments | |
E.g.: $arguments = '-clientport 80','-maploadinfo' | |
#> | |
$arguments = '-autologin','-maploadinfo' | |
<# ---- GuildWars 2 Path ---- | |
Modify as required. Points to the default install location | |
You can use environment variables here or absolute paths, e.g. E:\gw2 | |
#> | |
$GW2Path = "$env:ProgramFiles\Guild Wars 2\" | |
<# ---- GuildWars 2 Executable Name | |
#This is the default executable name. Adjust as required. Do not include the .exe extension | |
#> | |
$gw = 'Gw2-64' | |
#Don't change these paths unless arc does | |
$md5Uri = 'https://www.deltaconnected.com/arcdps/x64/d3d9.dll.md5sum' | |
$d3d9Uri = 'https://www.deltaconnected.com/arcdps/x64/d3d9.dll' | |
function Start-GW2 | |
{ | |
Write-Verbose 'Starting GuildWars 2...' | |
if($arguments.Length -lt 1) | |
{ | |
Start-Process -FilePath "$($GW2Path)\$($gw).exe" | |
} | |
else | |
{ | |
Start-Process -FilePath "$($GW2Path)\$($gw).exe" -ArgumentList $arguments | |
} | |
} | |
function Get-ArcDps | |
{ | |
Write-Verbose 'Downloading ArcDps' | |
$d3d9Response = Invoke-WebRequest -Uri $d3d9Uri | |
Set-Content -Path "$($GW2Path)\bin64\d3d9.dll" -Encoding Byte -Value $d3d9Response.Content | |
Write-Verbose 'Completed ArcDps install' | |
Start-GW2 | |
} | |
function Invoke-ArcDpsCheck | |
{ | |
if((Get-Process $gw -ErrorAction 0).Count -gt 0) | |
{ | |
Exit | |
} | |
$fileExists = Test-Path "$($GW2Path)\bin64\d3d9.dll" | |
if($fileExists) | |
{ | |
$currD3d9 = Get-FileHash "$($GW2Path)\bin64\d3d9.dll" -Algorithm MD5 | |
try | |
{ | |
$md5response = Invoke-WebRequest -Uri $md5Uri | |
} | |
catch { | |
Write-Verbose 'Failed to download MD5 sum' | |
Start-GW2 | |
Exit | |
} | |
if(!$currD3d9.Hash.Equals(($md5response.ToString().Split(" ",[System.StringSplitOptions]::RemoveEmptyEntries)[0]), | |
[System.StringComparison]::InvariantCultureIgnoreCase)) | |
{ | |
Write-Verbose 'ArcDps is out of date' | |
Copy-Item "$($GW2Path)\bin64\d3d9.dll" -Destination "$($GW2Path)\bin64\d3d9_old.bak" -Force | |
Get-ArcDps | |
} | |
else | |
{ | |
Write-Verbose 'ArcDps is up to date' | |
Start-GW2 | |
} | |
} | |
else | |
{ | |
Get-ArcDps | |
} | |
} | |
Invoke-ArcDpsCheck |
Updated with d3d9_arcdps_extras.dll.
Removed buildtemplates/extras dlls since they're no longer published.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using
Write-Host
is bad practice in automation scripts which is why I'm usingWrite-Verbose
. This script typically runs so quickly that Write-Host wouldn't be of much value regardless and usingStart-Sleep
just delays execution of an unattended script for no useful reason.Exit
is a keyword of PoSh; usingStop-Process
is just typing extra characters :-)