mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 09:01:08 +03:00
parent
8d34ae76fc
commit
3d8700d727
2 changed files with 7 additions and 4 deletions
|
@ -23,7 +23,7 @@ private class CheckSuperClassVisitor extends ClassVisitor {
|
||||||
String superClassName;
|
String superClassName;
|
||||||
|
|
||||||
public CheckSuperClassVisitor() {
|
public CheckSuperClassVisitor() {
|
||||||
super(Opcodes.ASM5);
|
super(Opcodes.ASM7);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -57,9 +57,12 @@ public void acceptVisitor(String className, ClassVisitor visitor) throws IOExcep
|
||||||
|
|
||||||
public byte[] getClassData(String className) throws IOException {
|
public byte[] getClassData(String className) throws IOException {
|
||||||
for (JarFile f : cp) {
|
for (JarFile f : cp) {
|
||||||
if (f.getEntry(className + ".class") != null)
|
if (f.getEntry(className + ".class") != null) {
|
||||||
|
byte[] bytes = null;
|
||||||
try (InputStream in = f.getInputStream(f.getEntry(className + ".class"))) {
|
try (InputStream in = f.getInputStream(f.getEntry(className + ".class"))) {
|
||||||
return IOHelper.read(in);
|
bytes = IOHelper.read(in);
|
||||||
|
}
|
||||||
|
return bytes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return IOHelper.read(IOHelper.getResourceURL(className + ".class"));
|
return IOHelper.read(IOHelper.getResourceURL(className + ".class"));
|
||||||
|
|
|
@ -33,7 +33,7 @@ public byte[] transform(byte[] input, String classname, JARLauncherBinary data)
|
||||||
ClassNode cn = new ClassNode();
|
ClassNode cn = new ClassNode();
|
||||||
cr.accept(cn, ClassReader.SKIP_DEBUG);
|
cr.accept(cn, ClassReader.SKIP_DEBUG);
|
||||||
for (ClassNodeTransformer tr : transLst) tr.transform(cn, classname, data);
|
for (ClassNodeTransformer tr : transLst) tr.transform(cn, classname, data);
|
||||||
ClassWriter cw = new SafeClassWriter(data.reader, ClassWriter.COMPUTE_FRAMES);
|
ClassWriter cw = new SafeClassWriter(data.reader, ClassWriter.COMPUTE_MAXS);
|
||||||
cn.accept(cw);
|
cn.accept(cw);
|
||||||
return cw.toByteArray();
|
return cw.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue