feat(YouTube): remove Hide player overlay filter patch

This commit is contained in:
inotia00
2023-10-21 05:19:49 +09:00
parent 96fd06f114
commit b24b1c3474
3 changed files with 0 additions and 91 deletions

View File

@ -1,84 +0,0 @@
package app.revanced.patches.youtube.player.playeroverlayfilter
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.youtube.utils.fingerprints.YouTubeControlsOverlayFingerprint
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ScrimOverlay
import app.revanced.patches.youtube.utils.settings.SettingsPatch
import app.revanced.util.bytecode.getWideLiteralIndex
import app.revanced.util.integrations.Constants.PLAYER
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
@Patch(
name = "Hide player overlay filter",
description = "Hides the dark filter layer from the player's background.",
dependencies = [
SettingsPatch::class,
SharedResourceIdPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.youtube",
[
"18.24.37",
"18.25.40",
"18.27.36",
"18.29.38",
"18.30.37",
"18.31.40",
"18.32.39",
"18.33.40",
"18.34.38",
"18.35.36",
"18.36.39",
"18.37.36",
"18.38.44",
"18.39.41"
]
)
]
)
@Suppress("unused")
object PlayerOverlayFilterPatch : BytecodePatch(
setOf(YouTubeControlsOverlayFingerprint)
) {
override fun execute(context: BytecodeContext) {
YouTubeControlsOverlayFingerprint.result?.let {
it.mutableMethod.apply {
val targetIndex = getWideLiteralIndex(ScrimOverlay) + 3
val targetParameter = getInstruction<ReferenceInstruction>(targetIndex).reference
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
if (!targetParameter.toString().endsWith("Landroid/widget/ImageView;"))
throw PatchException("Method signature parameter did not match: $targetParameter")
addInstruction(
targetIndex + 1,
"invoke-static {v$targetRegister}, $PLAYER->hidePlayerOverlayFilter(Landroid/widget/ImageView;)V"
)
}
} ?: throw YouTubeControlsOverlayFingerprint.exception
/**
* Add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: PLAYER_SETTINGS",
"SETTINGS: HIDE_PLAYER_OVERLAY_FILTER"
)
)
SettingsPatch.updatePatchStatus("Hide player overlay filter")
}
}