Expand description
Shared data contract for the file-hooking modding system.
This crate has no Windows-specific dependencies: it is compiled into
both the launcher (which writes a HookConfig out to disk) and the
supreme_hook_proxy DLL (which reads it back and applies it). Keeping
it platform-neutral means the redirection/patch logic can be unit
tested on any host, even though the DLL that consumes it only runs on
Windows.
Module layout:
- [
error], the sharedHookConfigErrortype. mods_state, plain load/save I/O for the mods directory’s single state file (mods.json), and theMOD_FILE_NAMEconstant for each mod’s ownmod.json.mod_config,ModConfig, one mod’s authoredmod.json.ui, the optionaluisection of amod.json(ModUi): launcher buttons/popups rendered generically by the Mods page.hook_config,HookConfig, the merged/resolved shape the proxy DLL consumes, and how a mods directory becomes one.dir_listing,patch,resolver,script_engine, see their own module docs.
Re-exports§
pub use dir_listing::EntryOffsets;pub use dir_listing::FilterResult;pub use dir_listing::filter_redirected_entries;pub use dir_listing::wildcard_match;pub use dir_listing::write_directory_entry;pub use hook_config::HookConfig;pub use hook_config::RedirectionMode;pub use hook_config::RedirectionRule;pub use hook_config::ResolvedAction;pub use hook_config::RuleTarget;pub use mod_config::ModConfig;pub use mod_config::ModParameter;pub use mod_config::ParameterKind;pub use mods_state::DEFAULT_MODS_DIR_NAME;pub use mods_state::MOD_FILE_NAME;pub use mods_state::MODS_STATE_FILE_NAME;pub use mods_state::ModConfigurations;pub use mods_state::ModsPreset;pub use mods_state::ModsState;pub use mods_state::load_mods_state;pub use mods_state::save_mods_state;pub use patch::BytesReplacement;pub use patch::MemoryPatch;pub use patch::ScriptSource;pub use patch::StringReplacement;pub use resolver::HookResolver;pub use resolver::ManagedFileSpec;pub use resolver::compute_target_path;pub use resolver::is_write_operation;pub use resolver::managed_file_specs;pub use resolver::seed_target_file;pub use ui::ModUi;pub use ui::UiButton;pub use ui::UiField;pub use ui::UiFieldKind;pub use ui::UiPopup;pub use ui::UiPopupKind;pub use validation::PLAYER_NAME_TAG;pub use validation::ROOM_NAME_TAG;pub use validation::is_known_tag;pub use validation::validate_value;
Modules§
- dir_
listing - Pure logic supporting
hooks::query_dir’s directory-listing hook: buffer rewriting, plus the glob-style filename matching used to decide which mod-provided files belong in a given listing. - hook_
config - The merged, resolved redirection config the proxy DLL actually
consumes:
HookConfig(a flat list ofRedirectionRules) andResolvedAction, the outcome of resolving one requested path against it. Distinct fromcrate::mod_config::ModConfig, which is the per-mod authored (possibly conditional/templated) shape, seeModConfig::resolved_rulesfor how one becomes the other. - mod_
config - The per-mod authored shape:
ModConfig(one mod’smod.json, metadata, conditional/templated rules, and the parameters it exposes), plus the${param_id}substitution/gating logic that turns it into the plaincrate::hook_config::RedirectionRulescrate::hook_config::HookConfig::load_from_mods_dirmerges across mods. - mods_
state - On-disk I/O for the mods directory’s single state file:
ModsState(persisted asmods.json), which replaces the olderenabled_mods.json+mod_configuration.jsonpair. Consolidating them fixes a specific bug in that older layout: with two files, a mod’s display position was reconstructed at load time from which bucket it happened to be in (enabled vs. not), so toggling a mod would visibly reshuffle the whole list. - patch
- resolver
- Disk-aware resolution: given a loaded
HookConfigplus a game directory and a scratch/temp directory, decide what should happen to a givenrel_keyfor reads, writes, and deletes, including staging patched replacement files and seeding write targets. - script_
engine - Encapsulates all Rhai usage for the modding system.
- ui
- The optional
uisection of a mod’smod.json, the launcher-UI schema the Mods page renders generically: buttons shown for the mod, and the popups those buttons open. Seecrate::mod_config::ModConfig::ui, which holds this as anOption, a mod without auisection (e.g. the existing practice-as-race mod) stays fully valid and simply gets no buttons. - validation
- Shared field-validation tags for mod-authored inputs.