mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-05-11 12:04:32 +02:00
fix: some more refactoring of integrations, add hide-watermark patch (#63)
* refactor: integrations * add HideWatermark patch * add hidewatermark patch * fix bug * use latest patcher version * Fix sig name * update to fingerprints * make cleaner patch * add 17.24.35 support for hide-watermark
This commit is contained in:
parent
a7ee89d497
commit
feb09c56f4
@ -38,6 +38,7 @@ class ShortsButtonRemoverPatch : BytecodePatch(
|
|||||||
val moveViewInstruction = buttonsViewImplementation.instructions[buttonsViewResult.patternScanResult!!.endIndex]
|
val moveViewInstruction = buttonsViewImplementation.instructions[buttonsViewResult.patternScanResult!!.endIndex]
|
||||||
val viewRegister = (moveViewInstruction as OneRegisterInstruction).registerA
|
val viewRegister = (moveViewInstruction as OneRegisterInstruction).registerA
|
||||||
|
|
||||||
|
|
||||||
// Save the tab enum in XGlobals to avoid smali/register workarounds
|
// Save the tab enum in XGlobals to avoid smali/register workarounds
|
||||||
tabEnumResult.mutableMethod.addInstruction(
|
tabEnumResult.mutableMethod.addInstruction(
|
||||||
tabEnumResult.patternScanResult!!.endIndex + 1,
|
tabEnumResult.patternScanResult!!.endIndex + 1,
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.watermark.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility(
|
||||||
|
[Package(
|
||||||
|
"com.google.android.youtube", arrayOf("17.24.34", "17.24.35")
|
||||||
|
)]
|
||||||
|
)
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class HideWatermarkCompatibility
|
@ -0,0 +1,21 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.watermark.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
||||||
|
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.watermark.annotations.HideWatermarkCompatibility
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
@Name("hide-watermark-signature")
|
||||||
|
@MatchingMethod(
|
||||||
|
"Ljvy;", "<init>"
|
||||||
|
)
|
||||||
|
@FuzzyPatternScanMethod(3)
|
||||||
|
@HideWatermarkCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object HideWatermarkFingerprint : MethodFingerprint (
|
||||||
|
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L", "L"), null ,null, null
|
||||||
|
)
|
@ -0,0 +1,21 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.watermark.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
||||||
|
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.watermark.annotations.HideWatermarkCompatibility
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
@Name("hide-watermark-parent-signature")
|
||||||
|
@MatchingMethod(
|
||||||
|
"Ljvy;", "<init>"
|
||||||
|
)
|
||||||
|
@FuzzyPatternScanMethod(3)
|
||||||
|
@HideWatermarkCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object HideWatermarkParentFingerprint : MethodFingerprint (
|
||||||
|
"L", AccessFlags.PUBLIC or AccessFlags.FINAL, null, null, listOf("player_overlay_in_video_programming"), null
|
||||||
|
)
|
@ -0,0 +1,51 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.watermark.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.impl.BytecodeData
|
||||||
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.removeInstruction
|
||||||
|
import app.revanced.patcher.extensions.removeInstructions
|
||||||
|
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultError
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.Dependencies
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||||
|
import app.revanced.patches.youtube.layout.watermark.annotations.HideWatermarkCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.watermark.fingerprints.HideWatermarkParentFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.watermark.fingerprints.HideWatermarkFingerprint
|
||||||
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Dependencies(dependencies = [IntegrationsPatch::class])
|
||||||
|
@Name("hide-watermark")
|
||||||
|
@Description("Hide Watermark on the page.")
|
||||||
|
@HideWatermarkCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class HideWatermarkPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
HideWatermarkParentFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
|
HideWatermarkFingerprint.resolve(data, 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
|
||||||
|
|
||||||
|
method.removeInstruction(line)
|
||||||
|
method.addInstructions(
|
||||||
|
line, """
|
||||||
|
invoke-static {}, Lapp/revanced/integrations/patches/BrandingWaterMarkPatch;->isBrandingWatermarkShown()Z
|
||||||
|
move-result p2
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
@ -28,7 +28,7 @@ class IntegrationsPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(data: BytecodeData): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
if (data.findClass("Lapp/revanced/integrations/utils/Globals") == null)
|
if (data.findClass("Lapp/revanced/integrations/utils/ReVancedUtils") == null)
|
||||||
return PatchResultError("Integrations have not been merged yet. This patch can not succeed without the integrations.")
|
return PatchResultError("Integrations have not been merged yet. This patch can not succeed without the integrations.")
|
||||||
|
|
||||||
val result = InitFingerprint.result!!
|
val result = InitFingerprint.result!!
|
||||||
@ -40,7 +40,7 @@ class IntegrationsPatch : BytecodePatch(
|
|||||||
method.addInstructions(
|
method.addInstructions(
|
||||||
0, """
|
0, """
|
||||||
invoke-static {v$count}, Lapp/revanced/integrations/sponsorblock/StringRef;->setContext(Landroid/content/Context;)V
|
invoke-static {v$count}, Lapp/revanced/integrations/sponsorblock/StringRef;->setContext(Landroid/content/Context;)V
|
||||||
sput-object v$count, Lapp/revanced/integrations/utils/Globals;->context:Landroid/content/Context;
|
sput-object v$count, Lapp/revanced/integrations/utils/ReVancedUtils;->context:Landroid/content/Context;
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ class IntegrationsPatch : BytecodePatch(
|
|||||||
null,
|
null,
|
||||||
ImmutableMethodImplementation(
|
ImmutableMethodImplementation(
|
||||||
1, """
|
1, """
|
||||||
invoke-static { }, Lapp/revanced/integrations/utils/Globals;->getAppContext()Landroid/content/Context;
|
invoke-static { }, Lapp/revanced/integrations/utils/ReVancedUtils;->getAppContext()Landroid/content/Context;
|
||||||
move-result-object v0
|
move-result-object v0
|
||||||
return-object v0
|
return-object v0
|
||||||
""".toInstructions(), null, null
|
""".toInstructions(), null, null
|
||||||
|
Loading…
x
Reference in New Issue
Block a user