This commit is contained in:
inotia00 2025-03-28 19:47:08 +09:00
parent f0b1155d20
commit 3e8c748f48
3 changed files with 50 additions and 24 deletions

View File

@ -38,6 +38,7 @@ import app.revanced.util.fingerprint.methodOrThrow
import app.revanced.util.fingerprint.mutableClassOrThrow import app.revanced.util.fingerprint.mutableClassOrThrow
import app.revanced.util.getReference import app.revanced.util.getReference
import app.revanced.util.getWalkerMethod import app.revanced.util.getWalkerMethod
import app.revanced.util.indexOfFirstInstruction
import app.revanced.util.indexOfFirstInstructionOrThrow import app.revanced.util.indexOfFirstInstructionOrThrow
import app.revanced.util.indexOfFirstLiteralInstructionOrThrow import app.revanced.util.indexOfFirstLiteralInstructionOrThrow
import app.revanced.util.replaceLiteralInstructionCall import app.revanced.util.replaceLiteralInstructionCall
@ -268,10 +269,11 @@ val toolBarComponentsPatch = bytecodePatch(
createSearchSuggestionsFingerprint.methodOrThrow().apply { createSearchSuggestionsFingerprint.methodOrThrow().apply {
val iteratorIndex = indexOfIteratorInstruction(this) val iteratorIndex = indexOfIteratorInstruction(this)
val replaceIndex = indexOfFirstInstructionOrThrow(iteratorIndex) { val replaceIndex = indexOfFirstInstruction(iteratorIndex) {
opcode == Opcode.IGET_OBJECT && opcode == Opcode.IGET_OBJECT &&
getReference<FieldReference>()?.type == "Landroid/widget/ImageView;" getReference<FieldReference>()?.type == "Landroid/widget/ImageView;"
} }
if (replaceIndex > -1) {
val uriIndex = indexOfFirstInstructionOrThrow(replaceIndex) { val uriIndex = indexOfFirstInstructionOrThrow(replaceIndex) {
opcode == Opcode.INVOKE_STATIC && opcode == Opcode.INVOKE_STATIC &&
getReference<MethodReference>()?.toString() == "Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;" getReference<MethodReference>()?.toString() == "Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;"
@ -292,6 +294,29 @@ val toolBarComponentsPatch = bytecodePatch(
""", ExternalLabel("hidden", getInstruction(jumpIndex)) """, ExternalLabel("hidden", getInstruction(jumpIndex))
) )
removeInstruction(replaceIndex) removeInstruction(replaceIndex)
} else { // only for YT 20.03
val insertIndex = indexOfFirstInstructionOrThrow(iteratorIndex) {
opcode == Opcode.INVOKE_VIRTUAL &&
getReference<MethodReference>()?.toString() == "Landroid/widget/ImageView;->setVisibility(I)V"
} - 1
if (getInstruction(insertIndex).opcode != Opcode.CONST_4) {
throw PatchException("Failed to find insert index")
}
val freeRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
val uriIndex = indexOfFirstInstructionOrThrow(insertIndex) {
opcode == Opcode.INVOKE_STATIC &&
getReference<MethodReference>()?.toString() == "Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;"
}
val jumpIndex = indexOfFirstInstructionOrThrow(uriIndex, Opcode.CONST_4)
addInstructionsWithLabels(
insertIndex, """
invoke-static { }, $GENERAL_CLASS_DESCRIPTOR->hideSearchTermThumbnail()Z
move-result v$freeRegister
if-nez v$freeRegister, :hidden
""", ExternalLabel("hidden", getInstruction(jumpIndex))
)
}
} }
if (is_19_16_or_greater) { if (is_19_16_or_greater) {

View File

@ -634,8 +634,8 @@ val playerComponentsPatch = bytecodePatch(
fingerprint.methodOrThrow(filmStripOverlayEnterParentFingerprint).hookFilmstripOverlay() fingerprint.methodOrThrow(filmStripOverlayEnterParentFingerprint).hookFilmstripOverlay()
} }
// Removed in YouTube 20.05+ // Removed in YouTube 20.03+
if (!is_20_05_or_greater) { if (!is_20_03_or_greater) {
youtubeControlsOverlayFingerprint.methodOrThrow().apply { youtubeControlsOverlayFingerprint.methodOrThrow().apply {
val constIndex = indexOfFirstLiteralInstructionOrThrow(fadeDurationFast) val constIndex = indexOfFirstLiteralInstructionOrThrow(fadeDurationFast)
val constRegister = getInstruction<OneRegisterInstruction>(constIndex).registerA val constRegister = getInstruction<OneRegisterInstruction>(constIndex).registerA
@ -663,7 +663,7 @@ val playerComponentsPatch = bytecodePatch(
) )
removeInstruction(insertIndex) removeInstruction(insertIndex)
} }
} else { } else if (is_20_05_or_greater) {
// This is a new film strip overlay added to YouTube 20.05+ // This is a new film strip overlay added to YouTube 20.05+
// Disabling this flag is not related to the operation of the patch. // Disabling this flag is not related to the operation of the patch.
filmStripOverlayConfigV2Fingerprint.injectLiteralInstructionBooleanCall( filmStripOverlayConfigV2Fingerprint.injectLiteralInstructionBooleanCall(

View File

@ -13,7 +13,8 @@ internal object Constants {
"19.16.39", // This is the last version where the 'Restore old seekbar thumbnails' setting works. "19.16.39", // This is the last version where the 'Restore old seekbar thumbnails' setting works.
"19.43.41", // This is the latest version where edge-to-edge display is not enforced on Android 15+. "19.43.41", // This is the latest version where edge-to-edge display is not enforced on Android 15+.
"19.44.39", // This is the only version that has experimental shortcut icons. "19.44.39", // This is the only version that has experimental shortcut icons.
"19.47.53", // This is the latest version supported by the RVX patch. "19.47.53", // This was the latest version supported by the previous RVX patch.
"20.03.45", // This is the latest version supported by the RVX patch.
) )
) )
} }