2010-02-06 20:37:25 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
|
|
|
require "scanf"
|
|
|
|
require "json"
|
|
|
|
|
|
|
|
filename = ARGV[0]
|
|
|
|
offset = ARGV[1].scanf("%x")[0]
|
|
|
|
|
|
|
|
NUM_MOBJS=137
|
|
|
|
|
|
|
|
def read_int(file)
|
2017-03-31 20:03:18 +00:00
|
|
|
c1 = file.getbyte
|
|
|
|
c2 = file.getbyte
|
|
|
|
c3 = file.getbyte
|
|
|
|
c4 = file.getbyte
|
2010-02-06 20:37:25 +00:00
|
|
|
|
|
|
|
c1 | (c2 << 8) | (c3 << 16) | (c4 << 24)
|
|
|
|
end
|
|
|
|
|
|
|
|
def read_mobj(file)
|
|
|
|
result = []
|
|
|
|
|
|
|
|
23.times do
|
|
|
|
i = read_int(file)
|
|
|
|
result.push(i)
|
|
|
|
end
|
|
|
|
|
|
|
|
result
|
|
|
|
end
|
|
|
|
|
|
|
|
states = []
|
|
|
|
|
|
|
|
File.open(filename) do |file|
|
|
|
|
file.seek(offset)
|
|
|
|
|
|
|
|
NUM_MOBJS.times do
|
|
|
|
states.push(read_mobj(file))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
for state in states
|
|
|
|
puts state.to_json
|
|
|
|
end
|
|
|
|
|