Skip to content

Instantly share code, notes, and snippets.

@raspi
Created January 15, 2014 09:36
Show Gist options
  • Save raspi/8433382 to your computer and use it in GitHub Desktop.
Save raspi/8433382 to your computer and use it in GitHub Desktop.
Get audio .ogg files from game "Sherlock Holmes - The Awakened"
# raspi 2007
# gets audio ogg files from "sherlock holmes - the awakened"
import os
import sys
import struct
datafilename = 'music.snd'
datafilesize = os.stat(datafilename)[6]
f = open (datafilename, 'rb')
firstblock = f.read(0x11)
stop_offset = datafilesize
dumpinfo = []
counter = 0
while f.tell() != stop_offset:
filename_len = ord(f.read(1))
filename = f.read(filename_len)
filename_soffset = struct.unpack("<L", f.read(4))[0]
filename_dlen = struct.unpack("<L", f.read(4))[0]
f.read(4)
dumpinfo.append({"fn": filename, "start": filename_soffset, "len": filename_dlen})
if counter == 0:
stop_offset = filename_soffset
counter = counter + 1
for nfo in dumpinfo[1:]:
print "Writin' %s" % nfo['fn']
f2 = open (nfo['fn'], 'wb')
f.seek(nfo['start'])
f2.write(f.read(nfo['len']))
f2.close()
print "Done."
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment