Skip to content

Instantly share code, notes, and snippets.

@ariscop
Created Jan 1, 2015
Embed
What would you like to do?
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