mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-04-29 22:24:31 +02:00
feat(youtube): add support version v18.32.39
This commit is contained in:
parent
78169d5fd7
commit
de2df18031
@ -34,7 +34,8 @@ Example:
|
||||
"18.27.36",
|
||||
"18.29.38",
|
||||
"18.30.37",
|
||||
"18.31.40"
|
||||
"18.31.40",
|
||||
"18.32.39"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
@ -2,7 +2,7 @@ package app.revanced.patches.youtube.shorts.shortscomponent.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ReelForcedMuteButton
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ReelPivotButton
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
@ -10,5 +10,5 @@ object ShortsPivotFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
||||
parameters = listOf("Z", "Z", "L"),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ReelForcedMuteButton) }
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ReelPivotButton) }
|
||||
)
|
@ -0,0 +1,14 @@
|
||||
package app.revanced.patches.youtube.shorts.shortscomponent.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ReelForcedMuteButton
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
object ShortsPivotLegacyFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
||||
parameters = listOf("Z", "Z", "L"),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ReelForcedMuteButton) }
|
||||
)
|
@ -2,6 +2,7 @@ package app.revanced.patches.youtube.shorts.shortscomponent.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
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.patch.BytecodePatch
|
||||
@ -9,17 +10,22 @@ import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsPivotFingerprint
|
||||
import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsPivotLegacyFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ReelForcedMuteButton
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ReelPivotButton
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
import app.revanced.util.integrations.Constants.SHORTS
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
class ShortsPivotButtonPatch : BytecodePatch(
|
||||
listOf(ShortsPivotFingerprint)
|
||||
listOf(
|
||||
ShortsPivotFingerprint,
|
||||
ShortsPivotLegacyFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
ShortsPivotFingerprint.result?.let {
|
||||
ShortsPivotLegacyFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = getWideLiteralIndex(ReelForcedMuteButton)
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
@ -27,9 +33,6 @@ class ShortsPivotButtonPatch : BytecodePatch(
|
||||
val insertIndex = getTargetIndexDownTo(targetIndex, Opcode.IF_EQZ)
|
||||
val jumpIndex = getTargetIndexUpTo(targetIndex, Opcode.GOTO)
|
||||
|
||||
if (insertIndex == -1 || jumpIndex == -1)
|
||||
throw PatchException("Failed to find hook method")
|
||||
|
||||
addInstructionsWithLabels(
|
||||
insertIndex, """
|
||||
invoke-static {}, $SHORTS->hideShortsPlayerPivotButton()Z
|
||||
@ -38,9 +41,24 @@ class ShortsPivotButtonPatch : BytecodePatch(
|
||||
""", ExternalLabel("hide", getInstruction(jumpIndex))
|
||||
)
|
||||
}
|
||||
} ?: ShortsPivotFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = getWideLiteralIndex(ReelPivotButton)
|
||||
|
||||
val insertIndex = getTargetIndexDownTo(targetIndex, Opcode.INVOKE_STATIC) + 2
|
||||
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
insertIndex, """
|
||||
invoke-static {v$insertRegister}, $SHORTS->hideShortsPlayerPivotButton(Ljava/lang/Object;)Ljava/lang/Object;
|
||||
move-result-object v$insertRegister
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: throw ShortsPivotFingerprint.exception
|
||||
|
||||
}
|
||||
|
||||
private companion object {
|
||||
fun MutableMethod.getTargetIndexDownTo(
|
||||
startIndex: Int,
|
||||
@ -52,7 +70,7 @@ class ShortsPivotButtonPatch : BytecodePatch(
|
||||
|
||||
return index
|
||||
}
|
||||
return -1
|
||||
throw PatchException("Failed to find hook method")
|
||||
}
|
||||
|
||||
fun MutableMethod.getTargetIndexUpTo(
|
||||
@ -65,7 +83,7 @@ class ShortsPivotButtonPatch : BytecodePatch(
|
||||
|
||||
return index
|
||||
}
|
||||
return -1
|
||||
throw PatchException("Failed to find hook method")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,8 @@ import app.revanced.patcher.annotation.Package
|
||||
"18.27.36",
|
||||
"18.29.38",
|
||||
"18.30.37",
|
||||
"18.31.40"
|
||||
"18.31.40",
|
||||
"18.32.39"
|
||||
)
|
||||
)
|
||||
]
|
||||
|
@ -59,6 +59,7 @@ class SharedResourceIdPatch : ResourcePatch {
|
||||
var ReelDynRemix: Long = -1
|
||||
var ReelDynShare: Long = -1
|
||||
var ReelForcedMuteButton: Long = -1
|
||||
var ReelPivotButton: Long = -1
|
||||
var ReelPlayerBadge: Long = -1
|
||||
var ReelPlayerBadge2: Long = -1
|
||||
var ReelPlayerFooter: Long = -1
|
||||
@ -139,6 +140,7 @@ class SharedResourceIdPatch : ResourcePatch {
|
||||
ReelDynRemix = find(ID, "reel_dyn_remix")
|
||||
ReelDynShare = find(ID, "reel_dyn_share")
|
||||
ReelForcedMuteButton = find(ID, "reel_player_forced_mute_button")
|
||||
ReelPivotButton = find(ID, "reel_pivot_button")
|
||||
ReelPlayerBadge = find(ID, "reel_player_badge")
|
||||
ReelPlayerBadge2 = find(ID, "reel_player_badge2")
|
||||
ReelPlayerFooter = find(LAYOUT, "reel_player_dyn_footer_vert_stories3")
|
||||
|
Loading…
x
Reference in New Issue
Block a user