youtube patches work now

This commit is contained in:
oSumAtrIX
2026-01-30 16:14:35 +01:00
parent acac6e960c
commit 2ea26b02ea
28 changed files with 181 additions and 184 deletions

View File

@@ -5,6 +5,7 @@ import app.revanced.patcher.extensions.instructions
import app.revanced.patcher.instructions
import app.revanced.patcher.invoke
import app.revanced.patcher.name
import app.revanced.patcher.opcodes
import app.revanced.patches.shared.misc.extension.extensionHook
import app.revanced.util.getReference
import app.revanced.util.indexOfFirstInstructionOrThrow
@@ -29,16 +30,16 @@ internal val startActivityInitHook = extensionHook(
) {
name("onCreate")
definingClass { endsWith("/StartActivity;") }
instructions(
Opcode.INVOKE_STATIC(),
Opcode.MOVE_RESULT(),
Opcode.CONST_4(),
Opcode.IF_EQZ(),
Opcode.CONST(),
Opcode.INVOKE_VIRTUAL(),
Opcode.IPUT_OBJECT(),
Opcode.IPUT_BOOLEAN(),
Opcode.INVOKE_VIRTUAL(), // Calls startActivity.getApplicationContext().
Opcode.MOVE_RESULT_OBJECT(),
opcodes(
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT,
Opcode.CONST_4,
Opcode.IF_EQZ,
Opcode.CONST,
Opcode.INVOKE_VIRTUAL,
Opcode.IPUT_OBJECT,
Opcode.IPUT_BOOLEAN,
Opcode.INVOKE_VIRTUAL, // Calls startActivity.getApplicationContext().
Opcode.MOVE_RESULT_OBJECT,
)
}

View File

@@ -5,6 +5,7 @@ import app.revanced.patcher.extensions.instructions
import app.revanced.patcher.instructions
import app.revanced.patcher.invoke
import app.revanced.patcher.name
import app.revanced.patcher.opcodes
import app.revanced.patches.shared.misc.extension.extensionHook
import app.revanced.util.getReference
import app.revanced.util.indexOfFirstInstructionOrThrow
@@ -29,12 +30,12 @@ internal val homeActivityInitHook = extensionHook(
) {
name("onCreate")
definingClass { endsWith("/HomeActivity;") }
instructions(
Opcode.CONST_STRING(),
Opcode.INVOKE_STATIC(),
Opcode.MOVE_RESULT_OBJECT(),
Opcode.IF_NEZ(),
Opcode.INVOKE_VIRTUAL(), // Calls getApplicationContext().
Opcode.MOVE_RESULT_OBJECT(),
opcodes(
Opcode.CONST_STRING,
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT,
Opcode.IF_NEZ,
Opcode.INVOKE_VIRTUAL, // Calls getApplicationContext().
Opcode.MOVE_RESULT_OBJECT,
)
}

View File

@@ -20,24 +20,22 @@ internal val BytecodePatchContext.screenMapperMethodMatch by composingFirstMetho
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
returnType("Lnl/nu/android/bff/domain/models/screen/ScreenEntity;")
parameterTypes("Lnl/nu/performance/api/client/objects/Screen;")
instructions(
Opcode.MOVE_RESULT_OBJECT(),
Opcode.IF_EQZ(),
Opcode.CHECK_CAST(),
opcodes(
Opcode.MOVE_RESULT_OBJECT,
Opcode.IF_EQZ,
Opcode.CHECK_CAST,
)
}
internal val BytecodePatchContext.nextPageRepositoryImplMethodMatch by composingFirstMethod {
definingClass("Lnl/nu/android/bff/data/repositories/NextPageRepositoryImpl;")
name("mapToPage")
accessFlags(AccessFlags.PRIVATE, AccessFlags.FINAL)
returnType("Lnl/nu/android/bff/domain/models/Page;")
parameterTypes("Lnl/nu/performance/api/client/PacResponse;", "Ljava/lang/String;")
definingClass("Lnl/nu/android/bff/data/repositories/NextPageRepositoryImpl;")
name("mapToPage")
instructions(
Opcode.MOVE_RESULT_OBJECT(),
Opcode.IF_EQZ(),
Opcode.CHECK_CAST(),
opcodes(
Opcode.MOVE_RESULT_OBJECT,
Opcode.IF_EQZ,
Opcode.CHECK_CAST,
)
}

View File

@@ -3,6 +3,7 @@ package app.revanced.patches.photomath.detection.deviceid
import app.revanced.patcher.gettingFirstMutableMethodDeclaratively
import app.revanced.patcher.instructions
import app.revanced.patcher.invoke
import app.revanced.patcher.opcodes
import app.revanced.patcher.parameterTypes
import app.revanced.patcher.patch.BytecodePatchContext
import app.revanced.patcher.returnType
@@ -11,16 +12,16 @@ import com.android.tools.smali.dexlib2.Opcode
internal val BytecodePatchContext.getDeviceIdMethod by gettingFirstMutableMethodDeclaratively {
returnType("Ljava/lang/String;")
parameterTypes()
instructions(
Opcode.SGET_OBJECT(),
Opcode.IGET_OBJECT(),
Opcode.INVOKE_STATIC(),
Opcode.MOVE_RESULT_OBJECT(),
Opcode.IF_NEZ(),
Opcode.INVOKE_STATIC(),
Opcode.MOVE_RESULT_OBJECT(),
Opcode.INVOKE_VIRTUAL(),
Opcode.MOVE_RESULT_OBJECT(),
Opcode.INVOKE_VIRTUAL(),
opcodes(
Opcode.SGET_OBJECT,
Opcode.IGET_OBJECT,
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT,
Opcode.IF_NEZ,
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_VIRTUAL,
)
}

View File

@@ -3,18 +3,19 @@ package app.revanced.patches.photomath.detection.signature
import app.revanced.patcher.composingFirstMethod
import app.revanced.patcher.instructions
import app.revanced.patcher.invoke
import app.revanced.patcher.opcodes
import app.revanced.patcher.patch.BytecodePatchContext
import com.android.tools.smali.dexlib2.Opcode
internal val BytecodePatchContext.checkSignatureMethodMatch by composingFirstMethod("SHA") {
instructions(
Opcode.CONST_STRING(),
Opcode.INVOKE_STATIC(),
Opcode.INVOKE_STATIC(),
Opcode.MOVE_RESULT_OBJECT(),
Opcode.INVOKE_VIRTUAL(),
Opcode.MOVE_RESULT_OBJECT(),
Opcode.INVOKE_STATIC(),
Opcode.MOVE_RESULT(),
opcodes(
Opcode.CONST_STRING,
Opcode.INVOKE_STATIC,
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT,
)
}

View File

@@ -10,11 +10,11 @@ internal val BytecodePatchContext.hideUpdatePopupMethod by gettingFirstMutableMe
definingClass("Lcom/microblink/photomath/main/activity/MainActivity;")
accessFlags(AccessFlags.FINAL, AccessFlags.PUBLIC)
returnType("V")
instructions(
Opcode.CONST_HIGH16(),
Opcode.INVOKE_VIRTUAL(), // ViewPropertyAnimator.alpha(1.0f)
Opcode.MOVE_RESULT_OBJECT(),
Opcode.CONST_WIDE_16(),
Opcode.INVOKE_VIRTUAL(), // ViewPropertyAnimator.setDuration(1000L)
opcodes(
Opcode.CONST_HIGH16,
Opcode.INVOKE_VIRTUAL, // ViewPropertyAnimator.alpha(1.0f)
Opcode.MOVE_RESULT_OBJECT,
Opcode.CONST_WIDE_16,
Opcode.INVOKE_VIRTUAL, // ViewPropertyAnimator.setDuration(1000L)
)
}

View File

@@ -12,11 +12,11 @@ internal val BytecodePatchContext.enterServerInsertedAdBreakStateMethod by getti
accessFlags(AccessFlags.PUBLIC)
parameterTypes("Lcom/amazon/avod/fsm/Trigger;")
returnType("V")
instructions(
Opcode.INVOKE_VIRTUAL(),
Opcode.MOVE_RESULT_OBJECT(),
Opcode.CONST_4(),
Opcode.CONST_4()
opcodes(
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CONST_4,
Opcode.CONST_4,
)
}
@@ -25,9 +25,9 @@ internal val BytecodePatchContext.doTriggerMethod by gettingFirstMutableMethodDe
definingClass("Lcom/amazon/avod/fsm/StateBase;")
accessFlags(AccessFlags.PROTECTED)
returnType("V")
instructions(
Opcode.IGET_OBJECT(),
Opcode.INVOKE_INTERFACE(),
Opcode.RETURN_VOID()
opcodes(
Opcode.IGET_OBJECT,
Opcode.INVOKE_INTERFACE,
Opcode.RETURN_VOID,
)
}

View File

@@ -8,15 +8,15 @@ import com.android.tools.smali.dexlib2.Opcode
internal val BytecodePatchContext.createOkHttpClientMethod by gettingFirstMutableMethodDeclaratively {
accessFlags(AccessFlags.PRIVATE)
instructions(
Opcode.NEW_INSTANCE(),
Opcode.INVOKE_DIRECT(),
Opcode.NEW_INSTANCE(),
Opcode.INVOKE_DIRECT(),
Opcode.NEW_INSTANCE(),
Opcode.INVOKE_DIRECT(),
Opcode.INVOKE_VIRTUAL(),
Opcode.MOVE_RESULT_OBJECT()
opcodes(
Opcode.NEW_INSTANCE,
Opcode.INVOKE_DIRECT,
Opcode.NEW_INSTANCE,
Opcode.INVOKE_DIRECT,
Opcode.NEW_INSTANCE,
Opcode.INVOKE_DIRECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
)
custom { immutableClassDef.sourceFile == "RedGifsAPIv2.java" }
}

View File

@@ -9,18 +9,18 @@ import com.android.tools.smali.dexlib2.Opcode
internal val BytecodePatchContext.authUtilityUserAgentMethod by gettingFirstMutableMethodDeclaratively {
accessFlags(AccessFlags.PUBLIC, AccessFlags.STATIC)
returnType("Ljava/lang/String;")
instructions(Opcode.APUT_OBJECT())
opcodes(Opcode.APUT_OBJECT)
custom { immutableClassDef.sourceFile == "AuthUtility.java" }
}
internal val BytecodePatchContext.getClientIdMethod by gettingFirstMutableMethodDeclaratively {
accessFlags(AccessFlags.PUBLIC, AccessFlags.STATIC)
returnType("L")
instructions(
Opcode.CONST(),
Opcode.INVOKE_STATIC(),
Opcode.MOVE_RESULT_OBJECT(),
Opcode.RETURN_OBJECT(),
opcodes(
Opcode.CONST,
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT,
Opcode.RETURN_OBJECT,
)
custom { immutableClassDef.sourceFile == "AuthUtility.java" }
}

View File

@@ -5,6 +5,7 @@ import app.revanced.patcher.definingClass
import app.revanced.patcher.gettingFirstMutableMethodDeclaratively
import app.revanced.patcher.instructions
import app.revanced.patcher.invoke
import app.revanced.patcher.opcodes
import app.revanced.patcher.patch.BytecodePatchContext
import app.revanced.patcher.returnType
import com.android.tools.smali.dexlib2.AccessFlags
@@ -13,13 +14,13 @@ import com.android.tools.smali.dexlib2.Opcode
internal val BytecodePatchContext.detectPiracyMethod by gettingFirstMutableMethodDeclaratively {
accessFlags(AccessFlags.PRIVATE, AccessFlags.STATIC)
returnType("V")
instructions(
Opcode.NEW_INSTANCE(),
Opcode.CONST_16(),
Opcode.CONST_WIDE_16(),
Opcode.INVOKE_DIRECT(),
Opcode.INVOKE_VIRTUAL(),
Opcode.RETURN_VOID(),
opcodes(
Opcode.NEW_INSTANCE,
Opcode.CONST_16,
Opcode.CONST_WIDE_16,
Opcode.INVOKE_DIRECT,
Opcode.INVOKE_VIRTUAL,
Opcode.RETURN_VOID,
)
definingClass { endsWith("ProcessLifeCyleListener;") }
}

View File

@@ -24,12 +24,12 @@ internal val BytecodePatchContext.getUserAgentMethod by gettingFirstMutableMetho
accessFlags(AccessFlags.PUBLIC, AccessFlags.STATIC)
returnType("Ljava/lang/String;")
parameterTypes()
instructions(
Opcode.NEW_ARRAY(),
Opcode.CONST_4(),
Opcode.INVOKE_STATIC(),
Opcode.MOVE_RESULT_OBJECT(),
Opcode.APUT_OBJECT(),
Opcode.CONST(),
opcodes(
Opcode.NEW_ARRAY,
Opcode.CONST_4,
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT,
Opcode.APUT_OBJECT,
Opcode.CONST,
)
}

View File

@@ -1,33 +1,30 @@
package app.revanced.patches.reddit.customclients.sync.detection.piracy
import app.revanced.patcher.gettingFirstMutableMethodDeclarativelyOrNull
import app.revanced.patcher.invoke
import app.revanced.patcher.accessFlags
import app.revanced.patcher.custom
import app.revanced.patcher.extensions.instructions
import app.revanced.patcher.extensions.reference
import app.revanced.patcher.gettingFirstMutableMethodDeclarativelyOrNull
import app.revanced.patcher.instructions
import app.revanced.patcher.invoke
import app.revanced.patcher.opcodes
import app.revanced.patcher.patch.BytecodePatchContext
import app.revanced.patcher.returnType
import app.revanced.patcher.type
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
internal val BytecodePatchContext.detectPiracyMethodOrNull by gettingFirstMutableMethodDeclarativelyOrNull(
"Lcom/github/javiersantos/piracychecker/PiracyChecker;"
"Lcom/github/javiersantos/piracychecker/PiracyChecker;",
) {
accessFlags(AccessFlags.PRIVATE, AccessFlags.FINAL)
returnType("V")
instructions(
Opcode.NEW_INSTANCE(),
Opcode.INVOKE_DIRECT(),
Opcode.NEW_INSTANCE(),
Opcode.INVOKE_DIRECT(),
Opcode.INVOKE_VIRTUAL(),
opcodes(
Opcode.NEW_INSTANCE,
Opcode.INVOKE_DIRECT,
Opcode.NEW_INSTANCE,
Opcode.INVOKE_DIRECT,
Opcode.INVOKE_VIRTUAL,
)
// TODO: Convert to instructions() extension.
custom {
instructions.any {
it.reference.toString() == "Lcom/github/javiersantos/piracychecker/PiracyChecker;"
}
}
}
instructions(type("Lcom/github/javiersantos/piracychecker/PiracyChecker;"))
}

View File

@@ -30,7 +30,7 @@ internal val BytecodePatchContext.lithoOnBoundsChangeMethodMatch by composingFir
5,
allOf(
Opcode.IGET_OBJECT(),
field { type == "Landroid/graphics/Path;" && definingClass == methodDefiningClass },
field { type == "Landroid/graphics/Paint;" && definingClass == methodDefiningClass },
),
),
after(

View File

@@ -9,10 +9,10 @@ internal val BytecodePatchContext.youTubeCopyTextMethodMatch by composingFirstMe
parameterTypes("L", "Ljava/util/Map;")
instructions(
Opcode.IGET_OBJECT(),
after(0..2, "text/plain"()),
after(0..2, method("newPlainText")),
after(0..2, Opcode.MOVE_RESULT_OBJECT()),
after(0..2, method("setPrimaryClip")),
afterAtMost(2, "text/plain"()),
afterAtMost(2, method("newPlainText")),
afterAtMost(2, Opcode.MOVE_RESULT_OBJECT()),
afterAtMost(2, method("setPrimaryClip")),
)
}
@@ -21,9 +21,9 @@ internal val BytecodePatchContext.youTubeSystemShareSheetMethodMatch by composin
parameterTypes("L", "Ljava/util/Map;")
instructions(
method("setClassName"),
after(0..4, method("iterator")),
after(0..15, allOf(Opcode.IGET_OBJECT(), type("Ljava/lang/String;"))),
after(0..15, method("putExtra")),
afterAtMost(4, method("iterator")),
afterAtMost(15, allOf(Opcode.IGET_OBJECT(), field { type == "Ljava/lang/String;" })),
afterAtMost(15, method("putExtra")),
)
}

View File

@@ -1,5 +1,6 @@
package app.revanced.patches.shared.misc.privacy
import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod
import app.revanced.patcher.Match
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.getInstruction
@@ -15,6 +16,7 @@ import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.util.addInstructionsAtControlFlowLabel
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
private const val EXTENSION_CLASS_DESCRIPTOR =
"Lapp/revanced/extension/shared/patches/SanitizeSharingLinksPatch;"
@@ -58,40 +60,34 @@ internal fun sanitizeSharingLinksPatch(
},
)
fun Match.hookUrlString(matchIndex: Int) {
val index = get(matchIndex)
val urlRegister = method.getInstruction<OneRegisterInstruction>(index).registerA
fun Match.hook(
getInsertIndex: List<Int>.() -> Int,
getUrlRegister: MutableMethod.(insertIndex: Int) -> Int,
) {
val insertIndex = indices[0].getInsertIndex()
val urlRegister = method.getUrlRegister(insertIndex)
method.addInstructions(
index + 1,
insertIndex,
"""
invoke-static { v$urlRegister }, $EXTENSION_CLASS_DESCRIPTOR->sanitize(Ljava/lang/String;)Ljava/lang/String;
invoke-static {v$urlRegister}, $EXTENSION_CLASS_DESCRIPTOR->sanitize(Ljava/lang/String;)Ljava/lang/String;
move-result-object v$urlRegister
""",
)
}
fun Match.hookIntentPutExtra(matchIndex: Int) {
val index = get(matchIndex)
val urlRegister = method.getInstruction<FiveRegisterInstruction>(index).registerE
method.addInstructionsAtControlFlowLabel(
index,
"""
invoke-static { v$urlRegister }, $EXTENSION_CLASS_DESCRIPTOR->sanitize(Ljava/lang/String;)Ljava/lang/String;
move-result-object v$urlRegister
""",
)
// YouTube share sheet.\
youTubeShareSheetMethodMatch.hook(getInsertIndex = { first() + 1 }) { insertIndex ->
getInstruction<OneRegisterInstruction>(insertIndex - 1).registerA
}
// YouTube share sheet copy link.
youTubeCopyTextMethodMatch.hookUrlString(0)
// YouTube share sheet other apps.
youTubeShareSheetMethodMatch.hookIntentPutExtra(3)
// Native system share sheet.
youTubeSystemShareSheetMethodMatch.hookIntentPutExtra(3)
youTubeSystemShareSheetMethodMatch.hook(getInsertIndex = { last() }) { insertIndex ->
getInstruction<OneRegisterInstruction>(insertIndex - 1).registerA
}
youTubeCopyTextMethodMatch.hook(getInsertIndex = { first() + 2 }) { insertIndex ->
getInstruction<TwoRegisterInstruction>(insertIndex - 2).registerA
}
}
}

View File

@@ -1,6 +1,7 @@
package app.revanced.patches.shared.misc.spoof
import app.revanced.patcher.accessFlags
import app.revanced.patcher.anyField
import app.revanced.patcher.composingFirstMethod
import app.revanced.patcher.custom
import app.revanced.patcher.definingClass
@@ -23,21 +24,21 @@ import com.android.tools.smali.dexlib2.iface.Method
internal val BytecodePatchContext.buildInitPlaybackRequestMethodMatch by composingFirstMethod("Content-Type", "Range") {
returnType($$"Lorg/chromium/net/UrlRequest$Builder;")
instructions(
Opcode.MOVE_RESULT_OBJECT(),
Opcode.IGET_OBJECT(), // Moves the request URI string to a register to build the request with.
opcodes(
Opcode.MOVE_RESULT_OBJECT,
Opcode.IGET_OBJECT, // Moves the request URI string to a register to build the request with.
)
}
internal val BytecodePatchContext.buildPlayerRequestURIMethodMatch by composingFirstMethod("key", "asig") {
returnType("Ljava/lang/String;")
instructions(
Opcode.INVOKE_VIRTUAL(), // Register holds player request URI.
Opcode.MOVE_RESULT_OBJECT(),
Opcode.IPUT_OBJECT(),
Opcode.IGET_OBJECT(),
Opcode.MONITOR_EXIT(),
Opcode.RETURN_OBJECT(),
opcodes(
Opcode.INVOKE_VIRTUAL, // Register holds player request URI.
Opcode.MOVE_RESULT_OBJECT,
Opcode.IPUT_OBJECT,
Opcode.IGET_OBJECT,
Opcode.MONITOR_EXIT,
Opcode.RETURN_OBJECT,
)
}
@@ -101,17 +102,15 @@ internal val BytecodePatchContext.protobufClassParseByteBufferMethod by gettingF
internal val BytecodePatchContext.createStreamingDataMethodMatch by composingFirstMethod {
accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
parameterTypes("L")
instructions(
Opcode.IPUT_OBJECT(),
Opcode.IGET_OBJECT(),
Opcode.IF_NEZ(),
Opcode.SGET_OBJECT(),
Opcode.IPUT_OBJECT(),
opcodes(
Opcode.IPUT_OBJECT,
Opcode.IGET_OBJECT,
Opcode.IF_NEZ,
Opcode.SGET_OBJECT,
Opcode.IPUT_OBJECT,
)
custom {
immutableClassDef.fields.any { field ->
field.name == "a" && field.type.endsWith($$"/StreamingDataOuterClass$StreamingData;")
}
immutableClassDef.anyField { name == "a" && type.endsWith($$"/StreamingDataOuterClass$StreamingData;") }
}
}

View File

@@ -290,7 +290,7 @@ internal fun spoofVideoStreamsPatch(
Opcode.SGET_OBJECT,
Opcode.RETURN_OBJECT,
)
custom { parameterTypes.isEmpty() }
custom { !parameterTypes.isEmpty() }
}
sabrMethod.addInstructionsWithLabels(
0,

View File

@@ -11,10 +11,10 @@ import kotlin.properties.ReadOnlyProperty
internal val BytecodePatchContext.jsonHookPatchMethodMatch by ReadOnlyProperty { context, _ ->
context.firstClassDef(JSON_HOOK_PATCH_CLASS_DESCRIPTOR).firstMethodComposite {
name("<clinit>")
instructions(
Opcode.INVOKE_INTERFACE(), // Add dummy hook to hooks list.
opcodes(
Opcode.INVOKE_INTERFACE, // Add dummy hook to hooks list.
// Add hooks to the hooks list.
Opcode.INVOKE_STATIC(), // Call buildList.
Opcode.INVOKE_STATIC, // Call buildList.
)
}
}

View File

@@ -130,8 +130,8 @@ internal val BytecodePatchContext.showFloatingMicrophoneButtonMethodMatch by com
parameterTypes()
instructions(
ResourceType.ID("fab"),
afterAtMost(10, allOf(Opcode.CHECK_CAST(), "/FloatingActionButton;"())),
afterAtMost(15, Opcode.IGET_BOOLEAN()),
afterAtMost(10, allOf(Opcode.CHECK_CAST(), type { endsWith("/FloatingActionButton;") })),
afterAtMost(10, Opcode.IGET_BOOLEAN()),
)
}

View File

@@ -66,7 +66,7 @@ internal val ClassDef.miniplayerModernCloseButtonMethodMatch by ClassDefComposin
parameterTypes()
instructions(
ResourceType.ID("modern_miniplayer_close"),
allOf(Opcode.CHECK_CAST(), "Landroid/widget/ImageView;"()),
allOf(Opcode.CHECK_CAST(), type("Landroid/widget/ImageView;")),
)
}
@@ -79,7 +79,7 @@ internal val ClassDef.miniplayerModernExpandButtonMethodMatch by ClassDefComposi
parameterTypes()
instructions(
ResourceType.ID("modern_miniplayer_expand"),
allOf(Opcode.CHECK_CAST(), "Landroid/widget/ImageView;"()),
allOf(Opcode.CHECK_CAST(), type("Landroid/widget/ImageView;")),
)
}

View File

@@ -80,11 +80,11 @@ internal val BytecodePatchContext.rollingNumberTextViewMethod by gettingFirstMut
parameterTypes("L", "F", "F")
instructions(
Opcode.IPUT(),
anyOf(Opcode.INVOKE_DIRECT(), Opcode.INVOKE_VIRTUAL()),
Opcode.IPUT_OBJECT(),
Opcode.IGET_OBJECT(),
Opcode.INVOKE_VIRTUAL(),
Opcode.RETURN_VOID(),
after(anyOf(Opcode.INVOKE_DIRECT(), Opcode.INVOKE_VIRTUAL())),
after(Opcode.IPUT_OBJECT()),
after(Opcode.IGET_OBJECT()),
after(Opcode.INVOKE_VIRTUAL()),
after(Opcode.RETURN_VOID()),
)
custom {
immutableClassDef.superclass == "Landroid/support/v7/widget/AppCompatTextView;" || immutableClassDef.superclass ==

View File

@@ -4,6 +4,7 @@ import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.fieldReference
import app.revanced.patcher.extensions.getInstruction
import app.revanced.patcher.extensions.methodReference
import app.revanced.patcher.extensions.typeReference
import app.revanced.patcher.immutableClassDef
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.bytecodePatch
@@ -153,7 +154,7 @@ val returnYouTubeDislikePatch = bytecodePatch(
} else {
insertIndex = indexOfFirstInstructionOrThrow {
opcode == Opcode.NEW_INSTANCE &&
fieldReference?.type == textDataClassType
typeReference?.type == textDataClassType
}
val charSequenceIndex = indexOfFirstInstructionOrThrow(insertIndex) {

View File

@@ -54,7 +54,7 @@ internal val BytecodePatchContext.reelPlaybackMethodMatch by composingFirstMetho
5,
allOf(
Opcode.INVOKE_VIRTUAL(),
method { returnType == "I" && parameterTypes.count() == 1 && parameterTypes.first() == "L" },
method { returnType == "I" && parameterTypes.count() == 1 && parameterTypes.first().startsWith("L") },
),
),
)

View File

@@ -11,7 +11,7 @@ internal val BytecodePatchContext.toolBarButtonMethodMatch by composingFirstMeth
returnType("V")
instructions(
ResourceType.ID("menu_item_view"),
allOf(Opcode.INVOKE_VIRTUAL(), method { returnType == "I" }),
allOf(Opcode.INVOKE_INTERFACE(), method { returnType == "I" }),
after(Opcode.MOVE_RESULT()),
afterAtMost(6, allOf(Opcode.IGET_OBJECT(), field { type == "Landroid/widget/ImageView;" })),
afterAtMost(8, method { name == "getDrawable" && definingClass == "Landroid/content/res/Resources;" }),

View File

@@ -32,6 +32,7 @@ val cronetImageUrlHookPatch = bytecodePatch(
dependsOn(sharedExtensionPatch)
apply {
loadImageUrlMethod = messageDigestImageUrlParentMethod.immutableClassDef.getMessageDigestImageUrlMethod()
loadImageSuccessCallbackMethod = onResponseStartedMethod.immutableClassDef.getOnSucceededMethod()
loadImageErrorCallbackMethod = onResponseStartedMethod.immutableClassDef.getOnFailureMethod()

View File

@@ -57,8 +57,8 @@ internal val BytecodePatchContext.messageDigestImageUrlParentMethod by gettingFi
parameterTypes()
instructions(
anyOf(
"@#&=*+-_.,:!?()/~'%;$"(),
"@#&=*+-_.,:!?()/~'%;$[]"(), // 20.38+
string { equals("@#&=*+-_.,:!?()/~'%;$") },
string { equals("@#&=*+-_.,:!?()/~'%;$[]") }, // 20.38+
),
)
}

View File

@@ -96,15 +96,15 @@ val videoInformationPatch = bytecodePatch(
// Find the location of the first invoke-direct call
// and extract the register storing the 'this' object reference.
val initThisIndex = indexOfFirstInstructionOrThrow {
val initThisIndex = playerInitMethod.indexOfFirstInstructionOrThrow {
opcode == Opcode.INVOKE_DIRECT && getReference<MethodReference>()?.name == "<init>"
}
playerInitInsertRegister = getInstruction<FiveRegisterInstruction>(initThisIndex).registerC
playerInitInsertRegister = playerInitMethod.getInstruction<FiveRegisterInstruction>(initThisIndex).registerC
playerInitInsertIndex = initThisIndex + 1
// Create extension interface methods.
addSeekInterfaceMethods(
playVideoCheckVideoStreamingDataResponseMethod.classDef,
playerInitMethod.classDef,
classDef.getSeekMethod(),
classDef.getSeekRelativeMethod(),
)
@@ -133,7 +133,7 @@ val videoInformationPatch = bytecodePatch(
val videoLengthMethodMatch = immutableClassDef.videoLengthMethodMatch
videoLengthMethodMatch.method.apply {
val videoLengthRegisterIndex = videoLengthMethodMatch[-1]
val videoLengthRegisterIndex = videoLengthMethodMatch[-1] - 2
val videoLengthRegister = getInstruction<OneRegisterInstruction>(videoLengthRegisterIndex).registerA
val dummyRegisterForLong = videoLengthRegister + 1 // required for long values since they are wide

View File

@@ -42,7 +42,7 @@ internal val BytecodePatchContext.speedArrayGeneratorMethodMatch by composingFir
"0.0#"(),
7L(),
Opcode.NEW_ARRAY(),
field { definingClass == "/PlayerConfigModel;" && type == "[F" },
field { definingClass.endsWith("/PlayerConfigModel;") && type == "[F" },
)
}