fix(YouTube/Hide filmstrip overlay, Hide seek message): patch does not work when A/B testing is applied

This commit is contained in:
inotia00
2023-12-28 21:35:43 +09:00
parent 20571016bb
commit 3974641760
4 changed files with 52 additions and 0 deletions

View File

@ -15,6 +15,7 @@ import app.revanced.patches.youtube.player.filmstripoverlay.fingerprints.FilmStr
import app.revanced.patches.youtube.player.filmstripoverlay.fingerprints.FilmStripOverlayParentFingerprint
import app.revanced.patches.youtube.player.filmstripoverlay.fingerprints.FilmStripOverlayPreviewFingerprint
import app.revanced.patches.youtube.player.filmstripoverlay.fingerprints.FineScrubbingOverlayFingerprint
import app.revanced.patches.youtube.utils.controlsoverlay.DisableControlsOverlayConfigPatch
import app.revanced.patches.youtube.utils.integrations.Constants.PLAYER
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
import app.revanced.patches.youtube.utils.settings.SettingsPatch
@ -32,6 +33,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
name = "Hide filmstrip overlay",
description = "Hide filmstrip overlay on swipe controls.",
dependencies = [
DisableControlsOverlayConfigPatch::class,
SettingsPatch::class,
SharedResourceIdPatch::class,
],

View File

@ -10,6 +10,7 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.youtube.player.seekmessage.fingerprints.SeekEduContainerFingerprint
import app.revanced.patches.youtube.player.seekmessage.fingerprints.SeekEduUndoOverlayFingerprint
import app.revanced.patches.youtube.utils.controlsoverlay.DisableControlsOverlayConfigPatch
import app.revanced.patches.youtube.utils.integrations.Constants.PLAYER
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.SeekUndoEduOverlayStub
@ -26,6 +27,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
name = "Hide seek message",
description = "Hides the 'Slide left or right to seek' or 'Release to cancel' message container.",
dependencies = [
DisableControlsOverlayConfigPatch::class,
SettingsPatch::class,
SharedResourceIdPatch::class
],

View File

@ -0,0 +1,34 @@
package app.revanced.patches.youtube.utils.controlsoverlay
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patches.youtube.utils.controlsoverlay.fingerprints.ControlsOverlayConfigFingerprint
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
object DisableControlsOverlayConfigPatch : BytecodePatch(
setOf(ControlsOverlayConfigFingerprint)
) {
override fun execute(context: BytecodeContext) {
/**
* Added in YouTube v18.39.41
*
* No exception even if fail to resolve fingerprints.
* For compatibility with YouTube v18.25.40 ~ YouTube v18.38.44.
*/
ControlsOverlayConfigFingerprint.result?.let {
it.mutableMethod.apply {
val targetIndex = implementation!!.instructions.size - 1
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
addInstruction(
targetIndex,
"const/4 v$targetRegister, 0x0"
)
}
}
}
}

View File

@ -0,0 +1,14 @@
package app.revanced.patches.youtube.utils.controlsoverlay.fingerprints
import app.revanced.util.fingerprint.LiteralValueFingerprint
/**
* Added in YouTube v18.39.41
*
* When this value is TRUE, new control overlay is used.
* In this case, the associated patches no longer work, so set this value to FALSE.
*/
object ControlsOverlayConfigFingerprint : LiteralValueFingerprint(
returnType = "Z",
literalSupplier = { 45427491 }
)