injector: saveJar -> save, finish main cleanup
This commit is contained in:
@@ -137,7 +137,7 @@ public class Deob
|
|||||||
//new MaxMemoryTransformer().transform(group);
|
//new MaxMemoryTransformer().transform(group);
|
||||||
//new RuneliteBufferTransformer().transform(group);
|
//new RuneliteBufferTransformer().transform(group);
|
||||||
|
|
||||||
JarUtil.saveJar(group, new File(args[1]));
|
JarUtil.save(group, new File(args[1]));
|
||||||
|
|
||||||
stopwatch.stop();
|
stopwatch.stop();
|
||||||
logger.info("Done in {}", stopwatch);
|
logger.info("Done in {}", stopwatch);
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public class UpdateMappings
|
|||||||
|
|
||||||
public void save(File out) throws IOException
|
public void save(File out) throws IOException
|
||||||
{
|
{
|
||||||
JarUtil.saveJar(group2, out);
|
JarUtil.save(group2, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException
|
public static void main(String[] args) throws IOException
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ public class JarUtil
|
|||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void saveJar(ClassGroup group, File jarfile)
|
public static void save(ClassGroup group, File jarfile)
|
||||||
{
|
{
|
||||||
try (JarOutputStream jout = new JarOutputStream(new FileOutputStream(jarfile)))
|
try (JarOutputStream jout = new JarOutputStream(new FileOutputStream(jarfile)))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class ClassFileVisitorTest
|
|||||||
{
|
{
|
||||||
ClassGroup group = JarUtil.load(new File(properties.getVanillaClient()));
|
ClassGroup group = JarUtil.load(new File(properties.getVanillaClient()));
|
||||||
|
|
||||||
JarUtil.saveJar(group, folder.newFile());
|
JarUtil.save(group, folder.newFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class EnumDeobfuscatorTest
|
|||||||
@After
|
@After
|
||||||
public void after() throws IOException
|
public void after() throws IOException
|
||||||
{
|
{
|
||||||
JarUtil.saveJar(group, folder.newFile());
|
JarUtil.save(group, folder.newFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class FieldInlinerTest
|
|||||||
@After
|
@After
|
||||||
public void after() throws IOException
|
public void after() throws IOException
|
||||||
{
|
{
|
||||||
JarUtil.saveJar(group, folder.newFile());
|
JarUtil.save(group, folder.newFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class IllegalStateExceptionsTest
|
|||||||
@After
|
@After
|
||||||
public void after() throws IOException
|
public void after() throws IOException
|
||||||
{
|
{
|
||||||
JarUtil.saveJar(group, folder.newFile());
|
JarUtil.save(group, folder.newFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class OrderTest
|
|||||||
@After
|
@After
|
||||||
public void after() throws IOException
|
public void after() throws IOException
|
||||||
{
|
{
|
||||||
JarUtil.saveJar(group, folder.newFile());
|
JarUtil.save(group, folder.newFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class PacketHandlerOrderTest
|
|||||||
@After
|
@After
|
||||||
public void after() throws IOException
|
public void after() throws IOException
|
||||||
{
|
{
|
||||||
JarUtil.saveJar(group, folder.newFile());
|
JarUtil.save(group, folder.newFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class RenameUniqueTest
|
|||||||
@After
|
@After
|
||||||
public void after() throws IOException
|
public void after() throws IOException
|
||||||
{
|
{
|
||||||
JarUtil.saveJar(group, folder.newFile());
|
JarUtil.save(group, folder.newFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class RuntimeExceptionsTest
|
|||||||
@After
|
@After
|
||||||
public void after() throws IOException
|
public void after() throws IOException
|
||||||
{
|
{
|
||||||
JarUtil.saveJar(group, folder.newFile());
|
JarUtil.save(group, folder.newFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class UnreachedCodeTest
|
|||||||
@After
|
@After
|
||||||
public void after() throws IOException
|
public void after() throws IOException
|
||||||
{
|
{
|
||||||
JarUtil.saveJar(group, folder.newFile());
|
JarUtil.save(group, folder.newFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class UnusedClassTest
|
|||||||
@After
|
@After
|
||||||
public void after() throws IOException
|
public void after() throws IOException
|
||||||
{
|
{
|
||||||
JarUtil.saveJar(group, folder.newFile());
|
JarUtil.save(group, folder.newFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class UnusedFieldsTest
|
|||||||
@After
|
@After
|
||||||
public void after() throws IOException
|
public void after() throws IOException
|
||||||
{
|
{
|
||||||
JarUtil.saveJar(group, folder.newFile());
|
JarUtil.save(group, folder.newFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class UnusedMethodsTest
|
|||||||
@After
|
@After
|
||||||
public void after() throws IOException
|
public void after() throws IOException
|
||||||
{
|
{
|
||||||
JarUtil.saveJar(group, folder.newFile());
|
JarUtil.save(group, folder.newFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class UnusedParametersTest
|
|||||||
@After
|
@After
|
||||||
public void after() throws IOException
|
public void after() throws IOException
|
||||||
{
|
{
|
||||||
JarUtil.saveJar(group, folder.newFile());
|
JarUtil.save(group, folder.newFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class ModArithTest
|
|||||||
@After
|
@After
|
||||||
public void after() throws IOException
|
public void after() throws IOException
|
||||||
{
|
{
|
||||||
JarUtil.saveJar(group, folder.newFile());
|
JarUtil.save(group, folder.newFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class MultiplyZeroDeobfuscatorTest
|
|||||||
@After
|
@After
|
||||||
public void after() throws IOException
|
public void after() throws IOException
|
||||||
{
|
{
|
||||||
JarUtil.saveJar(group, folder.newFile());
|
JarUtil.save(group, folder.newFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class ControlFlowDeobfuscatorTest
|
|||||||
@After
|
@After
|
||||||
public void after() throws IOException
|
public void after() throws IOException
|
||||||
{
|
{
|
||||||
JarUtil.saveJar(group, folder.newFile());
|
JarUtil.save(group, folder.newFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class ConstantParameterTest
|
|||||||
@After
|
@After
|
||||||
public void after() throws IOException
|
public void after() throws IOException
|
||||||
{
|
{
|
||||||
JarUtil.saveJar(group, folder.newFile());
|
JarUtil.save(group, folder.newFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class MenuActionDeobfuscatorTest
|
|||||||
@After
|
@After
|
||||||
public void after() throws IOException
|
public void after() throws IOException
|
||||||
{
|
{
|
||||||
JarUtil.saveJar(group, folder.newFile());
|
JarUtil.save(group, folder.newFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class PacketWriteDeobfuscatorTest
|
|||||||
@After
|
@After
|
||||||
public void after() throws IOException
|
public void after() throws IOException
|
||||||
{
|
{
|
||||||
JarUtil.saveJar(group, folder.newFile());
|
JarUtil.save(group, folder.newFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class ClientErrorTransformerTest
|
|||||||
{
|
{
|
||||||
File out = folder.newFile();
|
File out = folder.newFile();
|
||||||
|
|
||||||
JarUtil.saveJar(group, out);
|
JarUtil.save(group, out);
|
||||||
|
|
||||||
logger.info("Wrote to {}", out);
|
logger.info("Wrote to {}", out);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public class AnnotationCleaner
|
|||||||
|
|
||||||
new AnnotationAdder(group).run();
|
new AnnotationAdder(group).run();
|
||||||
|
|
||||||
JarUtil.saveJar(group, new File("C:/Users/Lucas/Desktop/niec.jar"));
|
JarUtil.save(group, new File("C:/Users/Lucas/Desktop/niec.jar"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class OhNoException extends Exception
|
private static class OhNoException extends Exception
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class AnnotationCopierTest
|
|||||||
@After
|
@After
|
||||||
public void after() throws IOException
|
public void after() throws IOException
|
||||||
{
|
{
|
||||||
JarUtil.saveJar(group2, new File(OUT));
|
JarUtil.save(group2, new File(OUT));
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Test
|
//@Test
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class AnnotationRenamerTest
|
|||||||
@After
|
@After
|
||||||
public void after() throws IOException
|
public void after() throws IOException
|
||||||
{
|
{
|
||||||
JarUtil.saveJar(group, new File(OUT));
|
JarUtil.save(group, new File(OUT));
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Test
|
//@Test
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public class UpdateMappingsTest
|
|||||||
|
|
||||||
map(group1, group2);
|
map(group1, group2);
|
||||||
|
|
||||||
JarUtil.saveJar(group2, new File(OUT));
|
JarUtil.save(group2, new File(OUT));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -98,7 +98,7 @@ public class UpdateMappingsTest
|
|||||||
|
|
||||||
new ScriptOpcodesTransformer().transform(group);
|
new ScriptOpcodesTransformer().transform(group);
|
||||||
|
|
||||||
JarUtil.saveJar(group, new File("C:/Users/Lucas/Desktop/Apapapapapap.jar"));
|
JarUtil.save(group, new File("C:/Users/Lucas/Desktop/Apapapapapap.jar"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void unannotate(ClassGroup group)
|
private void unannotate(ClassGroup group)
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public class HookImporter
|
|||||||
@After
|
@After
|
||||||
public void after() throws IOException
|
public void after() throws IOException
|
||||||
{
|
{
|
||||||
JarUtil.saveJar(group, OUT);
|
JarUtil.save(group, OUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class MappingImporter
|
|||||||
@After
|
@After
|
||||||
public void after() throws IOException
|
public void after() throws IOException
|
||||||
{
|
{
|
||||||
JarUtil.saveJar(group, OUT);
|
JarUtil.save(group, OUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasObfuscatedName(Annotated an, String name)
|
private boolean hasObfuscatedName(Annotated an, String name)
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public class HookImporter
|
|||||||
public void after() throws IOException
|
public void after() throws IOException
|
||||||
{
|
{
|
||||||
File out = folder.newFile("client.jar");
|
File out = folder.newFile("client.jar");
|
||||||
JarUtil.saveJar(group, out);
|
JarUtil.save(group, out);
|
||||||
logger.info("Wrote to {}", out);
|
logger.info("Wrote to {}", out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,39 +24,36 @@ import com.openosrs.injector.injectors.raw.ScriptVM;
|
|||||||
import com.openosrs.injector.rsapi.RSApi;
|
import com.openosrs.injector.rsapi.RSApi;
|
||||||
import com.openosrs.injector.transformers.InjectTransformer;
|
import com.openosrs.injector.transformers.InjectTransformer;
|
||||||
import com.openosrs.injector.transformers.SourceChanger;
|
import com.openosrs.injector.transformers.SourceChanger;
|
||||||
|
import static net.runelite.deob.util.JarUtil.load;
|
||||||
|
import static net.runelite.deob.util.JarUtil.save;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import net.runelite.deob.util.JarUtil;
|
|
||||||
import org.gradle.api.logging.Logger;
|
import org.gradle.api.logging.Logger;
|
||||||
import org.gradle.api.logging.Logging;
|
import org.gradle.api.logging.Logging;
|
||||||
|
|
||||||
public class Injector extends InjectData implements InjectTaskHandler
|
public class Injector extends InjectData implements InjectTaskHandler
|
||||||
{
|
{
|
||||||
private static final Logger log = Logging.getLogger(Injector.class);
|
static final Logger log = Logging.getLogger(Injector.class);
|
||||||
|
static Injector injector = new Injector();
|
||||||
private static Injector injector;
|
static File injectedClient =
|
||||||
static File injectedClient = new File("../runelite-client/src/main/resources/net/runelite/client/injected-client.oprs");
|
new File("../runelite-client/src/main/resources/net/runelite/client/injected-client.oprs");
|
||||||
|
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{
|
{
|
||||||
File vanillaJar = new File(args[0]);
|
injector.vanilla = load(new File(args[0]));
|
||||||
File rsClientJar = new File("../runescape-client/build/libs/runescape-client-" + args[1] + ".jar");
|
injector.deobfuscated = load(
|
||||||
File mixinsJar = new File("../runelite-mixins/build/libs/runelite-mixins-" + args[1] + ".jar");
|
new File("../runescape-client/build/libs/runescape-client-" + args[1] + ".jar"));
|
||||||
RSApi rsApiClasses = new RSApi(Objects.requireNonNull(
|
injector.rsApi = new RSApi(Objects.requireNonNull(
|
||||||
new File("../runescape-api/build/classes/java/main/net/runelite/rs/api/")
|
new File("../runescape-api/build/classes/java/main/net/runelite/rs/api/")
|
||||||
.listFiles()));
|
.listFiles()));
|
||||||
|
injector.mixins = load(
|
||||||
injector = new Injector();
|
new File("../runelite-mixins/build/libs/runelite-mixins-" + args[1] + ".jar"));
|
||||||
injector.vanilla = JarUtil.load(vanillaJar);
|
|
||||||
injector.deobfuscated = JarUtil.load(rsClientJar);
|
|
||||||
injector.rsApi = rsApiClasses;
|
|
||||||
injector.mixins = JarUtil.load(mixinsJar);
|
|
||||||
injector.initToVanilla();
|
injector.initToVanilla();
|
||||||
injector.inject();
|
injector.injectVanilla();
|
||||||
save();
|
save(injector.getVanilla(), injectedClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void inject()
|
public void injectVanilla()
|
||||||
{
|
{
|
||||||
log.debug("[DEBUG] Starting injection");
|
log.debug("[DEBUG] Starting injection");
|
||||||
|
|
||||||
@@ -96,13 +93,6 @@ public class Injector extends InjectData implements InjectTaskHandler
|
|||||||
transform(new SourceChanger(this));
|
transform(new SourceChanger(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void save()
|
|
||||||
{
|
|
||||||
log.info("[INFO] Saving jar to {}", injectedClient.toString());
|
|
||||||
|
|
||||||
JarUtil.saveJar(injector.getVanilla(), injectedClient);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void inject(com.openosrs.injector.injectors.Injector injector)
|
private void inject(com.openosrs.injector.injectors.Injector injector)
|
||||||
{
|
{
|
||||||
final String name = injector.getName();
|
final String name = injector.getName();
|
||||||
|
|||||||
@@ -15,5 +15,5 @@ public interface InjectTaskHandler
|
|||||||
/**
|
/**
|
||||||
* The actual method that does all the work
|
* The actual method that does all the work
|
||||||
*/
|
*/
|
||||||
void inject();
|
void injectVanilla();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user