fix(Duolingo - Unlock Super): Get correct instruction offset (#3023)

This commit is contained in:
Oyssale 2023-09-24 17:07:10 +02:00 committed by GitHub
parent 0e0b73521c
commit 5146de872a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,8 +54,8 @@ object UnlockDuolingoSuperPatch : BytecodePatch(
} }
private fun MutableMethod.indexOfReference(reference: Reference) = getInstructions() private fun MutableMethod.indexOfReference(reference: Reference) = getInstructions()
.filterIsInstance<BuilderInstruction22c>() .indexOfFirst { it is BuilderInstruction22c && it.opcode == Opcode.IPUT_BOOLEAN && it.reference == reference }
.filter { it.opcode == Opcode.IPUT_BOOLEAN }.indexOfFirst { it.reference == reference }.let { .let {
if (it == -1) throw PatchException("Could not find index of instruction with supplied reference.") if (it == -1) throw PatchException("Could not find index of instruction with supplied reference.")
else it else it
} }