refactor(repo)!: move apps, shared packages, and patch definitions

Everything sat in packages/: two programs next to the small libraries
they use, and the patch data loose at the root. The programs now live in
apps/ and the shared libraries in packages/:

  apps/server        the local server (was packages/local-service),
                     package @wto/server
  packages/patcher   builds the game copy (was packages/build),
                     package @wto/patcher
  patches/exe        exe patch definitions (was exe-patches)
  patches/gui        GUI script patches (was gui-patches)

Inside the server, the network layer folder becomes transport/ so it is
not server/server/, the entry module is server.ts, and startLocalService
and its types become startServer, ServerOptions and RunningServer. The
health answer names the app wto-server, and the TLS files in the data
folder are server.key and server.crt (made again on the next start).
Comments, logs and tool texts say "local server".

The patcher no longer reaches into the server's folder. It read the
default tuning/store.jsonc by a relative path to register bundle GUIDs
for the multi-vehicle packs, which also ignored the player's overrides
in <data>/tuning/. It now takes the pack ids from its caller; the
server exports multiVehiclePackIds(dataFolder), which reads them the way
the running server does. rebuildGuiPack takes the patch folder from its
caller as well.

The development build moves out of the patcher to
scripts/build-game-copy.ts, since it uses both the server and the
patcher. It needs --data (the folder the server will run with) and
defaults the patch folders and the hook library to this repository.


Checked with the root typecheck, check-patches, check-gui,
check-offsets, the native build, a run of build-game-copy.ts into a
scratch folder (12 exe patches, 35 GUI patches, 496 bundle GUIDs as
before) and a server start from apps/server answering wto-server.

BREAKING CHANGE: Use @wto/server and @wto/patcher from the new workspace paths. Run the development build with scripts/build-game-copy.ts and pass --data.
This commit is contained in:
N0VAN0M4LY committed 2026-11-29 03:20:54 +08:00
1 parent 9c813ccf7d
commit 930ea07630
476 files changed
+275 -251

No files matched your search

@@ -0,0 +1,8 @@
// Masked signature of BotSystem::changeUnit from the spawn point check (call 0x111a010)
// to the g_multiplayer null guard, 0x3c bytes; rip-relative and branch targets are wildcards.
// 2.61.0.37: unique hit at 0x11b2c14, edited instruction at +38 (0x11b2c3a).
{
"method": "signature",
"section": ".text",
"pattern": "48 8b 05 ?? ?? ?? ?? 48 8b 88 e0 03 00 00 48 8b 5c 24 20 48 89 da 4d 89 f0 e8 ?? ?? ?? ?? 84 c0 0f 84 ?? ?? ?? ?? 48 83 3d ?? ?? ?? ?? 00 0f 84 ?? ?? ?? ?? 48 8b 54 24 20"
}
@@ -0,0 +1,34 @@
// Let BotSystem::changeUnit spawn the AI players' vehicles on a LocalMP host (0x11b2c3a: the g_multiplayer
// null guard becomes a jump to the Unit::changeAircraft call at 0x11b314e).
// Why the exe: the build drops the dedicated server's script spawn permission, so with a multiplayer
// session the function only logs "spawn denied by scripts"; non-host sessions already return at its start.
// Without it: no AI vehicle ever spawns in a LocalMP battle.
// Kept from the baseline; not re-reviewed in the LocalMP rework.
{
"id": "battle/allow-local-host-bot-spawns",
"title": "Let BotSystem spawn AI vehicles on a LocalMP host",
"features": [
"K-AI 对手与队友"
],
"requires": [],
"verified_on": [
"2.61.0.37"
],
"edit": {
"offset": 38,
"asm": [
"jmp 0x514",
"nop",
"nop",
"nop",
"nop",
"nop",
"nop",
"nop",
"nop",
"nop"
],
"bytes": "e90f050000909090909090909090",
"expect_original": "48833d6e109d06000f8406050000"
}
}
@@ -0,0 +1,8 @@
// Masked signature of the 0xf02f (UnitRespawnRequest) branch of Unit::onEvent (0x103fbc0), from the
// human player check (call 0xfd34a0) to the spawn logic entry, 0x68 bytes; relative targets are wildcards.
// 2.61.0.37: unique hit at 0x1044e9b, edited instruction at +49 (0x1044ecc).
{
"method": "signature",
"section": ".text",
"pattern": "48 89 d9 e8 ?? ?? ?? ?? 84 c0 0f 84 ?? ?? ?? ?? 48 83 3d ?? ?? ?? ?? 00 0f 84 ?? ?? ?? ?? 8b 05 ?? ?? ?? ?? 83 c0 fd 49 8b 95 98 0f 00 00 83 f8 02 72 ?? 0f b6 4a 08 83 ba f8 0b 00 00 00 79 ?? 83 ba f4 0b 00 00 00 0f 88 ?? ?? ?? ?? ba 06 00 00 00 e8 ?? ?? ?? ?? 4c 89 e9 b2 01 e8 ?? ?? ?? ?? e9 ?? ?? ?? ?? 31 d2"
}
@@ -0,0 +1,25 @@
// Let the LocalMP host's player spawn in versus modes (GM_DOMINATION and others): the UnitRespawnRequest
// (0xf02f) branch of Unit::onEvent takes the spawn path at 0x1044f03 for every game mode (0x1044ecc jb -> jmp).
// Why the exe: the client keeps the spawn path only for GM_SINGLE_MISSION and GM_DYNAMIC; the versus modes'
// branch belongs to the dedicated server, which the build drops, and nothing outside the function decides it.
// Without it: after the "To Battle!" countdown the player falls back to vehicle selection.
// Kept from the baseline; not re-reviewed in the LocalMP rework.
{
"id": "battle/allow-local-host-player-respawn",
"title": "Let the LocalMP host's player spawn in versus modes",
"features": [
"K-出生点数 / 重生"
],
"requires": [],
"verified_on": [
"2.61.0.37"
],
"edit": {
"offset": 49,
"asm": [
"jmp 0x37"
],
"bytes": "eb35",
"expect_original": "7235"
}
}
@@ -0,0 +1,8 @@
// Masked signature of ucavLaunch from its prologue to the g_multiplayer->isHost early return, 0x35
// bytes; the rip-relative load of g_multiplayer and the branch targets are wildcards.
// 2.61.0.37: unique hit at 0x101ccd0, edited instruction (jne to the return) at +51 (0x101cd03).
{
"method": "signature",
"section": ".text",
"pattern": "41 57 41 56 41 55 41 54 56 57 55 53 48 81 ec 18 02 00 00 0f 29 bc 24 00 02 00 00 0f 29 b4 24 f0 01 00 00 48 8b 05 ?? ?? ?? ?? 48 85 c0 74 ?? 80 78 60 00 75 ??"
}
@@ -0,0 +1,25 @@
// Let the LocalMP host launch a UCAV (the light tank recon drone and the strike UCAV) from its vehicle.
// Why the exe: ucavLaunch returns at once when g_multiplayer->isHost is set, because on a dedicated
// server the launch is handled by server code that the client build does not contain; a LocalMP host
// is that server. Nothing outside the function decides it.
// Without it: pressing the drone key on a LocalMP host does nothing.
{
"id": "battle/allow-local-host-ucav-launch",
"title": "Let a LocalMP host launch UCAVs",
"features": [
"K-侦察"
],
"requires": [],
"verified_on": [
"2.61.0.37"
],
"edit": {
"offset": 51,
"asm": [
"nop",
"nop"
],
"bytes": "9090",
"expect_original": "753a"
}
}
@@ -0,0 +1,7 @@
// Masked signature of countActivePlayers (prologue through the player filter mask), 0x1b bytes.
// 2.61.0.37: unique hit at 0x11b9b60, edited instruction (or eax, 0x3a) at +24 (0x11b9b78).
{
"method": "signature",
"section": ".text",
"pattern": "41 57 41 56 41 54 56 57 53 48 83 ec 38 89 cf 80 f2 01 0f b6 c2 c1 e0 0a 83 c8 3a"
}
@@ -0,0 +1,26 @@
// Count AI players in countActivePlayers, the player count that domination ticket bleed and the
// battle's player-count rules use.
// Why the exe: the stock count walks MPlayers with a filter that skips bots (MPlayer+0x1d8 bit 7,
// "isBot"), because online battles have human players only; in a LocalMP battle the AI players take
// the human players' places, so the filter would count the AI team as empty. The filter is an
// immediate in the function; nothing outside it can change it.
// Without it: the AI team counts as having no active players.
{
"id": "battle/count-bots-as-active-players",
"title": "Count AI players as active players in LocalMP battles",
"features": [
"K-击杀、助攻、占点计分"
],
"requires": [],
"verified_on": [
"2.61.0.37"
],
"edit": {
"offset": 24,
"asm": [
"or eax, 0x32"
],
"bytes": "83c832",
"expect_original": "83c83a"
}
}
@@ -0,0 +1,8 @@
// Anti-cheat init, from the already-initialised check to the end of the "Disabled from CMD" branch, 109 bytes;
// rip-relative and branch targets are wildcards.
// 2.61.0.37: unique hit at 0x30c7112, edited je at +0x4a (0x30c715c).
{
"method": "signature",
"section": ".text",
"pattern": "48 83 3d ?? ?? ?? ?? 00 74 ?? 48 8d 15 ?? ?? ?? ?? 31 db b9 03 00 00 00 45 31 c0 45 31 c9 e8 ?? ?? ?? ?? e9 ?? ?? ?? ?? 49 89 ce c7 44 24 50 01 00 00 00 48 8d 0d ?? ?? ?? ?? 48 8d 54 24 50 45 31 c0 e8 ?? ?? ?? ?? 48 85 c0 74 ?? 48 8d 15 ?? ?? ?? ?? b9 03 00 00 00 45 31 c0 45 31 c9 e8 ?? ?? ?? ?? bb 01 00 00 00 e9 ?? ?? ?? ??"
}
@@ -0,0 +1,24 @@
// Always take the "-nobeac on the command line" branch, so BattlEye is never loaded.
// Why the executable: the anti-cheat loader runs before any network request; no service can answer it.
// Without it: launching aces.exe directly loads BattlEye and it tries to report to its servers.
{
"id": "isolation/never-load-battleye",
"title": "反作弊 BattlEye 永远不加载,和带上原版启动参数 -nobeac 的效果相同",
"features": [
"A-与正版隔离",
"A-不连 Gaijin"
],
"requires": [],
"verified_on": [
"2.61.0.37"
],
"edit": {
"offset": 74,
"asm": [
"nop",
"nop"
],
"bytes": "9090",
"expect_original": "7421"
}
}
@@ -0,0 +1,7 @@
// Command line switch lookup that sets dl and calls the crashpad setter, 45 bytes; call targets are wildcards.
// 2.61.0.37: unique hit at 0x40f5930, edited sete dl at +0x1a (0x40f594a).
{
"method": "signature",
"section": ".text",
"pattern": "48 8d 0d ?? ?? ?? ?? 48 8d 94 24 f0 00 00 00 45 31 c0 e8 ?? ?? ?? ?? 48 85 c0 0f 94 c2 48 89 d9 e8 ?? ?? ?? ?? 48 89 f9 ba 01 00 00 00"
}
@@ -0,0 +1,23 @@
// Always behave as if -crashpad-disable-upload was given: crash dumps stay on the machine.
// Why the executable: the upload switch is read from the command line only.
// Without it: a crash of a directly launched game uploads its dump to Gaijin.
{
"id": "isolation/never-upload-crash-reports",
"title": "崩溃报告永远不上传,和带上原版启动参数 -crashpad-disable-upload 的效果相同",
"features": [
"A-不连 Gaijin"
],
"requires": [],
"verified_on": [
"2.61.0.37"
],
"edit": {
"offset": 26,
"asm": [
"xor dl, dl",
"nop"
],
"bytes": "30d290",
"expect_original": "0f94c2"
}
}
@@ -0,0 +1,7 @@
// The wide string L"Software\Gaijin\WarThunder" with its terminating zero, 54 bytes.
// 2.61.0.37: unique hit at 0x7a39c4e.
{
"method": "signature",
"section": ".rdata",
"pattern": "53 00 6f 00 66 00 74 00 77 00 61 00 72 00 65 00 5c 00 47 00 61 00 69 00 6a 00 69 00 6e 00 5c 00 57 00 61 00 72 00 54 00 68 00 75 00 6e 00 64 00 65 00 72 00 00 00"
}
@@ -0,0 +1,23 @@
// Use HKCU\Software\WTOffline instead of Software\Gaijin\WarThunder.
// Why the executable: the registry path is a constant in the game identity table.
// Without it: the offline login reads and overwrites the retail client's saved credentials.
{
"id": "isolation/registry-key",
"title": "把注册表位置从 Software\\Gaijin\\WarThunder 改成 Software\\WTOffline,不碰正版保存的登录信息",
"features": [
"A-与正版隔离"
],
"requires": [],
"verified_on": [
"2.61.0.37"
],
"edit": {
"offset": 0,
"data": {
"encoding": "utf-16-le",
"text": "Software\\WTOffline"
},
"bytes": "53006f006600740077006100720065005c00570054004f00660066006c0069006e006500000000000000000000000000000000000000",
"expect_original": "53006f006600740077006100720065005c004700610069006a0069006e005c005700610072005400680075006e006400650072000000"
}
}
@@ -0,0 +1,8 @@
// "WarThunder" with the preceding string terminator and the following "War Thunder", 24 bytes,
// so the hit is the copy referenced by the game identity table.
// 2.61.0.37: unique hit at 0x777eb96, string at 0x777eb97.
{
"method": "signature",
"section": ".rdata",
"pattern": "00 57 61 72 54 68 75 6e 64 65 72 00 57 61 72 20 54 68 75 6e 64 65 72 00"
}
@@ -0,0 +1,23 @@
// Rename the game from WarThunder to WTOffline, which moves every per-user data folder.
// Why the executable: the engine derives Documents/AppData folders from this constant name.
// Without it: the offline client reads and rewrites the retail client's settings.
{
"id": "isolation/user-data-folder-name",
"title": "把游戏名从 WarThunder 改成 WTOffline,让离线版的用户数据目录和正版分开",
"features": [
"A-与正版隔离"
],
"requires": [],
"verified_on": [
"2.61.0.37"
],
"edit": {
"offset": 1,
"data": {
"encoding": "ascii",
"text": "WTOffline"
},
"bytes": "57544f66666c696e6500",
"expect_original": "5761725468756e646572"
}
}
@@ -0,0 +1,7 @@
// libcurl Curl_clone_primary_ssl_config from entry to the cert_blob null check, 176 bytes; branch targets are wildcards.
// 2.61.0.37: unique hit at 0x56463c0, edited instruction at +0x52 (0x5646412).
{
"method": "signature",
"section": ".text",
"pattern": "56 57 53 48 83 ec 20 48 89 d6 48 89 cf 8b 82 98 00 00 00 83 c8 20 89 82 98 00 00 00 0f b6 89 95 00 00 00 88 8a 95 00 00 00 8b 8f 90 00 00 00 89 8a 90 00 00 00 8b 8f 98 00 00 00 83 e1 01 83 e0 fe 09 c8 89 82 98 00 00 00 8b 8f 98 00 00 00 83 e1 02 83 e0 fd 09 c8 89 82 98 00 00 00 8b 8f 98 00 00 00 83 e1 04 83 e0 fb 09 c8 89 82 98 00 00 00 8b 8f 98 00 00 00 83 e1 08 83 e0 f7 09 c8 89 82 98 00 00 00 8b 8f 98 00 00 00 83 e1 10 83 e0 ef 09 c8 89 82 98 00 00 00 0f b6 87 94 00 00 00 88 82 94 00 00 00 48 8b 5f 68 48 85 db 74 ??"
}
@@ -0,0 +1,28 @@
// Clear libcurl's verifypeer and verifyhost bits when a connection copies its SSL settings.
// Why the executable: dagor.http and yuplay2 requests ignore network.blk enableSslCertCheck.
// Without it: redirected HTTPS requests (GJN purchases, item_info, redeem codes) fail the TLS handshake.
{
"id": "online/accept-local-tls-certificate",
"title": "让客户端的 HTTPS 连接接受本地服务的自签证书",
"features": [
"A-不连 Gaijin",
"G-礼包商店",
"G-兑换码"
],
"requires": [
"online/network-hook-library"
],
"verified_on": [
"2.61.0.37"
],
"edit": {
"offset": 82,
"asm": [
"and eax, -4",
"nop",
"nop"
],
"bytes": "83e0fc9090",
"expect_original": "83e0fd09c8"
}
}
@@ -0,0 +1,9 @@
// PEM header plus the DER prefix shared by every 2048-bit RSA key with exponent 65537;
// Gaijin's key bytes are not part of the pattern, so a rotated key is still found and expect_original checks it.
// The 1024-bit PEM at 0x7a3543d has a different prefix and does not match.
// 2.61.0.37: unique hit at 0x73422b0.
{
"method": "signature",
"section": ".rdata",
"pattern": "2d 2d 2d 2d 2d 42 45 47 49 4e 20 50 55 42 4c 49 43 20 4b 45 59 2d 2d 2d 2d 2d 0a 4d 49 49 42 49 6a 41 4e 42 67 6b 71 68 6b 69 47 39 77 30 42 41 51 45 46 41 41 4f 43 41 51 38 41 4d 49 49 42 43 67 4b 43 41 51 45 41"
}
@@ -0,0 +1,24 @@
// Replace the matching server public key with the local server's key.
// Why the executable: the session key is encrypted with this constant; only its private key can open it.
// Without it: the client cannot connect to the local matching server and the hangar never finishes loading.
{
"id": "online/matching-server-public-key",
"title": "把程序里匹配服务器的公钥换成本地服务的公钥,让本地服务能解出匹配连接的会话密钥",
"features": [
"J-对局模式",
"B-机库与载具"
],
"requires": [],
"verified_on": [
"2.61.0.37"
],
"edit": {
"offset": 0,
"data": {
"encoding": "ascii",
"text": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsPgD//C1npQhtyOpbO4A\npdBsJJStEDHapfM9SlKfhjuaXxJg7gn9iNkYDX9qCijXEH9iu/BVgI2d2RmHI1fC\nhmEnRtYvHiBgYYhB8lkMr0THDWgW7U6EmSjyPZ1w2uZuUKDuqkl8rksnveT0+Pz5\ngAK1SyczQteu0xoHhs/QuPN9RG/utuCWq/h6qPndPh+VQrMwr1n88eX4WFDMIRR0\n5Xoz0SLP1q5m2PrnK1jQ8asSTvU/dTbHzMX+XYyU9i5GSX2buOPug8QD1UmEJWxo\njSd8R9zs8YXAcni3IbFygDlNvP1C3r1fjtg1oqaYRXx4PDTGa8vtNpm45d7XtTyK\nWQIDAQAB\n-----END PUBLIC KEY-----\n"
},
"bytes": "2d2d2d2d2d424547494e205055424c4943204b45592d2d2d2d2d0a4d494942496a414e42676b71686b6947397730424151454641414f43415138414d49494243674b4341514541735067442f2f43316e70516874794f70624f34410a706442734a4a53744544486170664d39536c4b66686a756158784a6737676e39694e6b594458397143696a5845483969752f42566749326432526d48493166430a686d456e527459764869426759596842386c6b4d7230544844576757375536456d536a79505a317732755a75554b4475716b6c38726b736e766554302b507a350a67414b315379637a5174657530786f4868732f5175504e3952472f7574754357712f683671506e6450682b5651724d7772316e38386558345746444d495252300a35586f7a30534c503171356d3250726e4b316a51386173535476552f645462487a4d582b585979553969354753583262754f50756738514431556d454a57786f0a6a53643852397a7338595841636e69334962467967446c4e76503143337231666a7467316f7161595258783450445447613876744e706d34356437587454794b0a57514944415141420a2d2d2d2d2d454e44205055424c4943204b45592d2d2d2d2d0a",
"expect_original": "2d2d2d2d2d424547494e205055424c4943204b45592d2d2d2d2d0a4d494942496a414e42676b71686b6947397730424151454641414f43415138414d49494243674b434151454135566b754b6e6d5a3131777a66696169646b4c710a6256436f6f6448755a4b716c30547577516b2b4148306151625834773350373976584b57455751504c556156734f7a2b7a6166564455344b64764f374a2b62360a78706a6e49387632666c305653684e4e6a77664762386844364b32794532684f6466564f4e35676e6b3274456764654147443065324d38744e457869344d35770a707145545348336a6438376b6a30707a3941377231584c304d505163475664397236746e5a6f4d74754b6b786276754f326669452b4368306e41716b336461340a63424d756a43634963553849766362374733464841463572426d456c58524c6a485746566859446835336b52524c2f472f6d6e4a4a6e4b684e3638575070414d0a7167506457566f6f495731573646467a6c6f6a627338644241662f4e33616c5a4f46616378422f35373537516c7647364b38734952796d556b71396f4f6839500a62514944415141420a2d2d2d2d2d454e44205055424c4943204b45592d2d2d2d2d0a"
}
}
@@ -0,0 +1,7 @@
// The import name "WS2_32.dll" with its terminating zero, 11 bytes.
// 2.61.0.37: unique hit at 0x7a4b090 (referenced by the import descriptor Name field).
{
"method": "signature",
"section": ".rdata",
"pattern": "57 53 32 5f 33 32 2e 64 6c 6c 00"
}
@@ -0,0 +1,26 @@
// Import wto_ws.dll instead of WS2_32.dll; it forwards every export and redirects lookups and connections.
// Why the executable: many Gaijin addresses, ports and schemes are constants with no configuration entry.
// Without it: hard-coded https endpoints try the real internet and purchases/redeem codes never reach the local server.
{
"id": "online/network-hook-library",
"title": "让游戏加载离线版的网络钩子库 wto_ws.dll(代替直接加载 WS2_32.dll),把所有联网都接到本地服务",
"features": [
"A-不连 Gaijin",
"A-与正版隔离",
"G-礼包商店",
"G-兑换码"
],
"requires": [],
"verified_on": [
"2.61.0.37"
],
"edit": {
"offset": 0,
"data": {
"encoding": "ascii",
"text": "wto_ws.dll"
},
"bytes": "77746f5f77732e646c6c00",
"expect_original": "5753325f33322e646c6c00"
}
}
@@ -0,0 +1,9 @@
// First 0x60 bytes of the function, masked; a shorter prologue matches dozens of functions.
// Contains the "VRFx" archive magic comparison (56 52 46 78), a stable semantic anchor.
// Fallback: the first 0x40 bytes are also unique on 2.61.0.37; try them first if this pattern stops matching.
// 2.61.0.37: unique hit at 0x4073d30 (function 0x4073d30-0x407497d).
{
"method": "signature",
"section": ".text",
"pattern": "41 57 41 56 41 55 41 54 56 57 55 53 48 81 ec 68 01 00 00 0f 29 b4 24 50 01 00 00 48 8b 7a 40 48 85 ff 74 ?? 8b 5a 48 85 db 74 ?? 8b 42 08 83 f8 10 73 ?? 31 c0 0f 28 b4 24 50 01 00 00 48 81 c4 68 01 00 00 5b 5d 5f 5e 41 5c 41 5d 41 5e 41 5f c3 48 89 ce 4c 8b 32 41 81 3e 56 52 46 78 75 ??"
}
@@ -0,0 +1,23 @@
// Make the resource archive signature check return success.
// Why the executable: rebuilt archives cannot carry a Gaijin signature and are refused at mount time.
// Without it: the rebuilt char.vromfs.bin is not mounted and the client never learns the local addresses.
{
"id": "startup/skip-resource-archive-signature-check",
"title": "让资源包签名校验直接返回通过",
"features": [
"A-离线启动"
],
"requires": [],
"verified_on": [
"2.61.0.37"
],
"edit": {
"offset": 0,
"asm": [
"mov al, 1",
"ret"
],
"bytes": "b001c3",
"expect_original": "415741"
}
}