mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-25 11:41:04 +00:00
use invoke opcode
This commit is contained in:
@@ -3,8 +3,8 @@ package app.revanced.patches.willhaben.ads
|
||||
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||
import app.revanced.util.returnEarly
|
||||
|
||||
@Suppress("unused")
|
||||
internal val `Hide ads` by creatingBytecodePatch(
|
||||
@Suppress("unused", "ObjectPropertyName")
|
||||
val `Hide ads` by creatingBytecodePatch(
|
||||
description = "Hides all in-app ads.",
|
||||
) {
|
||||
compatibleWith("at.willhaben")
|
||||
|
||||
@@ -17,7 +17,7 @@ import com.android.tools.smali.dexlib2.Opcode
|
||||
internal val BytecodePatchContext.addCreateButtonViewMethod by gettingFirstMethodDeclaratively {
|
||||
instructions(
|
||||
addString("Android Wear"),
|
||||
opcode(Opcode.IF_EQZ),
|
||||
Opcode.IF_EQZ(),
|
||||
addString("Android Automotive", location = MatchAfterImmediately()),
|
||||
)
|
||||
}
|
||||
@@ -31,7 +31,7 @@ internal val BytecodePatchContext.createPivotBarMethod by gettingFirstMethodDecl
|
||||
)
|
||||
instructions(
|
||||
methodCall(definingClass = "Landroid/widget/TextView;", name = "setText"),
|
||||
opcode(Opcode.RETURN_VOID),
|
||||
Opcode.RETURN_VOID(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -37,14 +37,14 @@ internal val BytecodePatchContext.hideShowMoreLegacyButtonMethod by gettingFirst
|
||||
instructions(
|
||||
ResourceType.LAYOUT("expand_button_down"),
|
||||
methodCall(smali = "Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;"),
|
||||
opcode(Opcode.MOVE_RESULT_OBJECT),
|
||||
Opcode.MOVE_RESULT_OBJECT(),
|
||||
)
|
||||
}
|
||||
|
||||
internal val BytecodePatchContext.parseElementFromBufferMethod by gettingFirstMethodDeclaratively {
|
||||
parameterTypes("L", "L", "[B", "L", "L")
|
||||
instructions(
|
||||
opcode(Opcode.IGET_OBJECT),
|
||||
Opcode.IGET_OBJECT(),
|
||||
// IGET_BOOLEAN // 20.07+
|
||||
opcode(Opcode.INVOKE_INTERFACE, location = MatchAfterWithin(1)),
|
||||
opcode(Opcode.MOVE_RESULT_OBJECT, location = MatchAfterImmediately()),
|
||||
|
||||
@@ -24,7 +24,7 @@ internal val BytecodePatchContext.shortsBottomBarContainerMethod by gettingFirst
|
||||
addString("r_pfvc"),
|
||||
ResourceType.ID("bottom_bar_container"),
|
||||
methodCall(name = "getHeight"),
|
||||
opcode(Opcode.MOVE_RESULT),
|
||||
Opcode.MOVE_RESULT(),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ internal val BytecodePatchContext.renderBottomNavigationBarMethod by gettingFirs
|
||||
opcode(Opcode.IF_EQZ, MatchAfterImmediately()),
|
||||
opcode(Opcode.INVOKE_INTERFACE, MatchAfterImmediately()),
|
||||
|
||||
opcode(Opcode.MONITOR_EXIT),
|
||||
Opcode.MONITOR_EXIT(),
|
||||
opcode(Opcode.RETURN_VOID, MatchAfterImmediately()),
|
||||
opcode(Opcode.MOVE_EXCEPTION, MatchAfterImmediately()),
|
||||
opcode(Opcode.MONITOR_EXIT, MatchAfterImmediately()),
|
||||
|
||||
@@ -18,7 +18,7 @@ internal val BytecodePatchContext.timeCounterMethod by gettingFirstMethodDeclara
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
parameterTypes()
|
||||
instructions(
|
||||
opcode(Opcode.SUB_LONG_2ADDR),
|
||||
Opcode.SUB_LONG_2ADDR(),
|
||||
methodCall(
|
||||
opcode = Opcode.INVOKE_STATIC,
|
||||
returnType = "Ljava/lang/CharSequence;",
|
||||
|
||||
@@ -176,8 +176,8 @@ internal val BytecodePatchContext.miniplayerOverrideMethod by gettingFirstMethod
|
||||
internal val BytecodePatchContext.miniplayerOverrideNoContextMethod by gettingFirstMethodDeclaratively {
|
||||
accessFlags(AccessFlags.PRIVATE, AccessFlags.FINAL)
|
||||
returnType("Z")
|
||||
instructions(
|
||||
opcode(Opcode.IGET_BOOLEAN), // Anchor to insert the instruction.
|
||||
opcodes(
|
||||
Opcode.IGET_BOOLEAN, // Anchor to insert the instruction.
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -15,18 +15,17 @@ import app.revanced.util.addInstructionsAtControlFlowLabel
|
||||
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
@Suppress("unused")
|
||||
internal val `Exit fullscreen mode` by creatingBytecodePatch(
|
||||
description = "Adds options to automatically exit fullscreen mode when a video reaches the end."
|
||||
@Suppress("unused", "ObjectPropertyName")
|
||||
val `Exit fullscreen` by creatingBytecodePatch(
|
||||
description = "Adds options to automatically exit fullscreen mode when a video reaches the end.",
|
||||
) {
|
||||
|
||||
compatibleWith(
|
||||
"com.google.android.youtube"(
|
||||
"19.43.41",
|
||||
"20.14.43",
|
||||
"20.21.37",
|
||||
"20.31.40",
|
||||
)
|
||||
),
|
||||
)
|
||||
|
||||
dependsOn(
|
||||
@@ -35,7 +34,7 @@ internal val `Exit fullscreen mode` by creatingBytecodePatch(
|
||||
addResourcesPatch,
|
||||
playerTypeHookPatch,
|
||||
playerControlsPatch,
|
||||
videoInformationPatch
|
||||
videoInformationPatch,
|
||||
)
|
||||
|
||||
// Cannot declare as top level since this patch is in the same package as
|
||||
@@ -48,7 +47,7 @@ internal val `Exit fullscreen mode` by creatingBytecodePatch(
|
||||
addResources("youtube", "layout.player.fullscreen.exitFullscreenPatch")
|
||||
|
||||
PreferenceScreen.PLAYER.addPreferences(
|
||||
ListPreference("revanced_exit_fullscreen")
|
||||
ListPreference("revanced_exit_fullscreen"),
|
||||
)
|
||||
|
||||
videoEndMethod.apply {
|
||||
|
||||
@@ -20,7 +20,7 @@ internal val BytecodePatchContext.openVideosFullscreenPortraitMethod by gettingF
|
||||
returnType("V")
|
||||
parameterTypes("L", "Lj\$/util/Optional;")
|
||||
instructions(
|
||||
opcode(Opcode.MOVE_RESULT), // Conditional check to modify.
|
||||
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)),
|
||||
|
||||
@@ -72,7 +72,7 @@ internal val BytecodePatchContext.watchHistoryMenuUseProgressDrawableMethod by g
|
||||
parameterTypes("L")
|
||||
instructions(
|
||||
methodCall("Landroid/widget/ProgressBar;", "setMax"),
|
||||
opcode(Opcode.MOVE_RESULT),
|
||||
Opcode.MOVE_RESULT(),
|
||||
-1712394514(),
|
||||
)
|
||||
}
|
||||
@@ -106,7 +106,7 @@ internal val BytecodePatchContext.playerLinearGradientLegacyMethod by gettingFir
|
||||
instructions(
|
||||
ResourceType.COLOR("yt_youtube_magenta"),
|
||||
|
||||
opcode(Opcode.FILLED_NEW_ARRAY),
|
||||
Opcode.FILLED_NEW_ARRAY(),
|
||||
opcode(Opcode.MOVE_RESULT_OBJECT, MatchAfterImmediately()),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ internal val BytecodePatchContext.reelEnumConstructorMethod by gettingFirstMetho
|
||||
addString("REEL_LOOP_BEHAVIOR_SINGLE_PLAY"),
|
||||
addString("REEL_LOOP_BEHAVIOR_REPEAT"),
|
||||
addString("REEL_LOOP_BEHAVIOR_END_SCREEN"),
|
||||
opcode(Opcode.RETURN_VOID),
|
||||
Opcode.RETURN_VOID(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ internal val BytecodePatchContext.speedArrayGeneratorMethod by gettingFirstMetho
|
||||
newInstance("Ljava/text/DecimalFormat;"),
|
||||
addString("0.0#"),
|
||||
7L(),
|
||||
opcode(Opcode.NEW_ARRAY),
|
||||
Opcode.NEW_ARRAY(),
|
||||
fieldAccess(definingClass = "/PlayerConfigModel;", type = "[F"),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ internal val BytecodePatchContext.videoIdMethod by gettingFirstMethodDeclarative
|
||||
definingClass = "Lcom/google/android/libraries/youtube/innertube/model/player/PlayerResponseModel;",
|
||||
returnType = "Ljava/lang/String;",
|
||||
),
|
||||
opcode(Opcode.MOVE_RESULT_OBJECT),
|
||||
Opcode.MOVE_RESULT_OBJECT(),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -34,12 +34,12 @@ internal val BytecodePatchContext.videoIdBackgroundPlayMethod by gettingFirstMet
|
||||
definingClass = "Lcom/google/android/libraries/youtube/innertube/model/player/PlayerResponseModel;",
|
||||
returnType = "Ljava/lang/String;",
|
||||
),
|
||||
opcode(Opcode.MOVE_RESULT_OBJECT),
|
||||
opcode(Opcode.IPUT_OBJECT),
|
||||
opcode(Opcode.MONITOR_EXIT),
|
||||
opcode(Opcode.RETURN_VOID),
|
||||
opcode(Opcode.MONITOR_EXIT),
|
||||
opcode(Opcode.RETURN_VOID),
|
||||
Opcode.MOVE_RESULT_OBJECT(),
|
||||
Opcode.IPUT_OBJECT(),
|
||||
Opcode.MONITOR_EXIT(),
|
||||
Opcode.RETURN_VOID(),
|
||||
Opcode.MONITOR_EXIT(),
|
||||
Opcode.RETURN_VOID(),
|
||||
)
|
||||
custom { method, classDef ->
|
||||
method.implementation != null &&
|
||||
|
||||
Reference in New Issue
Block a user