SL2 Analyzer
Read a FromSoftware .sl2 save and report what is in it
Loading...
Searching...
No Matches
sl2.cli Namespace Reference

Functions

 _save_globs ()
 Folders a Souls save can live in, per OS.
 
 auto_find_save ()
 Find a .sl2 when none was given on the command line.
 
 main ()
 Program entry point.
 
 print_validation (save, data)
 Print each character's validation block to the terminal.
 
 warn_foreign_folder (path, save)
 Warn when a save is sitting in a folder belonging to a different account.
 
 write_out (path, text)
 Write the document, making the output folder if it does not exist yet.
 
 edit_save (args)
 Apply one or both copy-only edits and atomically create the requested .sl2.
 
 write_archive_manifest (option, archive, data, save, source=None, operations=None, force=False)
 Write a small, auditable sidecar describing one parsed archive copy.
 
 archive_manifest_path (option, archive)
 Resolve an explicit archive sidecar path, or the archive's default neighbor.
 
 verify_archive (paths, base_dir)
 Read every named archive and report BND4, parse, and ownership status.
 

Detailed Description

Command line: argument parsing, save auto-detection, and main().

Function Documentation

◆ _save_globs()

sl2.cli._save_globs ( )
protected

Folders a Souls save can live in, per OS.

Each game keeps its .sl2 in a game-named subfolder, hence the trailing */. Steam/Proton, Heroic, Lutris, and plain Wine all mirror the Windows APPDATA% tree inside a prefix, so the tail of every glob is the same .../AppData/Roaming/<game>/*.sl2.

Definition at line 27 of file cli.py.

Referenced by sl2.cli.auto_find_save().

Here is the caller graph for this function:

◆ auto_find_save()

sl2.cli.auto_find_save ( )

Find a .sl2 when none was given on the command line.

Globs the current folder and the usual Steam/Proton and Windows save locations, and returns the most recently modified match — the live character is almost always the newest file. Exits with a clear message if nothing is found.

Returns
The path to the chosen save.

Definition at line 71 of file cli.py.

References sl2.cli._save_globs().

Referenced by sl2.cli.main(), and sl2.cli.verify_archive().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

sl2.cli.main ( )

Program entry point.

Output format follows the -o extension (.json → JSON, anything else → Markdown) unless –format says otherwise, so the common case is one flag, not two.

Returns
None. Writes the chosen file and prints where it went.

Definition at line 94 of file cli.py.

References sl2.cli.auto_find_save(), sl2.cli.edit_save(), sl2.cli.print_validation(), sl2.cli.verify_archive(), sl2.cli.warn_foreign_folder(), sl2.cli.write_archive_manifest(), and sl2.cli.write_out().

Here is the call graph for this function:

◆ print_validation()

sl2.cli.print_validation (   save,
  data 
)

Print each character's validation block to the terminal.

The findings are already in the document; this is so a run that was only asking "does this save add up" answers without opening the file. Stdout, one block per character, in the shape validators/text.py defines.

Parameters
saveThe parsed sl2.convert.SaveData. data The file bytes, for the file-level rules.

Definition at line 287 of file cli.py.

Referenced by sl2.cli.main().

Here is the caller graph for this function:

◆ warn_foreign_folder()

sl2.cli.warn_foreign_folder (   path,
  save 
)

Warn when a save is sitting in a folder belonging to a different account.

DS3, Sekiro and Elden Ring write the owning account into the save, and the game only reads a save back from the folder named for that account — so a save whose account id changed underneath it (a Steam emulator reconfigured, a different profile) will not load, and the game says nothing useful about why. Comparing the two is free once both are known.

Note
Deliberately printed to STDERR and never into the document: the browser cannot see a dropped file's folder, and the two front ends have to stay byte-identical.
Parameters
pathThe save file's path.
saveThe parsed sl2.convert.SaveData.

Definition at line 309 of file cli.py.

Referenced by sl2.cli.main(), and sl2.cli.verify_archive().

Here is the caller graph for this function:

◆ write_out()

sl2.cli.write_out (   path,
  text 
)

Write the document, making the output folder if it does not exist yet.

Definition at line 331 of file cli.py.

Referenced by sl2.cli.main().

Here is the caller graph for this function:

◆ edit_save()

sl2.cli.edit_save (   args)

Apply one or both copy-only edits and atomically create the requested .sl2.

Definition at line 341 of file cli.py.

References sl2.cli.archive_manifest_path(), and sl2.cli.write_archive_manifest().

Referenced by sl2.cli.main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_archive_manifest()

sl2.cli.write_archive_manifest (   option,
  archive,
  data,
  save,
  source = None,
  operations = None,
  force = False 
)

Write a small, auditable sidecar describing one parsed archive copy.

Definition at line 406 of file cli.py.

References sl2.cli.archive_manifest_path().

Referenced by sl2.cli.edit_save(), and sl2.cli.main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ archive_manifest_path()

sl2.cli.archive_manifest_path (   option,
  archive 
)

Resolve an explicit archive sidecar path, or the archive's default neighbor.

Definition at line 458 of file cli.py.

Referenced by sl2.cli.edit_save(), and sl2.cli.write_archive_manifest().

Here is the caller graph for this function:

◆ verify_archive()

sl2.cli.verify_archive (   paths,
  base_dir 
)

Read every named archive and report BND4, parse, and ownership status.

Definition at line 463 of file cli.py.

References sl2.cli.auto_find_save(), and sl2.cli.warn_foreign_folder().

Referenced by sl2.cli.main().

Here is the call graph for this function:
Here is the caller graph for this function: