Skip to content

Instantly share code, notes, and snippets.

@kimoto
Created October 7, 2010 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimoto/615037 to your computer and use it in GitHub Desktop.
Save kimoto/615037 to your computer and use it in GitHub Desktop.
# demファイル内に、demo録画時のバージョン番号が記録されてる場所発見したので共有(ハイライトされてる場所が該当箇所)↓
# http://gyazo.com/7e3604b42ec6bfd54af099ecbdd32d6a.png
# ※実際にL4Dで読み込んでみればバージョン番号はわかることだけど以下詳細について
#
# demファイルをバイナリエディタで読み込んだときの0Cと0Dバイト目の値を、little endian -> big endianに変換して(単に値を入れ替えるだけ) それを10進数になおせばOK
#
# 実際に今日とったデモでやってみると
# 0CがF9, 0Dが07となっているので
# これをlittle endianからbig endianにすると
# 07F9になる
# 07F9を10進数に直すと2041
# この2041という値をsteam.infのPatchVersionのところに記載すればそのバージョンのデモ見れるようになる
filepath = ARGV.shift
unless filepath
STDERR.puts "usage: demo_extract.rb <filepath>"
exit 1
end
# read binary mode
buf = File.open(filepath, "rb"){|f| f.read }
# little endian -> big endian
bytes = 0
a = buf[0x0C].to_s(16)
b = buf[0x0D].to_s(16)
version = (b + a).hex
puts "engine version: #{version}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment