This commit is contained in:
inotia00
2023-02-15 11:57:57 +09:00
parent ec8bf1c2bb
commit 79a808db5c
213 changed files with 1710 additions and 3027 deletions

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.player.autoplaybutton.bytecode.patch
package app.revanced.patches.youtube.layout.player.autoplaybutton.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
@ -9,21 +10,30 @@ 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.LayoutConstructorFingerprint
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.PLAYER_LAYOUT
import org.jf.dexlib2.iface.instruction.Instruction
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
import org.jf.dexlib2.iface.reference.MethodReference
@Name("hide-autoplay-button-bytecode-patch")
@DependsOn([ResourceMappingPatch::class])
@Patch
@Name("hide-autoplay-button")
@Description("Hides the autoplay button in the video player.")
@DependsOn(
[
ResourceMappingPatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideAutoplayButtonBytecodePatch : BytecodePatch(
class HideAutoplayButtonPatch : BytecodePatch(
listOf(
LayoutConstructorFingerprint
)
@ -57,6 +67,19 @@ class HideAutoplayButtonBytecodePatch : BytecodePatch(
}
} ?: return LayoutConstructorFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_AUTOPLAY_BUTTON"
)
)
SettingsPatch.updatePatchStatus("hide-autoplay-button")
return PatchResultSuccess()
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.player.autoplaybutton.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.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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.player.autoplaybutton.bytecode.patch.HideAutoplayButtonBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-autoplay-button")
@Description("Hides the autoplay button in the video player.")
@DependsOn(
[
HideAutoplayButtonBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideAutoplayButtonPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_AUTOPLAY_BUTTON"
)
ResourceHelper.patchSuccess(
context,
"hide-autoplay-button"
)
return PatchResultSuccess()
}
}

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.player.captionsbutton.bytecode.patch
package app.revanced.patches.youtube.layout.player.captionsbutton.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
@ -8,12 +9,18 @@ import app.revanced.patcher.extensions.addInstruction
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.SubtitleButtonControllerFingerprint
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.PLAYER_LAYOUT
import org.jf.dexlib2.Opcode
@Name("hide-captions-button-bytecode-patch")
@Patch
@Name("hide-captions-button")
@Description("Hides the captions button in the video player.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class HideCaptionsButtonBytecodePatch : BytecodePatch(
@ -38,6 +45,19 @@ class HideCaptionsButtonBytecodePatch : BytecodePatch(
}
} ?: return SubtitleButtonControllerFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_CAPTIONS_BUTTON"
)
)
SettingsPatch.updatePatchStatus("hide-captions-button")
return PatchResultSuccess()
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.player.captionsbutton.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.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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.player.captionsbutton.bytecode.patch.HideCaptionsButtonBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-player-captions-button")
@Description("Hides the captions button in the video player.")
@DependsOn(
[
HideCaptionsButtonBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideCaptionsButtonPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_CAPTIONS_BUTTON"
)
ResourceHelper.patchSuccess(
context,
"hide-captions-button"
)
return PatchResultSuccess()
}
}

View File

@ -1,5 +1,6 @@
package app.revanced.patches.youtube.layout.player.castbutton.bytecode.patch
package app.revanced.patches.youtube.layout.player.castbutton.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
@ -7,13 +8,19 @@ 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.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.PLAYER_LAYOUT
@Name("hide-cast-button-bytecode-patch")
@Patch
@Name("hide-cast-button")
@Description("Hides the cast button in the video player.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class HideCastButtonBytecodePatch : BytecodePatch() {
class HideCastButtonPatch : BytecodePatch() {
override fun execute(context: BytecodeContext): PatchResult {
context.classes.forEach { classDef ->
classDef.methods.forEach { method ->
@ -31,6 +38,19 @@ class HideCastButtonBytecodePatch : BytecodePatch() {
}
}
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_CAST_BUTTON"
)
)
SettingsPatch.updatePatchStatus("hide-cast-button")
return PatchResultSuccess()
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.player.castbutton.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.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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.player.castbutton.bytecode.patch.HideCastButtonBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-cast-button")
@Description("Hides the cast button in the video player.")
@DependsOn(
[
HideCastButtonBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideCastButtonPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_CAST_BUTTON"
)
ResourceHelper.patchSuccess(
context,
"hide-cast-button"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.player.endscreencards.bytecode.fingerprints
package app.revanced.patches.youtube.layout.player.endscreencards.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.player.endscreencards.bytecode.fingerprints
package app.revanced.patches.youtube.layout.player.endscreencards.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.player.endscreencards.bytecode.fingerprints
package app.revanced.patches.youtube.layout.player.endscreencards.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch

View File

@ -1,7 +1,8 @@
package app.revanced.patches.youtube.layout.player.endscreencards.bytecode.patch
package app.revanced.patches.youtube.layout.player.endscreencards.patch
import app.revanced.extensions.injectHideCall
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
@ -10,14 +11,26 @@ 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.player.endscreencards.bytecode.fingerprints.*
import app.revanced.patches.youtube.layout.player.endscreencards.fingerprints.*
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import org.jf.dexlib2.iface.instruction.formats.Instruction21c
@Name("hide-endscreen-cards-bytecode-patch")
@Patch
@Name("hide-endscreen-cards")
@Description("Hides the suggested video cards at the end of a video in fullscreen.")
@DependsOn(
[
SettingsPatch::class,
SharedResourcdIdPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideEndscreenCardsBytecodePatch : BytecodePatch(
class HideEndscreenCardsPatch : BytecodePatch(
listOf(
LayoutCircleFingerprint,
LayoutIconFingerprint,
@ -42,6 +55,19 @@ class HideEndscreenCardsBytecodePatch : BytecodePatch(
it.result?.injectHideCalls() ?: return it.toErrorResult()
}
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_ENDSCREEN_CARDS"
)
)
SettingsPatch.updatePatchStatus("hide-endscreen-cards")
return PatchResultSuccess()
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.player.endscreencards.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.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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.player.endscreencards.bytecode.patch.HideEndscreenCardsBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-endscreen-cards")
@Description("Hides the suggested video cards at the end of a video in fullscreen.")
@DependsOn(
[
HideEndscreenCardsBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideEndscreenCardsPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_ENDSCREEN_CARDS"
)
ResourceHelper.patchSuccess(
context,
"hide-endscreen-cards"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.player.infocards.bytecode.fingerprints
package app.revanced.patches.youtube.layout.player.infocards.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.player.infocards.bytecode.fingerprints
package app.revanced.patches.youtube.layout.player.infocards.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.player.infocards.bytecode.patch
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
@ -9,15 +10,21 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.
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.bytecode.fingerprints.InfocardsIncognitoFingerprint
import app.revanced.patches.youtube.layout.player.infocards.bytecode.fingerprints.InfocardsIncognitoParentFingerprint
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_LAYOUT
@Name("hide-info-cards-bytecode-patch")
@Patch
@Name("hide-info-cards")
@Description("Hides info-cards in videos.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class HideInfoCardsBytecodePatch : BytecodePatch(
class HideInfocardsPatch : BytecodePatch(
listOf(InfocardsIncognitoParentFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
@ -33,6 +40,19 @@ class HideInfoCardsBytecodePatch : BytecodePatch(
) ?: return InfocardsIncognitoFingerprint.toErrorResult()
} ?: return InfocardsIncognitoParentFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_INFO_CARDS"
)
)
SettingsPatch.updatePatchStatus("hide-info-cards")
return PatchResultSuccess()
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.player.infocards.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.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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.player.infocards.bytecode.patch.HideInfoCardsBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-info-cards")
@Description("Hides info-cards in videos.")
@DependsOn(
[
HideInfoCardsBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideInfoCardsPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_INFO_CARDS"
)
ResourceHelper.patchSuccess(
context,
"hide-info-cards"
)
return PatchResultSuccess()
}
}

View File

@ -12,7 +12,6 @@ import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.playerbutton.patch.PlayerButtonPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-live-chat-button")
@ -31,18 +30,15 @@ class HideLiveChatButtonPatch : ResourcePatch {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_LIVE_CHATS_BUTTON"
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_LIVE_CHATS_BUTTON"
)
)
ResourceHelper.patchSuccess(
context,
"hide-live-chat-button"
)
SettingsPatch.updatePatchStatus("hide-live-chat-button")
return PatchResultSuccess()
}

View File

@ -12,7 +12,6 @@ import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.playerbutton.patch.PlayerButtonPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-next-prev-button")
@ -31,19 +30,16 @@ class HideNextPrevButtonPatch : ResourcePatch {
/*
add settings
*/
ResourceHelper.addSettings3(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_NEXT_BUTTON",
"SETTINGS: HIDE_PREV_BUTTON"
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_NEXT_BUTTON",
"SETTINGS: HIDE_PREV_BUTTON"
)
)
ResourceHelper.patchSuccess(
context,
"hide-next-prev-button"
)
SettingsPatch.updatePatchStatus("hide-next-prev-button")
return PatchResultSuccess()
}

View File

@ -1,7 +1,7 @@
package app.revanced.patches.youtube.layout.player.playeroverlayfilter.bytecode.patch
package app.revanced.patches.youtube.layout.player.playeroverlayfilter.patch
import app.revanced.extensions.findMutableMethodOf
import app.revanced.extensions.toResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
@ -9,19 +9,30 @@ import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
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.patcher.util.smali.ExternalLabel
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 org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.formats.Instruction21c
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
@DependsOn([ResourceMappingPatch::class])
@Name("hide-player-overlay-filter-bytecode-patch")
@Patch
@Name("hide-player-overlay-filter")
@Description("Remove the dark filter layer from the player's background.")
@DependsOn(
[
ResourceMappingPatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class PlayerOverlayFilterBytecodePatch : BytecodePatch() {
class PlayerOverlayFilterPatch : BytecodePatch() {
// list of resource names to get the id of
private val resourceIds = arrayOf(
@ -72,6 +83,25 @@ class PlayerOverlayFilterBytecodePatch : BytecodePatch() {
}
}
}
return toResult(patchSuccessArray.indexOf(false))
val errorIndex: Int = patchSuccessArray.indexOf(false)
if (errorIndex == -1) {
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_PLAYER_OVERLAY_FILTER"
)
)
SettingsPatch.updatePatchStatus("hide-player-overlay-filter")
return PatchResultSuccess()
} else
return PatchResultError("Instruction not found: $errorIndex")
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.player.playeroverlayfilter.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.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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.player.playeroverlayfilter.bytecode.patch.PlayerOverlayFilterBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-player-overlay-filter")
@Description("Remove the dark filter layer from the player's background.")
@DependsOn(
[
SettingsPatch::class,
PlayerOverlayFilterBytecodePatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class PlayerOverlayFilterPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_PALYER_OVERLAY_FILTER"
)
ResourceHelper.patchSuccess(
context,
"hide-player-overlay-filter"
)
return PatchResultSuccess()
}
}

View File

@ -1,25 +1,36 @@
package app.revanced.patches.youtube.layout.player.suggestactions.bytecode.patch
package app.revanced.patches.youtube.layout.player.suggestactions.patch
import app.revanced.extensions.findMutableMethodOf
import app.revanced.extensions.injectHideCall
import app.revanced.extensions.toResult
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.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 org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.formats.Instruction22c
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
@DependsOn([ResourceMappingPatch::class])
@Name("hide-suggested-actions-bytecode-patch")
@Patch
@Name("hide-suggested-actions")
@Description("Hide the suggested actions bar inside the player.")
@DependsOn(
[
ResourceMappingPatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class SuggestedActionsBytecodePatch : BytecodePatch() {
class SuggestedActionsPatch : BytecodePatch() {
// list of resource names to get the id of
private val resourceIds = arrayOf(
@ -57,6 +68,25 @@ class SuggestedActionsBytecodePatch : BytecodePatch() {
}
}
}
return toResult(patchSuccessArray.indexOf(false))
val errorIndex: Int = patchSuccessArray.indexOf(false)
if (errorIndex == -1) {
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_SUGGESTED_ACTION"
)
)
SettingsPatch.updatePatchStatus("hide-suggested-actions")
return PatchResultSuccess()
} else
return PatchResultError("Instruction not found: $errorIndex")
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.player.suggestactions.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.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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.player.suggestactions.bytecode.patch.SuggestedActionsBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-suggested-actions")
@Description("Hide the suggested actions bar inside the player.")
@DependsOn(
[
SettingsPatch::class,
SuggestedActionsBytecodePatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class SuggestedActionsPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_SUGGESTED_ACTION"
)
ResourceHelper.patchSuccess(
context,
"hide-suggested-actions"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.player.watermark.bytecode.fingerprints
package app.revanced.patches.youtube.layout.player.watermark.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.player.watermark.bytecode.fingerprints
package app.revanced.patches.youtube.layout.player.watermark.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.player.watermark.bytecode.patch
package app.revanced.patches.youtube.layout.player.watermark.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
@ -11,13 +12,19 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.
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.watermark.bytecode.fingerprints.HideWatermarkFingerprint
import app.revanced.patches.youtube.layout.player.watermark.bytecode.fingerprints.HideWatermarkParentFingerprint
import app.revanced.patches.youtube.layout.player.watermark.fingerprints.HideWatermarkFingerprint
import app.revanced.patches.youtube.layout.player.watermark.fingerprints.HideWatermarkParentFingerprint
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.PLAYER_LAYOUT
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
@Name("hide-channel-watermark-bytecode-patch")
@Patch
@Name("hide-channel-watermark")
@Description("Hides creator's watermarks on videos.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class HideChannelWatermarkBytecodePatch : BytecodePatch(
@ -44,6 +51,19 @@ class HideChannelWatermarkBytecodePatch : BytecodePatch(
} ?: return HideWatermarkFingerprint.toErrorResult()
} ?: return HideWatermarkParentFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_CHANNEL_WATERMARK"
)
)
SettingsPatch.updatePatchStatus("hide-channel-watermark")
return PatchResultSuccess()
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.player.watermark.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.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
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.player.watermark.bytecode.patch.HideChannelWatermarkBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-channel-watermark")
@Description("Hides creator's watermarks on videos.")
@DependsOn(
[
HideChannelWatermarkBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideChannelWatermarkPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_CHANNEL_WATERMARK"
)
ResourceHelper.patchSuccess(
context,
"hide-channel-watermark"
)
return PatchResultSuccess()
}
}