refactor: simplify casting instructions
This commit is contained in:
@ -30,7 +30,8 @@ class ClientSpoofPatch : BytecodePatch(
|
||||
UserAgentHeaderBuilderFingerprint.result?.let { result ->
|
||||
val insertIndex = result.scanResult.patternScanResult!!.endIndex
|
||||
result.mutableMethod.apply {
|
||||
val packageNameRegister = (instruction(insertIndex) as FiveRegisterInstruction).registerD
|
||||
val packageNameRegister = instruction<FiveRegisterInstruction>(insertIndex).registerD
|
||||
|
||||
addInstruction(insertIndex, "const-string v$packageNameRegister, \"$ORIGINAL_PACKAGE_NAME\"")
|
||||
}
|
||||
|
||||
|
@ -20,19 +20,17 @@ class VerticalScrollPatch : BytecodePatch(
|
||||
listOf(CanScrollVerticallyFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
val result = CanScrollVerticallyFingerprint.result ?: return CanScrollVerticallyFingerprint.toErrorResult()
|
||||
CanScrollVerticallyFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val moveResultRegister = instruction<OneRegisterInstruction>(insertIndex - 1).registerA
|
||||
|
||||
with(result) {
|
||||
val method = mutableMethod
|
||||
|
||||
val moveResultIndex = scanResult.patternScanResult!!.endIndex
|
||||
val moveResultRegister = (method.instruction(moveResultIndex) as OneRegisterInstruction).registerA
|
||||
|
||||
method.addInstruction(
|
||||
moveResultIndex + 1,
|
||||
"const/4 v$moveResultRegister, 0x0"
|
||||
)
|
||||
}
|
||||
addInstruction(
|
||||
insertIndex,
|
||||
"const/4 v$moveResultRegister, 0x0"
|
||||
)
|
||||
}
|
||||
} ?: return CanScrollVerticallyFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
Reference in New Issue
Block a user