A game update used to fail a patch whenever any byte it compared moved, even when only an address in the instruction changed. Patch definitions now say what a change needs and read the rest from the code: - patch.jsonc holds a list of variants, each written for one game build (written_for) with its own locate block and edit; locate.jsonc is merged into it. Exactly one variant must apply, otherwise the patch is left out. GUI script patches use the same variants rule. - expect_original and the bytes to write use the signature syntax, so addresses that differ between builds can be wildcards. - A locate block can capture values at the site (rel32 targets, immediates, displacements); a rel32 fixup fills a hole in the written bytes from a capture. allow-local-host-bot-spawns now jumps to the target of the conditional jump it replaces instead of a stored distance, which makes it apply to 2.61.0.43 as well. - verified_on is gone from the definitions. patches/versions/<version>.jsonc records, per checked game build, which variant of every patch applies and where; scripts/record-game-version.ts writes it and the launcher reads the recorded versions from there. The Python tools (check-patches, patch-exe, check-gui) read the same format; check-patches assembles a variant whose assembly names captures at the site it was located at. Checked: root and launcher type checks; check-patches and check-gui on 2.61.0.37 and 2.61.0.43 (12 exe and 35 GUI patches each); check-patches and check-gui report a deliberately broken patch with a non-zero exit; build-game-copy from 2.61.0.43 into a temporary folder. The computed bytes of allow-local-host-bot-spawns on 2.61.0.37 equal the bytes it stored before. BREAKING CHANGE: Each patch needs a variants list. Move executable locators into patch.jsonc and regenerate game version records with record-game-version.ts.
36 lines
4.5 KiB
JSON
36 lines
4.5 KiB
JSON
// 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-Game modes",
|
|
"B-Hangar and vehicles"
|
|
],
|
|
"requires": [],
|
|
"variants": [
|
|
// 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.
|
|
{
|
|
"written_for": "2.61.0.37",
|
|
"locate": {
|
|
"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"
|
|
},
|
|
"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": "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 73 50 67 44 2f 2f 43 31 6e 70 51 68 74 79 4f 70 62 4f 34 41 0a 70 64 42 73 4a 4a 53 74 45 44 48 61 70 66 4d 39 53 6c 4b 66 68 6a 75 61 58 78 4a 67 37 67 6e 39 69 4e 6b 59 44 58 39 71 43 69 6a 58 45 48 39 69 75 2f 42 56 67 49 32 64 32 52 6d 48 49 31 66 43 0a 68 6d 45 6e 52 74 59 76 48 69 42 67 59 59 68 42 38 6c 6b 4d 72 30 54 48 44 57 67 57 37 55 36 45 6d 53 6a 79 50 5a 31 77 32 75 5a 75 55 4b 44 75 71 6b 6c 38 72 6b 73 6e 76 65 54 30 2b 50 7a 35 0a 67 41 4b 31 53 79 63 7a 51 74 65 75 30 78 6f 48 68 73 2f 51 75 50 4e 39 52 47 2f 75 74 75 43 57 71 2f 68 36 71 50 6e 64 50 68 2b 56 51 72 4d 77 72 31 6e 38 38 65 58 34 57 46 44 4d 49 52 52 30 0a 35 58 6f 7a 30 53 4c 50 31 71 35 6d 32 50 72 6e 4b 31 6a 51 38 61 73 53 54 76 55 2f 64 54 62 48 7a 4d 58 2b 58 59 79 55 39 69 35 47 53 58 32 62 75 4f 50 75 67 38 51 44 31 55 6d 45 4a 57 78 6f 0a 6a 53 64 38 52 39 7a 73 38 59 58 41 63 6e 69 33 49 62 46 79 67 44 6c 4e 76 50 31 43 33 72 31 66 6a 74 67 31 6f 71 61 59 52 58 78 34 50 44 54 47 61 38 76 74 4e 70 6d 34 35 64 37 58 74 54 79 4b 0a 57 51 49 44 41 51 41 42 0a 2d 2d 2d 2d 2d 45 4e 44 20 50 55 42 4c 49 43 20 4b 45 59 2d 2d 2d 2d 2d 0a",
|
|
"expect_original": "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 35 56 6b 75 4b 6e 6d 5a 31 31 77 7a 66 69 61 69 64 6b 4c 71 0a 62 56 43 6f 6f 64 48 75 5a 4b 71 6c 30 54 75 77 51 6b 2b 41 48 30 61 51 62 58 34 77 33 50 37 39 76 58 4b 57 45 57 51 50 4c 55 61 56 73 4f 7a 2b 7a 61 66 56 44 55 34 4b 64 76 4f 37 4a 2b 62 36 0a 78 70 6a 6e 49 38 76 32 66 6c 30 56 53 68 4e 4e 6a 77 66 47 62 38 68 44 36 4b 32 79 45 32 68 4f 64 66 56 4f 4e 35 67 6e 6b 32 74 45 67 64 65 41 47 44 30 65 32 4d 38 74 4e 45 78 69 34 4d 35 77 0a 70 71 45 54 53 48 33 6a 64 38 37 6b 6a 30 70 7a 39 41 37 72 31 58 4c 30 4d 50 51 63 47 56 64 39 72 36 74 6e 5a 6f 4d 74 75 4b 6b 78 62 76 75 4f 32 66 69 45 2b 43 68 30 6e 41 71 6b 33 64 61 34 0a 63 42 4d 75 6a 43 63 49 63 55 38 49 76 63 62 37 47 33 46 48 41 46 35 72 42 6d 45 6c 58 52 4c 6a 48 57 46 56 68 59 44 68 35 33 6b 52 52 4c 2f 47 2f 6d 6e 4a 4a 6e 4b 68 4e 36 38 57 50 70 41 4d 0a 71 67 50 64 57 56 6f 6f 49 57 31 57 36 46 46 7a 6c 6f 6a 62 73 38 64 42 41 66 2f 4e 33 61 6c 5a 4f 46 61 63 78 42 2f 35 37 35 37 51 6c 76 47 36 4b 38 73 49 52 79 6d 55 6b 71 39 6f 4f 68 39 50 0a 62 51 49 44 41 51 41 42 0a 2d 2d 2d 2d 2d 45 4e 44 20 50 55 42 4c 49 43 20 4b 45 59 2d 2d 2d 2d 2d 0a"
|
|
}
|
|
}
|
|
]
|
|
}
|