mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-13 05:37:40 +02:00
remove disable-shorts-player-pip
patch
This commit is contained in:
@ -1,48 +0,0 @@
|
||||
package app.revanced.patches.youtube.extended.shortspip.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.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.extended.shortspip.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.EXTENDED_PATH
|
||||
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
@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?.let {
|
||||
with (it.mutableMethod) {
|
||||
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val register = (implementation!!.instructions[endIndex] as TwoRegisterInstruction).registerA
|
||||
this.addInstructions(
|
||||
endIndex + 1, """
|
||||
invoke-static {v$register}, $EXTENDED_PATH/DisableShortsPiPPatch;->disableShortsPlayerPiP(Z)Z
|
||||
move-result v$register
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return DisableShortsPiPFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
package app.revanced.patches.youtube.extended.shortspip.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.extended.shortspip.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.addSettings2(
|
||||
context,
|
||||
"PREFERENCE_CATEGORY: REVANCED_EXTENDED_SETTINGS",
|
||||
"PREFERENCE: EXTENDED_SETTINGS",
|
||||
"SETTINGS: EXPERIMENTAL_FLAGS",
|
||||
"SETTINGS: DISABLE_SHORTS_PLAYER_PIP"
|
||||
)
|
||||
|
||||
ResourceHelper.patchSuccess(
|
||||
context,
|
||||
"disable-shorts-player-pip"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object MinimizedPlaybackKidsFingerprint : MethodFingerprint(
|
||||
object KidsMinimizedPlaybackPolicyControllerFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("I", "L", "L"),
|
@ -1,11 +1,11 @@
|
||||
package app.revanced.patches.youtube.extended.shortspip.bytecode.fingerprints
|
||||
package app.revanced.patches.youtube.misc.minimizedplayback.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 DisableShortsPiPFingerprint : MethodFingerprint(
|
||||
object PipControllerFingerprint : MethodFingerprint(
|
||||
returnType = "L",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
@ -6,6 +6,7 @@ import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.data.toMethodWalker
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
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
|
||||
@ -13,35 +14,46 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.youtube.misc.minimizedplayback.bytecode.fingerprints.*
|
||||
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
|
||||
import app.revanced.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.shared.extensions.toErrorResult
|
||||
import app.revanced.shared.util.integrations.Constants.MISC_PATH
|
||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
import org.jf.dexlib2.iface.reference.MethodReference
|
||||
|
||||
@Name("enable-minimized-playback-bytecode-patch")
|
||||
@DependsOn([SharedResourcdIdPatch::class])
|
||||
@DependsOn(
|
||||
[
|
||||
PlayerTypeHookPatch::class,
|
||||
SharedResourcdIdPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class MinimizedPlaybackBytecodePatch : BytecodePatch(
|
||||
listOf(
|
||||
MinimizedPlaybackKidsFingerprint,
|
||||
KidsMinimizedPlaybackPolicyControllerFingerprint,
|
||||
MinimizedPlaybackManagerFingerprint,
|
||||
MinimizedPlaybackSettingsFingerprint
|
||||
MinimizedPlaybackSettingsFingerprint,
|
||||
PipControllerFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
val methods = arrayOf(
|
||||
MinimizedPlaybackKidsFingerprint,
|
||||
KidsMinimizedPlaybackPolicyControllerFingerprint,
|
||||
MinimizedPlaybackManagerFingerprint,
|
||||
MinimizedPlaybackSettingsFingerprint
|
||||
).map {
|
||||
it.result!!.mutableMethod
|
||||
it.result?.mutableMethod?: return it.toErrorResult()
|
||||
}
|
||||
|
||||
hookPlaybackController(methods[0])
|
||||
hookPlayback(methods[1])
|
||||
walkMutable(context, methods[2])
|
||||
methods[0].hookPlaybackController()
|
||||
methods[1].hookPlayback()
|
||||
methods[2].walkMutable(context)
|
||||
|
||||
PipControllerFingerprint.result?.hookShortsPiP()?:return PipControllerFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
@ -50,26 +62,25 @@ class MinimizedPlaybackBytecodePatch : BytecodePatch(
|
||||
const val INTEGRATIONS_PLAYBACK_METHOD_REFERENCE =
|
||||
"$MISC_PATH/MinimizedPlaybackPatch;->enableMinimizedPlayback()Z"
|
||||
|
||||
fun walkMutable(
|
||||
context: BytecodeContext,
|
||||
insertMethod: MutableMethod
|
||||
) {
|
||||
val booleanCalls = insertMethod.implementation!!.instructions.withIndex()
|
||||
const val INTEGRATIONS_PIP_METHOD_REFERENCE =
|
||||
"$MISC_PATH/MinimizedPlaybackPatch;->isNotPlayingShorts(Z)Z"
|
||||
|
||||
fun MutableMethod.walkMutable(
|
||||
context: BytecodeContext) {
|
||||
val booleanCalls = implementation!!.instructions.withIndex()
|
||||
.filter { ((it.value as? ReferenceInstruction)?.reference as? MethodReference)?.returnType == "Z" }
|
||||
|
||||
val booleanIndex = booleanCalls.elementAt(1).index
|
||||
val booleanMethod =
|
||||
context.toMethodWalker(insertMethod)
|
||||
context.toMethodWalker(this)
|
||||
.nextMethod(booleanIndex, true)
|
||||
.getMethod() as MutableMethod
|
||||
|
||||
hookPlayback(booleanMethod)
|
||||
booleanMethod.hookPlayback()
|
||||
}
|
||||
|
||||
fun hookPlayback(
|
||||
insertMethod: MutableMethod
|
||||
) {
|
||||
insertMethod.addInstructions(
|
||||
fun MutableMethod.hookPlayback() {
|
||||
addInstructions(
|
||||
0, """
|
||||
invoke-static {}, $INTEGRATIONS_PLAYBACK_METHOD_REFERENCE
|
||||
move-result v0
|
||||
@ -78,17 +89,28 @@ class MinimizedPlaybackBytecodePatch : BytecodePatch(
|
||||
)
|
||||
}
|
||||
|
||||
fun hookPlaybackController(
|
||||
insertMethod: MutableMethod
|
||||
) {
|
||||
insertMethod.addInstructions(
|
||||
fun MutableMethod.hookPlaybackController() {
|
||||
addInstructions(
|
||||
0, """
|
||||
invoke-static {}, $INTEGRATIONS_PLAYBACK_METHOD_REFERENCE
|
||||
move-result v0
|
||||
if-eqz v0, :default
|
||||
return-void
|
||||
""", listOf(ExternalLabel("default", insertMethod.instruction(0)))
|
||||
""", listOf(ExternalLabel("default", instruction(0)))
|
||||
)
|
||||
}
|
||||
|
||||
fun MethodFingerprintResult.hookShortsPiP() {
|
||||
val endIndex = scanResult.patternScanResult!!.endIndex
|
||||
with (mutableMethod) {
|
||||
val register = (implementation!!.instructions[endIndex] as TwoRegisterInstruction).registerA
|
||||
addInstructions(
|
||||
endIndex + 1, """
|
||||
invoke-static {v$register}, $INTEGRATIONS_PIP_METHOD_REFERENCE
|
||||
move-result v$register
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -191,9 +191,6 @@ 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_on">Zoom haptic feedback is disabled</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_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>
|
||||
@ -473,9 +470,6 @@ Are you sure you want to continue though?"</string>
|
||||
<string name="revanced_reboot_warning_oldlayout">"Tricks the YouTube client version to v17.28.35 to load the old layout
|
||||
|
||||
In the app settings, the YouTube version may be marked as v17.28.35"</string>
|
||||
<string name="revanced_reboot_warning_pip">"Disable pip mode on shorts players
|
||||
|
||||
This option is not valid on certain Android versions or certain OS"</string>
|
||||
<string name="revanced_reboot_warning_phone">"Tricks the dpi to change some layouts to phone layouts.
|
||||
|
||||
If you enable this setting, the following features are available:
|
||||
|
@ -349,8 +349,6 @@
|
||||
<SwitchPreference android:title="@string/revanced_enable_phone_layout_title" android:key="revanced_enable_phone_layout" android:summary="@string/revanced_enable_phone_layout_summary" android:defaultValue="false" />SETTINGS: LAYOUT_SWITCH -->
|
||||
<!-- SETTINGS: ENABLE_VP9_CODEC
|
||||
<SwitchPreference android:title="@string/revanced_enable_vp9_codec_title" android:key="revanced_enable_vp9_codec" android:defaultValue="false" android:summary="@string/revanced_enable_vp9_codec_summary" />SETTINGS: ENABLE_VP9_CODEC -->
|
||||
<!-- 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: ABOUT
|
||||
<Preference android:title=" " android:selectable="false" android:summary="@string/pref_about_category" />
|
||||
@ -430,7 +428,6 @@
|
||||
<Preference android:title="enable-old-layout" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="layout-switch" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="force-vp9-codec" 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=" " android:selectable="false" android:summary="@string/revanced_others_title" />
|
||||
<Preference android:title="return-youtube-dislike" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
|
Reference in New Issue
Block a user