Files

46 lines
2.1 KiB
PowerShell
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<#
.SYNOPSIS
在官方 Dalamud 尚未解锁新版本前,向已启动的国服客户端手动注入 Dalamud。
#>
$ErrorActionPreference = 'Stop'
Write-Host "=== FFXIV 国服 Dalamud 强制注入工具 ===" -ForegroundColor Cyan
# 1. 寻找正在运行的 ffxiv_dx11 游戏进程
$processes = Get-Process -Name "ffxiv_dx11" -ErrorAction SilentlyContinue
if (-not $processes) {
Write-Host "[!] 未检测到运行中的 ffxiv_dx11.exe 游戏进程!" -ForegroundColor Yellow
Write-Host " 步骤:" -ForegroundColor Gray
Write-Host " 1. 请先打开 XIVLauncherCN 正常登录并启动国服游戏。" -ForegroundColor Gray
Write-Host " 2. 待游戏进入标题画面或角色选择界面后,再次运行本脚本。" -ForegroundColor Gray
return
}
# 2. 定位 Dalamud.Injector
$injectorPath = Join-Path $env:APPDATA "XIVLauncherCN\addon\Hooks\15.0.3.6\Dalamud.Injector.exe"
if (-not (Test-Path $injectorPath)) {
$injectorPath = Join-Path $env:APPDATA "XIVLauncherCN\addon\Hooks\dev\Dalamud.Injector.exe"
}
if (-not (Test-Path $injectorPath)) {
Write-Host "[X] 未找到 XIVLauncherCN 的 Dalamud.Injector.exe,请确认启动器环境。" -ForegroundColor Red
return
}
Write-Host "[+] 找到 Dalamud 注入器: $injectorPath" -ForegroundColor Green
foreach ($proc in $processes) {
Write-Host "[*] 正在向游戏进程 PID: $($proc.Id) ($($proc.ProcessName)) 注入 Dalamud..." -ForegroundColor Cyan
& $injectorPath inject $proc.Id
$exitCode = $LASTEXITCODE
if ($exitCode -eq 0) {
Write-Host "[+] 注入指令执行成功 (ExitCode 0)!" -ForegroundColor Green
Write-Host " 请切回游戏窗口:" -ForegroundColor Yellow
Write-Host " - Dalamud 将自动初始化并加载 Dev 插件 [IC.Rebuild 0.1.16.0]" -ForegroundColor Gray
Write-Host " - 在聊天框输入 /icr 可打开 IC.Rebuild 面板" -ForegroundColor Gray
} else {
Write-Host "[!] 注入器返回退出码 $exitCode,如提示权限不足,请右键选择『以管理员身份运行』本脚本。" -ForegroundColor Red
}
}