feat(youtube): bump compatibility to 18.15.40 (#1964)

This commit is contained in:
oSumAtrIX 2023-04-24 03:19:32 +02:00 committed by GitHub
commit c4c6653c37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
69 changed files with 191 additions and 282 deletions

View File

@ -5,7 +5,6 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.*
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import org.w3c.dom.Element

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -13,7 +13,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -1,22 +0,0 @@
package app.revanced.patches.youtube.layout.hide.mixplaylists.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf(
"17.49.37",
"18.03.36",
"18.03.42",
"18.04.35",
"18.04.41",
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
)
)]
)
@Target(AnnotationTarget.CLASS)
internal annotation class MixPlaylistsPatchCompatibility

View File

@ -1,24 +0,0 @@
package app.revanced.patches.youtube.layout.hide.mixplaylists.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
object CreateMixPlaylistFingerprint : MethodFingerprint(
"V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf("L", "L", "L", "L", "L", "L", "L"), listOf(
Opcode.INVOKE_DIRECT,
Opcode.IPUT_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.IPUT_OBJECT,
Opcode.IPUT_OBJECT,
Opcode.IPUT_OBJECT,
Opcode.IPUT_OBJECT,
Opcode.NEW_INSTANCE,
Opcode.INVOKE_DIRECT,
Opcode.IPUT_OBJECT,
Opcode.IPUT_OBJECT,
Opcode.IPUT_OBJECT,
Opcode.INVOKE_VIRTUAL,
)
)

View File

@ -1,24 +0,0 @@
package app.revanced.patches.youtube.layout.hide.mixplaylists.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
object SecondCreateMixPlaylistFingerprint : MethodFingerprint(
"V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf("L", "L", "L", "L", "L", "L"), listOf(
Opcode.INVOKE_DIRECT,
Opcode.IPUT_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.IPUT_OBJECT,
Opcode.IPUT_OBJECT,
Opcode.IPUT_OBJECT,
Opcode.IPUT_OBJECT,
Opcode.NEW_INSTANCE,
Opcode.INVOKE_DIRECT,
Opcode.IPUT_OBJECT,
Opcode.IPUT_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.RETURN_VOID
)
)

View File

@ -1,64 +0,0 @@
package app.revanced.patches.youtube.layout.hide.mixplaylists.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.layout.hide.mixplaylists.annotations.MixPlaylistsPatchCompatibility
import app.revanced.patches.youtube.layout.hide.mixplaylists.fingerprints.CreateMixPlaylistFingerprint
import app.revanced.patches.youtube.layout.hide.mixplaylists.fingerprints.SecondCreateMixPlaylistFingerprint
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Patch
@DependsOn([IntegrationsPatch::class])
@Name("hide-my-mix")
@Description("Hides mix playlists.")
@MixPlaylistsPatchCompatibility
@Version("0.0.1")
class MixPlaylistsPatch : BytecodePatch(
listOf(
CreateMixPlaylistFingerprint, SecondCreateMixPlaylistFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_hide_mix_playlists",
StringResource("revanced_hide_mix_playlists_title", "Hide mix playlists"),
false,
StringResource("revanced_hide_mix_playlists_summary_on", "Mix playlists are hidden"),
StringResource("revanced_hide_mix_playlists_summary_off", "Mix playlists are shown")
)
)
arrayOf(CreateMixPlaylistFingerprint, SecondCreateMixPlaylistFingerprint).forEach(::addHook)
return PatchResultSuccess()
}
private fun addHook(fingerprint: MethodFingerprint) {
with (fingerprint.result!!) {
val insertIndex = scanResult.patternScanResult!!.endIndex - 3
val register = (mutableMethod.instruction(insertIndex - 2) as OneRegisterInstruction).registerA
mutableMethod.addInstruction(
insertIndex,
"invoke-static {v$register}, Lapp/revanced/integrations/patches/HideMixPlaylistsPatch;->hideMixPlaylists(Landroid/view/View;)V"
)
}
}
}

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.returnyoutubedislike.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.08.37"))])
@Compatibility([Package("com.google.android.youtube", arrayOf("18.15.40"))])
@Target(AnnotationTarget.CLASS)
internal annotation class ReturnYouTubeDislikeCompatibility

View File

@ -1,13 +1,10 @@
package app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
object ShortsTextComponentParentFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PROTECTED or AccessFlags.FINAL,
parameters = listOf("L", "L"),
opcodes = listOf(
Opcode.INVOKE_STATIC,

View File

@ -16,15 +16,16 @@ object TextComponentAtomicReferenceFingerprint : MethodFingerprint(
Opcode.MOVE_OBJECT, // available unused register
Opcode.MOVE_OBJECT_FROM16,
Opcode.MOVE_OBJECT_FROM16,
Opcode.MOVE_FROM16,
Opcode.MOVE_OBJECT_FROM16,
Opcode.MOVE_OBJECT_FROM16,
Opcode.INVOKE_VIRTUAL, // CharSequence atomic reference
Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST,
Opcode.MOVE_OBJECT, // CharSequence reference, and control flow label. Insert code here.
Opcode.INVOKE_VIRTUAL_RANGE,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT,
Opcode.IF_EQZ,
Opcode.INVOKE_VIRTUAL_RANGE,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.GOTO,
Opcode.CONST_4,

View File

@ -26,6 +26,7 @@ import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
import app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch
import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
@ -101,14 +102,15 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
textComponentContextFingerprintResult.mutableMethod.apply {
// Get the conversion context obfuscated field name, and the registers for the AtomicReference and CharSequence
val conversionContextFieldName =
(instruction(conversionContextIndex) as ReferenceInstruction).reference.toString()
val contextRegister = // any free register
val conversionContextFieldReference =
(instruction(conversionContextIndex) as ReferenceInstruction).reference
// any free register
val contextRegister =
(instruction(atomicReferenceStartIndex) as TwoRegisterInstruction).registerB
val atomicReferenceRegister =
(instruction(atomicReferenceStartIndex + 4) as BuilderInstruction35c).registerC
(instruction(atomicReferenceStartIndex + 5) as FiveRegisterInstruction).registerC
val insertIndex = atomicReferenceStartIndex + 7
val insertIndex = atomicReferenceStartIndex + 8
val moveCharSequenceInstruction = instruction(insertIndex) as TwoRegisterInstruction
val charSequenceRegister = moveCharSequenceInstruction.registerB
@ -117,10 +119,10 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
replaceInstruction(insertIndex, "move-object/from16 v$contextRegister, p0")
addInstructions(
insertIndex + 1, """
iget-object v$contextRegister, v$contextRegister, $conversionContextFieldName # copy obfuscated context field into free register
iget-object v$contextRegister, v$contextRegister, $conversionContextFieldReference # copy obfuscated context field into free register
invoke-static {v$contextRegister, v$atomicReferenceRegister, v$charSequenceRegister}, $INTEGRATIONS_PATCH_CLASS_DESCRIPTOR->onLithoTextLoaded(Ljava/lang/Object;Ljava/util/concurrent/atomic/AtomicReference;Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
move-result-object v$charSequenceRegister
move-object v${moveCharSequenceInstruction.registerA}, v${moveCharSequenceInstruction.registerB} # original instruction at the insertion point
move-object v${moveCharSequenceInstruction.registerA}, v${charSequenceRegister} # original instruction at the insertion point
"""
)
}

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -0,0 +1,13 @@
package app.revanced.patches.youtube.layout.searchbar.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode
object CreateSearchSuggestionsFingerprint : MethodFingerprint(
opcodes = listOf(
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT,
Opcode.CONST_4
),
strings = listOf("ss_rds")
)

View File

@ -1,27 +0,0 @@
package app.revanced.patches.youtube.layout.searchbar.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
object DrawActionBarFingerprint : MethodFingerprint(
"V",
AccessFlags.PRIVATE or AccessFlags.FINAL,
listOf("I", "I"),
listOf(
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.SGET_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.IGET_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.IGET_OBJECT,
Opcode.CONST,
Opcode.INVOKE_VIRTUAL,
Opcode.IGET_OBJECT,
Opcode.INVOKE_STATIC,
),
)

View File

@ -17,51 +17,22 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.layout.searchbar.annotations.WideSearchbarCompatibility
import app.revanced.patches.youtube.layout.searchbar.fingerprints.DrawActionBarFingerprint
import app.revanced.patches.youtube.layout.searchbar.fingerprints.CreateSearchSuggestionsFingerprint
import app.revanced.patches.youtube.layout.searchbar.fingerprints.SetWordmarkHeaderFingerprint
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
@Patch
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
@Name("enable-wide-searchbar")
@Name("wide-searchbar")
@Description("Replaces the search icon with a wide search bar. This will hide the YouTube logo when active.")
@WideSearchbarCompatibility
@Version("0.0.1")
class WideSearchbarPatch : BytecodePatch(
listOf(
SetWordmarkHeaderFingerprint, DrawActionBarFingerprint
SetWordmarkHeaderFingerprint, CreateSearchSuggestionsFingerprint
)
) {
private companion object {
/**
* Walk a fingerprints method at a given index mutably.
*
* @param index The index to walk at.
* @param fromFingerprint The fingerprint to walk the method on.
* @return The [MutableMethod] which was walked on.
*/
fun BytecodeContext.walkMutable(index: Int, fromFingerprint: MethodFingerprint) =
fromFingerprint.result?.let {
toMethodWalker(it.method).nextMethod(index, true).getMethod() as MutableMethod
} ?: throw SetWordmarkHeaderFingerprint.toErrorResult()
/**
* Injects instructions required for certain methods.
*
*/
fun MutableMethod.injectSearchBarHook() {
addInstructions(
implementation!!.instructions.size - 1,
"""
invoke-static {}, Lapp/revanced/integrations/patches/NewActionbarPatch;->getNewActionBar()Z
move-result p0
"""
)
}
}
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
@ -73,16 +44,45 @@ class WideSearchbarPatch : BytecodePatch(
)
)
val result = DrawActionBarFingerprint.result ?: return DrawActionBarFingerprint.toErrorResult()
val result = CreateSearchSuggestionsFingerprint.result ?: return CreateSearchSuggestionsFingerprint.toErrorResult()
// patch methods
mapOf(
SetWordmarkHeaderFingerprint to 1,
DrawActionBarFingerprint to result.scanResult.patternScanResult!!.endIndex
CreateSearchSuggestionsFingerprint to result.scanResult.patternScanResult!!.startIndex
).forEach { (fingerprint, callIndex) ->
context.walkMutable(callIndex, fingerprint).injectSearchBarHook()
}
return PatchResultSuccess()
}
private companion object {
/**
* Walk a fingerprints method at a given index mutably.
*
* @param index The index to walk at.
* @param fromFingerprint The fingerprint to walk the method on.
* @return The [MutableMethod] which was walked on.
*/
fun BytecodeContext.walkMutable(index: Int, fromFingerprint: MethodFingerprint) =
fromFingerprint.result?.let {
toMethodWalker(it.method).nextMethod(index, true).getMethod() as MutableMethod
} ?: throw fromFingerprint.toErrorResult()
/**
* Injects instructions required for certain methods.
*
*/
fun MutableMethod.injectSearchBarHook() {
addInstructions(
implementation!!.instructions.size - 1,
"""
invoke-static {}, Lapp/revanced/integrations/patches/WideSearchbarPatch;->enableWideSearchbar()Z
move-result p0
"""
)
}
}
}

View File

@ -4,7 +4,7 @@ import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package("com.google.android.youtube", arrayOf("18.08.37"))]
[Package("com.google.android.youtube", arrayOf("18.08.37", "18.15.40"))]
)
@Target(AnnotationTarget.CLASS)
internal annotation class SponsorBlockCompatibility

View File

@ -21,7 +21,9 @@ import app.revanced.patches.shared.fingerprints.SeekbarFingerprint
import app.revanced.patches.shared.fingerprints.SeekbarOnDrawFingerprint
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility
import app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints.*
import app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints.AppendTimeFingerprint
import app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints.PlayerOverlaysLayoutInitFingerprint
import app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints.RectangleFieldInvalidatorFingerprint
import app.revanced.patches.youtube.layout.sponsorblock.resource.patch.SponsorBlockResourcePatch
import app.revanced.patches.youtube.misc.autorepeat.fingerprints.AutoRepeatFingerprint
import app.revanced.patches.youtube.misc.autorepeat.fingerprints.AutoRepeatParentFingerprint
@ -153,14 +155,22 @@ class SponsorBlockBytecodePatch : BytecodePatch(
/*
* Draw segment
*/
val drawSegmentInstructionInsertIndex = (seekbarMethodInstructions.size - 1 - 2)
val (canvasInstance, centerY) = (seekbarMethodInstructions[drawSegmentInstructionInsertIndex] as FiveRegisterInstruction).let {
it.registerC to it.registerE
// Find the drawCircle call and draw the segment before it
for (i in seekbarMethodInstructions.size - 1 downTo 0) {
val invokeInstruction = seekbarMethodInstructions[i] as? ReferenceInstruction ?: continue
if ((invokeInstruction.reference as MethodReference).name != "drawCircle") continue
val (canvasInstance, centerY) = (invokeInstruction as FiveRegisterInstruction).let {
it.registerC to it.registerE
}
seekbarMethod.addInstruction(
i,
"invoke-static {v$canvasInstance, v$centerY}, $INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR->drawSponsorTimeBars(Landroid/graphics/Canvas;F)V"
)
break
}
seekbarMethod.addInstruction(
drawSegmentInstructionInsertIndex,
"invoke-static {v$canvasInstance, v$centerY}, $INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR->drawSponsorTimeBars(Landroid/graphics/Canvas;F)V"
)
/*
* Voting & Shield button

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -3,6 +3,6 @@ package app.revanced.patches.youtube.layout.tabletminiplayer.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.08.37"))])
@Compatibility([Package("com.google.android.youtube", arrayOf("18.15.40"))])
@Target(AnnotationTarget.CLASS)
internal annotation class TabletMiniPlayerCompatibility

View File

@ -9,5 +9,5 @@ object MiniPlayerOverrideParentFingerprint : MethodFingerprint(
returnType = "L",
access = AccessFlags.PUBLIC or AccessFlags.STATIC,
parameters = listOf("L"),
strings = listOf("VIDEO_QUALITIES_QUICK_MENU_BOTTOM_SHEET_FRAGMENT")
strings = listOf("PLAYBACK_RATE_MENU_BOTTOM_SHEET_FRAGMENT")
)

View File

@ -67,10 +67,9 @@ class TabletMiniPlayerPatch : BytecodePatch(
*/
MiniPlayerOverrideParentFingerprint.result?.let {
if (!MiniPlayerOverrideFingerprint.resolve(context, it.classDef))
return MiniPlayerOverrideFingerprint.toErrorResult()
throw MiniPlayerOverrideFingerprint.toErrorResult()
MiniPlayerOverrideFingerprint.addProxyCall()
} ?: return MiniPlayerOverrideParentFingerprint.toErrorResult()
/*

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -4,16 +4,17 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.*
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.all.misc.debugging.patch.EnableAndroidDebuggingPatch
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.misc.debugging.annotations.DebuggingCompatibility
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.all.misc.debugging.patch.EnableAndroidDebuggingPatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import org.w3c.dom.Element
@Patch
@Name("enable-debugging")

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -9,5 +9,5 @@ object ComponentContextParserFingerprint : MethodFingerprint(
Opcode.IPUT_OBJECT,
Opcode.NEW_INSTANCE
),
strings = listOf("LoggingProperties are not in proto format")
strings = listOf("Component was not found %s because it was removed due to duplicate converter bindings")
)

View File

@ -10,7 +10,6 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.util.smali.ExternalLabel
@ -22,6 +21,7 @@ import app.revanced.patches.youtube.misc.litho.filter.fingerprints.ReadComponent
import org.jf.dexlib2.iface.instruction.Instruction
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
@DependsOn([IntegrationsPatch::class])
@Description("Hooks the method which parses the bytes into a ComponentContext to filter components.")
@ -44,15 +44,15 @@ class LithoFilterPatch : BytecodePatch(
val insertHookIndex = result.scanResult.patternScanResult!!.endIndex
val builderMethodDescriptor = instruction(builderMethodIndex).descriptor
val emptyComponentFieldDescriptor = instruction(emptyComponentFieldIndex).descriptor
// Register is overwritten right after it is used for this patch, therefore free to clobber.
val clobberedRegister = instruction(insertHookIndex).oneRegister
// Register is overwritten right after it is used in this patch, therefore free to clobber.
val clobberedRegister = instruction(insertHookIndex - 1).twoRegisterA
@Suppress("UnnecessaryVariable")
// The register, this patch clobbers, is previously used for the StringBuilder,
// later on a new StringBuilder is instantiated on it.
val stringBuilderRegister = clobberedRegister
val identifierRegister = instruction(ReadComponentIdentifierFingerprint.patternScanEndIndex).oneRegister
val identifierRegister = instruction(ReadComponentIdentifierFingerprint.patternScanEndIndex).oneRegisterA
addInstructions(
insertHookIndex, // right after setting the component.pathBuilder field,
@ -69,7 +69,7 @@ class LithoFilterPatch : BytecodePatch(
listOf(ExternalLabel("not_an_ad", instruction(insertHookIndex)))
)
}
} ?: return PatchResultError("Could not find the method to hook.")
} ?: return ComponentContextParserFingerprint.toErrorResult()
return PatchResultSuccess()
}
@ -81,8 +81,10 @@ class LithoFilterPatch : BytecodePatch(
val Instruction.descriptor
get() = (this as ReferenceInstruction).reference.toString()
val Instruction.oneRegister
val Instruction.oneRegisterA
get() = (this as OneRegisterInstruction).registerA
val Instruction.twoRegisterA
get() = (this as TwoRegisterInstruction).registerA
}
}

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -4,7 +4,7 @@ import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package("com.google.android.youtube", arrayOf("18.08.37"))]
[Package("com.google.android.youtube", arrayOf("18.08.37", "18.15.40"))]
)
@Target(AnnotationTarget.CLASS)
internal annotation class VideoInformationCompatibility

View File

@ -4,7 +4,7 @@ import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package("com.google.android.youtube", arrayOf("18.08.37"))]
[Package("com.google.android.youtube", arrayOf("18.08.37", "18.15.40"))]
)
@Target(AnnotationTarget.CLASS)
internal annotation class RememberVideoQualityCompatibility

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -4,7 +4,7 @@ import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package("com.google.android.youtube", arrayOf("18.08.37"))]
[Package("com.google.android.youtube", arrayOf("18.08.37", "18.15.40"))]
)
@Target(AnnotationTarget.CLASS)
internal annotation class RememberPlaybackSpeedCompatibility

View File

@ -14,7 +14,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)

View File

@ -15,7 +15,8 @@ import app.revanced.patcher.annotation.Package
"18.05.32",
"18.05.35",
"18.05.40",
"18.08.37"
"18.08.37",
"18.15.40"
)
)]
)