build(Needs bump): Bump dependencies (#2946)
Co-authored-by: Ushie <ushiekane@gmail.com> Co-authored-by: aAbed <aabedhkhan@gmail.com> Co-authored-by: CnC-Robert <CnC.Rob3rt@gmail.com>
This commit is contained in:
@ -2,12 +2,11 @@ package app.revanced.extensions
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.Method
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.WideLiteralInstruction
|
||||
@ -20,7 +19,7 @@ import org.w3c.dom.Node
|
||||
* @return The [PatchException].
|
||||
*/
|
||||
val MethodFingerprint.exception
|
||||
get() = PatchException("Failed to resolve $name")
|
||||
get() = PatchException("Failed to resolve ${this.javaClass.simpleName}")
|
||||
|
||||
/**
|
||||
* Find the [MutableMethod] from a given [Method] in a [MutableClass].
|
||||
@ -77,22 +76,21 @@ fun Method.findIndexForIdResource(resourceName: String): Int {
|
||||
*
|
||||
* @return the first constant instruction with the value, or -1 if not found.
|
||||
*/
|
||||
fun Method.indexOfFirstConstantInstructionValue(constantValue: Long): Int {
|
||||
return implementation?.let {
|
||||
it.instructions.indexOfFirst { instruction ->
|
||||
instruction.opcode == Opcode.CONST && (instruction as WideLiteralInstruction).wideLiteral == constantValue
|
||||
}
|
||||
} ?: -1
|
||||
}
|
||||
fun Method.indexOfFirstConstantInstructionValue(constantValue: Long) = implementation?.let {
|
||||
it.instructions.indexOfFirst { instruction ->
|
||||
instruction.opcode == Opcode.CONST && (instruction as WideLiteralInstruction).wideLiteral == constantValue
|
||||
}
|
||||
} ?: -1
|
||||
|
||||
|
||||
/**
|
||||
* Check if the method contains a constant with the given value.
|
||||
*
|
||||
* @return if the method contains a constant with the given value.
|
||||
*/
|
||||
fun Method.containsConstantInstructionValue(constantValue: Long): Boolean {
|
||||
return indexOfFirstConstantInstructionValue(constantValue) >= 0
|
||||
}
|
||||
fun Method.containsConstantInstructionValue(constantValue: Long) =
|
||||
indexOfFirstConstantInstructionValue(constantValue) >= 0
|
||||
|
||||
|
||||
/**
|
||||
* Traverse the class hierarchy starting from the given root class.
|
||||
|
Reference in New Issue
Block a user