This commit is contained in:
oSumAtrIX
2026-01-24 16:24:01 +01:00
parent 99bfecbc97
commit 72b6b04679
36 changed files with 130 additions and 163 deletions

View File

@@ -1,7 +1,5 @@
package app.revanced.patches.shared.layout.theme
import app.revanced.patcher.InstructionLocation.MatchAfterImmediately
import app.revanced.patcher.InstructionLocation.MatchAfterWithin
import app.revanced.patcher.accessFlags
import app.revanced.patcher.fieldAccess
import app.revanced.patcher.gettingFirstMethodDeclaratively
@@ -28,18 +26,18 @@ internal val BytecodePatchContext.lithoOnBoundsChangeMethod by gettingFirstMetho
definingClass = "this",
name = "isStateful",
returnType = "Z",
location = MatchAfterWithin(5),
after(5),
),
fieldAccess(
opcode = Opcode.IGET_OBJECT,
definingClass = "this",
type = "Landroid/graphics/Paint",
location = MatchAfterWithin(5),
after(5),
),
methodCall(
smali = "Landroid/graphics/Paint;->setColor(I)V",
location = MatchAfterImmediately(),
after(),
),
)
custom { method, _ ->

View File

@@ -152,7 +152,7 @@ internal val BytecodePatchContext.nerdsStatsVideoFormatBuilderMethod by gettingF
returnType("Ljava/lang/String;")
parameterTypes("L")
instructions(
addString("codecs=\""),
"codecs=\""(),
)
}

View File

@@ -19,6 +19,6 @@ internal val BytecodePatchContext.offlineVideoEndpointMethod by gettingFirstMeth
"L",
)
instructions(
addString("Object is not an offlineable video: "),
"Object is not an offlineable video: "(),
)
}

View File

@@ -1,8 +1,7 @@
package app.revanced.patches.youtube.interaction.seekbar
import app.revanced.patcher.InstructionLocation.MatchAfterImmediately
import app.revanced.patcher.InstructionLocation.MatchAfterWithin
import app.revanced.patcher.accessFlags
import app.revanced.patcher.after
import app.revanced.patcher.fieldAccess
import app.revanced.patcher.firstMethodComposite
import app.revanced.patcher.firstMutableMethodDeclaratively
@@ -133,15 +132,15 @@ internal val BytecodePatchContext.seekbarTappingMethod by gettingFirstMethodDecl
Int.MAX_VALUE(),
newInstance("Landroid/graphics/Point;"),
methodCall(smali = "Landroid/graphics/Point;-><init>(II)V", location = MatchAfterImmediately()),
methodCall(smali = "Landroid/graphics/Point;-><init>(II)V", after()),
methodCall(
smali = "Lj\$/util/Optional;->of(Ljava/lang/Object;)Lj\$/util/Optional;",
location = MatchAfterImmediately(),
after(),
),
opcode(Opcode.MOVE_RESULT_OBJECT, location = MatchAfterImmediately()),
fieldAccess(opcode = Opcode.IPUT_OBJECT, type = "Lj\$/util/Optional;", location = MatchAfterImmediately()),
after(Opcode.MOVE_RESULT_OBJECT()),
fieldAccess(opcode = Opcode.IPUT_OBJECT, type = "Lj\$/util/Optional;", after()),
opcode(Opcode.INVOKE_VIRTUAL, location = MatchAfterWithin(10)),
after(10, Opcode.INVOKE_VIRTUAL()),
)
custom { method, _ -> method.name == "onTouchEvent" }
}

View File

@@ -1,6 +1,5 @@
package app.revanced.patches.youtube.layout.buttons.navigation
import app.revanced.patcher.InstructionLocation.MatchAfterImmediately
import app.revanced.patcher.accessFlags
import app.revanced.patcher.addString
import app.revanced.patcher.gettingFirstMethodDeclaratively
@@ -16,9 +15,9 @@ import com.android.tools.smali.dexlib2.Opcode
internal val BytecodePatchContext.addCreateButtonViewMethod by gettingFirstMethodDeclaratively {
instructions(
addString("Android Wear"),
"Android Wear"(),
Opcode.IF_EQZ(),
addString("Android Automotive", location = MatchAfterImmediately()),
addString("Android Automotive", after()),
)
}

View File

@@ -1,6 +1,5 @@
package app.revanced.patches.youtube.layout.formfactor
import app.revanced.patcher.InstructionLocation.*
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.getInstruction
import app.revanced.patcher.fieldAccess
@@ -57,7 +56,7 @@ val `Change form factor` by creatingBytecodePatch(
fieldAccess(
definingClass = formFactorEnumConstructorMethod.originalClassDef.type,
type = "I",
location = MatchAfterWithin(50),
after(50),
),
)
}

View File

@@ -1,6 +1,5 @@
package app.revanced.patches.youtube.layout.hide.general
import app.revanced.patcher.InstructionLocation.*
import app.revanced.patcher.StringComparisonType
import app.revanced.patcher.accessFlags
import app.revanced.patcher.addString
@@ -28,7 +27,7 @@ internal val BytecodePatchContext.hideShowMoreButtonMethod by gettingFirstMethod
instructions(
ResourceType.LAYOUT("expand_button_down"),
methodCall(smali = "Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;"),
opcode(Opcode.MOVE_RESULT_OBJECT, location = MatchAfterImmediately()),
after(Opcode.MOVE_RESULT_OBJECT()),
)
}
@@ -46,8 +45,8 @@ internal val BytecodePatchContext.parseElementFromBufferMethod by gettingFirstMe
instructions(
Opcode.IGET_OBJECT(),
// IGET_BOOLEAN // 20.07+
opcode(Opcode.INVOKE_INTERFACE, location = MatchAfterWithin(1)),
opcode(Opcode.MOVE_RESULT_OBJECT, location = MatchAfterImmediately()),
after(1, Opcode.INVOKE_INTERFACE()),
after(Opcode.MOVE_RESULT_OBJECT()),
addString("Failed to parse Element", comparison = StringComparisonType.STARTS_WITH),
)
@@ -57,7 +56,7 @@ internal val BytecodePatchContext.playerOverlayMethod by gettingFirstMethodDecla
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
returnType("L")
instructions(
addString("player_overlay_in_video_programming"),
"player_overlay_in_video_programming"(),
)
}
@@ -141,8 +140,8 @@ internal val BytecodePatchContext.showFloatingMicrophoneButtonMethod by gettingF
parameterTypes()
instructions(
ResourceType.ID("fab"),
checkCast("/FloatingActionButton;", location = MatchAfterWithin(10)),
opcode(Opcode.IGET_BOOLEAN, location = MatchAfterWithin(15)),
checkCast("/FloatingActionButton;", after(10)),
after(15, Opcode.IGET_BOOLEAN()),
)
}

View File

@@ -17,7 +17,7 @@ internal val BytecodePatchContext.infocardsIncognitoMethod by gettingFirstMethod
returnType("Ljava/lang/Boolean;")
parameterTypes("L", "J")
instructions(
addString("vibrator"),
"vibrator"(),
)
}
@@ -25,7 +25,7 @@ internal val BytecodePatchContext.infocardsIncognitoParentMethod by gettingFirst
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
returnType("Ljava/lang/String;")
instructions(
addString("player_overlay_info_card_teaser"),
"player_overlay_info_card_teaser"(),
)
}

View File

@@ -1,6 +1,5 @@
package app.revanced.patches.youtube.layout.hide.shorts
import app.revanced.patcher.InstructionLocation.*
import app.revanced.patcher.accessFlags
import app.revanced.patcher.addString
import app.revanced.patcher.gettingFirstMethodDeclaratively
@@ -21,7 +20,7 @@ internal val BytecodePatchContext.shortsBottomBarContainerMethod by gettingFirst
returnType("V")
parameterTypes("Landroid/view/View;", "Landroid/os/Bundle;")
instructions(
addString("r_pfvc"),
"r_pfvc"(),
ResourceType.ID("bottom_bar_container"),
methodCall(name = "getHeight"),
Opcode.MOVE_RESULT(),
@@ -36,16 +35,16 @@ internal val BytecodePatchContext.renderBottomNavigationBarMethod by gettingFirs
parameterTypes("Ljava/lang/String;")
instructions(
opcode(Opcode.IGET_OBJECT, MatchFirst()),
opcode(Opcode.MONITOR_ENTER, MatchAfterImmediately()),
opcode(Opcode.IGET_OBJECT, MatchAfterImmediately()),
opcode(Opcode.IF_EQZ, MatchAfterImmediately()),
opcode(Opcode.INVOKE_INTERFACE, MatchAfterImmediately()),
after(Opcode.MONITOR_ENTER()),
after(Opcode.IGET_OBJECT()),
after(Opcode.IF_EQZ()),
after(Opcode.INVOKE_INTERFACE()),
Opcode.MONITOR_EXIT(),
opcode(Opcode.RETURN_VOID, MatchAfterImmediately()),
opcode(Opcode.MOVE_EXCEPTION, MatchAfterImmediately()),
opcode(Opcode.MONITOR_EXIT, MatchAfterImmediately()),
opcode(Opcode.THROW, MatchAfterImmediately()),
after(Opcode.RETURN_VOID()),
after(Opcode.MOVE_EXCEPTION()),
after(Opcode.MONITOR_EXIT()),
after(Opcode.THROW()),
)
}
@@ -62,7 +61,7 @@ internal val BytecodePatchContext.legacyRenderBottomNavigationBarLegacyParentMet
"L",
)
instructions(
addString("aa"),
"aa"(),
)
}
@@ -82,7 +81,7 @@ internal val BytecodePatchContext.renderBottomNavigationBarLegacy1941ParentMetho
"L",
)
instructions(
addString("aa"),
"aa"(),
)
}
@@ -95,7 +94,7 @@ internal val BytecodePatchContext.renderBottomNavigationBarParentMethod by getti
"I",
)
instructions(
addString("RPCAC"),
"RPCAC"(),
)
}
@@ -112,7 +111,7 @@ internal val BytecodePatchContext.setPivotBarVisibilityMethod by gettingFirstMet
internal val BytecodePatchContext.setPivotBarVisibilityParentMethod by gettingFirstMethodDeclaratively {
parameterTypes("Z")
instructions(
addString("FEnotifications_inbox"),
"FEnotifications_inbox"(),
)
}

View File

@@ -1,6 +1,5 @@
package app.revanced.patches.youtube.layout.hide.time
import app.revanced.patcher.InstructionLocation.*
import app.revanced.patcher.accessFlags
import app.revanced.patcher.fieldAccess
import app.revanced.patcher.gettingFirstMethodDeclaratively
@@ -22,17 +21,17 @@ internal val BytecodePatchContext.timeCounterMethod by gettingFirstMethodDeclara
methodCall(
opcode = Opcode.INVOKE_STATIC,
returnType = "Ljava/lang/CharSequence;",
location = MatchAfterImmediately(),
after(),
),
opcode(Opcode.MOVE_RESULT_OBJECT, location = MatchAfterImmediately()),
fieldAccess(opcode = Opcode.IGET_WIDE, type = "J", location = MatchAfterImmediately()),
fieldAccess(opcode = Opcode.IGET_WIDE, type = "J", location = MatchAfterImmediately()),
opcode(Opcode.SUB_LONG_2ADDR, location = MatchAfterImmediately()),
after(Opcode.MOVE_RESULT_OBJECT()),
fieldAccess(opcode = Opcode.IGET_WIDE, type = "J", after()),
fieldAccess(opcode = Opcode.IGET_WIDE, type = "J", after()),
after(Opcode.SUB_LONG_2ADDR()),
methodCall(
opcode = Opcode.INVOKE_STATIC,
returnType = "Ljava/lang/CharSequence;",
location = MatchAfterWithin(5),
after(5),
),
)
}

View File

@@ -2,7 +2,6 @@
package app.revanced.patches.youtube.layout.miniplayer
import app.revanced.patcher.InstructionLocation.MatchAfterWithin
import app.revanced.patcher.accessFlags
import app.revanced.patcher.addString
import app.revanced.patcher.checkCast
@@ -52,7 +51,7 @@ internal val BytecodePatchContext.miniplayerModernViewParentMethod by gettingFir
returnType("Ljava/lang/String;")
parameterTypes()
instructions(
addString("player_overlay_modern_mini_player_controls"),
"player_overlay_modern_mini_player_controls"(),
)
}
@@ -164,11 +163,11 @@ internal val BytecodePatchContext.miniplayerOverrideMethod by gettingFirstMethod
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
returnType("L")
instructions(
addString("appName"),
"appName"(),
methodCall(
parameters = listOf("Landroid/content/Context;"),
returnType = "Z",
location = MatchAfterWithin(10),
after(10),
),
)
}

View File

@@ -1,7 +1,7 @@
package app.revanced.patches.youtube.layout.player.fullscreen
import app.revanced.patcher.InstructionLocation.MatchAfterWithin
import app.revanced.patcher.accessFlags
import app.revanced.patcher.after
import app.revanced.patcher.gettingFirstMethodDeclaratively
import app.revanced.patcher.instructions
import app.revanced.patcher.literal
@@ -22,8 +22,8 @@ internal val BytecodePatchContext.openVideosFullscreenPortraitMethod by gettingF
instructions(
Opcode.MOVE_RESULT(), // Conditional check to modify.
// Open videos fullscreen portrait feature flag.
literal(45666112L, location = MatchAfterWithin(5)), // Cannot be more than 5.
opcode(Opcode.MOVE_RESULT, location = MatchAfterWithin(10)),
literal(45666112L, after(5)), // Cannot be more than 5.
after(10, Opcode.MOVE_RESULT()),
)
}

View File

@@ -1,6 +1,5 @@
package app.revanced.patches.youtube.layout.player.overlay
import app.revanced.patcher.InstructionLocation.MatchAfterWithin
import app.revanced.patcher.checkCast
import app.revanced.patcher.gettingFirstMethodDeclaratively
import app.revanced.patcher.instructions
@@ -12,6 +11,6 @@ internal val BytecodePatchContext.createPlayerOverviewMethod by gettingFirstMeth
returnType("V")
instructions(
ResourceType.ID("scrim_overlay"),
checkCast("Landroid/widget/ImageView;", location = MatchAfterWithin(10)),
checkCast("Landroid/widget/ImageView;", after(10)),
)
}

View File

@@ -15,21 +15,21 @@ import com.android.tools.smali.dexlib2.Opcode
internal val BytecodePatchContext.dislikeMethod by gettingFirstMethodDeclaratively {
returnType("V")
instructions(
addString("like/dislike"),
"like/dislike"(),
)
}
internal val BytecodePatchContext.likeMethod by gettingFirstMethodDeclaratively {
returnType("V")
instructions(
addString("like/like"),
"like/like"(),
)
}
internal val BytecodePatchContext.removeLikeMethod by gettingFirstMethodDeclaratively {
returnType("V")
instructions(
addString("like/removelike"),
"like/removelike"(),
)
}
@@ -71,7 +71,7 @@ internal val BytecodePatchContext.rollingNumberMeasureStaticLabelParentMethod by
returnType("Ljava/lang/String;")
parameterTypes()
instructions(
addString("RollingNumberFontProperties{paint="),
"RollingNumberFontProperties{paint="(),
)
}
@@ -105,7 +105,7 @@ internal val BytecodePatchContext.rollingNumberTextViewMethod by gettingFirstMet
internal val BytecodePatchContext.textComponentConstructorMethod by gettingFirstMethodDeclaratively {
accessFlags(AccessFlags.CONSTRUCTOR, AccessFlags.PRIVATE)
instructions(
addString("TextComponent"),
"TextComponent"(),
)
}
@@ -113,7 +113,7 @@ internal val BytecodePatchContext.textComponentDataMethod by gettingFirstMethodD
accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
parameterTypes("L", "L")
instructions(
addString("text"),
"text"(),
)
custom { _, classDef ->
classDef.fields.find { it.type == "Ljava/util/BitSet;" } != null
@@ -128,7 +128,7 @@ internal val BytecodePatchContext.textComponentLookupMethod by gettingFirstMetho
returnType("L")
parameterTypes("L")
instructions(
addString(""),
""(),
)
}

View File

@@ -1,7 +1,5 @@
package app.revanced.patches.youtube.layout.seekbar
import app.revanced.patcher.InstructionLocation.MatchAfterImmediately
import app.revanced.patcher.InstructionLocation.MatchAfterWithin
import app.revanced.patcher.accessFlags
import app.revanced.patcher.addString
import app.revanced.patcher.anyInstruction
@@ -93,8 +91,8 @@ internal val BytecodePatchContext.playerLinearGradientMethod by gettingFirstMeth
instructions(
ResourceType.COLOR("yt_youtube_magenta"),
opcode(Opcode.FILLED_NEW_ARRAY, location = MatchAfterWithin(5)),
opcode(Opcode.MOVE_RESULT_OBJECT, location = MatchAfterImmediately()),
after(5, Opcode.FILLED_NEW_ARRAY()),
after(Opcode.MOVE_RESULT_OBJECT()),
)
}
@@ -107,7 +105,7 @@ internal val BytecodePatchContext.playerLinearGradientLegacyMethod by gettingFir
ResourceType.COLOR("yt_youtube_magenta"),
Opcode.FILLED_NEW_ARRAY(),
opcode(Opcode.MOVE_RESULT_OBJECT, MatchAfterImmediately()),
after(Opcode.MOVE_RESULT_OBJECT()),
)
}
@@ -130,8 +128,8 @@ internal val BytecodePatchContext.lottieCompositionFactoryZipMethod by gettingFi
parameterTypes("Landroid/content/Context;", "Ljava/util/zip/ZipInputStream;", "Ljava/lang/String;")
returnType("L")
instructions(
addString("Unable to parse composition"),
addString(" however it was not found in the animation."),
"Unable to parse composition"(),
" however it was not found in the animation."(),
)
}

View File

@@ -1,6 +1,5 @@
package app.revanced.patches.youtube.layout.shortsautoplay
import app.revanced.patcher.InstructionLocation.*
import app.revanced.patcher.accessFlags
import app.revanced.patcher.addString
import app.revanced.patcher.fieldAccess
@@ -17,10 +16,10 @@ import com.android.tools.smali.dexlib2.Opcode
internal val BytecodePatchContext.reelEnumConstructorMethod by gettingFirstMethodDeclaratively {
accessFlags(AccessFlags.STATIC, AccessFlags.CONSTRUCTOR)
instructions(
addString("REEL_LOOP_BEHAVIOR_UNKNOWN"),
addString("REEL_LOOP_BEHAVIOR_SINGLE_PLAY"),
addString("REEL_LOOP_BEHAVIOR_REPEAT"),
addString("REEL_LOOP_BEHAVIOR_END_SCREEN"),
"REEL_LOOP_BEHAVIOR_UNKNOWN"(),
"REEL_LOOP_BEHAVIOR_SINGLE_PLAY"(),
"REEL_LOOP_BEHAVIOR_REPEAT"(),
"REEL_LOOP_BEHAVIOR_END_SCREEN"(),
Opcode.RETURN_VOID(),
)
}
@@ -29,7 +28,7 @@ internal val BytecodePatchContext.reelPlaybackRepeatParentMethod by gettingFirst
returnType("V")
parameterTypes("Ljava/lang/String;", "J")
instructions(
addString("Reels[%s] Playback Time: %d ms"),
"Reels[%s] Playback Time: %d ms"(),
)
}
@@ -56,13 +55,13 @@ internal val BytecodePatchContext.reelPlaybackMethod by gettingFirstMethodDeclar
methodCall(
name = "<init>",
parameters = listOf("I", "L", "L"),
location = MatchAfterWithin(15),
after(15),
),
methodCall(
opcode = Opcode.INVOKE_VIRTUAL,
parameters = listOf("L"),
returnType = "I",
location = MatchAfterWithin(5),
after(5),
),
)
}

View File

@@ -1,6 +1,5 @@
package app.revanced.patches.youtube.layout.spoofappversion
import app.revanced.patcher.InstructionLocation.*
import app.revanced.patcher.accessFlags
import app.revanced.patcher.fieldAccess
import app.revanced.patcher.gettingFirstMethodDeclaratively
@@ -21,10 +20,10 @@ internal val BytecodePatchContext.toolBarButtonMethod by gettingFirstMethodDecla
instructions(
ResourceType.ID("menu_item_view"),
methodCall(returnType = "I", opcode = Opcode.INVOKE_INTERFACE),
opcode(Opcode.MOVE_RESULT, MatchAfterImmediately()),
fieldAccess(type = "Landroid/widget/ImageView;", opcode = Opcode.IGET_OBJECT, location = MatchAfterWithin(6)),
methodCall("Landroid/content/res/Resources;", "getDrawable", location = MatchAfterWithin(8)),
methodCall("Landroid/widget/ImageView;", "setImageDrawable", location = MatchAfterWithin(4)),
after(Opcode.MOVE_RESULT()),
fieldAccess(type = "Landroid/widget/ImageView;", opcode = Opcode.IGET_OBJECT, after(6)),
methodCall("Landroid/content/res/Resources;", "getDrawable", after(8)),
methodCall("Landroid/widget/ImageView;", "setImageDrawable", after(4)),
)
custom { method, _ ->
// 20.37+ has second parameter of "Landroid/content/Context;"

View File

@@ -13,7 +13,7 @@ import com.android.tools.smali.dexlib2.Opcode
internal val BytecodePatchContext.intentActionMethod by gettingFirstMethodDeclaratively {
parameterTypes("Landroid/content/Intent;")
instructions(
addString("has_handled_intent"),
"has_handled_intent"(),
)
}
@@ -22,7 +22,7 @@ internal val BytecodePatchContext.browseIdMethod by gettingFirstMethodDeclarativ
// parameterTypes() // 20.30 and earlier is no parameters. 20.31+ parameter is L.
instructions(
addString("FEwhat_to_watch"),
"FEwhat_to_watch"(),
512(),
fieldAccess(opcode = Opcode.IPUT_OBJECT, type = "Ljava/lang/String;"),
)

View File

@@ -1,6 +1,5 @@
package app.revanced.patches.youtube.layout.startupshortsreset
import app.revanced.patcher.InstructionLocation.*
import app.revanced.patcher.StringComparisonType
import app.revanced.patcher.accessFlags
import app.revanced.patcher.addString
@@ -25,10 +24,10 @@ internal val BytecodePatchContext.userWasInShortsAlternativeMethod by gettingFir
parameterTypes("Ljava/lang/Object;")
instructions(
checkCast("Ljava/lang/Boolean;"),
methodCall(smali = "Ljava/lang/Boolean;->booleanValue()Z", location = MatchAfterImmediately()),
opcode(Opcode.MOVE_RESULT, MatchAfterImmediately()),
methodCall(smali = "Ljava/lang/Boolean;->booleanValue()Z", after()),
after(Opcode.MOVE_RESULT()),
// 20.40+ string was merged into another string and is a partial match.
addString("userIsInShorts: ", comparison = StringComparisonType.CONTAINS, location = MatchAfterWithin(15)),
addString("userIsInShorts: ", comparison = StringComparisonType.CONTAINS, after(15)),
)
}
@@ -40,7 +39,7 @@ internal val BytecodePatchContext.userWasInShortsLegacyMethod by gettingFirstMet
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
parameterTypes("Ljava/lang/Object;")
instructions(
addString("Failed to read user_was_in_shorts proto after successful warmup"),
"Failed to read user_was_in_shorts proto after successful warmup"(),
)
}

View File

@@ -9,7 +9,7 @@ import app.revanced.patcher.returnType
internal val BytecodePatchContext.deviceDimensionsModelToStringMethod by gettingFirstMethodDeclaratively {
returnType("L")
instructions(
addString("minh."),
addString(";maxh."),
"minh."(),
";maxh."(),
)
}

View File

@@ -13,11 +13,11 @@ internal val applicationInitHook = extensionHook {
// Does _not_ resolve to the YouTube main activity.
// Required as some hooked code runs before the main activity is launched.
instructions(
addString("Application.onCreate"),
addString("Application creation")
"Application.onCreate"(),
"Application creation"(),
)
}
internal val applicationInitOnCrateHook = activityOnCreateExtensionHook(
YOUTUBE_MAIN_ACTIVITY_CLASS_TYPE
YOUTUBE_MAIN_ACTIVITY_CLASS_TYPE,
)

View File

@@ -1,10 +1,11 @@
package app.revanced.patches.youtube.misc.fix.backtoexitgesture
import app.revanced.patcher.InstructionLocation.*
import app.revanced.patcher.accessFlags
import app.revanced.patcher.after
import app.revanced.patcher.checkCast
import app.revanced.patcher.gettingFirstMethodDeclaratively
import app.revanced.patcher.instructions
import app.revanced.patcher.invoke
import app.revanced.patcher.literal
import app.revanced.patcher.methodCall
import app.revanced.patcher.opcode
@@ -33,10 +34,10 @@ internal val BytecodePatchContext.recyclerViewTopScrollingMethod by gettingFirst
parameterTypes()
instructions(
methodCall(smali = "Ljava/util/Iterator;->next()Ljava/lang/Object;"),
opcode(Opcode.MOVE_RESULT_OBJECT, MatchAfterImmediately()),
after(Opcode.MOVE_RESULT_OBJECT()),
checkCast("Landroid/support/v7/widget/RecyclerView;", MatchAfterImmediately()),
literal(0, location = MatchAfterImmediately()),
methodCall(definingClass = "Landroid/support/v7/widget/RecyclerView;", location = MatchAfterImmediately()),
opcode(Opcode.GOTO, MatchAfterImmediately()),
literal(0, after()),
methodCall(definingClass = "Landroid/support/v7/widget/RecyclerView;", after()),
after(Opcode.GOTO()),
)
}

View File

@@ -20,6 +20,6 @@ internal val BytecodePatchContext.unstableContentProviderMethod by gettingFirstM
name = "putAll",
parameters = listOf("Ljava/util/Map;"),
),
addString("ContentProvider query returned null cursor"),
"ContentProvider query returned null cursor"(),
)
}

View File

@@ -1,6 +1,5 @@
package app.revanced.patches.youtube.misc.gms
import app.revanced.patcher.InstructionLocation.*
import app.revanced.patcher.accessFlags
import app.revanced.patcher.gettingFirstMethodDeclaratively
import app.revanced.patcher.instructions
@@ -21,7 +20,7 @@ internal val BytecodePatchContext.specificNetworkErrorViewControllerMethod by ge
ResourceType.DRAWABLE("ic_offline_no_content_upside_down"),
ResourceType.STRING("offline_no_content_body_text_not_offline_eligible"),
methodCall(name = "getString", returnType = "Ljava/lang/String;"),
opcode(Opcode.MOVE_RESULT_OBJECT, location = MatchAfterImmediately()),
after(Opcode.MOVE_RESULT_OBJECT()),
)
}
@@ -35,6 +34,6 @@ internal val BytecodePatchContext.loadingFrameLayoutControllerMethod by gettingF
ResourceType.DRAWABLE("ic_offline_no_content_upside_down"),
ResourceType.STRING("offline_no_content_body_text_not_offline_eligible"),
methodCall(name = "getString", returnType = "Ljava/lang/String;"),
opcode(Opcode.MOVE_RESULT_OBJECT, MatchAfterImmediately()),
after(Opcode.MOVE_RESULT_OBJECT()),
)
}

View File

@@ -68,8 +68,8 @@ internal val BytecodePatchContext.messageDigestImageUrlParentMethod by gettingFi
parameterTypes()
instructions(
anyInstruction(
addString("@#&=*+-_.,:!?()/~'%;\$"),
addString("@#&=*+-_.,:!?()/~'%;\$[]"), // 20.38+
"@#&=*+-_.,:!?()/~'%;\$"(),
"@#&=*+-_.,:!?()/~'%;\$[]"(), // 20.38+
),
)
}

View File

@@ -19,7 +19,7 @@ internal val BytecodePatchContext.abUriParserLegacyMethod by gettingFirstMethodD
returnType("Ljava/lang/Object;")
parameterTypes("Ljava/lang/Object;")
instructions(
addString("Found entityKey=`"),
"Found entityKey=`"(),
addString("that does not contain a PlaylistVideoEntityId", comparison = StringComparisonType.CONTAINS),
methodCall(smali = "Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;"),
)
@@ -48,8 +48,8 @@ internal val BytecodePatchContext.httpUriParserMethod by gettingFirstMethodDecla
parameterTypes("Ljava/lang/String;")
instructions(
methodCall(smali = "Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;"),
addString("https"),
addString("://"),
addString("https:"),
"https"(),
"://"(),
"https:"(),
)
}

View File

@@ -17,8 +17,8 @@ import com.android.tools.smali.dexlib2.Opcode
internal val BytecodePatchContext.componentCreateMethod by gettingFirstMethodDeclaratively {
instructions(
addString("Element missing correct type extension"),
addString("Element missing type"),
"Element missing correct type extension"(),
"Element missing type"(),
)
}
@@ -62,7 +62,7 @@ internal val BytecodePatchContext.emptyComponentMethod by gettingFirstMethodDecl
accessFlags(AccessFlags.PRIVATE, AccessFlags.CONSTRUCTOR)
parameterTypes()
instructions(
addString("EmptyComponent"),
"EmptyComponent"(),
)
custom { _, classDef ->
classDef.methods.filter { AccessFlags.STATIC.isSet(it.accessFlags) }.size == 1

View File

@@ -1,9 +1,9 @@
package app.revanced.patches.youtube.misc.loopvideo
import app.revanced.patcher.accessFlags
import app.revanced.patcher.addString
import app.revanced.patcher.gettingFirstMethodDeclaratively
import app.revanced.patcher.instructions
import app.revanced.patcher.invoke
import app.revanced.patcher.patch.BytecodePatchContext
import app.revanced.patcher.returnType
import com.android.tools.smali.dexlib2.AccessFlags
@@ -12,7 +12,7 @@ internal val BytecodePatchContext.videoStartPlaybackMethod by gettingFirstMethod
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
returnType("V")
instructions(
addString("play() called when the player wasn't loaded."),
addString("play() blocked because Background Playability failed"),
"play() called when the player wasn't loaded."(),
"play() blocked because Background Playability failed"(),
)
}

View File

@@ -1,8 +1,6 @@
package app.revanced.patches.youtube.misc.navigation
import app.revanced.patcher.*
import app.revanced.patcher.InstructionLocation.MatchAfterImmediately
import app.revanced.patcher.InstructionLocation.MatchAfterWithin
import app.revanced.patcher.accessFlags
import app.revanced.patcher.gettingFirstMethodDeclaratively
import app.revanced.patcher.instructions
@@ -131,26 +129,26 @@ internal val BytecodePatchContext.pivotBarButtonsViewSetSelectedMethod by gettin
internal val BytecodePatchContext.pivotBarConstructorMethod by gettingFirstMethodDeclaratively {
accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
instructions(
addString("com.google.android.apps.youtube.app.endpoint.flags"),
"com.google.android.apps.youtube.app.endpoint.flags"(),
)
}
internal val BytecodePatchContext.imageEnumConstructorMethod by gettingFirstMethodDeclaratively {
accessFlags(AccessFlags.STATIC, AccessFlags.CONSTRUCTOR)
instructions(
addString("TAB_ACTIVITY_CAIRO"),
opcode(Opcode.INVOKE_DIRECT, location = MatchAfterImmediately()),
opcode(Opcode.SPUT_OBJECT, location = MatchAfterImmediately()),
"TAB_ACTIVITY_CAIRO"(),
after(Opcode.INVOKE_DIRECT()),
after(Opcode.SPUT_OBJECT()),
)
}
internal val BytecodePatchContext.setEnumMapMethod by gettingFirstMethodDeclaratively {
instructions(
ResourceType.DRAWABLE("yt_fill_bell_black_24"),
methodCall(smali = "Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;", location = MatchAfterWithin(10)),
methodCall(smali = "Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;", after(10)),
methodCall(
smali = "Ljava/util/EnumMap;->put(Ljava/lang/Enum;Ljava/lang/Object;)Ljava/lang/Object;",
location = MatchAfterWithin(10),
after(10),
),
)
}

View File

@@ -1,6 +1,5 @@
package app.revanced.patches.youtube.misc.playercontrols
import app.revanced.patcher.InstructionLocation.MatchAfterImmediately
import app.revanced.patcher.accessFlags
import app.revanced.patcher.checkCast
import app.revanced.patcher.gettingFirstMethodDeclaratively
@@ -74,7 +73,7 @@ internal val BytecodePatchContext.playerTopControlsInflateMethod by gettingFirst
instructions(
ResourceType.ID("controls_layout_stub"),
methodCall("Landroid/view/ViewStub;", "inflate"),
opcode(Opcode.MOVE_RESULT_OBJECT, MatchAfterImmediately()),
after(Opcode.MOVE_RESULT_OBJECT()),
)
}
@@ -84,7 +83,7 @@ internal val BytecodePatchContext.playerBottomControlsInflateMethod by gettingFi
instructions(
ResourceType.ID("bottom_ui_container_stub"),
methodCall("Landroid/view/ViewStub;", "inflate"),
opcode(Opcode.MOVE_RESULT_OBJECT, MatchAfterImmediately()),
after(Opcode.MOVE_RESULT_OBJECT()),
)
}

View File

@@ -1,11 +1,10 @@
package app.revanced.patches.youtube.misc.playertype
import app.revanced.patcher.InstructionLocation.MatchAfterWithin
import app.revanced.patcher.accessFlags
import app.revanced.patcher.addString
import app.revanced.patcher.after
import app.revanced.patcher.gettingFirstMethodDeclaratively
import app.revanced.patcher.instructions
import app.revanced.patcher.opcode
import app.revanced.patcher.invoke
import app.revanced.patcher.parameterTypes
import app.revanced.patcher.patch.BytecodePatchContext
import app.revanced.patcher.returnType
@@ -35,7 +34,7 @@ internal val BytecodePatchContext.reelWatchPagerMethod by gettingFirstMethodDecl
returnType("Landroid/view/View;")
instructions(
ResourceType.ID("reel_watch_player"),
opcode(Opcode.MOVE_RESULT_OBJECT, location = MatchAfterWithin(10)),
after(10, Opcode.MOVE_RESULT_OBJECT()),
)
}
@@ -58,7 +57,7 @@ internal val BytecodePatchContext.controlsStateToStringMethod by gettingFirstMet
parameterTypes()
returnType("Ljava/lang/String;")
instructions(
addString("videoState"),
addString("isBuffering"),
"videoState"(),
"isBuffering"(),
)
}

View File

@@ -1,7 +1,7 @@
package app.revanced.patches.youtube.misc.settings
import app.revanced.patcher.InstructionLocation.MatchAfterWithin
import app.revanced.patcher.accessFlags
import app.revanced.patcher.after
import app.revanced.patcher.gettingFirstMethodDeclaratively
import app.revanced.patcher.instructions
import app.revanced.patcher.invoke
@@ -36,7 +36,8 @@ internal val BytecodePatchContext.cairoFragmentConfigMethod by gettingFirstMetho
returnType("Z")
instructions(
45532100L(),
opcode(Opcode.MOVE_RESULT, location = MatchAfterWithin(10)),
after(10, Opcode.MOVE_RESULT()),
)
}

View File

@@ -1,12 +1,7 @@
package app.revanced.patches.youtube.video.playerresponse
import app.revanced.patcher.accessFlags
import app.revanced.patcher.addString
import app.revanced.patcher.gettingFirstMethodDeclaratively
import app.revanced.patcher.instructions
import app.revanced.patcher.parameterTypes
import app.revanced.patcher.*
import app.revanced.patcher.patch.BytecodePatchContext
import app.revanced.patcher.returnType
import com.android.tools.smali.dexlib2.AccessFlags
/**
@@ -31,7 +26,7 @@ internal val BytecodePatchContext.playerParameterBuilderMethod by gettingFirstMe
"Z", // Appears to indicate if the video id is being opened or is currently playing.
"Z",
"Z",
"Lj\$/time/Duration;",
"Lj$/time/Duration;",
)
}
@@ -57,11 +52,9 @@ internal val BytecodePatchContext.playerParameterBuilder2026Method by gettingFir
"Z", // Appears to indicate if the video id is being opened or is currently playing.
"Z",
"Z",
"Lj\$/time/Duration;",
)
instructions(
addString("psps"),
"Lj$/time/Duration;",
)
instructions("psps"())
}
/**
@@ -87,9 +80,7 @@ internal val BytecodePatchContext.playerParameterBuilder2015Method by gettingFir
"Z",
"Z",
)
instructions(
addString("psps"),
)
instructions("psps"())
}
/**
@@ -116,9 +107,7 @@ internal val BytecodePatchContext.playerParameterBuilder2010Method by gettingFir
"Z",
"Z",
)
instructions(
addString("psps"),
)
instructions("psps"())
}
/**
@@ -144,9 +133,7 @@ internal val BytecodePatchContext.playerParameterBuilder2002Method by gettingFir
"Z",
"Z",
)
instructions(
addString("psps"),
)
instructions("psps"())
}
/**
@@ -171,9 +158,7 @@ internal val BytecodePatchContext.playerParameterBuilder1925Method by gettingFir
"Z",
"Z",
)
instructions(
addString("psps"),
)
instructions("psps"())
}
/**

View File

@@ -15,7 +15,7 @@ import com.android.tools.smali.dexlib2.Opcode
internal val BytecodePatchContext.videoQualityItemOnClickParentMethod by gettingFirstMethodDeclaratively {
returnType("V")
instructions(
addString("VIDEO_QUALITIES_MENU_BOTTOM_SHEET_FRAGMENT"),
"VIDEO_QUALITIES_MENU_BOTTOM_SHEET_FRAGMENT"(),
)
}

View File

@@ -47,7 +47,7 @@ internal val BytecodePatchContext.speedArrayGeneratorMethod by gettingFirstMetho
instructions(
methodCall(name = "size", returnType = "I"),
newInstance("Ljava/text/DecimalFormat;"),
addString("0.0#"),
"0.0#"(),
7L(),
Opcode.NEW_ARRAY(),
fieldAccess(definingClass = "/PlayerConfigModel;", type = "[F"),

View File

@@ -9,6 +9,6 @@ import app.revanced.patcher.patch.BytecodePatchContext
internal val BytecodePatchContext.initializePlaybackSpeedValuesMethod by gettingFirstMethodDeclaratively {
parameterTypes("[L", "I")
instructions(
addString("menu_item_playback_speed"),
"menu_item_playback_speed"(),
)
}