Fix abstractfont drawalpha

This commit is contained in:
Lucwousin
2020-01-03 04:33:46 +01:00
parent eee8c73a5b
commit d49f9c080d
2 changed files with 8 additions and 8 deletions

View File

@@ -16,7 +16,7 @@ plugins {
val oprsver = "1.5.44-SNAPSHOT" val oprsver = "1.5.44-SNAPSHOT"
group = "com.openosrs" group = "com.openosrs"
version = "1.0.2.3" version = "1.0.3.0"
repositories { repositories {
mavenCentral() mavenCentral()

View File

@@ -19,7 +19,6 @@ import net.runelite.asm.attributes.Code;
import net.runelite.asm.attributes.code.Instruction; import net.runelite.asm.attributes.code.Instruction;
import net.runelite.asm.attributes.code.InstructionType; import net.runelite.asm.attributes.code.InstructionType;
import net.runelite.asm.attributes.code.Instructions; import net.runelite.asm.attributes.code.Instructions;
import net.runelite.asm.attributes.code.instruction.types.FieldInstruction;
import net.runelite.asm.attributes.code.instruction.types.GetFieldInstruction; import net.runelite.asm.attributes.code.instruction.types.GetFieldInstruction;
import net.runelite.asm.attributes.code.instruction.types.LVTInstruction; import net.runelite.asm.attributes.code.instruction.types.LVTInstruction;
import net.runelite.asm.attributes.code.instruction.types.PushConstantInstruction; import net.runelite.asm.attributes.code.instruction.types.PushConstantInstruction;
@@ -124,10 +123,10 @@ public class RasterizerAlpha extends AbstractInjector
continue; continue;
StackContext alphaPop = isub.getPops().get(0); StackContext alphaPop = isub.getPops().get(0);
InstructionContext alphaPusher = alphaPop.getPushed().resolve(alphaPop); InstructionContext alphaPusher = alphaPop.getPushed();
InstructionContext isubResult = isub.getPushes().get(0).getPopped().get(0); InstructionContext isubResult = isub.getPushes().get(0).getPopped().get(0);
if (pushesToSameField(isubResult, alphaPusher)) if (pushesToSameVar(isubResult, alphaPusher))
{ {
alphaPusher = resolveFieldThroughInvokes(alphaPop); alphaPusher = resolveFieldThroughInvokes(alphaPop);
@@ -189,12 +188,13 @@ public class RasterizerAlpha extends AbstractInjector
log.info("Injected {} DrawAlpha invokes and {} ors", counts[1], counts[0]); log.info("Injected {} DrawAlpha invokes and {} ors", counts[1], counts[0]);
} }
private static boolean pushesToSameField(InstructionContext cA, InstructionContext cB) private static boolean pushesToSameVar(InstructionContext cA, InstructionContext cB)
{ {
if (cA.getInstruction() instanceof FieldInstruction && cB instanceof FieldInstruction) Instruction iA = cA.getInstruction(), iB = cB.getInstruction();
if (iA instanceof LVTInstruction && iB instanceof LVTInstruction)
{ {
Field a = ((FieldInstruction) cA.getInstruction()).getMyField(); int a = ((LVTInstruction) iA).getVariableIndex();
Field b = ((FieldInstruction) cB.getInstruction()).getMyField(); int b = ((LVTInstruction) iB).getVariableIndex();
return a == b; return a == b;
} }