mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-12-07 01:51:27 +01:00
Compare commits
8 Commits
256f98f5f6
...
e87666a228
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e87666a228 | ||
|
|
86eaba8248 | ||
|
|
945ce7490a | ||
|
|
b824d35960 | ||
|
|
dcc8d560b2 | ||
|
|
69465f3a99 | ||
|
|
6f14542c18 | ||
|
|
81bef57742 |
28
CHANGELOG.md
28
CHANGELOG.md
@@ -1,3 +1,31 @@
|
||||
## [2.36.2](https://github.com/revanced/revanced-patches/compare/v2.36.1...v2.36.2) (2022-08-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* disable cast modules in YouTube Music ([#337](https://github.com/revanced/revanced-patches/issues/337)) ([86eaba8](https://github.com/revanced/revanced-patches/commit/86eaba8248100987f46540a224956099bcf9da2c))
|
||||
|
||||
## [2.36.1](https://github.com/revanced/revanced-patches/compare/v2.36.0...v2.36.1) (2022-08-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add missing switch for tablet mini-player ([b824d35](https://github.com/revanced/revanced-patches/commit/b824d35960df9e99c2a2d248356c3c9342cfe130))
|
||||
|
||||
# [2.36.0](https://github.com/revanced/revanced-patches/compare/v2.35.0...v2.36.0) (2022-08-14)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* `swipe-controls` override volume button behaviour ([#285](https://github.com/revanced/revanced-patches/issues/285)) ([69465f3](https://github.com/revanced/revanced-patches/commit/69465f3a9934973a2449605a248a462510e10ff6))
|
||||
|
||||
# [2.35.0](https://github.com/revanced/revanced-patches/compare/v2.34.0...v2.35.0) (2022-08-14)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* `tiktok-ads` patch ([#335](https://github.com/revanced/revanced-patches/issues/335)) ([81bef57](https://github.com/revanced/revanced-patches/commit/81bef57742bfaefcdfe02fd290cca6923341149a))
|
||||
|
||||
# [2.34.0](https://github.com/revanced/revanced-patches/compare/v2.33.2...v2.34.0) (2022-08-14)
|
||||
|
||||
|
||||
|
||||
@@ -45,6 +45,14 @@ Official patches by ReVanced
|
||||
| `promo-code-unlock` | Disables the validation of promo code. Any code will work to unlock all features. | all |
|
||||
</details>
|
||||
|
||||
### 📦 `com.ss.android.ugc.trill`
|
||||
<details>
|
||||
|
||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||
|:--------:|:--------------:|:-----------------:|
|
||||
| `tiktok-ads` | Removes ads from TikTok. | all |
|
||||
</details>
|
||||
|
||||
### 📦 `com.google.android.youtube`
|
||||
<details>
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
kotlin.code.style = official
|
||||
version = 2.34.0
|
||||
version = 2.36.2
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package app.revanced.extensions
|
||||
|
||||
import app.revanced.patcher.data.impl.BytecodeData
|
||||
import app.revanced.patcher.data.impl.ResourceData
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.util.smali.toInstruction
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
@@ -27,6 +29,30 @@ internal fun MutableMethodImplementation.injectHideCall(
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* traverse the class hierarchy starting from the given root class
|
||||
*
|
||||
* @param targetClass the class to start traversing the class hierarchy from
|
||||
* @param callback function that is called for every class in the hierarchy
|
||||
*/
|
||||
fun BytecodeData.traverseClassHierarchy(targetClass: MutableClass, callback: MutableClass.() -> Unit) {
|
||||
callback(targetClass)
|
||||
this.findClass(targetClass.superclass ?: return)?.resolve()?.let {
|
||||
traverseClassHierarchy(it, callback)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* apply a transform to all methods of the class
|
||||
*
|
||||
* @param transform the transformation function. original method goes in, transformed method goes out
|
||||
*/
|
||||
fun MutableClass.transformMethods(transform: MutableMethod.() -> MutableMethod) {
|
||||
val transformedMethods = methods.map { it.transform() }
|
||||
methods.clear()
|
||||
methods.addAll(transformedMethods)
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert an event hook at the top of the method. If the hook returns true, the event is consumed and the method will return with true
|
||||
*
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package app.revanced.patches.music.misc.microg.fingerprints
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
|
||||
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
|
||||
|
||||
@Name("cast-context-fetch-fingerprint")
|
||||
@MatchingMethod(
|
||||
"Lvvz;", "a"
|
||||
)
|
||||
@DirectPatternScanMethod
|
||||
@MicroGPatchCompatibility
|
||||
@Version("0.0.1")
|
||||
object CastContextFetchFingerprint : MethodFingerprint(
|
||||
null, null, null, null,
|
||||
listOf("Error fetching CastContext.")
|
||||
)
|
||||
@@ -0,0 +1,20 @@
|
||||
package app.revanced.patches.music.misc.microg.fingerprints
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
|
||||
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
|
||||
|
||||
@Name("cast-module-fingerprint")
|
||||
@MatchingMethod(
|
||||
"Llqh;", "c"
|
||||
)
|
||||
@DirectPatternScanMethod
|
||||
@MicroGPatchCompatibility
|
||||
@Version("0.0.1")
|
||||
object CastDynamiteModuleFingerprint : MethodFingerprint(
|
||||
null, null, null, null,
|
||||
listOf("com.google.android.gms.cast.framework.internal.CastDynamiteModuleImpl")
|
||||
)
|
||||
@@ -0,0 +1,20 @@
|
||||
package app.revanced.patches.music.misc.microg.fingerprints
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
|
||||
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
|
||||
|
||||
@Name("cast-context-fetch-fingerprint")
|
||||
@MatchingMethod(
|
||||
"Lmcf;", "c"
|
||||
)
|
||||
@DirectPatternScanMethod
|
||||
@MicroGPatchCompatibility
|
||||
@Version("0.0.1")
|
||||
object CastDynamiteModuleV2Fingerprint : MethodFingerprint(
|
||||
null, null, null, null,
|
||||
listOf("Failed to load module via V2: ")
|
||||
)
|
||||
@@ -36,6 +36,9 @@ class MusicMicroGBytecodePatch : BytecodePatch(
|
||||
listOf(
|
||||
ServiceCheckFingerprint,
|
||||
GooglePlayUtilityFingerprint,
|
||||
CastDynamiteModuleFingerprint,
|
||||
CastDynamiteModuleV2Fingerprint,
|
||||
CastContextFetchFingerprint,
|
||||
PrimeFingerprint,
|
||||
)
|
||||
) {
|
||||
@@ -122,9 +125,17 @@ class MusicMicroGBytecodePatch : BytecodePatch(
|
||||
listOf(
|
||||
ServiceCheckFingerprint,
|
||||
GooglePlayUtilityFingerprint,
|
||||
CastDynamiteModuleFingerprint,
|
||||
CastDynamiteModuleV2Fingerprint,
|
||||
CastContextFetchFingerprint,
|
||||
).forEach { fingerprint ->
|
||||
val result = fingerprint.result!!
|
||||
val stringInstructions = when (result.method.returnType.first()) {
|
||||
'L' -> """
|
||||
const/4 v0, 0x0
|
||||
return-object v0
|
||||
"""
|
||||
|
||||
'V' -> "return-void"
|
||||
'I' -> """
|
||||
const/4 v0, 0x0
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package app.revanced.patches.tiktok.ad.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[
|
||||
Package("com.ss.android.ugc.trill", arrayOf()),
|
||||
Package("com.zhiliaoapp.musically", arrayOf())
|
||||
]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
internal annotation class TiktokAdsCompatibility
|
||||
@@ -0,0 +1,20 @@
|
||||
package app.revanced.patches.tiktok.ad.fingerprints
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.tiktok.ad.annotations.TiktokAdsCompatibility
|
||||
|
||||
@Name("feed-item-clone-fingerprint")
|
||||
@MatchingMethod(
|
||||
"Lcom/ss/android/ugc/aweme/feed/model/FeedItemList;",
|
||||
"clone",
|
||||
)
|
||||
@TiktokAdsCompatibility
|
||||
@Version("0.0.1")
|
||||
object FeedItemListCloneFingerprint : MethodFingerprint(
|
||||
null, null, null, null,null, { methodDef ->
|
||||
methodDef.definingClass.endsWith("/FeedItemList;") && methodDef.name == "clone"
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,48 @@
|
||||
package app.revanced.patches.tiktok.ad.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.addInstruction
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||
import app.revanced.patches.tiktok.ad.annotations.TiktokAdsCompatibility
|
||||
import app.revanced.patches.tiktok.ad.fingerprints.FeedItemListCloneFingerprint
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
import org.jf.dexlib2.iface.reference.FieldReference
|
||||
|
||||
@Patch
|
||||
@Name("tiktok-ads")
|
||||
@Description("Removes ads from TikTok.")
|
||||
@TiktokAdsCompatibility
|
||||
@Version("0.0.1")
|
||||
class TiktokAdsPatch : BytecodePatch(
|
||||
listOf(FeedItemListCloneFingerprint)
|
||||
) {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
val method = FeedItemListCloneFingerprint.result!!.mutableMethod
|
||||
// iterate all instructions in the clone method
|
||||
for ((index, instruction) in method.implementation!!.instructions.withIndex()) {
|
||||
// conditions for the instruction we need
|
||||
if (instruction.opcode.ordinal != Opcode.IPUT_OBJECT.ordinal) continue
|
||||
val clonePreloadAdsFieldInstruction = (instruction as? ReferenceInstruction)
|
||||
if ((clonePreloadAdsFieldInstruction?.reference as? FieldReference)?.name != "preloadAds") continue
|
||||
|
||||
// set null instead of the field "preloadAds"
|
||||
val overrideRegister = (clonePreloadAdsFieldInstruction as TwoRegisterInstruction).registerA
|
||||
method.addInstruction(
|
||||
index,
|
||||
"const/4 v$overrideRegister, 0x0"
|
||||
)
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
return PatchResultError("Could not find required instruction.")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package app.revanced.patches.youtube.interaction.swipecontrols.fingerprints
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
|
||||
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.interaction.swipecontrols.annotation.SwipeControlsCompatibility
|
||||
|
||||
@Name("swipe-controls-host-activity-fingerprint")
|
||||
@MatchingMethod(
|
||||
"Lapp/revanced/integrations/swipecontrols/SwipeControlsHostActivity;", "<init>"
|
||||
)
|
||||
@DirectPatternScanMethod
|
||||
@SwipeControlsCompatibility
|
||||
@Version("0.0.1")
|
||||
object SwipeControlsHostActivityFingerprint : MethodFingerprint(
|
||||
null, null, null, null, null, { methodDef ->
|
||||
methodDef.definingClass == "Lapp/revanced/integrations/swipecontrols/SwipeControlsHostActivity;" && methodDef.name == "<init>"
|
||||
}
|
||||
)
|
||||
@@ -7,15 +7,15 @@ import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.interaction.swipecontrols.annotation.SwipeControlsCompatibility
|
||||
|
||||
@Name("watch-while-onStart-fingerprint")
|
||||
@Name("watch-while-activity-fingerprint")
|
||||
@MatchingMethod(
|
||||
"LWatchWhileActivity;", "onCreate"
|
||||
"LWatchWhileActivity;", "<init>"
|
||||
)
|
||||
@DirectPatternScanMethod
|
||||
@SwipeControlsCompatibility
|
||||
@Version("0.0.1")
|
||||
object WatchWhileOnStartFingerprint : MethodFingerprint(
|
||||
object WatchWhileActivityFingerprint : MethodFingerprint(
|
||||
null, null, null, null, null, { methodDef ->
|
||||
methodDef.definingClass.endsWith("WatchWhileActivity;") && methodDef.name == "onStart"
|
||||
methodDef.definingClass.endsWith("WatchWhileActivity;") && methodDef.name == "<init>"
|
||||
}
|
||||
)
|
||||
)
|
||||
@@ -1,45 +1,69 @@
|
||||
package app.revanced.patches.youtube.interaction.swipecontrols.patch.bytecode
|
||||
|
||||
import app.revanced.extensions.transformMethods
|
||||
import app.revanced.extensions.traverseClassHierarchy
|
||||
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.addInstruction
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||
import app.revanced.patches.youtube.interaction.swipecontrols.annotation.SwipeControlsCompatibility
|
||||
import app.revanced.patches.youtube.interaction.swipecontrols.fingerprints.WatchWhileOnStartFingerprint
|
||||
import app.revanced.patches.youtube.interaction.swipecontrols.fingerprints.SwipeControlsHostActivityFingerprint
|
||||
import app.revanced.patches.youtube.interaction.swipecontrols.fingerprints.WatchWhileActivityFingerprint
|
||||
import app.revanced.patches.youtube.interaction.swipecontrols.patch.resource.SwipeControlsResourcePatch
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.playeroverlay.patch.PlayerOverlaysHookPatch
|
||||
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.immutable.ImmutableMethod
|
||||
|
||||
@Patch
|
||||
@Name("swipe-controls")
|
||||
@Description("Adds volume and brightness swipe controls.")
|
||||
@SwipeControlsCompatibility
|
||||
@Version("0.0.2")
|
||||
@Version("0.0.3")
|
||||
@DependsOn(
|
||||
[
|
||||
IntegrationsPatch::class,
|
||||
PlayerTypeHookPatch::class,
|
||||
PlayerOverlaysHookPatch::class,
|
||||
SwipeControlsResourcePatch::class
|
||||
]
|
||||
)
|
||||
class SwipeControlsBytecodePatch : BytecodePatch(
|
||||
listOf(
|
||||
WatchWhileOnStartFingerprint
|
||||
WatchWhileActivityFingerprint,
|
||||
SwipeControlsHostActivityFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
WatchWhileOnStartFingerprint.result!!.mutableMethod.addInstruction(
|
||||
0,
|
||||
"invoke-static { p0 }, Lapp/revanced/integrations/patches/SwipeControlsPatch;->WatchWhileActivity_onStartHookEX(Ljava/lang/Object;)V"
|
||||
)
|
||||
val wrapperClass = SwipeControlsHostActivityFingerprint.result!!.mutableClass
|
||||
val targetClass = WatchWhileActivityFingerprint.result!!.mutableClass
|
||||
|
||||
// inject the wrapper class from integrations into the class hierarchy of WatchWhileActivity
|
||||
wrapperClass.setSuperClass(targetClass.superclass)
|
||||
targetClass.setSuperClass(wrapperClass.type)
|
||||
|
||||
// ensure all classes and methods in the hierarchy are non-final, so we can override them in integrations
|
||||
data.traverseClassHierarchy(targetClass) {
|
||||
accessFlags = accessFlags and AccessFlags.FINAL.value.inv()
|
||||
transformMethods {
|
||||
ImmutableMethod(
|
||||
definingClass,
|
||||
name,
|
||||
parameters,
|
||||
returnType,
|
||||
accessFlags and AccessFlags.FINAL.value.inv(),
|
||||
annotations,
|
||||
hiddenApiRestrictions,
|
||||
implementation
|
||||
).toMutable()
|
||||
}
|
||||
}
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
<SwitchPreference android:title="@string/revanced_branding_watermark_title" android:key="revanced_branding_watermark_enabled" android:defaultValue="false" android:summaryOn="@string/revanced_branding_watermark_summary_on" android:summaryOff="@string/revanced_branding_watermark_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_cast_button_title" android:key="revanced_cast_button_enabled" android:defaultValue="false" android:summaryOn="@string/revanced_cast_button_summary_on" android:summaryOff="@string/revanced_cast_button_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_autoplay_button_title" android:key="revanced_autoplay_button_enabled" android:defaultValue="false" android:summaryOn="@string/revanced_autoplay_button_summary_on" android:summaryOff="@string/revanced_autoplay_button_summary_off" />
|
||||
<!--<SwitchPreference android:title="@string/revanced_tablet_miniplayer_title" android:key="revanced_tablet_miniplayer" android:defaultValue="false" android:summaryOn="@string/revanced_tablet_miniplayer_summary_on" android:summaryOff="@string/revanced_tablet_miniplayer_summary_off" />-->
|
||||
<SwitchPreference android:title="@string/revanced_tablet_miniplayer_title" android:key="revanced_tablet_miniplayer" android:defaultValue="false" android:summaryOn="@string/revanced_tablet_miniplayer_summary_on" android:summaryOff="@string/revanced_tablet_miniplayer_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_create_button_title" android:key="revanced_create_button_enabled" android:defaultValue="false" android:summaryOn="@string/revanced_create_button_summary_on" android:summaryOff="@string/revanced_create_button_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_new_actionbar_title" android:key="revanced_new_actionbar" android:defaultValue="false" android:summaryOn="@string/revanced_new_actionbar_summary_on" android:summaryOff="@string/revanced_new_actionbar_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_shorts_button_title" android:key="revanced_shorts_button_enabled" android:defaultValue="false" android:summaryOn="@string/revanced_shorts_button_summary_on" android:summaryOff="@string/revanced_shorts_button_summary_off" />
|
||||
|
||||
Reference in New Issue
Block a user