ClayAmore / ER-Save-Editor

Elden Ring Save Editor. Compatible with PC and Playstation saves.
Apache License 2.0
313 stars 80 forks source link

Adding death counter to common/save_slot.rs #66

Open anchaides opened 4 months ago

anchaides commented 4 months ago

I found myself looking into some Nexus Elden Ring utility that lets you know how many times your character has died. However, I didn't trust that tool because its source code is not released. While playing around with your tool, I managed to find where the actual value is stored within the SaveSlot structure.

followed by { 0xFFFFFFFF, 0x800 } in active profiles. I'm not really that familiar with Rust, nor was I interested in the whole set of features from your project, so I reworked the reader in C++. In my version, I skip most of the file; it's just some C++ code that detects when the value changes and tells OBS to save the replay buffer to generate a dataset for another hobbyist project of mine. I don't know if my utility would be worth publishing, and I'm not really sure how that would work with the licensing, given that I relied heavily on your structures/source code to figure out the parts of the save file I was unsure of. (It was a great help, thank you so much!) But while I figure that out, have this PR with the newfound values.

I did not modify the UI, but the value is now there should you decide to use it. I have tested that the correct values are read from my PC Save file and stored in save_slot[i].death_counter.

-    _0x1d: [u8; 0x1d],
+    _0x3_1: [u8; 0x3],
+    pub death_counter: u32,
+    _c0xffffffff: u32,
+    _c0x800: u16,
+    _0x10_1: [u8; 0x10],