mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 13:17:46 +02:00
fix(YouTube/Shorts components): Hide paused header
setting does not work
This commit is contained in:
@ -36,6 +36,7 @@ import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||
import app.revanced.patches.youtube.video.information.VideoInformationPatch
|
||||
import app.revanced.util.REGISTER_TEMPLATE_REPLACEMENT
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.getWalkerMethod
|
||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
|
||||
import app.revanced.util.indexOfFirstWideLiteralInstructionValueOrThrow
|
||||
@ -283,15 +284,39 @@ object ShortsComponentPatch : BaseBytecodePatch(
|
||||
|
||||
ShortsPausedHeaderFingerprint.resultOrThrow().let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = it.scanResult.patternScanResult!!.startIndex
|
||||
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex + 1
|
||||
val targetInstruction = getInstruction(targetIndex)
|
||||
val targetReference =
|
||||
(targetInstruction as? ReferenceInstruction)?.reference as? MethodReference
|
||||
val useMethodWalker = targetInstruction.opcode == Opcode.INVOKE_VIRTUAL &&
|
||||
targetReference?.returnType == "V" &&
|
||||
targetReference.parameterTypes.firstOrNull() == "Landroid/view/View;"
|
||||
|
||||
addInstructions(
|
||||
insertIndex, """
|
||||
invoke-static {v$insertRegister}, $SHORTS_CLASS_DESCRIPTOR->hideShortsPausedHeader(Z)Z
|
||||
move-result v$insertRegister
|
||||
"""
|
||||
)
|
||||
if (useMethodWalker) {
|
||||
// YouTube 18.29.38 ~ YouTube 19.28.42
|
||||
getWalkerMethod(context, targetIndex).apply {
|
||||
addInstructionsWithLabels(
|
||||
0, """
|
||||
invoke-static {}, $SHORTS_CLASS_DESCRIPTOR->hideShortsPausedHeader()Z
|
||||
move-result v0
|
||||
if-eqz v0, :show
|
||||
return-void
|
||||
""", ExternalLabel("show", getInstruction(0))
|
||||
)
|
||||
}
|
||||
} else {
|
||||
// YouTube 19.29.42 ~
|
||||
val insertIndex = it.scanResult.patternScanResult!!.startIndex
|
||||
val insertRegister =
|
||||
getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
insertIndex, """
|
||||
invoke-static {v$insertRegister}, $SHORTS_CLASS_DESCRIPTOR->hideShortsPausedHeader(Z)Z
|
||||
move-result v$insertRegister
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user