fix(Mi Fitness - Fix login): Patch correct register (#2942)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
16ce28027c
commit
dc969422b5
|
@ -2,13 +2,11 @@ package app.revanced.patches.mifitness.misc.login
|
||||||
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patches.mifitness.misc.login.fingerprints.XiaomiAccountManagerConstructorFingerprint
|
import app.revanced.patches.mifitness.misc.login.fingerprints.XiaomiAccountManagerConstructorFingerprint
|
||||||
import app.revanced.util.exception
|
import app.revanced.util.exception
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Fix login",
|
name = "Fix login",
|
||||||
|
@ -20,16 +18,9 @@ object FixLoginPatch : BytecodePatch(
|
||||||
setOf(XiaomiAccountManagerConstructorFingerprint),
|
setOf(XiaomiAccountManagerConstructorFingerprint),
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
XiaomiAccountManagerConstructorFingerprint.result?.let {
|
XiaomiAccountManagerConstructorFingerprint.result?.mutableMethod?.addInstruction(
|
||||||
it.mutableMethod.apply {
|
0,
|
||||||
val isCertifiedIndex = it.scanResult.patternScanResult!!.startIndex
|
"const/16 p2, 0x0",
|
||||||
val isCertifiedRegister = getInstruction<OneRegisterInstruction>(isCertifiedIndex).registerA
|
) ?: throw XiaomiAccountManagerConstructorFingerprint.exception
|
||||||
|
|
||||||
addInstruction(
|
|
||||||
isCertifiedIndex,
|
|
||||||
"const/4 p$isCertifiedRegister, 0x0",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} ?: throw XiaomiAccountManagerConstructorFingerprint.exception
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,14 @@ package app.revanced.patches.mifitness.misc.login.fingerprints
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
|
||||||
|
|
||||||
internal object XiaomiAccountManagerConstructorFingerprint : MethodFingerprint(
|
internal object XiaomiAccountManagerConstructorFingerprint : MethodFingerprint(
|
||||||
accessFlags = AccessFlags.PRIVATE or AccessFlags.CONSTRUCTOR,
|
accessFlags = AccessFlags.PRIVATE or AccessFlags.CONSTRUCTOR,
|
||||||
customFingerprint = { methodDef, _ ->
|
customFingerprint = { methodDef, _ ->
|
||||||
methodDef.definingClass == "Lcom/xiaomi/passport/accountmanager/XiaomiAccountManager;"
|
methodDef.definingClass == "Lcom/xiaomi/passport/accountmanager/XiaomiAccountManager;"
|
||||||
},
|
},
|
||||||
opcodes = listOf(Opcode.IF_NEZ),
|
parameters = listOf(
|
||||||
|
"Landroid/content/Context;",
|
||||||
|
"Z",
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue