Skip to content

Commit

Permalink
Remove dumpBytecode
Browse files Browse the repository at this point in the history
  • Loading branch information
Nilsen84 committed Sep 1, 2023
1 parent 5f4490b commit 408d2c0
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions src/main/kotlin/net/weavemc/loader/HookManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,12 @@ package net.weavemc.loader
import net.weavemc.loader.api.Hook
import net.weavemc.loader.bootstrap.SafeTransformer
import net.weavemc.loader.hooks.*
import net.weavemc.loader.util.dump
import org.objectweb.asm.ClassReader
import org.objectweb.asm.ClassWriter
import org.objectweb.asm.tree.ClassNode
import org.spongepowered.asm.transformers.MixinClassWriter
import java.nio.file.Files
import java.nio.file.Paths

internal object HookManager : SafeTransformer {

/**
* JVM argument to dump bytecode to disk. Can be enabled by adding
* `-DdumpBytecode=true` to your JVM arguments when launching with Weave.
*
* Defaults to `false`.
*/
val dumpBytecode = System.getProperty("dumpBytecode")?.toBoolean() ?: false

val hooks = mutableListOf(
ChatReceivedEventHook(),
ChatSentEventHook(),
Expand Down Expand Up @@ -58,15 +46,6 @@ internal object HookManager : SafeTransformer {
// HACK: use MixinClassWriter because it doesn't load classes when computing frames.
val writer = MixinClassWriter(reader, flags)
node.accept(writer)
if (dumpBytecode) {
val bytecodeDir = Files.createDirectory(Paths.get(
System.getProperty("user.home"),
".weave",
".bytecode.out"
))

node.dump(bytecodeDir.resolve("$className.class").toString())
}
return writer.toByteArray()
}
}

0 comments on commit 408d2c0

Please sign in to comment.