Skip to content

Instantly share code, notes, and snippets.

@LucasOe
Last active October 15, 2022 23:58
Show Gist options
  • Save LucasOe/3eba6b71989418625596be03711eb598 to your computer and use it in GitHub Desktop.
Save LucasOe/3eba6b71989418625596be03711eb598 to your computer and use it in GitHub Desktop.
Powershell script for detecting conflicts between Witcher 3 mods
# Usage
# 1. Download quickbms.exe and witcher3.bms (The ScriptMerger files are outdated):
# http://aluigi.altervista.org/papers/quickbms.zip
# http://aluigi.altervista.org/bms/witcher3.bms
# 2. Place this file into a directory next to quickbms.exe and witcher3.bms
# 3. Change $witcherPath to your Witcher directory.
#
# To show conflicts between two (or more) mods, run `./conflicts.ps1 <mod1> <mod2> <...>` inside the Powershell console.
# For example: `.\conflicts.ps1 modHDReworkedProject modBrothersInArms`
# To list every conflicting mod file, run this script with only one mod as an argument.
# For example: `.\conflicts.ps1 modBrothersInArms`
$witcherPath = "C:\Program Files (x86)\Steam\steamapps\common\The Witcher 3"
$outputs = New-Object System.Collections.Generic.List[System.Object]
$modCount = $args.Count
$args | ForEach-Object {
$arg = $_
$output = (./quickbms.exe -l -F "mods/$arg/content/blob0.bundle" ".\witcher3.bms" "$witcherPath" 2>$null)
$output = $output.ForEach({ ($_ -split '\s+')[3] })
$outputs.Add($output)
# Comapare agains every other mods if only one argument is provided
if ($modCount -eq 1) {
Write-Host "Looking for conflicts. This may take a while!`n"
$mods = Get-ChildItem -Path "$witcherPath/mods" -Directory | Select-Object -ExpandProperty Name
$mods | ForEach-Object {
$mod = $_
$modOutput = (./quickbms.exe -l -F "mods/$mod/content/blob0.bundle,!mods/$arg/content/blob0.bundle" ".\witcher3.bms" "$witcherPath" 2>$null)
$modOutput = $modOutput.ForEach({ ($_ -split '\s+')[3] })
$conflicts = Compare-Object -ReferenceObject $output -DifferenceObject $modOutput -PassThru -ExcludeDifferent | Out-String
if ($conflicts.Length -gt 0) { Write-Host "$mod`n$conflicts"}
}
}
}
if ($modCount -gt 1) { Compare-Object @outputs -PassThru -ExcludeDifferent }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment