Created
December 31, 2012 02:25
-
-
Save zhuowei/4416929 to your computer and use it in GitHub Desktop.
Pulls movs r1, # statements from objdump output of Tile::initTiles to find out block ID locations in Minecraft PE
This file contains 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
#!/usr/bin/python | |
#Feed the decompiled Tile::initTiles method from objdump into standard input | |
from sys import stdin | |
lastMov = ""; | |
def decodeAndPrint(movstr): | |
endpart = movstr[movstr.find("#") + 1:len(movstr) - 1] | |
if endpart.find(";") > -1: | |
endpart = endpart[0:endpart.find(";") - 1] | |
print(movstr[0:movstr.find(":")].lstrip() + "," + "{0:X}".format(int(endpart))) | |
def isAConstructor(mystr): | |
if mystr.find("bl") < 0 or mystr.find("::") < 0 or mystr.find("Tile") < 0: | |
return False; | |
funcname = mystr[mystr.find("<") + 1: mystr.find(">")] | |
firstPart = funcname[0: funcname.find("::")] | |
secondPart = funcname[funcname.find("::") + 2: funcname.find("(")] | |
if firstPart == secondPart: | |
return True | |
return False | |
for line in stdin: | |
if isAConstructor(line): | |
decodeAndPrint(lastMov) | |
elif line.find("mov") > -1 and line.find("r1, #") > -1: | |
lastMov = line | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added this to https://gist.github.com/shoghicp/4678643/6c872c58936995f72267f85279609fa009fe9fe9#file-extractor-php-L232
Thanks!
PS: A way to get the name would be pretty good ;)