mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 05:07:41 +02:00
refactor: move the patch to the correct path
This commit is contained in:
@ -10,8 +10,8 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.adAttributionId
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.AdAttribution
|
||||
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
@ -25,14 +25,14 @@ class GeneralAdsBytecodePatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
context.classes.forEach { classDef ->
|
||||
classDef.methods.forEach { method ->
|
||||
if (!method.isWideLiteralExists(adAttributionId))
|
||||
if (!method.isWideLiteralExists(AdAttribution))
|
||||
return@forEach
|
||||
|
||||
context.proxy(classDef)
|
||||
.mutableClass
|
||||
.findMutableMethodOf(method)
|
||||
.apply {
|
||||
val insertIndex = method.getWideLiteralIndex(adAttributionId) + 1
|
||||
val insertIndex = method.getWideLiteralIndex(AdAttribution) + 1
|
||||
if (getInstruction(insertIndex).opcode != org.jf.dexlib2.Opcode.INVOKE_VIRTUAL)
|
||||
return@forEach
|
||||
|
||||
|
@ -15,8 +15,7 @@ import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.ads.general.bytecode.patch.GeneralAdsBytecodePatch
|
||||
import app.revanced.patches.youtube.ads.getpremium.patch.HideGetPremiumPatch
|
||||
import app.revanced.patches.youtube.misc.litho.patch.ByteBufferFilterPatch
|
||||
import app.revanced.patches.youtube.misc.litho.patch.LithoFilterPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import org.w3c.dom.Element
|
||||
|
||||
@Patch
|
||||
|
@ -11,7 +11,7 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.shared.patch.videoads.GeneralVideoAdsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.ADS_PATH
|
||||
|
||||
@Patch
|
||||
@ -31,7 +31,7 @@ class VideoAdsPatch : BytecodePatch() {
|
||||
GeneralVideoAdsPatch.injectLegacyAds(INTEGRATIONS_CLASS_DESCRIPTOR)
|
||||
GeneralVideoAdsPatch.injectMainstreamAds(INTEGRATIONS_CLASS_DESCRIPTOR)
|
||||
|
||||
/*
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.buttomplayer.buttoncontainer.patch
|
||||
package app.revanced.patches.youtube.buttomplayer.buttoncontainer.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
@ -11,7 +11,7 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.misc.litho.patch.ByteBufferFilterPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.BOTTOM_PLAYER
|
||||
|
||||
@Patch
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.buttomplayer.comment.patch
|
||||
package app.revanced.patches.youtube.buttomplayer.comment.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
@ -11,7 +11,7 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.ads.general.bytecode.patch.GeneralAdsBytecodePatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
|
||||
@Patch
|
||||
@Name("hide-comment-component")
|
@ -1,40 +0,0 @@
|
||||
package app.revanced.patches.youtube.button.overlaybuttons.bytecode.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.misc.playercontrols.patch.PlayerControlsPatch
|
||||
import app.revanced.patches.youtube.misc.videoid.legacy.patch.LegacyVideoIdPatch
|
||||
import app.revanced.util.integrations.Constants.BUTTON_PATH
|
||||
|
||||
@Name("overlay-buttons-bytecode-patch")
|
||||
@DependsOn(
|
||||
dependencies = [
|
||||
PlayerControlsPatch::class,
|
||||
LegacyVideoIdPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class OverlayButtonsBytecodePatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
arrayOf(
|
||||
"Download",
|
||||
"AutoRepeat",
|
||||
"CopyWithTimeStamp",
|
||||
"Copy",
|
||||
"Speed"
|
||||
).forEach {
|
||||
PlayerControlsPatch.initializeControl("$BUTTON_PATH/$it;")
|
||||
PlayerControlsPatch.injectVisibility("$BUTTON_PATH/$it;")
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.flyoutpanel.flyoutpanel.patch
|
||||
package app.revanced.patches.youtube.flyoutpanel.flyoutpanel.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
@ -11,7 +11,7 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.ads.general.resource.patch.GeneralAdsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
|
||||
@Patch
|
||||
@Name("hide-flyout-panel")
|
@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.flyoutpanel.oldqualitylayout.fingerprints
|
||||
package app.revanced.patches.youtube.flyoutpanel.oldqualitylayout.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.videoQualityFragmentId
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.VideoQualityBottomSheet
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@ -22,5 +22,5 @@ object QualityMenuViewInflateFingerprint : MethodFingerprint(
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.CHECK_CAST
|
||||
),
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(videoQualityFragmentId) }
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(VideoQualityBottomSheet) }
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.flyoutpanel.oldqualitylayout.patch
|
||||
package app.revanced.patches.youtube.flyoutpanel.oldqualitylayout.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -13,9 +13,9 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.flyoutpanel.oldqualitylayout.fingerprints.QualityMenuViewInflateFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.flyoutpanel.oldqualitylayout.fingerprints.QualityMenuViewInflateFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.FLYOUT_PANEL
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@ -31,9 +31,7 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class OldQualityLayoutPatch : BytecodePatch(
|
||||
listOf(
|
||||
QualityMenuViewInflateFingerprint
|
||||
)
|
||||
listOf(QualityMenuViewInflateFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.fullscreen.autoplaypreview.patch
|
||||
package app.revanced.patches.youtube.fullscreen.autoplaypreview.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -15,9 +15,9 @@ import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.shared.fingerprints.LayoutConstructorFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.autoNavPreviewId
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.AutoNavPreviewStub
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.bytecode.getStringIndex
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
import app.revanced.util.integrations.Constants.FULLSCREEN
|
||||
@ -41,25 +41,27 @@ class HideAutoplayPreviewPatch : BytecodePatch(
|
||||
listOf(LayoutConstructorFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
LayoutConstructorFingerprint.result?.mutableMethod?.let {
|
||||
val insertInstruction = it.implementation!!.instructions
|
||||
LayoutConstructorFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertInstruction = implementation!!.instructions
|
||||
|
||||
val dummyRegister = it.getInstruction<OneRegisterInstruction>(it.getStringIndex("1.0x")).registerA
|
||||
val insertIndex = it.getWideLiteralIndex(autoNavPreviewId)
|
||||
val dummyRegister = getInstruction<OneRegisterInstruction>(getStringIndex("1.0x")).registerA
|
||||
val insertIndex = getWideLiteralIndex(AutoNavPreviewStub)
|
||||
|
||||
val branchIndex = insertInstruction.subList(insertIndex + 1, insertInstruction.size - 1).indexOfFirst { instruction ->
|
||||
((instruction as? ReferenceInstruction)?.reference as? FieldReference)?.type == "Lcom/google/android/apps/youtube/app/player/autonav/AutonavToggleController;"
|
||||
} + 1
|
||||
val branchIndex = insertInstruction.subList(insertIndex + 1, insertInstruction.size - 1).indexOfFirst { instruction ->
|
||||
((instruction as? ReferenceInstruction)?.reference as? FieldReference)?.type == "Lcom/google/android/apps/youtube/app/player/autonav/AutonavToggleController;"
|
||||
} + 1
|
||||
|
||||
val jumpInstruction = it.getInstruction<Instruction>(insertIndex + branchIndex)
|
||||
val jumpInstruction = getInstruction<Instruction>(insertIndex + branchIndex)
|
||||
|
||||
it.addInstructionsWithLabels(
|
||||
insertIndex, """
|
||||
invoke-static {}, $FULLSCREEN->hideAutoPlayPreview()Z
|
||||
move-result v$dummyRegister
|
||||
if-nez v$dummyRegister, :hidden
|
||||
""", ExternalLabel("hidden", jumpInstruction)
|
||||
)
|
||||
addInstructionsWithLabels(
|
||||
insertIndex, """
|
||||
invoke-static {}, $FULLSCREEN->hideAutoPlayPreview()Z
|
||||
move-result v$dummyRegister
|
||||
if-nez v$dummyRegister, :hidden
|
||||
""", ExternalLabel("hidden", jumpInstruction)
|
||||
)
|
||||
}
|
||||
} ?: return LayoutConstructorFingerprint.toErrorResult()
|
||||
|
||||
/**
|
@ -0,0 +1,10 @@
|
||||
package app.revanced.patches.youtube.fullscreen.endscreenoverlay.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.AppRelatedEndScreenResults
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
|
||||
object EndScreenResultsFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(AppRelatedEndScreenResults) }
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.fullscreen.endscreenoverlay.patch
|
||||
package app.revanced.patches.youtube.fullscreen.endscreenoverlay.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -14,9 +14,9 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.fullscreen.endscreenoverlay.fingerprints.EndScreenResultsFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.fullscreen.endscreenoverlay.fingerprints.EndScreenResultsFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.FULLSCREEN
|
||||
|
||||
@Patch
|
||||
@ -34,15 +34,17 @@ class HideEndScreenOverlayPatch : BytecodePatch(
|
||||
listOf(EndScreenResultsFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
EndScreenResultsFingerprint.result?.mutableMethod?.let {
|
||||
it.addInstructionsWithLabels(
|
||||
0, """
|
||||
invoke-static {}, $FULLSCREEN->hideEndScreenOverlay()Z
|
||||
move-result v0
|
||||
if-eqz v0, :show
|
||||
return-void
|
||||
""", ExternalLabel("show", it.getInstruction(0))
|
||||
)
|
||||
EndScreenResultsFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
addInstructionsWithLabels(
|
||||
0, """
|
||||
invoke-static {}, $FULLSCREEN->hideEndScreenOverlay()Z
|
||||
move-result v0
|
||||
if-eqz v0, :show
|
||||
return-void
|
||||
""", ExternalLabel("show", getInstruction(0))
|
||||
)
|
||||
}
|
||||
} ?: return EndScreenResultsFingerprint.toErrorResult()
|
||||
|
||||
/**
|
@ -0,0 +1,10 @@
|
||||
package app.revanced.patches.youtube.fullscreen.fullscreenpanels.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.FullScreenEngagementPanel
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
|
||||
object FullscreenEngagementPanelFingerprint : MethodFingerprint(
|
||||
returnType = "L",
|
||||
customFingerprint = { it, _ -> it.definingClass.endsWith("FullscreenEngagementPanelOverlay;") && it.isWideLiteralExists(FullScreenEngagementPanel) }
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.fingerprints
|
||||
package app.revanced.patches.youtube.fullscreen.fullscreenpanels.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.Opcode
|
@ -1,10 +1,11 @@
|
||||
package app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.patch
|
||||
package app.revanced.patches.youtube.fullscreen.fullscreenpanels.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
@ -17,10 +18,14 @@ import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.shared.fingerprints.LayoutConstructorFingerprint
|
||||
import app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.fingerprints.FullscreenViewAdderFingerprint
|
||||
import app.revanced.patches.youtube.layout.fullscreen.quickactions.patch.QuickActionsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.fullscreen.fullscreenpanels.fingerprints.FullscreenEngagementPanelFingerprint
|
||||
import app.revanced.patches.youtube.fullscreen.fullscreenpanels.fingerprints.FullscreenViewAdderFingerprint
|
||||
import app.revanced.patches.youtube.utils.quickactionscontainer.patch.HideQuickActionsContainerPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.FullScreenEngagementPanel
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.bytecode.getStringIndex
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
import app.revanced.util.integrations.Constants.FULLSCREEN
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@ -32,19 +37,34 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
||||
@Description("Hides video description and comments panel in fullscreen view.")
|
||||
@DependsOn(
|
||||
[
|
||||
QuickActionsPatch::class,
|
||||
SettingsPatch::class
|
||||
HideQuickActionsContainerPatch::class,
|
||||
SettingsPatch::class,
|
||||
SharedResourceIdPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideFullscreenPanelsPatch : BytecodePatch(
|
||||
listOf(
|
||||
FullscreenEngagementPanelFingerprint,
|
||||
FullscreenViewAdderFingerprint,
|
||||
LayoutConstructorFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
FullscreenEngagementPanelFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = getWideLiteralIndex(FullScreenEngagementPanel) + 3
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
targetIndex + 1,
|
||||
"invoke-static {v$targetRegister}, $FULLSCREEN->hideFullscreenPanels(Landroidx/coordinatorlayout/widget/CoordinatorLayout;)V"
|
||||
)
|
||||
}
|
||||
} ?: return FullscreenEngagementPanelFingerprint.toErrorResult()
|
||||
|
||||
FullscreenViewAdderFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
@ -59,25 +79,26 @@ class HideFullscreenPanelsPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return FullscreenViewAdderFingerprint.toErrorResult()
|
||||
}
|
||||
|
||||
LayoutConstructorFingerprint.result?.mutableMethod?.let {
|
||||
val instructions = it.implementation!!.instructions
|
||||
val dummyRegister = it.getInstruction<OneRegisterInstruction>(it.getStringIndex("1.0x")).registerA
|
||||
LayoutConstructorFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val dummyRegister = getInstruction<OneRegisterInstruction>(getStringIndex("1.0x")).registerA
|
||||
|
||||
val invokeIndex = instructions.indexOfFirst { instruction ->
|
||||
instruction.opcode == Opcode.INVOKE_VIRTUAL &&
|
||||
((instruction as ReferenceInstruction).reference.toString() ==
|
||||
"Landroid/widget/FrameLayout;->addView(Landroid/view/View;)V")
|
||||
val invokeIndex = implementation!!.instructions.indexOfFirst { instruction ->
|
||||
instruction.opcode == Opcode.INVOKE_VIRTUAL &&
|
||||
((instruction as ReferenceInstruction).reference.toString() ==
|
||||
"Landroid/widget/FrameLayout;->addView(Landroid/view/View;)V")
|
||||
}
|
||||
|
||||
addInstructionsWithLabels(
|
||||
invokeIndex, """
|
||||
invoke-static {}, $FULLSCREEN->showFullscreenTitle()Z
|
||||
move-result v$dummyRegister
|
||||
if-eqz v$dummyRegister, :hidden
|
||||
""", ExternalLabel("hidden", getInstruction(invokeIndex + 1))
|
||||
)
|
||||
}
|
||||
|
||||
it.addInstructionsWithLabels(
|
||||
invokeIndex, """
|
||||
invoke-static {}, $FULLSCREEN->showFullscreenTitle()Z
|
||||
move-result v$dummyRegister
|
||||
if-eqz v$dummyRegister, :hidden
|
||||
""", ExternalLabel("hidden", it.getInstruction(invokeIndex + 1))
|
||||
)
|
||||
} ?: return LayoutConstructorFingerprint.toErrorResult()
|
||||
|
||||
/**
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.fullscreen.landscapemode.fingerprints
|
||||
package app.revanced.patches.youtube.fullscreen.landscapemode.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.fullscreen.landscapemode.fingerprints
|
||||
package app.revanced.patches.youtube.fullscreen.landscapemode.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.fullscreen.landscapemode.fingerprints
|
||||
package app.revanced.patches.youtube.fullscreen.landscapemode.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.fullscreen.landscapemode.patch
|
||||
package app.revanced.patches.youtube.fullscreen.landscapemode.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -15,8 +15,8 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.fullscreen.landscapemode.fingerprints.*
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.fullscreen.landscapemode.fingerprints.*
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.FULLSCREEN
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.fullscreen.quickactions.patch
|
||||
package app.revanced.patches.youtube.fullscreen.quickactions.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
@ -11,7 +11,8 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.ads.general.resource.patch.GeneralAdsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.utils.quickactionscontainer.patch.HideQuickActionsContainerPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
|
||||
@Patch
|
||||
@Name("hide-quick-actions")
|
||||
@ -19,6 +20,7 @@ import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
@DependsOn(
|
||||
[
|
||||
GeneralAdsPatch::class,
|
||||
HideQuickActionsContainerPatch::class,
|
||||
SettingsPatch::class
|
||||
]
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.general.accountmenu.fingerprints
|
||||
package app.revanced.patches.youtube.general.accountmenu.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.Opcode
|
@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.general.accountmenu.fingerprints
|
||||
package app.revanced.patches.youtube.general.accountmenu.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.compactLinkId
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.CompactLink
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@ -12,5 +12,5 @@ object AccountMenuParentFingerprint : MethodFingerprint(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT
|
||||
),
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(compactLinkId) }
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(CompactLink) }
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.general.accountmenu.patch
|
||||
package app.revanced.patches.youtube.general.accountmenu.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -14,10 +14,10 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.general.accountmenu.fingerprints.AccountMenuFingerprint
|
||||
import app.revanced.patches.youtube.layout.general.accountmenu.fingerprints.AccountMenuParentFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.general.accountmenu.fingerprints.AccountMenuFingerprint
|
||||
import app.revanced.patches.youtube.general.accountmenu.fingerprints.AccountMenuParentFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.GENERAL
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.general.autocaptions.fingerprints
|
||||
package app.revanced.patches.youtube.general.autocaptions.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.general.autocaptions.patch
|
||||
package app.revanced.patches.youtube.general.autocaptions.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -18,9 +18,9 @@ import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.shared.fingerprints.SubtitleButtonControllerFingerprint
|
||||
import app.revanced.patches.shared.fingerprints.SubtitleTrackFingerprint
|
||||
import app.revanced.patches.youtube.layout.general.autocaptions.fingerprints.StartVideoInformerFingerprint
|
||||
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.general.autocaptions.fingerprints.StartVideoInformerFingerprint
|
||||
import app.revanced.patches.youtube.utils.playertype.patch.PlayerTypeHookPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.GENERAL
|
||||
|
||||
@Patch
|
||||
@ -46,29 +46,28 @@ class AutoCaptionsPatch : BytecodePatch(
|
||||
StartVideoInformerFingerprint.toPatch(Status.DISABLED),
|
||||
SubtitleButtonControllerFingerprint.toPatch(Status.ENABLED)
|
||||
).forEach { (fingerprint, status) ->
|
||||
with(fingerprint.result?.mutableMethod ?: return fingerprint.toErrorResult()) {
|
||||
addInstructions(
|
||||
0,
|
||||
fingerprint.result?.mutableMethod?.addInstructions(
|
||||
0, """
|
||||
const/4 v0, ${status.value}
|
||||
sput-boolean v0, $GENERAL->captionsButtonStatus:Z
|
||||
"""
|
||||
const/4 v0, ${status.value}
|
||||
sput-boolean v0, $GENERAL->captionsButtonStatus:Z
|
||||
"""
|
||||
)
|
||||
}
|
||||
)?: return fingerprint.toErrorResult()
|
||||
}
|
||||
|
||||
SubtitleTrackFingerprint.result?.mutableMethod?.let {
|
||||
it.addInstructionsWithLabels(
|
||||
0, """
|
||||
invoke-static {}, $GENERAL->hideAutoCaptions()Z
|
||||
move-result v0
|
||||
if-eqz v0, :auto_captions_shown
|
||||
sget-boolean v0, $GENERAL->captionsButtonStatus:Z
|
||||
if-nez v0, :auto_captions_shown
|
||||
const/4 v0, 0x1
|
||||
return v0
|
||||
""", ExternalLabel("auto_captions_shown", it.getInstruction(0))
|
||||
)
|
||||
SubtitleTrackFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
addInstructionsWithLabels(
|
||||
0, """
|
||||
invoke-static {}, $GENERAL->hideAutoCaptions()Z
|
||||
move-result v0
|
||||
if-eqz v0, :auto_captions_shown
|
||||
sget-boolean v0, $GENERAL->captionsButtonStatus:Z
|
||||
if-nez v0, :auto_captions_shown
|
||||
const/4 v0, 0x1
|
||||
return v0
|
||||
""", ExternalLabel("auto_captions_shown", getInstruction(0))
|
||||
)
|
||||
}
|
||||
} ?: return SubtitleTrackFingerprint.toErrorResult()
|
||||
|
||||
/**
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.general.autopopuppanels.fingerprints
|
||||
package app.revanced.patches.youtube.general.autopopuppanels.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.general.autopopuppanels.patch
|
||||
package app.revanced.patches.youtube.general.autopopuppanels.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -14,8 +14,8 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.general.autopopuppanels.fingerprints.EngagementPanelControllerFingerprint
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.general.autopopuppanels.fingerprints.EngagementPanelControllerFingerprint
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.GENERAL
|
||||
|
||||
@Patch
|
||||
@ -29,17 +29,19 @@ class PlayerPopupPanelsPatch : BytecodePatch(
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
EngagementPanelControllerFingerprint.result?.mutableMethod?.let {
|
||||
it.addInstructionsWithLabels(
|
||||
0, """
|
||||
invoke-static {}, $GENERAL->hideAutoPlayerPopupPanels()Z
|
||||
move-result v0
|
||||
if-eqz v0, :player_popup_panels_shown
|
||||
if-eqz p4, :player_popup_panels_shown
|
||||
const/4 v0, 0x0
|
||||
return-object v0
|
||||
""", ExternalLabel("player_popup_panels_shown", it.getInstruction(0))
|
||||
)
|
||||
EngagementPanelControllerFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
addInstructionsWithLabels(
|
||||
0, """
|
||||
invoke-static {}, $GENERAL->hideAutoPlayerPopupPanels()Z
|
||||
move-result v0
|
||||
if-eqz v0, :player_popup_panels_shown
|
||||
if-eqz p4, :player_popup_panels_shown
|
||||
const/4 v0, 0x0
|
||||
return-object v0
|
||||
""", ExternalLabel("player_popup_panels_shown", getInstruction(0))
|
||||
)
|
||||
}
|
||||
} ?: return EngagementPanelControllerFingerprint.toErrorResult()
|
||||
|
||||
/**
|
@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.general.breakingnews.fingerprints
|
||||
package app.revanced.patches.youtube.general.breakingnews.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.horizontalCardListId
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.HorizontalCardList
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@ -12,5 +12,5 @@ object BreakingNewsFingerprint : MethodFingerprint(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT
|
||||
),
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(horizontalCardListId) }
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(HorizontalCardList) }
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.general.breakingnews.patch
|
||||
package app.revanced.patches.youtube.general.breakingnews.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -13,9 +13,9 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.general.breakingnews.fingerprints.BreakingNewsFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.general.breakingnews.fingerprints.BreakingNewsFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.GENERAL
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.general.categorybar.fingerprints
|
||||
package app.revanced.patches.youtube.general.categorybar.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.filterBarHeightId
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.FilterBarHeight
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@ -12,5 +12,5 @@ object FilterBarHeightFingerprint : MethodFingerprint(
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.IPUT
|
||||
),
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(filterBarHeightId) }
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(FilterBarHeight) }
|
||||
)
|
@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.general.categorybar.fingerprints
|
||||
package app.revanced.patches.youtube.general.categorybar.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.relatedChipCloudMarginId
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.RelatedChipCloudMargin
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@ -11,5 +11,5 @@ object RelatedChipCloudFingerprint : MethodFingerprint(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT
|
||||
),
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(relatedChipCloudMarginId) }
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(RelatedChipCloudMargin) }
|
||||
)
|
@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.general.categorybar.fingerprints
|
||||
package app.revanced.patches.youtube.general.categorybar.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.barContainerHeightId
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.BarContainerHeight
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@ -13,5 +13,5 @@ object SearchResultsChipBarFingerprint : MethodFingerprint(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT
|
||||
),
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(barContainerHeightId) }
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(BarContainerHeight) }
|
||||
)
|
@ -0,0 +1,96 @@
|
||||
package app.revanced.patches.youtube.general.categorybar.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.general.categorybar.fingerprints.FilterBarHeightFingerprint
|
||||
import app.revanced.patches.youtube.general.categorybar.fingerprints.RelatedChipCloudFingerprint
|
||||
import app.revanced.patches.youtube.general.categorybar.fingerprints.SearchResultsChipBarFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.GENERAL
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@Name("hide-category-bar")
|
||||
@Description("Hide the category bar at the top of the feed and at the top of related videos.")
|
||||
@DependsOn(
|
||||
[
|
||||
SettingsPatch::class,
|
||||
SharedResourceIdPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class CategoryBarPatch : BytecodePatch(
|
||||
listOf(
|
||||
FilterBarHeightFingerprint,
|
||||
RelatedChipCloudFingerprint,
|
||||
SearchResultsChipBarFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
FilterBarHeightFingerprint.patch<TwoRegisterInstruction> { register ->
|
||||
"""
|
||||
invoke-static { v$register }, $GENERAL->hideCategoryBarInFeed(I)I
|
||||
move-result v$register
|
||||
"""
|
||||
}
|
||||
|
||||
RelatedChipCloudFingerprint.patch<OneRegisterInstruction>(1) { register ->
|
||||
"invoke-static { v$register }, " +
|
||||
"$GENERAL->hideCategoryBarInRelatedVideo(Landroid/view/View;)V"
|
||||
}
|
||||
|
||||
SearchResultsChipBarFingerprint.patch<OneRegisterInstruction>(-1, -2) { register ->
|
||||
"""
|
||||
invoke-static { v$register }, $GENERAL->hideCategoryBarInSearchResults(I)I
|
||||
move-result v$register
|
||||
"""
|
||||
}
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: GENERAL_SETTINGS",
|
||||
"SETTINGS: HIDE_CATEGORY_BAR"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-category-bar")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
private companion object {
|
||||
private fun <RegisterInstruction: OneRegisterInstruction> MethodFingerprint.patch(
|
||||
insertIndexOffset: Int = 0,
|
||||
hookRegisterOffset: Int = 0,
|
||||
instructions: (Int) -> String
|
||||
) =
|
||||
result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
|
||||
val insertIndex = endIndex + insertIndexOffset
|
||||
val register = getInstruction<RegisterInstruction>(endIndex + hookRegisterOffset).registerA
|
||||
|
||||
addInstructions(insertIndex, instructions(register))
|
||||
}
|
||||
} ?: throw toErrorResult()
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.general.channellistsubmenu.fingerprints
|
||||
package app.revanced.patches.youtube.general.channellistsubmenu.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.channelListSubMenuId
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ChannelListSubMenu
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@ -12,5 +12,5 @@ object ChannelListSubMenuFingerprint : MethodFingerprint(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT
|
||||
),
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(channelListSubMenuId) }
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(ChannelListSubMenu) }
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.general.channellistsubmenu.patch
|
||||
package app.revanced.patches.youtube.general.channellistsubmenu.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -13,9 +13,9 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.general.channellistsubmenu.fingerprints.ChannelListSubMenuFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.general.channellistsubmenu.fingerprints.ChannelListSubMenuFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.GENERAL
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.general.crowdfundingbox.fingerprints
|
||||
package app.revanced.patches.youtube.general.crowdfundingbox.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.donationCompanionResourceId
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.DonationCompanion
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@ -11,5 +11,5 @@ object CrowdfundingBoxFingerprint : MethodFingerprint(
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.IPUT_OBJECT
|
||||
),
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(donationCompanionResourceId) }
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(DonationCompanion) }
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.general.crowdfundingbox.patch
|
||||
package app.revanced.patches.youtube.general.crowdfundingbox.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -13,9 +13,9 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.general.crowdfundingbox.fingerprints.CrowdfundingBoxFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.general.crowdfundingbox.fingerprints.CrowdfundingBoxFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.GENERAL
|
||||
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.general.floatingmicrophone.fingerprints
|
||||
package app.revanced.patches.youtube.general.floatingmicrophone.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.fabId
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.Fab
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@ -11,5 +11,5 @@ object FloatingMicrophoneFingerprint : MethodFingerprint(
|
||||
Opcode.IF_EQZ,
|
||||
Opcode.RETURN_VOID
|
||||
),
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(fabId) }
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(Fab) }
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.general.floatingmicrophone.patch
|
||||
package app.revanced.patches.youtube.general.floatingmicrophone.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -13,9 +13,9 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.general.floatingmicrophone.fingerprints.FloatingMicrophoneFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.general.floatingmicrophone.fingerprints.FloatingMicrophoneFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.GENERAL
|
||||
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
@ -49,7 +49,7 @@ class FloatingMicrophonePatch : BytecodePatch(
|
||||
}
|
||||
} ?: return FloatingMicrophoneFingerprint.toErrorResult()
|
||||
|
||||
/*
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
SettingsPatch.addPreference(
|
@ -0,0 +1,74 @@
|
||||
package app.revanced.patches.youtube.general.headerswitch.patch
|
||||
|
||||
import app.revanced.extensions.findMutableMethodOf
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.WordMarkHeader
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import app.revanced.util.integrations.Constants.GENERAL
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@Name("header-switch")
|
||||
@Description("Add switch to change header.")
|
||||
@DependsOn(
|
||||
[
|
||||
SettingsPatch::class,
|
||||
SharedResourceIdPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
@Suppress("LABEL_NAME_CLASH")
|
||||
class HeaderSwitchPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
context.classes.forEach { classDef ->
|
||||
classDef.methods.forEach { method ->
|
||||
if (!method.isWideLiteralExists(WordMarkHeader))
|
||||
return@forEach
|
||||
|
||||
context.proxy(classDef)
|
||||
.mutableClass
|
||||
.findMutableMethodOf(method)
|
||||
.apply {
|
||||
val targetIndex = getWideLiteralIndex(WordMarkHeader)
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
targetIndex + 1, """
|
||||
invoke-static {v$targetRegister}, $GENERAL->enablePremiumHeader(I)I
|
||||
move-result v$targetRegister
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: GENERAL_SETTINGS",
|
||||
"SETTINGS: HEADER_SWITCH"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("header-switch")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.general.loadmorebutton.fingerprints
|
||||
package app.revanced.patches.youtube.general.loadmorebutton.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.expandButtonId
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ExpandButtonDown
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@ -12,5 +12,5 @@ object LoadMoreButtonFingerprint : MethodFingerprint(
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.MOVE_RESULT_OBJECT
|
||||
),
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(expandButtonId) }
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(ExpandButtonDown) }
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.general.loadmorebutton.patch
|
||||
package app.revanced.patches.youtube.general.loadmorebutton.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -13,9 +13,9 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.general.loadmorebutton.fingerprints.LoadMoreButtonFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.general.loadmorebutton.fingerprints.LoadMoreButtonFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.GENERAL
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
@ -0,0 +1,15 @@
|
||||
package app.revanced.patches.youtube.general.mixplaylists.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.BottomPanelOverlayText
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object BottomPanelOverlayTextFingerprint : MethodFingerprint(
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.IPUT_OBJECT
|
||||
),
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(BottomPanelOverlayText) }
|
||||
)
|
@ -0,0 +1,100 @@
|
||||
package app.revanced.patches.youtube.general.mixplaylists.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.shared.fingerprints.EmptyComponentBuilderFingerprint
|
||||
import app.revanced.patches.youtube.general.mixplaylists.fingerprints.BottomPanelOverlayTextFingerprint
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.bytecode.getStringIndex
|
||||
import app.revanced.util.integrations.Constants.GENERAL
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@Name("hide-mix-playlists")
|
||||
@Description("Removes mix playlists from home feed and video player.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class MixPlaylistsPatch : BytecodePatch(
|
||||
listOf(
|
||||
BottomPanelOverlayTextFingerprint,
|
||||
EmptyComponentBuilderFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
/**
|
||||
* Hide MixPlaylists when tablet UI is turned on
|
||||
* Required only for RVX Patches
|
||||
*/
|
||||
BottomPanelOverlayTextFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val insertRegister = getInstruction<TwoRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
insertIndex,
|
||||
"invoke-static {v$insertRegister}, $GENERAL->hideMixPlaylists(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
} ?: return BottomPanelOverlayTextFingerprint.toErrorResult()
|
||||
|
||||
/**
|
||||
* Separated from bytebuffer patch
|
||||
* Target method is only used for Hide MixPlaylists patch
|
||||
*/
|
||||
EmptyComponentBuilderFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val freeIndex = implementation!!.instructions.indexOfFirst { instruction ->
|
||||
instruction.opcode == Opcode.CONST_4
|
||||
}
|
||||
val jumpIndex = getStringIndex("Failed to convert Element to Flatbuffers: %s") + 2
|
||||
val insertIndex = freeIndex + 5
|
||||
|
||||
val freeRegister = getInstruction<OneRegisterInstruction>(freeIndex).registerA + 1
|
||||
|
||||
addInstructionsWithLabels(
|
||||
insertIndex, """
|
||||
invoke-static {v$freeRegister}, $GENERAL->hideMixPlaylists([B)Z
|
||||
move-result v$freeRegister
|
||||
if-nez v$freeRegister, :not_an_ad
|
||||
""", ExternalLabel("not_an_ad", getInstruction(jumpIndex))
|
||||
)
|
||||
|
||||
addInstruction(
|
||||
0,
|
||||
"move-object/from16 v$freeRegister, p3"
|
||||
)
|
||||
}
|
||||
} ?: return EmptyComponentBuilderFingerprint.toErrorResult()
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: GENERAL_SETTINGS",
|
||||
"SETTINGS: HIDE_MIX_PLAYLISTS"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-mix-playlists")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.general.personalinformation.fingerprints
|
||||
package app.revanced.patches.youtube.general.personalinformation.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.accountSwitcherAccessibilityId
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.AccountSwitcherAccessibility
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@ -15,5 +15,5 @@ object AccountSwitcherAccessibilityLabelFingerprint : MethodFingerprint(
|
||||
Opcode.APUT_OBJECT,
|
||||
Opcode.CONST
|
||||
),
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(accountSwitcherAccessibilityId) }
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(AccountSwitcherAccessibility) }
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.general.personalinformation.patch
|
||||
package app.revanced.patches.youtube.general.personalinformation.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -13,8 +13,8 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.general.personalinformation.fingerprints.AccountSwitcherAccessibilityLabelFingerprint
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.general.personalinformation.fingerprints.AccountSwitcherAccessibilityLabelFingerprint
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.GENERAL
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@ -31,14 +31,14 @@ class HideEmailAddressPatch : BytecodePatch(
|
||||
|
||||
AccountSwitcherAccessibilityLabelFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val register = getInstruction<OneRegisterInstruction>(insertIndex - 2).registerA
|
||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex - 2
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
insertIndex, """
|
||||
invoke-static {v$register}, $GENERAL->hideEmailAddress(I)I
|
||||
move-result v$register
|
||||
"""
|
||||
targetIndex + 2, """
|
||||
invoke-static {v$targetRegister}, $GENERAL->hideEmailAddress(I)I
|
||||
move-result v$targetRegister
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return AccountSwitcherAccessibilityLabelFingerprint.toErrorResult()
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.general.searchterms.fingerprints
|
||||
package app.revanced.patches.youtube.general.searchterms.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.general.searchterms.fingerprints
|
||||
package app.revanced.patches.youtube.general.searchterms.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -0,0 +1,9 @@
|
||||
package app.revanced.patches.youtube.general.searchterms.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.SearchSuggestionEntry
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
|
||||
object SearchSuggestionEntryFingerprint : MethodFingerprint(
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(SearchSuggestionEntry) }
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.general.searchterms.patch
|
||||
package app.revanced.patches.youtube.general.searchterms.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -14,10 +14,12 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.general.searchterms.fingerprints.*
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.searchSuggestionEntryId
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.general.searchterms.fingerprints.SearchEndpointFingerprint
|
||||
import app.revanced.patches.youtube.general.searchterms.fingerprints.SearchEndpointParentFingerprint
|
||||
import app.revanced.patches.youtube.general.searchterms.fingerprints.SearchSuggestionEntryFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.SearchSuggestionEntry
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
import app.revanced.util.integrations.Constants.GENERAL
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@ -56,7 +58,7 @@ class SearchTermsPatch : BytecodePatch(
|
||||
} ?: return SearchEndpointParentFingerprint.toErrorResult()
|
||||
|
||||
SearchSuggestionEntryFingerprint.result?.mutableMethod?.let {
|
||||
val targetIndex = it.getWideLiteralIndex(searchSuggestionEntryId) + 2
|
||||
val targetIndex = it.getWideLiteralIndex(SearchSuggestionEntry) + 2
|
||||
val targetRegister = it.getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
it.addInstruction(
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.general.snackbar.fingerprints
|
||||
package app.revanced.patches.youtube.general.snackbar.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.general.snackbar.patch
|
||||
package app.revanced.patches.youtube.general.snackbar.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -14,8 +14,8 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.general.snackbar.fingerprints.HideSnackBarFingerprint
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.general.snackbar.fingerprints.HideSnackBarFingerprint
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.GENERAL
|
||||
|
||||
@Patch
|
||||
@ -29,15 +29,17 @@ class HideSnackBarPatch : BytecodePatch(
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
HideSnackBarFingerprint.result?.mutableMethod?.let {
|
||||
it.addInstructionsWithLabels(
|
||||
0, """
|
||||
invoke-static {}, $GENERAL->hideSnackBar()Z
|
||||
move-result v0
|
||||
if-eqz v0, :default
|
||||
return-void
|
||||
""", ExternalLabel("default", it.getInstruction(0))
|
||||
)
|
||||
HideSnackBarFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
addInstructionsWithLabels(
|
||||
0, """
|
||||
invoke-static {}, $GENERAL->hideSnackBar()Z
|
||||
move-result v0
|
||||
if-eqz v0, :default
|
||||
return-void
|
||||
""", ExternalLabel("default", getInstruction(0))
|
||||
)
|
||||
}
|
||||
} ?: return HideSnackBarFingerprint.toErrorResult()
|
||||
|
||||
/**
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.general.stories.patch
|
||||
package app.revanced.patches.youtube.general.stories.patch
|
||||
|
||||
import app.revanced.extensions.findMutableMethodOf
|
||||
import app.revanced.extensions.injectHideCall
|
||||
@ -14,7 +14,7 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.iface.instruction.formats.Instruction22c
|
||||
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
|
||||
@ -35,7 +35,8 @@ class HideStoriesPatch : BytecodePatch() {
|
||||
// list of resource names to get the id of
|
||||
private val resourceIds = arrayOf(
|
||||
"reel_multiple_items_shelf",
|
||||
"reel_item_container"
|
||||
"reel_item_container",
|
||||
"reel_multiple_items_shelf_title_layout"
|
||||
).map { name ->
|
||||
ResourceMappingPatch.resourceMappings.single { it.name == name }.id
|
||||
}
|
||||
@ -49,7 +50,7 @@ class HideStoriesPatch : BytecodePatch() {
|
||||
when (instruction.opcode) {
|
||||
Opcode.CONST -> {
|
||||
when ((instruction as Instruction31i).wideLiteral) {
|
||||
resourceIds[0], resourceIds[1] -> { // reel ads
|
||||
resourceIds[0], resourceIds[1] -> {
|
||||
val insertIndex = index + 4
|
||||
val iPutInstruction = instructions.elementAt(insertIndex)
|
||||
if (iPutInstruction.opcode != Opcode.IPUT_OBJECT) return@forEachIndexed
|
||||
@ -62,6 +63,19 @@ class HideStoriesPatch : BytecodePatch() {
|
||||
patchSuccessArray[0] = true
|
||||
patchSuccessArray[1] = true
|
||||
}
|
||||
|
||||
resourceIds[2] -> {
|
||||
val insertIndex = index - 1
|
||||
val iPutInstruction = instructions.elementAt(insertIndex)
|
||||
if (iPutInstruction.opcode != Opcode.IPUT_OBJECT) return@forEachIndexed
|
||||
|
||||
val mutableMethod = context.proxy(classDef).mutableClass.findMutableMethodOf(method)
|
||||
|
||||
val viewRegister = (iPutInstruction as Instruction22c).registerA
|
||||
mutableMethod.implementation!!.injectHideCall(insertIndex, viewRegister, "layout/GeneralPatch", "hideStoriesShelf")
|
||||
|
||||
patchSuccessArray[2] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
else -> return@forEachIndexed
|
@ -1,13 +1,13 @@
|
||||
package app.revanced.patches.youtube.layout.general.tabletminiplayer.fingerprints
|
||||
package app.revanced.patches.youtube.general.tabletminiplayer.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.floatyBarTopMarginId
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.FloatyBarTopMargin
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
|
||||
object MiniPlayerDimensionsCalculatorFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(floatyBarTopMarginId) }
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(FloatyBarTopMargin) }
|
||||
)
|
@ -1,9 +1,8 @@
|
||||
package app.revanced.patches.youtube.layout.general.tabletminiplayer.fingerprints
|
||||
package app.revanced.patches.youtube.general.tabletminiplayer.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object MiniPlayerOverrideFingerprint : MethodFingerprint(
|
||||
returnType = "L",
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.general.tabletminiplayer.fingerprints
|
||||
package app.revanced.patches.youtube.general.tabletminiplayer.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.general.tabletminiplayer.fingerprints
|
||||
package app.revanced.patches.youtube.general.tabletminiplayer.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
@ -10,7 +10,6 @@ object MiniPlayerResponseModelSizeCheckFingerprint : MethodFingerprint(
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L", "L"),
|
||||
opcodes = listOf(
|
||||
Opcode.RETURN_OBJECT,
|
||||
Opcode.CHECK_CAST,
|
||||
Opcode.CHECK_CAST,
|
||||
Opcode.INVOKE_STATIC,
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.general.tabletminiplayer.patch
|
||||
package app.revanced.patches.youtube.general.tabletminiplayer.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -17,9 +17,12 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.general.tabletminiplayer.fingerprints.*
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.general.tabletminiplayer.fingerprints.MiniPlayerDimensionsCalculatorFingerprint
|
||||
import app.revanced.patches.youtube.general.tabletminiplayer.fingerprints.MiniPlayerOverrideFingerprint
|
||||
import app.revanced.patches.youtube.general.tabletminiplayer.fingerprints.MiniPlayerOverrideNoContextFingerprint
|
||||
import app.revanced.patches.youtube.general.tabletminiplayer.fingerprints.MiniPlayerResponseModelSizeCheckFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.bytecode.getStringIndex
|
||||
import app.revanced.util.integrations.Constants.GENERAL
|
||||
import org.jf.dexlib2.Opcode
|
||||
@ -61,7 +64,8 @@ class TabletMiniPlayerPatch : BytecodePatch(
|
||||
}
|
||||
} ?: return MiniPlayerOverrideFingerprint.toErrorResult()
|
||||
|
||||
MiniPlayerResponseModelSizeCheckFingerprint.result?.addProxyCall() ?: return MiniPlayerResponseModelSizeCheckFingerprint.toErrorResult()
|
||||
MiniPlayerResponseModelSizeCheckFingerprint.result?.addProxyCall()
|
||||
?: return MiniPlayerResponseModelSizeCheckFingerprint.toErrorResult()
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -101,7 +105,7 @@ class TabletMiniPlayerPatch : BytecodePatch(
|
||||
val insertInstructions = this.implementation!!.instructions
|
||||
for ((index, instruction) in insertInstructions.withIndex()) {
|
||||
if (instruction.opcode != Opcode.RETURN) continue
|
||||
val parameterRegister = getInstruction<OneRegisterInstruction>(index).registerA
|
||||
val parameterRegister = this.getInstruction<OneRegisterInstruction>(index).registerA
|
||||
this.insertOverride(index, parameterRegister)
|
||||
this.insertOverride(insertInstructions.size - 1, parameterRegister)
|
||||
break
|
@ -0,0 +1,18 @@
|
||||
package app.revanced.patches.youtube.general.widesearchbar.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ActionBarRingo
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object SetActionBarRingoFingerprint : MethodFingerprint(
|
||||
returnType = "L",
|
||||
parameters = listOf("L", "L"),
|
||||
opcodes = listOf(
|
||||
Opcode.IF_NEZ,
|
||||
Opcode.SGET_OBJECT,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.INVOKE_STATIC
|
||||
),
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(ActionBarRingo) }
|
||||
)
|
@ -0,0 +1,17 @@
|
||||
package app.revanced.patches.youtube.general.widesearchbar.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ToolBarPaddingHome
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object SetToolBarPaddingFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
parameters = listOf("I", "I"),
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.INVOKE_STATIC
|
||||
),
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(ToolBarPaddingHome) }
|
||||
)
|
@ -0,0 +1,101 @@
|
||||
package app.revanced.patches.youtube.general.widesearchbar.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.data.toMethodWalker
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.general.widesearchbar.fingerprints.SetActionBarRingoFingerprint
|
||||
import app.revanced.patches.youtube.general.widesearchbar.fingerprints.SetToolBarPaddingFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch.Companion.contexts
|
||||
import app.revanced.util.integrations.Constants.GENERAL
|
||||
|
||||
@Patch
|
||||
@Name("enable-wide-searchbar")
|
||||
@Description("Replaces the search icon with a wide search bar. This will hide the YouTube logo when active.")
|
||||
@DependsOn(
|
||||
[
|
||||
SettingsPatch::class,
|
||||
SharedResourceIdPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class WideSearchbarPatch : BytecodePatch(
|
||||
listOf(
|
||||
SetActionBarRingoFingerprint,
|
||||
SetToolBarPaddingFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
arrayOf(
|
||||
SetActionBarRingoFingerprint,
|
||||
SetToolBarPaddingFingerprint
|
||||
).forEach {
|
||||
it.injectHook(context)
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Wide SearchBar Start Margin
|
||||
*/
|
||||
contexts.xmlEditor[TARGET_RESOURCE_PATH].use { editor ->
|
||||
val document = editor.file
|
||||
|
||||
with(document.getElementsByTagName("RelativeLayout").item(0)) {
|
||||
if (attributes.getNamedItem(FLAG) != null) return@with
|
||||
|
||||
document.createAttribute(FLAG)
|
||||
.apply { value = "8.0dip" }
|
||||
.let(attributes::setNamedItem)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: GENERAL_SETTINGS",
|
||||
"SETTINGS: ENABLE_WIDE_SEARCHBAR"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("enable-wide-searchbar")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val FLAG = "android:paddingStart"
|
||||
const val TARGET_RESOURCE_PATH = "res/layout/action_bar_ringo_background.xml"
|
||||
|
||||
fun MethodFingerprint.injectHook(context: BytecodeContext) {
|
||||
result?.let {
|
||||
(context
|
||||
.toMethodWalker(it.method)
|
||||
.nextMethod(it.scanResult.patternScanResult!!.endIndex, true)
|
||||
.getMethod() as MutableMethod).apply {
|
||||
addInstructions(
|
||||
implementation!!.instructions.size - 1, """
|
||||
invoke-static {}, $GENERAL->enableWideSearchbar()Z
|
||||
move-result p0
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: throw toErrorResult()
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.etc.branding.icon.patch
|
||||
package app.revanced.patches.youtube.layout.branding.icon.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
@ -10,7 +10,7 @@ import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.resources.IconHelper.customIcon
|
||||
import app.revanced.util.resources.ResourceHelper.updatePatchStatusIcon
|
||||
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.etc.branding.icon.patch
|
||||
package app.revanced.patches.youtube.layout.branding.icon.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
@ -10,7 +10,7 @@ import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.resources.IconHelper.customIcon
|
||||
import app.revanced.util.resources.ResourceHelper.updatePatchStatusIcon
|
||||
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.etc.branding.icon.patch
|
||||
package app.revanced.patches.youtube.layout.branding.icon.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
@ -10,7 +10,7 @@ import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.resources.IconHelper.customIcon
|
||||
import app.revanced.util.resources.ResourceHelper.updatePatchStatusIcon
|
||||
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.etc.branding.name.patch
|
||||
package app.revanced.patches.youtube.layout.branding.name.patch
|
||||
|
||||
import app.revanced.extensions.startsWithAny
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -9,7 +9,7 @@ import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.resources.ResourceHelper.updatePatchStatusLabel
|
||||
import org.w3c.dom.Element
|
||||
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.etc.doubletapbackground.patch
|
||||
package app.revanced.patches.youtube.layout.doubletapbackground.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
@ -10,7 +10,7 @@ import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
|
||||
@Patch(false)
|
||||
@Name("hide-double-tap-overlay-filter")
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.etc.doubletaplength.patch
|
||||
package app.revanced.patches.youtube.layout.doubletaplength.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
@ -9,7 +9,7 @@ import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.resources.ResourceHelper.addEntryValues
|
||||
import app.revanced.util.resources.ResourceUtils
|
||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.etc.forcebackground.patch
|
||||
package app.revanced.patches.youtube.layout.forcebackground.patch
|
||||
|
||||
import app.revanced.extensions.doRecursively
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -11,7 +11,7 @@ import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import org.w3c.dom.Element
|
||||
|
||||
@Patch(false)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.etc.forceheader.patch
|
||||
package app.revanced.patches.youtube.layout.forceheader.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
@ -11,7 +11,7 @@ import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.StandardCopyOption
|
||||
import kotlin.io.path.exists
|
@ -1,10 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.fullscreen.endscreenoverlay.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.appRelatedEndScreenResultsId
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
|
||||
object EndScreenResultsFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(appRelatedEndScreenResultsId) }
|
||||
)
|
@ -1,14 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.scrubbingId
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object ScrubbingLabelFingerprint : MethodFingerprint(
|
||||
opcodes = listOf(
|
||||
Opcode.IPUT_BOOLEAN,
|
||||
Opcode.CONST_WIDE_32
|
||||
),
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(scrubbingId) }
|
||||
)
|
@ -1,76 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.fingerprints.ScrubbingLabelFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.FULLSCREEN
|
||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@Name("hide-filmstrip-overlay")
|
||||
@Description("Hide flimstrip overlay on swipe controls.")
|
||||
@DependsOn(
|
||||
[
|
||||
SettingsPatch::class,
|
||||
SharedResourceIdPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideFilmstripOverlayPatch : BytecodePatch(
|
||||
listOf(ScrubbingLabelFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
val result = ScrubbingLabelFingerprint.result?: return ScrubbingLabelFingerprint.toErrorResult()
|
||||
|
||||
result.mutableMethod.hook(result.scanResult.patternScanResult!!.endIndex - 1)
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: FULLSCREEN_SETTINGS",
|
||||
"SETTINGS: HIDE_FILMSTRIP_OVERLAY"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-filmstrip-overlay")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
private companion object {
|
||||
fun MutableMethod.hook(index: Int) {
|
||||
val targetInstruction = getInstruction<TwoRegisterInstruction>(index)
|
||||
val fieldReference = getInstruction<ReferenceInstruction>(index).reference
|
||||
replaceInstruction(
|
||||
index,
|
||||
"invoke-static {v${targetInstruction.registerA}}, $FULLSCREEN->hideFilmstripOverlay(Z)Z"
|
||||
)
|
||||
|
||||
addInstructions(
|
||||
index + 1, """
|
||||
move-result v${targetInstruction.registerA}
|
||||
iput-boolean v${targetInstruction.registerA}, v${targetInstruction.registerB}, $fieldReference
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object SeekHapticsFingerprint : MethodFingerprint(
|
||||
opcodes = listOf(
|
||||
Opcode.CHECK_CAST,
|
||||
Opcode.CHECK_CAST,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.RETURN_VOID
|
||||
),
|
||||
strings = listOf("Failed to easy seek haptics vibrate.")
|
||||
)
|
@ -1,118 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.fingerprints.MarkerHapticsFingerprint
|
||||
import app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.fingerprints.ScrubbingHapticsFingerprint
|
||||
import app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.fingerprints.SeekHapticsFingerprint
|
||||
import app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.fingerprints.ZoomHapticsFingerprint
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.FULLSCREEN
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@Name("disable-haptic-feedback")
|
||||
@Description("Disable haptic feedback when swiping.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HapticFeedBackPatch : BytecodePatch(
|
||||
listOf(
|
||||
MarkerHapticsFingerprint,
|
||||
SeekHapticsFingerprint,
|
||||
ScrubbingHapticsFingerprint,
|
||||
ZoomHapticsFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
arrayOf(
|
||||
SeekHapticsFingerprint to "disableSeekVibrate",
|
||||
ScrubbingHapticsFingerprint to "disableScrubbingVibrate",
|
||||
MarkerHapticsFingerprint to "disableChapterVibrate",
|
||||
ZoomHapticsFingerprint to "disableZoomVibrate"
|
||||
).map { (fingerprint, name) ->
|
||||
fingerprint.result?.let {
|
||||
if (fingerprint == SeekHapticsFingerprint)
|
||||
it.disableHaptics(name)
|
||||
else
|
||||
it.voidHaptics(name)
|
||||
} ?: return fingerprint.toErrorResult()
|
||||
}
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: FULLSCREEN_SETTINGS",
|
||||
"SETTINGS: DISABLE_HAPTIC_FEEDBACK"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("disable-haptic-feedback")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
fun MethodFingerprintResult.disableHaptics(targetMethodName: String) {
|
||||
mutableMethod.apply {
|
||||
val startIndex = scanResult.patternScanResult!!.startIndex
|
||||
val endIndex = scanResult.patternScanResult!!.endIndex
|
||||
val insertIndex = endIndex + 4
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
val dummyRegister = targetRegister + 1
|
||||
|
||||
removeInstruction(insertIndex)
|
||||
|
||||
addInstructionsWithLabels(
|
||||
insertIndex, """
|
||||
invoke-static {}, $FULLSCREEN->$targetMethodName()Z
|
||||
move-result v$dummyRegister
|
||||
if-eqz v$dummyRegister, :vibrate
|
||||
const-wide/16 v$targetRegister, 0x0
|
||||
goto :exit
|
||||
:vibrate
|
||||
const-wide/16 v$targetRegister, 0x19
|
||||
""", ExternalLabel("exit", getInstruction(insertIndex))
|
||||
)
|
||||
|
||||
addInstructionsWithLabels(
|
||||
startIndex, """
|
||||
invoke-static {}, $FULLSCREEN->$targetMethodName()Z
|
||||
move-result v$dummyRegister
|
||||
if-eqz v$dummyRegister, :vibrate
|
||||
return-void
|
||||
""", ExternalLabel("vibrate", getInstruction(startIndex))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun MethodFingerprintResult.voidHaptics(targetMethodName: String) {
|
||||
mutableMethod.addInstructionsWithLabels(
|
||||
0, """
|
||||
invoke-static {}, $FULLSCREEN->$targetMethodName()Z
|
||||
move-result v0
|
||||
if-eqz v0, :vibrate
|
||||
return-void
|
||||
""", ExternalLabel("vibrate", mutableMethod.getInstruction(0))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.fullscreen.seekmessage.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.easySeekEduContainerId
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
|
||||
object SeekEduContainerFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(easySeekEduContainerId) }
|
||||
)
|
@ -1,110 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.general.categorybar.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.general.categorybar.fingerprints.FilterBarHeightFingerprint
|
||||
import app.revanced.patches.youtube.layout.general.categorybar.fingerprints.RelatedChipCloudFingerprint
|
||||
import app.revanced.patches.youtube.layout.general.categorybar.fingerprints.SearchResultsChipBarFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.GENERAL
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@Name("hide-category-bar")
|
||||
@Description("Hide the category bar at the top of the feed and at the top of related videos.")
|
||||
@DependsOn(
|
||||
[
|
||||
SettingsPatch::class,
|
||||
SharedResourceIdPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class CategoryBarPatch : BytecodePatch(
|
||||
listOf(
|
||||
FilterBarHeightFingerprint,
|
||||
RelatedChipCloudFingerprint,
|
||||
SearchResultsChipBarFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
/**
|
||||
* Category Bar in feed
|
||||
* Home feed and subscriptions feed
|
||||
*/
|
||||
FilterBarHeightFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val register = getInstruction<TwoRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
insertIndex, """
|
||||
invoke-static {v$register}, $GENERAL->hideCategoryBarInFeed(I)I
|
||||
move-result v$register
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return FilterBarHeightFingerprint.toErrorResult()
|
||||
|
||||
/**
|
||||
* Category Bar in related video
|
||||
*/
|
||||
RelatedChipCloudFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val register = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
insertIndex + 1,
|
||||
"invoke-static {v$register}, $GENERAL->hideCategoryBarInRelatedVideo(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
} ?: return RelatedChipCloudFingerprint.toErrorResult()
|
||||
|
||||
/**
|
||||
* Category Bar in search results
|
||||
*/
|
||||
SearchResultsChipBarFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex - 2
|
||||
val register = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
targetIndex + 1, """
|
||||
invoke-static {v$register}, $GENERAL->hideCategoryBarInSearchResults(I)I
|
||||
move-result v$register
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return SearchResultsChipBarFingerprint.toErrorResult()
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: GENERAL_SETTINGS",
|
||||
"SETTINGS: HIDE_CATEGORY_BAR"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-category-bar")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,95 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.general.headerswitch.patch
|
||||
|
||||
import app.revanced.extensions.findMutableMethodOf
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.GENERAL
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
|
||||
|
||||
@Patch
|
||||
@Name("header-switch")
|
||||
@Description("Add switch to change header.")
|
||||
@DependsOn(
|
||||
[
|
||||
ResourceMappingPatch::class,
|
||||
SettingsPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HeaderSwitchPatch : BytecodePatch() {
|
||||
|
||||
// list of resource names to get the id of
|
||||
private val resourceIds = arrayOf(
|
||||
"ytWordmarkHeader"
|
||||
).map { name ->
|
||||
ResourceMappingPatch.resourceMappings.single { it.name == name }.id
|
||||
}
|
||||
private var patchSuccessArray = Array(resourceIds.size) {false}
|
||||
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
context.classes.forEach { classDef ->
|
||||
classDef.methods.forEach { method ->
|
||||
with(method.implementation) {
|
||||
this?.instructions?.forEachIndexed { index, instruction ->
|
||||
when (instruction.opcode) {
|
||||
Opcode.CONST -> {
|
||||
when ((instruction as Instruction31i).wideLiteral) {
|
||||
resourceIds[0] -> { // header
|
||||
val insertIndex = index + 1
|
||||
|
||||
val mutableMethod = context.proxy(classDef).mutableClass.findMutableMethodOf(method)
|
||||
|
||||
val viewRegister = (instructions.elementAt(index) as Instruction31i).registerA
|
||||
|
||||
mutableMethod.addInstructions(
|
||||
insertIndex, """
|
||||
invoke-static {v$viewRegister}, $GENERAL->enablePremiumHeader(I)I
|
||||
move-result v$viewRegister
|
||||
"""
|
||||
)
|
||||
|
||||
patchSuccessArray[0] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
else -> return@forEachIndexed
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val errorIndex: Int = patchSuccessArray.indexOf(false)
|
||||
|
||||
if (errorIndex == -1) {
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: GENERAL_SETTINGS",
|
||||
"SETTINGS: HEADER_SWITCH"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("header-switch")
|
||||
|
||||
return PatchResultSuccess()
|
||||
} else
|
||||
return PatchResultError("Instruction not found: $errorIndex")
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.general.searchterms.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.searchSuggestionEntryId
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
|
||||
object SearchSuggestionEntryFingerprint : MethodFingerprint(
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(searchSuggestionEntryId) }
|
||||
)
|
@ -1,18 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.general.widesearchbar.bytecode.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object WideSearchbarOneFingerprint : MethodFingerprint(
|
||||
returnType = "L",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L", "L"),
|
||||
opcodes = listOf(
|
||||
Opcode.IF_NEZ,
|
||||
Opcode.SGET_OBJECT,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.INVOKE_STATIC
|
||||
)
|
||||
)
|
@ -1,15 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.general.widesearchbar.bytecode.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
|
||||
object WideSearchbarOneParentFingerprint : MethodFingerprint(
|
||||
returnType = "V", accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
strings = listOf(
|
||||
"FEhistory",
|
||||
"FEmy_videos",
|
||||
"FEpurchases"
|
||||
)
|
||||
)
|
@ -1,17 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.general.widesearchbar.bytecode.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object WideSearchbarTwoFingerprint : MethodFingerprint(
|
||||
returnType = "L",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.IF_EQZ,
|
||||
Opcode.NEW_INSTANCE
|
||||
)
|
||||
)
|
@ -1,14 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.general.widesearchbar.bytecode.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
|
||||
object WideSearchbarTwoParentFingerprint : MethodFingerprint(
|
||||
returnType = "L",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||
strings = listOf(
|
||||
"Callback already registered.",
|
||||
"Failed to create SpotlightModeController."
|
||||
)
|
||||
)
|
@ -1,85 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.general.widesearchbar.bytecode.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.data.toMethodWalker
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.general.widesearchbar.bytecode.fingerprints.*
|
||||
import app.revanced.patches.youtube.layout.general.widesearchbar.resource.patch.WideSearchbarResourcePatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.GENERAL
|
||||
|
||||
@Patch
|
||||
@Name("enable-wide-searchbar")
|
||||
@Description("Replaces the search icon with a wide search bar. This will hide the YouTube logo when active.")
|
||||
@DependsOn(
|
||||
[
|
||||
SettingsPatch::class,
|
||||
WideSearchbarResourcePatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class WideSearchbarPatch : BytecodePatch(
|
||||
listOf(
|
||||
WideSearchbarOneParentFingerprint,
|
||||
WideSearchbarTwoParentFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
arrayOf(
|
||||
WideSearchbarOneParentFingerprint to WideSearchbarOneFingerprint,
|
||||
WideSearchbarTwoParentFingerprint to WideSearchbarTwoFingerprint
|
||||
).map { (parentFingerprint, fingerprint) ->
|
||||
parentFingerprint.result?.classDef?.let { classDef ->
|
||||
fingerprint.also { it.resolve(context, classDef) }.result?.let {
|
||||
val index = if (fingerprint == WideSearchbarOneFingerprint) it.scanResult.patternScanResult!!.endIndex
|
||||
else it.scanResult.patternScanResult!!.startIndex
|
||||
|
||||
val targetMethod =
|
||||
context
|
||||
.toMethodWalker(it.method)
|
||||
.nextMethod(index, true)
|
||||
.getMethod() as MutableMethod
|
||||
|
||||
targetMethod.injectSearchBarHook()
|
||||
} ?: return fingerprint.toErrorResult()
|
||||
} ?: return parentFingerprint.toErrorResult()
|
||||
}
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: GENERAL_SETTINGS",
|
||||
"SETTINGS: ENABLE_WIDE_SEARCHBAR"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("enable-wide-searchbar")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private fun MutableMethod.injectSearchBarHook() {
|
||||
addInstructions(
|
||||
implementation!!.instructions.size - 1, """
|
||||
invoke-static {}, $GENERAL->enableWideSearchbar()Z
|
||||
move-result p0
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.general.widesearchbar.resource.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
|
||||
@Name("enable-wide-searchbar-resource-patch")
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class WideSearchbarResourcePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
context.xmlEditor["res/layout/action_bar_ringo_background.xml"].use { editor ->
|
||||
val document = editor.file
|
||||
|
||||
with(document.getElementsByTagName("RelativeLayout").item(0)) {
|
||||
if (attributes.getNamedItem(FLAG) != null) return@with
|
||||
|
||||
document.createAttribute(FLAG)
|
||||
.apply { value = "8.0dip" }
|
||||
.let(attributes::setNamedItem)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val FLAG = "android:paddingStart"
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.etc.materialyou.patch
|
||||
package app.revanced.patches.youtube.layout.materialyou.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
@ -10,9 +10,9 @@ import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.etc.theme.patch.GeneralThemePatch
|
||||
import app.revanced.patches.youtube.layout.etc.theme.patch.GeneralThemePatch.Companion.isMonetPatchIncluded
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.layout.theme.patch.GeneralThemePatch
|
||||
import app.revanced.patches.youtube.layout.theme.patch.GeneralThemePatch.Companion.isMonetPatchIncluded
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.resources.ResourceHelper.updatePatchStatusTheme
|
||||
import app.revanced.util.resources.ResourceUtils
|
||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.etc.optimize.patch
|
||||
package app.revanced.patches.youtube.layout.optimize.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
@ -10,7 +10,7 @@ import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
|
||||
@Patch
|
||||
@Name("optimize-resource")
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.etc.optimize.patch
|
||||
package app.revanced.patches.youtube.layout.optimize.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.etc.pipnotification.fingerprints
|
||||
package app.revanced.patches.youtube.layout.pipnotification.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.etc.pipnotification.fingerprints
|
||||
package app.revanced.patches.youtube.layout.pipnotification.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
@ -10,11 +10,11 @@ object SecondaryPiPFingerprint : MethodFingerprint(
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
opcodes = listOf(
|
||||
null,
|
||||
Opcode.CHECK_CAST,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.CHECK_CAST,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.CHECK_CAST,
|
||||
Opcode.IGET_OBJECT
|
||||
Opcode.IF_EQZ,
|
||||
Opcode.INVOKE_VIRTUAL
|
||||
),
|
||||
strings = listOf("honeycomb.Shell\$HomeActivity")
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.etc.pipnotification.patch
|
||||
package app.revanced.patches.youtube.layout.pipnotification.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -12,8 +12,9 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.etc.pipnotification.fingerprints.*
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.layout.pipnotification.fingerprints.PrimaryPiPFingerprint
|
||||
import app.revanced.patches.youtube.layout.pipnotification.fingerprints.SecondaryPiPFingerprint
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
|
||||
@Patch
|
||||
@Name("hide-pip-notification")
|
||||
@ -32,14 +33,18 @@ class PiPNotificationPatch : BytecodePatch(
|
||||
arrayOf(
|
||||
PrimaryPiPFingerprint,
|
||||
SecondaryPiPFingerprint
|
||||
).map {
|
||||
it.result ?: return it.toErrorResult()
|
||||
}.forEach {
|
||||
val index = it.scanResult.patternScanResult!!.startIndex + 1
|
||||
it.mutableMethod.addInstruction(index, "return-void")
|
||||
).forEach { fingerprint ->
|
||||
fingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
addInstruction(
|
||||
it.scanResult.patternScanResult!!.endIndex - 4,
|
||||
"return-void"
|
||||
)
|
||||
}
|
||||
} ?: return fingerprint.toErrorResult()
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
SettingsPatch.updatePatchStatus("hide-pip-notification")
|
@ -1,57 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.player.infocards.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.player.infocards.fingerprints.InfocardsIncognitoFingerprint
|
||||
import app.revanced.patches.youtube.layout.player.infocards.fingerprints.InfocardsIncognitoParentFingerprint
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.PLAYER
|
||||
|
||||
@Patch
|
||||
@Name("hide-info-cards")
|
||||
@Description("Hides info-cards in videos.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideInfocardsPatch : BytecodePatch(
|
||||
listOf(InfocardsIncognitoParentFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
InfocardsIncognitoParentFingerprint.result?.classDef?.let { classDef ->
|
||||
InfocardsIncognitoFingerprint.also {
|
||||
it.resolve(context, classDef)
|
||||
}.result?.mutableMethod?.
|
||||
addInstructions(
|
||||
1, """
|
||||
invoke-static {v0}, $PLAYER->hideInfoCard(Z)Z
|
||||
move-result v0
|
||||
"""
|
||||
) ?: return InfocardsIncognitoFingerprint.toErrorResult()
|
||||
} ?: return InfocardsIncognitoParentFingerprint.toErrorResult()
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: PLAYER_SETTINGS",
|
||||
"SETTINGS: HIDE_INFO_CARDS"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-info-cards")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.player.playerbuttonbg.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
|
||||
object HidePlayerButtonFingerprint : MethodFingerprint (
|
||||
customFingerprint = { it, _ ->
|
||||
it.definingClass == "Lapp/revanced/integrations/patches/layout/PlayerPatch;"
|
||||
&& it.name == "hidePlayerButton"
|
||||
}
|
||||
)
|
@ -1,9 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.player.playeroverlayfilter.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.scrimOverlayId
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
|
||||
object ScrimOverlayFingerprint : MethodFingerprint(
|
||||
customFingerprint = { it, _ -> it.definingClass.endsWith("YouTubeControlsOverlay;") && it.isWideLiteralExists(scrimOverlayId) }
|
||||
)
|
@ -1,16 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.player.previousnextbutton.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
|
||||
|
||||
object SupportsNextPreviousFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
parameters = listOf("Z"),
|
||||
opcodes = listOf(Opcode.OR_INT_LIT8),
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.implementation!!.instructions.any {
|
||||
((it as? NarrowLiteralInstruction)?.narrowLiteral == 64)
|
||||
}
|
||||
}
|
||||
)
|
@ -1,55 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.player.previousnextbutton.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.shared.fingerprints.ControlsOverlayStyleFingerprint
|
||||
import app.revanced.patches.youtube.layout.player.previousnextbutton.fingerprints.SupportsNextPreviousFingerprint
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.PLAYER
|
||||
|
||||
@Patch
|
||||
@Name("hide-previous-next-button")
|
||||
@Description("Hides the previous and next button in the player controller.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HidePreviousNextButtonPatch : BytecodePatch(
|
||||
listOf(ControlsOverlayStyleFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
ControlsOverlayStyleFingerprint.result?.let { parentResult ->
|
||||
SupportsNextPreviousFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.mutableMethod?.addInstructions(
|
||||
0, """
|
||||
invoke-static {p1}, $PLAYER->hidePreviousNextButton(Z)Z
|
||||
move-result p1
|
||||
"""
|
||||
) ?: return SupportsNextPreviousFingerprint.toErrorResult()
|
||||
} ?: return ControlsOverlayStyleFingerprint.toErrorResult()
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: PLAYER_SETTINGS",
|
||||
"SETTINGS: HIDE_PREVIOUS_NEXT_BUTTON"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-previous-next-button")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.seekbar.seekbar.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.timebar.patch.HookTimeBarPatch
|
||||
import app.revanced.util.integrations.Constants.SEEKBAR
|
||||
|
||||
@Patch
|
||||
@Name("hide-seekbar")
|
||||
@Description("Hides the seekbar and progressbar.")
|
||||
@DependsOn(
|
||||
[
|
||||
HookTimeBarPatch::class,
|
||||
SettingsPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideSeekbarPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
val insertMethod = HookTimeBarPatch.setTimeBarMethod
|
||||
|
||||
insertMethod.addInstructionsWithLabels(
|
||||
0, """
|
||||
invoke-static {}, $SEEKBAR->hideSeekbar()Z
|
||||
move-result v0
|
||||
if-eqz v0, :show_seekbar
|
||||
return-void
|
||||
""", ExternalLabel("show_seekbar", insertMethod.getInstruction(0))
|
||||
)
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: SEEKBAR_SETTINGS",
|
||||
"SETTINGS: HIDE_SEEKBAR"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-seekbar")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.seekbar.seekbarcolor.bytecode.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
|
||||
object ControlsOverlayFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
customFingerprint = { it, _ -> it.name == "<init>"}
|
||||
)
|
@ -1,11 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.seekbar.seekbarcolor.bytecode.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
|
||||
object ControlsOverlayParentFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PRIVATE or AccessFlags.STATIC or AccessFlags.FINAL,
|
||||
strings = listOf("Error screen presenter should be present")
|
||||
)
|
@ -1,9 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.seekbar.seekbarcolor.bytecode.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.inlineTimeBarColorizedBarPlayedColorDarkId
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
|
||||
object SeekbarColorFingerprint : MethodFingerprint(
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(inlineTimeBarColorizedBarPlayedColorDarkId) }
|
||||
)
|
@ -1,21 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.seekbar.seekbartapping.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.util.bytecode.isNarrowLiteralExists
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object SeekbarTappingFingerprint : MethodFingerprint(
|
||||
returnType = "Z",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
opcodes = listOf(
|
||||
Opcode.NEW_INSTANCE,
|
||||
Opcode.INVOKE_DIRECT,
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.RETURN
|
||||
),
|
||||
customFingerprint = { it, _ -> it.name == "onTouchEvent" && it.isNarrowLiteralExists(2147483647) }
|
||||
)
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user