Committing inital work on generating sanitized MCP conf data.

This commit is contained in:
LexManos 2012-08-04 02:33:46 -07:00
parent 72f1f3fb0d
commit 53cf27f632
4 changed files with 20653 additions and 12 deletions

6170
conf/joined.exc Normal file

File diff suppressed because it is too large Load diff

14363
conf/joined.srg Normal file

File diff suppressed because it is too large Load diff

View file

@ -19,10 +19,11 @@ Classes = %(DirConf)s/classes.csv
Methods = %(DirConf)s/methods.csv
Fields = %(DirConf)s/fields.csv
Params = %(DirConf)s/params.csv
NewIds = %(DirConf)s/newids.csv
[SRGS]
ConfClient = %(DirConf)s/client.srg
ConfServer = %(DirConf)s/server.srg
ConfClient = %(DirConf)s/joined.srg
ConfServer = %(DirConf)s/joined.srg
Client = %(DirTemp)s/client_rg.srg
Server = %(DirTemp)s/server_rg.srg
DeobfClient = %(DirTemp)s/client_deobf.srg
@ -35,8 +36,8 @@ DirNatives = %(DirJars)s/bin/natives
Client = %(DirJars)s/bin/minecraft.jar
Server = %(DirJars)s/minecraft_server.jar
LWJGL = %(DirJars)s/bin/jinput.jar,%(DirJars)s/bin/lwjgl.jar,%(DirJars)s/bin/lwjgl_util.jar
MD5Client = 8e8778078a175a33603a585257f28563
MD5Server = 5f078323c2d661b8d9773c8242d912c3
MD5Client = 266ccbc9798afd2eadf3d6c01b4c562a
MD5Server = f44a3cfe6ec35b1ac3f2b635e73d96fe
[RETROGUARD]
Location = %(DirRuntime)s/bin/retroguard.jar
@ -55,8 +56,8 @@ ServerDeobLog = %(DirLogs)s/server_deob.log
NullPkg = net/minecraft/src
[EXCEPTOR]
XClientCfg = %(DirConf)s/client.exc
XServerCfg = %(DirConf)s/server.exc
XClientCfg = %(DirConf)s/joined.exc
XServerCfg = %(DirConf)s/joined.exc
XClientOut = %(DirTemp)s/minecraft_exc.jar
XServerOut = %(DirTemp)s/minecraft_server_exc.jar
XClientLog = %(DirLogs)s/client_exc.log
@ -94,7 +95,6 @@ LogServer = %(DirLogs)s/server_compile.log
ClassPathClient = %(DirLib)s/,%(DirLib)s/*,%(DirJars)s/bin/minecraft.jar,%(DirJars)s/bin/jinput.jar,%(DirJars)s/bin/lwjgl.jar,%(DirJars)s/bin/lwjgl_util.jar
ClassPathServer = %(DirLib)s/,%(DirLib)s/*,%(DirJars)s/minecraft_server.jar
ClientFixes = %(DirConf)s/patches
FixSound = gk
FixStart = Start
IgnorePkg = paulscode,com/jcraft,isom,ibxm,de/matthiasmann/twl,org/xmlpull,javax/xml
@ -121,10 +121,10 @@ OutSRCServer = %(DirModSrc)s/minecraft_server
[MCP]
LogFile = %(DirLogs)s/mcp.log
LogFileErr = %(DirLogs)s/mcperr.log
UpdateUrl = http://mcp.ocean-labs.de/files/mcprolling_{version}/
UpdateUrl =
IgnoreUpdate = %(DirBin)s,%(DirLib)s,%(DirLogs)s,%(DirModSrc)s,%(DirReobf)s,%(DirSrc)s,%(DirTemp)s,%(DirEclipse)s/Client/bin,%(DirEclipse)s/Server/bin,%(DirJars)s/world,%(DirJars)s/saves,%(DirJars)s/resources
RGIndex = 52000
ParamIndex = 1300
RGIndex = 70000
ParamIndex = 3000
[ASTYLE]
AstyleConfig = %(DirConf)s/astyle.cfg
@ -148,7 +148,7 @@ CmdAStyle = %s --suffix=none --quiet --options={conffile} {classes}
CmdRG = %s -cp "{classpath}" RetroGuard -searge {conffile}
CmdRGReobf = %s -cp "{classpath}" RetroGuard -notch {conffile}
CmdJadretro = %s -jar %s {targetdir}
CmdFernflower = %s -jar %s -rbr=0 -dgs=1 -asc=1 -log=WARN {indir} {outdir}
CmdFernflower = %s -jar %s -din=0 -rbr=0 -dgs=1 -asc=1 -log=WARN {indir} {outdir}
CmdExceptor = %s -jar %s {input} {output} {conf} {log}
CmdRecomp = %s -Xlint:-options -deprecation -g -source 1.6 -target 1.6 -classpath "{classpath}" -sourcepath {sourcepath} -d {outpath} {pkgs}
CmdStartSrv = %s -Xincgc -Xms1024M -Xmx1024M -cp "{classpath}" net.minecraft.server.MinecraftServer

110
forge.py
View file

@ -2,6 +2,7 @@ import os, os.path, sys
import urllib, zipfile
import shutil, glob, fnmatch
import subprocess, logging, re
import pprint
forge_dir = os.path.dirname(os.path.abspath(__file__))
mcp_dir = os.path.abspath('..')
@ -104,4 +105,111 @@ def apply_forge_patches(fml_dir, mcp_dir, forge_dir, src_dir, copy_files=True):
if os.path.isdir(os.path.join(forge_dir, 'patches', 'common')):
apply_patches(mcp_dir, os.path.join(forge_dir, 'patches', 'common'), src_dir)
if copy_files and os.path.isdir(os.path.join(forge_dir, 'common')):
copytree(os.path.join(forge_dir, 'common'), os.path.join(src_dir, 'common'))
copytree(os.path.join(forge_dir, 'common'), os.path.join(src_dir, 'common'))
def get_conf_copy(mcp_dir, forge_dir):
#Lets grab the files we dont work on
for file in ['astyle.cfg', 'version.cfg', 'patches/minecraft_ff.patch', 'patches/minecraft_server_ff.patch']:
dest_file = os.path.normpath(os.path.join(forge_dir, 'conf', file))
src_file = os.path.normpath(os.path.join(mcp_dir, 'conf', file))
if os.path.exists(dst_file):
os.remove(dst_file)
shutil.copy(src_file, dst_dir)
print 'Grabbing: ' + src_file
gen_merged_srg(mcp_dir, forge_dir)
gen_merged_exc(mcp_dir, forge_dir)
gen_merged_fields(os.path.join(mcp_dir, 'conf', 'client.srg'), os.path.join(mcp_dir, 'conf', 'fields.csv'))
def gen_merged_rg(mcp_dir, forge_dir):
print 'Generating merged Retroguard data'
srg_client = os.path.join(mcp_dir, 'conf', 'client.srg')
srg_server = os.path.join(mcp_dir, 'conf', 'server.srg')
if not os.path.isfile(srg_client) or not os.path.isfile(srg_server):
print 'Could not find client and server srg files in "%s"' % mcp_dir
return False
client = {'PK:': {}, 'CL:': {}, 'FD:': {}, 'MD:': {}}
with open(srg_client, 'r') as fh:
for line in fh:
pts = line.rstrip('\r\n').split(' ')
if pts[0] == 'MD:':
client[pts[0]][pts[1] + ' ' + pts[2]] = pts[3] + ' ' + pts[4]
else:
client[pts[0]][pts[1]] = pts[2]
server = {'PK:': {}, 'CL:': {}, 'FD:': {}, 'MD:': {}}
with open(srg_server, 'r') as fh:
for line in fh:
pts = line.rstrip('\r\n').split(' ')
if pts[0] == 'MD:':
server[pts[0]][pts[1] + ' ' + pts[2]] = pts[3] + ' ' + pts[4]
else:
server[pts[0]][pts[1]] = pts[2]
common = {'PK:': {}, 'CL:': {}, 'FD:': {}, 'MD:': {}}
for type in common:
for key, value in client[type].items():
if key in server[type]:
if value == server[type][key]:
client[type].pop(key)
server[type].pop(key)
common[type][key] = value
for type in common:
for key, value in client[type].items():
common[type][key] = value + ' #C'
for type in common:
for key, value in server[type].items():
common[type][key] = value + ' #S'
#Print joined retroguard files
with open(os.path.join(forge_dir, 'conf', 'joined.srg'), 'w') as f:
for type in ['PK:', 'CL:', 'FD:', 'MD:']:
for key in sorted(common[type]):
f.write('%s %s %s\n' % (type, key, common[type][key]))
def gen_merged_exc(mcp_dir, forge_dir):
print 'Generating merged MCInjector config'
exc_client = os.path.join(mcp_dir, 'conf', 'client.exc')
exc_server = os.path.join(mcp_dir, 'conf', 'server.exc')
client = {}
with open(exc_client, 'r') as fh:
for line in fh:
if not line.startswith('#'):
pts = line.rstrip('\r\n').split('=')
client[pts[0]] = pts[1]
server = {}
with open(exc_server, 'r') as fh:
for line in fh:
if not line.startswith('#'):
pts = line.rstrip('\r\n').split('=')
server[pts[0]] = pts[1]
common = {}
for key, value in client.items():
if key in server:
if value != server[key]:
print 'Error: Exec for shared function does not match client and server:'
print 'Function: ' + key
print 'Client: ' + value
print 'Server: ' + server[value]
if value != '|':
common[key] = value
client.pop(key)
server.pop(key)
else:
if value != '|':
common[key] = value
common = dict(common.items() + server.items())
#Print joined mcinjector files
with open(os.path.join(forge_dir, 'conf', 'joined.exc'), 'w') as f:
for key in sorted(common):
f.write('%s=%s\n' % (key, common[key]))