Skip to content

Instantly share code, notes, and snippets.

@ariscop
Created January 1, 2015 01:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ariscop/b0318152925c79ece7e6 to your computer and use it in GitHub Desktop.
Save ariscop/b0318152925c79ece7e6 to your computer and use it in GitHub Desktop.
Tool for extracting .lmp files from "The Elder Scrolls Travels - Dawnstar"
#!/usr/bin/env python3
import sys, struct
fd = open(sys.argv[1], "rb")
while(True):
byte = fd.read(1)
if byte != b'-':
break
name = b''
while(True):
byte = fd.read(1)
if byte == b'-':
break
name += byte
data = fd.read(6)
offset, length = struct.unpack(">IH", data)
print((name, offset, length))
name = name.decode()
pos = fd.tell()
out = open("/tmp/out/" + name, "wb")
fd.seek(offset)
out.write(fd.read(length))
out.close()
fd.seek(pos)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment