mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-13 13:47:42 +02:00
add disable-landscape-mode
patch (exclude by default)
This commit is contained in:
@ -0,0 +1,8 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.fullscreen.landscapemode.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
|
||||||
|
object OrientationParentFingerprint : MethodFingerprint(
|
||||||
|
returnType = "Z",
|
||||||
|
strings = listOf("NoClassDefFoundError thrown while verifying stack trace.")
|
||||||
|
)
|
@ -0,0 +1,17 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.fullscreen.landscapemode.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 OrientationPrimaryFingerprint : MethodFingerprint (
|
||||||
|
returnType = "V",
|
||||||
|
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||||
|
parameters = listOf("L"),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT
|
||||||
|
),
|
||||||
|
customFingerprint = {it.name == "<init>"}
|
||||||
|
)
|
@ -0,0 +1,16 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.fullscreen.landscapemode.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 OrientationSecondaryFingerprint : MethodFingerprint (
|
||||||
|
returnType = "V",
|
||||||
|
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = listOf("L"),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT
|
||||||
|
)
|
||||||
|
)
|
@ -0,0 +1,77 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.fullscreen.landscapemode.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.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||||
|
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.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.util.integrations.Constants.FULLSCREEN
|
||||||
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
|
@Patch(false)
|
||||||
|
@Name("diable-landscape-mode")
|
||||||
|
@Description("Disable landscape mode when entering fullscreen.")
|
||||||
|
@DependsOn([SettingsPatch::class])
|
||||||
|
@YouTubeCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class LandScapeModePatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
OrientationParentFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
OrientationParentFingerprint.result?.classDef?.let { classDef ->
|
||||||
|
arrayOf(
|
||||||
|
OrientationPrimaryFingerprint,
|
||||||
|
OrientationSecondaryFingerprint
|
||||||
|
).forEach { fingerprint ->
|
||||||
|
fingerprint.also { it.resolve(context, classDef) }.result?.injectOverride() ?: return fingerprint.toErrorResult()
|
||||||
|
}
|
||||||
|
} ?: return OrientationParentFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add settings
|
||||||
|
*/
|
||||||
|
SettingsPatch.addPreference(
|
||||||
|
arrayOf(
|
||||||
|
"PREFERENCE: FULLSCREEN_SETTINGS",
|
||||||
|
"SETTINGS: DISABLE_LANDSCAPE_MODE"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
SettingsPatch.updatePatchStatus("diable-landscape-mode")
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
private companion object {
|
||||||
|
const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||||
|
"$FULLSCREEN->disableLandScapeMode(Z)Z"
|
||||||
|
|
||||||
|
fun MethodFingerprintResult.injectOverride() {
|
||||||
|
with (mutableMethod) {
|
||||||
|
val index = scanResult.patternScanResult!!.endIndex
|
||||||
|
val register = (instruction(index) as OneRegisterInstruction).registerA
|
||||||
|
|
||||||
|
addInstructions(
|
||||||
|
index +1, """
|
||||||
|
invoke-static {v$register}, $INTEGRATIONS_CLASS_DESCRIPTOR
|
||||||
|
move-result v$register
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -176,6 +176,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_landscape_mode_summary_off">Landscape mode when entering fullscreen is enabled</string>
|
||||||
|
<string name="revanced_disable_landscape_mode_summary_on">Landscape mode when entering fullscreen is disabled</string>
|
||||||
|
<string name="revanced_disable_landscape_mode_title">Disable landscape mode when entering fullscreen</string>
|
||||||
<string name="revanced_disable_quic_protocol_summary">"Disable CronetEngine's QUIC protocol"</string>
|
<string name="revanced_disable_quic_protocol_summary">"Disable CronetEngine's QUIC protocol"</string>
|
||||||
<string name="revanced_disable_quic_protocol_title">Disable QUIC protocol</string>
|
<string name="revanced_disable_quic_protocol_title">Disable QUIC protocol</string>
|
||||||
<string name="revanced_double_back_timeout_summary">The amount of seconds the double press back to exit</string>
|
<string name="revanced_double_back_timeout_summary">The amount of seconds the double press back to exit</string>
|
||||||
|
@ -216,6 +216,10 @@
|
|||||||
<!-- SETTINGS: HIDE_FILMSTRIP_OVERLAY
|
<!-- SETTINGS: HIDE_FILMSTRIP_OVERLAY
|
||||||
<SwitchPreference android:title="@string/revanced_hide_filmstrip_overlay_title" android:key="revanced_hide_filmstrip_overlay" android:defaultValue="false" android:summaryOn="@string/revanced_hide_filmstrip_overlay_summary_on" android:summaryOff="@string/revanced_hide_filmstrip_overlay_summary_off" />SETTINGS: HIDE_FILMSTRIP_OVERLAY -->
|
<SwitchPreference android:title="@string/revanced_hide_filmstrip_overlay_title" android:key="revanced_hide_filmstrip_overlay" android:defaultValue="false" android:summaryOn="@string/revanced_hide_filmstrip_overlay_summary_on" android:summaryOff="@string/revanced_hide_filmstrip_overlay_summary_off" />SETTINGS: HIDE_FILMSTRIP_OVERLAY -->
|
||||||
|
|
||||||
|
<!-- SETTINGS: DISABLE_LANDSCAPE_MODE
|
||||||
|
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_experimental_flag" />
|
||||||
|
<SwitchPreference android:title="@string/revanced_disable_landscape_mode_title" android:key="revanced_disable_landscape_mode" android:defaultValue="false" android:summaryOn="@string/revanced_disable_landscape_mode_summary_on" android:summaryOff="@string/revanced_disable_landscape_mode_summary_off" />SETTINGS: DISABLE_LANDSCAPE_MODE -->
|
||||||
|
|
||||||
<!-- SETTINGS: DISABLE_HAPTIC_FEEDBACK
|
<!-- SETTINGS: DISABLE_HAPTIC_FEEDBACK
|
||||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_haptic_feedback_title" />
|
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_haptic_feedback_title" />
|
||||||
<SwitchPreference android:title="@string/revanced_disable_haptic_feedback_seek_title" android:key="revanced_disable_haptic_feedback_seek" android:defaultValue="false" android:summaryOn="@string/revanced_disable_haptic_feedback_seek_summary_on" android:summaryOff="@string/revanced_disable_haptic_feedback_seek_summary_off" />
|
<SwitchPreference android:title="@string/revanced_disable_haptic_feedback_seek_title" android:key="revanced_disable_haptic_feedback_seek" android:defaultValue="false" android:summaryOn="@string/revanced_disable_haptic_feedback_seek_summary_on" android:summaryOff="@string/revanced_disable_haptic_feedback_seek_summary_off" />
|
||||||
@ -475,6 +479,7 @@
|
|||||||
<Preference android:title="hide-autoplay-preview" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="hide-autoplay-preview" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="hide-endscreen-overlay" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="hide-endscreen-overlay" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="hide-filmstrip-overlay" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="hide-filmstrip-overlay" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
|
<Preference android:title="diable-landscape-mode" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="disable-haptic-feedback" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="disable-haptic-feedback" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
|
|
||||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_bottom_player" />
|
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_bottom_player" />
|
||||||
|
Reference in New Issue
Block a user