param( [string]$GameDir = "D:\cbt1" ) $ErrorActionPreference = 'Stop' $dist = Join-Path $PSScriptRoot 'dist' $clientExe = 'GenshinImpact.exe', 'YuanShen.exe' | Where-Object { Test-Path (Join-Path $GameDir $_) } | Select-Object -First 1 if (-not $clientExe) { throw "No Genshin client (GenshinImpact.exe / YuanShen.exe) found in $GameDir - pass -GameDir to your client folder." } Write-Host "Client: $clientExe in $GameDir" -ForegroundColor DarkGray $files = 'version.dll', 'gadget.dll', 'gadget.config', 'redirect.js' foreach ($file in $files) { $source = Join-Path $dist $file if (-not (Test-Path $source)) { throw "missing $source - run build.ps1 first." } $target = Join-Path $GameDir $file if ((Test-Path $target) -and $file -eq 'version.dll') { Copy-Item $target "$target.bak" -Force Write-Host "backed up existing version.dll -> version.dll.bak" -ForegroundColor DarkGray } Copy-Item $source $target -Force Write-Host "deployed $file" -ForegroundColor Green } Write-Host "" Write-Host "Patch deployed to $GameDir. Start the SDK server (:8899) and gameserver, then launch GenshinImpact.exe." -ForegroundColor Cyan Write-Host "Check YuanshenPatch.log in the game folder to confirm the gadget loaded." -ForegroundColor Cyan