Skip to main content

Crate ltk_fantome

Crate ltk_fantome 

Source
Expand description

Reading and writing the legacy Fantome (.fantome) archive format.

This crate handles the format itself: the metadata shapes stored in META/info.json, FantomeWriter for producing archives, and FantomeReader for consuming them. Turning a mod project into an archive (and back) lives in ltk_mod_project’s fantome module, which composes the primitives here.

Three operations rewrite an archive in place of reading it: add_hashtables embeds a mod’s names into one, normalize_archive holds its packed WADs stored so a reader can seek to them, and apply_delta repairs its content - chunks inside a packed WAD, whole entries, or both - without repacking the mod. All three raw-copy everything they do not themselves replace, and all three belong to a caller working on a copy it owns.

What normalizing buys is spent twice over. FantomeReader::mount_packed_wad reads a packed WAD an archive stores chunk by chunk where it lies, so looking inside one costs its TOC and the chunks asked for rather than the whole archive unpacked to a directory; and apply_delta rewrites that WAD’s tail in place of rebuilding it, so a repair costs what changed rather than what the mod holds.

Re-exports§

pub use error::FantomeExtractError;
pub use error::FantomeWriteError;

Modules§

error
Errors returned when reading and writing Fantome data.

Structs§

ArchiveDelta
The change to make to an archive: chunks inside packed WADs, whole entries, or both.
DeltaProgress
One step of an apply_delta, reported before the step is taken.
DeltaReport
What applying a delta wrote.
FantomeDistributor
The Distributor declaration in a Fantome info.json.
FantomeHashtable
One Hashtables manifest entry in a Fantome info.json.
FantomeInfo
Fantome metadata structure that goes into info.json
FantomeLayerInfo
Per-layer metadata in a Fantome info.json.
FantomeReader
Reads a Fantome archive entry by entry.
FantomeWriter
Writes a Fantome archive entry by entry.
LayerWad
One WAD an archive holds, and the layer holding it.
NoResolver
Re-exported because this crate’s own signatures name them.
PackedWadSource
A packed WAD’s bytes, addressed from the WAD’s own first byte.
SkippedHashtable
A hashtable declaration that a read skipped, and the reason it was skipped.
Wad
Re-exported because this crate’s own signatures name them.
WadExtractOptions
How FantomeReader::extract_wads unpacks what it finds.
WadProgress
One WAD’s turn in FantomeReader::extract_wads, reported before the WAD is written.

Enums§

DeltaStep
What an apply_delta step is doing.
FantomeDeltaError
Failure to apply a delta to an archive.
FantomeEntry
Where an archive’s file entries belong, by their names.
FantomeLicense
The license declaration in a Fantome info.json.
FantomeNormalizeError
Failure to normalize an archive.
FantomeRewriteError
Failure to rewrite an archive.
HashtableSkipReason
The reason a read skipped a hashtable declaration.
NamingPolicy
Re-exported because this crate’s own signatures name them.
NormalizeOutcome
What a normalize did.
RewriteOutcome
What a rewrite did.

Constants§

BASE_LAYER
The name of the base layer, whose WAD directory is WAD/.
GAME_DATA_MANIFEST
The layer-relative name of a layer’s declarations under META/game_data/<layer>/.

Traits§

PathResolver
Re-exported because this crate’s own signatures name them.

Functions§

add_hashtables
Merge names into the archive reader holds, writing the result to sink.
apply_delta
Rewrite the archive at source into dest, applying delta and nothing else.
classify_entry
Where the file named entry_name belongs.
free_table_path
Returns the first conventional table path for category that is_taken rejects.
game_data_entry_name
The archive entry name of the override file or manifest at path in layer: META/game_data/{layer}/{path}.
is_layer_name
Whether name can name a layer’s WAD directory: one or more ASCII letters, digits, - or _.
normalize_archive
Normalize the .fantome archive at source, writing the result to dest.
replace_entries
Write entries in place of what the archive holds, and merge names.
store_packed_wads
Write the archive reader holds to sink, its packed WADs stored.
wad_entry_name
The archive entry name of path in layer’s WAD directory: WAD/{path} for BASE_LAYER in any casing, WAD_{layer}/{path} for any other layer.