Skip to content

Instantly share code, notes, and snippets.

@ngraham20
Forked from reneklacan/aoe4-mp-fix.sh
Last active March 16, 2023 01:54
Show Gist options
  • Save ngraham20/414d31f6c6a8bd0c40d0b87ca38bf65f to your computer and use it in GitHub Desktop.
Save ngraham20/414d31f6c6a8bd0c40d0b87ca38bf65f to your computer and use it in GitHub Desktop.
Script to fix AOE Definitive Edition desync issues
#!/bin/bash
# modified to work with Mac OS' Porting Kit's installation location to attempt multiplayer fix
set -ex
AOE4_DIR="/Users/$USER/Applications/Age of Empires 3 Definitive Ed.app/Contents/SharedSupport"
AOE4_WIN_DIR=$AOE4_DIR/prefix/drive_c/windows
AOE4_WIN_SYS32_DIR=$AOE4_WIN_DIR/system32
AOE4_WIN_SYS64_DIR=$AOE4_WIN_DIR/syswow64
function check_deps() {
which wget || (echo "wget is required (you can install it with 'brew install wget')" && exit 1)
which cabextract || (echo "cabextract is required ('brew install cabextract')" && exit 1)
}
function cleanup() {
local arch=$1
rm -f vc_redist.$arch.exe
rm -rf 0 a{0..11} u{0..31}
}
function backup() {
local timestamp=$(date +%s)
mv ucrtbase.dll ucrtbase.dll.bak-$timestamp
mv concrt140.dll concrt140.dll.bak-$timestamp
mv msvcp140.dll msvcp140.dll.bak-$timestamp
mv vcamp140.dll vcamp140.dll.bak-$timestamp
mv vccorlib140.dll vccorlib140.dll.bak-$timestamp
mv vcomp140.dll vcomp140.dll.bak-$timestamp
mv vcruntime140.dll vcruntime140.dll.bak-$timestamp
}
function download_and_replace() {
local arch=$1
wget https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.$arch.exe
cabextract vc_redist.$arch.exe
cabextract a10
}
function replace_dlls() {
local dir=$1
local arch=$2
cd $dir
backup
cleanup $arch
download_and_replace $arch
cleanup $arch
}
check_deps
replace_dlls $AOE4_WIN_SYS32_DIR x64
replace_dlls $AOE4_WIN_SYS64_DIR x86
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment