Skip to content

Commit

Permalink
feat: Merge RVX v4.10.2-dev.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesco146 authored Jul 14, 2024
2 parents cec5a66 + 55194c6 commit eb5f944
Show file tree
Hide file tree
Showing 291 changed files with 3,914 additions and 2,054 deletions.
34 changes: 27 additions & 7 deletions api/revanced-patches.api
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,17 @@ public final class app/revanced/patches/music/layout/playeroverlay/PlayerOverlay
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
}

public final class app/revanced/patches/music/misc/alternativedomain/AlternativeDomainBytecodePatch : app/revanced/patches/shared/alternativedomain/BaseAlternativeDomainPatch {
public static final field INSTANCE Lapp/revanced/patches/music/misc/alternativedomain/AlternativeDomainBytecodePatch;
}

public final class app/revanced/patches/music/misc/alternativedomain/AlternativeDomainPatch : app/revanced/util/patch/BaseBytecodePatch, java/io/Closeable {
public static final field INSTANCE Lapp/revanced/patches/music/misc/alternativedomain/AlternativeDomainPatch;
public fun close ()V
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}

public final class app/revanced/patches/music/misc/backgroundplayback/BackgroundPlaybackPatch : app/revanced/util/patch/BaseBytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/music/misc/backgroundplayback/BackgroundPlaybackPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
Expand Down Expand Up @@ -668,6 +679,12 @@ public abstract class app/revanced/patches/shared/ads/BaseAdsPatch : app/revance
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}

public abstract class app/revanced/patches/shared/alternativedomain/BaseAlternativeDomainPatch : app/revanced/patcher/patch/BytecodePatch {
public fun <init> (Ljava/lang/String;)V
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}

public abstract class app/revanced/patches/shared/captions/BaseAutoCaptionsPatch : app/revanced/patcher/patch/BytecodePatch {
public fun <init> (Ljava/lang/String;)V
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
Expand Down Expand Up @@ -896,6 +913,10 @@ public final class app/revanced/patches/youtube/ads/general/VideoAdsPatch : app/
public static final field INSTANCE Lapp/revanced/patches/youtube/ads/general/VideoAdsPatch;
}

public final class app/revanced/patches/youtube/alternativethumbnails/general/AlternativeDomainBytecodePatch : app/revanced/patches/shared/alternativedomain/BaseAlternativeDomainPatch {
public static final field INSTANCE Lapp/revanced/patches/youtube/alternativethumbnails/general/AlternativeDomainBytecodePatch;
}

public final class app/revanced/patches/youtube/alternativethumbnails/general/AlternativeThumbnailsPatch : app/revanced/util/patch/BaseBytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/youtube/alternativethumbnails/general/AlternativeThumbnailsPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
Expand Down Expand Up @@ -1071,6 +1092,12 @@ public final class app/revanced/patches/youtube/layout/theme/ThemePatch : app/re
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
}

public final class app/revanced/patches/youtube/layout/visual/VisualPreferencesIconsPatch : app/revanced/util/patch/BaseResourcePatch {
public static final field INSTANCE Lapp/revanced/patches/youtube/layout/visual/VisualPreferencesIconsPatch;
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
}

public final class app/revanced/patches/youtube/misc/backgroundplayback/BackgroundPlaybackPatch : app/revanced/util/patch/BaseBytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/backgroundplayback/BackgroundPlaybackPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
Expand Down Expand Up @@ -1447,7 +1474,6 @@ public final class app/revanced/patches/youtube/utils/recyclerview/BottomSheetRe
public static final field INSTANCE Lapp/revanced/patches/youtube/utils/recyclerview/BottomSheetRecyclerViewPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
public final fun injectCall (Ljava/lang/String;)V
}

public final class app/revanced/patches/youtube/utils/resourceid/SharedResourceIdPatch : app/revanced/patcher/patch/ResourcePatch {
Expand Down Expand Up @@ -1699,12 +1725,6 @@ public final class app/revanced/patches/youtube/utils/settings/SettingsPatch : a
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
}

public final class app/revanced/patches/youtube/utils/settings/VisualPreferencesIconsPatch : app/revanced/util/patch/BaseResourcePatch {
public static final field INSTANCE Lapp/revanced/patches/youtube/utils/settings/VisualPreferencesIconsPatch;
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
}

public final class app/revanced/patches/youtube/utils/sponsorblock/SponsorBlockBytecodePatch : app/revanced/patcher/patch/BytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/youtube/utils/sponsorblock/SponsorBlockBytecodePatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package app.revanced.patches.music.misc.alternativedomain

import app.revanced.patches.shared.alternativedomain.BaseAlternativeDomainPatch
import app.revanced.patches.music.utils.integrations.Constants.MISC_PATH

object AlternativeDomainBytecodePatch : BaseAlternativeDomainPatch("$MISC_PATH/AlternativeDomainPatch;")
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package app.revanced.patches.music.misc.alternativedomain

import app.revanced.patcher.data.BytecodeContext
import app.revanced.patches.music.utils.compatibility.Constants.COMPATIBLE_PACKAGE
import app.revanced.patches.music.utils.settings.CategoryType
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.patch.BaseBytecodePatch
import java.io.Closeable

@Suppress("unused")
object AlternativeDomainPatch : BaseBytecodePatch(
name = "Alternative domain",
description = "Adds options to replace static images(avatars, playlist covers, etc.) domain.",
dependencies = setOf(
AlternativeDomainBytecodePatch::class,
SettingsPatch::class
),
compatiblePackages = COMPATIBLE_PACKAGE
), Closeable {
override fun execute(context: BytecodeContext) {
}
// Use Closeable for lexicographic arrangement of settings.
override fun close() {
SettingsPatch.addSwitchPreference(
CategoryType.MISC,
"revanced_use_alternative_domain",
"false"
)
SettingsPatch.addPreferenceWithIntent(
CategoryType.MISC,
"revanced_alternative_domain",
"revanced_use_alternative_domain"
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object Constants {
"6.42.55", // This is the latest version that supports Android 7.0
"6.51.53", // This is the latest version of YouTube Music 6.xx.xx
"7.07.52", // This was the latest version that was supported by the previous patch.
"7.08.52", // This is the latest version supported by the RVX patch.
"7.08.53", // This is the latest version supported by the RVX patch.
)
)
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package app.revanced.patches.shared.alternativedomain

import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patches.shared.alternativedomain.fingerprints.MessageDigestImageUrlFingerprint
import app.revanced.patches.shared.alternativedomain.fingerprints.MessageDigestImageUrlParentFingerprint
import app.revanced.util.resultOrThrow

abstract class BaseAlternativeDomainPatch(
private val classDescriptor: String
) : BytecodePatch(
setOf(MessageDigestImageUrlParentFingerprint)
) {
override fun execute(context: BytecodeContext) {

MessageDigestImageUrlFingerprint.resolve(
context,
MessageDigestImageUrlParentFingerprint.resultOrThrow().classDef
)

MessageDigestImageUrlFingerprint.resultOrThrow().mutableMethod.addInstructions(
0, """
invoke-static { p1 }, $classDescriptor->overrideImageURL(Ljava/lang/String;)Ljava/lang/String;
move-result-object p1
"""
)

}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.youtube.alternativethumbnails.general.fingerprints
package app.revanced.patches.shared.alternativedomain.fingerprints

import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.MethodFingerprint
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.youtube.alternativethumbnails.general.fingerprints
package app.revanced.patches.shared.alternativedomain.fingerprints

import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.MethodFingerprint
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package app.revanced.patches.youtube.alternativethumbnails.general

import app.revanced.patches.shared.alternativedomain.BaseAlternativeDomainPatch
import app.revanced.patches.youtube.utils.integrations.Constants.ALTERNATIVE_THUMBNAILS_CLASS_DESCRIPTOR

object AlternativeDomainBytecodePatch : BaseAlternativeDomainPatch(ALTERNATIVE_THUMBNAILS_CLASS_DESCRIPTOR)
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
import app.revanced.patcher.fingerprint.MethodFingerprint
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
import app.revanced.patches.youtube.alternativethumbnails.general.fingerprints.MessageDigestImageUrlFingerprint
import app.revanced.patches.youtube.alternativethumbnails.general.fingerprints.MessageDigestImageUrlParentFingerprint
import app.revanced.patches.youtube.alternativethumbnails.general.fingerprints.cronet.RequestFingerprint
import app.revanced.patches.youtube.alternativethumbnails.general.fingerprints.cronet.request.callback.OnFailureFingerprint
import app.revanced.patches.youtube.alternativethumbnails.general.fingerprints.cronet.request.callback.OnResponseStartedFingerprint
Expand All @@ -32,41 +30,23 @@ object AlternativeThumbnailsPatch : BaseBytecodePatch(
name = "Alternative thumbnails",
description = "Adds options to replace video thumbnails using the DeArrow API or image captures from the video.",
dependencies = setOf(
AlternativeDomainBytecodePatch::class,
NavigationBarHookPatch::class,
PlayerTypeHookPatch::class,
SettingsPatch::class,
),
compatiblePackages = COMPATIBLE_PACKAGE,
fingerprints = setOf(
MessageDigestImageUrlParentFingerprint,
OnResponseStartedFingerprint,
RequestFingerprint,
)
) {
private lateinit var loadImageUrlMethod: MutableMethod
private var loadImageUrlIndex = 0

private lateinit var loadImageSuccessCallbackMethod: MutableMethod
private var loadImageSuccessCallbackIndex = 0

private lateinit var loadImageErrorCallbackMethod: MutableMethod
private var loadImageErrorCallbackIndex = 0

/**
* @param highPriority If the hook should be called before all other hooks.
*/
@Suppress("SameParameterValue")
private fun addImageUrlHook(targetMethodClass: String, highPriority: Boolean) {
loadImageUrlMethod.addInstructions(
if (highPriority) 0 else loadImageUrlIndex,
"""
invoke-static { p1 }, $targetMethodClass->overrideImageURL(Ljava/lang/String;)Ljava/lang/String;
move-result-object p1
"""
)
loadImageUrlIndex += 2
}

/**
* If a connection completed, which includes normal 200 responses but also includes
* status 404 and other error like http responses.
Expand Down Expand Up @@ -102,13 +82,6 @@ object AlternativeThumbnailsPatch : BaseBytecodePatch(
block: (MutableMethod) -> Unit
) = alsoResolve(fingerprint).also { block(it.mutableMethod) }

MessageDigestImageUrlFingerprint.resolveAndLetMutableMethod(
MessageDigestImageUrlParentFingerprint
) {
loadImageUrlMethod = it
addImageUrlHook(ALTERNATIVE_THUMBNAILS_CLASS_DESCRIPTOR, true)
}

OnSucceededFingerprint.resolveAndLetMutableMethod(OnResponseStartedFingerprint) {
loadImageSuccessCallbackMethod = it
addImageUrlSuccessCallbackHook(ALTERNATIVE_THUMBNAILS_CLASS_DESCRIPTOR)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ object AutoCaptionsPatch : BaseBytecodePatch(
) {
override fun execute(context: BytecodeContext) {

VideoInformationPatch.hookBackgroundPlay("$GENERAL_CLASS_DESCRIPTOR->newVideoStarted(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;JZ)V")
VideoInformationPatch.hook("$GENERAL_CLASS_DESCRIPTOR->newVideoStarted(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;JZ)V")

/**
* Add settings
Expand Down
Loading

0 comments on commit eb5f944

Please sign in to comment.