Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save AlexeyGy/485150e3daf98b563140 to your computer and use it in GitHub Desktop.

Select an option

Save AlexeyGy/485150e3daf98b563140 to your computer and use it in GitHub Desktop.
Dark Souls Deaths Counter
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import struct
import sys
sys.stdout.flush()
def main():
with open('DRAKS0005.sl2', 'rb') as fo:
fo.seek(0x3c0, 0)
print "current pos:", fo.tell()
for slot in range(0, 10):
name = fo.read(32)
if name[0] != '\00':
fo.seek(-0x120, 1)
fo.seek(0x1f128, 1)
deaths = fo.read(4)
fo.seek(-0x04, 1)
fo.seek(-0x1f128, 1)
print "name: %s\tdeaths: %d" % (name.decode('utf-16').split('\00')[0], struct.unpack('i', deaths)[0])
fo.seek(0x100, 1)
fo.seek(0x60020, 1)
raw_input("Press Enter to continue...")
if __name__ == '__main__':
main()
@AlexeyGy
Copy link
Copy Markdown
Author

Updated the script to reflect new savegame format 2015

@JoshuaMa64
Copy link
Copy Markdown

What's the meaning of "current pos" in your code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment