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