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