Open-source multiplayer game server compatible with the RuneScape client https://www.openrs2.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

48 lines
1.1 KiB

package org.openrs2.deob.bytecode
import org.objectweb.asm.Attribute
import org.objectweb.asm.ByteVector
import org.objectweb.asm.ClassWriter
import org.objectweb.asm.Label
import org.objectweb.asm.tree.LabelNode
public class OriginalPcTable(
private val pcs: Map<LabelNode, Int>,
private val names: Map<Int, String>
) : Attribute("OriginalPcTable") {
override fun isCodeAttribute(): Boolean {
return true
}
override fun isUnknown(): Boolean {
return false
}
override fun getLabels(): Array<Label> {
return pcs.keys.map(LabelNode::getLabel).toTypedArray()
}
override fun write(
classWriter: ClassWriter,
code: ByteArray?,
codeLength: Int,
maxStack: Int,
maxLocals: Int
): ByteVector {
val buf = ByteVector()
buf.putShort(pcs.size)
for ((label, pc) in pcs) {
buf.putShort(label.label.offset)
buf.putShort(pc)
}
buf.putShort(names.size)
for ((pc, name) in names) {
buf.putShort(pc)
buf.putShort(classWriter.newUTF8(name))
}
return buf
}
}