Commit 3f15cd54 authored by Christian's avatar Christian

Functional client @ 1.6.1

parent 12c928c5
...@@ -30,9 +30,13 @@ ...@@ -30,9 +30,13 @@
<isset property="env.WORKSPACE" /> <isset property="env.WORKSPACE" />
</condition> </condition>
<property name="fml.python.dir" location="${basedir}/python" /> <property name="fml.python.dir" location="${basedir}/python" />
<property name="fml.lzma.dir" location="${basedir}/lzmabin" />
<condition property="python.exe" value="${fml.python.dir}/python_fml" else="python"> <condition property="python.exe" value="${fml.python.dir}/python_fml" else="python">
<os family="Windows" /> <os family="Windows" />
</condition> </condition>
<condition property="lzma.exe" value="${fml.lzma.dir}/xz.exe" else="xz">
<os family="Windows" />
</condition>
<condition property="mcp.exists"> <condition property="mcp.exists">
<available file="${mcp.home}/runtime/commands.py" /> <available file="${mcp.home}/runtime/commands.py" />
</condition> </condition>
...@@ -150,7 +154,7 @@ ...@@ -150,7 +154,7 @@
</jar> </jar>
<antcall target="signjar" /> <antcall target="signjar" />
<zip update="true" destfile="${basedir}/target/${universal.jarname}.zip"> <zip update="true" destfile="${basedir}/target/${universal.jarname}.zip">
<zipfileset dir="${basedir}/binpatch" prefix="binpatch" includes="**/*.binpatch"/> <fileset dir="${basedir}" includes="binpatches.pack.lzma,deobfuscation_data-${version.minecraft}.lzma"/>
<fileset dir="${client.mcp.obfoutput}" includes="*.class" /> <fileset dir="${client.mcp.obfoutput}" includes="*.class" />
<zipfileset dir="${basedir}" includes="fmlversion.properties" /> <zipfileset dir="${basedir}" includes="fmlversion.properties" />
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt" /> <zipfileset dir="${basedir}" includes="LICENSE-fml.txt" />
...@@ -216,7 +220,8 @@ ...@@ -216,7 +220,8 @@
<globmapper from="packaged.srg" to="deobfuscation_data-${version.minecraft}" /> <globmapper from="packaged.srg" to="deobfuscation_data-${version.minecraft}" />
</mappedresources> </mappedresources>
</copy> </copy>
<exec executable="lzma"> <exec executable="${lzma.exe}">
<arg line="--format=lzma"/>
<arg line="build-tmp-deobf/deobfuscation_data-${version.minecraft}"/> <arg line="build-tmp-deobf/deobfuscation_data-${version.minecraft}"/>
<arg line="-v"/> <arg line="-v"/>
</exec> </exec>
...@@ -402,5 +407,21 @@ ...@@ -402,5 +407,21 @@
<arg path="${basedir}/binpatch/server"/> <arg path="${basedir}/binpatch/server"/>
<arg value="true"/> <arg value="true"/>
</java> </java>
<mkdir dir="binpatch-tmp"/>
<zip destfile="binpatch-tmp/binpatches.jar" basedir="${basedir}">
<include name="binpatch/**/*.binpatch"/>
</zip>
<apply executable="pack200">
<arg line="--no-gzip"/>
<arg line="binpatch-tmp/binpatches.pack"/>
<fileset dir="binpatch-tmp" includes="binpatches.jar"/>
</apply>
<apply executable="${lzma.exe}">
<arg line="--format=lzma"/>
<arg line="-v"/>
<fileset dir="binpatch-tmp" includes="binpatches.pack"/>
</apply>
<move file="binpatch-tmp/binpatches.pack.lzma" todir="${basedir}"/>
<delete dir="binpatch-tmp" failonerror="false"/>
</target> </target>
</project> </project>
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* are made available under the terms of the GNU Lesser Public License v2.1 * are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* *
* Contributors: * Contributors:
* cpw - implementation * cpw - implementation
*/ */
...@@ -150,7 +150,7 @@ public class MCPMerger ...@@ -150,7 +150,7 @@ public class MCPMerger
line = line.split("#")[0]; line = line.split("#")[0];
char cmd = line.charAt(0); char cmd = line.charAt(0);
line = line.substring(1).trim(); line = line.substring(1).trim();
switch (cmd) switch (cmd)
{ {
case '!': dontAnnotate.add(line); break; case '!': dontAnnotate.add(line); break;
...@@ -347,7 +347,7 @@ public class MCPMerger ...@@ -347,7 +347,7 @@ public class MCPMerger
} }
String entryName = entry.getName(); String entryName = entry.getName();
boolean filtered = false; boolean filtered = false;
for (String filter : dontProcess) for (String filter : dontProcess)
{ {
...@@ -357,7 +357,7 @@ public class MCPMerger ...@@ -357,7 +357,7 @@ public class MCPMerger
break; break;
} }
} }
if (filtered || !entryName.endsWith(".class") || entryName.startsWith(".")) if (filtered || !entryName.endsWith(".class") || entryName.startsWith("."))
{ {
ZipEntry newEntry = new ZipEntry(entry.getName()); ZipEntry newEntry = new ZipEntry(entry.getName());
......
...@@ -47,6 +47,7 @@ public class FMLTweaker implements ITweaker { ...@@ -47,6 +47,7 @@ public class FMLTweaker implements ITweaker {
classLoader.addTransformerExclusion("cpw.mods.fml.repackage."); classLoader.addTransformerExclusion("cpw.mods.fml.repackage.");
classLoader.addTransformerExclusion("cpw.mods.fml.relauncher."); classLoader.addTransformerExclusion("cpw.mods.fml.relauncher.");
classLoader.addTransformerExclusion("cpw.mods.fml.common.asm.transformers."); classLoader.addTransformerExclusion("cpw.mods.fml.common.asm.transformers.");
classLoader.addClassLoaderExclusion("LZMA.");
FMLLaunchHandler.configureForClientLaunch(classLoader, this); FMLLaunchHandler.configureForClientLaunch(classLoader, this);
} }
......
package cpw.mods.fml.common.patcher; package cpw.mods.fml.common.patcher;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.FilenameFilter; import java.io.FilenameFilter;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.security.CodeSource; import java.security.CodeSource;
import java.util.Collections; import java.util.Collections;
...@@ -10,9 +13,14 @@ import java.util.List; ...@@ -10,9 +13,14 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.jar.JarEntry; import java.util.jar.JarEntry;
import java.util.jar.JarFile; import java.util.jar.JarFile;
import java.util.jar.JarInputStream;
import java.util.jar.JarOutputStream;
import java.util.jar.Pack200;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import LZMA.LzmaInputStream;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.base.Throwables; import com.google.common.base.Throwables;
...@@ -83,18 +91,20 @@ public class ClassPatchManager { ...@@ -83,18 +91,20 @@ public class ClassPatchManager {
public void setup(Side side) public void setup(Side side)
{ {
Pattern binpatchMatcher = Pattern.compile(String.format("binpatch/%s/.*.binpatch", side.toString().toLowerCase(Locale.ENGLISH))); Pattern binpatchMatcher = Pattern.compile(String.format("binpatch/%s/.*.binpatch", side.toString().toLowerCase(Locale.ENGLISH)));
JarFile fmlJar; JarInputStream jis;
try try
{ {
FMLRelaunchLog.fine("FML URI is %s", FMLTweaker.getJarLocation()); InputStream binpatchesCompressed = getClass().getResourceAsStream("/binpatches.pack.lzma");
File fmlJarFile = new File(FMLTweaker.getJarLocation()); if (binpatchesCompressed==null)
if (!fmlJarFile.exists() || !fmlJarFile.isFile())
{ {
FMLRelaunchLog.log(Level.INFO, "Not found an FML jar, I assume you're developing FML. Hi cpw or Lex!"); FMLRelaunchLog.log(Level.SEVERE, "The binary patch set is missing. Things are probably about to go very wrong.");
patches = ArrayListMultimap.create();
return; return;
} }
fmlJar = new JarFile(fmlJarFile); LzmaInputStream binpatchesDecompressed = new LzmaInputStream(binpatchesCompressed);
ByteArrayOutputStream jarBytes = new ByteArrayOutputStream();
JarOutputStream jos = new JarOutputStream(jarBytes);
Pack200.newUnpacker().unpack(binpatchesDecompressed, jos);
jis = new JarInputStream(new ByteArrayInputStream(jarBytes.toByteArray()));
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -104,28 +114,43 @@ public class ClassPatchManager { ...@@ -104,28 +114,43 @@ public class ClassPatchManager {
patches = ArrayListMultimap.create(); patches = ArrayListMultimap.create();
for (JarEntry entry : Collections.list(fmlJar.entries())) do
{ {
if (binpatchMatcher.matcher(entry.getName()).matches()) try
{ {
ClassPatch cp = readPatch(entry, fmlJar); JarEntry entry = jis.getNextJarEntry();
if (cp != null) if (entry == null)
{
break;
}
if (binpatchMatcher.matcher(entry.getName()).matches())
{
ClassPatch cp = readPatch(entry, jis);
if (cp != null)
{
patches.put(cp.sourceClassName, cp);
}
}
else
{ {
patches.put(cp.sourceClassName, cp); jis.closeEntry();
} }
} }
} catch (IOException e)
FMLLog.fine("Read %d binary patches from %s", patches.size(), fmlJar.getName()); {
}
} while (true);
FMLLog.fine("Read %d binary patches", patches.size());
FMLLog.fine("Patch list :\n\t%s", Joiner.on("\t\n").join(patches.asMap().entrySet())); FMLLog.fine("Patch list :\n\t%s", Joiner.on("\t\n").join(patches.asMap().entrySet()));
} }
private ClassPatch readPatch(JarEntry patchEntry, JarFile jarFile) private ClassPatch readPatch(JarEntry patchEntry, JarInputStream jis)
{ {
FMLLog.finest("Reading patch data from %s in file %s", patchEntry.getName(), jarFile.getName()); FMLLog.finest("Reading patch data from %s", patchEntry.getName());
ByteArrayDataInput input; ByteArrayDataInput input;
try try
{ {
input = ByteStreams.newDataInput(ByteStreams.toByteArray(jarFile.getInputStream(patchEntry))); input = ByteStreams.newDataInput(ByteStreams.toByteArray(jis));
} }
catch (IOException e) catch (IOException e)
{ {
......
...@@ -85,7 +85,7 @@ def read_mc_versions(fml_dir, version=None, work_dir=None): ...@@ -85,7 +85,7 @@ def read_mc_versions(fml_dir, version=None, work_dir=None):
mc_info['library_dir'] = os.path.join(work_dir, 'libraries') mc_info['library_dir'] = os.path.join(work_dir, 'libraries')
mc_info['client_file'] = os.path.join(version_dir, '%s.jar' % version) mc_info['client_file'] = os.path.join(version_dir, '%s.jar' % version)
mc_info['json_file'] = os.path.join(version_dir, '%s.json' % version) mc_info['json_file'] = os.path.join(version_dir, '%s.json' % version)
mc_info['server_file'] = os.path.join(work_dir, 'minecraft_server.jar') mc_info['server_file'] = os.path.join(work_dir, 'minecraft_server.%s.jar' % version)
mc_info['asset_dir'] = os.path.join(work_dir, 'assets') mc_info['asset_dir'] = os.path.join(work_dir, 'assets')
else: else:
mc_info['new_launcher'] = False mc_info['new_launcher'] = False
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment