@zebbedaja/er-save-parser 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -14
- package/dist/index.d.mts +1 -2
- package/dist/index.mjs +2739 -11
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
# ER Save Parser
|
|
2
2
|
|
|
3
|
+

|
|
4
|
+
[](https://www.npmjs.com/package/@zebbedaja/er-save-parser)
|
|
5
|
+
[](https://www.npmjs.com/package/@zebbedaja/er-save-parser)
|
|
6
|
+

|
|
7
|
+
[](LICENSE)
|
|
8
|
+
|
|
3
9
|
Parse Elden Ring PC save files into structured TypeScript/JavaScript objects.
|
|
4
10
|
|
|
5
11
|
## Features
|
|
6
12
|
|
|
7
13
|
- **Full save slot parsing** — all 10 slots with character data, attributes, Flask counts, regions visited, death count, and more
|
|
8
|
-
- **Event flag decoding** — track boss defeats, quest progress, and ending states
|
|
14
|
+
- **Event flag decoding** — track boss defeats, quest progress, and ending states
|
|
9
15
|
- **Settings extraction** — camera, audio, HDR, ray tracing, and other game settings
|
|
10
16
|
- **Profile summaries** — character name, level, play time, starting gift, and archetype per slot
|
|
11
17
|
- **Zero runtime dependencies** — pure ESM, no bundled dependencies
|
|
@@ -18,6 +24,10 @@ npm install @zebbedaja/er-save-parser
|
|
|
18
24
|
|
|
19
25
|
## Usage
|
|
20
26
|
|
|
27
|
+
### Node
|
|
28
|
+
|
|
29
|
+
#### TypeScript
|
|
30
|
+
|
|
21
31
|
```typescript
|
|
22
32
|
import { parse, type Save, type Slot, type Character } from '@zebbedaja/er-save-parser'
|
|
23
33
|
import { readFileSync } from 'fs'
|
|
@@ -48,8 +58,42 @@ slot?.eventFlags?.forEach((flag) => {
|
|
|
48
58
|
})
|
|
49
59
|
```
|
|
50
60
|
|
|
61
|
+
#### JavaScript
|
|
62
|
+
|
|
63
|
+
```javascript
|
|
64
|
+
import { parse } from '@zebbedaja/er-save-parser'
|
|
65
|
+
import { readFileSync } from 'node:fs'
|
|
66
|
+
|
|
67
|
+
const buffer = readFileSync('ER0000.sl2').buffer
|
|
68
|
+
const save = parse(buffer)
|
|
69
|
+
|
|
70
|
+
console.log(save.steamId)
|
|
71
|
+
console.log(save.settings?.hud)
|
|
72
|
+
|
|
73
|
+
const slot = save.slots?.[0]
|
|
74
|
+
const char = slot?.character
|
|
75
|
+
|
|
76
|
+
if (char) {
|
|
77
|
+
console.log(char.characterName) // "Tarnished"
|
|
78
|
+
console.log(char.level) // 150
|
|
79
|
+
console.log(char.runes) // 1234567
|
|
80
|
+
console.log(char.strength) // 45
|
|
81
|
+
console.log(char.faith) // 30
|
|
82
|
+
console.log(char.arcane) // 20
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Check boss defeats
|
|
86
|
+
slot?.eventFlags?.forEach((flag) => {
|
|
87
|
+
if (flag.state) {
|
|
88
|
+
console.log(`${flag.name} ✓`)
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
```
|
|
92
|
+
|
|
51
93
|
### Reading from a file in the browser
|
|
52
94
|
|
|
95
|
+
#### TypeScript
|
|
96
|
+
|
|
53
97
|
```typescript
|
|
54
98
|
async function parseFromFile(file: File): Promise<Save> {
|
|
55
99
|
const buffer = await file.arrayBuffer()
|
|
@@ -57,12 +101,21 @@ async function parseFromFile(file: File): Promise<Save> {
|
|
|
57
101
|
}
|
|
58
102
|
```
|
|
59
103
|
|
|
104
|
+
#### JavaScript
|
|
105
|
+
|
|
106
|
+
```javascript
|
|
107
|
+
async function parseFromFile(file) {
|
|
108
|
+
const buffer = await file.arrayBuffer()
|
|
109
|
+
return parse(buffer)
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
60
113
|
## Parsed Data
|
|
61
114
|
|
|
62
115
|
### `Save` (root)
|
|
63
116
|
| Field | Type | Description |
|
|
64
117
|
|---|---|---|
|
|
65
|
-
| `magicBytes` | `string` | Hex string,
|
|
118
|
+
| `magicBytes` | `string` | Hex string, e.g. `424e4434` (`BND4`) |
|
|
66
119
|
| `checksum` | `string` | Save file checksum |
|
|
67
120
|
| `version` | `number` | Save file version |
|
|
68
121
|
| `steamId` | `string` | Associated Steam64 ID |
|
|
@@ -144,18 +197,8 @@ async function parseFromFile(file: File): Promise<Save> {
|
|
|
144
197
|
|
|
145
198
|
## Error handling
|
|
146
199
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const save = parse(buffer)
|
|
150
|
-
} catch (error: unknown) {
|
|
151
|
-
if (error instanceof Error) {
|
|
152
|
-
console.error('Failed to parse save file:', error.message)
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
The parser will throw if:
|
|
158
|
-
- The file magic bytes don't match `BND4`
|
|
200
|
+
The parser will throw an Error if:
|
|
201
|
+
- The file magic bytes don't match `BND4` or `SL2\x00`
|
|
159
202
|
- Event flags reference blocks not found in the BST map
|
|
160
203
|
- Calculated byte positions exceed save data bounds
|
|
161
204
|
|
|
@@ -169,6 +212,22 @@ npm run build # Bundle with tsdown
|
|
|
169
212
|
npm run dev # Watch mode
|
|
170
213
|
```
|
|
171
214
|
|
|
215
|
+
## TODO
|
|
216
|
+
|
|
217
|
+
- Read all event flags
|
|
218
|
+
- Read equipment
|
|
219
|
+
- Read inventory
|
|
220
|
+
|
|
172
221
|
## License
|
|
173
222
|
|
|
174
223
|
MIT
|
|
224
|
+
|
|
225
|
+
## Credits
|
|
226
|
+
|
|
227
|
+
- [Hapfel1/er-save-manager](https://github.com/Hapfel1/er-save-manager) — Python-based save manager/editor with GUI, backup, teleportation, and community features
|
|
228
|
+
- [ClayAmore/ER-Save-Lib](https://github.com/ClayAmore/ER-Save-Lib) — Rust library for reading/writing save files with PC and PlayStation support
|
|
229
|
+
- [ClayAmore/ER-Save-Editor](https://github.com/ClayAmore/ER-Save-Editor) — Full-featured Rust save editor for PC and PlayStation save files
|
|
230
|
+
- [EthanShoeDev/elden-ring-compass](https://github.com/EthanShoeDev/elden-ring-compass) — React-based progress tracker with interactive map and save file polling
|
|
231
|
+
- [CyberGiant7/Elden-Ring-Automatic-Checklist](https://github.com/CyberGiant7/Elden-Ring-Automatic-Checklist) — Online tool that analyzes save files to track 100% completion and missing items
|
|
232
|
+
- [vawser/Smithbox](https://github.com/vawser/Smithbox) — Comprehensive modding tool for FromSoftware games with param, map, model, and material editors
|
|
233
|
+
- [soulsmodding.com](https://soulsmodding.com) — FromSoftware save file documentation and reverse engineering resources
|
package/dist/index.d.mts
CHANGED
|
@@ -139,7 +139,6 @@ interface EventFlag {
|
|
|
139
139
|
}
|
|
140
140
|
//#endregion
|
|
141
141
|
//#region src/parser.d.ts
|
|
142
|
-
declare function fn(): string;
|
|
143
142
|
declare function parse(buffer: ArrayBuffer): Save;
|
|
144
143
|
//#endregion
|
|
145
|
-
export { Character, EventFlag, ProfileSummary, Save, Settings, Slot,
|
|
144
|
+
export { type Character, type EventFlag, type ProfileSummary, type Save, type Settings, type Slot, parse };
|