Compare commits

...

20 Commits

Author SHA1 Message Date
semantic-release-bot
c684a1c846 chore(release): 2.35.0 [skip ci]
# [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)) ([49ddc0a](49ddc0a2ed))
2022-08-14 20:18:06 +00:00
oSumAtrIX
49ddc0a2ed feat: tiktok-ads patch (#335) 2022-08-14 22:16:25 +02:00
semantic-release-bot
221b61acc7 chore(release): 2.34.0 [skip ci]
# [2.34.0](https://github.com/revanced/revanced-patches/compare/v2.33.2...v2.34.0) (2022-08-14)

### Features

* `tablet-mini-player` patch ([aab39cb](aab39cbe93))
2022-08-14 15:35:33 +00:00
oSumAtrIX
c133d495c3 build: bump patcher dependency version 2022-08-14 17:33:13 +02:00
oSumAtrIX
aab39cbe93 feat: tablet-mini-player patch 2022-08-14 17:32:32 +02:00
semantic-release-bot
bdab92faf2 chore(release): 2.33.2 [skip ci]
## [2.33.2](https://github.com/revanced/revanced-patches/compare/v2.33.1...v2.33.2) (2022-08-07)
2022-08-07 20:42:34 +00:00
oSumAtrIX
50acd3d3b5 refactor: remove unused parameter 2022-08-07 22:40:07 +02:00
oSumAtrIX
49a369a340 refactor: un-shadow variable name 2022-08-07 22:39:53 +02:00
oSumAtrIX
be8620bf91 build: bump patcher dependency version 2022-08-07 22:36:02 +02:00
semantic-release-bot
32ed4c9f04 chore(release): 2.33.1 [skip ci]
## [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)) ([9c44497](9c44497d40))
2022-08-07 10:44:47 +00:00
Itroublve
9c44497d40 fix: spoof X-Android-Cert of Firebase authToken api request (#315) 2022-08-07 12:42:39 +02:00
semantic-release-bot
8e604139e3 chore(release): 2.33.0 [skip ci]
# [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)) ([3de3a82](3de3a82afb))
2022-08-06 23:04:00 +00:00
epicsampler
3de3a82afb feat: bump music patches to 5.17.51 (#307) 2022-08-07 01:02:08 +02:00
oSumAtrIX
d39fb7ca03 refactor: use approriate description 2022-08-05 03:48:03 +02:00
semantic-release-bot
2d995d3757 chore(release): 2.32.1 [skip ci]
## [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)) ([464c980](464c98093a))
2022-08-04 19:55:13 +00:00
Itroublve
464c98093a fix: incorrect compatibilty attribute (#296) 2022-08-04 21:53:29 +02:00
semantic-release-bot
6ac5ed441f chore(release): 2.32.0 [skip ci]
# [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)) ([7925ca9](7925ca97c4))
2022-08-04 17:05:39 +00:00
Technikte
7925ca97c4 feat: promo-code-unlock patch (#292) 2022-08-04 19:03:56 +02:00
semantic-release-bot
0c5f117d5d chore(release): 2.31.0 [skip ci]
# [2.31.0](https://github.com/revanced/revanced-patches/compare/v2.30.1...v2.31.0) (2022-08-03)

### Features

* remove `force-vp9-codec` patch ([#287](https://github.com/revanced/revanced-patches/issues/287)) ([6ab475c](6ab475c284))
2022-08-03 18:30:49 +00:00
epicsampler
6ab475c284 feat: remove force-vp9-codec patch (#287) 2022-08-03 20:28:39 +02:00
40 changed files with 615 additions and 341 deletions

View File

@@ -1,3 +1,54 @@
# [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)
### Features
* remove `force-vp9-codec` patch ([#287](https://github.com/revanced/revanced-patches/issues/287)) ([e428978](https://github.com/revanced/revanced-patches/commit/e42897801b20e7439969954753e2c15c85eb41b5))
## [2.30.1](https://github.com/revanced/revanced-patches/compare/v2.30.0...v2.30.1) (2022-08-03)

View File

@@ -25,16 +25,32 @@ Official patches by ReVanced
| 💊 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 |
| `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 |
| `upgrade-button-remover` | Removes the upgrade tab from the pivot bar. | 5.16.51 |
| `background-play` | Enables playing music in the background. | 5.16.51 |
| `music-microg-support` | Allows YouTube Music ReVanced to run without root and under a different package name. | 5.16.51 |
| `music-video-ads` | Removes ads in the music player. | 5.16.51 |
| `codecs-unlock` | Adds more audio codec options. The new audio codecs usually result in better audio quality. | 5.16.51 |
| `exclusive-audio-playback` | Enables the option to play music without video. | 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.17.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.17.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.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>
### 📦 `com.google.android.youtube`
@@ -58,8 +74,8 @@ Official patches by ReVanced
| `hide-watermark` | Hides creator's watermarks on videos. | 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 |
| `force-vp9-codec` | Forces the VP9 codec for videos. | 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 |
| `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 |

View File

@@ -22,7 +22,7 @@ repositories {
dependencies {
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")
}

View File

@@ -1,2 +1,2 @@
kotlin.code.style = official
version = 2.30.1
version = 2.35.0

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
import app.revanced.patcher.extensions.PatchExtensions.description
import app.revanced.patcher.extensions.PatchExtensions.patchName
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
object Generator {

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility(
[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)

View File

@@ -5,10 +5,9 @@ import app.revanced.patcher.annotation.Package
@Compatibility(
[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)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class CodecsUnlockCompatibility

View File

@@ -12,17 +12,14 @@ import org.jf.dexlib2.Opcode
@Name("codec-lock-fingerprint")
@MatchingMethod(
"Labwj;",
"Lacfr;",
"a",
)
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@CodecsUnlockCompatibility
@Version("0.0.1")
object CodecsLockFingerprint : MethodFingerprint(
"L", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L", "L", "L", "L"), listOf(
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST,
"L", AccessFlags.PUBLIC or AccessFlags.STATIC, null, listOf(
Opcode.INVOKE_DIRECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT,
@@ -37,5 +34,6 @@ object CodecsLockFingerprint : MethodFingerprint(
Opcode.INVOKE_INTERFACE,
Opcode.INVOKE_DIRECT,
Opcode.RETURN_OBJECT
)
)
),
listOf("eac3_supported")
)

View File

@@ -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.fingerprints.AllCodecsReferenceFingerprint
import app.revanced.patches.music.audio.codecs.fingerprints.CodecsLockFingerprint
import org.jf.dexlib2.Opcode
@Patch
@Name("codecs-unlock")
@@ -25,19 +26,29 @@ class CodecsUnlockPatch : BytecodePatch(
)
) {
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 codecMethod =
data.toMethodWalker(result.method).nextMethod(result.patternScanResult!!.startIndex).getMethod()
val allCodecsResult = AllCodecsReferenceFingerprint.result!!
val allCodecsMethod =
data.toMethodWalker(allCodecsResult.method)
.nextMethod(allCodecsResult.patternScanResult!!.startIndex)
.getMethod()
implementation.replaceInstruction(
instructionIndex,
"invoke-static {}, ${codecMethod.definingClass}->${codecMethod.name}()Ljava/util/Set;".toInstruction()
"invoke-static {}, ${allCodecsMethod.definingClass}->${allCodecsMethod.name}()Ljava/util/Set;".toInstruction()
)
return PatchResultSuccess()

View File

@@ -5,10 +5,9 @@ import app.revanced.patcher.annotation.Package
@Compatibility(
[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)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class ExclusiveAudioCompatibility

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility(
[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)

View File

@@ -5,10 +5,9 @@ import app.revanced.patcher.annotation.Package
@Compatibility(
[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)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class HideGetPremiumCompatibility

View File

@@ -3,6 +3,11 @@ package app.revanced.patches.music.layout.tastebuilder.annotations
import app.revanced.patcher.annotation.Compatibility
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(
[Package(
"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)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class RemoveTasteBuilderCompatibility

View File

@@ -5,10 +5,9 @@ import app.revanced.patcher.annotation.Package
@Compatibility(
[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)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class RemoveUpgradeButtonCompatibility

View File

@@ -5,9 +5,9 @@ import app.revanced.patcher.annotation.Package
@Compatibility(
[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)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class MusicMicroGPatchCompatibility
internal annotation class MusicMicroGPatchCompatibility

View File

@@ -5,10 +5,9 @@ import app.revanced.patcher.annotation.Package
@Compatibility(
[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)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class BackgroundPlayCompatibility

View File

@@ -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

View File

@@ -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"
}
)

View File

@@ -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.")
}
}

View File

@@ -1,13 +1,13 @@
package app.revanced.patches.youtube.misc.forcevp9.annotations
package app.revanced.patches.warnwetter.misc.firebasegetcert.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf("17.26.35", "17.27.39", "17.28.34", "17.29.34")
"de.dwd.warnapp", arrayOf()
)]
)
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class ForceVP9Compatibility
internal annotation class FirebaseGetCertPatchCompatibility

View File

@@ -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: "
)
)

View File

@@ -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: "
)
)

View File

@@ -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()
}
}

View File

@@ -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

View File

@@ -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"
}
)

View File

@@ -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()
}
}

View File

@@ -174,7 +174,6 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
}
Opcode.CONST_STRING -> {
when (((instruction as Instruction21c).reference as StringReference).string) {
stringReferences[0] -> {
val stringInstruction = instructions.elementAt(3)
@@ -200,23 +199,23 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
stringReferences[2] -> { // Litho ads
// create proxied method.
val proxy = data.proxy(classDef)
val mutableClass = proxy.resolve()
val proxiedClass = proxy.resolve()
// add getIsEmpty method
mutableClass.addGetIsEmptyMethod()
proxiedClass.addGetIsEmptyMethod()
// 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.")
val lithoMethodImplementation = lithoMethod.implementation!!
// create and add getTemplateName method
val getTemplateMethod =
mutableClass.createGetTemplateNameMethod(lithoMethodImplementation)
mutableClass.addMethod(getTemplateMethod)
proxiedClass.createGetTemplateNameMethod(lithoMethodImplementation)
proxiedClass.addMethod(getTemplateMethod)
val lithoInstructions = lithoMethodImplementation.instructions
val thisType = mutableClass.type
val thisType = proxiedClass.type
val templateNameParameterType = getTemplateMethod.parameterTypes.first()
// get reference descriptors

View File

@@ -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

View File

@@ -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,
)
)

View File

@@ -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
)

View File

@@ -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
)

View File

@@ -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
)

View File

@@ -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)
}
}
}

View File

@@ -1,48 +0,0 @@
package app.revanced.patches.youtube.misc.forcevp9.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.DirectPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.forcevp9.annotations.ForceVP9Compatibility
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@Name("force-vp9-codec-fingerprint")
@MatchingMethod(
"Lpzs;", "aI"
)
@DirectPatternScanMethod
@ForceVP9Compatibility
@Version("0.0.1")
object ForceVP9CodecFingerprint : MethodFingerprint(
"Z", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L", "I"), listOf(
Opcode.SGET, Opcode.IF_NEZ, Opcode.INVOKE_STATIC
), null, null
)
/*
public static boolean aI(Context context, int i) {
if (b == 0) {
aH(context);
}
return b >= i; // Override to: return Lapp/revanced/integrations/patches/ForceCodecPatch->shouldForceVP9()
}
.method public static aI(Landroid/content/Context;I)Z
sget v0, Lpzs;->b:I
if-nez v0, :cond_7
invoke-static {p0}, Lpzs;->aH(Landroid/content/Context;)V
:cond_7
//remove after here, and inject only our code
sget p0, Lpzs;->b:I
if-lt p0, p1, :cond_d
const/4 p0, 0x1
return p0
:cond_d
const/4 p0, 0x0
return p0
.end method
*/

View File

@@ -1,73 +0,0 @@
package app.revanced.patches.youtube.misc.forcevp9.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.DirectPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.forcevp9.annotations.ForceVP9Compatibility
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@Name("force-vp9-codec-fingerprint-two")
@MatchingMethod(
"Lpzs;", "aO"
)
@DirectPatternScanMethod
@ForceVP9Compatibility
@Version("0.0.1")
object ForceVP9CodecFingerprintTwo : MethodFingerprint(
"Z", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("I"), listOf(
Opcode.INVOKE_STATIC, Opcode.MOVE_RESULT_OBJECT, Opcode.CONST_4
), null, null
)
/*
public static boolean aO(int i) {
Pair aG = aG();
return (aG == null ? 0 : Math.min(((Integer) aG.first).intValue(), ((Integer) aG.second).intValue())) >= i;
//replace line with: return Lapp/revanced/integrations/patches/ForceCodecPatch/shouldForceVP9();
}
becomes:
public static boolean aO(int i) {
return Lapp/revanced/integrations/patches/ForceCodecPatch/shouldForceVP9();
}
.method public static aO(I)Z
invoke-static {}, Lpzs;->aG()Landroid/util/Pair;
move-result-object v0
const/4 v1, 0x0
if-nez v0, :cond_9
const/4 v0, 0x0
goto :goto_1d
:cond_9
iget-object v2, v0, Landroid/util/Pair;->first:Ljava/lang/Object;
check-cast v2, Ljava/lang/Integer;
invoke-virtual {v2}, Ljava/lang/Integer;->intValue()I
move-result v2
iget-object v0, v0, Landroid/util/Pair;->second:Ljava/lang/Object;
check-cast v0, Ljava/lang/Integer;
invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I
move-result v0
invoke-static {v2, v0}, Ljava/lang/Math;->min(II)I
move-result v0
:goto_1d
if-lt v0, p0, :cond_21
const/4 p0, 0x1
return p0
:cond_21
return v1
.end method
becomes:
.method public static aO(I)Z
invoke-static {}, Lapp/revanced/integrations/patches/ForceCodecPatch;->shouldForceVP9()Z
move-result v0
return v0
.end method
*/

View File

@@ -1,24 +0,0 @@
package app.revanced.patches.youtube.misc.forcevp9.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.DirectPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.forcevp9.annotations.ForceVP9Compatibility
import org.jf.dexlib2.AccessFlags
@Name("force-vp9-codec-parent-fingerprint")
@MatchingMethod(
"Lqaa;", "U"
)
@DirectPatternScanMethod
@ForceVP9Compatibility
@Version("0.0.1")
object ForceVP9ParentFingerprint : MethodFingerprint(
"L", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf(), null,
listOf(
"sys.display-size", "x"
)
)

View File

@@ -1,30 +0,0 @@
package app.revanced.patches.youtube.misc.forcevp9.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.DirectPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.forcevp9.annotations.ForceVP9Compatibility
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.reference.FieldReference
@Name("replace-device-info-parent-fingerprint")
@MatchingMethod(
"Lvjb;", "e"
)
@DirectPatternScanMethod
@ForceVP9Compatibility
@Version("0.0.1")
object ReplaceDeviceInfoFingerprint : MethodFingerprint(
"L", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf(), null,
null,
customFingerprint = { methodDef ->
methodDef.implementation!!.instructions.any {
((it as? ReferenceInstruction)?.reference as? FieldReference)?.definingClass.equals("Landroid/os/Build;")
&& ((it as? ReferenceInstruction)?.reference as? FieldReference)?.name.equals("MANUFACTURER")
}
}
)

View File

@@ -1,24 +0,0 @@
package app.revanced.patches.youtube.misc.forcevp9.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.DirectPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.forcevp9.annotations.ForceVP9Compatibility
import org.jf.dexlib2.AccessFlags
@Name("replace-device-info-parent-fingerprint")
@MatchingMethod(
"Lvjb;", "b"
)
@DirectPatternScanMethod
@ForceVP9Compatibility
@Version("0.0.1")
object ReplaceDeviceInfoParentFingerprint : MethodFingerprint(
"L", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf(), null,
listOf(
"Failed to read the client side experiments map from the disk"
)
)

View File

@@ -1,87 +0,0 @@
package app.revanced.patches.youtube.misc.forcevp9.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.impl.MethodFingerprintResult
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.misc.forcevp9.annotations.ForceVP9Compatibility
import app.revanced.patches.youtube.misc.forcevp9.fingerprints.*
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.reference.FieldReference
@Patch
@DependsOn([IntegrationsPatch::class])
@Name("force-vp9-codec")
@Description("Forces the VP9 codec for videos.")
@ForceVP9Compatibility
@Version("0.0.1")
class ForceVP9CodecPatch : BytecodePatch(
listOf(
ForceVP9ParentFingerprint, ReplaceDeviceInfoParentFingerprint
)
) {
override fun execute(data: BytecodeData): PatchResult {
val classDef = ForceVP9ParentFingerprint.result!!.classDef
ForceVP9CodecFingerprint.resolve(data, classDef)
ForceVP9CodecFingerprintTwo.resolve(data, classDef)
replaceInstructions(ForceVP9CodecFingerprint.result!!)
replaceInstructions(ForceVP9CodecFingerprintTwo.result!!)
ReplaceDeviceInfoFingerprint.resolve(data, ReplaceDeviceInfoParentFingerprint.result!!.classDef)
var method = ReplaceDeviceInfoFingerprint.result!!.mutableMethod
replaceDeviceInfos("Manufacturer", method)
replaceDeviceInfos("Model", method)
return PatchResultSuccess()
}
private fun replaceInstructions(result: MethodFingerprintResult) {
val method = result.mutableMethod
method.removeInstructions(0, method.implementation!!.instructions.size - 1)
method.addInstructions(
0, """
invoke-static {}, Lapp/revanced/integrations/patches/ForceCodecPatch;->shouldForceVP9()Z
move-result v0
return v0
"""
)
}
private fun replaceDeviceInfos(name: String, method: MutableMethod) {
var impl = method.implementation!!
//find target instruction for Build.name.uppercase() and replace that with our method
impl.instructions.filter {
((it as? ReferenceInstruction)?.reference as? FieldReference)?.let { field ->
//sget-object v1, Landroid/os/Build;->MANUFACTURER:Ljava/lang/String;
//sget-object v1, Landroid/os/Build;->MODEL:Ljava/lang/String;
field.definingClass == "Landroid/os/Build;" && field.name == name.uppercase()
} == true
}.forEach { instruction ->
val index = method.implementation!!.instructions.indexOf(instruction)
val register = (instruction as OneRegisterInstruction).registerA
// inject the call to
method.removeInstruction(index)
method.addInstructions(
index, """
invoke-static {}, Lapp/revanced/integrations/patches/ForceCodecPatch;->get$name()Ljava/lang/String;
move-result-object v$register
"""
)
}
}
}

View File

@@ -17,7 +17,7 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Patch
@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
@Version("0.0.1")
class CustomVideoBufferPatch : BytecodePatch(
@@ -26,13 +26,13 @@ class CustomVideoBufferPatch : BytecodePatch(
)
) {
override fun execute(data: BytecodeData): PatchResult {
execMaxBuffer(data)
execMaxBuffer()
execPlaybackBuffer(data)
execReBuffer(data)
return PatchResultSuccess()
}
private fun execMaxBuffer(data: BytecodeData) {
private fun execMaxBuffer() {
val result = MaxBufferFingerprint.result!!
val method = result.mutableMethod
val index = result.patternScanResult!!.endIndex - 1