|
|
@ -20,13 +20,13 @@ class Deobfuscator @Inject constructor( |
|
|
|
fun run(input: Path, output: Path) { |
|
|
|
fun run(input: Path, output: Path) { |
|
|
|
// read input jars/packs |
|
|
|
// read input jars/packs |
|
|
|
logger.info { "Reading input jars" } |
|
|
|
logger.info { "Reading input jars" } |
|
|
|
val unpackClass = readJar(input.resolve("unpackclass.pack")) |
|
|
|
val unpackClass = Library.read(input.resolve("unpackclass.pack"), JarLibraryReader) |
|
|
|
val glUnpackClass = Library(unpackClass) |
|
|
|
val glUnpackClass = Library(unpackClass) |
|
|
|
val loader = readJar(input.resolve("loader.jar")) |
|
|
|
val loader = Library.read(input.resolve("loader.jar"), JarLibraryReader) |
|
|
|
val glLoader = readJar(input.resolve("loader_gl.jar")) |
|
|
|
val glLoader = Library.read(input.resolve("loader_gl.jar"), JarLibraryReader) |
|
|
|
val gl = readPack(input.resolve("jaggl.pack200")) |
|
|
|
val gl = Library.read(input.resolve("jaggl.pack200"), Pack200LibraryReader) |
|
|
|
val client = readJar(input.resolve("runescape.jar")) |
|
|
|
val client = Library.read(input.resolve("runescape.jar"), JarLibraryReader) |
|
|
|
val glClient = readPack(input.resolve("runescape_gl.pack200")) |
|
|
|
val glClient = Library.read(input.resolve("runescape_gl.pack200"), Pack200LibraryReader) |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
* TODO(gpe): it'd be nice to have separate signlink.jar and |
|
|
|
* TODO(gpe): it'd be nice to have separate signlink.jar and |
|
|
@ -103,44 +103,20 @@ class Deobfuscator @Inject constructor( |
|
|
|
|
|
|
|
|
|
|
|
Files.createDirectories(output) |
|
|
|
Files.createDirectories(output) |
|
|
|
|
|
|
|
|
|
|
|
writeJar(classPath, client, output.resolve("runescape.jar")) |
|
|
|
client.write(output.resolve("runescape.jar"), JarLibraryWriter, classPath) |
|
|
|
writeJar(classPath, loader, output.resolve("loader.jar")) |
|
|
|
loader.write(output.resolve("loader.jar"), JarLibraryWriter, classPath) |
|
|
|
writeJar(classPath, signLink, output.resolve("signlink.jar")) |
|
|
|
signLink.write(output.resolve("signlink.jar"), JarLibraryWriter, classPath) |
|
|
|
writeJar(classPath, unpack, output.resolve("unpack.jar")) |
|
|
|
unpack.write(output.resolve("unpack.jar"), JarLibraryWriter, classPath) |
|
|
|
writeJar(classPath, unpackClass, output.resolve("unpackclass.jar")) |
|
|
|
unpackClass.write(output.resolve("unpackclass.jar"), JarLibraryWriter, classPath) |
|
|
|
|
|
|
|
|
|
|
|
writeJar(glClassPath, gl, output.resolve("jaggl.jar")) |
|
|
|
gl.write(output.resolve("jaggl.jar"), JarLibraryWriter, glClassPath) |
|
|
|
writeJar(glClassPath, glClient, output.resolve("runescape_gl.jar")) |
|
|
|
glClient.write(output.resolve("runescape_gl.jar"), JarLibraryWriter, glClassPath) |
|
|
|
writeJar(glClassPath, glLoader, output.resolve("loader_gl.jar")) |
|
|
|
glLoader.write(output.resolve("loader_gl.jar"), JarLibraryWriter, glClassPath) |
|
|
|
writeJar(glClassPath, glSignLink, output.resolve("signlink_gl.jar")) |
|
|
|
glSignLink.write(output.resolve("signlink_gl.jar"), JarLibraryWriter, glClassPath) |
|
|
|
writeJar(glClassPath, glUnpack, output.resolve("unpack_gl.jar")) |
|
|
|
glUnpack.write(output.resolve("unpack_gl.jar"), JarLibraryWriter, glClassPath) |
|
|
|
writeJar(glClassPath, glUnpackClass, output.resolve("unpackclass_gl.jar")) |
|
|
|
glUnpackClass.write(output.resolve("unpackclass_gl.jar"), JarLibraryWriter, glClassPath) |
|
|
|
|
|
|
|
|
|
|
|
writeJar(unsignedClassPath, unsignedClient, output.resolve("runescape_unsigned.jar")) |
|
|
|
unsignedClient.write(output.resolve("runescape_unsigned.jar"), JarLibraryWriter, unsignedClassPath) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun readJar(path: Path): Library { |
|
|
|
|
|
|
|
logger.info { "Reading jar $path" } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Files.newInputStream(path).use { input -> |
|
|
|
|
|
|
|
JarLibraryReader.read(input) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun readPack(path: Path): Library { |
|
|
|
|
|
|
|
logger.info { "Reading pack $path" } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Files.newInputStream(path).use { input -> |
|
|
|
|
|
|
|
Pack200LibraryReader.read(input) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun writeJar(classPath: ClassPath, library: Library, path: Path) { |
|
|
|
|
|
|
|
logger.info { "Writing jar $path" } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Files.newOutputStream(path).use { output -> |
|
|
|
|
|
|
|
JarLibraryWriter.write(output, classPath, library) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
companion object { |
|
|
|
companion object { |
|
|
|