public
Created

Reading Tribes 1 dts files

  • Download Gist
read_tribes1dts.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#!/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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.