Use getArgumentExpressions in HighDpiTransformer

Signed-off-by: Graham <gpe@openrs2.org>
Graham 1 year ago
parent b0f37cd959
commit bd36b77e44
  1. 17
      patcher/src/main/kotlin/org/openrs2/patcher/transform/HighDpiTransformer.kt

@ -3,7 +3,6 @@ package org.openrs2.patcher.transform
import com.github.michaelbull.logging.InlineLogger
import jakarta.inject.Singleton
import org.objectweb.asm.Opcodes
import org.objectweb.asm.tree.AbstractInsnNode
import org.objectweb.asm.tree.ClassNode
import org.objectweb.asm.tree.FieldInsnNode
import org.objectweb.asm.tree.FieldNode
@ -20,7 +19,7 @@ import org.objectweb.asm.tree.VarInsnNode
import org.openrs2.asm.InsnMatcher
import org.openrs2.asm.classpath.ClassPath
import org.openrs2.asm.classpath.Library
import org.openrs2.asm.getExpression
import org.openrs2.asm.getArgumentExpressions
import org.openrs2.asm.previousReal
import org.openrs2.asm.transform.Transformer
import kotlin.math.max
@ -267,13 +266,9 @@ public class HighDpiTransformer : Transformer() {
}
private fun transformBounds(method: MethodNode, invoke: MethodInsnNode): Boolean {
val exprs = mutableListOf<List<AbstractInsnNode>>()
var head = invoke.previousReal ?: return false
val exprs = getArgumentExpressions(invoke) ?: return false
while (exprs.size < 4) {
val expr = getExpression(head) ?: return false
if (invoke.name == "glViewport" && expr.any { it.opcode == Opcodes.IALOAD }) {
if (invoke.name == "glViewport" && exprs.flatten().any { it.opcode == Opcodes.IALOAD }) {
/*
* The glViewport() call that uses IALOAD restores viewport
* bounds previously saved with glGetIntegerv(), so there's no
@ -282,12 +277,6 @@ public class HighDpiTransformer : Transformer() {
return false
}
exprs += expr
head = expr.first().previousReal ?: return false
}
exprs.reverse()
for (expr in exprs) {
val single = expr.singleOrNull()
if (single != null && single.opcode == Opcodes.ICONST_0) {

Loading…
Cancel
Save