mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-29 13:41:03 +00:00
progres
This commit is contained in:
@@ -4,6 +4,7 @@ import app.revanced.patcher.classDef
|
||||
import app.revanced.patcher.extensions.addInstruction
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.getInstruction
|
||||
import app.revanced.patcher.firstMutableClassDef
|
||||
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||
import app.revanced.patches.tiktok.shared.getEnterFromMethod
|
||||
import app.revanced.patches.tiktok.shared.onRenderFirstFrameMethod
|
||||
@@ -43,7 +44,7 @@ val `Playback speed` by creatingBytecodePatch(
|
||||
"""
|
||||
# Video playback location (e.g. home page, following page or search result page) retrieved using getEnterFrom method.
|
||||
const/4 v0, 0x1
|
||||
invoke-virtual { p0, v0 }, ${getEnterFromMethod.immutableMethod}
|
||||
invoke-virtual { p0, v0 }, $getEnterFromMethod
|
||||
move-result-object v0
|
||||
|
||||
# Model of current video retrieved using getCurrentAweme method.
|
||||
@@ -53,7 +54,7 @@ val `Playback speed` by creatingBytecodePatch(
|
||||
# Desired playback speed retrieved using getPlaybackSpeed method.
|
||||
invoke-static { }, Lapp/revanced/extension/tiktok/speed/PlaybackSpeedPatch;->getPlaybackSpeed()F
|
||||
move-result v2
|
||||
invoke-static { v0, v1, v2 }, $setSpeedMethod
|
||||
invoke-static { v0, v1, v2 }, ${setSpeedMethod.definingClass}->${setSpeedMethod.name}(Ljava/lang/String;Lcom/ss/android/ugc/aweme/feed/model/Aweme;F)V
|
||||
""",
|
||||
)
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ internal val BytecodePatchContext.settingsEntryMethod by gettingFirstMethodDecla
|
||||
|
||||
internal val BytecodePatchContext.settingsEntryInfoMethod by gettingFirstMethod("ExposeItem(title=", ", icon=")
|
||||
|
||||
internal val BytecodePatchContext.settingsStatusLoadMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.settingsStatusLoadMethod by gettingFirstMutableMethodDeclaratively {
|
||||
name("load")
|
||||
definingClass { endsWith("Lapp/revanced/extension/tiktok/settings/SettingsStatus;") }
|
||||
definingClass("Lapp/revanced/extension/tiktok/settings/SettingsStatus;")
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@ package app.revanced.patches.tiktok.misc.spoof.sim
|
||||
import app.revanced.patcher.extensions.addInstruction
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.getInstruction
|
||||
import app.revanced.patcher.firstMutableMethod
|
||||
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||
import app.revanced.patches.tiktok.misc.extension.sharedExtensionPatch
|
||||
import app.revanced.patches.tiktok.misc.settings.Settings
|
||||
import app.revanced.patches.tiktok.misc.settings.settingsStatusLoadMethod
|
||||
import app.revanced.util.findMutableMethodOf
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
||||
@@ -68,23 +68,21 @@ val `SIM spoof` by creatingBytecodePatch(
|
||||
}
|
||||
}
|
||||
}.forEach { (classDef, methods) ->
|
||||
with(classDef.getOrReplaceMutable()) {
|
||||
methods.forEach { (method, patches) ->
|
||||
with(findMutableMethodOf(method)) {
|
||||
while (!patches.isEmpty()) {
|
||||
val (index, replacement) = patches.removeLast()
|
||||
methods.forEach { (method, patches) ->
|
||||
with(classDef.firstMutableMethod(method)) {
|
||||
while (!patches.isEmpty()) {
|
||||
val (index, replacement) = patches.removeLast()
|
||||
|
||||
val resultReg = getInstruction<OneRegisterInstruction>(index + 1).registerA
|
||||
val resultReg = getInstruction<OneRegisterInstruction>(index + 1).registerA
|
||||
|
||||
// Patch Android API and return fake sim information.
|
||||
addInstructions(
|
||||
index + 2,
|
||||
"""
|
||||
invoke-static {v$resultReg}, Lapp/revanced/extension/tiktok/spoof/sim/SpoofSimPatch;->$replacement(Ljava/lang/String;)Ljava/lang/String;
|
||||
move-result-object v$resultReg
|
||||
""",
|
||||
)
|
||||
}
|
||||
// Patch Android API and return fake sim information.
|
||||
addInstructions(
|
||||
index + 2,
|
||||
"""
|
||||
invoke-static {v$resultReg}, Lapp/revanced/extension/tiktok/spoof/sim/SpoofSimPatch;->$replacement(Ljava/lang/String;)Ljava/lang/String;
|
||||
move-result-object v$resultReg
|
||||
""",
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import app.revanced.patcher.*
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
internal val BytecodePatchContext.brightnessMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.brightnessMethod by gettingFirstMutableMethodDeclaratively {
|
||||
name("run")
|
||||
definingClass { contains("/ScreenPlugin$") }
|
||||
accessFlags(AccessFlags.PUBLIC)
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
package app.revanced.patches.youtube.ad.general
|
||||
|
||||
import app.revanced.patcher.accessFlags
|
||||
import app.revanced.patcher.custom
|
||||
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.containsLiteralInstruction
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.indexOfFirstInstructionReversed
|
||||
@@ -13,7 +9,7 @@ import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.iface.Method
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
|
||||
internal val BytecodePatchContext.fullScreenEngagementAdContainerMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.fullScreenEngagementAdContainerMethod by gettingFirstMutableMethodDeclaratively {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("V")
|
||||
parameterTypes()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package app.revanced.patches.youtube.ad.video
|
||||
|
||||
import app.revanced.patcher.gettingFirstMethod
|
||||
import app.revanced.patcher.gettingFirstMutableMethodDeclaratively
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
|
||||
internal val BytecodePatchContext.loadVideoAdsMethod by gettingFirstMethod(
|
||||
internal val BytecodePatchContext.loadVideoAdsMethod by gettingFirstMutableMethodDeclaratively(
|
||||
"TriggerBundle doesn't have the required metadata specified by the trigger ",
|
||||
"Ping migration no associated ping bindings for activated trigger: ",
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@ import app.revanced.patcher.*
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
internal val BytecodePatchContext.offlineVideoEndpointMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.offlineVideoEndpointMethod by gettingFirstMutableMethodDeclaratively {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("V")
|
||||
parameterTypes(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package app.revanced.patches.youtube.interaction.swipecontrols
|
||||
|
||||
import app.revanced.patcher.classDef
|
||||
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||
import app.revanced.patcher.patch.resourcePatch
|
||||
import app.revanced.patches.all.misc.resources.addResources
|
||||
|
||||
@@ -54,8 +54,8 @@ val `Disable auto captions` by creatingBytecodePatch(
|
||||
arrayOf(
|
||||
startVideoInformerMethod to 0,
|
||||
storyboardRendererDecoderRecommendedLevelMethod to 1,
|
||||
).forEach { (fingerprint, enabled) ->
|
||||
fingerprint.method.addInstructions(
|
||||
).forEach { (method, enabled) ->
|
||||
method.addInstructions(
|
||||
0,
|
||||
"""
|
||||
const/4 v0, 0x$enabled
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal val BytecodePatchContext.startVideoInformerMethod by gettingFirstMethodDeclaratively("pc") {
|
||||
internal val BytecodePatchContext.startVideoInformerMethod by gettingFirstMutableMethodDeclaratively("pc") {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("V")
|
||||
opcodes(
|
||||
@@ -14,13 +14,13 @@ internal val BytecodePatchContext.startVideoInformerMethod by gettingFirstMethod
|
||||
)
|
||||
}
|
||||
|
||||
internal val BytecodePatchContext.storyboardRendererDecoderRecommendedLevelMethod by gettingFirstMethodDeclaratively("#-1#") {
|
||||
internal val BytecodePatchContext.storyboardRendererDecoderRecommendedLevelMethod by gettingFirstMutableMethodDeclaratively("#-1#") {
|
||||
returnType("V")
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
parameterTypes("L")
|
||||
}
|
||||
|
||||
internal val BytecodePatchContext.subtitleTrackMethod by gettingFirstMethodDeclaratively("DISABLE_CAPTIONS_OPTION") {
|
||||
internal val BytecodePatchContext.subtitleTrackMethod by gettingFirstMutableMethodDeclaratively("DISABLE_CAPTIONS_OPTION") {
|
||||
definingClass { endsWith("/SubtitleTrack;") }
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("Z")
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package app.revanced.patches.youtube.layout.branding
|
||||
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import app.revanced.patches.shared.layout.branding.baseCustomBrandingPatch
|
||||
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
|
||||
import app.revanced.patches.youtube.misc.gms.Constants.YOUTUBE_MAIN_ACTIVITY_NAME
|
||||
import app.revanced.patches.youtube.misc.gms.Constants.YOUTUBE_PACKAGE_NAME
|
||||
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
|
||||
import app.revanced.patches.youtube.shared.mainActivityOnCreateMethod
|
||||
|
||||
@Suppress("unused")
|
||||
val customBrandingPatch = baseCustomBrandingPatch(
|
||||
@@ -14,9 +16,9 @@ val customBrandingPatch = baseCustomBrandingPatch(
|
||||
originalAppPackageName = YOUTUBE_PACKAGE_NAME,
|
||||
isYouTubeMusic = false,
|
||||
numberOfPresetAppNames = 5,
|
||||
getMainActivityOnCreate = mainActivityOnCreateFingerprint,
|
||||
getMainActivityOnCreate = BytecodePatchContext::mainActivityOnCreateMethod::get,
|
||||
mainActivityName = YOUTUBE_MAIN_ACTIVITY_NAME,
|
||||
activityAliasNameWithIntents = "com.google.android.youtube.app.honeycomb.Shell\$HomeActivity",
|
||||
activityAliasNameWithIntents = $$"com.google.android.youtube.app.honeycomb.Shell$HomeActivity",
|
||||
preferenceScreen = PreferenceScreen.GENERAL_LAYOUT,
|
||||
|
||||
block = {
|
||||
@@ -28,7 +30,7 @@ val customBrandingPatch = baseCustomBrandingPatch(
|
||||
"20.14.43",
|
||||
"20.21.37",
|
||||
"20.31.40",
|
||||
)
|
||||
),
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@ import app.revanced.patcher.*
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
internal val BytecodePatchContext.setFullScreenBackgroundColorMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.setFullScreenBackgroundColorMethod by gettingFirstMutableMethodDeclaratively {
|
||||
name("onLayout")
|
||||
definingClass { endsWith("/YouTubePlayerViewNotForReflection;") }
|
||||
returnType("V")
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package app.revanced.patches.youtube.layout.hide.relatedvideooverlay
|
||||
|
||||
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.iface.ClassDef
|
||||
|
||||
internal val BytecodePatchContext.relatedEndScreenResultsParentMethod by gettingFirstMethodDeclaratively {
|
||||
returnType("V")
|
||||
@@ -14,7 +12,8 @@ internal val BytecodePatchContext.relatedEndScreenResultsParentMethod by getting
|
||||
)
|
||||
}
|
||||
|
||||
internal val BytecodePatchContext.relatedEndScreenResultsMethod by gettingFirstMethodDeclaratively {
|
||||
context(_: BytecodePatchContext)
|
||||
internal fun ClassDef.getRelatedEndScreenResultsMethod() = firstMutableMethodDeclaratively {
|
||||
returnType("V")
|
||||
parameterTypes(
|
||||
"I",
|
||||
|
||||
@@ -3,6 +3,7 @@ package app.revanced.patches.youtube.layout.hide.relatedvideooverlay
|
||||
import app.revanced.patcher.extensions.ExternalLabel
|
||||
import app.revanced.patcher.extensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.getInstruction
|
||||
import app.revanced.patcher.immutableClassDef
|
||||
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||
import app.revanced.patches.all.misc.resources.addResources
|
||||
import app.revanced.patches.all.misc.resources.addResourcesPatch
|
||||
@@ -42,19 +43,18 @@ val `Hide related video overlay` by creatingBytecodePatch(
|
||||
SwitchPreference("revanced_hide_related_videos_overlay"),
|
||||
)
|
||||
|
||||
relatedEndScreenResultsMethod.match(
|
||||
relatedEndScreenResultsParentMethod.immutableClassDef,
|
||||
).method.apply {
|
||||
addInstructionsWithLabels(
|
||||
0,
|
||||
"""
|
||||
invoke-static {}, $EXTENSION_CLASS_DESCRIPTOR->hideRelatedVideoOverlay()Z
|
||||
move-result v0
|
||||
if-eqz v0, :show
|
||||
return-void
|
||||
""",
|
||||
ExternalLabel("show", getInstruction(0)),
|
||||
)
|
||||
}
|
||||
val relatedEndScreenResultsMethod =
|
||||
relatedEndScreenResultsParentMethod.immutableClassDef.getRelatedEndScreenResultsMethod()
|
||||
|
||||
relatedEndScreenResultsMethod.addInstructionsWithLabels(
|
||||
0,
|
||||
"""
|
||||
invoke-static {}, $EXTENSION_CLASS_DESCRIPTOR->hideRelatedVideoOverlay()Z
|
||||
move-result v0
|
||||
if-eqz v0, :show
|
||||
return-void
|
||||
""",
|
||||
ExternalLabel("show", relatedEndScreenResultsMethod.getInstruction(0)),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,13 @@
|
||||
package app.revanced.patches.youtube.layout.hide.shorts
|
||||
|
||||
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
|
||||
import app.revanced.patcher.method
|
||||
import app.revanced.patcher.opcodes
|
||||
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
|
||||
import com.android.tools.smali.dexlib2.iface.ClassDef
|
||||
|
||||
internal val BytecodePatchContext.shortsBottomBarContainerMethod by gettingFirstMethodDeclaratively {
|
||||
internal val shortsBottomBarContainerMethodMatch = firstMethodComposite {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("V")
|
||||
parameterTypes("Landroid/view/View;", "Landroid/os/Bundle;")
|
||||
@@ -29,7 +22,9 @@ internal val BytecodePatchContext.shortsBottomBarContainerMethod by gettingFirst
|
||||
/**
|
||||
* 19.41 to 20.44.
|
||||
*/
|
||||
internal val BytecodePatchContext.renderBottomNavigationBarMethod by gettingFirstMethodDeclaratively {
|
||||
|
||||
context(_: BytecodePatchContext)
|
||||
internal fun ClassDef.getRenderBottomNavigationBarMethodMatch() = firstMutableMethodDeclaratively {
|
||||
returnType("V")
|
||||
parameterTypes("Ljava/lang/String;")
|
||||
instructions(
|
||||
@@ -38,7 +33,6 @@ internal val BytecodePatchContext.renderBottomNavigationBarMethod by gettingFirs
|
||||
after(Opcode.IGET_OBJECT()),
|
||||
after(Opcode.IF_EQZ()),
|
||||
after(Opcode.INVOKE_INTERFACE()),
|
||||
|
||||
Opcode.MONITOR_EXIT(),
|
||||
after(Opcode.RETURN_VOID()),
|
||||
after(Opcode.MOVE_EXCEPTION()),
|
||||
@@ -97,7 +91,7 @@ internal val BytecodePatchContext.renderBottomNavigationBarParentMethod by getti
|
||||
)
|
||||
}
|
||||
|
||||
internal val BytecodePatchContext.setPivotBarVisibilityMethod by gettingFirstMethodDeclaratively {
|
||||
internal val setPivotBarVisibilityMethodMatch = firstMethodComposite {
|
||||
accessFlags(AccessFlags.PRIVATE, AccessFlags.FINAL)
|
||||
returnType("V")
|
||||
parameterTypes("Z")
|
||||
@@ -114,7 +108,7 @@ internal val BytecodePatchContext.setPivotBarVisibilityParentMethod by gettingFi
|
||||
)
|
||||
}
|
||||
|
||||
internal val BytecodePatchContext.shortsExperimentalPlayerFeatureFlagMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.shortsExperimentalPlayerFeatureFlagMethod by gettingFirstMutableMethodDeclaratively {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("Z")
|
||||
parameterTypes()
|
||||
@@ -123,7 +117,7 @@ internal val BytecodePatchContext.shortsExperimentalPlayerFeatureFlagMethod by g
|
||||
)
|
||||
}
|
||||
|
||||
internal val BytecodePatchContext.renderNextUIFeatureFlagMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.renderNextUIFeatureFlagMethod by gettingFirstMutableMethodDeclaratively {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("Z")
|
||||
parameterTypes()
|
||||
|
||||
@@ -4,6 +4,7 @@ import app.revanced.patcher.extensions.addInstruction
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.getInstruction
|
||||
import app.revanced.patcher.extensions.wideLiteral
|
||||
import app.revanced.patcher.immutableClassDef
|
||||
import app.revanced.patcher.patch.booleanOption
|
||||
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||
import app.revanced.patcher.patch.resourcePatch
|
||||
@@ -209,11 +210,9 @@ val `Hide Shorts components` by creatingBytecodePatch(
|
||||
// region Hide the navigation bar.
|
||||
|
||||
// Hook to get the pivotBar view.
|
||||
setPivotBarVisibilityMethod.match(
|
||||
setPivotBarVisibilityParentMethod.immutableClassDef,
|
||||
).let { result ->
|
||||
result.method.apply {
|
||||
val insertIndex = result.indices.last()
|
||||
setPivotBarVisibilityMethodMatch.match(setPivotBarVisibilityParentMethod.immutableClassDef).let { match ->
|
||||
match.method.apply {
|
||||
val insertIndex = match.indices.last()
|
||||
val viewRegister = getInstruction<OneRegisterInstruction>(insertIndex - 1).registerA
|
||||
addInstruction(
|
||||
insertIndex,
|
||||
@@ -224,23 +223,21 @@ val `Hide Shorts components` by creatingBytecodePatch(
|
||||
}
|
||||
|
||||
// Hook to hide the shared navigation bar when the Shorts player is opened.
|
||||
renderBottomNavigationBarMethod.match(
|
||||
(
|
||||
if (is_20_45_or_greater) {
|
||||
renderBottomNavigationBarParentMethod
|
||||
} else if (is_19_41_or_greater) {
|
||||
renderBottomNavigationBarLegacy1941ParentMethod
|
||||
} else {
|
||||
legacyRenderBottomNavigationBarLegacyParentMethod
|
||||
}
|
||||
).immutableClassDef,
|
||||
).method.addInstruction(
|
||||
(
|
||||
if (is_20_45_or_greater) {
|
||||
renderBottomNavigationBarParentMethod
|
||||
} else if (is_19_41_or_greater) {
|
||||
renderBottomNavigationBarLegacy1941ParentMethod
|
||||
} else {
|
||||
legacyRenderBottomNavigationBarLegacyParentMethod
|
||||
}
|
||||
).immutableClassDef.getRenderBottomNavigationBarMethodMatch().addInstruction(
|
||||
0,
|
||||
"invoke-static { p1 }, $FILTER_CLASS_DESCRIPTOR->hideNavigationBar(Ljava/lang/String;)V",
|
||||
)
|
||||
|
||||
// Hide the bottom bar container of the Shorts player.
|
||||
shortsBottomBarContainerMethod.let {
|
||||
shortsBottomBarContainerMethodMatch.let {
|
||||
it.method.apply {
|
||||
val targetIndex = it.indices.last()
|
||||
val heightRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
@@ -1,19 +1,14 @@
|
||||
package app.revanced.patches.youtube.layout.hide.signintotvpopup
|
||||
|
||||
import app.revanced.patcher.gettingFirstMethodDeclaratively
|
||||
import app.revanced.patcher.gettingFirstMutableMethodDeclaratively
|
||||
import app.revanced.patcher.instructions
|
||||
import app.revanced.patcher.parameterTypes
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import app.revanced.patcher.returnType
|
||||
import app.revanced.patches.shared.misc.mapping.ResourceType
|
||||
|
||||
internal val BytecodePatchContext.signInToTvPopupMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.signInToTvPopupMethod by gettingFirstMutableMethodDeclaratively {
|
||||
returnType("Z")
|
||||
parameterTypes("Ljava/lang/String;", "Z", "L")
|
||||
instructions(
|
||||
resourceLiteral(
|
||||
ResourceType.STRING,
|
||||
"mdx_seamless_tv_sign_in_drawer_fragment_title",
|
||||
),
|
||||
)
|
||||
instructions(ResourceType.STRING("mdx_seamless_tv_sign_in_drawer_fragment_title"))
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal val BytecodePatchContext.timeCounterMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.timeCounterMethod by gettingFirstMutableMethodDeclaratively {
|
||||
returnType("V")
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
parameterTypes()
|
||||
|
||||
@@ -2,6 +2,7 @@ package app.revanced.patches.youtube.layout.searchbar
|
||||
|
||||
import app.revanced.patcher.accessFlags
|
||||
import app.revanced.patcher.gettingFirstMethodDeclaratively
|
||||
import app.revanced.patcher.gettingFirstMutableMethodDeclaratively
|
||||
import app.revanced.patcher.instructions
|
||||
import app.revanced.patcher.parameterTypes
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
@@ -23,7 +24,7 @@ internal val BytecodePatchContext.setWordmarkHeaderMethod by gettingFirstMethodD
|
||||
/**
|
||||
* Matches the same method as [yoodlesImageViewMethod].
|
||||
*/
|
||||
internal val BytecodePatchContext.wideSearchbarLayoutMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.wideSearchbarLayoutMethod by gettingFirstMutableMethodDeclaratively {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("Landroid/view/View;")
|
||||
parameterTypes("L", "L")
|
||||
|
||||
@@ -62,28 +62,26 @@ val `Wide search bar` by creatingBytecodePatch(
|
||||
SwitchPreference("revanced_wide_searchbar"),
|
||||
)
|
||||
|
||||
setWordmarkHeaderMethod.let {
|
||||
// Navigate to the method that checks if the YT logo is shown beside the search bar.
|
||||
val shouldShowLogoMethod = with(it.immutableMethod) {
|
||||
val invokeStaticIndex = indexOfFirstInstructionOrThrow {
|
||||
opcode == Opcode.INVOKE_STATIC &&
|
||||
getReference<MethodReference>()?.returnType == "Z"
|
||||
}
|
||||
navigate(this).to(invokeStaticIndex).stop()
|
||||
// Navigate to the method that checks if the YT logo is shown beside the search bar.
|
||||
val shouldShowLogoMethod = with(setWordmarkHeaderMethod) {
|
||||
val invokeStaticIndex = indexOfFirstInstructionOrThrow {
|
||||
opcode == Opcode.INVOKE_STATIC &&
|
||||
getReference<MethodReference>()?.returnType == "Z"
|
||||
}
|
||||
navigate(this).to(invokeStaticIndex).stop()
|
||||
}
|
||||
|
||||
shouldShowLogoMethod.apply {
|
||||
findInstructionIndicesReversedOrThrow(Opcode.RETURN).forEach { index ->
|
||||
val register = getInstruction<OneRegisterInstruction>(index).registerA
|
||||
shouldShowLogoMethod.apply {
|
||||
findInstructionIndicesReversedOrThrow(Opcode.RETURN).forEach { index ->
|
||||
val register = getInstruction<OneRegisterInstruction>(index).registerA
|
||||
|
||||
addInstructionsAtControlFlowLabel(
|
||||
index,
|
||||
"""
|
||||
invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->enableWideSearchbar(Z)Z
|
||||
move-result v$register
|
||||
""",
|
||||
)
|
||||
}
|
||||
addInstructionsAtControlFlowLabel(
|
||||
index,
|
||||
"""
|
||||
invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->enableWideSearchbar(Z)Z
|
||||
move-result v$register
|
||||
""",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ 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.fullscreenSeekbarThumbnailsMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.fullscreenSeekbarThumbnailsMethod by gettingFirstMutableMethodDeclaratively {
|
||||
returnType("Z")
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
parameterTypes()
|
||||
|
||||
@@ -116,9 +116,9 @@ val `Shorts autoplay` by creatingBytecodePatch(
|
||||
if (is_20_09_or_greater) {
|
||||
// Variable names are only a rough guess of what these methods do.
|
||||
val userActionMethodReference =
|
||||
reelPlaybackMethodMatch.method.getInstruction(reelPlaybackMethodMatch.indices[1]).methodReference
|
||||
reelPlaybackMethodMatch.method.getInstruction(reelPlaybackMethodMatch.indices[1]).methodReference!!
|
||||
val reelSequenceControllerMethodReference =
|
||||
reelPlaybackMethodMatch.method.getInstruction(reelPlaybackMethodMatch.indices[2]).methodReference
|
||||
reelPlaybackMethodMatch.method.getInstruction(reelPlaybackMethodMatch.indices[2]).methodReference!!
|
||||
|
||||
reelPlaybackRepeatMethod.apply {
|
||||
// Find the first call modified by extension code above.
|
||||
|
||||
@@ -24,7 +24,7 @@ internal val userWasInShortsAlternativeMethodMatch = firstMethodComposite {
|
||||
/**
|
||||
* Pre 20.02
|
||||
*/
|
||||
internal val BytecodePatchContext.userWasInShortsLegacyMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.userWasInShortsLegacyMethod by gettingFirstMutableMethodDeclaratively {
|
||||
returnType("V")
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
parameterTypes("Ljava/lang/Object;")
|
||||
@@ -36,7 +36,7 @@ internal val BytecodePatchContext.userWasInShortsLegacyMethod by gettingFirstMet
|
||||
/**
|
||||
* 18.15.40+
|
||||
*/
|
||||
internal val BytecodePatchContext.userWasInShortsConfigMethod by gettingFirstMethodDeclaratively {
|
||||
internal val BytecodePatchContext.userWasInShortsConfigMethod by gettingFirstMutableMethodDeclaratively {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("Z")
|
||||
parameterTypes()
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package app.revanced.util
|
||||
|
||||
import app.revanced.patcher.MutablePredicateList
|
||||
import app.revanced.patcher.custom
|
||||
import app.revanced.patcher.*
|
||||
import app.revanced.patcher.extensions.*
|
||||
import app.revanced.patcher.firstMutableClassDef
|
||||
import app.revanced.patcher.firstMutableClassDefOrNull
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patches.shared.misc.mapping.ResourceType
|
||||
@@ -258,16 +255,6 @@ internal fun Int.toPublicAccessFlags(): Int = this.or(AccessFlags.PUBLIC.value)
|
||||
.and(AccessFlags.PROTECTED.value.inv())
|
||||
.and(AccessFlags.PRIVATE.value.inv())
|
||||
|
||||
/**
|
||||
* Find the [MutableMethod] from a given [Method] in a [MutableClass].
|
||||
*
|
||||
* @param method The [Method] to find.
|
||||
* @return The [MutableMethod].
|
||||
*/
|
||||
fun MutableClassDef.findMutableMethodOf(method: Method) = this.methods.first {
|
||||
MethodUtil.methodSignaturesMatch(it, method)
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply a transform to all methods of the class.
|
||||
*
|
||||
@@ -805,7 +792,7 @@ fun BytecodePatchContext.forEachInstructionAsSequence(
|
||||
val instructions =
|
||||
method.instructionsOrNull as? List<Instruction> ?: return@flatMap emptySequence<() -> Unit>()
|
||||
|
||||
val mutableMethod by lazy { mutableClassDef.findMutableMethodOf(method) }
|
||||
val mutableMethod by lazy { mutableClassDef.firstMutableMethod(method) }
|
||||
|
||||
instructions.asReversed().asSequence().mapIndexed { index, instruction ->
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user