mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-06 09:34:37 +02:00
fix(YouTube Music/Hide action bar component): apply fingerprints compatible with the wider version
This commit is contained in:
parent
2ab584c410
commit
065f0c124f
@ -2,6 +2,7 @@ package app.revanced.patches.music.actionbar.component
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
||||
@ -11,6 +12,7 @@ import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.music.actionbar.component.fingerprints.ActionBarComponentFingerprint
|
||||
import app.revanced.patches.music.actionbar.component.fingerprints.LikeDislikeContainerFingerprint
|
||||
import app.revanced.patches.music.actionbar.component.fingerprints.LikeDislikeContainerVisibilityFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.ACTIONBAR
|
||||
import app.revanced.patches.music.utils.intenthook.IntentHookPatch
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
@ -148,8 +150,29 @@ object ActionBarComponentPatch : BytecodePatch(
|
||||
}
|
||||
} ?: throw ActionBarComponentFingerprint.exception
|
||||
|
||||
LikeDislikeContainerFingerprint.result?.let {
|
||||
LikeDislikeContainerFingerprint.result?.let { parentResult ->
|
||||
// Resolves fingerprints
|
||||
LikeDislikeContainerVisibilityFingerprint.resolve(context, parentResult.classDef)
|
||||
|
||||
/**
|
||||
* Added in YouTube Music v6.35.xx~
|
||||
*/
|
||||
LikeDislikeContainerVisibilityFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = it.scanResult.patternScanResult!!.startIndex + 1
|
||||
val targetRegister =
|
||||
getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
targetIndex + 1, """
|
||||
invoke-static {v$targetRegister}, $ACTIONBAR->hideLikeDislikeButton(Z)Z
|
||||
move-result v$targetRegister
|
||||
"""
|
||||
)
|
||||
}
|
||||
} // Don't throw exception
|
||||
|
||||
parentResult.mutableMethod.apply {
|
||||
val insertIndex = getWideLiteralInstructionIndex(LikeDislikeContainer) + 2
|
||||
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
|
@ -0,0 +1,33 @@
|
||||
package app.revanced.patches.music.actionbar.component.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
|
||||
object LikeDislikeContainerVisibilityFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT
|
||||
),
|
||||
customFingerprint = custom@{ methodDef, _ ->
|
||||
if (methodDef.implementation == null)
|
||||
return@custom false
|
||||
|
||||
for (instruction in methodDef.implementation!!.instructions) {
|
||||
if (instruction.opcode != Opcode.INVOKE_VIRTUAL)
|
||||
continue
|
||||
|
||||
val referenceInstruction = instruction as ReferenceInstruction
|
||||
if (referenceInstruction.reference.toString() != "Landroid/view/View;->setVisibility(I)V")
|
||||
continue
|
||||
|
||||
return@custom true
|
||||
}
|
||||
return@custom false
|
||||
}
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user