Files
WT-Offline/native/wto-net/src/local_mp_values.h
T
N0VAN0M4LY fdac56a036 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.
2026-11-29 12:26:11 +08:00

83 lines
4.4 KiB
C

/*
* What the LocalMP modules need from aces.exe, as resolved by the build (patches/native/*.jsonc,
* @wto/patcher native-resolve.ts) and handed over in wto_ws.cfg. Nothing here is a constant of a
* game build: functions and globals are absolute addresses in this process, structure offsets are
* what the definitions captured from the code.
*
* lmp_values_load(module) fills the fields of one module (local_mp_values.c); a module whose values
* are not all present is left off. The build only writes the values of modules that resolved
* completely together with the modules they require.
*/
#pragma once
#include <stddef.h>
#include <stdint.h>
typedef struct LmpValues {
/* local_mp_core */
uint8_t *do_respawn_player, *get_player_country, *refl_dtor, *aircraft_change_result, *set_player_gui_state;
uint8_t *get_unit_by_eid, *set_owning_mplayer, *iground_on_dead, *datablock_get_str, *datablock_set_from;
uint8_t *mp_construct_local, *gui_state_update, *unit_change_aircraft, *dagmem_alloc;
uint8_t *multiplayer, *app, *local_mplayer, *hero, *mission_settings, *stdmem, *player_count, *player_table;
size_t mp_is_host, mp_is_local_mp, mp_chat_host, mp_pid, mp_user_id, mp_team, mp_broken_slots, mp_unit_eid;
size_t match_team, app_score_rules, app_econ_holder, econ_state, econ_change_req;
size_t unit_type, unit_mplayer, unit_info, unit_info_name, mis_custom_bots;
/* local_mp_players */
uint8_t *mplayer_init_matching, *is_slot_ready_at_host;
size_t mp_gui_state, mp_used_spares, mis_allies_country, mis_axis_country, mis_arcade_country;
/* local_mp_loadout */
uint8_t *sem_change_aircraft_send, *refl_ctor, *datablock_dtor, *bullet_vec_assign, *get_decals_blk;
uint8_t *get_attachables_blk, *str_hash_fnv1, *namemap_add_name_id, *crew_skills_init;
size_t refl_bullets, refl_disabled_mods, refl_enabled_mods, refl_custom_preset, refl_attachables, refl_decals;
size_t refl_custom_skin, refl_skin, refl_weapon, refl_unit, refl_flags, refl_gun_convergence;
size_t refl_vertical_targeting, refl_bomb_fuse, refl_fuel;
size_t mp_resp_base_id, mp_spawn_delay_a, mp_spawn_delay_b, mp_spawn_pos_x, mp_spawn_pos_y, mp_spawn_pos_z;
/* Change request members: captured as offsets in the economic state, used relative to the request. */
size_t econ_req_slot_id, econ_req_bullets_begin, econ_req_bullets_end;
size_t req_slot_id, req_bullets_begin, req_bullets_end;
size_t unit_crew_skills;
/* local_mp_actions */
uint8_t *mp_init_chat;
size_t mp_chat, mp_team1_countries, mp_team2_countries;
/* local_mp_awards */
uint8_t *blk_ctor, *blk_set_str, *blk_to_owned, *blk_set_int, *hud_notify_script, *blk_dtor, *game_save_data;
size_t gsd_hud_queue, unit_info_exp_class;
/* local_mp_scores */
uint8_t *datablock_get_real;
size_t mis_custom_score_params;
/* local_mp_kills */
uint8_t *mplayer_add_score, *net_mark_dirty, *on_unit_dead_once, *iground_award_assists;
size_t mp_score, mp_stat_dirty, mp_stat_payload, unit_skip_kill, unit_severe_idx, unit_severe_uid, unit_severe_pid;
size_t igm_already_dead, igm_dead_silent, igm_bailout_dead, igm_offenders_count, igm_offenders, offender_size;
size_t igm_killer, igm_killer_uid, igm_killer_pid, igm_killer_army, unit_vtf_choose_offender;
size_t unit_army, offender_army, offender_uid, offender_pid;
size_t mp_kills, mp_ground_kills, mp_human_kills, mp_naval_kills, mp_team_kills, mp_ai_kills;
size_t mp_ai_ground_kills, mp_ai_naval_kills, mp_assists, mp_deaths, mp_capture_zone, mp_fallback_score;
size_t mp_award_damage, mp_air_severe_dmg, mp_ship_severe_dmg;
/* local_mp_events */
uint8_t *dispatch_assist, *dispatch_capture_zone, *dispatch_hit_crit, *dispatch_severe_damage, *dispatch_naval_damage;
size_t offender_assist_sent;
/* local_mp_nuke */
uint8_t *shell_launch, *shell_explode, *cta_logic_action;
size_t shell_launch_record, shell_rec_instant_win, mission_vars_data, mission_vars_count, mission_var_stride;
ptrdiff_t mission_var_bias, mission_var_name_disp, mission_var_value_disp;
size_t mission_var_name, mission_var_value;
/* local_mp_support */
uint8_t *set_controlled_unit;
size_t mp_support_unit_eid, mp_support_unit_ptr;
} LmpValues;
extern LmpValues g_lmp;
/* Fill the values of `module` ("local_mp_core", ...); returns 0 and logs the first missing one. */
int lmp_values_load(const char *module);