Add PublicKeyTransformer to Bundler

master
Graham 5 years ago
parent 97a11ba765
commit 1d0bcfd88f
  1. 20
      bundler/src/main/java/dev/openrs2/bundler/Bundler.kt
  2. 10
      bundler/src/main/java/dev/openrs2/bundler/BundlerModule.kt

@ -1,6 +1,7 @@
package dev.openrs2.bundler package dev.openrs2.bundler
import com.github.michaelbull.logging.InlineLogger import com.github.michaelbull.logging.InlineLogger
import com.google.inject.Guice
import dev.openrs2.asm.classpath.ClassPath import dev.openrs2.asm.classpath.ClassPath
import dev.openrs2.asm.classpath.Library import dev.openrs2.asm.classpath.Library
import dev.openrs2.bundler.transform.BufferSizeTransformer import dev.openrs2.bundler.transform.BufferSizeTransformer
@ -9,6 +10,7 @@ import dev.openrs2.bundler.transform.HostCheckTransformer
import dev.openrs2.bundler.transform.LoadLibraryTransformer import dev.openrs2.bundler.transform.LoadLibraryTransformer
import dev.openrs2.bundler.transform.MacResizeTransformer import dev.openrs2.bundler.transform.MacResizeTransformer
import dev.openrs2.bundler.transform.PlatformDetectionTransformer import dev.openrs2.bundler.transform.PlatformDetectionTransformer
import dev.openrs2.bundler.transform.PublicKeyTransformer
import dev.openrs2.bundler.transform.ResourceTransformer import dev.openrs2.bundler.transform.ResourceTransformer
import dev.openrs2.bundler.transform.RightClickTransformer import dev.openrs2.bundler.transform.RightClickTransformer
import java.nio.file.Path import java.nio.file.Path
@ -16,14 +18,20 @@ import java.nio.file.Paths
import java.util.jar.Attributes import java.util.jar.Attributes
import java.util.jar.Attributes.Name.MANIFEST_VERSION import java.util.jar.Attributes.Name.MANIFEST_VERSION
import java.util.jar.Manifest import java.util.jar.Manifest
import javax.inject.Inject
import javax.inject.Singleton
fun main() { fun main() {
val bundler = Bundler(Paths.get("nonfree/code"), Paths.get("nonfree/code/bundle")) val injector = Guice.createInjector(BundlerModule())
bundler.run() val bundler = injector.getInstance(Bundler::class.java)
bundler.run(Paths.get("nonfree/code"), Paths.get("nonfree/code/bundle"))
} }
class Bundler(private val input: Path, private val output: Path) { @Singleton
fun run() { class Bundler @Inject constructor(publicKeyTransformer: PublicKeyTransformer) {
private val transformers = listOf(*TRANSFORMERS.toTypedArray(), publicKeyTransformer)
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 unpacker = Library.readJar(input.resolve("game_unpacker.dat")) val unpacker = Library.readJar(input.resolve("game_unpacker.dat"))
@ -48,13 +56,13 @@ class Bundler(private val input: Path, private val output: Path) {
// run simple transformers // run simple transformers
logger.info { "Transforming client" } logger.info { "Transforming client" }
for (transformer in TRANSFORMERS) { for (transformer in transformers) {
logger.info { "Running transformer ${transformer.javaClass.simpleName} " } logger.info { "Running transformer ${transformer.javaClass.simpleName} " }
transformer.transform(classPath) transformer.transform(classPath)
} }
logger.info { "Transforming client_gl" } logger.info { "Transforming client_gl" }
for (transformer in TRANSFORMERS) { for (transformer in transformers) {
logger.info { "Running transformer ${transformer.javaClass.simpleName} " } logger.info { "Running transformer ${transformer.javaClass.simpleName} " }
transformer.transform(glClassPath) transformer.transform(glClassPath)
} }

@ -0,0 +1,10 @@
package dev.openrs2.bundler
import com.google.inject.AbstractModule
import dev.openrs2.common.CommonModule
class BundlerModule : AbstractModule() {
override fun configure() {
install(CommonModule())
}
}
Loading…
Cancel
Save