A load of transformer accesses- also a few tweaks to the transformer, and linux support in the fml python

This commit is contained in:
Christian 2012-08-01 18:59:45 -02:30
parent 4fb08f1660
commit 5f51e63385
5 changed files with 221 additions and 16 deletions

View file

@ -1,2 +1,168 @@
#Blank FML Access Transformer #Main FML Access Transformer configuration file
# TileEntity addMapping
public ajh.a(Ljava/lang/Class;Ljava/lang/String;)V public ajh.a(Ljava/lang/Class;Ljava/lang/String;)V
# EntityList addMappings
public jq.a(Ljava/lang/Class;Ljava/lang/String;I)V
public jq.a(Ljava/lang/Class;Ljava/lang/String;III)V
# EntityList nameToClassMap
public jq.b
# RenderManager renderers
public avx.o
# RenderBlocks - everything
public avf.A
public avf.B
public avf.C
public avf.D
public avf.E
public avf.F
public avf.G
public avf.H
public avf.I
public avf.J
public avf.K
public avf.L
public avf.M
public avf.N
public avf.S
public avf.T
public avf.U
public avf.V
public avf.W
public avf.X
public avf.Y
public avf.Z
public avf.a
public avf.aA
public avf.aB
public avf.aC
public avf.aD
public avf.aE
public avf.aF
public avf.aG
public avf.aH
public avf.aI
public avf.aJ
public avf.aK
public avf.aL
public avf.aM
public avf.aN
public avf.aO
public avf.aa
public avf.ab
public avf.ac
public avf.ad
public avf.ae
public avf.af
public avf.ag
public avf.ah
public avf.ai
public avf.aj
public avf.ak
public avf.al
public avf.am
public avf.an
public avf.ao
public avf.ap
public avf.aq
public avf.ar
public avf.as
public avf.at
public avf.au
public avf.av
public avf.aw
public avf.ax
public avf.ay
public avf.az
public avf.b
public avf.c
public avf.d
public avf.e
public avf.f
public avf.g
public avf.h
public avf.i
public avf.j
public avf.k
public avf.l
public avf.m
public avf.n
public avf.o
public avf.p
public avf.q
public avf.r
public avf.s
public avf.t
public avf.u
public avf.v
public avf.w
public avf.x
public avf.y
public avf.z
public avf.a()V
public avf.a(DDDDDDFD)V
public avf.a(IIII)I
public avf.a(IIILacn;)F
public avf.a(Laex;III)Z
public avf.a(Lafc;III)Z
public avf.a(Lafg;III)Z
public avf.a(Lafq;III)Z
public avf.a(Lafv;III)Z
public avf.a(Lafw;III)Z
public avf.a(Lahg;III)Z
public avf.a(Laie;III)Z
public avf.a(Laif;DDDDD)V
public avf.a(Laif;DDDI)V
public avf.a(Laif;IDDD)V
public avf.a(Laif;IDDDD)V
public avf.a(Laif;IF)V
public avf.a(Laif;IIDDDD)V
public avf.a(Laif;III)V
public avf.a(Laif;IIIFFF)Z
public avf.a(Laif;IIII)V
public avf.a(Laif;IIIZ)V
public avf.a(Laif;Luo;IIII)V
public avf.b(DDDDDDFD)V
public avf.b(I)Z
public avf.b(Laif;DDDI)V
public avf.b(Laif;IDDD)V
public avf.b(Laif;III)Z
public avf.b(Laif;IIIZ)Z
public avf.c(DDDDDDFD)V
public avf.c(Laif;DDDI)V
public avf.c(Laif;III)Z
public avf.c(Laif;IIIFFF)Z
public avf.c(Laif;IIIZ)Z
public avf.d(Laif;DDDI)V
public avf.d(Laif;III)V
public avf.d(Laif;IIIFFF)Z
public avf.e(Laif;DDDI)V
public avf.e(Laif;III)Z
public avf.f(Laif;DDDI)V
public avf.f(Laif;III)Z
public avf.g(Laif;III)Z
public avf.h(Laif;III)Z
public avf.i(Laif;III)Z
public avf.j(Laif;III)Z
public avf.k(Laif;III)Z
public avf.l(Laif;III)Z
public avf.m(Laif;III)Z
public avf.n(Laif;III)Z
public avf.o(Laif;III)Z
public avf.p(Laif;III)Z
public avf.q(Laif;III)Z
public avf.r(Laif;III)Z
public avf.s(Laif;III)Z
public avf.t(Laif;III)Z
public avf.u(Laif;III)Z
public avf.v(Laif;III)Z
public avf.w(Laif;III)Z
public avf.x(Laif;III)Z
#RenderEngine - make TextureFX list public
public ave.h
#RenderPlayer - make armorlist public and not final
public-f awq.j
#StringTranslate - make the current table public
public ak.b
# TileEntityRenderer - make the list of renderers public
public axr.m

View file

@ -4,6 +4,7 @@
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src-common"/> <classpathentry kind="src" path="src-common"/>
<classpathentry kind="src" path="client"/> <classpathentry kind="src" path="client"/>
<classpathentry kind="src" path="transformers"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry exported="true" kind="lib" path="jars/bin/jinput.jar"> <classpathentry exported="true" kind="lib" path="jars/bin/jinput.jar">
<attributes> <attributes>

View file

@ -50,6 +50,11 @@
<type>2</type> <type>2</type>
<locationURI>MCP_LOC/src-work/common</locationURI> <locationURI>MCP_LOC/src-work/common</locationURI>
</link> </link>
<link>
<name>transformers</name>
<type>2</type>
<locationURI>MCP_LOC/FML/transformers</locationURI>
</link>
<link> <link>
<name>common/fmlversion.properties</name> <name>common/fmlversion.properties</name>
<type>1</type> <type>1</type>

View file

@ -146,19 +146,20 @@ def setup_fml(fml_dir, mcp_dir):
def applyrg_shunt(self, side, reobf=False, applyrg_real = Commands.applyrg): def applyrg_shunt(self, side, reobf=False, applyrg_real = Commands.applyrg):
jars = {CLIENT: self.jarclient, SERVER: self.jarserver} jars = {CLIENT: self.jarclient, SERVER: self.jarserver}
#print "==================================SHUNT %s============================" % side print "==================================SHUNT %s============================" % side
#print "Java: %s" % self.cmdjava print "Java: %s" % self.cmdjava
#print "Javac: %s" % self.cmdjavac print "Javac: %s" % self.cmdjavac
#print "Jar: %s" % jars[side] print "Jar: %s" % jars[side]
binDir = os.path.join(fml_dir, 'bin') binDir = os.path.join(fml_dir, 'bin')
if not os.path.isdir(binDir): if not os.path.isdir(binDir):
os.makedirs(binDir) os.makedirs(binDir)
#Compile AccessTransformer #Compile AccessTransformer
forkcmd = ('%s -Xlint:-options -deprecation -g -source 1.6 -target 1.6 -classpath "{classpath};." -sourcepath {sourcepath} -d {outpath} {target}' % self.cmdjavac).format( forkcmd = ('%s -Xlint:-options -deprecation -g -source 1.6 -target 1.6 -classpath "{classpath}" -sourcepath {sourcepath} -d {outpath} {target}' % self.cmdjavac).format(
classpath=os.path.join(mcp_dir, 'lib', '*'), sourcepath=os.path.join(fml_dir, 'common'), outpath=os.path.join(fml_dir, 'bin'), classpath=os.path.join(mcp_dir, 'lib', '*'), sourcepath=os.path.join(fml_dir, 'common'), outpath=os.path.join(fml_dir, 'bin'),
target=os.path.join(fml_dir, 'transformers', 'cpw', 'mods', 'fml', 'common', 'asm', 'transformers', 'AccessTransformer.java')) target=os.path.join(fml_dir, 'transformers', 'cpw', 'mods', 'fml', 'common', 'asm', 'transformers', 'AccessTransformer.java'))
print forkcmd
self.runcmd(forkcmd) self.runcmd(forkcmd)
#Run AccessTransformer #Run AccessTransformer

View file

@ -3,6 +3,7 @@ package cpw.mods.fml.common.asm.transformers;
import static org.objectweb.asm.Opcodes.ACC_PRIVATE; import static org.objectweb.asm.Opcodes.ACC_PRIVATE;
import static org.objectweb.asm.Opcodes.ACC_PROTECTED; import static org.objectweb.asm.Opcodes.ACC_PROTECTED;
import static org.objectweb.asm.Opcodes.ACC_PUBLIC; import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
import static org.objectweb.asm.Opcodes.ACC_FINAL;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
@ -55,12 +56,25 @@ public class AccessTransformer implements IClassTransformer
public int oldAccess = 0; public int oldAccess = 0;
public int newAccess = 0; public int newAccess = 0;
public int targetAccess = 0; public int targetAccess = 0;
public boolean changeFinal = false;
public boolean markFinal = false;
private void setTargetAccess(String name) private void setTargetAccess(String name)
{ {
if (name.equalsIgnoreCase("public")) targetAccess = ACC_PUBLIC; if (name.startsWith("public")) targetAccess = ACC_PUBLIC;
else if (name.equalsIgnoreCase("private")) targetAccess = ACC_PRIVATE; else if (name.startsWith("private")) targetAccess = ACC_PRIVATE;
else if (name.equalsIgnoreCase("protected")) targetAccess = ACC_PROTECTED; else if (name.startsWith("protected")) targetAccess = ACC_PROTECTED;
if (name.endsWith("-f"))
{
changeFinal = true;
markFinal = false;
}
else if (name.endsWith("+f"))
{
changeFinal = true;
markFinal = true;
}
} }
} }
@ -68,7 +82,7 @@ public class AccessTransformer implements IClassTransformer
public AccessTransformer() throws IOException public AccessTransformer() throws IOException
{ {
this("/rules.csv"); this("fml_at.cfg");
} }
protected AccessTransformer(String rulesFile) throws IOException protected AccessTransformer(String rulesFile) throws IOException
{ {
@ -111,12 +125,17 @@ public class AccessTransformer implements IClassTransformer
Modifier m = new Modifier(); Modifier m = new Modifier();
m.setTargetAccess(parts.get(0)); m.setTargetAccess(parts.get(0));
List<String> descriptor = Lists.newArrayList(Splitter.on(".").trimResults().split(parts.get(1))); List<String> descriptor = Lists.newArrayList(Splitter.on(".").trimResults().split(parts.get(1)));
List<String> method = Lists.newArrayList(Splitter.on(CharMatcher.anyOf("()")).omitEmptyStrings().trimResults().split(descriptor.get(1))); String nameReference = descriptor.get(1);
if (method.size()==3) //cpw, cleanthis up plz int parenIdx = nameReference.indexOf('(');
if (parenIdx>0)
{ {
m.desc = String.format("(%s)%s", method.get(1), method.get(2)); m.desc = nameReference.substring(parenIdx);
m.name = nameReference.substring(0,parenIdx-1);
}
else
{
m.name = nameReference;
} }
m.name = method.get(0);
modifiers.put(descriptor.get(0), m); modifiers.put(descriptor.get(0), m);
return true; return true;
} }
@ -196,6 +215,19 @@ public class AccessTransformer implements IClassTransformer
default: default:
throw new RuntimeException("The fuck?"); throw new RuntimeException("The fuck?");
} }
// Clear the "final" marker on fields only if specified in control field
if (target.changeFinal && target.desc == "")
{
if (target.markFinal)
{
ret |= ACC_FINAL;
}
else
{
ret &= ~ACC_FINAL;
}
}
target.newAccess = ret; target.newAccess = ret;
return ret; return ret;
} }