Skip to content

@jamesu /read_tribes1dts.rb
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Reading Tribes 1 dts files
#!/usr/bin/ruby
# Basic attempt at reading Tribes 1 .dts files
# Appears to be some sort of nested IFF-like block format
File.open(ARGV[0]) do |f|
pos = 0
while !f.eof
f.seek pos
magic = f.read(4).unpack("L<")[0]
if magic != 0x53524550 # PERS
pos += 1
next
end
size, namesize = f.read(4+2).unpack("L<S<")
name = f.read(namesize)
puts "BLOCK: #{name} @ #{pos} [#{size} bytes]"
pos += 4+4+2+namesize # Skip this block header
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.