Unit::loadCrew previously skipped reading the player's equipped crew from the profile whenever Multiplayer+0x60 (host flag) was non-zero, leaving human players with default skills and no Expert/Ace bonuses. Calling UnitCrewSkills::initFromSave after Unit::changeAircraft in the native loadout hook ran too late to affect live vehicle crew state. Add exe patch battle/load-local-host-player-crew to check both the host and LocalMP flags (+0x60 and +0x61) in Unit::loadCrew so only non-LocalMP hosts skip directly to the default crew while preserving the owner check. Remove the late initFromSave workaround from local_mp_loadout.c (keeping its native patch sites for compatibility with 0.1.2 hook DLLs) and add the E-Crew skills in battle feature labels to the launcher locales. Verified with check-patches on 2.61.0.37 (0x10025dd) and 2.61.0.58 (0x100700d), native wto_ws.dll build, launcher typecheck and build; pending in-game verification.
44 lines
1.8 KiB
JSON
44 lines
1.8 KiB
JSON
// Let Unit::loadCrew read the local player's equipped crew when the multiplayer host is LocalMP.
|
|
// Why the exe: native initialization skips the profile on hosts before it builds the live crew object.
|
|
// Without it: a human player's LocalMP unit receives default skills instead of the crew in the profile.
|
|
{
|
|
"id": "battle/load-local-host-player-crew",
|
|
"title": "Load the equipped player's crew on a LocalMP host",
|
|
"features": ["E-Crew skills in battle"],
|
|
"requires": [],
|
|
"variants": [
|
|
// Unit::loadCrew tests the host flag, then the unit's player bit and the local player ID.
|
|
// The adjacent host and LocalMP fields are boolean bytes at +0x60 and +0x61 in Multiplayer.
|
|
// Keep the owner checks and skip to the default crew only for a non-LocalMP host.
|
|
// 2.61.0.37: site 0x10025d6, edit at 0x10025dd; 2.61.0.58: edit at 0x100700d.
|
|
{
|
|
"written_for": "2.61.0.37",
|
|
"locate": {
|
|
"method": "signature",
|
|
"section": ".text",
|
|
"pattern": "48 8b 05 ?? ?? ?? ?? 48 85 c0 74 0a 80 78 60 00 0f 85 ?? ?? ?? ?? 8b 86 90 00 00 00 a9 00 01 00 00 75 15 48 8b 05 ?? ?? ?? ?? 8b 80 a4 05 00 00 39 c5",
|
|
"captures": {
|
|
"default_crew": { "offset": 18, "type": "rel32" }
|
|
}
|
|
},
|
|
"edit": {
|
|
"offset": 7,
|
|
"asm": [
|
|
"test rax, rax",
|
|
"je check_owner",
|
|
"cmp word ptr [rax + 0x60], 1",
|
|
"je {default_crew}",
|
|
"check_owner:",
|
|
"test byte ptr [rsi + 0x91], 1",
|
|
"nop",
|
|
"nop",
|
|
"nop"
|
|
],
|
|
"bytes": "48 85 c0 74 0b 66 83 78 60 01 0f 84 ?? ?? ?? ?? f6 86 91 00 00 00 01 90 90 90",
|
|
"expect_original": "48 85 c0 74 0a 80 78 60 00 0f 85 ?? ?? ?? ?? 8b 86 90 00 00 00 a9 00 01 00 00",
|
|
"fixups": [{ "at": 12, "type": "rel32", "target": "default_crew" }]
|
|
}
|
|
}
|
|
]
|
|
}
|