refactor(native)!: load LocalMP values from the build configuration

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.
This commit is contained in:
N0VAN0M4LY committed 2026-11-29 12:26:11 +08:00
1 parent dde852e2b1
commit fdac56a036
23 files changed
+721 -805

No files matched your search

+12 -14
View File
@@ -2,8 +2,8 @@
* Shared internal state, resolved engine pointers, and subsystem interfaces
* for the LocalMP in-process host bridge.
*
* All addresses are resolved dynamically from masked .text signatures in
* local_mp_offsets.h and every detour is gated on local_mp_is_host().
* Addresses and structure offsets come from the build (local_mp_values.h); every detour is gated
* on local_mp_is_host().
*/
#pragma once
@@ -48,8 +48,6 @@ extern LmpGetUnitByEidFn g_lmp_get_unit_by_eid;
extern LmpSetOwningMPlayerFn g_lmp_set_owning_mplayer;
extern LmpDataBlockGetStrFn g_lmp_datablock_get_str;
uint8_t *local_mp_scan_unique(const uint8_t *base, size_t size, const char *name, const char *spec);
void *local_mp_resolve_rip(const uint8_t *insn, size_t disp_off, size_t insn_len);
int local_mp_is_host(void);
int local_mp_is_local_mplayer(const uint8_t *mp);
uint8_t *local_mp_econ_state(void);
@@ -84,13 +82,13 @@ void local_mp_add_mplayer_score(uint8_t *mp, float delta, uint32_t event_id);
void local_mp_mark_mplayer_dirty(uint8_t *mp);
void local_mp_inc_mplayer_stat(uint8_t *mp, size_t off);
/* Subsystem hook installers invoked once from install_local_mp_hooks(). */
int install_local_mp_player_hooks(const uint8_t *text, size_t text_size, uint8_t *p_do_respawn);
int install_local_mp_loadout_hooks(const uint8_t *text, size_t text_size);
int install_local_mp_action_hooks(const uint8_t *text, size_t text_size);
int install_local_mp_award_hooks(const uint8_t *text, size_t text_size, uint8_t *p_ground_dead);
int install_local_mp_kill_hooks(const uint8_t *text, size_t text_size, uint8_t *p_ground_dead);
int install_local_mp_event_hooks(const uint8_t *text, size_t text_size);
int install_local_mp_score_reader(const uint8_t *text, size_t text_size);
int install_local_mp_nuke_hooks(const uint8_t *text, size_t text_size);
int install_local_mp_support_hooks(const uint8_t *text, size_t text_size);
/* Module hook installers, called by install_local_mp_hooks() once the module's values are loaded. */
int install_local_mp_player_hooks(void);
int install_local_mp_loadout_hooks(void);
int install_local_mp_action_hooks(void);
int install_local_mp_award_hooks(void);
int install_local_mp_kill_hooks(void);
int install_local_mp_event_hooks(void);
int install_local_mp_score_reader(void);
int install_local_mp_nuke_hooks(void);
int install_local_mp_support_hooks(void);