Skip to content
This repository has been archived by the owner on May 26, 2018. It is now read-only.

Commit

Permalink
Functional client @ 1.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
cpw committed Jul 1, 2013
1 parent 12c928c commit 3f15cd5
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 24 deletions.
25 changes: 23 additions & 2 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@
<isset property="env.WORKSPACE" />
</condition>
<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">
<os family="Windows" />
</condition>
<condition property="lzma.exe" value="${fml.lzma.dir}/xz.exe" else="xz">
<os family="Windows" />
</condition>
<condition property="mcp.exists">
<available file="${mcp.home}/runtime/commands.py" />
</condition>
Expand Down Expand Up @@ -150,7 +154,7 @@
</jar>
<antcall target="signjar" />
<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" />
<zipfileset dir="${basedir}" includes="fmlversion.properties" />
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt" />
Expand Down Expand Up @@ -216,7 +220,8 @@
<globmapper from="packaged.srg" to="deobfuscation_data-${version.minecraft}" />
</mappedresources>
</copy>
<exec executable="lzma">
<exec executable="${lzma.exe}">
<arg line="--format=lzma"/>
<arg line="build-tmp-deobf/deobfuscation_data-${version.minecraft}"/>
<arg line="-v"/>
</exec>
Expand Down Expand Up @@ -402,5 +407,21 @@
<arg path="${basedir}/binpatch/server"/>
<arg value="true"/>
</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>
</project>
8 changes: 4 additions & 4 deletions common/cpw/mods/fml/common/asm/transformers/MCPMerger.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
*
* Contributors:
* cpw - implementation
*/
Expand Down Expand Up @@ -150,7 +150,7 @@ private static boolean readMapFile(File mapFile)
line = line.split("#")[0];
char cmd = line.charAt(0);
line = line.substring(1).trim();

switch (cmd)
{
case '!': dontAnnotate.add(line); break;
Expand Down Expand Up @@ -347,7 +347,7 @@ private static Hashtable<String, ZipEntry> getClassEntries(ZipFile inFile, ZipOu
}

String entryName = entry.getName();

boolean filtered = false;
for (String filter : dontProcess)
{
Expand All @@ -357,7 +357,7 @@ private static Hashtable<String, ZipEntry> getClassEntries(ZipFile inFile, ZipOu
break;
}
}

if (filtered || !entryName.endsWith(".class") || entryName.startsWith("."))
{
ZipEntry newEntry = new ZipEntry(entry.getName());
Expand Down
1 change: 1 addition & 0 deletions common/cpw/mods/fml/common/launcher/FMLTweaker.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public void injectIntoClassLoader(LaunchClassLoader classLoader)
classLoader.addTransformerExclusion("cpw.mods.fml.repackage.");
classLoader.addTransformerExclusion("cpw.mods.fml.relauncher.");
classLoader.addTransformerExclusion("cpw.mods.fml.common.asm.transformers.");
classLoader.addClassLoaderExclusion("LZMA.");
FMLLaunchHandler.configureForClientLaunch(classLoader, this);
}

Expand Down
59 changes: 42 additions & 17 deletions common/cpw/mods/fml/common/patcher/ClassPatchManager.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
package cpw.mods.fml.common.patcher;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.security.CodeSource;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.jar.JarEntry;
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.regex.Pattern;

import LZMA.LzmaInputStream;

import com.google.common.base.Joiner;
import com.google.common.base.Strings;
import com.google.common.base.Throwables;
Expand Down Expand Up @@ -83,18 +91,20 @@ else if (!patch.existsAtTarget)
public void setup(Side side)
{
Pattern binpatchMatcher = Pattern.compile(String.format("binpatch/%s/.*.binpatch", side.toString().toLowerCase(Locale.ENGLISH)));
JarFile fmlJar;
JarInputStream jis;
try
{
FMLRelaunchLog.fine("FML URI is %s", FMLTweaker.getJarLocation());
File fmlJarFile = new File(FMLTweaker.getJarLocation());
if (!fmlJarFile.exists() || !fmlJarFile.isFile())
InputStream binpatchesCompressed = getClass().getResourceAsStream("/binpatches.pack.lzma");
if (binpatchesCompressed==null)
{
FMLRelaunchLog.log(Level.INFO, "Not found an FML jar, I assume you're developing FML. Hi cpw or Lex!");
patches = ArrayListMultimap.create();
FMLRelaunchLog.log(Level.SEVERE, "The binary patch set is missing. Things are probably about to go very wrong.");
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)
{
Expand All @@ -104,28 +114,43 @@ public void setup(Side side)

patches = ArrayListMultimap.create();

for (JarEntry entry : Collections.list(fmlJar.entries()))
do
{
if (binpatchMatcher.matcher(entry.getName()).matches())
try
{
ClassPatch cp = readPatch(entry, fmlJar);
if (cp != null)
JarEntry entry = jis.getNextJarEntry();
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();
}
}
}
FMLLog.fine("Read %d binary patches from %s", patches.size(), fmlJar.getName());
catch (IOException e)
{
}
} 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()));
}

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;
try
{
input = ByteStreams.newDataInput(ByteStreams.toByteArray(jarFile.getInputStream(patchEntry)));
input = ByteStreams.newDataInput(ByteStreams.toByteArray(jis));
}
catch (IOException e)
{
Expand Down
2 changes: 1 addition & 1 deletion install/fml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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['client_file'] = os.path.join(version_dir, '%s.jar' % 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')
else:
mc_info['new_launcher'] = False
Expand Down

0 comments on commit 3f15cd5

Please sign in to comment.