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.
 

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 23 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 67 of file cli.py.

References sl2.cli._save_globs().

Referenced by sl2.cli.main().

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 90 of file cli.py.

References sl2.cli.auto_find_save(), sl2.cli.print_validation(), sl2.cli.warn_foreign_folder(), 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 216 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 238 of file cli.py.

Referenced by sl2.cli.main().

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 260 of file cli.py.

Referenced by sl2.cli.main().

Here is the caller graph for this function: