mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-28 21:21:02 +00:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42c562cff7 | ||
|
|
155121f891 | ||
|
|
c684a1c846 | ||
|
|
49ddc0a2ed | ||
|
|
221b61acc7 | ||
|
|
c133d495c3 | ||
|
|
aab39cbe93 | ||
|
|
bdab92faf2 | ||
|
|
50acd3d3b5 | ||
|
|
49a369a340 | ||
|
|
be8620bf91 | ||
|
|
32ed4c9f04 | ||
|
|
9c44497d40 | ||
|
|
8e604139e3 | ||
|
|
3de3a82afb | ||
|
|
d39fb7ca03 | ||
|
|
2d995d3757 | ||
|
|
464c98093a | ||
|
|
6ac5ed441f | ||
|
|
7925ca97c4 |
51
CHANGELOG.md
51
CHANGELOG.md
@@ -1,3 +1,54 @@
|
|||||||
|
# [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)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* `tablet-mini-player` patch ([dae41f1](https://github.com/revanced/revanced-patches/commit/dae41f1c59d26d00b1ba821dbe1521e68226f47c))
|
||||||
|
|
||||||
|
## [2.33.2](https://github.com/revanced/revanced-patches/compare/v2.33.1...v2.33.2) (2022-08-07)
|
||||||
|
|
||||||
|
## [2.33.1](https://github.com/revanced/revanced-patches/compare/v2.33.0...v2.33.1) (2022-08-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* spoof `X-Android-Cert` of Firebase `authToken` api request ([#315](https://github.com/revanced/revanced-patches/issues/315)) ([c81d61f](https://github.com/revanced/revanced-patches/commit/c81d61f685449590473fa5205e7709f81872a9b9))
|
||||||
|
|
||||||
|
# [2.33.0](https://github.com/revanced/revanced-patches/compare/v2.32.1...v2.33.0) (2022-08-06)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* bump music patches to 5.17.51 ([#307](https://github.com/revanced/revanced-patches/issues/307)) ([c303589](https://github.com/revanced/revanced-patches/commit/c303589bd8d1956ce2e3c4c285d45a648b5db30f))
|
||||||
|
|
||||||
|
## [2.32.1](https://github.com/revanced/revanced-patches/compare/v2.32.0...v2.32.1) (2022-08-04)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* incorrect compatibilty attribute ([#296](https://github.com/revanced/revanced-patches/issues/296)) ([0ab3e97](https://github.com/revanced/revanced-patches/commit/0ab3e9724157c628555964273c6b65f9f48f9664))
|
||||||
|
|
||||||
|
# [2.32.0](https://github.com/revanced/revanced-patches/compare/v2.31.0...v2.32.0) (2022-08-04)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* `promo-code-unlock` patch ([#292](https://github.com/revanced/revanced-patches/issues/292)) ([d5df2e6](https://github.com/revanced/revanced-patches/commit/d5df2e68f47cbb3d374b8ce24769872959014051))
|
||||||
|
|
||||||
# [2.31.0](https://github.com/revanced/revanced-patches/compare/v2.30.1...v2.31.0) (2022-08-03)
|
# [2.31.0](https://github.com/revanced/revanced-patches/compare/v2.30.1...v2.31.0) (2022-08-03)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
35
README.md
35
README.md
@@ -25,16 +25,32 @@ Official patches by ReVanced
|
|||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|:--------:|:--------------:|:-----------------:|
|
||||||
| `minimized-playback-music` | Enables minimized playback on Kids music. | 5.16.51 |
|
| `minimized-playback-music` | Enables minimized playback on Kids music. | 5.17.51 |
|
||||||
| `tasteBuilder-remover` | Removes the "Tell us which artists you like" card from the home screen. | 5.16.51 |
|
| `tasteBuilder-remover` | Removes the "Tell us which artists you like" card from the home screen. | 5.16.51 |
|
||||||
| `hide-get-premium` | Removes all "Get Premium" evidences from the avatar menu. | 5.16.51 |
|
| `hide-get-premium` | Removes all "Get Premium" evidences from the avatar menu. | 5.17.51 |
|
||||||
| `compact-header` | Hides the music category bar at the top of the homepage. | 5.16.51 |
|
| `compact-header` | Hides the music category bar at the top of the homepage. | 5.16.51 |
|
||||||
| `upgrade-button-remover` | Removes the upgrade tab from the pivot bar. | 5.16.51 |
|
| `upgrade-button-remover` | Removes the upgrade tab from the pivot bar. | 5.17.51 |
|
||||||
| `background-play` | Enables playing music in the background. | 5.16.51 |
|
| `background-play` | Enables playing music in the background. | 5.17.51 |
|
||||||
| `music-microg-support` | Allows YouTube Music ReVanced to run without root and under a different package name. | 5.16.51 |
|
| `music-microg-support` | Allows YouTube Music ReVanced to run without root and under a different package name. | 5.17.51 |
|
||||||
| `music-video-ads` | Removes ads in the music player. | 5.16.51 |
|
| `music-video-ads` | Removes ads in the music player. | 5.17.51 |
|
||||||
| `codecs-unlock` | Adds more audio codec options. The new audio codecs usually result in better audio quality. | 5.16.51 |
|
| `codecs-unlock` | Adds more audio codec options. The new audio codecs usually result in better audio quality. | 5.17.51 |
|
||||||
| `exclusive-audio-playback` | Enables the option to play music without video. | 5.16.51 |
|
| `exclusive-audio-playback` | Enables the option to play music without video. | 5.17.51 |
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### 📦 `de.dwd.warnapp`
|
||||||
|
<details>
|
||||||
|
|
||||||
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|
|:--------:|:--------------:|:-----------------:|
|
||||||
|
| `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>
|
</details>
|
||||||
|
|
||||||
### 📦 `com.google.android.youtube`
|
### 📦 `com.google.android.youtube`
|
||||||
@@ -58,7 +74,8 @@ Official patches by ReVanced
|
|||||||
| `hide-watermark` | Hides creator's watermarks on videos. | 17.29.34 |
|
| `hide-watermark` | Hides creator's watermarks on videos. | 17.29.34 |
|
||||||
| `sponsorblock` | Integrate SponsorBlock. | 17.29.34 |
|
| `sponsorblock` | Integrate SponsorBlock. | 17.29.34 |
|
||||||
| `enable-wide-searchbar` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | 17.29.34 |
|
| `enable-wide-searchbar` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | 17.29.34 |
|
||||||
| `custom-video-buffer` | Lets you change the buffers of videos. Has no use without settings yet. | 17.29.34 |
|
| `tablet-mini-player` | Enables the tablet mini player layout. | 17.29.34 |
|
||||||
|
| `custom-video-buffer` | Lets you change the buffers of videos. | 17.29.34 |
|
||||||
| `always-autorepeat` | Always repeats the playing video again. | 17.29.34 |
|
| `always-autorepeat` | Always repeats the playing video again. | 17.29.34 |
|
||||||
| `microg-support` | Allows YouTube ReVanced to run without root and under a different package name with Vanced MicroG | 17.29.34 |
|
| `microg-support` | Allows YouTube ReVanced to run without root and under a different package name with Vanced MicroG | 17.29.34 |
|
||||||
| `settings` | Adds settings for ReVanced to YouTube. | all |
|
| `settings` | Adds settings for ReVanced to YouTube. | all |
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ repositories {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("stdlib"))
|
implementation(kotlin("stdlib"))
|
||||||
|
|
||||||
implementation("app.revanced:revanced-patcher:3.3.1")
|
implementation("app.revanced:revanced-patcher:3.3.3")
|
||||||
implementation("app.revanced:multidexlib2:2.5.2.r2")
|
implementation("app.revanced:multidexlib2:2.5.2.r2")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.31.0
|
version = 2.36.0
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
package app.revanced.extensions
|
package app.revanced.extensions
|
||||||
|
|
||||||
|
import app.revanced.patcher.data.impl.BytecodeData
|
||||||
import app.revanced.patcher.data.impl.ResourceData
|
import app.revanced.patcher.data.impl.ResourceData
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
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.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patcher.util.smali.toInstruction
|
import app.revanced.patcher.util.smali.toInstruction
|
||||||
import org.jf.dexlib2.AccessFlags
|
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
|
* 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
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
|||||||
import app.revanced.patcher.extensions.PatchExtensions.description
|
import app.revanced.patcher.extensions.PatchExtensions.description
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||||
import app.revanced.patcher.patch.Patch
|
import app.revanced.patcher.patch.Patch
|
||||||
import app.revanced.patcher.util.patch.implementation.JarPatchBundle
|
import app.revanced.patcher.util.patch.impl.JarPatchBundle
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
object Generator {
|
object Generator {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
|||||||
|
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package(
|
[Package(
|
||||||
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51")
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
|||||||
@@ -5,10 +5,9 @@ import app.revanced.patcher.annotation.Package
|
|||||||
|
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package(
|
[Package(
|
||||||
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51")
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
internal annotation class CodecsUnlockCompatibility
|
internal annotation class CodecsUnlockCompatibility
|
||||||
|
|
||||||
|
|||||||
@@ -12,17 +12,14 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
@Name("codec-lock-fingerprint")
|
@Name("codec-lock-fingerprint")
|
||||||
@MatchingMethod(
|
@MatchingMethod(
|
||||||
"Labwj;",
|
"Lacfr;",
|
||||||
"a",
|
"a",
|
||||||
)
|
)
|
||||||
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
|
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
|
||||||
@CodecsUnlockCompatibility
|
@CodecsUnlockCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
object CodecsLockFingerprint : MethodFingerprint(
|
object CodecsLockFingerprint : MethodFingerprint(
|
||||||
"L", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L", "L", "L", "L"), listOf(
|
"L", AccessFlags.PUBLIC or AccessFlags.STATIC, null, listOf(
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
|
||||||
Opcode.CHECK_CAST,
|
|
||||||
Opcode.INVOKE_DIRECT,
|
Opcode.INVOKE_DIRECT,
|
||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.MOVE_RESULT,
|
Opcode.MOVE_RESULT,
|
||||||
@@ -37,5 +34,6 @@ object CodecsLockFingerprint : MethodFingerprint(
|
|||||||
Opcode.INVOKE_INTERFACE,
|
Opcode.INVOKE_INTERFACE,
|
||||||
Opcode.INVOKE_DIRECT,
|
Opcode.INVOKE_DIRECT,
|
||||||
Opcode.RETURN_OBJECT
|
Opcode.RETURN_OBJECT
|
||||||
)
|
),
|
||||||
)
|
listOf("eac3_supported")
|
||||||
|
)
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import app.revanced.patcher.util.smali.toInstruction
|
|||||||
import app.revanced.patches.music.audio.codecs.annotations.CodecsUnlockCompatibility
|
import app.revanced.patches.music.audio.codecs.annotations.CodecsUnlockCompatibility
|
||||||
import app.revanced.patches.music.audio.codecs.fingerprints.AllCodecsReferenceFingerprint
|
import app.revanced.patches.music.audio.codecs.fingerprints.AllCodecsReferenceFingerprint
|
||||||
import app.revanced.patches.music.audio.codecs.fingerprints.CodecsLockFingerprint
|
import app.revanced.patches.music.audio.codecs.fingerprints.CodecsLockFingerprint
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("codecs-unlock")
|
@Name("codecs-unlock")
|
||||||
@@ -25,19 +26,29 @@ class CodecsUnlockPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(data: BytecodeData): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
var result = CodecsLockFingerprint.result!!
|
val codecsLockResult = CodecsLockFingerprint.result!!
|
||||||
|
|
||||||
val implementation = result.mutableMethod.implementation!!
|
val implementation = codecsLockResult.mutableMethod.implementation!!
|
||||||
|
|
||||||
val instructionIndex = result.patternScanResult!!.startIndex
|
val scanResultStartIndex = codecsLockResult.patternScanResult!!.startIndex
|
||||||
|
val instructionIndex = scanResultStartIndex +
|
||||||
|
if (implementation.instructions[scanResultStartIndex - 1].opcode == Opcode.CHECK_CAST) {
|
||||||
|
// for 5.16.xx and lower
|
||||||
|
-3
|
||||||
|
} else {
|
||||||
|
// since 5.17.xx
|
||||||
|
-2
|
||||||
|
}
|
||||||
|
|
||||||
result = AllCodecsReferenceFingerprint.result!!
|
val allCodecsResult = AllCodecsReferenceFingerprint.result!!
|
||||||
val codecMethod =
|
val allCodecsMethod =
|
||||||
data.toMethodWalker(result.method).nextMethod(result.patternScanResult!!.startIndex).getMethod()
|
data.toMethodWalker(allCodecsResult.method)
|
||||||
|
.nextMethod(allCodecsResult.patternScanResult!!.startIndex)
|
||||||
|
.getMethod()
|
||||||
|
|
||||||
implementation.replaceInstruction(
|
implementation.replaceInstruction(
|
||||||
instructionIndex,
|
instructionIndex,
|
||||||
"invoke-static {}, ${codecMethod.definingClass}->${codecMethod.name}()Ljava/util/Set;".toInstruction()
|
"invoke-static {}, ${allCodecsMethod.definingClass}->${allCodecsMethod.name}()Ljava/util/Set;".toInstruction()
|
||||||
)
|
)
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
|
|||||||
@@ -5,10 +5,9 @@ import app.revanced.patcher.annotation.Package
|
|||||||
|
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package(
|
[Package(
|
||||||
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51")
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
internal annotation class ExclusiveAudioCompatibility
|
internal annotation class ExclusiveAudioCompatibility
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
|||||||
|
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package(
|
[Package(
|
||||||
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51")
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
|||||||
@@ -5,10 +5,9 @@ import app.revanced.patcher.annotation.Package
|
|||||||
|
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package(
|
[Package(
|
||||||
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51")
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
internal annotation class HideGetPremiumCompatibility
|
internal annotation class HideGetPremiumCompatibility
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,11 @@ package app.revanced.patches.music.layout.tastebuilder.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
/**
|
||||||
|
* -- Note 2022-08-05 --
|
||||||
|
* Since 5.17.xx the tastebuilder component is dismissible, so this patch is less useful
|
||||||
|
* also it is partly litho now
|
||||||
|
*/
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package(
|
[Package(
|
||||||
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51")
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51")
|
||||||
@@ -11,4 +16,3 @@ import app.revanced.patcher.annotation.Package
|
|||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
internal annotation class RemoveTasteBuilderCompatibility
|
internal annotation class RemoveTasteBuilderCompatibility
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,9 @@ import app.revanced.patcher.annotation.Package
|
|||||||
|
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package(
|
[Package(
|
||||||
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51")
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
internal annotation class RemoveUpgradeButtonCompatibility
|
internal annotation class RemoveUpgradeButtonCompatibility
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import app.revanced.patcher.annotation.Package
|
|||||||
|
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package(
|
[Package(
|
||||||
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51")
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
internal annotation class MusicMicroGPatchCompatibility
|
internal annotation class MusicMicroGPatchCompatibility
|
||||||
|
|||||||
@@ -5,10 +5,9 @@ import app.revanced.patcher.annotation.Package
|
|||||||
|
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package(
|
[Package(
|
||||||
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51")
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
internal annotation class BackgroundPlayCompatibility
|
internal annotation class BackgroundPlayCompatibility
|
||||||
|
|
||||||
|
|||||||
@@ -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,13 @@
|
|||||||
|
package app.revanced.patches.warnwetter.misc.firebasegetcert.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility(
|
||||||
|
[Package(
|
||||||
|
"de.dwd.warnapp", arrayOf()
|
||||||
|
)]
|
||||||
|
)
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class FirebaseGetCertPatchCompatibility
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package app.revanced.patches.warnwetter.misc.firebasegetcert.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.warnwetter.misc.firebasegetcert.annotations.FirebaseGetCertPatchCompatibility
|
||||||
|
|
||||||
|
@Name("messaging-app-certificate-fingerprint")
|
||||||
|
@MatchingMethod(
|
||||||
|
"Lcom/google/firebase/installations/remote/c;", "f"
|
||||||
|
)
|
||||||
|
@FirebaseGetCertPatchCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object GetMessagingCertFingerprint : MethodFingerprint(
|
||||||
|
"Ljava/lang/String;",
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
listOf(
|
||||||
|
"ContentValues",
|
||||||
|
"Could not get fingerprint hash for package: ",
|
||||||
|
"No such package: "
|
||||||
|
)
|
||||||
|
)
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package app.revanced.patches.warnwetter.misc.firebasegetcert.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.warnwetter.misc.firebasegetcert.annotations.FirebaseGetCertPatchCompatibility
|
||||||
|
|
||||||
|
@Name("registration-app-certificate-fingerprint")
|
||||||
|
@MatchingMethod(
|
||||||
|
"Lcom/google/firebase/remoteconfig/internal/ConfigFetchHttpClient;", "f"
|
||||||
|
)
|
||||||
|
@FirebaseGetCertPatchCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object GetReqistrationCertFingerprint : MethodFingerprint(
|
||||||
|
"Ljava/lang/String;",
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
listOf(
|
||||||
|
"FirebaseRemoteConfig",
|
||||||
|
"Could not get fingerprint hash for package: ",
|
||||||
|
"No such package: "
|
||||||
|
)
|
||||||
|
)
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package app.revanced.patches.warnwetter.misc.firebasegetcert.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.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||||
|
import app.revanced.patches.warnwetter.misc.firebasegetcert.fingerprints.*
|
||||||
|
import app.revanced.patches.warnwetter.misc.firebasegetcert.annotations.FirebaseGetCertPatchCompatibility
|
||||||
|
|
||||||
|
@Name("spoof-cert-patch")
|
||||||
|
@Description("Spoofs the X-Android-Cert header.")
|
||||||
|
@FirebaseGetCertPatchCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class FirebaseGetCertPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
GetReqistrationCertFingerprint,
|
||||||
|
GetMessagingCertFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
|
val spoofedInstruction =
|
||||||
|
"""
|
||||||
|
const-string v0, "0799DDF0414D3B3475E88743C91C0676793ED450"
|
||||||
|
return-object v0
|
||||||
|
"""
|
||||||
|
|
||||||
|
val registrationCertMethod = GetReqistrationCertFingerprint.result!!.mutableMethod
|
||||||
|
val messagingCertMethod = GetMessagingCertFingerprint.result!!.mutableMethod
|
||||||
|
|
||||||
|
registrationCertMethod.addInstructions(
|
||||||
|
0,
|
||||||
|
spoofedInstruction
|
||||||
|
)
|
||||||
|
messagingCertMethod.addInstructions(
|
||||||
|
0,
|
||||||
|
spoofedInstruction
|
||||||
|
)
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package app.revanced.patches.warnwetter.misc.promocode.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility(
|
||||||
|
[Package(
|
||||||
|
"de.dwd.warnapp", arrayOf()
|
||||||
|
)]
|
||||||
|
)
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class PromoCodeUnlockCompatibility
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package app.revanced.patches.warnwetter.misc.promocode.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.MatchingMethod
|
||||||
|
import app.revanced.patches.warnwetter.misc.promocode.annotations.PromoCodeUnlockCompatibility
|
||||||
|
|
||||||
|
@Name("promo-code-unlock-fingerprint")
|
||||||
|
@MatchingMethod(
|
||||||
|
"Lde/dwd/warnapp/model/PromoTokenVerification;", "isValid"
|
||||||
|
)
|
||||||
|
@PromoCodeUnlockCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object PromoCodeUnlockFingerprint : MethodFingerprint(
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
{ methodDef ->
|
||||||
|
methodDef.definingClass.endsWith("PromoTokenVerification;") && methodDef.name == "isValid"
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package app.revanced.patches.warnwetter.misc.promocode.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.patch.annotations.Patch
|
||||||
|
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patches.warnwetter.misc.firebasegetcert.patch.FirebaseGetCertPatch
|
||||||
|
import app.revanced.patches.warnwetter.misc.promocode.annotations.PromoCodeUnlockCompatibility
|
||||||
|
import app.revanced.patches.warnwetter.misc.promocode.fingerprints.PromoCodeUnlockFingerprint
|
||||||
|
|
||||||
|
@DependsOn(
|
||||||
|
[
|
||||||
|
FirebaseGetCertPatch::class
|
||||||
|
]
|
||||||
|
)
|
||||||
|
@Patch
|
||||||
|
@Name("promo-code-unlock")
|
||||||
|
@Description("Disables the validation of promo code. Any code will work to unlock all features.")
|
||||||
|
@PromoCodeUnlockCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class PromoCodeUnlockPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
PromoCodeUnlockFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
|
||||||
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
|
val method = PromoCodeUnlockFingerprint.result!!.mutableMethod
|
||||||
|
method.addInstructions(
|
||||||
|
0,
|
||||||
|
"""
|
||||||
|
const/4 v0, 0x1
|
||||||
|
return v0
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -174,7 +174,6 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Opcode.CONST_STRING -> {
|
Opcode.CONST_STRING -> {
|
||||||
|
|
||||||
when (((instruction as Instruction21c).reference as StringReference).string) {
|
when (((instruction as Instruction21c).reference as StringReference).string) {
|
||||||
stringReferences[0] -> {
|
stringReferences[0] -> {
|
||||||
val stringInstruction = instructions.elementAt(3)
|
val stringInstruction = instructions.elementAt(3)
|
||||||
@@ -200,23 +199,23 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
|
|||||||
stringReferences[2] -> { // Litho ads
|
stringReferences[2] -> { // Litho ads
|
||||||
// create proxied method.
|
// create proxied method.
|
||||||
val proxy = data.proxy(classDef)
|
val proxy = data.proxy(classDef)
|
||||||
val mutableClass = proxy.resolve()
|
val proxiedClass = proxy.resolve()
|
||||||
|
|
||||||
// add getIsEmpty method
|
// add getIsEmpty method
|
||||||
mutableClass.addGetIsEmptyMethod()
|
proxiedClass.addGetIsEmptyMethod()
|
||||||
|
|
||||||
// get required method to patch and get references from
|
// get required method to patch and get references from
|
||||||
val lithoMethod = getLithoMethod(mutableClass)
|
val lithoMethod = getLithoMethod(proxiedClass)
|
||||||
?: return PatchResultError("Could not find required litho method to patch.")
|
?: return PatchResultError("Could not find required litho method to patch.")
|
||||||
val lithoMethodImplementation = lithoMethod.implementation!!
|
val lithoMethodImplementation = lithoMethod.implementation!!
|
||||||
|
|
||||||
// create and add getTemplateName method
|
// create and add getTemplateName method
|
||||||
val getTemplateMethod =
|
val getTemplateMethod =
|
||||||
mutableClass.createGetTemplateNameMethod(lithoMethodImplementation)
|
proxiedClass.createGetTemplateNameMethod(lithoMethodImplementation)
|
||||||
mutableClass.addMethod(getTemplateMethod)
|
proxiedClass.addMethod(getTemplateMethod)
|
||||||
|
|
||||||
val lithoInstructions = lithoMethodImplementation.instructions
|
val lithoInstructions = lithoMethodImplementation.instructions
|
||||||
val thisType = mutableClass.type
|
val thisType = proxiedClass.type
|
||||||
val templateNameParameterType = getTemplateMethod.parameterTypes.first()
|
val templateNameParameterType = getTemplateMethod.parameterTypes.first()
|
||||||
|
|
||||||
// get reference descriptors
|
// get reference descriptors
|
||||||
|
|||||||
@@ -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.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.interaction.swipecontrols.annotation.SwipeControlsCompatibility
|
import app.revanced.patches.youtube.interaction.swipecontrols.annotation.SwipeControlsCompatibility
|
||||||
|
|
||||||
@Name("watch-while-onStart-fingerprint")
|
@Name("watch-while-activity-fingerprint")
|
||||||
@MatchingMethod(
|
@MatchingMethod(
|
||||||
"LWatchWhileActivity;", "onCreate"
|
"LWatchWhileActivity;", "<init>"
|
||||||
)
|
)
|
||||||
@DirectPatternScanMethod
|
@DirectPatternScanMethod
|
||||||
@SwipeControlsCompatibility
|
@SwipeControlsCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
object WatchWhileOnStartFingerprint : MethodFingerprint(
|
object WatchWhileActivityFingerprint : MethodFingerprint(
|
||||||
null, null, null, null, null, { methodDef ->
|
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
|
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.Description
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.impl.BytecodeData
|
import app.revanced.patcher.data.impl.BytecodeData
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patcher.patch.impl.BytecodePatch
|
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.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.interaction.swipecontrols.patch.resource.SwipeControlsResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
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 app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.immutable.ImmutableMethod
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("swipe-controls")
|
@Name("swipe-controls")
|
||||||
@Description("Adds volume and brightness swipe controls.")
|
@Description("Adds volume and brightness swipe controls.")
|
||||||
@SwipeControlsCompatibility
|
@SwipeControlsCompatibility
|
||||||
@Version("0.0.2")
|
@Version("0.0.3")
|
||||||
@DependsOn(
|
@DependsOn(
|
||||||
[
|
[
|
||||||
IntegrationsPatch::class,
|
IntegrationsPatch::class,
|
||||||
PlayerTypeHookPatch::class,
|
PlayerTypeHookPatch::class,
|
||||||
PlayerOverlaysHookPatch::class,
|
|
||||||
SwipeControlsResourcePatch::class
|
SwipeControlsResourcePatch::class
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
class SwipeControlsBytecodePatch : BytecodePatch(
|
class SwipeControlsBytecodePatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
WatchWhileOnStartFingerprint
|
WatchWhileActivityFingerprint,
|
||||||
|
SwipeControlsHostActivityFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(data: BytecodeData): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
WatchWhileOnStartFingerprint.result!!.mutableMethod.addInstruction(
|
val wrapperClass = SwipeControlsHostActivityFingerprint.result!!.mutableClass
|
||||||
0,
|
val targetClass = WatchWhileActivityFingerprint.result!!.mutableClass
|
||||||
"invoke-static { p0 }, Lapp/revanced/integrations/patches/SwipeControlsPatch;->WatchWhileActivity_onStartHookEX(Ljava/lang/Object;)V"
|
|
||||||
)
|
// 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()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.tabletminiplayer.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility(
|
||||||
|
[Package(
|
||||||
|
"com.google.android.youtube", arrayOf("17.26.35", "17.29.34")
|
||||||
|
)]
|
||||||
|
)
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class TabletMiniPlayerCompatibility
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.tabletminiplayer.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.tabletminiplayer.annotations.TabletMiniPlayerCompatibility
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
@Name("mini-player-dimensions-calculator-fingerprint")
|
||||||
|
@MatchingMethod(
|
||||||
|
"Lkkr;", "pM"
|
||||||
|
)
|
||||||
|
@FuzzyPatternScanMethod(2) // TODO: Find a good threshold value
|
||||||
|
@TabletMiniPlayerCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object MiniPlayerDimensionsCalculatorFingerprint : MethodFingerprint(
|
||||||
|
"V",
|
||||||
|
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
listOf("L"),
|
||||||
|
listOf(
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.MUL_FLOAT,
|
||||||
|
Opcode.INVOKE_INTERFACE,
|
||||||
|
Opcode.IGET_BOOLEAN,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.IF_EQZ,
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.MOVE_RESULT,
|
||||||
|
Opcode.IF_NEZ,
|
||||||
|
Opcode.FLOAT_TO_DOUBLE,
|
||||||
|
Opcode.CONST_WIDE_HIGH16,
|
||||||
|
Opcode.CMPL_DOUBLE,
|
||||||
|
)
|
||||||
|
)
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.tabletminiplayer.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.MatchingMethod
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.tabletminiplayer.annotations.TabletMiniPlayerCompatibility
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
@Name("mini-player-override-fingerprint")
|
||||||
|
@MatchingMethod(
|
||||||
|
"Lkkr;", "j"
|
||||||
|
)
|
||||||
|
@TabletMiniPlayerCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object MiniPlayerOverrideFingerprint : MethodFingerprint(
|
||||||
|
"Z", AccessFlags.STATIC or AccessFlags.PUBLIC ,null,
|
||||||
|
listOf(Opcode.RETURN), // anchor to insert the instruction
|
||||||
|
)
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.tabletminiplayer.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.MatchingMethod
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.tabletminiplayer.annotations.TabletMiniPlayerCompatibility
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
@Name("mini-player-override-no-context-fingerprint")
|
||||||
|
@MatchingMethod(
|
||||||
|
"Lkkr;", "k"
|
||||||
|
)
|
||||||
|
@TabletMiniPlayerCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object MiniPlayerOverrideNoContextFingerprint : MethodFingerprint(
|
||||||
|
"Z", AccessFlags.FINAL or AccessFlags.PRIVATE ,null,
|
||||||
|
listOf(Opcode.RETURN), // anchor to insert the instruction
|
||||||
|
)
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.tabletminiplayer.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.MatchingMethod
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.tabletminiplayer.annotations.TabletMiniPlayerCompatibility
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
@Name("mini-player-response-model-size-check-fingerprint")
|
||||||
|
@MatchingMethod(
|
||||||
|
"Lenv;", "a"
|
||||||
|
)
|
||||||
|
@TabletMiniPlayerCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object MiniPlayerResponseModelSizeCheckFingerprint : MethodFingerprint(
|
||||||
|
"L",
|
||||||
|
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
listOf("L", "L"),
|
||||||
|
listOf(
|
||||||
|
Opcode.OR_INT_LIT8,
|
||||||
|
Opcode.IPUT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.CHECK_CAST,
|
||||||
|
Opcode.RETURN_OBJECT,
|
||||||
|
Opcode.RETURN_OBJECT,
|
||||||
|
Opcode.CHECK_CAST,
|
||||||
|
Opcode.CHECK_CAST,
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT,
|
||||||
|
Opcode.IF_NEZ,
|
||||||
|
),
|
||||||
|
null
|
||||||
|
)
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.tabletminiplayer.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.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve
|
||||||
|
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
|
||||||
|
import app.revanced.patches.youtube.layout.tabletminiplayer.annotations.TabletMiniPlayerCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.tabletminiplayer.fingerprints.MiniPlayerDimensionsCalculatorFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.tabletminiplayer.fingerprints.MiniPlayerOverrideFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.tabletminiplayer.fingerprints.MiniPlayerOverrideNoContextFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.tabletminiplayer.fingerprints.MiniPlayerResponseModelSizeCheckFingerprint
|
||||||
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@DependsOn([IntegrationsPatch::class])
|
||||||
|
@Name("tablet-mini-player")
|
||||||
|
@Description("Enables the tablet mini player layout.")
|
||||||
|
@TabletMiniPlayerCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class TabletMiniPlayerPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
MiniPlayerDimensionsCalculatorFingerprint,
|
||||||
|
MiniPlayerResponseModelSizeCheckFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
|
// first resolve the fingerprints via the parent fingerprint
|
||||||
|
val miniPlayerClass = MiniPlayerDimensionsCalculatorFingerprint.result!!.classDef
|
||||||
|
|
||||||
|
/*
|
||||||
|
* no context parameter method
|
||||||
|
*/
|
||||||
|
MiniPlayerOverrideNoContextFingerprint.resolve(data, miniPlayerClass)
|
||||||
|
val (method, _, parameterRegister) = MiniPlayerOverrideNoContextFingerprint.addProxyCall()
|
||||||
|
// - 1 means to insert before the return instruction
|
||||||
|
val secondInsertIndex = method.implementation!!.instructions.size - 1
|
||||||
|
method.insertOverride(secondInsertIndex, parameterRegister /** same register used to return **/)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* method with context parameter
|
||||||
|
*/
|
||||||
|
MiniPlayerOverrideFingerprint.resolve(data, miniPlayerClass)
|
||||||
|
val (_, _, _) = MiniPlayerOverrideFingerprint.addProxyCall()
|
||||||
|
|
||||||
|
/*
|
||||||
|
* size check return value override
|
||||||
|
*/
|
||||||
|
val (_, _, _) = MiniPlayerResponseModelSizeCheckFingerprint.addProxyCall()
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
// helper methods
|
||||||
|
private companion object {
|
||||||
|
fun MethodFingerprint.addProxyCall(): Triple<MutableMethod, Int, Int> {
|
||||||
|
val (method, scanIndex, parameterRegister) = this.unwrap()
|
||||||
|
method.insertOverride(scanIndex, parameterRegister)
|
||||||
|
|
||||||
|
return Triple(method, scanIndex, parameterRegister)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun MutableMethod.insertOverride(index: Int, overrideRegister: Int) {
|
||||||
|
this.addInstructions(
|
||||||
|
index,
|
||||||
|
"""
|
||||||
|
invoke-static {v$overrideRegister}, Lapp/revanced/integrations/patches/TabletMiniPlayerOverridePatch;->getTabletMiniPlayerOverride(Z)Z
|
||||||
|
move-result v$overrideRegister
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun MethodFingerprint.unwrap(): Triple<MutableMethod, Int, Int> {
|
||||||
|
val result = this.result!!
|
||||||
|
val scanIndex = result.patternScanResult!!.endIndex
|
||||||
|
val method = result.mutableMethod
|
||||||
|
val instructions = method.implementation!!.instructions
|
||||||
|
val parameterRegister = (instructions[scanIndex] as OneRegisterInstruction).registerA
|
||||||
|
|
||||||
|
return Triple(method, scanIndex, parameterRegister)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
|||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("custom-video-buffer")
|
@Name("custom-video-buffer")
|
||||||
@Description("Lets you change the buffers of videos. Has no use without settings yet.")
|
@Description("Lets you change the buffers of videos.")
|
||||||
@CustomVideoBufferCompatibility
|
@CustomVideoBufferCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class CustomVideoBufferPatch : BytecodePatch(
|
class CustomVideoBufferPatch : BytecodePatch(
|
||||||
@@ -26,13 +26,13 @@ class CustomVideoBufferPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(data: BytecodeData): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
execMaxBuffer(data)
|
execMaxBuffer()
|
||||||
execPlaybackBuffer(data)
|
execPlaybackBuffer(data)
|
||||||
execReBuffer(data)
|
execReBuffer(data)
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun execMaxBuffer(data: BytecodeData) {
|
private fun execMaxBuffer() {
|
||||||
val result = MaxBufferFingerprint.result!!
|
val result = MaxBufferFingerprint.result!!
|
||||||
val method = result.mutableMethod
|
val method = result.mutableMethod
|
||||||
val index = result.patternScanResult!!.endIndex - 1
|
val index = result.patternScanResult!!.endIndex - 1
|
||||||
|
|||||||
Reference in New Issue
Block a user