mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-01 15:14:34 +02:00
add disable-auto-captions
patch
This commit is contained in:
parent
f901b807d1
commit
3ae638218c
@ -0,0 +1,50 @@
|
||||
package app.revanced.patches.music.layout.autocaptions.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.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.music.misc.settings.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.patches.shared.fingerprints.SubtitleTrackFingerprint
|
||||
import app.revanced.util.integrations.Constants.MUSIC_SETTINGS_PATH
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@Name("disable-auto-captions")
|
||||
@Description("Disable forced captions from automatically enabling in video player.")
|
||||
@DependsOn([MusicSettingsPatch::class])
|
||||
@YouTubeMusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class DisableAutoCaptionsPatch : BytecodePatch(
|
||||
listOf(
|
||||
SubtitleTrackFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
SubtitleTrackFingerprint.result?.mutableMethod?.let {
|
||||
with (it.implementation!!.instructions) {
|
||||
val index = size - 1
|
||||
val register = (elementAt(index) as OneRegisterInstruction).registerA
|
||||
it.addInstructions(
|
||||
index, """
|
||||
invoke-static {v$register}, $MUSIC_SETTINGS_PATH->disableAutoCaptions(Z)Z
|
||||
move-result v$register
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return SubtitleTrackFingerprint.toErrorResult()
|
||||
|
||||
MusicSettingsPatch.addMusicPreference("design", "revanced_disable_auto_captions", "false")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -4,6 +4,8 @@
|
||||
<string name="revanced_category_design">Design</string>
|
||||
<string name="revanced_category_listening">Listening</string>
|
||||
<string name="revanced_category_navigation">Navigation</string>
|
||||
<string name="revanced_disable_auto_captions_summary">Disable forced captions from automatically enabling in video player.</string>
|
||||
<string name="revanced_disable_auto_captions_title">Disable auto captions</string>
|
||||
<string name="revanced_enable_black_navbar_summary">Sets the navigation bar color to black.</string>
|
||||
<string name="revanced_enable_black_navbar_title">Enable black navbar</string>
|
||||
<string name="revanced_enable_color_match_player_summary">Matches the fullscreen player color with the minimized one.</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user