2012-04-04 15:05:31 +00:00
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
import commands
|
|
|
|
import fnmatch
|
|
|
|
import re
|
|
|
|
import subprocess, shlex
|
|
|
|
|
2012-04-05 12:25:04 +00:00
|
|
|
mcp_root = os.path.abspath(sys.argv[1])
|
|
|
|
sys.path.append(os.path.join(mcp_root,"runtime"))
|
|
|
|
from filehandling.srgshandler import parse_srg
|
|
|
|
|
2012-04-04 15:05:31 +00:00
|
|
|
def cmdsplit(args):
|
|
|
|
if os.sep == '\\':
|
|
|
|
args = args.replace('\\', '\\\\')
|
|
|
|
return shlex.split(args)
|
|
|
|
|
|
|
|
def main():
|
|
|
|
list_file = os.path.abspath(sys.argv[2])
|
2012-04-05 12:25:04 +00:00
|
|
|
prelist = os.path.join(mcp_root,"temp","server.md5")
|
|
|
|
postlist = os.path.join(mcp_root,"temp","server_reobf.md5")
|
2012-04-04 15:05:31 +00:00
|
|
|
cmd = 'diff --unchanged-group-format='' --old-group-format='' --new-group-format=\'%%>\' --changed-group-format=\'%%>\' %s %s' % (prelist, postlist)
|
|
|
|
process = subprocess.Popen(cmdsplit(cmd), stdout=subprocess.PIPE, bufsize=-1)
|
|
|
|
difflist,_= process.communicate()
|
2012-04-05 12:42:10 +00:00
|
|
|
srg_data = parse_srg(os.path.join(mcp_root,"temp","server_rg.srg"))
|
2012-04-05 12:29:07 +00:00
|
|
|
classes = {}
|
2012-04-05 12:25:04 +00:00
|
|
|
for row in srg_data['CL']:
|
|
|
|
classes[row['deobf_name']] = row['obf_name']
|
|
|
|
|
2012-04-04 15:05:31 +00:00
|
|
|
with open(list_file, 'w') as fh:
|
2012-04-05 12:42:10 +00:00
|
|
|
for diff in difflist.splitlines():
|
|
|
|
diffrow=diff.strip().split()
|
|
|
|
clazz=diffrow[0]
|
2012-04-05 12:25:04 +00:00
|
|
|
if clazz in classes:
|
|
|
|
clazz=classes[clazz]
|
2012-04-05 12:42:10 +00:00
|
|
|
if clazz.startswith("net/minecraft/src/"):
|
|
|
|
clazz=clazz[len("net/minecraft/src/"):]
|
2012-04-05 14:16:23 +00:00
|
|
|
fh.write("minecraft_server/%s.class\n" %(clazz))
|
2012-04-04 15:05:31 +00:00
|
|
|
|
2012-05-10 06:01:23 +00:00
|
|
|
prelist = os.path.join(mcp_root,"temp","client.md5")
|
|
|
|
postlist = os.path.join(mcp_root,"temp","client_reobf.md5")
|
|
|
|
cmd = 'diff --unchanged-group-format='' --old-group-format='' --new-group-format=\'%%>\' --changed-group-format=\'%%>\' %s %s' % (prelist, postlist)
|
|
|
|
process = subprocess.Popen(cmdsplit(cmd), stdout=subprocess.PIPE, bufsize=-1)
|
|
|
|
difflist,_= process.communicate()
|
|
|
|
srg_data = parse_srg(os.path.join(mcp_root,"temp","client_rg.srg"))
|
|
|
|
classes = {}
|
|
|
|
for row in srg_data['CL']:
|
|
|
|
classes[row['deobf_name']] = row['obf_name']
|
|
|
|
|
2012-05-24 10:48:59 +00:00
|
|
|
with open(list_file, 'a') as fh:
|
2012-05-10 06:01:23 +00:00
|
|
|
for diff in difflist.splitlines():
|
|
|
|
diffrow=diff.strip().split()
|
|
|
|
clazz=diffrow[0]
|
|
|
|
if clazz in classes:
|
|
|
|
clazz=classes[clazz]
|
|
|
|
if clazz.startswith("net/minecraft/src/"):
|
|
|
|
clazz=clazz[len("net/minecraft/src/"):]
|
|
|
|
fh.write("minecraft/%s.class\n" %(clazz))
|
|
|
|
|
|
|
|
|
2012-04-04 15:05:31 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|