Add blank line between is blocks

Seems to be a recent change in the IDEA formatter.

Signed-off-by: Graham <gpe@openrs2.org>
Graham 2 years ago
parent c0056f9cb1
commit 4ca7fab636
  1. 2
      archive/src/main/kotlin/org/openrs2/archive/cache/CacheDownloader.kt
  2. 1
      archive/src/main/kotlin/org/openrs2/archive/cache/nxt/Js5RequestEncoder.kt
  3. 2
      archive/src/main/kotlin/org/openrs2/archive/jav/JavConfig.kt
  4. 2
      archive/src/main/kotlin/org/openrs2/archive/key/JsonKeyReader.kt
  5. 2
      asm/src/main/kotlin/org/openrs2/asm/ClassNodeRemapper.kt
  6. 2
      asm/src/main/kotlin/org/openrs2/asm/InsnNodeUtils.kt
  7. 2
      asm/src/main/kotlin/org/openrs2/asm/MethodNodeUtils.kt
  8. 3
      asm/src/main/kotlin/org/openrs2/asm/StackMetadata.kt
  9. 1
      asm/src/main/kotlin/org/openrs2/asm/filter/Glob.kt
  10. 2
      asm/src/main/kotlin/org/openrs2/asm/packclass/ConstantPool.kt
  11. 22
      asm/src/main/kotlin/org/openrs2/asm/packclass/PackClass.kt
  12. 1
      buffer-generator/src/main/kotlin/org/openrs2/buffer/generator/ByteOrder.kt
  13. 2
      cache-550/src/main/kotlin/org/openrs2/cache/config/enum/EnumType.kt
  14. 3
      cache-550/src/main/kotlin/org/openrs2/cache/config/struct/StructType.kt
  15. 1
      cache-550/src/main/kotlin/org/openrs2/cache/config/varbit/VarbitType.kt
  16. 19
      cache-550/src/main/kotlin/org/openrs2/cache/midi/Song.kt
  17. 2
      cache/src/main/kotlin/org/openrs2/cache/Js5Compression.kt
  18. 2
      cache/src/main/kotlin/org/openrs2/cache/Js5MasterIndex.kt
  19. 1
      cache/src/main/kotlin/org/openrs2/cache/MutableNamedEntryCollection.kt
  20. 1
      compress/src/main/kotlin/org/openrs2/compress/gzip/GzipLaxInputStream.kt
  21. 6
      deob-ast/src/main/kotlin/org/openrs2/deob/ast/transform/AddSubTransformer.kt
  22. 4
      deob-ast/src/main/kotlin/org/openrs2/deob/ast/transform/BitMaskTransformer.kt
  23. 7
      deob-ast/src/main/kotlin/org/openrs2/deob/ast/transform/EncloseTransformer.kt
  24. 1
      deob-ast/src/main/kotlin/org/openrs2/deob/ast/transform/ForLoopConditionTransformer.kt
  25. 2
      deob-ast/src/main/kotlin/org/openrs2/deob/ast/transform/GlTransformer.kt
  26. 4
      deob-ast/src/main/kotlin/org/openrs2/deob/ast/transform/IdentityTransformer.kt
  27. 2
      deob-ast/src/main/kotlin/org/openrs2/deob/ast/transform/IfElseTransformer.kt
  28. 13
      deob-ast/src/main/kotlin/org/openrs2/deob/ast/util/ExprUtils.kt
  29. 1
      deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/analysis/CopyPropagationAnalyzer.kt
  30. 2
      deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/analysis/IntInterpreter.kt
  31. 1
      deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/analysis/LiveVariableAnalyzer.kt
  32. 2
      deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/remap/FieldMappingGenerator.kt
  33. 1
      deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/transform/ConstantArgTransformer.kt
  34. 1
      deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/transform/EmptyClassTransformer.kt
  35. 2
      deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/transform/OpaquePredicateTransformer.kt
  36. 1
      deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/transform/UnusedArgTransformer.kt
  37. 1
      deob-processor/src/main/kotlin/org/openrs2/deob/processor/NameMapProcessor.kt
  38. 3
      http/src/main/kotlin/org/openrs2/http/NetrcReader.kt
  39. 2
      patcher/src/main/kotlin/org/openrs2/patcher/transform/CachePathTransformer.kt
  40. 2
      patcher/src/main/kotlin/org/openrs2/patcher/transform/HighDpiTransformer.kt
  41. 1
      patcher/src/main/kotlin/org/openrs2/patcher/transform/PublicKeyTransformer.kt
  42. 3
      protocol/src/main/kotlin/org/openrs2/protocol/js5/upstream/Js5RequestEncoder.kt
  43. 3
      protocol/src/main/kotlin/org/openrs2/protocol/login/upstream/LoginRequest.kt
  44. 1
      util/src/main/kotlin/org/openrs2/util/charset/ModifiedUtf8Charset.kt
  45. 2
      util/src/main/kotlin/org/openrs2/util/collect/ForestDisjointSet.kt

@ -54,6 +54,7 @@ public class CacheDownloader @Inject constructor(
) )
) )
} }
"runescape" -> { "runescape" -> {
val buildMinor = game.buildMinor ?: throw Exception("Current minor build not set") val buildMinor = game.buildMinor ?: throw Exception("Current minor build not set")
@ -82,6 +83,7 @@ public class CacheDownloader @Inject constructor(
) )
) )
} }
else -> throw UnsupportedOperationException() else -> throw UnsupportedOperationException()
} }

@ -16,6 +16,7 @@ public object Js5RequestEncoder : MessageToByteEncoder<Js5Request>(Js5Request::c
out.writeShort(msg.build) out.writeShort(msg.build)
out.writeShort(0) out.writeShort(0)
} }
is Js5Request.Connected -> { is Js5Request.Connected -> {
out.writeByte(6) out.writeByte(6)
out.writeMedium(5) out.writeMedium(5)

@ -47,12 +47,14 @@ public data class JavConfig(
messages[parts[0]] = parts[1] messages[parts[0]] = parts[1]
} }
} }
line.startsWith("param=") -> { line.startsWith("param=") -> {
val parts = line.substring("param=".length).split("=", limit = 2) val parts = line.substring("param=".length).split("=", limit = 2)
if (parts.size == 2) { if (parts.size == 2) {
params[parts[0]] = parts[1] params[parts[0]] = parts[1]
} }
} }
else -> { else -> {
val parts = line.split("=", limit = 2) val parts = line.split("=", limit = 2)
if (parts.size == 2) { if (parts.size == 2) {

@ -24,11 +24,13 @@ public class JsonKeyReader @Inject constructor(
keys += mapper.treeToValue<XteaKey?>(key) ?: throw IOException("Key must be non-null") keys += mapper.treeToValue<XteaKey?>(key) ?: throw IOException("Key must be non-null")
} }
} }
root.isObject -> { root.isObject -> {
for (entry in root.fields()) { for (entry in root.fields()) {
keys += mapper.treeToValue<XteaKey?>(entry.value) ?: throw IOException("Key must be non-null") keys += mapper.treeToValue<XteaKey?>(entry.value) ?: throw IOException("Key must be non-null")
} }
} }
else -> throw IOException("Root element must be an array or object") else -> throw IOException("Root element must be an array or object")
} }

@ -109,12 +109,14 @@ public fun AbstractInsnNode.remap(remapper: ExtendedRemapper) {
name = remapper.mapFieldName(originalOwner, name, desc) name = remapper.mapFieldName(originalOwner, name, desc)
desc = remapper.mapDesc(desc) desc = remapper.mapDesc(desc)
} }
is MethodInsnNode -> { is MethodInsnNode -> {
val originalOwner = owner val originalOwner = owner
owner = remapper.mapMethodOwner(originalOwner, name, desc) owner = remapper.mapMethodOwner(originalOwner, name, desc)
name = remapper.mapMethodName(originalOwner, name, desc) name = remapper.mapMethodName(originalOwner, name, desc)
desc = remapper.mapDesc(desc) desc = remapper.mapDesc(desc)
} }
is InvokeDynamicInsnNode -> throw UnsupportedOperationException() is InvokeDynamicInsnNode -> throw UnsupportedOperationException()
is TypeInsnNode -> desc = remapper.mapType(desc) is TypeInsnNode -> desc = remapper.mapType(desc)
is LdcInsnNode -> cst = remapper.mapValue(cst) is LdcInsnNode -> cst = remapper.mapValue(cst)

@ -245,6 +245,7 @@ public val AbstractInsnNode.intConstant: Int?
null null
} }
} }
is LdcInsnNode -> { is LdcInsnNode -> {
val cst = cst val cst = cst
if (cst is Int) { if (cst is Int) {
@ -253,6 +254,7 @@ public val AbstractInsnNode.intConstant: Int?
null null
} }
} }
else -> when (opcode) { else -> when (opcode) {
Opcodes.ICONST_M1 -> -1 Opcodes.ICONST_M1 -> -1
Opcodes.ICONST_0 -> 0 Opcodes.ICONST_0 -> 0

@ -99,6 +99,7 @@ public fun MethodNode.removeArgument(argIndex: Int) {
newLocalIndexUsed = true newLocalIndexUsed = true
} }
} }
is IincInsnNode -> { is IincInsnNode -> {
insn.`var` = remap(insn.`var`, argType, localIndex, newLocalIndex) insn.`var` = remap(insn.`var`, argType, localIndex, newLocalIndex)
@ -106,6 +107,7 @@ public fun MethodNode.removeArgument(argIndex: Int) {
newLocalIndexUsed = true newLocalIndexUsed = true
} }
} }
is FrameNode -> throw UnsupportedOperationException("SKIP_FRAMES and COMPUTE_FRAMES must be used") is FrameNode -> throw UnsupportedOperationException("SKIP_FRAMES and COMPUTE_FRAMES must be used")
} }
} }

@ -188,6 +188,7 @@ public val AbstractInsnNode.stackMetadata: StackMetadata
} else { } else {
PUSH1 PUSH1
} }
is FieldInsnNode -> { is FieldInsnNode -> {
val fieldSize = Type.getType(desc).size val fieldSize = Type.getType(desc).size
var pushes = 0 var pushes = 0
@ -202,6 +203,7 @@ public val AbstractInsnNode.stackMetadata: StackMetadata
} }
StackMetadata(pops, pushes) StackMetadata(pops, pushes)
} }
is MethodInsnNode -> { is MethodInsnNode -> {
val argumentsAndReturnSizes = Type.getArgumentsAndReturnSizes(desc) val argumentsAndReturnSizes = Type.getArgumentsAndReturnSizes(desc)
val pushes = argumentsAndReturnSizes and 0x3 val pushes = argumentsAndReturnSizes and 0x3
@ -211,6 +213,7 @@ public val AbstractInsnNode.stackMetadata: StackMetadata
} }
StackMetadata(pops, pushes) StackMetadata(pops, pushes)
} }
is InvokeDynamicInsnNode -> throw UnsupportedOperationException() is InvokeDynamicInsnNode -> throw UnsupportedOperationException()
is MultiANewArrayInsnNode -> StackMetadata(dims, 1) is MultiANewArrayInsnNode -> StackMetadata(dims, 1)
else -> SIMPLE_OPCODES[opcode] ?: throw IllegalArgumentException() else -> SIMPLE_OPCODES[opcode] ?: throw IllegalArgumentException()

@ -35,6 +35,7 @@ public object Glob {
} else { } else {
regex.append(".*") regex.append(".*")
} }
else -> regex.append(Regex.escape(ch.toString())) else -> regex.append(Regex.escape(ch.toString()))
} }
} }

@ -94,6 +94,7 @@ public class ConstantPool private constructor(
addMethodRef(methodRef) addMethodRef(methodRef)
} }
} }
is FieldInsnNode -> addFieldRef(MemberRef(insn.owner, insn.name, insn.desc)) is FieldInsnNode -> addFieldRef(MemberRef(insn.owner, insn.name, insn.desc))
is TypeInsnNode -> strings += insn.desc is TypeInsnNode -> strings += insn.desc
} }
@ -155,6 +156,7 @@ public class ConstantPool private constructor(
throw IllegalArgumentException("Unsupported constant type: ${value.sort}") throw IllegalArgumentException("Unsupported constant type: ${value.sort}")
} }
} }
else -> throw IllegalArgumentException("Unsupported constant type: ${value.javaClass.name}") else -> throw IllegalArgumentException("Unsupported constant type: ${value.javaClass.name}")
} }
} }

@ -503,11 +503,13 @@ public object PackClass {
branchLen += (cases + 2) * 4 branchLen += (cases + 2) * 4
sipushAndSwitchLen += 4 sipushAndSwitchLen += 4
} }
Opcodes.LOOKUPSWITCH -> { Opcodes.LOOKUPSWITCH -> {
val cases = buf.readVarInt() val cases = buf.readVarInt()
branchLen += (cases + 1) * 4 branchLen += (cases + 1) * 4
sipushAndSwitchLen += cases * 4 sipushAndSwitchLen += cases * 4
} }
Opcodes.INVOKEINTERFACE -> interfaceMethodRefLen += 2 Opcodes.INVOKEINTERFACE -> interfaceMethodRefLen += 2
Opcodes.NEWARRAY -> newArrayLen++ Opcodes.NEWARRAY -> newArrayLen++
Opcodes.MULTIANEWARRAY -> multiNewArrayLen++ Opcodes.MULTIANEWARRAY -> multiNewArrayLen++
@ -1155,10 +1157,12 @@ public object PackClass {
) )
} }
} }
insn.`var` < 256 -> { insn.`var` < 256 -> {
buf.writeByte(insn.opcode) buf.writeByte(insn.opcode)
localVarBuf.writeByte(insn.`var`) localVarBuf.writeByte(insn.`var`)
} }
else -> { else -> {
buf.writeByte(WIDE) buf.writeByte(WIDE)
buf.writeByte(insn.opcode) buf.writeByte(insn.opcode)
@ -1166,28 +1170,34 @@ public object PackClass {
} }
} }
} }
is LdcInsnNode -> { is LdcInsnNode -> {
when (val value = insn.cst) { when (val value = insn.cst) {
is Int -> { is Int -> {
buf.writeByte(LDC_INT) buf.writeByte(LDC_INT)
constantPool.writeInt(constantBuf, value) constantPool.writeInt(constantBuf, value)
} }
is Long -> { is Long -> {
buf.writeByte(LDC_LONG) buf.writeByte(LDC_LONG)
constantPool.writeLong(wideConstantBuf, value) constantPool.writeLong(wideConstantBuf, value)
} }
is Float -> { is Float -> {
buf.writeByte(LDC_FLOAT) buf.writeByte(LDC_FLOAT)
constantPool.writeFloat(constantBuf, value) constantPool.writeFloat(constantBuf, value)
} }
is Double -> { is Double -> {
buf.writeByte(LDC_DOUBLE) buf.writeByte(LDC_DOUBLE)
constantPool.writeDouble(wideConstantBuf, value) constantPool.writeDouble(wideConstantBuf, value)
} }
is String -> { is String -> {
buf.writeByte(LDC_STRING) buf.writeByte(LDC_STRING)
constantPool.writeString(constantBuf, value) constantPool.writeString(constantBuf, value)
} }
is Type -> { is Type -> {
if (value.sort == Type.OBJECT) { if (value.sort == Type.OBJECT) {
buf.writeByte(LDC_CLASS) buf.writeByte(LDC_CLASS)
@ -1198,19 +1208,23 @@ public object PackClass {
) )
} }
} }
else -> throw IllegalArgumentException( else -> throw IllegalArgumentException(
"Unsupported constant type: ${value.javaClass.name}" "Unsupported constant type: ${value.javaClass.name}"
) )
} }
} }
is TypeInsnNode -> { is TypeInsnNode -> {
buf.writeByte(insn.opcode) buf.writeByte(insn.opcode)
constantPool.writeString(classBuf, insn.desc) constantPool.writeString(classBuf, insn.desc)
} }
is FieldInsnNode -> { is FieldInsnNode -> {
buf.writeByte(insn.opcode) buf.writeByte(insn.opcode)
constantPool.writeFieldRef(fieldRefBuf, MemberRef(insn.owner, insn.name, insn.desc)) constantPool.writeFieldRef(fieldRefBuf, MemberRef(insn.owner, insn.name, insn.desc))
} }
is MethodInsnNode -> { is MethodInsnNode -> {
buf.writeByte(insn.opcode) buf.writeByte(insn.opcode)
@ -1221,6 +1235,7 @@ public object PackClass {
constantPool.writeMethodRef(methodRefBuf, methodRef) constantPool.writeMethodRef(methodRefBuf, methodRef)
} }
} }
is JumpInsnNode -> { is JumpInsnNode -> {
val targetPc = insns[i].indexOf(insn.label.nextReal) val targetPc = insns[i].indexOf(insn.label.nextReal)
val delta = targetPc - pc val delta = targetPc - pc
@ -1239,6 +1254,7 @@ public object PackClass {
branchBuf.writeInt(delta) branchBuf.writeInt(delta)
} }
} }
is IntInsnNode -> { is IntInsnNode -> {
buf.writeByte(insn.opcode) buf.writeByte(insn.opcode)
@ -1249,6 +1265,7 @@ public object PackClass {
else -> throw IllegalArgumentException("Unsupported IntInsnNode opcode: ${insn.opcode}") else -> throw IllegalArgumentException("Unsupported IntInsnNode opcode: ${insn.opcode}")
} }
} }
is IincInsnNode -> { is IincInsnNode -> {
if (insn.`var` < 256 && (insn.incr >= -128 && insn.incr <= 127)) { if (insn.`var` < 256 && (insn.incr >= -128 && insn.incr <= 127)) {
buf.writeByte(insn.opcode) buf.writeByte(insn.opcode)
@ -1261,6 +1278,7 @@ public object PackClass {
wideIincBuf.writeShort(insn.incr) wideIincBuf.writeShort(insn.incr)
} }
} }
is TableSwitchInsnNode -> { is TableSwitchInsnNode -> {
buf.writeByte(insn.opcode) buf.writeByte(insn.opcode)
@ -1275,6 +1293,7 @@ public object PackClass {
branchBuf.writeInt(targetPc - pc) branchBuf.writeInt(targetPc - pc)
} }
} }
is LookupSwitchInsnNode -> { is LookupSwitchInsnNode -> {
buf.writeByte(insn.opcode) buf.writeByte(insn.opcode)
@ -1295,11 +1314,13 @@ public object PackClass {
branchBuf.writeInt(targetPc - pc) branchBuf.writeInt(targetPc - pc)
} }
} }
is MultiANewArrayInsnNode -> { is MultiANewArrayInsnNode -> {
buf.writeByte(insn.opcode) buf.writeByte(insn.opcode)
constantPool.writeString(classBuf, insn.desc) constantPool.writeString(classBuf, insn.desc)
multiNewArrayBuf.writeByte(insn.dims) multiNewArrayBuf.writeByte(insn.dims)
} }
is InsnNode -> buf.writeByte(insn.opcode) is InsnNode -> buf.writeByte(insn.opcode)
else -> throw IllegalArgumentException("Unsupported instruction type: ${insn.javaClass.name}") else -> throw IllegalArgumentException("Unsupported instruction type: ${insn.javaClass.name}")
} }
@ -1552,6 +1573,7 @@ public object PackClass {
throw IllegalArgumentException("Unsupported constant type: ${value.sort}") throw IllegalArgumentException("Unsupported constant type: ${value.sort}")
} }
} }
else -> throw IllegalArgumentException("Unsupported constant type: ${value.javaClass.name}") else -> throw IllegalArgumentException("Unsupported constant type: ${value.javaClass.name}")
} }
} }

@ -19,6 +19,7 @@ public enum class ByteOrder(public val suffix: String) {
else -> 8 else -> 8
} }
} }
ALT3_REVERSE -> { ALT3_REVERSE -> {
require(width == 4) require(width == 4)
when (i) { when (i) {

@ -37,6 +37,7 @@ public class EnumType(id: Int) : ConfigType(id) {
this.strings = strings this.strings = strings
} }
6 -> { 6 -> {
val size = buf.readUnsignedShort() val size = buf.readUnsignedShort()
val ints = Int2IntOpenHashMap() val ints = Int2IntOpenHashMap()
@ -48,6 +49,7 @@ public class EnumType(id: Int) : ConfigType(id) {
this.ints = ints this.ints = ints
} }
else -> throw IllegalArgumentException("Unsupported config code: $code") else -> throw IllegalArgumentException("Unsupported config code: $code")
} }
} }

@ -26,6 +26,7 @@ public class StructType(id: Int) : ConfigType(id) {
} }
} }
} }
else -> throw IllegalArgumentException("Unsupported config code: $code") else -> throw IllegalArgumentException("Unsupported config code: $code")
} }
} }
@ -42,11 +43,13 @@ public class StructType(id: Int) : ConfigType(id) {
buf.writeMedium(id) buf.writeMedium(id)
buf.writeString(value) buf.writeString(value)
} }
is Int -> { is Int -> {
buf.writeBoolean(false) buf.writeBoolean(false)
buf.writeMedium(id) buf.writeMedium(id)
buf.writeInt(value) buf.writeInt(value)
} }
else -> throw IllegalStateException() else -> throw IllegalStateException()
} }
} }

@ -15,6 +15,7 @@ public class VarbitType(id: Int) : ConfigType(id) {
startBit = buf.readUnsignedByte().toInt() startBit = buf.readUnsignedByte().toInt()
endBit = buf.readUnsignedByte().toInt() endBit = buf.readUnsignedByte().toInt()
} }
else -> throw IllegalArgumentException("Unsupported config code: $code") else -> throw IllegalArgumentException("Unsupported config code: $code")
} }
} }

@ -196,11 +196,13 @@ public object Song {
onVelocity = (onVelocity + onVelocityBuf.readUnsignedByte().toInt()) and 0x7F onVelocity = (onVelocity + onVelocityBuf.readUnsignedByte().toInt()) and 0x7F
ShortMessage(ShortMessage.NOTE_ON, channel, key, onVelocity) ShortMessage(ShortMessage.NOTE_ON, channel, key, onVelocity)
} }
NOTE_OFF -> { NOTE_OFF -> {
key = (key + keyBuf.readUnsignedByte().toInt()) and 0x7F key = (key + keyBuf.readUnsignedByte().toInt()) and 0x7F
offVelocity = (offVelocity + offVelocityBuf.readUnsignedByte().toInt()) and 0x7F offVelocity = (offVelocity + offVelocityBuf.readUnsignedByte().toInt()) and 0x7F
ShortMessage(ShortMessage.NOTE_OFF, channel, key, offVelocity) ShortMessage(ShortMessage.NOTE_OFF, channel, key, offVelocity)
} }
CONTROL_CHANGE -> { CONTROL_CHANGE -> {
controller = (controller + controllerBuf.readUnsignedByte()) and 0x7F controller = (controller + controllerBuf.readUnsignedByte()) and 0x7F
@ -218,6 +220,7 @@ public object Song {
REGISTERED_LSB -> registeredLsbBuf.readUnsignedByte().toInt() REGISTERED_LSB -> registeredLsbBuf.readUnsignedByte().toInt()
DAMPER, PORTAMENTO, ALL_SOUND_OFF, RESET_CONTROLLERS, ALL_NOTES_OFF -> DAMPER, PORTAMENTO, ALL_SOUND_OFF, RESET_CONTROLLERS, ALL_NOTES_OFF ->
otherKnownControllerBuf.readUnsignedByte().toInt() otherKnownControllerBuf.readUnsignedByte().toInt()
else -> unknownControllerBuf.readUnsignedByte().toInt() else -> unknownControllerBuf.readUnsignedByte().toInt()
} }
@ -225,25 +228,30 @@ public object Song {
values[controller] = value values[controller] = value
ShortMessage(ShortMessage.CONTROL_CHANGE, channel, controller, value and 0x7F) ShortMessage(ShortMessage.CONTROL_CHANGE, channel, controller, value and 0x7F)
} }
PITCH_WHEEL_CHANGE -> { PITCH_WHEEL_CHANGE -> {
pitchWheel += pitchWheelLsbBuf.readUnsignedByte().toInt() pitchWheel += pitchWheelLsbBuf.readUnsignedByte().toInt()
pitchWheel += (pitchWheelMsbBuf.readUnsignedByte().toInt() shl 7) pitchWheel += (pitchWheelMsbBuf.readUnsignedByte().toInt() shl 7)
pitchWheel = pitchWheel and 0x3FFF pitchWheel = pitchWheel and 0x3FFF
ShortMessage(ShortMessage.PITCH_BEND, channel, pitchWheel and 0x7F, pitchWheel shr 7) ShortMessage(ShortMessage.PITCH_BEND, channel, pitchWheel and 0x7F, pitchWheel shr 7)
} }
CHANNEL_PRESSURE_CHANGE -> { CHANNEL_PRESSURE_CHANGE -> {
channelPressure = (channelPressure + channelPressureBuf.readUnsignedByte().toInt()) and 0x7F channelPressure = (channelPressure + channelPressureBuf.readUnsignedByte().toInt()) and 0x7F
ShortMessage(ShortMessage.CHANNEL_PRESSURE, channel, channelPressure, 0) ShortMessage(ShortMessage.CHANNEL_PRESSURE, channel, channelPressure, 0)
} }
KEY_PRESSURE_CHANGE -> { KEY_PRESSURE_CHANGE -> {
key = (key + keyBuf.readUnsignedByte().toInt()) and 0x7F key = (key + keyBuf.readUnsignedByte().toInt()) and 0x7F
keyPressure = (keyPressure + keyPressureBuf.readUnsignedByte().toInt()) and 0x7F keyPressure = (keyPressure + keyPressureBuf.readUnsignedByte().toInt()) and 0x7F
ShortMessage(ShortMessage.POLY_PRESSURE, channel, key, keyPressure) ShortMessage(ShortMessage.POLY_PRESSURE, channel, key, keyPressure)
} }
PROGRAM_CHANGE -> { PROGRAM_CHANGE -> {
val bankSelect = bankSelectBuf.readUnsignedByte().toInt() val bankSelect = bankSelectBuf.readUnsignedByte().toInt()
ShortMessage(ShortMessage.PROGRAM_CHANGE, channel, bankSelect, 0) ShortMessage(ShortMessage.PROGRAM_CHANGE, channel, bankSelect, 0)
} }
else -> throw IllegalStateException() else -> throw IllegalStateException()
} }
@ -317,9 +325,11 @@ public object Song {
require(message.data.size == 3) require(message.data.size == 3)
tempoBuf.writeBytes(message.data) tempoBuf.writeBytes(message.data)
} }
else -> throw IllegalArgumentException("Unsupported meta type: $type") else -> throw IllegalArgumentException("Unsupported meta type: $type")
} }
} }
is ShortMessage -> { is ShortMessage -> {
val command = message.status and 0xF0 val command = message.status and 0xF0
val channel = message.status and 0xF val channel = message.status and 0xF
@ -354,11 +364,13 @@ public object Song {
onVelocityBuf.writeByte((onVelocity - prevOnVelocity) and 0x7F) onVelocityBuf.writeByte((onVelocity - prevOnVelocity) and 0x7F)
prevOnVelocity = onVelocity prevOnVelocity = onVelocity
} }
ShortMessage.NOTE_OFF -> { ShortMessage.NOTE_OFF -> {
val offVelocity = message.data2 val offVelocity = message.data2
offVelocityBuf.writeByte((offVelocity - prevOffVelocity) and 0x7F) offVelocityBuf.writeByte((offVelocity - prevOffVelocity) and 0x7F)
prevOffVelocity = offVelocity prevOffVelocity = offVelocity
} }
ShortMessage.CONTROL_CHANGE -> { ShortMessage.CONTROL_CHANGE -> {
val controller = message.data1 val controller = message.data1
controllerBuf.writeByte((controller - prevController) and 0x7F) controllerBuf.writeByte((controller - prevController) and 0x7F)
@ -381,11 +393,13 @@ public object Song {
REGISTERED_LSB -> registeredLsbBuf.writeByte(valueDelta) REGISTERED_LSB -> registeredLsbBuf.writeByte(valueDelta)
DAMPER, PORTAMENTO, ALL_SOUND_OFF, RESET_CONTROLLERS, ALL_NOTES_OFF -> DAMPER, PORTAMENTO, ALL_SOUND_OFF, RESET_CONTROLLERS, ALL_NOTES_OFF ->
otherKnownControllerBuf.writeByte(valueDelta) otherKnownControllerBuf.writeByte(valueDelta)
else -> unknownControllerBuf.writeByte(valueDelta) else -> unknownControllerBuf.writeByte(valueDelta)
} }
prevValues[controller] = value prevValues[controller] = value
} }
ShortMessage.PITCH_BEND -> { ShortMessage.PITCH_BEND -> {
val pitchWheel = message.data1 or (message.data2 shl 7) val pitchWheel = message.data1 or (message.data2 shl 7)
val pitchWheelDelta = (pitchWheel - prevPitchWheel) and 0x3FFF val pitchWheelDelta = (pitchWheel - prevPitchWheel) and 0x3FFF
@ -393,22 +407,27 @@ public object Song {
pitchWheelMsbBuf.writeByte(pitchWheelDelta shr 7) pitchWheelMsbBuf.writeByte(pitchWheelDelta shr 7)
prevPitchWheel = pitchWheel prevPitchWheel = pitchWheel
} }
ShortMessage.CHANNEL_PRESSURE -> { ShortMessage.CHANNEL_PRESSURE -> {
val channelPressure = message.data1 val channelPressure = message.data1
channelPressureBuf.writeByte((channelPressure - prevChannelPressure) and 0x7F) channelPressureBuf.writeByte((channelPressure - prevChannelPressure) and 0x7F)
prevChannelPressure = channelPressure prevChannelPressure = channelPressure
} }
ShortMessage.POLY_PRESSURE -> { ShortMessage.POLY_PRESSURE -> {
val keyPressure = message.data2 val keyPressure = message.data2
keyPressureBuf.writeByte((keyPressure - prevKeyPressure) and 0x7F) keyPressureBuf.writeByte((keyPressure - prevKeyPressure) and 0x7F)
prevKeyPressure = keyPressure prevKeyPressure = keyPressure
} }
ShortMessage.PROGRAM_CHANGE -> { ShortMessage.PROGRAM_CHANGE -> {
bankSelectBuf.writeByte(message.data1) bankSelectBuf.writeByte(message.data1)
} }
else -> throw IllegalStateException() else -> throw IllegalStateException()
} }
} }
else -> throw IllegalArgumentException("Unsupported message type: ${message.javaClass.name}") else -> throw IllegalArgumentException("Unsupported message type: ${message.javaClass.name}")
} }
} }

@ -255,6 +255,7 @@ public object Js5Compression {
return null return null
} }
} }
Js5CompressionType.GZIP -> { Js5CompressionType.GZIP -> {
val magic = plaintext.readUnsignedShort() val magic = plaintext.readUnsignedShort()
if (magic != GZIP_MAGIC) { if (magic != GZIP_MAGIC) {
@ -269,6 +270,7 @@ public object Js5Compression {
return null return null
} }
} }
Js5CompressionType.LZMA -> { Js5CompressionType.LZMA -> {
val properties = plaintext.readUnsignedByte() val properties = plaintext.readUnsignedByte()

@ -210,12 +210,14 @@ public data class Js5MasterIndex(
} }
len / 4 len / 4
} }
MasterIndexFormat.VERSIONED -> { MasterIndexFormat.VERSIONED -> {
require(len % 8 == 0) { require(len % 8 == 0) {
"Length is not a multiple of 8 bytes" "Length is not a multiple of 8 bytes"
} }
len / 8 len / 8
} }
else -> { else -> {
buf.readUnsignedByte().toInt() buf.readUnsignedByte().toInt()
} }

@ -251,6 +251,7 @@ public abstract class MutableNamedEntryCollection<T : MutableNamedEntry>(
newSet.add(id) newSet.add(id)
nameHashTable[newNameHash] = newSet nameHashTable[newNameHash] = newSet
} }
else -> set.add(id) else -> set.add(id)
} }

@ -65,6 +65,7 @@ public class GzipLaxInputStream(
checkTrailer() checkTrailer()
return -1 return -1
} }
inflater.needsInput() -> fill() inflater.needsInput() -> fill()
inflater.needsDictionary() -> throw IOException("Dictionaries not supported") inflater.needsDictionary() -> throw IOException("Dictionaries not supported")
} }

@ -80,18 +80,22 @@ public class AddSubTransformer : Transformer() {
negate -> terms += expr.negate() negate -> terms += expr.negate()
else -> terms += expr else -> terms += expr
} }
expr is BinaryExpr -> when { expr is BinaryExpr -> when {
expr.operator == BinaryExpr.Operator.PLUS -> { expr.operator == BinaryExpr.Operator.PLUS -> {
addTerms(terms, expr.left, negate) addTerms(terms, expr.left, negate)
addTerms(terms, expr.right, negate) addTerms(terms, expr.right, negate)
} }
expr.operator == BinaryExpr.Operator.MINUS -> { expr.operator == BinaryExpr.Operator.MINUS -> {
addTerms(terms, expr.left, negate) addTerms(terms, expr.left, negate)
addTerms(terms, expr.right, !negate) addTerms(terms, expr.right, !negate)
} }
negate -> terms += expr.negate() negate -> terms += expr.negate()
else -> terms += expr else -> terms += expr
} }
negate -> terms += expr.negate() negate -> terms += expr.negate()
else -> terms += expr else -> terms += expr
} }
@ -105,11 +109,13 @@ public class AddSubTransformer : Transformer() {
is Int -> n < 0 is Int -> n < 0
else -> error("Invalid IntegerLiteralExpr type") else -> error("Invalid IntegerLiteralExpr type")
} }
is LongLiteralExpr -> when (val n = asNumber()) { is LongLiteralExpr -> when (val n = asNumber()) {
LongLiteralExpr.MAX_63_BIT_UNSIGNED_VALUE_AS_BIG_INTEGER -> false LongLiteralExpr.MAX_63_BIT_UNSIGNED_VALUE_AS_BIG_INTEGER -> false
is Long -> n < 0 is Long -> n < 0
else -> error("Invalid LongLiteralExpr type") else -> error("Invalid LongLiteralExpr type")
} }
else -> false else -> false
} }
} }

@ -62,6 +62,7 @@ public class BitMaskTransformer : Transformer() {
maskExpr = IntegerLiteralExpr(mask.toString()) maskExpr = IntegerLiteralExpr(mask.toString())
} }
is LongLiteralExpr -> { is LongLiteralExpr -> {
var mask = maskExpr.checkedAsLong() var mask = maskExpr.checkedAsLong()
@ -73,6 +74,7 @@ public class BitMaskTransformer : Transformer() {
maskExpr = mask.toLongLiteralExpr() maskExpr = mask.toLongLiteralExpr()
} }
else -> return@walk else -> return@walk
} }
@ -124,6 +126,7 @@ public class BitMaskTransformer : Transformer() {
mask = mask ushr shamt mask = mask ushr shamt
IntegerLiteralExpr(mask.toString()) IntegerLiteralExpr(mask.toString())
} }
is LongLiteralExpr -> { is LongLiteralExpr -> {
var mask = maskExpr.checkedAsLong() var mask = maskExpr.checkedAsLong()
if (shamt > java.lang.Long.numberOfTrailingZeros(mask)) { if (shamt > java.lang.Long.numberOfTrailingZeros(mask)) {
@ -133,6 +136,7 @@ public class BitMaskTransformer : Transformer() {
mask = mask ushr shamt mask = mask ushr shamt
mask.toLongLiteralExpr() mask.toLongLiteralExpr()
} }
else -> return@walk else -> return@walk
} }

@ -76,6 +76,7 @@ public class EncloseTransformer : Transformer() {
BinaryExpr.Operator.OR -> LOGICAL_OR BinaryExpr.Operator.OR -> LOGICAL_OR
else -> null else -> null
} }
is InstanceOfExpr -> RELATIONAL is InstanceOfExpr -> RELATIONAL
is ConditionalExpr -> TERNARY is ConditionalExpr -> TERNARY
is AssignExpr -> ASSIGNMENT is AssignExpr -> ASSIGNMENT
@ -95,6 +96,7 @@ public class EncloseTransformer : Transformer() {
encloseLeft(expr, scope) encloseLeft(expr, scope)
} }
} }
is UnaryExpr -> encloseRight(expr, expr.expression) is UnaryExpr -> encloseRight(expr, expr.expression)
is CastExpr -> encloseRight(expr, expr.expression) is CastExpr -> encloseRight(expr, expr.expression)
is ObjectCreationExpr -> { is ObjectCreationExpr -> {
@ -102,16 +104,19 @@ public class EncloseTransformer : Transformer() {
encloseLeft(expr, scope) encloseLeft(expr, scope)
} }
} }
is BinaryExpr -> { is BinaryExpr -> {
encloseLeft(expr, expr.left) encloseLeft(expr, expr.left)
encloseRight(expr, expr.right) encloseRight(expr, expr.right)
} }
is InstanceOfExpr -> encloseLeft(expr, expr.expression) is InstanceOfExpr -> encloseLeft(expr, expr.expression)
is ConditionalExpr -> { is ConditionalExpr -> {
encloseLeft(expr, expr.condition) encloseLeft(expr, expr.condition)
encloseLeft(expr, expr.thenExpr) encloseLeft(expr, expr.thenExpr)
encloseRight(expr, expr.elseExpr) encloseRight(expr, expr.elseExpr)
} }
is AssignExpr -> { is AssignExpr -> {
encloseLeft(expr, expr.target) encloseLeft(expr, expr.target)
encloseRight(expr, expr.value) encloseRight(expr, expr.value)
@ -131,6 +136,7 @@ public class EncloseTransformer : Transformer() {
parent.replace(child, EnclosedExpr(child.clone())) parent.replace(child, EnclosedExpr(child.clone()))
} }
} }
Associativity.NONE, Associativity.RIGHT -> { Associativity.NONE, Associativity.RIGHT -> {
if (childOp.isPrecedenceLessEqual(parentOp)) { if (childOp.isPrecedenceLessEqual(parentOp)) {
parent.replace(child, EnclosedExpr(child.clone())) parent.replace(child, EnclosedExpr(child.clone()))
@ -149,6 +155,7 @@ public class EncloseTransformer : Transformer() {
parent.replace(child, EnclosedExpr(child.clone())) parent.replace(child, EnclosedExpr(child.clone()))
} }
} }
Associativity.RIGHT -> { Associativity.RIGHT -> {
if (childOp.isPrecedenceLess(parentOp)) { if (childOp.isPrecedenceLess(parentOp)) {
parent.replace(child, EnclosedExpr(child.clone())) parent.replace(child, EnclosedExpr(child.clone()))

@ -45,6 +45,7 @@ public class ForLoopConditionTransformer : Transformer() {
PREFIX_INCREMENT, PREFIX_DECREMENT, POSTFIX_INCREMENT, POSTFIX_DECREMENT -> expression PREFIX_INCREMENT, PREFIX_DECREMENT, POSTFIX_INCREMENT, POSTFIX_DECREMENT -> expression
else -> null else -> null
} }
is AssignExpr -> target is AssignExpr -> target
else -> null else -> null
} }

@ -244,10 +244,12 @@ public class GlTransformer @Inject constructor(private val registry: GlRegistry)
transformExpr(unit, command, parameter, expr.left) transformExpr(unit, command, parameter, expr.left)
transformExpr(unit, command, parameter, expr.right) transformExpr(unit, command, parameter, expr.right)
} }
is ConditionalExpr -> { is ConditionalExpr -> {
transformExpr(unit, command, parameter, expr.thenExpr) transformExpr(unit, command, parameter, expr.thenExpr)
transformExpr(unit, command, parameter, expr.elseExpr) transformExpr(unit, command, parameter, expr.elseExpr)
} }
is IntegerLiteralExpr -> { is IntegerLiteralExpr -> {
transformIntegerLiteralExpr(unit, command, parameter, expr) transformIntegerLiteralExpr(unit, command, parameter, expr)
} }

@ -27,6 +27,7 @@ public class IdentityTransformer : Transformer() {
expr.replace(expr.left) expr.replace(expr.left)
} }
} }
BinaryExpr.Operator.MINUS -> { BinaryExpr.Operator.MINUS -> {
if (expr.left.isZero()) { if (expr.left.isZero()) {
// 0 - x => -x // 0 - x => -x
@ -36,6 +37,7 @@ public class IdentityTransformer : Transformer() {
expr.replace(expr.left) expr.replace(expr.left)
} }
} }
BinaryExpr.Operator.MULTIPLY -> { BinaryExpr.Operator.MULTIPLY -> {
if (expr.left.isOne()) { if (expr.left.isOne()) {
// 1 * x => x // 1 * x => x
@ -45,12 +47,14 @@ public class IdentityTransformer : Transformer() {
expr.replace(expr.left) expr.replace(expr.left)
} }
} }
BinaryExpr.Operator.DIVIDE -> { BinaryExpr.Operator.DIVIDE -> {
if (expr.right.isOne()) { if (expr.right.isOne()) {
// x / 1 => x // x / 1 => x
expr.replace(expr.left) expr.replace(expr.left)
} }
} }
else -> Unit else -> Unit
} }
} }

@ -458,6 +458,7 @@ public class IfElseTransformer : Transformer() {
null null
} }
} }
else -> null else -> null
} }
} }
@ -477,6 +478,7 @@ public class IfElseTransformer : Transformer() {
val tail = statements.lastOrNull() val tail = statements.lastOrNull()
tail is ThrowStmt || tail is ReturnStmt tail is ThrowStmt || tail is ReturnStmt
} }
else -> false else -> false
} }
} }

@ -51,16 +51,19 @@ public fun Expression.negate(): Expression {
UnaryExpr.Operator.MINUS -> expression.clone() UnaryExpr.Operator.MINUS -> expression.clone()
else -> UnaryExpr(clone(), UnaryExpr.Operator.MINUS) else -> UnaryExpr(clone(), UnaryExpr.Operator.MINUS)
} }
is IntegerLiteralExpr -> when (val n = asNumber()) { is IntegerLiteralExpr -> when (val n = asNumber()) {
IntegerLiteralExpr.MAX_31_BIT_UNSIGNED_VALUE_AS_LONG -> IntegerLiteralExpr(Integer.MIN_VALUE.toString()) IntegerLiteralExpr.MAX_31_BIT_UNSIGNED_VALUE_AS_LONG -> IntegerLiteralExpr(Integer.MIN_VALUE.toString())
is Int -> IntegerLiteralExpr((-n.toInt()).toString()) is Int -> IntegerLiteralExpr((-n.toInt()).toString())
else -> error("Invalid IntegerLiteralExpr type") else -> error("Invalid IntegerLiteralExpr type")
} }
is LongLiteralExpr -> when (val n = asNumber()) { is LongLiteralExpr -> when (val n = asNumber()) {
LongLiteralExpr.MAX_63_BIT_UNSIGNED_VALUE_AS_BIG_INTEGER -> Long.MIN_VALUE.toLongLiteralExpr() LongLiteralExpr.MAX_63_BIT_UNSIGNED_VALUE_AS_BIG_INTEGER -> Long.MIN_VALUE.toLongLiteralExpr()
is Long -> (-n).toLongLiteralExpr() is Long -> (-n).toLongLiteralExpr()
else -> error("Invalid LongLiteralExpr type") else -> error("Invalid LongLiteralExpr type")
} }
else -> UnaryExpr(clone(), UnaryExpr.Operator.MINUS) else -> UnaryExpr(clone(), UnaryExpr.Operator.MINUS)
} }
} }
@ -72,27 +75,37 @@ public fun Expression.not(): Expression {
return expression.clone() return expression.clone()
} }
} }
is BinaryExpr -> { is BinaryExpr -> {
when (operator) { when (operator) {
BinaryExpr.Operator.EQUALS -> BinaryExpr.Operator.EQUALS ->
return BinaryExpr(left.clone(), right.clone(), BinaryExpr.Operator.NOT_EQUALS) return BinaryExpr(left.clone(), right.clone(), BinaryExpr.Operator.NOT_EQUALS)
BinaryExpr.Operator.NOT_EQUALS -> BinaryExpr.Operator.NOT_EQUALS ->
return BinaryExpr(left.clone(), right.clone(), BinaryExpr.Operator.EQUALS) return BinaryExpr(left.clone(), right.clone(), BinaryExpr.Operator.EQUALS)
BinaryExpr.Operator.GREATER -> BinaryExpr.Operator.GREATER ->
return BinaryExpr(left.clone(), right.clone(), BinaryExpr.Operator.LESS_EQUALS) return BinaryExpr(left.clone(), right.clone(), BinaryExpr.Operator.LESS_EQUALS)
BinaryExpr.Operator.GREATER_EQUALS -> BinaryExpr.Operator.GREATER_EQUALS ->
return BinaryExpr(left.clone(), right.clone(), BinaryExpr.Operator.LESS) return BinaryExpr(left.clone(), right.clone(), BinaryExpr.Operator.LESS)
BinaryExpr.Operator.LESS -> BinaryExpr.Operator.LESS ->
return BinaryExpr(left.clone(), right.clone(), BinaryExpr.Operator.GREATER_EQUALS) return BinaryExpr(left.clone(), right.clone(), BinaryExpr.Operator.GREATER_EQUALS)
BinaryExpr.Operator.LESS_EQUALS -> BinaryExpr.Operator.LESS_EQUALS ->
return BinaryExpr(left.clone(), right.clone(), BinaryExpr.Operator.GREATER) return BinaryExpr(left.clone(), right.clone(), BinaryExpr.Operator.GREATER)
BinaryExpr.Operator.AND -> BinaryExpr.Operator.AND ->
return BinaryExpr(left.not(), right.not(), BinaryExpr.Operator.OR) return BinaryExpr(left.not(), right.not(), BinaryExpr.Operator.OR)
BinaryExpr.Operator.OR -> BinaryExpr.Operator.OR ->
return BinaryExpr(left.not(), right.not(), BinaryExpr.Operator.AND) return BinaryExpr(left.not(), right.not(), BinaryExpr.Operator.AND)
else -> Unit else -> Unit
} }
} }
is BooleanLiteralExpr -> return BooleanLiteralExpr(!value) is BooleanLiteralExpr -> return BooleanLiteralExpr(!value)
} }

@ -51,6 +51,7 @@ public class CopyPropagationAnalyzer(owner: String, method: MethodNode) :
newSet newSet
} }
} }
insn is IincInsnNode -> set.minusKilledByAssignmentTo(insn.`var`) insn is IincInsnNode -> set.minusKilledByAssignmentTo(insn.`var`)
else -> set else -> set
} }

@ -84,12 +84,14 @@ public class IntInterpreter(private val args: Array<IntValueSet>) : Interpreter<
} }
v1 / v2 v1 / v2
} }
Opcodes.IREM -> { Opcodes.IREM -> {
if (v2 == 0) { if (v2 == 0) {
return IntValue(basicValue) return IntValue(basicValue)
} }
v1 % v2 v1 % v2
} }
Opcodes.ISHL -> v1 shl v2 Opcodes.ISHL -> v1 shl v2
Opcodes.ISHR -> v1 shr v2 Opcodes.ISHR -> v1 shr v2
Opcodes.IUSHR -> v1 ushr v2 Opcodes.IUSHR -> v1 ushr v2

@ -27,6 +27,7 @@ public class LiveVariableAnalyzer(owner: String, method: MethodNode) :
Opcodes.ISTORE, Opcodes.LSTORE, Opcodes.FSTORE, Opcodes.DSTORE, Opcodes.ASTORE -> set.minus(insn.`var`) Opcodes.ISTORE, Opcodes.LSTORE, Opcodes.FSTORE, Opcodes.DSTORE, Opcodes.ASTORE -> set.minus(insn.`var`)
else -> set else -> set
} }
is IincInsnNode -> set.plus(insn.`var`) is IincInsnNode -> set.plus(insn.`var`)
else -> set else -> set
} }

@ -60,10 +60,12 @@ public class FieldMappingGenerator(
Type.BOOLEAN, Type.BYTE, Type.CHAR, Type.SHORT, Type.INT, Type.LONG, Type.FLOAT, Type.DOUBLE -> { Type.BOOLEAN, Type.BYTE, Type.CHAR, Type.SHORT, Type.INT, Type.LONG, Type.FLOAT, Type.DOUBLE -> {
elementType.className + dimensions elementType.className + dimensions
} }
Type.OBJECT -> { Type.OBJECT -> {
val className = classMapping.getOrDefault(elementType.internalName, elementType.internalName) val className = classMapping.getOrDefault(elementType.internalName, elementType.internalName)
className.getClassName() + dimensions className.getClassName() + dimensions
} }
else -> throw IllegalArgumentException("Unknown field type $elementType") else -> throw IllegalArgumentException("Unknown field type $elementType")
} }

@ -212,6 +212,7 @@ public class ConstantArgTransformer @Inject constructor(private val profile: Pro
else -> Unit else -> Unit
} }
} }
IF_ICMPEQ, IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE -> { IF_ICMPEQ, IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE -> {
val value1 = frame.getStack(frame.stackSize - 2) val value1 = frame.getStack(frame.stackSize - 2)
val value2 = frame.getStack(frame.stackSize - 1) val value2 = frame.getStack(frame.stackSize - 1)

@ -79,6 +79,7 @@ public class EmptyClassTransformer : Transformer() {
addTypeReference(cst) addTypeReference(cst)
} }
} }
is TypeInsnNode -> referencedClasses.add(insn.desc) is TypeInsnNode -> referencedClasses.add(insn.desc)
} }
} }

@ -111,10 +111,12 @@ public class OpaquePredicateTransformer : Transformer() {
method.instructions.remove(match[0]) method.instructions.remove(match[0])
branch.opcode = Opcodes.GOTO branch.opcode = Opcodes.GOTO
} }
Opcodes.IFNE -> { Opcodes.IFNE -> {
// branch is never taken // branch is never taken
match.forEach(method.instructions::remove) match.forEach(method.instructions::remove)
} }
else -> error("Invalid opcode") else -> error("Invalid opcode")
} }

@ -85,6 +85,7 @@ public class UnusedArgTransformer @Inject constructor(private val profile: Profi
retainArg(partition, localToArgMap, frame, insn.`var`) retainArg(partition, localToArgMap, frame, insn.`var`)
} }
} }
is IincInsnNode -> retainArg(partition, localToArgMap, frame, insn.`var`) is IincInsnNode -> retainArg(partition, localToArgMap, frame, insn.`var`)
is MethodInsnNode -> { is MethodInsnNode -> {
val invokePartition = inheritedMethodSets[MemberRef(insn)] val invokePartition = inheritedMethodSets[MemberRef(insn)]

@ -101,6 +101,7 @@ public class NameMapProcessor : AbstractProcessor() {
map.methods[ref] = Method(owner, name, arguments, locals) map.methods[ref] = Method(owner, name, arguments, locals)
} }
else -> error("Unexpected element type") else -> error("Unexpected element type")
} }
} }

@ -49,10 +49,12 @@ public class NetrcReader(private val scanner: Scanner) {
state = State.READ_MACHINE state = State.READ_MACHINE
host = scanner.next() host = scanner.next()
} }
"default" -> { "default" -> {
state = State.READ_MACHINE state = State.READ_MACHINE
host = null host = null
} }
"login", "password", "account" -> { "login", "password", "account" -> {
if (state != State.READ_MACHINE) { if (state != State.READ_MACHINE) {
throw IOException("Unexpected token '$token'") throw IOException("Unexpected token '$token'")
@ -66,6 +68,7 @@ public class NetrcReader(private val scanner: Scanner) {
password = scanner.next() password = scanner.next()
} }
} }
"macdef" -> skipMacro() "macdef" -> skipMacro()
} }
} }

@ -32,10 +32,12 @@ public class CachePathTransformer @Inject constructor(
insn.cst = ".${config.internalOperator}_cache_" insn.cst = ".${config.internalOperator}_cache_"
paths++ paths++
} }
"jagex_" -> { "jagex_" -> {
insn.cst = ".${config.internalOperator}_" insn.cst = ".${config.internalOperator}_"
paths++ paths++
} }
"runescape" -> { "runescape" -> {
insn.cst = config.internalGame insn.cst = config.internalGame
paths++ paths++

@ -63,10 +63,12 @@ public class HighDpiTransformer : Transformer() {
addCanvasScaleField(clazz) addCanvasScaleField(clazz)
newMembers++ newMembers++
} }
in GL_INTERFACES -> { in GL_INTERFACES -> {
addPixelZoomMethod(clazz, Opcodes.ACC_ABSTRACT) addPixelZoomMethod(clazz, Opcodes.ACC_ABSTRACT)
newMembers++ newMembers++
} }
in GL_IMPLS -> { in GL_IMPLS -> {
addPixelZoomMethod(clazz, Opcodes.ACC_FINAL or Opcodes.ACC_NATIVE) addPixelZoomMethod(clazz, Opcodes.ACC_FINAL or Opcodes.ACC_NATIVE)
newMembers++ newMembers++

@ -32,6 +32,7 @@ public class PublicKeyTransformer @Inject constructor(private val key: RSAPrivat
insn.cst = key.publicExponent.toString() insn.cst = key.publicExponent.toString()
exponents++ exponents++
} }
JAGEX_MODULUS -> { JAGEX_MODULUS -> {
insn.cst = key.modulus.toString() insn.cst = key.modulus.toString()
moduli++ moduli++

@ -14,17 +14,20 @@ public object Js5RequestEncoder : MessageToByteEncoder<Js5Request>(Js5Request::c
out.writeByte(msg.archive) out.writeByte(msg.archive)
out.writeShort(msg.group) out.writeShort(msg.group)
} }
is Js5Request.Rekey -> { is Js5Request.Rekey -> {
out.writeByte(4) out.writeByte(4)
out.writeByte(msg.key) out.writeByte(msg.key)
out.writeZero(2) out.writeZero(2)
} }
is Js5Request.LoggedIn -> encodeSimple(out, 2) is Js5Request.LoggedIn -> encodeSimple(out, 2)
is Js5Request.LoggedOut -> encodeSimple(out, 3) is Js5Request.LoggedOut -> encodeSimple(out, 3)
is Js5Request.Connected -> { is Js5Request.Connected -> {
out.writeByte(6) out.writeByte(6)
out.writeMedium(3) out.writeMedium(3)
} }
is Js5Request.Disconnect -> encodeSimple(out, 7) is Js5Request.Disconnect -> encodeSimple(out, 7)
} }
} }

@ -12,6 +12,7 @@ public sealed class LoginRequest : Packet {
public val day: Int, public val day: Int,
public val country: Int public val country: Int
) : LoginRequest() ) : LoginRequest()
public data class CreateCheckName(public val username: String) : LoginRequest() public data class CreateCheckName(public val username: String) : LoginRequest()
public data class CreateAccount( public data class CreateAccount(
public val build: Int, public val build: Int,
@ -27,11 +28,13 @@ public sealed class LoginRequest : Packet {
public val country: Int, public val country: Int,
public val email: String public val email: String
) : LoginRequest() ) : LoginRequest()
public data class RequestWorldList(public val checksum: Int) : LoginRequest() public data class RequestWorldList(public val checksum: Int) : LoginRequest()
public data class CheckWorldSuitability( public data class CheckWorldSuitability(
public val build: Int, public val build: Int,
public val username: String, public val username: String,
public val password: String public val password: String
) : LoginRequest() ) : LoginRequest()
public object InitCrossDomainConnection : LoginRequest() public object InitCrossDomainConnection : LoginRequest()
} }

@ -37,6 +37,7 @@ public object ModifiedUtf8Charset : Charset("ModifiedUtf8", null) {
output.put((0xC0 or ((char.code shr 6) and 0x1F)).toByte()) output.put((0xC0 or ((char.code shr 6) and 0x1F)).toByte())
output.put((0x80 or (char.code and 0x3F)).toByte()) output.put((0x80 or (char.code and 0x3F)).toByte())
} }
else -> { else -> {
output.put((0xE0 or ((char.code shr 12) and 0x1F)).toByte()) output.put((0xE0 or ((char.code shr 12) and 0x1F)).toByte())
output.put((0x80 or ((char.code shr 6) and 0x1F)).toByte()) output.put((0x80 or ((char.code shr 6) and 0x1F)).toByte())

@ -105,9 +105,11 @@ public class ForestDisjointSet<T> : DisjointSet<T> {
xRoot.rank < yRoot.rank -> { xRoot.rank < yRoot.rank -> {
xRoot.parent = yRoot xRoot.parent = yRoot
} }
xRoot.rank > yRoot.rank -> { xRoot.rank > yRoot.rank -> {
yRoot.parent = xRoot yRoot.parent = xRoot
} }
else -> { else -> {
yRoot.parent = xRoot yRoot.parent = xRoot
xRoot.rank++ xRoot.rank++

Loading…
Cancel
Save