Files
WT-Offline/native/wto-net/build.ps1
T
N0VAN0M4LY c17c3d3384 Narrow the LocalMP native bridge to documented engine gaps
- Scoreboard scores come from the local service: BattleEconomy
  missionScores() writes the official mission scores into the stock
  mission block customScoreParams, which the client copies into
  MissionSettings+0x6d8 without reading it; local_mp_scores.c reads them
  with DataBlock::getReal. The hardcoded scores and the death score go.
- countActivePlayers already counts players with a living vehicle; the
  only LocalMP gap is its filter skipping bots (MPlayer+0x1d8 bit 7). A
  one-byte exe patch drops that filter bit instead of a rewrite hook.
- ucavLaunch returns early on a host; an exe patch skips that return
  instead of clearing the global host flag around the call.
- onBecameDead no longer runs with isLocalMP cleared: that only queued an
  EventOnPlayerDeath stock LocalMP skips on purpose, and broke the local
  player id remap inside the function.
- The host chat object keeps its two-field layout, now documented from
  the host chat handler that reads it.
2026-11-28 07:09:07 +08:00

35 lines
1.8 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_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",
"$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')