Skip to content

Instantly share code, notes, and snippets.

@prubini87
Forked from OneFaced/UpdateArcDps.cmd
Last active August 15, 2019 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prubini87/d4c99cd13c6430d162d5d7a282563328 to your computer and use it in GitHub Desktop.
Save prubini87/d4c99cd13c6430d162d5d7a282563328 to your computer and use it in GitHub Desktop.
GuildWars 2 ArcDps Update Script
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\" # by placing this script on the root directory of your Guild Wars 2 installation, there's no need to configure this.
$GW2Path = $PSScriptRoot + '\'
<# ---- 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'
$btUri = 'https://www.deltaconnected.com/arcdps/x64/buildtemplates/d3d9_arcdps_buildtemplates.dll'
$eUri = 'https://www.deltaconnected.com/arcdps/x64/extras/d3d9_arcdps_extras.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
$btResponse = Invoke-WebRequest -Uri $btUri
Set-Content -Path "$($GW2Path)\bin64\d3d9_arcdps_buildtemplates.dll" -Encoding Byte -Value $btResponse.Content
$eResponse = Invoke-WebRequest -Uri $eUri
Set-Content -Path "$($GW2Path)\bin64\d3d9_arcdps_extras.dll" -Encoding Byte -Value $eResponse.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
try
{
Copy-Item "$($GW2Path)\bin64\d3d9_arcdps_buildtemplates.dll" -Destination "$($GW2Path)\bin64\d3d9_arcdps_buildtemplates_old.bak" -Force
}
catch {}
try
{
Copy-Item "$($GW2Path)\bin64\d3d9_arcdps_extras.dll" -Destination "$($GW2Path)\bin64\d3d9_arcdps_extras_old.bak" -Force
}
catch {}
Get-ArcDps
}
else
{
Write-Verbose 'ArcDps is up to date'
Start-GW2
}
}
else
{
Get-ArcDps
}
}
Invoke-ArcDpsCheck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment