mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-05 09:04:34 +02:00
fix(YouTube/Hide account menu): improve patch method
This commit is contained in:
parent
a28c05ab6a
commit
82b0ada662
@ -13,7 +13,7 @@ import app.revanced.patches.youtube.general.accountmenu.fingerprints.AccountMenu
|
|||||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
||||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||||
import app.revanced.util.integrations.Constants.GENERAL
|
import app.revanced.util.integrations.Constants.GENERAL
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Hide account menu",
|
name = "Hide account menu",
|
||||||
@ -49,27 +49,23 @@ object AccountMenuPatch : BytecodePatch(
|
|||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
|
|
||||||
AccountMenuParentFingerprint.result?.let { parentResult ->
|
AccountMenuParentFingerprint.result?.let { parentResult ->
|
||||||
AccountMenuFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
|
AccountMenuFingerprint.also {
|
||||||
|
it.resolve(
|
||||||
|
context,
|
||||||
|
parentResult.classDef
|
||||||
|
)
|
||||||
|
}.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val targetIndex = it.scanResult.patternScanResult!!.startIndex + 1
|
val targetIndex = it.scanResult.patternScanResult!!.startIndex + 2
|
||||||
val register = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
val targetInstruction = getInstruction<FiveRegisterInstruction>(targetIndex)
|
||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
targetIndex + 1,
|
targetIndex,
|
||||||
"invoke-static {v$register}, $GENERAL->hideAccountMenu(Landroid/text/Spanned;)V"
|
"invoke-static {v${targetInstruction.registerC}, v${targetInstruction.registerD}}, " +
|
||||||
|
"$GENERAL->hideAccountMenu(Landroid/view/View;Ljava/lang/CharSequence;)V"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} ?: throw AccountMenuFingerprint.exception
|
} ?: throw AccountMenuFingerprint.exception
|
||||||
|
|
||||||
parentResult.mutableMethod.apply {
|
|
||||||
val endIndex = parentResult.scanResult.patternScanResult!!.endIndex
|
|
||||||
val register = getInstruction<OneRegisterInstruction>(endIndex).registerA
|
|
||||||
|
|
||||||
addInstruction(
|
|
||||||
endIndex + 1,
|
|
||||||
"sput-object v$register, $GENERAL->compactLink:Landroid/view/View;"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} ?: throw AccountMenuParentFingerprint.exception
|
} ?: throw AccountMenuParentFingerprint.exception
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user