Logo FSBarV1_Archived

SmfParser Module

Parses BAR Spring Map Files (.sd7 / .smf) from disk into an SmfMap value that downstream primitives can consume without a running engine.

Functions and values

Function or value Description

listInstalledMaps ()

Full Usage: listInstalledMaps ()

Parameters:
    () : unit

Returns: string list

Return absolute paths to every .sd7 archive currently installed at the standard BAR path (~/.local/state/Beyond All Reason/maps/). Returns an empty list when BAR is not installed — callers decide whether that is an error or a skip signal.

() : unit
Returns: string list

parseBytes sourceName bytes

Full Usage: parseBytes sourceName bytes

Parameters:
    sourceName : string - Label recorded in SourceArchive for diagnostics.
    bytes : byte[] - Raw SMF byte buffer.

Returns: Result<SmfMap, SmfParseError>

Parse raw SMF bytes directly (no 7-zip extraction step). Used by unit tests that inject a minimal synthetic SMF payload without going through the filesystem.

sourceName : string

Label recorded in SourceArchive for diagnostics.

bytes : byte[]

Raw SMF byte buffer.

Returns: Result<SmfMap, SmfParseError>

parseSd7 sd7Path

Full Usage: parseSd7 sd7Path

Parameters:
    sd7Path : string - Absolute path to the .sd7 archive.

Returns: Result<SmfMap, SmfParseError> Ok SmfMap on success, or Error with a descriptive payload.

Parse a .sd7 archive by extracting its embedded .smf via bsdtar and decoding the resulting bytes. Thread-safe: each call uses its own temp directory and cleans up afterwards.

sd7Path : string

Absolute path to the .sd7 archive.

Returns: Result<SmfMap, SmfParseError>

Ok SmfMap on success, or Error with a descriptive payload.

toMapGrid smf

Full Usage: toMapGrid smf

Parameters:
Returns: MapGrid

Convert an SmfMap to a MapGrid for consumption by Pathing / Chokepoints / WallIn / BasePlan. LOS and radar layers are zero-initialised (an offline SMF has no runtime visibility data).

smf : SmfMap
Returns: MapGrid

Type something to start searching.