Build, and use, MC versioned deobfuscation data

This commit is contained in:
Christian 2013-03-02 10:30:45 -05:00
parent 245e7312b2
commit 429dfc3d3d
6 changed files with 36 additions and 9 deletions

View file

@ -16,6 +16,7 @@
</exec>
<propertyfile file="fmlversion.properties">
<entry key="fmlbuild.build.number" type="int" value="${version.build}"/>
<entry key="fmlbuild.deobfuscation.hash" type="string" value="${deobf.checksum}"/>
</propertyfile>
</target>
@ -210,6 +211,8 @@
<globmapper from="packaged.srg" to="joined.srg"/>
</mappedresources>
</zip>
<checksum algorithm="SHA1" property="deobf.checksum" file="deobfuscation_data_${version.minecraft}.zip"/>
<antcall target="writeversion"/>
</target>
<target name="build" depends="buildenvsetup,merge-client,merge-common,build-universal,build-source-pack,build-deobf-data" />

View file

@ -126,7 +126,7 @@ public class FMLSanityChecker implements IFMLCallHook
public void injectData(Map<String, Object> data)
{
cl = (RelaunchClassLoader) data.get("classLoader");
FMLDeobfuscatingRemapper.INSTANCE.setup((File)data.get("mcLocation"), cl);
FMLDeobfuscatingRemapper.INSTANCE.setup((File)data.get("mcLocation"), cl, (String) data.get("deobfuscationFileName"));
}
}

View file

@ -51,15 +51,16 @@ public class FMLDeobfuscatingRemapper extends Remapper {
private FMLDeobfuscatingRemapper()
{
classNameBiMap=ImmutableBiMap.of();
}
public void setup(File mcDir, RelaunchClassLoader classLoader)
public void setup(File mcDir, RelaunchClassLoader classLoader, String deobfFileName)
{
this.classLoader = classLoader;
try
{
File libDir = new File(mcDir, "lib");
File mapData = new File(libDir, "deobfuscation_data.zip");
File mapData = new File(libDir, deobfFileName);
ZipFile mapZip = new ZipFile(mapData);
ZipEntry classData = mapZip.getEntry("joined.srg");
ZipInputSupplier zis = new ZipInputSupplier(mapZip, classData);

View file

@ -2,8 +2,8 @@ package cpw.mods.fml.relauncher;
public class CoreFMLLibraries implements ILibrarySet
{
private static String[] libraries = { "argo-small-3.2.jar","guava-14.0-rc3.jar","asm-all-4.1.jar", "bcprov-jdk15on-148.jar" };
private static String[] checksums = { "58912ea2858d168c50781f956fa5b59f0f7c6b51", "931ae21fa8014c3ce686aaa621eae565fefb1a6a", "054986e962b88d8660ae4566475658469595ef58", "960dea7c9181ba0b17e8bab0c06a43f0a5f04e65" };
private static String[] libraries = { "argo-small-3.2.jar","guava-14.0-rc3.jar","asm-all-4.1.jar", "bcprov-jdk15on-148.jar", FMLInjectionData.debfuscationDataName() };
private static String[] checksums = { "58912ea2858d168c50781f956fa5b59f0f7c6b51", "931ae21fa8014c3ce686aaa621eae565fefb1a6a", "054986e962b88d8660ae4566475658469595ef58", "960dea7c9181ba0b17e8bab0c06a43f0a5f04e65", FMLInjectionData.deobfuscationDataHash };
@Override
public String[] getLibraries()

View file

@ -17,6 +17,8 @@ public class FMLInjectionData
static String build;
static String mccversion;
static String mcpversion;
static String deobfuscationDataHash;
public static List<String> containers = new ArrayList<String>();
static void build(File mcHome, RelaunchClassLoader classLoader)
@ -43,10 +45,13 @@ public class FMLInjectionData
build = properties.getProperty("fmlbuild.build.number", "missing");
mccversion = properties.getProperty("fmlbuild.mcversion", "missing");
mcpversion = properties.getProperty("fmlbuild.mcpversion", "missing");
deobfuscationDataHash = properties.getProperty("fmlbuild.deobfuscation.hash","deadbeef");
}
static String debfuscationDataName()
{
return "deobfuscation_data_"+mccversion+".zip";
}
public static Object[] data()
{
return new Object[] { major, minor, rev, build, mccversion, mcpversion, minecraftHome, containers };

View file

@ -35,8 +35,23 @@ public class RelaunchLibraryManager
private static Map<IFMLLoadingPlugin, File> pluginLocations;
private static List<IFMLLoadingPlugin> loadPlugins;
private static List<ILibrarySet> libraries;
private static boolean deobfuscatedEnvironment;
public static void handleLaunch(File mcDir, RelaunchClassLoader actualClassLoader)
{
try
{
// Are we in a 'decompiled' environment?
actualClassLoader.getClassBytes("net.minecraft.world.World");
FMLRelaunchLog.info("Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation");
deobfuscatedEnvironment = true;
}
catch (IOException e1)
{
FMLRelaunchLog.fine("Enabling runtime deobfuscation");
deobfuscatedEnvironment = false;
}
pluginLocations = new HashMap<IFMLLoadingPlugin, File>();
loadPlugins = new ArrayList<IFMLLoadingPlugin>();
libraries = new ArrayList<ILibrarySet>();
@ -240,8 +255,10 @@ public class RelaunchLibraryManager
}
}
// Deobfuscation transformer, always last
actualClassLoader.registerTransformer("cpw.mods.fml.common.asm.transformers.DeobfuscationTransformer");
if (!deobfuscatedEnvironment)
{
actualClassLoader.registerTransformer("cpw.mods.fml.common.asm.transformers.DeobfuscationTransformer");
}
downloadMonitor.updateProgressString("Running coremod plugins");
Map<String,Object> data = new HashMap<String,Object>();
data.put("mcLocation", mcDir);
@ -259,6 +276,7 @@ public class RelaunchLibraryManager
IFMLCallHook call = (IFMLCallHook) Class.forName(setupClass, true, actualClassLoader).newInstance();
Map<String,Object> callData = new HashMap<String, Object>();
callData.put("classLoader", actualClassLoader);
callData.put("deobfuscationFileName", FMLInjectionData.debfuscationDataName());
call.injectData(callData);
call.call();
}