mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-27 12:41:03 +00:00
made by AI
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
package app.revanced.patches.instagram.feed
|
||||
|
||||
import app.revanced.patcher.classDef
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.getInstruction
|
||||
import app.revanced.patcher.firstMutableMethodDeclaratively
|
||||
import app.revanced.patcher.name
|
||||
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||
import app.revanced.patches.instagram.misc.extension.sharedExtensionPatch
|
||||
import app.revanced.util.getReference
|
||||
@@ -33,20 +34,16 @@ val `Limit feed to followed profiles` by creatingBytecodePatch(
|
||||
mainFeedRequestHeaderFieldName = indexOfFirstInstructionOrThrow {
|
||||
getReference<FieldReference>().let { ref ->
|
||||
ref?.type == "Ljava/util/Map;" &&
|
||||
ref.definingClass == mainFeedRequestClassMethod.classDef.toString()
|
||||
ref.definingClass == mainFeedRequestClassMethod.immutableClassDef.toString()
|
||||
}
|
||||
}.let { instructionIndex ->
|
||||
getInstruction(instructionIndex).getReference<FieldReference>()!!.name
|
||||
}
|
||||
}
|
||||
|
||||
val initMainFeedRequestMethod = fingerprint {
|
||||
custom { method, classDef ->
|
||||
method.name == "<init>" &&
|
||||
classDef == mainFeedRequestClassMethod.classDef
|
||||
}
|
||||
}
|
||||
initMainFeedRequestMethod.apply {
|
||||
mainFeedRequestClassMethod.immutableClassDef.firstMutableMethodDeclaratively {
|
||||
name("<init>")
|
||||
}.apply {
|
||||
// Finds the instruction where the map is being initialized in the constructor
|
||||
val getHeaderIndex = indexOfFirstInstructionOrThrow {
|
||||
getReference<FieldReference>().let {
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
|
||||
package app.revanced.patches.instagram.hide.navigation
|
||||
|
||||
import app.revanced.patcher.accessFlags
|
||||
import app.revanced.patcher.gettingFirstMethodDeclaratively
|
||||
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
|
||||
|
||||
internal val BytecodePatchContext.initializeNavigationButtonsListMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.initializeNavigationButtonsListMethod by gettingFirstMutableMethodDeclaratively {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
parameterTypes("Lcom/instagram/common/session/UserSession;", "Z")
|
||||
returnType("Ljava/util/List;")
|
||||
}
|
||||
|
||||
internal val navigationButtonsEnumClassDef = fingerprint {
|
||||
strings("FEED", "fragment_feed", "SEARCH", "fragment_search")
|
||||
}
|
||||
internal val navigationButtonsEnumClassDefMatch = firstMethodComposite(
|
||||
"FEED", "fragment_feed", "SEARCH", "fragment_search",
|
||||
)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package app.revanced.patches.instagram.hide.navigation
|
||||
|
||||
import app.revanced.patcher.extensions.getInstruction
|
||||
import app.revanced.patcher.firstMutableMethodDeclaratively
|
||||
import app.revanced.patcher.name
|
||||
import app.revanced.patcher.patch.booleanOption
|
||||
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||
import app.revanced.patches.instagram.misc.extension.sharedExtensionPatch
|
||||
@@ -71,20 +73,14 @@ val `Hide navigation buttons` by creatingBytecodePatch(
|
||||
|
||||
// Get the field name which contains the name of the enum for the navigation button
|
||||
// ("fragment_clips", "fragment_share", ...)
|
||||
val navigationButtonsEnumInitFingerprint = fingerprint {
|
||||
custom { method, classDef ->
|
||||
method.name == "<init>" &&
|
||||
classDef == navigationButtonsEnumClassDef.classDef
|
||||
}
|
||||
}
|
||||
|
||||
val enumNameField: String
|
||||
with(navigationButtonsEnumInitFingerprint.method) {
|
||||
enumNameField = indexOfFirstInstructionOrThrow {
|
||||
val enumNameField = navigationButtonsEnumClassDefMatch.classDef.firstMutableMethodDeclaratively {
|
||||
name("<init>")
|
||||
}.let { method ->
|
||||
method.indexOfFirstInstructionOrThrow {
|
||||
opcode == Opcode.IPUT_OBJECT &&
|
||||
(this as TwoRegisterInstruction).registerA == 2 // p2 register.
|
||||
}.let {
|
||||
getInstruction(it).getReference<FieldReference>()!!.name
|
||||
method.getInstruction(it).getReference<FieldReference>()!!.name
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package app.revanced.patches.instagram.hide.stories
|
||||
import app.revanced.patcher.*
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal val getOrCreateAvatarViewMethod = firstMethodComposite {
|
||||
internal val getOrCreateAvatarViewMethodMatch = firstMethodComposite {
|
||||
definingClass("Lcom/instagram/reels/ui/views/reelavatar/RecyclerReelAvatarView;")
|
||||
parameterTypes()
|
||||
returnType("L")
|
||||
|
||||
@@ -11,9 +11,11 @@ val `Hide Stories from Home` by creatingBytecodePatch(
|
||||
compatibleWith("com.instagram.android")
|
||||
|
||||
apply {
|
||||
val addStoryEndIndex = getOrCreateAvatarViewMethod.indices.last()
|
||||
getOrCreateAvatarViewMethodMatch.let {
|
||||
val addStoryEndIndex = it.indices.last()
|
||||
|
||||
// Remove addView of Story.
|
||||
getOrCreateAvatarViewMethod.removeInstruction(addStoryEndIndex)
|
||||
// Remove addView of Story.
|
||||
it.method.removeInstruction(addStoryEndIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import app.revanced.patcher.patch.creatingBytecodePatch
|
||||
import app.revanced.util.Utils.trimIndentMultiline
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
|
||||
import app.revanced.util.indexOfFirstStringInstruction
|
||||
import app.revanced.util.returnEarly
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
@@ -20,8 +21,9 @@ val `Enable developer menu` by creatingBytecodePatch(
|
||||
compatibleWith("com.instagram.android")
|
||||
|
||||
apply {
|
||||
with(clearNotificationReceiverMethod) {
|
||||
indexOfFirstInstructionReversedOrThrow(clearNotificationReceiverMethod.stringMatches.first().index) {
|
||||
clearNotificationReceiverMethod.apply {
|
||||
val stringIndex = indexOfFirstStringInstruction("NOTIFICATION_DISMISSED")
|
||||
indexOfFirstInstructionReversedOrThrow(stringIndex) {
|
||||
val reference = getReference<MethodReference>()
|
||||
opcode in listOf(Opcode.INVOKE_STATIC, Opcode.INVOKE_STATIC_RANGE) &&
|
||||
reference?.parameterTypes?.size == 1 &&
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
|
||||
package app.revanced.patches.instagram.misc.devmenu
|
||||
|
||||
internal val BytecodePatchContext.clearNotificationReceiverMethod by gettingFirstMethodDeclaratively {
|
||||
custom { method, classDef ->
|
||||
method.name == "onReceive" &&
|
||||
classDef.type == "Lcom/instagram/notifications/push/ClearNotificationReceiver;"
|
||||
}
|
||||
strings("NOTIFICATION_DISMISSED")
|
||||
import app.revanced.patcher.*
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
|
||||
internal val BytecodePatchContext.clearNotificationReceiverMethod by gettingFirstMutableMethodDeclaratively(
|
||||
"NOTIFICATION_DISMISSED",
|
||||
) {
|
||||
name("onReceive")
|
||||
definingClass("Lcom/instagram/notifications/push/ClearNotificationReceiver;")
|
||||
}
|
||||
|
||||
@@ -21,27 +21,25 @@ val `Open links externally` by creatingBytecodePatch(
|
||||
compatibleWith("com.instagram.android")
|
||||
|
||||
apply {
|
||||
inAppBrowserFunctionMethodMatch.let {
|
||||
val stringMatchIndex = it.stringMatches?.first { match -> match.string == TARGET_STRING }!!.index
|
||||
inAppBrowserFunctionMethodMatch.method.apply {
|
||||
val stringMatchIndex = inAppBrowserFunctionMethodMatch.indices.first()
|
||||
|
||||
it.method.apply {
|
||||
val urlResultObjIndex = indexOfFirstInstructionOrThrow(
|
||||
stringMatchIndex,
|
||||
Opcode.MOVE_OBJECT_FROM16,
|
||||
)
|
||||
val urlResultObjIndex = indexOfFirstInstructionOrThrow(
|
||||
stringMatchIndex,
|
||||
Opcode.MOVE_OBJECT_FROM16,
|
||||
)
|
||||
|
||||
// Register that contains the url after moving from a higher register.
|
||||
val urlRegister = getInstruction<TwoRegisterInstruction>(urlResultObjIndex).registerA
|
||||
// Register that contains the url after moving from a higher register.
|
||||
val urlRegister = getInstruction<TwoRegisterInstruction>(urlResultObjIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
urlResultObjIndex + 1,
|
||||
"""
|
||||
invoke-static { v$urlRegister }, $EXTENSION_CLASS_DESCRIPTOR->openExternally(Ljava/lang/String;)Z
|
||||
move-result v$urlRegister
|
||||
return v$urlRegister
|
||||
""",
|
||||
)
|
||||
}
|
||||
addInstructions(
|
||||
urlResultObjIndex + 1,
|
||||
"""
|
||||
invoke-static { v$urlRegister }, $EXTENSION_CLASS_DESCRIPTOR->openExternally(Ljava/lang/String;)Z
|
||||
move-result v$urlRegister
|
||||
return v$urlRegister
|
||||
""",
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,23 +3,24 @@ package app.revanced.patches.instagram.misc.share
|
||||
import app.revanced.patcher.extensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import app.revanced.util.indexOfFirstInstruction
|
||||
import app.revanced.util.indexOfFirstStringInstruction
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.mutable.MutableMethod
|
||||
|
||||
context(BytecodePatchContext)
|
||||
context(_: BytecodePatchContext)
|
||||
internal fun editShareLinksPatch(block: MutableMethod.(index: Int, register: Int) -> Unit) {
|
||||
val fingerprintsToPatch = arrayOf(
|
||||
val methodsToPatch = arrayOf(
|
||||
permalinkResponseJsonParserMethod,
|
||||
storyUrlResponseJsonParserMethod,
|
||||
profileUrlResponseJsonParserMethod,
|
||||
liveUrlResponseJsonParserMethod,
|
||||
)
|
||||
|
||||
for (fingerprint in fingerprintsToPatch) {
|
||||
fingerprint.method.apply {
|
||||
for (method in methodsToPatch) {
|
||||
method.apply {
|
||||
val putSharingUrlIndex = indexOfFirstInstruction(
|
||||
permalinkResponseJsonParserMethod.stringMatches.first().index,
|
||||
indexOfFirstStringInstruction("permalink"),
|
||||
Opcode.IPUT_OBJECT,
|
||||
)
|
||||
|
||||
|
||||
@@ -1,23 +1,28 @@
|
||||
package app.revanced.patches.instagram.misc.share
|
||||
|
||||
import com.google.common.util.concurrent.Striped.custom
|
||||
import app.revanced.patcher.*
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
|
||||
internal val BytecodePatchContext.permalinkResponseJsonParserMethod by gettingFirstMethodDeclaratively {
|
||||
strings("permalink", "PermalinkResponse")
|
||||
custom { method, _ -> method.name == "parseFromJson" }
|
||||
internal val BytecodePatchContext.permalinkResponseJsonParserMethod by gettingFirstMutableMethodDeclaratively(
|
||||
"permalink", "PermalinkResponse",
|
||||
) {
|
||||
name("parseFromJson")
|
||||
}
|
||||
|
||||
internal val BytecodePatchContext.storyUrlResponseJsonParserMethod by gettingFirstMethodDeclaratively {
|
||||
strings("story_item_to_share_url", "StoryItemUrlResponse")
|
||||
custom { method, _ -> method.name == "parseFromJson" }
|
||||
internal val BytecodePatchContext.storyUrlResponseJsonParserMethod by gettingFirstMutableMethodDeclaratively(
|
||||
"story_item_to_share_url", "StoryItemUrlResponse",
|
||||
) {
|
||||
name("parseFromJson")
|
||||
}
|
||||
|
||||
internal val BytecodePatchContext.profileUrlResponseJsonParserMethod by gettingFirstMethodDeclaratively {
|
||||
strings("profile_to_share_url", "ProfileUrlResponse")
|
||||
custom { method, _ -> method.name == "parseFromJson" }
|
||||
internal val BytecodePatchContext.profileUrlResponseJsonParserMethod by gettingFirstMutableMethodDeclaratively(
|
||||
"profile_to_share_url", "ProfileUrlResponse",
|
||||
) {
|
||||
name("parseFromJson")
|
||||
}
|
||||
|
||||
internal val BytecodePatchContext.liveUrlResponseJsonParserMethod by gettingFirstMethodDeclaratively {
|
||||
strings("live_to_share_url", "LiveItemLinkUrlResponse")
|
||||
custom { method, _ -> method.name == "parseFromJson" }
|
||||
internal val BytecodePatchContext.liveUrlResponseJsonParserMethod by gettingFirstMutableMethodDeclaratively(
|
||||
"live_to_share_url", "LiveItemLinkUrlResponse",
|
||||
) {
|
||||
name("parseFromJson")
|
||||
}
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
package app.revanced.patches.instagram.misc.share.domain
|
||||
|
||||
import app.revanced.patcher.accessFlags
|
||||
import app.revanced.patcher.gettingFirstMethodDeclaratively
|
||||
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
|
||||
|
||||
internal val BytecodePatchContext.getCustomShareDomainMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.getCustomShareDomainMethod by gettingFirstMutableMethodDeclaratively {
|
||||
accessFlags(AccessFlags.PRIVATE, AccessFlags.STATIC)
|
||||
returnType("Ljava/lang/String;")
|
||||
parameterTypes()
|
||||
custom { method, classDef ->
|
||||
method.name == "getCustomShareDomain" && classDef.type == EXTENSION_CLASS_DESCRIPTOR
|
||||
}
|
||||
name("getCustomShareDomain")
|
||||
definingClass(EXTENSION_CLASS_DESCRIPTOR)
|
||||
}
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
package app.revanced.patches.instagram.misc.signature
|
||||
|
||||
import app.revanced.patcher.gettingFirstMethodDeclaratively
|
||||
import app.revanced.patcher.parameterTypes
|
||||
import app.revanced.patcher.*
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import app.revanced.patcher.returnType
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.indexOfFirstInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
|
||||
internal val BytecodePatchContext.isValidSignatureClassMethod by gettingFirstMethodDeclaratively {
|
||||
strings("The provider for uri '", "' is not trusted: ")
|
||||
}
|
||||
internal val isValidSignatureClassMethodMatch = firstMethodComposite(
|
||||
"The provider for uri '", "' is not trusted: ",
|
||||
)
|
||||
|
||||
internal val BytecodePatchContext.isValidSignatureMethodMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.isValidSignatureMethodMethod by gettingFirstMutableMethodDeclaratively {
|
||||
parameterTypes("L", "Z")
|
||||
returnType("Z")
|
||||
custom { method, _ ->
|
||||
method.indexOfFirstInstruction {
|
||||
custom {
|
||||
indexOfFirstInstruction {
|
||||
getReference<MethodReference>()?.name == "keySet"
|
||||
} >= 0
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ val `Disable signature check` by creatingBytecodePatch(
|
||||
|
||||
apply {
|
||||
isValidSignatureMethodMethod
|
||||
.match(isValidSignatureClassMethod.classDef)
|
||||
.match(isValidSignatureClassMethodMatch.classDef)
|
||||
.method
|
||||
.returnEarly(true)
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
package app.revanced.patches.messenger.metaai
|
||||
|
||||
import app.revanced.patcher.*
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal val BytecodePatchContext.getMobileConfigBoolMethod by gettingFirstMutableMethodDeclaratively {
|
||||
internal val getMobileConfigBoolMethodMatch = firstMethodComposite {
|
||||
returnType("Z")
|
||||
opcodes(Opcode.RETURN)
|
||||
custom { "Lcom/facebook/mobileconfig/factory/MobileConfigUnsafeContext;" in immutableClassDef.interfaces }
|
||||
}
|
||||
|
||||
internal val BytecodePatchContext.metaAIKillSwitchCheckMethod by gettingFirstMutableMethodDeclaratively("SearchAiagentImplementationsKillSwitch") {
|
||||
internal val metaAIKillSwitchCheckMethodMatch = firstMethodComposite("SearchAiagentImplementationsKillSwitch") {
|
||||
opcodes(Opcode.CONST_WIDE)
|
||||
}
|
||||
internal val BytecodePatchContext.extensionMethodMethod by gettingFirstMutableMethodDeclaratively("REPLACED_BY_PATCH") {
|
||||
|
||||
internal val extensionMethodMethodMatch = firstMethodComposite("REPLACED_BY_PATCH") {
|
||||
name(EXTENSION_METHOD_NAME)
|
||||
definingClass(EXTENSION_CLASS_DESCRIPTOR)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package app.revanced.patches.messenger.metaai
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.getInstruction
|
||||
import app.revanced.patcher.extensions.replaceInstruction
|
||||
import app.revanced.patcher.method
|
||||
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||
import app.revanced.patches.messenger.misc.extension.sharedExtensionPatch
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@@ -21,11 +20,11 @@ val `Remove Meta AI` by creatingBytecodePatch(
|
||||
dependsOn(sharedExtensionPatch)
|
||||
|
||||
apply {
|
||||
getMobileConfigBoolMethod.apply {
|
||||
val returnIndex = getMobileConfigBoolMethod.patternMatch.startIndex // TODO
|
||||
val returnRegister = getInstruction<OneRegisterInstruction>(returnIndex).registerA
|
||||
getMobileConfigBoolMethodMatch.let {
|
||||
val returnIndex = it.indices.first()
|
||||
val returnRegister = it.method.getInstruction<OneRegisterInstruction>(returnIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
it.method.addInstructions(
|
||||
returnIndex,
|
||||
"""
|
||||
invoke-static { p1, p2, v$returnRegister }, $EXTENSION_CLASS_DESCRIPTOR->$EXTENSION_METHOD_NAME(JZ)Z
|
||||
@@ -35,16 +34,18 @@ val `Remove Meta AI` by creatingBytecodePatch(
|
||||
}
|
||||
|
||||
// Extract the common starting digits of Meta AI flag IDs from a flag found in code.
|
||||
val relevantDigits = with(metaAIKillSwitchCheckMethod) {
|
||||
method.getInstruction<WideLiteralInstruction>(patternMatch.startIndex).wideLiteral // TODO
|
||||
val relevantDigits = metaAIKillSwitchCheckMethodMatch.let {
|
||||
it.method.getInstruction<WideLiteralInstruction>(it.indices.first()).wideLiteral
|
||||
}.toString().substring(0, 7)
|
||||
|
||||
// Replace placeholder in the extension method.
|
||||
extensionMethodMethod.replaceInstruction(
|
||||
stringM.first().index, // TODO
|
||||
"""
|
||||
extensionMethodMethodMatch.let {
|
||||
it.method.replaceInstruction(
|
||||
it.indices.first(),
|
||||
"""
|
||||
const-string v1, "$relevantDigits"
|
||||
""",
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,22 @@
|
||||
package app.revanced.patches.youtube.layout.startpage
|
||||
|
||||
import app.revanced.patcher.gettingFirstMethodDeclaratively
|
||||
import app.revanced.patcher.instructions
|
||||
import app.revanced.patcher.invoke
|
||||
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.Opcode
|
||||
|
||||
internal val BytecodePatchContext.intentActionMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.intentActionMethod by gettingFirstMutableMethodDeclaratively(
|
||||
"has_handled_intent",
|
||||
) {
|
||||
parameterTypes("Landroid/content/Intent;")
|
||||
instructions(
|
||||
"has_handled_intent"(),
|
||||
)
|
||||
}
|
||||
|
||||
internal val BytecodePatchContext.browseIdMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.browseIdMethod by gettingFirstMutableMethodDeclaratively(
|
||||
"FEwhat_to_watch",
|
||||
) {
|
||||
returnType("Lcom/google/android/apps/youtube/app/common/ui/navigation/PaneDescriptor;")
|
||||
|
||||
// parameterTypes() // 20.30 and earlier is no parameters. 20.31+ parameter is L.
|
||||
instructions(
|
||||
"FEwhat_to_watch"(),
|
||||
512(),
|
||||
fieldAccess(opcode = Opcode.IPUT_OBJECT, type = "Ljava/lang/String;"),
|
||||
512L(),
|
||||
allOf(Opcode.IPUT_OBJECT(), field { type == "Ljava/lang/String;" }),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,21 +1,16 @@
|
||||
package app.revanced.patches.youtube.layout.theme
|
||||
|
||||
import app.revanced.patcher.anyInstruction
|
||||
import app.revanced.patcher.gettingFirstMethodDeclaratively
|
||||
import app.revanced.patcher.instructions
|
||||
import app.revanced.patcher.invoke
|
||||
import app.revanced.patcher.parameterTypes
|
||||
import app.revanced.patcher.*
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import app.revanced.patcher.returnType
|
||||
import app.revanced.patches.youtube.shared.YOUTUBE_MAIN_ACTIVITY_CLASS_TYPE
|
||||
|
||||
internal val BytecodePatchContext.useGradientLoadingScreenMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.useGradientLoadingScreenMethod by gettingFirstMutableMethodDeclaratively {
|
||||
instructions(
|
||||
45412406L(),
|
||||
)
|
||||
}
|
||||
|
||||
internal val BytecodePatchContext.splashScreenStyleMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.splashScreenStyleMethod by gettingFirstMutableMethodDeclaratively {
|
||||
returnType("V")
|
||||
parameterTypes("Landroid/os/Bundle;")
|
||||
instructions(
|
||||
@@ -24,7 +19,6 @@ internal val BytecodePatchContext.splashScreenStyleMethod by gettingFirstMethodD
|
||||
269032877L(), // 20.29 and lower.
|
||||
),
|
||||
)
|
||||
custom { method, classDef ->
|
||||
method.name == "onCreate" && classDef.type == YOUTUBE_MAIN_ACTIVITY_CLASS_TYPE
|
||||
}
|
||||
definingClass(YOUTUBE_MAIN_ACTIVITY_CLASS_TYPE)
|
||||
name("onCreate")
|
||||
}
|
||||
|
||||
@@ -200,21 +200,17 @@ val themePatch = baseThemePatch(
|
||||
)
|
||||
}
|
||||
|
||||
useGradientLoadingScreenMethod.let {
|
||||
it.method.insertLiteralOverride(
|
||||
it.instructionMatches.first().index,
|
||||
"$EXTENSION_CLASS_DESCRIPTOR->gradientLoadingScreenEnabled(Z)Z",
|
||||
)
|
||||
}
|
||||
useGradientLoadingScreenMethod.insertLiteralOverride(
|
||||
45412406L,
|
||||
"$EXTENSION_CLASS_DESCRIPTOR->gradientLoadingScreenEnabled(Z)Z",
|
||||
)
|
||||
|
||||
if (is_19_47_or_greater) {
|
||||
// Lottie splash screen exists in earlier versions, but it may not be always on.
|
||||
splashScreenStyleMethod.let {
|
||||
it.method.insertLiteralOverride(
|
||||
it.instructionMatches.first().index,
|
||||
"$EXTENSION_CLASS_DESCRIPTOR->getLoadingScreenType(I)I",
|
||||
)
|
||||
}
|
||||
splashScreenStyleMethod.insertLiteralOverride(
|
||||
1074339245L,
|
||||
"$EXTENSION_CLASS_DESCRIPTOR->getLoadingScreenType(I)I",
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
package app.revanced.patches.youtube.misc.dimensions.spoof
|
||||
|
||||
import app.revanced.patcher.gettingFirstMethodDeclaratively
|
||||
import app.revanced.patcher.instructions
|
||||
import app.revanced.patcher.*
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import app.revanced.patcher.returnType
|
||||
|
||||
internal val BytecodePatchContext.deviceDimensionsModelToStringMethod by gettingFirstMethodDeclaratively {
|
||||
// Strings are partial matches (format delimiters), so keep in instructions block.
|
||||
internal val deviceDimensionsModelToStringMethodMatch = firstMethodComposite {
|
||||
returnType("L")
|
||||
instructions(
|
||||
"minh."(),
|
||||
";maxh."(),
|
||||
)
|
||||
strings {
|
||||
+"minh."
|
||||
+";maxh."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,8 +38,7 @@ val `Spoof device dimensions` by creatingBytecodePatch(
|
||||
SwitchPreference("revanced_spoof_device_dimensions"),
|
||||
)
|
||||
|
||||
deviceDimensionsModelToStringMethod
|
||||
.classDef.methods.first { method -> method.name == "<init>" }
|
||||
deviceDimensionsModelToStringMethodMatch.classDef.methods.first { method -> method.name == "<init>" }
|
||||
// Override the parameters containing the dimensions.
|
||||
.addInstructions(
|
||||
1, // Add after super call.
|
||||
|
||||
@@ -30,21 +30,19 @@ internal val accountCredentialsInvalidTextPatch = bytecodePatch {
|
||||
// MicroG accounts look almost identical to Google device accounts
|
||||
// and it's more foolproof to instead uninstall/reinstall.
|
||||
arrayOf(
|
||||
specificNetworkErrorViewControllerMethod,
|
||||
loadingFrameLayoutControllerMethod,
|
||||
).forEach { fingerprint ->
|
||||
fingerprint.apply {
|
||||
val index = indices.last()
|
||||
val register = method.getInstruction<OneRegisterInstruction>(index).registerA
|
||||
specificNetworkErrorViewControllerMethodMatch,
|
||||
loadingFrameLayoutControllerMethodMatch,
|
||||
).forEach { match ->
|
||||
val index = match.indices.last()
|
||||
val register = match.method.getInstruction<OneRegisterInstruction>(index).registerA
|
||||
|
||||
method.addInstructions(
|
||||
index + 1,
|
||||
"""
|
||||
invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->getOfflineNetworkErrorString(Ljava/lang/String;)Ljava/lang/String;
|
||||
move-result-object v$register
|
||||
""",
|
||||
)
|
||||
}
|
||||
match.method.addInstructions(
|
||||
index + 1,
|
||||
"""
|
||||
invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->getOfflineNetworkErrorString(Ljava/lang/String;)Ljava/lang/String;
|
||||
move-result-object v$register
|
||||
""",
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,37 +1,33 @@
|
||||
package app.revanced.patches.youtube.misc.gms
|
||||
|
||||
import app.revanced.patcher.accessFlags
|
||||
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 app.revanced.patches.shared.misc.mapping.ResourceType
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal val BytecodePatchContext.specificNetworkErrorViewControllerMethod by gettingFirstMethodDeclaratively {
|
||||
internal val specificNetworkErrorViewControllerMethodMatch = firstMethodComposite {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("V")
|
||||
parameterTypes()
|
||||
instructions(
|
||||
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;"),
|
||||
after(Opcode.MOVE_RESULT_OBJECT()),
|
||||
method { name == "getString" && returnType == "Ljava/lang/String;" },
|
||||
Opcode.MOVE_RESULT_OBJECT(),
|
||||
)
|
||||
}
|
||||
|
||||
// It's not clear if this second class is ever used and it may be dead code,
|
||||
// but it the layout image/text is identical to the network error fingerprint above.
|
||||
internal val BytecodePatchContext.loadingFrameLayoutControllerMethod by gettingFirstMethodDeclaratively {
|
||||
internal val loadingFrameLayoutControllerMethodMatch = firstMethodComposite {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("V")
|
||||
parameterTypes("L")
|
||||
instructions(
|
||||
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;"),
|
||||
after(Opcode.MOVE_RESULT_OBJECT()),
|
||||
method { name == "getString" && returnType == "Ljava/lang/String;" },
|
||||
Opcode.MOVE_RESULT_OBJECT(),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -52,19 +52,17 @@ val `Disable haptic feedback` by creatingBytecodePatch(
|
||||
scrubbingHapticsMethod to "disablePreciseSeekingVibrate",
|
||||
seekUndoHapticsMethod to "disableSeekUndoVibrate",
|
||||
zoomHapticsMethod to "disableZoomVibrate",
|
||||
).forEach { (fingerprint, methodName) ->
|
||||
fingerprint.method.apply {
|
||||
addInstructionsWithLabels(
|
||||
0,
|
||||
"""
|
||||
invoke-static {}, $EXTENSION_CLASS_DESCRIPTOR->$methodName()Z
|
||||
move-result v0
|
||||
if-eqz v0, :vibrate
|
||||
return-void
|
||||
""",
|
||||
ExternalLabel("vibrate", getInstruction(0)),
|
||||
)
|
||||
}
|
||||
).forEach { (method, methodName) ->
|
||||
method.addInstructionsWithLabels(
|
||||
0,
|
||||
"""
|
||||
invoke-static {}, $EXTENSION_CLASS_DESCRIPTOR->$methodName()Z
|
||||
move-result v0
|
||||
if-eqz v0, :vibrate
|
||||
return-void
|
||||
""",
|
||||
ExternalLabel("vibrate", method.getInstruction(0)),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,28 @@
|
||||
package app.revanced.patches.youtube.misc.hapticfeedback
|
||||
|
||||
internal val BytecodePatchContext.markerHapticsMethod by gettingFirstMethodDeclaratively {
|
||||
import app.revanced.patcher.*
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
|
||||
internal val BytecodePatchContext.markerHapticsMethod by gettingFirstMutableMethodDeclaratively(
|
||||
"Failed to execute markers haptics vibrate.",
|
||||
) {
|
||||
returnType("V")
|
||||
strings("Failed to execute markers haptics vibrate.")
|
||||
}
|
||||
|
||||
internal val BytecodePatchContext.scrubbingHapticsMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.scrubbingHapticsMethod by gettingFirstMutableMethodDeclaratively(
|
||||
"Failed to haptics vibrate for fine scrubbing.",
|
||||
) {
|
||||
returnType("V")
|
||||
strings("Failed to haptics vibrate for fine scrubbing.")
|
||||
}
|
||||
|
||||
internal val BytecodePatchContext.seekUndoHapticsMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.seekUndoHapticsMethod by gettingFirstMutableMethodDeclaratively(
|
||||
"Failed to execute seek undo haptics vibrate.",
|
||||
) {
|
||||
returnType("V")
|
||||
strings("Failed to execute seek undo haptics vibrate.")
|
||||
}
|
||||
|
||||
internal val BytecodePatchContext.zoomHapticsMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.zoomHapticsMethod by gettingFirstMutableMethodDeclaratively(
|
||||
"Failed to haptics vibrate for video zoom",
|
||||
) {
|
||||
returnType("V")
|
||||
strings("Failed to haptics vibrate for video zoom")
|
||||
}
|
||||
|
||||
@@ -31,13 +31,13 @@ val cronetImageUrlHookPatch = bytecodePatch(
|
||||
|
||||
apply {
|
||||
loadImageUrlMethod = messageDigestImageUrlMethod
|
||||
.match(messageDigestImageUrlParentMethod.immutableClassDef).method
|
||||
.match(messageDigestImageUrlParentMethodMatch.classDef)
|
||||
|
||||
loadImageSuccessCallbackMethod = onSucceededMethod
|
||||
.match(onResponseStartedMethod.immutableClassDef).method
|
||||
.match(onResponseStartedMethodMatch.classDef)
|
||||
|
||||
loadImageErrorCallbackMethod = onFailureMethod
|
||||
.match(onResponseStartedMethod.immutableClassDef).method
|
||||
.match(onResponseStartedMethodMatch.classDef)
|
||||
|
||||
// The URL is required for the failure callback hook, but the URL field is obfuscated.
|
||||
// Add a helper get method that returns the URL field.
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
package app.revanced.patches.youtube.misc.imageurlhook
|
||||
|
||||
import app.revanced.patcher.accessFlags
|
||||
import app.revanced.patcher.anyInstruction
|
||||
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
|
||||
|
||||
internal val BytecodePatchContext.onFailureMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.onFailureMethod by gettingFirstMutableMethodDeclaratively {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("V")
|
||||
parameterTypes(
|
||||
@@ -17,58 +12,49 @@ internal val BytecodePatchContext.onFailureMethod by gettingFirstMethodDeclarati
|
||||
"Lorg/chromium/net/UrlResponseInfo;",
|
||||
"Lorg/chromium/net/CronetException;",
|
||||
)
|
||||
custom { method, _ ->
|
||||
method.name == "onFailed"
|
||||
}
|
||||
name("onFailed")
|
||||
}
|
||||
|
||||
// Acts as a parent fingerprint.
|
||||
internal val BytecodePatchContext.onResponseStartedMethod by gettingFirstMethodDeclaratively {
|
||||
internal val onResponseStartedMethodMatch = firstMethodComposite(
|
||||
"Content-Length",
|
||||
"Content-Type",
|
||||
"identity",
|
||||
"application/x-protobuf",
|
||||
) {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("V")
|
||||
parameterTypes("Lorg/chromium/net/UrlRequest;", "Lorg/chromium/net/UrlResponseInfo;")
|
||||
strings(
|
||||
"Content-Length",
|
||||
"Content-Type",
|
||||
"identity",
|
||||
"application/x-protobuf",
|
||||
)
|
||||
custom { method, _ ->
|
||||
method.name == "onResponseStarted"
|
||||
}
|
||||
name("onResponseStarted")
|
||||
}
|
||||
|
||||
internal val BytecodePatchContext.onSucceededMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.onSucceededMethod by gettingFirstMutableMethodDeclaratively {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("V")
|
||||
parameterTypes("Lorg/chromium/net/UrlRequest;", "Lorg/chromium/net/UrlResponseInfo;")
|
||||
custom { method, _ ->
|
||||
method.name == "onSucceeded"
|
||||
}
|
||||
name("onSucceeded")
|
||||
}
|
||||
|
||||
internal const val CRONET_URL_REQUEST_CLASS_DESCRIPTOR = "Lorg/chromium/net/impl/CronetUrlRequest;"
|
||||
|
||||
internal val BytecodePatchContext.requestMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.requestMethod by gettingFirstMutableMethodDeclaratively {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
|
||||
custom { _, classDef ->
|
||||
classDef.type == CRONET_URL_REQUEST_CLASS_DESCRIPTOR
|
||||
}
|
||||
definingClass(CRONET_URL_REQUEST_CLASS_DESCRIPTOR)
|
||||
}
|
||||
|
||||
internal val BytecodePatchContext.messageDigestImageUrlMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.messageDigestImageUrlMethod by gettingFirstMutableMethodDeclaratively {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
|
||||
parameterTypes("Ljava/lang/String;", "L")
|
||||
}
|
||||
|
||||
internal val BytecodePatchContext.messageDigestImageUrlParentMethod by gettingFirstMethodDeclaratively {
|
||||
internal val messageDigestImageUrlParentMethodMatch = firstMethodComposite {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("Ljava/lang/String;")
|
||||
parameterTypes()
|
||||
instructions(
|
||||
anyInstruction(
|
||||
"@#&=*+-_.,:!?()/~'%;\$"(),
|
||||
"@#&=*+-_.,:!?()/~'%;\$[]"(), // 20.38+
|
||||
),
|
||||
)
|
||||
strings {
|
||||
anyOf(
|
||||
"@#&=*+-_.,:!?()/~'%;\$",
|
||||
"@#&=*+-_.,:!?()/~'%;\$[]", // 20.38+
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
package app.revanced.patches.youtube.misc.links
|
||||
|
||||
import app.revanced.patcher.StringComparisonType
|
||||
import app.revanced.patcher.accessFlags
|
||||
import app.revanced.patcher.firstMethodComposite
|
||||
import app.revanced.patcher.gettingFirstMethodDeclaratively
|
||||
import app.revanced.patcher.instructions
|
||||
import app.revanced.patcher.parameterTypes
|
||||
import app.revanced.patcher.returnType
|
||||
import app.revanced.patcher.*
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
/**
|
||||
@@ -16,10 +10,13 @@ internal val abUriParserLegacyMethodMatch = firstMethodComposite {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("Ljava/lang/Object;")
|
||||
parameterTypes("Ljava/lang/Object;")
|
||||
strings {
|
||||
// Partial string match - keep in instructions block
|
||||
+"Found entityKey=`"
|
||||
// "that does not contain a PlaylistVideoEntityId" - partial, skipped
|
||||
}
|
||||
instructions(
|
||||
"Found entityKey=`"(),
|
||||
addString("that does not contain a PlaylistVideoEntityId", comparison = StringComparisonType.CONTAINS),
|
||||
methodCall(smali = "Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;"),
|
||||
method { smali == "Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;" },
|
||||
)
|
||||
}
|
||||
|
||||
@@ -33,10 +30,10 @@ internal val abUriParserMethodMatch = firstMethodComposite {
|
||||
instructions(
|
||||
// Method is a switch statement of unrelated code,
|
||||
// and there's no strings or anything unique to fingerprint.
|
||||
methodCall(smali = "Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;"),
|
||||
methodCall(smali = "Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;"),
|
||||
methodCall(smali = "Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;"),
|
||||
methodCall(smali = "Ljava/util/List;->get(I)Ljava/lang/Object;"),
|
||||
method { smali == "Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;" },
|
||||
method { smali == "Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;" },
|
||||
method { smali == "Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;" },
|
||||
method { smali == "Ljava/util/List;->get(I)Ljava/lang/Object;" },
|
||||
)
|
||||
}
|
||||
|
||||
@@ -45,9 +42,11 @@ internal val httpUriParserMethodMatch = firstMethodComposite {
|
||||
returnType("Landroid/net/Uri;")
|
||||
parameterTypes("Ljava/lang/String;")
|
||||
instructions(
|
||||
methodCall(smali = "Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;"),
|
||||
"https"(),
|
||||
"://"(),
|
||||
"https:"(),
|
||||
method { smali == "Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;" },
|
||||
)
|
||||
strings {
|
||||
+"https"
|
||||
+"://"
|
||||
+"https:"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
package app.revanced.patches.youtube.video.speed.remember
|
||||
|
||||
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
|
||||
|
||||
internal val BytecodePatchContext.initializePlaybackSpeedValuesMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.initializePlaybackSpeedValuesMethod by gettingFirstMutableMethodDeclaratively(
|
||||
"menu_item_playback_speed",
|
||||
) {
|
||||
parameterTypes("[L", "I")
|
||||
instructions(
|
||||
"menu_item_playback_speed"(),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,37 +1,37 @@
|
||||
package app.revanced.patches.youtube.video.videoid
|
||||
|
||||
import app.revanced.patcher.accessFlags
|
||||
import app.revanced.patcher.gettingFirstMethodDeclaratively
|
||||
import app.revanced.patcher.instructions
|
||||
import app.revanced.patcher.invoke
|
||||
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
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.ClassDef
|
||||
|
||||
internal val BytecodePatchContext.videoIdMethod by gettingFirstMethodDeclaratively {
|
||||
/**
|
||||
* Matches using the class found in [videoIdParentMethodMatch].
|
||||
*/
|
||||
context(_: BytecodePatchContext)
|
||||
internal fun ClassDef.getVideoIdMethodMatch() = firstMethodComposite {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("V")
|
||||
parameterTypes("L")
|
||||
instructions(
|
||||
methodCall(
|
||||
definingClass = "Lcom/google/android/libraries/youtube/innertube/model/player/PlayerResponseModel;",
|
||||
returnType = "Ljava/lang/String;",
|
||||
),
|
||||
method {
|
||||
definingClass == "Lcom/google/android/libraries/youtube/innertube/model/player/PlayerResponseModel;"
|
||||
&& returnType == "Ljava/lang/String;"
|
||||
},
|
||||
Opcode.MOVE_RESULT_OBJECT(),
|
||||
)
|
||||
}
|
||||
|
||||
internal val BytecodePatchContext.videoIdBackgroundPlayMethod by gettingFirstMethodDeclaratively {
|
||||
internal val videoIdBackgroundPlayMethodMatch = firstMethodComposite {
|
||||
accessFlags(AccessFlags.DECLARED_SYNCHRONIZED, AccessFlags.FINAL, AccessFlags.PUBLIC)
|
||||
returnType("V")
|
||||
parameterTypes("L")
|
||||
instructions(
|
||||
methodCall(
|
||||
definingClass = "Lcom/google/android/libraries/youtube/innertube/model/player/PlayerResponseModel;",
|
||||
returnType = "Ljava/lang/String;",
|
||||
),
|
||||
method {
|
||||
definingClass == "Lcom/google/android/libraries/youtube/innertube/model/player/PlayerResponseModel;"
|
||||
&& returnType == "Ljava/lang/String;"
|
||||
},
|
||||
Opcode.MOVE_RESULT_OBJECT(),
|
||||
Opcode.IPUT_OBJECT(),
|
||||
Opcode.MONITOR_EXIT(),
|
||||
@@ -39,16 +39,16 @@ internal val BytecodePatchContext.videoIdBackgroundPlayMethod by gettingFirstMet
|
||||
Opcode.MONITOR_EXIT(),
|
||||
Opcode.RETURN_VOID(),
|
||||
)
|
||||
custom { method, classDef ->
|
||||
method.implementation != null &&
|
||||
custom {
|
||||
implementation != null &&
|
||||
(
|
||||
classDef.methods.count() == 17 || // 20.39 and lower.
|
||||
classDef.methods.count() == 16
|
||||
definingClass.methods.count() == 17 || // 20.39 and lower.
|
||||
definingClass.methods.count() == 16
|
||||
) // 20.40+
|
||||
}
|
||||
}
|
||||
|
||||
internal val videoIdParentFingerprint = fingerprint {
|
||||
internal val videoIdParentMethodMatch = firstMethodComposite {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("[L")
|
||||
parameterTypes("L")
|
||||
|
||||
@@ -92,22 +92,18 @@ val videoIdPatch = bytecodePatch(
|
||||
)
|
||||
|
||||
apply {
|
||||
videoIdMethod.match(videoIdParentFingerprint.immutableClassDef).let {
|
||||
it.method.apply {
|
||||
videoIdMethod = this
|
||||
val index = it.instructionMatches.first().index
|
||||
videoIdRegister = getInstruction<OneRegisterInstruction>(index + 1).registerA
|
||||
videoIdInsertIndex = index + 2
|
||||
}
|
||||
videoIdParentMethodMatch.classDef.getVideoIdMethodMatch().let {
|
||||
videoIdMethod = it.method
|
||||
val index = it.indices.first()
|
||||
videoIdRegister = videoIdMethod.getInstruction<OneRegisterInstruction>(index + 1).registerA
|
||||
videoIdInsertIndex = index + 2
|
||||
}
|
||||
|
||||
videoIdBackgroundPlayMethod.let {
|
||||
it.method.apply {
|
||||
backgroundPlaybackMethod = this
|
||||
val index = it.instructionMatches.first().index
|
||||
backgroundPlaybackVideoIdRegister = getInstruction<OneRegisterInstruction>(index + 1).registerA
|
||||
backgroundPlaybackInsertIndex = index + 2
|
||||
}
|
||||
videoIdBackgroundPlayMethodMatch.let {
|
||||
backgroundPlaybackMethod = it.method
|
||||
val index = it.indices.first()
|
||||
backgroundPlaybackVideoIdRegister = backgroundPlaybackMethod.getInstruction<OneRegisterInstruction>(index + 1).registerA
|
||||
backgroundPlaybackInsertIndex = index + 2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user