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,7 +1,7 @@
package app.revanced.patches.youtube.layout.fullscreen.endscreenoverlay.bytecode.patch
package app.revanced.patches.youtube.layout.fullscreen.endscreenoverlay.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 app.revanced.util.integrations.Constants.FULLSCREEN_LAYOUT
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
@Name("hide-endscreen-overlay-bytecode-patch")
@DependsOn([ResourceMappingPatch::class])
@Patch
@Name("hide-endscreen-overlay")
@Description("Hide endscreen overlay on swipe controls.")
@DependsOn(
[
ResourceMappingPatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideEndscreenOverlayBytecodePatch : BytecodePatch() {
class HideEndscreenOverlayPatch : BytecodePatch() {
// list of resource names to get the id of
private val resourceIds = arrayOf(
"app_related_endscreen_results"
@ -65,6 +76,25 @@ class HideEndscreenOverlayBytecodePatch : 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: FULLSCREEN",
"SETTINGS: HIDE_ENDSCREEN_OVERLAY"
)
)
SettingsPatch.updatePatchStatus("hide-endscreen-overlay")
return PatchResultSuccess()
} else
return PatchResultError("Instruction not found: $errorIndex")
}
}

View File

@ -1,48 +0,0 @@
package app.revanced.patches.youtube.layout.fullscreen.endscreenoverlay.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.fullscreen.endscreenoverlay.bytecode.patch.HideEndscreenOverlayBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-endscreen-overlay")
@Description("Hide endscreen overlay on swipe controls.")
@DependsOn(
[
HideEndscreenOverlayBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideFilmStripPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: FULLSCREEN",
"SETTINGS: HIDE_ENDSCREEN_OVERLAY"
)
ResourceHelper.patchSuccess(
context,
"hide-endscreen-overlay"
)
return PatchResultSuccess()
}
}

View File

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

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.bytecode.patch
package app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.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
@ -10,18 +11,24 @@ 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.youtube.layout.fullscreen.flimstripoverlay.bytecode.fingerprints.ScrubbingLabelFingerprint
import app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.fingerprints.ScrubbingLabelFingerprint
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.FULLSCREEN_LAYOUT
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
import org.jf.dexlib2.iface.reference.FieldReference
@Name("hide-filmstrip-overlay-bytecode-patch")
@Patch
@Name("hide-filmstrip-overlay")
@Description("Hide flimstrip overlay on swipe controls.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class HideFilmstripOverlayBytecodePatch : BytecodePatch(
class HideFilmstripOverlayPatch : BytecodePatch(
listOf(
ScrubbingLabelFingerprint
)
@ -49,6 +56,19 @@ class HideFilmstripOverlayBytecodePatch : BytecodePatch(
it.removeInstruction(index)
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: FULLSCREEN",
"SETTINGS: HIDE_FILMSTRIP_OVERLAY"
)
)
SettingsPatch.updatePatchStatus("hide-filmstrip-overlay")
return PatchResultSuccess()
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.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.fullscreen.flimstripoverlay.bytecode.patch.HideFilmstripOverlayBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-filmstrip-overlay")
@Description("Hide flimstrip overlay on swipe controls.")
@DependsOn(
[
HideFilmstripOverlayBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideFilmstripOverlayPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: FULLSCREEN",
"SETTINGS: HIDE_FILMSTRIP_OVERLAY"
)
ResourceHelper.patchSuccess(
context,
"hide-filmstrip-overlay"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.bytecode.fingerprints
package app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.bytecode.patch
package app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.patch
import app.revanced.extensions.findMutableMethodOf
import app.revanced.extensions.injectHideCall
@ -15,11 +15,11 @@ import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.formats.Instruction21c
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
@Name("hide-fullscreen-buttoncontainer-bytecode-patch")
@Name("hide-fullscreen-buttoncontainer")
@DependsOn([ResourceMappingPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class FullscreenButtonContainerBytecodePatch : BytecodePatch() {
class HideFullscreenButtonContainerPatch : BytecodePatch() {
private val resourceIds = arrayOf(
"quick_actions_element_container"
).map { name ->

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.bytecode.patch
package app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.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
@ -10,19 +11,30 @@ import app.revanced.patcher.extensions.removeInstruction
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.youtube.layout.fullscreen.fullscreenpanels.bytecode.fingerprints.FullscreenViewAdderFingerprint
import app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.fingerprints.FullscreenViewAdderFingerprint
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.FULLSCREEN_LAYOUT
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
@Name("hide-fullscreen-panels-bytecode-patch")
@Patch
@Name("hide-fullscreen-panels")
@Description("Hides video description and comments panel in fullscreen view.")
@DependsOn(
[
HideFullscreenButtonContainerPatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideFullscreenPanelsBytecodePatch : BytecodePatch(
class HideFullscreenPanelsPatch : BytecodePatch(
listOf(
FullscreenViewAdderFingerprint,
LayoutConstructorFingerprint
@ -45,6 +57,19 @@ class HideFullscreenPanelsBytecodePatch : BytecodePatch(
}
} ?: return FullscreenViewAdderFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: FULLSCREEN",
"SETTINGS: HIDE_FULLSCREEN_PANELS"
)
)
SettingsPatch.updatePatchStatus("hide-fullscreen-panels")
LayoutConstructorFingerprint.result?.mutableMethod?.let { method ->
val invokeIndex = method.implementation!!.instructions.indexOfFirst {
it.opcode.ordinal == Opcode.INVOKE_VIRTUAL.ordinal &&

View File

@ -1,51 +0,0 @@
package app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.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.fullscreen.fullscreenpanels.bytecode.patch.FullscreenButtonContainerBytecodePatch
import app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.bytecode.patch.HideFullscreenPanelsBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-fullscreen-panels")
@Description("Hides video description and comments panel in fullscreen view.")
@DependsOn(
[
FullscreenButtonContainerBytecodePatch::class,
HideFullscreenPanelsBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideFullscreenPanelsPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: FULLSCREEN",
"SETTINGS: HIDE_FULLSCREEN_PANELS"
)
ResourceHelper.patchSuccess(
context,
"hide-fullscreen-panels"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.bytecode.fingerprints
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.bytecode.fingerprints
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.bytecode.fingerprints
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.bytecode.fingerprints
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.bytecode.patch
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.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,16 +12,22 @@ 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.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.bytecode.fingerprints.*
import app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.fingerprints.*
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.FULLSCREEN_LAYOUT
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Name("disable-haptic-feedback-bytecode-patch")
@Patch
@Name("disable-haptic-feedback")
@Description("Disable haptic feedback when swiping.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class HapticFeedBackBytecodePatch : BytecodePatch(
class HapticFeedBackPatch : BytecodePatch(
listOf(
MarkerHapticsFingerprint,
SeekHapticsFingerprint,
@ -44,6 +51,19 @@ class HapticFeedBackBytecodePatch : BytecodePatch(
} ?: return fingerprint.toErrorResult()
}
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: FULLSCREEN",
"SETTINGS: DISABLE_HAPTIC_FEEDBACK"
)
)
SettingsPatch.updatePatchStatus("disable-haptic-feedback")
return PatchResultSuccess()
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.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.fullscreen.hapticfeedback.bytecode.patch.HapticFeedBackBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("disable-haptic-feedback")
@Description("Disable haptic feedback when swiping.")
@DependsOn(
[
HapticFeedBackBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HapticFeedBackPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: FULLSCREEN",
"SETTINGS: DISABLE_HAPTIC_FEEDBACK"
)
ResourceHelper.patchSuccess(
context,
"disable-haptic-feedback"
)
return PatchResultSuccess()
}
}