mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 13:17:46 +02:00
cleanup
This commit is contained in:
@ -1,11 +1,17 @@
|
||||
package app.revanced.patches.youtube.layout.player.watermark.bytecode.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@FuzzyPatternScanMethod(3)
|
||||
object HideWatermarkFingerprint : MethodFingerprint (
|
||||
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L", "L"), null ,null, null
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L", "L"),
|
||||
opcodes = listOf(
|
||||
Opcode.IF_EQZ,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.IGET_BOOLEAN
|
||||
)
|
||||
)
|
@ -1,11 +1,11 @@
|
||||
package app.revanced.patches.youtube.layout.player.watermark.bytecode.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
|
||||
@FuzzyPatternScanMethod(3)
|
||||
object HideWatermarkParentFingerprint : MethodFingerprint (
|
||||
"L", AccessFlags.PUBLIC or AccessFlags.FINAL, null, null, listOf("player_overlay_in_video_programming"), null
|
||||
returnType = "L",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
strings = listOf("player_overlay_in_video_programming")
|
||||
)
|
||||
|
@ -4,16 +4,18 @@ 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.Companion.resolve
|
||||
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.patches.youtube.layout.player.watermark.bytecode.fingerprints.HideWatermarkFingerprint
|
||||
import app.revanced.patches.youtube.layout.player.watermark.bytecode.fingerprints.HideWatermarkParentFingerprint
|
||||
import app.revanced.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.shared.extensions.toErrorResult
|
||||
import app.revanced.shared.util.integrations.Constants.PLAYER_LAYOUT
|
||||
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
@Name("hide-channel-watermark-bytecode-patch")
|
||||
@YouTubeCompatibility
|
||||
@ -24,20 +26,23 @@ class HideChannelWatermarkBytecodePatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
HideWatermarkFingerprint.resolve(context, HideWatermarkParentFingerprint.result!!.classDef)
|
||||
val result = HideWatermarkFingerprint.result
|
||||
?: return PatchResultError("Required parent method could not be found.")
|
||||
|
||||
val method = result.mutableMethod
|
||||
val line = method.implementation!!.instructions.size - 5
|
||||
HideWatermarkParentFingerprint.result?.let { parentResult ->
|
||||
HideWatermarkFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
|
||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
|
||||
method.removeInstruction(line)
|
||||
method.addInstructions(
|
||||
line, """
|
||||
invoke-static {}, $PLAYER_LAYOUT->hideChannelWatermark()Z
|
||||
move-result p2
|
||||
"""
|
||||
)
|
||||
with (it.mutableMethod) {
|
||||
val register = (instruction(insertIndex) as TwoRegisterInstruction).registerA
|
||||
removeInstruction(insertIndex)
|
||||
addInstructions(
|
||||
insertIndex, """
|
||||
invoke-static {}, $PLAYER_LAYOUT->hideChannelWatermark()Z
|
||||
move-result v$register
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return HideWatermarkFingerprint.toErrorResult()
|
||||
} ?: return HideWatermarkParentFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
Reference in New Issue
Block a user