Skip to content

Commit

Permalink
docs: Add PlugY save data format info
Browse files Browse the repository at this point in the history
  • Loading branch information
squeek502 committed Aug 19, 2018
1 parent ebf941d commit 90114d3
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules/
html/
xml/
latex/
package-lock.json
4 changes: 4 additions & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@

* [Introduction](INDEX.md)
* [API Reference](api.md)

### File Structures

* [PlugY Save Files (.sss/.d2x)](formats/plugy.md)
2 changes: 1 addition & 1 deletion docs/book.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"plugins": ["theme-official","-sharing","-fontsettings","-search"],
"plugins": ["theme-official","-sharing","-fontsettings","-search","-lunr"],
"title": "d2itemreader",
"github_url": "https://github.com/squeek502/d2itemreader",
"structure": {
Expand Down
51 changes: 51 additions & 0 deletions docs/formats/plugy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
## PlugY Shared Stash (.sss) File Format

Byte Offset | Size (bytes) | Description
------------|:------------:|-------------
0x00 | 4 | File header. Must be "SSS\0" (0x00535353 when read as a 32 bit unsigned integer).
0x04 | 2 | File version. Will be "01" (0x3130) when file version is 1, or "02" (0x3230) when file version is 2.

#### File version 1

When the file version is "01", there will be no shared gold data in the file.

Byte Offset | Size (bytes) | Description
------------|:------------:|-------------
0x06 | 4 | Number of pages in the stash data as a 32 bit unsigned integer
0x0A | ... | Beginning of [Stash data](#stash-data-format)

#### File version 2

When the file version is "02", there will be shared gold data in the file.

Byte Offset | Size (bytes) | Description
------------|:------------:|-------------
0x06 | 4 | Shared gold as a 32 bit unsigned integer
0x0A | 4 | Number of pages in the stash data as a 32 bit unsigned integer
0x0E | ... | Beginning of [Stash data](#stash-data-format)

## PlugY Personal Stash (.d2x) File Format

Byte Offset | Size (bytes) | Description
------------|:------------:|-------------
0x00 | 4 | File header. Must be "CSTM" (0x4D545343 when read as a 32 bit unsigned integer).
0x04 | 2 | File version. Will be "01" (0x3130) when file version is 1. No other versions are in use currently.
0x06 | 4 | Unused bytes
0x0A | 4 | Number of pages in the stash data as a 32 bit unsigned integer
0x0E | ... | Beginning of [Stash data](#stash-data-format)

## Stash Data Format

For each stash page:

Byte Offset | Size (bytes) | Description
------------|:------------:|-------------
0x00 | 2 | Stash header. Must be "ST" (0x5453 when read as a 16 bit unsigned integer).
0x02 | 0 or 4 | Flags data (added in PlugY 11.02, doesn't exist in save data from earlier versions). The actual flags can be seen [here](https://github.com/ChaosMarc/PlugY/blob/0116cb44b459ba02832cf8f07092ce4f48aeecdf/PlugY/playerCustomData.h#L19-L27). <br/><br/> It's possible to determine if the flags data exists by checking if the 2 bytes following the next null character == the D2 item header ("JM"); see [the PlugY source code for an example](https://github.com/ChaosMarc/PlugY/blob/0116cb44b459ba02832cf8f07092ce4f48aeecdf/PlugY/InfinityStash.cpp#L258-L264).
0x02 or 0x06 | At least 1 | Stash page name as a null-terminated string. Can be a maximum of 15 characters + the null terminator (16 total bytes).
Varies | ... | Beginning of [D2 Inventory data](formats/d2.md#inventory-data-format)

## Sources / Further Reading

* [PlugY save files structures (The Phrozen Keep)](https://d2mods.info/forum/viewtopic.php?f=133&t=31359)
* [loadStash (PlugY 11.02 Source Code)](https://github.com/ChaosMarc/PlugY/blob/0116cb44b459ba02832cf8f07092ce4f48aeecdf/PlugY/InfinityStash.cpp#L243-L282)

0 comments on commit 90114d3

Please sign in to comment.