wto_ws.dll no longer scans aces.exe or carries structure offsets of a game build. It reads the values the patcher resolved (wto_ws.cfg native.* lines) into g_lmp through one table that names, per module, which value fills which field (local_mp_values.c), and installs each module whose values are all present, in dependency order, instead of giving up on the whole bridge when one subsystem is missing. When the settings were resolved for another executable (PE time stamp and image size differ), the bridge stays off. local_mp_offsets.h keeps the existing names so the module code reads as before; only Dagor library layouts (dag::Vector, DataBlock), protocol enums, the reflection buffer size and the two change request members with no reader in the client remain constants. A few fields are derived where the client has no instruction of its own for them (local_mp_values.c derive_values). The signatures moved to patches/native, and the header-based check-offsets command is gone: record-game-version and the launcher's patch check resolve the native modules now. Shared sites moved to local_mp_core (mission customBots, the player's unit eid) so modules do not depend on each other for them. Checked: DLL build (no warnings outside MinHook); root and launcher type checks; check-patches on 2.61.0.37; version records for 2.61.0.37 and 2.61.0.43 (10 native modules each); a lab run of the 2.61.0.37 copy logs 239 native values and "9 of 9 LocalMP modules installed". Battles were not played in this run. BREAKING CHANGE: Rebuild game copies to generate the new native values in wto_ws.cfg. Use record-game-version.ts or the launcher patch check in place of wtotools check-offsets.
35 lines
1.9 KiB
PowerShell
35 lines
1.9 KiB
PowerShell
<#
|
|
Build wto_ws.dll with the Visual Studio C compiler (x64).
|
|
|
|
powershell -NoProfile -ExecutionPolicy Bypass -File native\wto-net\build.ps1 [-Out <folder>]
|
|
|
|
Output: <Out>\wto_ws.dll (default build\native). Static C runtime (/MT), so the DLL needs
|
|
nothing but the system's ws2_32.dll. MinHook comes from native\third_party\minhook (BSD-2).
|
|
#>
|
|
param([string]$Out = (Join-Path $PSScriptRoot '..\..\build\native'))
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
$vswhere = Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio\Installer\vswhere.exe'
|
|
$vs = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
|
|
if (-not $vs) { throw 'Visual Studio with the x64 C++ tools was not found' }
|
|
$vcvars = Join-Path $vs 'VC\Auxiliary\Build\vcvars64.bat'
|
|
|
|
$src = Join-Path $PSScriptRoot 'src'
|
|
$mh = Join-Path $PSScriptRoot '..\third_party\minhook'
|
|
New-Item -ItemType Directory -Force $Out | Out-Null
|
|
$obj = Join-Path $Out 'obj'
|
|
New-Item -ItemType Directory -Force $obj | Out-Null
|
|
|
|
$sources = @(
|
|
"$src\dll_main.c", "$src\hook_config.c", "$src\redirect_rules.c", "$src\resolver_hooks.c", "$src\connection_hooks.c",
|
|
"$src\local_mp_core.c", "$src\local_mp_values.c", "$src\local_mp_players.c", "$src\local_mp_loadout.c", "$src\local_mp_actions.c", "$src\local_mp_awards.c", "$src\local_mp_kills.c", "$src\local_mp_events.c", "$src\local_mp_scores.c", "$src\local_mp_nuke.c", "$src\local_mp_support.c",
|
|
"$mh\src\hook.c", "$mh\src\buffer.c", "$mh\src\trampoline.c", "$mh\src\hde\hde64.c"
|
|
) | ForEach-Object { '"' + (Resolve-Path $_) + '"' }
|
|
|
|
$command = "`"$vcvars`" >nul && cl /nologo /LD /O2 /MT /W4 /wd4100 /D_CRT_SECURE_NO_WARNINGS /DWIN32_LEAN_AND_MEAN " +
|
|
"/I`"$mh\include`" /Fo`"$obj\\`" $($sources -join ' ') /Fe`"$Out\wto_ws.dll`" " +
|
|
"/link /DEF:`"$src\wto_ws.def`" ws2_32.lib"
|
|
cmd /c $command
|
|
if ($LASTEXITCODE -ne 0) { throw "cl failed with $LASTEXITCODE" }
|
|
Write-Output (Join-Path $Out 'wto_ws.dll')
|