Created
December 12, 2017 03:08
-
-
Save lopex/7c92b5a817ea6f9e91a3ca5b7783da64 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trans_name = "utf8_mac" | |
src = open("#{repo_path}/enc/trans/#{trans_name}.c").read | |
process_binary "#{repo_path}/enc/trans/#{trans_name}.o", section_name do |name, binary, address| | |
case name | |
when /_byte_array/ | |
size = src[/(\w+?_byte_array)\[(\d+?)\]/m, 2].to_i | |
open("test/" + name.capitalize, "wb") do |f| | |
f << [size].pack("N") | |
f << binary[address, size] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment