Skip to main content

Module symloader

Module symloader 

Source
Expand description

Loads pack files and populates the SymbolRegistry.

Pack files use 2004scape’s id=name format (matching CompilerTypeInfo.load). Constants are loaded from .constant files in the scripts directory.

Functions§

collect_all_files
Recursively collect every file under dir in a single traversal, in read_dir order (each directory recursed as it is encountered).
load_constant_files
Load all .constant files from the scripts directory, matching 2004scape’s loadDirExtFull(scripts_dir, '.constant', ...) behavior.
load_dbtable_configs
Scan .dbtable files under scripts_dir and register each column as a compound entity ID table:column → packed int, mirroring 2004scape’s runescript lookup.
load_dbtable_pack
Load dbtable.pack as a name → id map. Used by load_dbtable_configs.
load_engine_command_params
Parse the parameter types declared in an engine.rs2 file and populate registry.command_param_types. Lines like: [command,sound_synth](synth $sound, int $loops, int $delay) are parsed to extract the ordered list of parameter types per command.
load_game_var_types
Scan the game-var configs and refine the type of each matching game-var. load_game_vars defaults everything to Type::Int; the real type comes from the type=<typename> line in the config block. Only varp, varn, vars and varbit are registered from their file alone; the cache’s tables number the others, through their .pack.
load_packs
Load all .pack files from pack_dir into registry.
patch_command_return_types
Patch return types for commands whose signatures are not in engine.rs2 but are known to return values in the Neptune compiler. Without this, statement-level calls to these commands will be missing POP_INT_DISCARD / POP_STRING_DISCARD.