Add name field to Library

Signed-off-by: Graham <gpe@openrs2.dev>
Graham 4 years ago
parent 091c0ed29e
commit 9db64efb7b
  1. 8
      asm/src/main/java/dev/openrs2/asm/classpath/Library.kt
  2. 12
      bundler/src/main/java/dev/openrs2/bundler/Bundler.kt
  3. 12
      deob/src/main/java/dev/openrs2/deob/Deobfuscator.kt

@ -9,10 +9,10 @@ import java.nio.file.Path
import java.util.SortedMap
import java.util.TreeMap
class Library() : Iterable<ClassNode> {
class Library(val name: String) : Iterable<ClassNode> {
private var classes: SortedMap<String, ClassNode> = TreeMap()
constructor(library: Library) : this() {
constructor(name: String, library: Library) : this(name) {
for (clazz in library.classes.values) {
val copy = ClassNode()
clazz.accept(copy)
@ -55,14 +55,14 @@ class Library() : Iterable<ClassNode> {
companion object {
private val logger = InlineLogger()
fun read(path: Path, reader: LibraryReader): Library {
fun read(name: String, path: Path, reader: LibraryReader): Library {
logger.info { "Reading library $path" }
val classes = Files.newInputStream(path).use { input ->
reader.read(input)
}
val library = Library()
val library = Library(name)
for (clazz in classes) {
library.add(clazz)
}

@ -42,12 +42,12 @@ class Bundler @Inject constructor(
fun run(input: Path, output: Path, keyStorePath: Path) {
// read input jars/packs
logger.info { "Reading input jars" }
val unpacker = Library.read(input.resolve("unpackclass.pack"), JarLibraryReader)
val loader = Library.read(input.resolve("loader.jar"), JarLibraryReader)
val glLoader = Library.read(input.resolve("loader_gl.jar"), JarLibraryReader)
val gl = Library.read(input.resolve("jaggl.pack200"), Pack200LibraryReader)
val client = Library.read(input.resolve("runescape.jar"), JarLibraryReader)
val glClient = Library.read(input.resolve("runescape_gl.pack200"), Pack200LibraryReader)
val unpacker = Library.read("unpackclass", input.resolve("unpackclass.pack"), JarLibraryReader)
val loader = Library.read("loader_sd", input.resolve("loader.jar"), JarLibraryReader)
val glLoader = Library.read("loader_hd", input.resolve("loader_gl.jar"), JarLibraryReader)
val gl = Library.read("gl", input.resolve("jaggl.pack200"), Pack200LibraryReader)
val client = Library.read("client_sd", input.resolve("runescape.jar"), JarLibraryReader)
val glClient = Library.read("client_hd", input.resolve("runescape_gl.pack200"), Pack200LibraryReader)
// bundle libraries together into a common classpath
val runtime = ClassLoader.getPlatformClassLoader()

@ -21,19 +21,19 @@ class Deobfuscator @Inject constructor(
fun run(input: Path, output: Path) {
// read input jars/packs
logger.info { "Reading input jars" }
val client = Library.read(input.resolve("runescape_gl.pack200"), Pack200LibraryReader)
val gl = Library.read(input.resolve("jaggl.pack200"), Pack200LibraryReader)
val loader = Library.read(input.resolve("loader_gl.jar"), JarLibraryReader)
val unpackClass = Library.read(input.resolve("unpackclass.pack"), JarLibraryReader)
val client = Library.read("client", input.resolve("runescape_gl.pack200"), Pack200LibraryReader)
val gl = Library.read("gl", input.resolve("jaggl.pack200"), Pack200LibraryReader)
val loader = Library.read("loader", input.resolve("loader_gl.jar"), JarLibraryReader)
val unpackClass = Library.read("unpackclass", input.resolve("unpackclass.pack"), JarLibraryReader)
// overwrite client's classes with signed classes from the loader
logger.info { "Moving signed classes from loader to signlink" }
val signlink = Library()
val signlink = Library("signlink")
SignedClassUtils.move(loader, client, signlink)
// move unpack class out of the loader (so the unpacker and loader can both depend on it)
logger.info { "Moving unpack from loader to unpack" }
val unpack = Library()
val unpack = Library("unpack")
unpack.add(loader.remove("unpack")!!)
// prefix remaining loader/unpacker classes (to avoid conflicts when we rename in the same classpath as the client)

Loading…
Cancel
Save