|
SL2 Analyzer
Read a FromSoftware .sl2 save and report what is in it
|
Functions | |
| read_uint (buf, off, size) | |
| Read a little-endian unsigned integer, or None if it would run past the end of the buffer. | |
| u8 (buf, off) | |
| One-byte read. | |
| u16 (buf, off) | |
| Two-byte read. | |
| u32 (buf, off) | |
| Four-byte read. | |
| u64 (buf, off) | |
| Eight-byte read. | |
| read_utf16 (buf, off, max_char) | |
| Decode a UTF-16LE string that ends at the first null pair. | |
| is_valid_name (name) | |
| Decide whether a decoded string is a plausible character name. | |
Variables | |
| NAME_OK = set("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 -_'") | |
| The only characters a real player name may contain. | |
Safe, bounds-checked readers. Nothing anywhere in the package indexes a buffer without going through these. A read that would run off the end returns None (or "") instead of raising or reading whatever happens to sit past it.
| sl2.reader.read_uint | ( | buf, | |
| off, | |||
| size | |||
| ) |
Read a little-endian unsigned integer, or None if it would run past the end of the buffer.
| buf | The bytes to read from. |
| off | Byte offset. A negative offset is treated as out of range. |
| size | Width in bytes (1, 2, 4, or 8). |
| sl2.reader.u8 | ( | buf, | |
| off | |||
| ) |
| sl2.reader.u16 | ( | buf, | |
| off | |||
| ) |
| sl2.reader.u32 | ( | buf, | |
| off | |||
| ) |
| sl2.reader.u64 | ( | buf, | |
| off | |||
| ) |
| sl2.reader.read_utf16 | ( | buf, | |
| off, | |||
| max_char | |||
| ) |
Decode a UTF-16LE string that ends at the first null pair.
Souls names are UTF-16LE and not always fixed-length, so this reads a bounded window and stops at the first 0x0000. Returns an empty string on a bad read rather than raising.
| buf | The bytes to read from. |
| off | Where the string starts. |
| max_char | Maximum characters to consider. |
| sl2.reader.is_valid_name | ( | name | ) |