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§
- Archive
Delta - The change to make to an archive: chunks inside packed WADs, whole entries, or both.
- Delta
Progress - One step of an
apply_delta, reported before the step is taken. - Delta
Report - What applying a delta wrote.
- Fantome
Distributor - The
Distributordeclaration in a Fantome info.json. - Fantome
Hashtable - One
Hashtablesmanifest entry in a Fantome info.json. - Fantome
Info - Fantome metadata structure that goes into info.json
- Fantome
Layer Info - Per-layer metadata in a Fantome info.json.
- Fantome
Reader - Reads a Fantome archive entry by entry.
- Fantome
Writer - Writes a Fantome archive entry by entry.
- Layer
Wad - One WAD an archive holds, and the layer holding it.
- NoResolver
- Re-exported because this crate’s own signatures name them.
- Packed
WadSource - A packed WAD’s bytes, addressed from the WAD’s own first byte.
- Skipped
Hashtable - A hashtable declaration that a read skipped, and the reason it was skipped.
- Wad
- Re-exported because this crate’s own signatures name them.
- WadExtract
Options - How
FantomeReader::extract_wadsunpacks what it finds. - WadProgress
- One WAD’s turn in
FantomeReader::extract_wads, reported before the WAD is written.
Enums§
- Delta
Step - What an
apply_deltastep is doing. - Fantome
Delta Error - Failure to apply a delta to an archive.
- Fantome
Entry - Where an archive’s file entries belong, by their names.
- Fantome
License - The license declaration in a Fantome info.json.
- Fantome
Normalize Error - Failure to normalize an archive.
- Fantome
Rewrite Error - Failure to rewrite an archive.
- Hashtable
Skip Reason - The reason a read skipped a hashtable declaration.
- Naming
Policy - Re-exported because this crate’s own signatures name them.
- Normalize
Outcome - What a normalize did.
- Rewrite
Outcome - 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§
- Path
Resolver - Re-exported because this crate’s own signatures name them.
Functions§
- add_
hashtables - Merge
namesinto the archivereaderholds, writing the result tosink. - apply_
delta - Rewrite the archive at
sourceintodest, applyingdeltaand nothing else. - classify_
entry - Where the file named
entry_namebelongs. - free_
table_ path - Returns the first conventional table path for
categorythatis_takenrejects. - game_
data_ entry_ name - The archive entry name of the override file or manifest at
pathinlayer:META/game_data/{layer}/{path}. - is_
layer_ name - Whether
namecan name a layer’s WAD directory: one or more ASCII letters, digits,-or_. - normalize_
archive - Normalize the
.fantomearchive atsource, writing the result todest. - replace_
entries - Write
entriesin place of what the archive holds, and mergenames. - store_
packed_ wads - Write the archive
readerholds tosink, its packed WADs stored. - wad_
entry_ name - The archive entry name of
pathinlayer’s WAD directory:WAD/{path}forBASE_LAYERin any casing,WAD_{layer}/{path}for any other layer.