bump v2.147.0

This commit is contained in:
inotia00
2022-12-23 17:49:31 +09:00
parent 74aecf4720
commit 187d905bdb
1034 changed files with 21004 additions and 11645 deletions

View File

@ -0,0 +1,68 @@
package app.revanced.patches.youtube.layout.fullscreen.endscreenoverlay.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.extensions.instruction
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.shared.annotation.YouTubeCompatibility
import app.revanced.shared.extensions.findMutableMethodOf
import app.revanced.shared.patches.mapping.ResourceMappingPatch
import app.revanced.shared.util.integrations.Constants.FULLSCREEN_LAYOUT
import org.jf.dexlib2.iface.instruction.formats.Instruction22c
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
import org.jf.dexlib2.Opcode
@Name("hide-endscreen-overlay-bytecode-patch")
@DependsOn([ResourceMappingPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class HideEndscreenOverlayBytecodePatch : BytecodePatch() {
// list of resource names to get the id of
private val resourceIds = arrayOf(
"app_related_endscreen_results"
).map { name ->
ResourceMappingPatch.resourceMappings.single { it.name == name }.id
}
override fun execute(context: BytecodeContext): PatchResult {
context.classes.forEach { classDef ->
classDef.methods.forEach { method ->
with(method.implementation) {
this?.instructions?.forEachIndexed { index, instruction ->
when (instruction.opcode) {
Opcode.CONST -> {
when ((instruction as Instruction31i).wideLiteral) {
resourceIds[0] -> { // end screen result
val insertIndex = index - 13
val invokeInstruction = instructions.elementAt(insertIndex)
if (invokeInstruction.opcode != Opcode.IF_NEZ) return@forEachIndexed
val mutableMethod = context.proxy(classDef).mutableClass.findMutableMethodOf(method)
val dummyRegister = (instructions.elementAt(index) as Instruction31i).registerA
mutableMethod.addInstructions(
insertIndex, """
invoke-static {}, $FULLSCREEN_LAYOUT->hideEndscreenOverlay()Z
move-result v$dummyRegister
if-eqz v$dummyRegister, :on
return-void
""", listOf(ExternalLabel("on", mutableMethod.instruction(insertIndex)))
)
}
}
}
else -> return@forEachIndexed
}
}
}
}
}
return PatchResultSuccess()
}
}

View File

@ -0,0 +1,50 @@
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.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.layout.fullscreen.endscreenoverlay.bytecode.patch.HideEndscreenOverlayBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.shared.annotation.YouTubeCompatibility
import app.revanced.shared.util.resources.ResourceHelper
import app.revanced.shared.util.resources.ResourceUtils
import app.revanced.shared.util.resources.ResourceUtils.copyResources
@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

@ -0,0 +1,16 @@
package app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.bytecode.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
import org.jf.dexlib2.Opcode
object ScrubbingLabelFingerprint : MethodFingerprint(
opcodes = listOf(Opcode.IPUT_BOOLEAN),
customFingerprint = { methodDef ->
methodDef.implementation?.instructions?.any { instruction ->
instruction.opcode.ordinal == Opcode.CONST.ordinal &&
(instruction as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.scrubbingLabelId
} == true
}
)

View File

@ -0,0 +1,56 @@
package app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.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.extensions.removeInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.bytecode.fingerprints.ScrubbingLabelFingerprint
import app.revanced.shared.annotation.YouTubeCompatibility
import app.revanced.shared.util.integrations.Constants.FULLSCREEN_LAYOUT
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
import org.jf.dexlib2.iface.reference.FieldReference
import org.jf.dexlib2.Opcode
@Name("hide-filmstrip-overlay-bytecode-patch")
@YouTubeCompatibility
@Version("0.0.1")
class HideFilmstripOverlayBytecodePatch : BytecodePatch(
listOf(
ScrubbingLabelFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
val scrubbingLabelResult = ScrubbingLabelFingerprint.result!!
val scrubbingLabelMethod = scrubbingLabelResult.mutableMethod
val scrubbingLabelMethodInstructions = scrubbingLabelMethod.implementation!!.instructions
for ((index, instruction) in scrubbingLabelMethodInstructions.withIndex()) {
if (instruction.opcode != Opcode.IPUT_BOOLEAN) continue
val scrubbingLabelRegisterA = (instruction as TwoRegisterInstruction).registerA
val scrubbingLabelRegisterB = scrubbingLabelRegisterA + 2
val scrubbingLabelRegisterC = (instruction as TwoRegisterInstruction).registerB
val scrubbingLabelReference = (instruction as ReferenceInstruction).reference as FieldReference
scrubbingLabelMethod.addInstructions(
index + 1, """
invoke-static {}, $FULLSCREEN_LAYOUT->hideFilmstripOverlay()Z
move-result v$scrubbingLabelRegisterB
if-eqz v$scrubbingLabelRegisterB, :show
const/4 v$scrubbingLabelRegisterA, 0x0
:show
iput-boolean v$scrubbingLabelRegisterA, v$scrubbingLabelRegisterC, ${scrubbingLabelReference.definingClass}->${scrubbingLabelReference.name}:${scrubbingLabelReference.type}
"""
)
scrubbingLabelMethod.removeInstruction(index)
break
}
return PatchResultSuccess()
}
}

View File

@ -0,0 +1,49 @@
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.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.layout.fullscreen.flimstripoverlay.bytecode.patch.HideFilmstripOverlayBytecodePatch
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("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

@ -0,0 +1,57 @@
package app.revanced.patches.youtube.layout.fullscreen.fullscreenbuttoncontainer.bytecode.patch
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.shared.annotation.YouTubeCompatibility
import app.revanced.shared.extensions.findMutableMethodOf
import app.revanced.shared.extensions.injectHideCall
import app.revanced.shared.patches.mapping.ResourceMappingPatch
import org.jf.dexlib2.iface.instruction.formats.Instruction21c
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
import org.jf.dexlib2.Opcode
@Name("hide-fullscreen-buttoncontainer-bytecode-patch")
@DependsOn([ResourceMappingPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class FullscreenButtonContainerBytecodePatch : BytecodePatch() {
private val resourceIds = arrayOf(
"quick_actions_element_container"
).map { name ->
ResourceMappingPatch.resourceMappings.single { it.name == name }.id
}
override fun execute(context: BytecodeContext): PatchResult {
context.classes.forEach { classDef ->
classDef.methods.forEach { method ->
with(method.implementation) {
this?.instructions?.forEachIndexed { index, instruction ->
when (instruction.opcode) {
Opcode.CONST -> {
when ((instruction as Instruction31i).wideLiteral) {
resourceIds[0] -> { // fullscreen panel
val insertIndex = index + 3
val invokeInstruction = instructions.elementAt(insertIndex)
if (invokeInstruction.opcode != Opcode.CHECK_CAST) return@forEachIndexed
val mutableMethod = context.proxy(classDef).mutableClass.findMutableMethodOf(method)
val viewRegister = (invokeInstruction as Instruction21c).registerA
mutableMethod.implementation!!.injectHideCall(insertIndex, viewRegister, "layout/FullscreenLayoutPatch", "hideFullscreenButtonContainer")
}
}
}
else -> return@forEachIndexed
}
}
}
}
}
return PatchResultSuccess()
}
}

View File

@ -0,0 +1,49 @@
package app.revanced.patches.youtube.layout.fullscreen.fullscreenbuttoncontainer.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.layout.fullscreen.fullscreenbuttoncontainer.bytecode.patch.FullscreenButtonContainerBytecodePatch
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("hide-fullscreen-buttoncontainer")
@Description("Hides the button containers in fullscreen.")
@DependsOn(
[
FullscreenButtonContainerBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class FullscreenButtonContainerPatch : 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_BUTTON_CONTAINER"
)
ResourceHelper.patchSuccess(
context,
"hide-fullscreen-buttoncontainer"
)
return PatchResultSuccess()
}
}

View File

@ -0,0 +1,7 @@
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.bytecode.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object MarkerHapticsFingerprint : MethodFingerprint(
strings = listOf("Failed to execute markers haptics vibrate.")
)

View File

@ -0,0 +1,7 @@
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.bytecode.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object ScrubbingHapticsFingerprint : MethodFingerprint(
strings = listOf("Failed to haptics vibrate for fine scrubbing.")
)

View File

@ -0,0 +1,14 @@
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.bytecode.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode
object SeekHapticsFingerprint : MethodFingerprint(
opcodes = listOf(
Opcode.CHECK_CAST,
Opcode.CHECK_CAST,
Opcode.INVOKE_VIRTUAL,
Opcode.RETURN_VOID
),
strings = listOf("Failed to easy seek haptics vibrate.")
)

View File

@ -0,0 +1,7 @@
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.bytecode.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object ZoomHapticsFingerprint : MethodFingerprint(
strings = listOf("Failed to haptics vibrate for video zoom")
)

View File

@ -0,0 +1,88 @@
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.bytecode.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
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.removeInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.bytecode.fingerprints.*
import app.revanced.shared.annotation.YouTubeCompatibility
import app.revanced.shared.util.integrations.Constants.FULLSCREEN_LAYOUT
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Name("disable-haptic-feedback-bytecode-patch")
@YouTubeCompatibility
@Version("0.0.1")
class HapticFeedBackBytecodePatch : BytecodePatch(
listOf(
MarkerHapticsFingerprint,
SeekHapticsFingerprint,
ScrubbingHapticsFingerprint,
ZoomHapticsFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
SeekHapticsFingerprint.disableHaptics("disableSeekVibrate")
ScrubbingHapticsFingerprint.voidHaptics("disableScrubbingVibrate")
MarkerHapticsFingerprint.voidHaptics("disableChapterVibrate")
ZoomHapticsFingerprint.voidHaptics("disableZoomVibrate")
return PatchResultSuccess()
}
private companion object {
fun MethodFingerprint.disableHaptics(targetMethodName: String) {
with(this.result!!) {
val startIndex = scanResult.patternScanResult!!.startIndex
val endIndex = scanResult.patternScanResult!!.endIndex
val insertIndex = endIndex + 4
val targetRegister = (method.implementation!!.instructions.elementAt(insertIndex) as OneRegisterInstruction).registerA
val dummyRegister = targetRegister + 1
mutableMethod.removeInstruction(insertIndex)
mutableMethod.addInstructions(
insertIndex, """
invoke-static {}, $FULLSCREEN_LAYOUT->$targetMethodName()Z
move-result v$dummyRegister
if-eqz v$dummyRegister, :vibrate
const-wide/16 v$targetRegister, 0x0
goto :exit
:vibrate
const-wide/16 v$targetRegister, 0x19
""", listOf(ExternalLabel("exit", mutableMethod.instruction(insertIndex)))
)
mutableMethod.addInstructions(
startIndex, """
invoke-static {}, $FULLSCREEN_LAYOUT->$targetMethodName()Z
move-result v$dummyRegister
if-eqz v$dummyRegister, :vibrate
return-void
""", listOf(ExternalLabel("vibrate", mutableMethod.instruction(startIndex)))
)
}
}
fun MethodFingerprint.voidHaptics(targetMethodName: String) {
with(this.result!!) {
mutableMethod.addInstructions(
0, """
invoke-static {}, $FULLSCREEN_LAYOUT->$targetMethodName()Z
move-result v0
if-eqz v0, :vibrate
return-void
""", listOf(ExternalLabel("vibrate", mutableMethod.instruction(0)))
)
}
}
}
}

View File

@ -0,0 +1,49 @@
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.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.layout.fullscreen.hapticfeedback.bytecode.patch.HapticFeedBackBytecodePatch
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-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()
}
}