mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-03 16:14:28 +02:00
add disable-shorts-player-pip
patch
This commit is contained in:
parent
838f67bc54
commit
4994edc5fc
@ -0,0 +1,12 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.general.bytecode.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
object DisableShortsPiPFingerprint : MethodFingerprint(
|
||||||
|
returnType = "L",
|
||||||
|
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = listOf("L"),
|
||||||
|
customFingerprint = { it.definingClass == "Lcom/google/android/apps/youtube/app/common/ui/pip/DefaultPipController;" }
|
||||||
|
)
|
@ -0,0 +1,78 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.general.bytecode.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
import app.revanced.patcher.extensions.removeInstruction
|
||||||
|
import app.revanced.patcher.extensions.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.util.smali.ExternalLabel
|
||||||
|
import app.revanced.patches.youtube.layout.general.bytecode.fingerprints.DisableShortsPiPFingerprint
|
||||||
|
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
||||||
|
import app.revanced.shared.annotation.YouTubeCompatibility
|
||||||
|
import app.revanced.shared.extensions.toErrorResult
|
||||||
|
import app.revanced.shared.util.integrations.Constants.GENERAL_LAYOUT
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
|
||||||
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
|
@Name("disable-shorts-pip-bytecode-patch")
|
||||||
|
@DependsOn(
|
||||||
|
[
|
||||||
|
PlayerTypeHookPatch::class
|
||||||
|
]
|
||||||
|
)
|
||||||
|
@YouTubeCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class DisableShortsPiPBytecodePatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
DisableShortsPiPFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
|
DisableShortsPiPFingerprint.result?.mutableMethod?.let { method ->
|
||||||
|
|
||||||
|
with (method.implementation!!) {
|
||||||
|
val invokeIndex = this.instructions.indexOfFirst {
|
||||||
|
it.opcode.ordinal == Opcode.INVOKE_VIRTUAL.ordinal &&
|
||||||
|
((it as? BuilderInstruction35c)?.reference.toString() ==
|
||||||
|
"$REFERENCE_DESCRIPTOR")
|
||||||
|
}
|
||||||
|
val registerA = (method.instruction(invokeIndex + 1) as OneRegisterInstruction).registerA
|
||||||
|
|
||||||
|
val registerC = (method.instruction(invokeIndex) as BuilderInstruction35c).registerC
|
||||||
|
val registerE = (method.instruction(invokeIndex) as BuilderInstruction35c).registerE
|
||||||
|
|
||||||
|
method.addInstructions(
|
||||||
|
invokeIndex + 1,"""
|
||||||
|
invoke-static {}, $GENERAL_LAYOUT->disableShortsPlayerPiP()Z
|
||||||
|
move-result v$registerA
|
||||||
|
if-eqz v$registerA, :pip
|
||||||
|
goto :disablepip
|
||||||
|
:pip
|
||||||
|
invoke-virtual {v${registerC}, v${registerE}}, $REFERENCE_DESCRIPTOR
|
||||||
|
move-result v$registerA
|
||||||
|
""", listOf(ExternalLabel("disablepip", method.instruction(invokeIndex + 1)))
|
||||||
|
)
|
||||||
|
method.removeInstruction(invokeIndex)
|
||||||
|
method.replaceInstruction(
|
||||||
|
invokeIndex + 6, "nop"
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
} ?: return DisableShortsPiPFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
private companion object {
|
||||||
|
const val REFERENCE_DESCRIPTOR =
|
||||||
|
"Landroid/app/Activity;->enterPictureInPictureMode(Landroid/app/PictureInPictureParams;)Z"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.general.resource.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.ResourceContext
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
|
import app.revanced.patches.youtube.layout.general.bytecode.patch.DisableShortsPiPBytecodePatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
|
import app.revanced.shared.annotation.YouTubeCompatibility
|
||||||
|
import app.revanced.shared.util.resources.ResourceHelper
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("disable-shorts-player-pip")
|
||||||
|
@Description("Disable PiP mode in YouTube Shorts player.")
|
||||||
|
@DependsOn(
|
||||||
|
[
|
||||||
|
DisableShortsPiPBytecodePatch::class,
|
||||||
|
SettingsPatch::class
|
||||||
|
]
|
||||||
|
)
|
||||||
|
@YouTubeCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class DisableShortsPiPPatch : ResourcePatch {
|
||||||
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
|
||||||
|
/*
|
||||||
|
add settings
|
||||||
|
*/
|
||||||
|
ResourceHelper.addSettings4(
|
||||||
|
context,
|
||||||
|
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
|
||||||
|
"PREFERENCE: LAYOUT_SETTINGS",
|
||||||
|
"PREFERENCE_HEADER: GENERAL",
|
||||||
|
"SETTINGS: SHORTS_COMPONENT.PARENT",
|
||||||
|
"SETTINGS: SHORTS_COMPONENT_PARENT.B",
|
||||||
|
"SETTINGS: DISABLE_SHORTS_PLAYER_PIP"
|
||||||
|
)
|
||||||
|
|
||||||
|
ResourceHelper.patchSuccess(
|
||||||
|
context,
|
||||||
|
"disable-shorts-player-pip"
|
||||||
|
)
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
@ -188,6 +188,9 @@ Is it ready to submit?"</string>
|
|||||||
<string name="revanced_disable_haptic_feedback_zoom_summary_off">Zoom haptic feedback is enabled</string>
|
<string name="revanced_disable_haptic_feedback_zoom_summary_off">Zoom haptic feedback is enabled</string>
|
||||||
<string name="revanced_disable_haptic_feedback_zoom_summary_on">Zoom haptic feedback is disabled</string>
|
<string name="revanced_disable_haptic_feedback_zoom_summary_on">Zoom haptic feedback is disabled</string>
|
||||||
<string name="revanced_disable_haptic_feedback_zoom_title">Disable zoom haptic feedback</string>
|
<string name="revanced_disable_haptic_feedback_zoom_title">Disable zoom haptic feedback</string>
|
||||||
|
<string name="revanced_disable_shorts_player_pip_summary_off">PiP mode in shorts player is enabled</string>
|
||||||
|
<string name="revanced_disable_shorts_player_pip_summary_on">PiP mode in shorts player is disabled</string>
|
||||||
|
<string name="revanced_disable_shorts_player_pip_title">Disable pip mode in shorts player</string>
|
||||||
<string name="revanced_copytimestamp_success">Time Stamp copied to clipboard</string>
|
<string name="revanced_copytimestamp_success">Time Stamp copied to clipboard</string>
|
||||||
<string name="revanced_enable_always_auto_repeat_summary_off">Always auto repeat is disabled</string>
|
<string name="revanced_enable_always_auto_repeat_summary_off">Always auto repeat is disabled</string>
|
||||||
<string name="revanced_enable_always_auto_repeat_summary_on">Always auto repeat is enabled</string>
|
<string name="revanced_enable_always_auto_repeat_summary_on">Always auto repeat is enabled</string>
|
||||||
|
@ -106,6 +106,9 @@
|
|||||||
<!-- SETTINGS: SHORTS_COMPONENT_PARENT.B
|
<!-- SETTINGS: SHORTS_COMPONENT_PARENT.B
|
||||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_hide_shorts_player_component_title" />SETTINGS: SHORTS_COMPONENT_PARENT.B -->
|
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_hide_shorts_player_component_title" />SETTINGS: SHORTS_COMPONENT_PARENT.B -->
|
||||||
|
|
||||||
|
<!-- SETTINGS: DISABLE_SHORTS_PLAYER_PIP
|
||||||
|
<SwitchPreference android:title="@string/revanced_disable_shorts_player_pip_title" android:key="revanced_disable_shorts_player_pip" android:defaultValue="false" android:summaryOn="@string/revanced_disable_shorts_player_pip_summary_on" android:summaryOff="@string/revanced_disable_shorts_player_pip_summary_off" />SETTINGS: DISABLE_SHORTS_PLAYER_PIP -->
|
||||||
|
|
||||||
<!-- SETTINGS: HIDE_STARTUP_SHORTS_PLAYER
|
<!-- SETTINGS: HIDE_STARTUP_SHORTS_PLAYER
|
||||||
<SwitchPreference android:title="@string/revanced_hide_startup_shorts_player_title" android:key="revanced_hide_startup_shorts_player" android:defaultValue="true" android:summaryOn="@string/revanced_hide_startup_shorts_player_summary_on" android:summaryOff="@string/revanced_hide_startup_shorts_player_summary_off" />SETTINGS: HIDE_STARTUP_SHORTS_PLAYER -->
|
<SwitchPreference android:title="@string/revanced_hide_startup_shorts_player_title" android:key="revanced_hide_startup_shorts_player" android:defaultValue="true" android:summaryOn="@string/revanced_hide_startup_shorts_player_summary_on" android:summaryOff="@string/revanced_hide_startup_shorts_player_summary_off" />SETTINGS: HIDE_STARTUP_SHORTS_PLAYER -->
|
||||||
|
|
||||||
@ -363,6 +366,7 @@
|
|||||||
<Preference android:title="hide-shorts-button" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="hide-shorts-button" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="hide-shorts-component" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="hide-shorts-component" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="hide-startup-shorts-player" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="hide-startup-shorts-player" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
|
<Preference android:title="disable-shorts-player-pip" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="enable-wide-searchbar" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="enable-wide-searchbar" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="enable-tablet-miniplayer" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="enable-tablet-miniplayer" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="hide-auto-captions" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="hide-auto-captions" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user