mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-23 02:31:03 +00:00
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8bdfe8b74f | ||
|
|
c7c9440a60 | ||
|
|
4dcd487275 | ||
|
|
68eff6fd76 | ||
|
|
9b58c642f3 | ||
|
|
f9c16396d6 | ||
|
|
7c528856e1 | ||
|
|
29c18ad537 | ||
|
|
1654d4121b | ||
|
|
05c6c9e683 | ||
|
|
facb808e37 | ||
|
|
fe1427b88a | ||
|
|
634c6c3344 | ||
|
|
d438d9b866 | ||
|
|
e4139a112e | ||
|
|
559d7ad50c | ||
|
|
e1bbe59b40 | ||
|
|
2f932d697b | ||
|
|
237129d327 | ||
|
|
e4d7dc0aa9 | ||
|
|
fed9e4aafa | ||
|
|
85aa45d3f2 | ||
|
|
16df8d5ebc | ||
|
|
e89c3dad39 | ||
|
|
0f78f621c7 |
78
CHANGELOG.md
78
CHANGELOG.md
@@ -1,3 +1,81 @@
|
|||||||
|
## [2.76.3](https://github.com/revanced/revanced-patches/compare/v2.76.2...v2.76.3) (2022-10-01)
|
||||||
|
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* **general-ads:** hook pathBuilder ([b9bad0b](https://github.com/revanced/revanced-patches/commit/b9bad0bb922bbd44ddf2acbfae87243beb28851a))
|
||||||
|
|
||||||
|
## [2.76.2](https://github.com/revanced/revanced-patches/compare/v2.76.1...v2.76.2) (2022-09-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **twitter/monochrome-icon:** add missing `File.write` call ([#682](https://github.com/revanced/revanced-patches/issues/682)) ([de22e3f](https://github.com/revanced/revanced-patches/commit/de22e3f03ef1d6db08f9446f02e687721d9017d7))
|
||||||
|
|
||||||
|
## [2.76.1](https://github.com/revanced/revanced-patches/compare/v2.76.0...v2.76.1) (2022-09-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **disable-startup-shorts-player:** remove redundant opcode pattern ([#679](https://github.com/revanced/revanced-patches/issues/679)) ([5197a24](https://github.com/revanced/revanced-patches/commit/5197a24cc5ecc1b51cdc5c00c77c873b86394994))
|
||||||
|
|
||||||
|
# [2.76.0](https://github.com/revanced/revanced-patches/compare/v2.75.2...v2.76.0) (2022-09-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* bump YouTube Music patches compatibility to v5.26.52 ([#681](https://github.com/revanced/revanced-patches/issues/681)) ([f195734](https://github.com/revanced/revanced-patches/commit/f195734925dd41596d058f9cbf2b7e619a8d5833))
|
||||||
|
|
||||||
|
## [2.75.2](https://github.com/revanced/revanced-patches/compare/v2.75.1...v2.75.2) (2022-09-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **twitter patches.:** use wider compatible Java API for writing to file ([#678](https://github.com/revanced/revanced-patches/issues/678)) ([4448de8](https://github.com/revanced/revanced-patches/commit/4448de80a6277862d81c7a29b9489e4fbec48496))
|
||||||
|
|
||||||
|
## [2.75.1](https://github.com/revanced/revanced-patches/compare/v2.75.0...v2.75.1) (2022-09-29)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **disable-startup-shorts-player:** incorrect offsets, invert branch condition ([#672](https://github.com/revanced/revanced-patches/issues/672)) ([bfe1e38](https://github.com/revanced/revanced-patches/commit/bfe1e3808ece85fbb0785a4378ee95591115ac33))
|
||||||
|
|
||||||
|
# [2.75.0](https://github.com/revanced/revanced-patches/compare/v2.74.0...v2.75.0) (2022-09-29)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* `disable-capture-restriction` patch ([#655](https://github.com/revanced/revanced-patches/issues/655)) ([3cc26c3](https://github.com/revanced/revanced-patches/commit/3cc26c31d378c27ca7f768f777daa00e3f849dff))
|
||||||
|
|
||||||
|
# [2.74.0](https://github.com/revanced/revanced-patches/compare/v2.73.0...v2.74.0) (2022-09-29)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* `disable-startup-shorts-player` patch ([#670](https://github.com/revanced/revanced-patches/issues/670)) ([feb3bd0](https://github.com/revanced/revanced-patches/commit/feb3bd02aaf67379733d10988fd58b0c3924f88e))
|
||||||
|
|
||||||
|
# [2.73.0](https://github.com/revanced/revanced-patches/compare/v2.72.1...v2.73.0) (2022-09-29)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* `dynamic-color` patch ([#652](https://github.com/revanced/revanced-patches/issues/652)) ([a16575b](https://github.com/revanced/revanced-patches/commit/a16575b984354138b9ab175307be8d15de60b6a6))
|
||||||
|
|
||||||
|
## [2.72.1](https://github.com/revanced/revanced-patches/compare/v2.72.0...v2.72.1) (2022-09-29)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **hdr-brightness:** trim list of compatible versions ([#602](https://github.com/revanced/revanced-patches/issues/602)) ([3209d90](https://github.com/revanced/revanced-patches/commit/3209d902e4d1aa73b59ce059cf3f76ef2095af70))
|
||||||
|
|
||||||
|
# [2.72.0](https://github.com/revanced/revanced-patches/compare/v2.71.2...v2.72.0) (2022-09-29)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* `tiktok-speed` patch ([#668](https://github.com/revanced/revanced-patches/issues/668)) ([23fff16](https://github.com/revanced/revanced-patches/commit/23fff16e6ab02bf281d46d8b5f93788425d8b525))
|
||||||
|
* bump YouTube Music patches to v5.25.51 ([#669](https://github.com/revanced/revanced-patches/issues/669)) ([563c846](https://github.com/revanced/revanced-patches/commit/563c8466568d578de7c8a8e869fb1aa74370784a))
|
||||||
|
|
||||||
## [2.71.2](https://github.com/revanced/revanced-patches/compare/v2.71.1...v2.71.2) (2022-09-28)
|
## [2.71.2](https://github.com/revanced/revanced-patches/compare/v2.71.1...v2.71.2) (2022-09-28)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
25
README.md
25
README.md
@@ -19,6 +19,7 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|:--------:|:--------------:|:-----------------:|
|
||||||
| `hide-premium-navbar` | Removes the premium tab from the navbar. | all |
|
| `hide-premium-navbar` | Removes the premium tab from the navbar. | all |
|
||||||
|
| `disable-capture-restriction` | Allows capturing Spotify's audio output while screen sharing or screen recording. | all |
|
||||||
| `spotify-theme` | Applies a custom theme. | all |
|
| `spotify-theme` | Applies a custom theme. | all |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
@@ -43,6 +44,7 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|:--------:|:--------------:|:-----------------:|
|
||||||
|
| `tiktok-speed` | Enables the playback speed option for all videos. | all |
|
||||||
| `tiktok-download` | Removes download restrictions and changes the default path to download to. | all |
|
| `tiktok-download` | Removes download restrictions and changes the default path to download to. | all |
|
||||||
| `tiktok-seekbar` | Show progress bar for all video. | all |
|
| `tiktok-seekbar` | Show progress bar for all video. | all |
|
||||||
| `tiktok-force-login` | Do not force login. | all |
|
| `tiktok-force-login` | Do not force login. | all |
|
||||||
@@ -56,6 +58,7 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|:--------:|:--------------:|:-----------------:|
|
||||||
|
| `tiktok-speed` | Enables the playback speed option for all videos. | all |
|
||||||
| `tiktok-download` | Removes download restrictions and changes the default path to download to. | all |
|
| `tiktok-download` | Removes download restrictions and changes the default path to download to. | all |
|
||||||
| `tiktok-seekbar` | Show progress bar for all video. | all |
|
| `tiktok-seekbar` | Show progress bar for all video. | all |
|
||||||
| `tiktok-force-login` | Do not force login. | all |
|
| `tiktok-force-login` | Do not force login. | all |
|
||||||
@@ -70,6 +73,7 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|:--------:|:--------------:|:-----------------:|
|
||||||
| `monochrome-icon` | Adds a monochrome icon. | all |
|
| `monochrome-icon` | Adds a monochrome icon. | all |
|
||||||
|
| `dynamic-color` | Replaces the default Twitter Blue with the users Material You palette. | all |
|
||||||
| `timeline-ads` | Removes ads from the Twitter timeline. | all |
|
| `timeline-ads` | Removes ads from the Twitter timeline. | all |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
@@ -78,16 +82,16 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|:--------:|:--------------:|:-----------------:|
|
||||||
| `exclusive-audio-playback` | Enables the option to play music without video. | 5.23.50 |
|
| `exclusive-audio-playback` | Enables the option to play music without video. | 5.26.52 |
|
||||||
| `codecs-unlock` | Adds more audio codec options. The new audio codecs usually result in better audio quality. | 5.23.50 |
|
| `codecs-unlock` | Adds more audio codec options. The new audio codecs usually result in better audio quality. | 5.26.52 |
|
||||||
| `music-microg-support` | Allows YouTube Music ReVanced to run without root and under a different package name. | 5.23.50 |
|
| `music-microg-support` | Allows YouTube Music ReVanced to run without root and under a different package name. | 5.26.52 |
|
||||||
| `music-video-ads` | Removes ads in the music player. | 5.23.50 |
|
| `music-video-ads` | Removes ads in the music player. | 5.26.52 |
|
||||||
| `tasteBuilder-remover` | Removes the "Tell us which artists you like" card from the home screen. | 5.23.50 |
|
| `tasteBuilder-remover` | Removes the "Tell us which artists you like" card from the home screen. | 5.26.52 |
|
||||||
| `minimized-playback-music` | Enables minimized playback on Kids music. | 5.23.50 |
|
| `minimized-playback-music` | Enables minimized playback on Kids music. | 5.26.52 |
|
||||||
| `compact-header` | Hides the music category bar at the top of the homepage. | 5.23.50 |
|
| `compact-header` | Hides the music category bar at the top of the homepage. | 5.26.52 |
|
||||||
| `upgrade-button-remover` | Removes the upgrade tab from the pivot bar. | 5.23.50 |
|
| `upgrade-button-remover` | Removes the upgrade tab from the pivot bar. | 5.26.52 |
|
||||||
| `hide-get-premium` | Removes all "Get Premium" evidences from the avatar menu. | 5.23.50 |
|
| `hide-get-premium` | Removes all "Get Premium" evidences from the avatar menu. | 5.26.52 |
|
||||||
| `background-play` | Enables playing music in the background. | 5.23.50 |
|
| `background-play` | Enables playing music in the background. | 5.26.52 |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
### 📦 `com.google.android.youtube`
|
### 📦 `com.google.android.youtube`
|
||||||
@@ -116,6 +120,7 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `enable-wide-searchbar` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | 17.36.37 |
|
| `enable-wide-searchbar` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | 17.36.37 |
|
||||||
| `disable-fullscreen-panels` | Disables video description and comments panel in fullscreen view. | 17.36.37 |
|
| `disable-fullscreen-panels` | Disables video description and comments panel in fullscreen view. | 17.36.37 |
|
||||||
| `hide-autoplay-button` | Hides the autoplay button in the video player. | 17.36.37 |
|
| `hide-autoplay-button` | Hides the autoplay button in the video player. | 17.36.37 |
|
||||||
|
| `disable-startup-shorts-player` | Disables playing YouTube Shorts when launching YouTube. | 17.36.37 |
|
||||||
| `premium-heading` | Shows premium branding on the home screen. | all |
|
| `premium-heading` | Shows premium branding on the home screen. | all |
|
||||||
| `custom-branding` | Changes the YouTube launcher icon and name to your choice (defaults to ReVanced). | all |
|
| `custom-branding` | Changes the YouTube launcher icon and name to your choice (defaults to ReVanced). | all |
|
||||||
| `hide-create-button` | Hides the create button in the navigation bar. | 17.36.37 |
|
| `hide-create-button` | Hides the create button in the navigation bar. | 17.36.37 |
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("app.revanced:revanced-patcher:5.1.0")
|
implementation("app.revanced:revanced-patcher:5.1.2")
|
||||||
implementation("app.revanced:multidexlib2:2.5.2.r2")
|
implementation("app.revanced:multidexlib2:2.5.2.r2")
|
||||||
// Required for meta
|
// Required for meta
|
||||||
implementation("com.google.code.gson:gson:2.9.1")
|
implementation("com.google.code.gson:gson:2.9.1")
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.71.2
|
version = 2.76.3
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -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", "5.17.51", "5.21.52", "5.22.54", "5.23.50")
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51", "5.21.52", "5.22.54", "5.23.50", "5.25.51", "5.25.52", "5.26.52")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
|||||||
@@ -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", "5.17.51", "5.21.52", "5.22.54", "5.23.50")
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51", "5.21.52", "5.22.54", "5.23.50", "5.25.51", "5.25.52", "5.26.52")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
|||||||
@@ -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", "5.17.51", "5.21.52", "5.22.54", "5.23.50")
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51", "5.21.52", "5.22.54", "5.23.50", "5.25.51", "5.25.52", "5.26.52")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
|||||||
@@ -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", "5.21.52", "5.22.54", "5.23.50")
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.21.52", "5.22.54", "5.23.50", "5.25.51", "5.25.52", "5.26.52")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
|||||||
@@ -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", "5.17.51", "5.21.52", "5.22.54", "5.23.50")
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51", "5.21.52", "5.22.54", "5.23.50", "5.25.51", "5.25.52", "5.26.52")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
|||||||
@@ -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", "5.17.51", "5.21.52", "5.22.54", "5.23.50")
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51", "5.21.52", "5.22.54", "5.23.50", "5.25.51", "5.25.52", "5.26.52")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import app.revanced.patcher.annotation.Package
|
|||||||
*/
|
*/
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package(
|
[Package(
|
||||||
"com.google.android.apps.youtube.music", arrayOf("5.21.52", "5.22.54", "5.23.50")
|
"com.google.android.apps.youtube.music", arrayOf("5.21.52", "5.22.54", "5.23.50", "5.25.51", "5.25.52", "5.26.52")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
|||||||
@@ -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", "5.17.51", "5.21.52", "5.22.54", "5.23.50")
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51", "5.21.52", "5.22.54", "5.23.50", "5.25.51", "5.25.52", "5.26.52")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
|||||||
@@ -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", "5.17.51", "5.21.52", "5.22.54", "5.23.50")
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51", "5.21.52", "5.22.54", "5.23.50", "5.25.51", "5.25.52", "5.26.52")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
|||||||
@@ -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", "5.17.51", "5.21.52", "5.22.54", "5.23.50")
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51", "5.21.52", "5.22.54", "5.23.50", "5.25.51", "5.25.52", "5.26.52")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package app.revanced.patches.spotify.audio.annotation
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility(
|
||||||
|
[Package("com.spotify.music")]
|
||||||
|
)
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class DisableCaptureRestrictionCompatibility
|
||||||
|
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package app.revanced.patches.spotify.audio.bytecode.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.instruction
|
||||||
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
|
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.spotify.audio.annotation.DisableCaptureRestrictionCompatibility
|
||||||
|
import app.revanced.patches.spotify.audio.fingerprints.DisableCaptureRestrictionAudioDriverFingerprint
|
||||||
|
import app.revanced.patches.spotify.audio.resource.patch.DisableCaptureRestrictionResourcePatch
|
||||||
|
import org.jf.dexlib2.iface.instruction.Instruction
|
||||||
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("disable-capture-restriction")
|
||||||
|
@DependsOn([DisableCaptureRestrictionResourcePatch::class])
|
||||||
|
@Description("Allows capturing Spotify's audio output while screen sharing or screen recording.")
|
||||||
|
@DisableCaptureRestrictionCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class DisableCaptureRestrictionBytecodePatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
DisableCaptureRestrictionAudioDriverFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
private fun MutableMethod.replaceConstant4Instruction(index: Int, instruction: Instruction, with: Int) {
|
||||||
|
val register = (instruction as OneRegisterInstruction).registerA
|
||||||
|
this.replaceInstruction(
|
||||||
|
index, "const/4 v$register, $with"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
|
val method = DisableCaptureRestrictionAudioDriverFingerprint.result!!.mutableMethod
|
||||||
|
|
||||||
|
// Replace constant that contains the capture policy parameter for AudioAttributesBuilder.setAllowedCapturePolicy()
|
||||||
|
val instruction = method.instruction(CONST_INSTRUCTION_POSITION)
|
||||||
|
method.replaceConstant4Instruction(CONST_INSTRUCTION_POSITION, instruction, ALLOW_CAPTURE_BY_ALL)
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
private companion object {
|
||||||
|
const val CONST_INSTRUCTION_POSITION = 2
|
||||||
|
const val ALLOW_CAPTURE_BY_ALL = 0x01
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package app.revanced.patches.spotify.audio.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.spotify.audio.annotation.DisableCaptureRestrictionCompatibility
|
||||||
|
|
||||||
|
@Name("disable-capture-restriction-audio-driver-fingerprint")
|
||||||
|
@MatchingMethod(
|
||||||
|
"Lcom/spotify/playback/playbacknative/AudioDriver;", "constructAudioAttributes"
|
||||||
|
)
|
||||||
|
@DirectPatternScanMethod
|
||||||
|
@DisableCaptureRestrictionCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object DisableCaptureRestrictionAudioDriverFingerprint : MethodFingerprint(
|
||||||
|
customFingerprint = { methodDef ->
|
||||||
|
methodDef.definingClass == "Lcom/spotify/playback/playbacknative/AudioDriver;" && methodDef.name == "constructAudioAttributes"
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package app.revanced.patches.spotify.audio.resource.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.ResourceData
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.patch.impl.ResourcePatch
|
||||||
|
import app.revanced.patches.spotify.audio.annotation.DisableCaptureRestrictionCompatibility
|
||||||
|
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||||
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
|
@Name("disable-capture-restriction-resource-patch")
|
||||||
|
@Description("Sets allowAudioPlaybackCapture in manifest to true.")
|
||||||
|
@DisableCaptureRestrictionCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class DisableCaptureRestrictionResourcePatch : ResourcePatch() {
|
||||||
|
override fun execute(data: ResourceData): PatchResult {
|
||||||
|
// create an xml editor instance
|
||||||
|
data.xmlEditor["AndroidManifest.xml"].use { dom ->
|
||||||
|
// get the application node
|
||||||
|
val applicationNode = dom
|
||||||
|
.file
|
||||||
|
.getElementsByTagName("application")
|
||||||
|
.item(0) as Element
|
||||||
|
|
||||||
|
// set allowAudioPlaybackCapture attribute to true
|
||||||
|
applicationNode.setAttribute("android:allowAudioPlaybackCapture", "true")
|
||||||
|
}
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package app.revanced.patches.tiktok.interaction.speed.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility(
|
||||||
|
[
|
||||||
|
Package("com.ss.android.ugc.trill"),
|
||||||
|
Package("com.zhiliaoapp.musically")
|
||||||
|
]
|
||||||
|
)
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class SpeedCompatibility
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package app.revanced.patches.tiktok.interaction.speed.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.tiktok.interaction.speed.annotations.SpeedCompatibility
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
@Name("speed-control-parent-fingerprint")
|
||||||
|
@MatchingMethod("LX/4cP;", "LJIILL")
|
||||||
|
@SpeedCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object SpeedControlParentFingerprint : MethodFingerprint(
|
||||||
|
returnType = "L",
|
||||||
|
access = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
||||||
|
parameters = listOf(
|
||||||
|
"L"
|
||||||
|
),
|
||||||
|
strings = listOf(
|
||||||
|
"playback_speed"
|
||||||
|
)
|
||||||
|
)
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package app.revanced.patches.tiktok.interaction.speed.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.data.impl.toMethodWalker
|
||||||
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
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.tiktok.interaction.speed.annotations.SpeedCompatibility
|
||||||
|
import app.revanced.patches.tiktok.interaction.speed.fingerprints.SpeedControlParentFingerprint
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("tiktok-speed")
|
||||||
|
@Description("Enables the playback speed option for all videos.")
|
||||||
|
@SpeedCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class SpeedPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
SpeedControlParentFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
|
val parentMethod = SpeedControlParentFingerprint.result!!.mutableMethod
|
||||||
|
val parentMethodInstructions = parentMethod.implementation!!.instructions
|
||||||
|
for ((index, instruction) in parentMethodInstructions.withIndex()) {
|
||||||
|
if (instruction.opcode != Opcode.INVOKE_VIRTUAL) continue
|
||||||
|
val isSpeedEnableMethod = data
|
||||||
|
.toMethodWalker(parentMethod)
|
||||||
|
.nextMethod(index, true)
|
||||||
|
.getMethod() as MutableMethod
|
||||||
|
isSpeedEnableMethod.addInstructions(
|
||||||
|
0,
|
||||||
|
"""
|
||||||
|
const/4 v0, 0x1
|
||||||
|
return v0
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package app.revanced.patches.twitter.misc.dynamiccolor.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility([Package("com.twitter.android")])
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class DynamicColorCompatibility
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package app.revanced.patches.twitter.misc.dynamiccolor.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.ResourceData
|
||||||
|
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.ResourcePatch
|
||||||
|
import app.revanced.patches.twitter.misc.dynamiccolor.annotations.DynamicColorCompatibility
|
||||||
|
import java.io.FileWriter
|
||||||
|
import java.nio.file.Files
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("dynamic-color")
|
||||||
|
@Description("Replaces the default Twitter Blue with the users Material You palette.")
|
||||||
|
@DynamicColorCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class DynamicColorPatch : ResourcePatch() {
|
||||||
|
override fun execute(data: ResourceData): PatchResult {
|
||||||
|
val resDirectory = data["res"]
|
||||||
|
if (!resDirectory.isDirectory) return PatchResultError("The res folder can not be found.")
|
||||||
|
|
||||||
|
val valuesV31Directory = resDirectory.resolve("values-v31")
|
||||||
|
if (!valuesV31Directory.isDirectory) Files.createDirectories(valuesV31Directory.toPath())
|
||||||
|
|
||||||
|
val valuesNightV31Directory = resDirectory.resolve("values-night-v31")
|
||||||
|
if (!valuesNightV31Directory.isDirectory) Files.createDirectories(valuesNightV31Directory.toPath())
|
||||||
|
|
||||||
|
listOf(valuesV31Directory, valuesNightV31Directory).forEach { it ->
|
||||||
|
val colorsXml = it.resolve("colors.xml")
|
||||||
|
|
||||||
|
if(!colorsXml.exists()) {
|
||||||
|
FileWriter(colorsXml).use {
|
||||||
|
it.write("<?xml version=\"1.0\" encoding=\"utf-8\"?><resources></resources>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data.xmlEditor["res/values-v31/colors.xml"].use { editor ->
|
||||||
|
val document = editor.file
|
||||||
|
|
||||||
|
mapOf(
|
||||||
|
"ps__twitter_blue" to "@color/twitter_blue",
|
||||||
|
"ps__twitter_blue_pressed" to "@color/twitter_blue_fill_pressed",
|
||||||
|
"twitter_blue" to "@android:color/system_accent1_400",
|
||||||
|
"twitter_blue_fill_pressed" to "@android:color/system_accent1_300",
|
||||||
|
"twitter_blue_opacity_30" to "@android:color/system_accent1_100",
|
||||||
|
"twitter_blue_opacity_50" to "@android:color/system_accent1_200",
|
||||||
|
"twitter_blue_opacity_58" to "@android:color/system_accent1_300",
|
||||||
|
"deep_transparent_twitter_blue" to "@android:color/system_accent1_200",
|
||||||
|
"ic_launcher_background" to "#1DA1F2"
|
||||||
|
).forEach { (k, v) ->
|
||||||
|
val colorElement = document.createElement("color")
|
||||||
|
|
||||||
|
colorElement.setAttribute("name", k)
|
||||||
|
colorElement.textContent = v
|
||||||
|
|
||||||
|
document.getElementsByTagName("resources").item(0).appendChild(colorElement)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data.xmlEditor["res/values-night-v31/colors.xml"].use { editor ->
|
||||||
|
val document = editor.file
|
||||||
|
|
||||||
|
mapOf(
|
||||||
|
"twitter_blue" to "@android:color/system_accent1_200",
|
||||||
|
"twitter_blue_fill_pressed" to "@android:color/system_accent1_300",
|
||||||
|
"twitter_blue_opacity_30" to "@android:color/system_accent1_50",
|
||||||
|
"twitter_blue_opacity_50" to "@android:color/system_accent1_100",
|
||||||
|
"twitter_blue_opacity_58" to "@android:color/system_accent1_200",
|
||||||
|
"deep_transparent_twitter_blue" to "@android:color/system_accent1_200"
|
||||||
|
).forEach { (k, v) ->
|
||||||
|
val colorElement = document.createElement("color")
|
||||||
|
|
||||||
|
colorElement.setAttribute("name", k)
|
||||||
|
colorElement.textContent = v
|
||||||
|
|
||||||
|
document.getElementsByTagName("resources").item(0).appendChild(colorElement)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,6 @@ package app.revanced.patches.twitter.misc.monochrome.patch
|
|||||||
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.DomFileEditor
|
|
||||||
import app.revanced.patcher.data.impl.ResourceData
|
import app.revanced.patcher.data.impl.ResourceData
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
import app.revanced.patcher.patch.PatchResultError
|
||||||
@@ -11,6 +10,7 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
|||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patcher.patch.impl.ResourcePatch
|
import app.revanced.patcher.patch.impl.ResourcePatch
|
||||||
import app.revanced.patches.twitter.misc.monochrome.annotations.MonochromeIconCompatibility
|
import app.revanced.patches.twitter.misc.monochrome.annotations.MonochromeIconCompatibility
|
||||||
|
import java.io.FileWriter
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@@ -26,27 +26,29 @@ class MonochromeIconPatch : ResourcePatch() {
|
|||||||
val mipmapV33Directory = resDirectory.resolve("mipmap-anydpi-v33")
|
val mipmapV33Directory = resDirectory.resolve("mipmap-anydpi-v33")
|
||||||
if (!mipmapV33Directory.isDirectory) Files.createDirectories(mipmapV33Directory.toPath())
|
if (!mipmapV33Directory.isDirectory) Files.createDirectories(mipmapV33Directory.toPath())
|
||||||
|
|
||||||
Files.writeString(
|
FileWriter(mipmapV33Directory.resolve("ic_launcher_twitter.xml")).use {
|
||||||
mipmapV33Directory.resolve("ic_launcher_twitter.xml").toPath(),
|
it.write(
|
||||||
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
|
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
|
||||||
"<adaptive-icon\n" +
|
"<adaptive-icon\n" +
|
||||||
" xmlns:android=\"http://schemas.android.com/apk/res/android\">\n" +
|
" xmlns:android=\"http://schemas.android.com/apk/res/android\">\n" +
|
||||||
" <background android:drawable=\"@color/ic_launcher_background\" />\n" +
|
" <background android:drawable=\"@color/ic_launcher_background\" />\n" +
|
||||||
" <foreground android:drawable=\"@mipmap/ic_launcher_twitter_foreground\" />\n" +
|
" <foreground android:drawable=\"@mipmap/ic_launcher_twitter_foreground\" />\n" +
|
||||||
" <monochrome android:drawable=\"@mipmap/ic_launcher_twitter_foreground\" />\n" +
|
" <monochrome android:drawable=\"@mipmap/ic_launcher_twitter_foreground\" />\n" +
|
||||||
"</adaptive-icon>"
|
"</adaptive-icon>"
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
Files.writeString(
|
FileWriter(mipmapV33Directory.resolve("ic_launcher_twitter_round.xml")).use {
|
||||||
mipmapV33Directory.resolve("ic_launcher_twitter_round.xml").toPath(),
|
it.write(
|
||||||
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
|
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
|
||||||
"<adaptive-icon\n" +
|
"<adaptive-icon\n" +
|
||||||
" xmlns:android=\"http://schemas.android.com/apk/res/android\">\n" +
|
" xmlns:android=\"http://schemas.android.com/apk/res/android\">\n" +
|
||||||
" <background android:drawable=\"@color/ic_launcher_background\" />\n" +
|
" <background android:drawable=\"@color/ic_launcher_background\" />\n" +
|
||||||
" <foreground android:drawable=\"@mipmap/ic_launcher_twitter_foreground\" />\n" +
|
" <foreground android:drawable=\"@mipmap/ic_launcher_twitter_foreground\" />\n" +
|
||||||
" <monochrome android:drawable=\"@mipmap/ic_launcher_twitter_foreground\" />\n" +
|
" <monochrome android:drawable=\"@mipmap/ic_launcher_twitter_foreground\" />\n" +
|
||||||
"</adaptive-icon>"
|
"</adaptive-icon>"
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
package app.revanced.patches.youtube.ad.general.bytecode.extensions
|
package app.revanced.patches.youtube.ad.general.bytecode.extensions
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
|
||||||
import app.revanced.patcher.extensions.softCompareTo
|
import app.revanced.patcher.extensions.softCompareTo
|
||||||
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.MutableClass
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
|
||||||
import org.jf.dexlib2.builder.BuilderInstruction
|
|
||||||
import org.jf.dexlib2.builder.MutableMethodImplementation
|
|
||||||
import org.jf.dexlib2.iface.Method
|
import org.jf.dexlib2.iface.Method
|
||||||
import org.jf.dexlib2.iface.instruction.Instruction
|
import org.jf.dexlib2.iface.instruction.Instruction
|
||||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
@@ -16,21 +12,6 @@ import org.jf.dexlib2.iface.reference.Reference
|
|||||||
import org.jf.dexlib2.immutable.reference.ImmutableMethodReference
|
import org.jf.dexlib2.immutable.reference.ImmutableMethodReference
|
||||||
|
|
||||||
internal object MethodExtensions {
|
internal object MethodExtensions {
|
||||||
internal fun MutableMethodImplementation.insertBlocks(
|
|
||||||
startIndex: Int,
|
|
||||||
vararg blocks: List<BuilderInstruction>,
|
|
||||||
) {
|
|
||||||
blocks.reversed().forEach {
|
|
||||||
this.addInstructions(
|
|
||||||
startIndex, it
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun MutableClass.addMethod(mutableMethod: MutableMethod) {
|
|
||||||
this.methods.add(mutableMethod)
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun MutableClass.findMutableMethodOf(
|
internal fun MutableClass.findMutableMethodOf(
|
||||||
method: Method
|
method: Method
|
||||||
) = this.methods.first {
|
) = this.methods.first {
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ 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.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
import app.revanced.patcher.patch.PatchResultError
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
@@ -14,23 +17,18 @@ 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.MutableClass
|
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.toInstructions
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
import app.revanced.patches.youtube.ad.general.annotation.GeneralAdsCompatibility
|
import app.revanced.patches.youtube.ad.general.annotation.GeneralAdsCompatibility
|
||||||
import app.revanced.patches.youtube.ad.general.bytecode.extensions.MethodExtensions.addMethod
|
|
||||||
import app.revanced.patches.youtube.ad.general.bytecode.extensions.MethodExtensions.findMutableMethodOf
|
import app.revanced.patches.youtube.ad.general.bytecode.extensions.MethodExtensions.findMutableMethodOf
|
||||||
import app.revanced.patches.youtube.ad.general.bytecode.extensions.MethodExtensions.insertBlocks
|
|
||||||
import app.revanced.patches.youtube.ad.general.bytecode.extensions.MethodExtensions.toDescriptor
|
import app.revanced.patches.youtube.ad.general.bytecode.extensions.MethodExtensions.toDescriptor
|
||||||
import app.revanced.patches.youtube.ad.general.bytecode.utils.MethodUtils.createMutableMethod
|
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch
|
import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.builder.MutableMethodImplementation
|
import org.jf.dexlib2.builder.instruction.BuilderInstruction10x
|
||||||
import org.jf.dexlib2.builder.instruction.*
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.MethodImplementation
|
|
||||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction21c
|
import org.jf.dexlib2.iface.instruction.formats.Instruction21c
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction22c
|
import org.jf.dexlib2.iface.instruction.formats.Instruction22c
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
|
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
|
||||||
@@ -38,7 +36,6 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
|||||||
import org.jf.dexlib2.iface.reference.FieldReference
|
import org.jf.dexlib2.iface.reference.FieldReference
|
||||||
import org.jf.dexlib2.iface.reference.MethodReference
|
import org.jf.dexlib2.iface.reference.MethodReference
|
||||||
import org.jf.dexlib2.iface.reference.StringReference
|
import org.jf.dexlib2.iface.reference.StringReference
|
||||||
import org.jf.dexlib2.immutable.reference.ImmutableMethodReference
|
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@DependsOn([ResourceMappingResourcePatch::class, IntegrationsPatch::class, SettingsPatch::class])
|
@DependsOn([ResourceMappingResourcePatch::class, IntegrationsPatch::class, SettingsPatch::class])
|
||||||
@@ -170,13 +167,6 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
|
|||||||
StringResource("revanced_adremover_paid_content_enabled_summary_on", "Paid content is hidden"),
|
StringResource("revanced_adremover_paid_content_enabled_summary_on", "Paid content is hidden"),
|
||||||
StringResource("revanced_adremover_paid_content_enabled_summary_off", "Paid content is shown")
|
StringResource("revanced_adremover_paid_content_enabled_summary_off", "Paid content is shown")
|
||||||
),
|
),
|
||||||
SwitchPreference(
|
|
||||||
"revanced_adremover_suggested",
|
|
||||||
StringResource("revanced_adremover_suggested_enabled_title", "Remove personal suggestions"),
|
|
||||||
true,
|
|
||||||
StringResource("revanced_adremover_suggested_enabled_summary_on", "Personal suggestions are hidden"),
|
|
||||||
StringResource("revanced_adremover_suggested_enabled_summary_off", "Personal suggestions are shown")
|
|
||||||
),
|
|
||||||
SwitchPreference(
|
SwitchPreference(
|
||||||
"revanced_adremover_hide_suggestions",
|
"revanced_adremover_hide_suggestions",
|
||||||
StringResource("revanced_adremover_hide_suggestions_enabled_title", "Hide suggestions"),
|
StringResource("revanced_adremover_hide_suggestions_enabled_title", "Hide suggestions"),
|
||||||
@@ -329,72 +319,54 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stringReferences[2] -> { // Litho ads
|
stringReferences[2] -> { // Litho ads
|
||||||
// create proxied method.
|
|
||||||
val proxy = data.proxy(classDef)
|
val proxy = data.proxy(classDef)
|
||||||
val proxiedClass = proxy.resolve()
|
val proxiedClass = proxy.resolve()
|
||||||
|
|
||||||
// add getIsEmpty method
|
|
||||||
proxiedClass.addGetIsEmptyMethod()
|
|
||||||
|
|
||||||
// get required method to patch and get references from
|
|
||||||
val lithoMethod = getLithoMethod(proxiedClass)
|
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!!
|
|
||||||
|
|
||||||
// create and add getTemplateName method
|
val instructionWithNeededDescriptor =
|
||||||
val getTemplateMethod =
|
lithoMethod.implementation!!.instructions.indexOfFirst {
|
||||||
proxiedClass.createGetTemplateNameMethod(lithoMethodImplementation)
|
it.opcode == Opcode.INVOKE_STATIC_RANGE
|
||||||
proxiedClass.addMethod(getTemplateMethod)
|
}
|
||||||
|
|
||||||
val lithoInstructions = lithoMethodImplementation.instructions
|
// get required descriptors
|
||||||
val thisType = proxiedClass.type
|
val createEmptyComponentDescriptor =
|
||||||
val templateNameParameterType = getTemplateMethod.parameterTypes.first()
|
lithoMethod.instruction(instructionWithNeededDescriptor)
|
||||||
|
.toDescriptor<MethodReference>()
|
||||||
|
val emptyComponentFieldDescriptor =
|
||||||
|
lithoMethod.instruction(instructionWithNeededDescriptor + 2)
|
||||||
|
.toDescriptor<FieldReference>()
|
||||||
|
|
||||||
// get reference descriptors
|
val pathBuilderAnchorFingerprint = object : MethodFingerprint(
|
||||||
val indexOfReference1 = lithoInstructions.indexOfFirst {
|
opcodes = listOf(
|
||||||
it.opcode == Opcode.INVOKE_STATIC_RANGE
|
Opcode.CONST_16,
|
||||||
}
|
Opcode.INVOKE_VIRTUAL,
|
||||||
val descriptor1 =
|
Opcode.IPUT_OBJECT
|
||||||
lithoInstructions.elementAt(indexOfReference1).toDescriptor<MethodReference>()
|
)
|
||||||
val descriptor2 = lithoInstructions.elementAt(indexOfReference1 + 2)
|
) {}
|
||||||
.toDescriptor<FieldReference>()
|
|
||||||
|
|
||||||
// create label
|
val pathBuilderScanResult = pathBuilderAnchorFingerprint.also {
|
||||||
val lithoRemoveLabel = lithoMethodImplementation.newLabelForIndex(0)
|
it.resolve(data, lithoMethod, classDef)
|
||||||
|
}.result!!.scanResult.patternScanResult!!
|
||||||
|
|
||||||
// create branch instructions
|
val clobberedRegister =
|
||||||
val ifEqzFirstInstruction =
|
(lithoMethod.instruction(pathBuilderScanResult.startIndex) as OneRegisterInstruction).registerA
|
||||||
BuilderInstruction21t(Opcode.IF_EQZ, 0, lithoRemoveLabel)
|
|
||||||
val ifEqzSecondInstruction =
|
|
||||||
BuilderInstruction21t(Opcode.IF_EQZ, 1, lithoRemoveLabel)
|
|
||||||
|
|
||||||
// create blocks
|
val insertIndex = pathBuilderScanResult.endIndex + 1
|
||||||
val block1 = """
|
lithoMethod.addInstructions(
|
||||||
invoke-static/range {p3}, $thisType->getTemplateName($templateNameParameterType)Ljava/lang/String;
|
insertIndex, // right after setting the component.pathBuilder field,
|
||||||
move-result-object v0
|
"""
|
||||||
""".toInstructions(lithoMethod)
|
invoke-static {v5}, Lapp/revanced/integrations/patches/GeneralBytecodeAdsPatch;->isAdComponent(Ljava/lang/StringBuilder;)Z
|
||||||
val block2 = """
|
move-result v$clobberedRegister
|
||||||
move-object/from16 v1, p3
|
if-eqz v$clobberedRegister, :not_an_ad
|
||||||
iget-object v2, v1, $templateNameParameterType->b:Ljava/nio/ByteBuffer;
|
move-object/from16 v2, p1
|
||||||
invoke-static {v0, v2}, Lapp/revanced/integrations/patches/GeneralBytecodeAdsPatch;->containsAd(Ljava/lang/String;Ljava/nio/ByteBuffer;)Z
|
invoke-static {v2}, $createEmptyComponentDescriptor
|
||||||
move-result v1
|
move-result-object v0
|
||||||
""".toInstructions(lithoMethod)
|
iget-object v0, v0, $emptyComponentFieldDescriptor
|
||||||
val block3 = """
|
return-object v0
|
||||||
move-object/from16 v2, p1
|
""",
|
||||||
invoke-static {v2}, $descriptor1
|
listOf(ExternalLabel("not_an_ad", lithoMethod.instruction(insertIndex)))
|
||||||
move-result-object v0
|
|
||||||
iget-object v0, v0, $descriptor2
|
|
||||||
return-object v0
|
|
||||||
""".toInstructions(lithoMethod)
|
|
||||||
|
|
||||||
// insert blocks and branch instructions
|
|
||||||
lithoMethodImplementation.insertBlocks(
|
|
||||||
0,
|
|
||||||
block1,
|
|
||||||
listOf(ifEqzFirstInstruction),
|
|
||||||
block2,
|
|
||||||
listOf(ifEqzSecondInstruction),
|
|
||||||
block3,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -414,142 +386,4 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
|
|||||||
instruction.opcode == Opcode.CONST && (instruction as Instruction31i).narrowLiteral == lithoConstant
|
instruction.opcode == Opcode.CONST && (instruction as Instruction31i).narrowLiteral == lithoConstant
|
||||||
} ?: false
|
} ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun MutableClass.addGetIsEmptyMethod() {
|
|
||||||
val getIsEmptyImplementation = MutableMethodImplementation(1)
|
|
||||||
|
|
||||||
// create target instructions
|
|
||||||
val firstTargetInstruction = BuilderInstruction11n(Opcode.CONST_4, 0, 1)
|
|
||||||
val secondTargetInstruction = BuilderInstruction11n(Opcode.CONST_4, 0, 0)
|
|
||||||
|
|
||||||
// add instructions to the instruction list
|
|
||||||
getIsEmptyImplementation.addInstructions(
|
|
||||||
0, listOf(
|
|
||||||
// BuilderInstruction21t(Opcode.IF_EQZ, 0, first),
|
|
||||||
BuilderInstruction35c(
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
ImmutableMethodReference("Ljava/lang/String;", "isEmpty", null, "Z")
|
|
||||||
),
|
|
||||||
BuilderInstruction11x(Opcode.MOVE_RESULT, 0),
|
|
||||||
// BuilderInstruction21t(Opcode.IF_EQZ, 0, second),
|
|
||||||
// BuilderInstruction10t(Opcode.GOTO, first),
|
|
||||||
secondTargetInstruction,
|
|
||||||
BuilderInstruction11x(Opcode.RETURN, 0),
|
|
||||||
firstTargetInstruction,
|
|
||||||
BuilderInstruction11x(Opcode.RETURN, 0),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
val getIsEmptyInstructions = getIsEmptyImplementation.instructions
|
|
||||||
|
|
||||||
// create labels for the target instructions
|
|
||||||
val firstLabel =
|
|
||||||
getIsEmptyImplementation.newLabelForIndex(getIsEmptyInstructions.indexOf(firstTargetInstruction))
|
|
||||||
val secondLabel =
|
|
||||||
getIsEmptyImplementation.newLabelForIndex(getIsEmptyInstructions.indexOf(secondTargetInstruction))
|
|
||||||
|
|
||||||
// create branch instructions to the labels
|
|
||||||
val ifEqzFirstInstruction = BuilderInstruction21t(Opcode.IF_EQZ, 0, firstLabel)
|
|
||||||
val ifEqzSecondInstruction = BuilderInstruction21t(Opcode.IF_EQZ, 0, secondLabel)
|
|
||||||
val gotoInstruction = BuilderInstruction10t(Opcode.GOTO, firstLabel)
|
|
||||||
|
|
||||||
// insert remaining branch instructions, order of adding those instructions is important
|
|
||||||
getIsEmptyImplementation.addInstructions(
|
|
||||||
2, listOf(
|
|
||||||
ifEqzSecondInstruction, gotoInstruction
|
|
||||||
)
|
|
||||||
)
|
|
||||||
getIsEmptyImplementation.addInstruction(
|
|
||||||
0, ifEqzFirstInstruction
|
|
||||||
)
|
|
||||||
|
|
||||||
this.addMethod(
|
|
||||||
createMutableMethod(
|
|
||||||
this.type, "getIsEmpty", "Z", "Ljava/lang/String;", getIsEmptyImplementation
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun MutableClass.createGetTemplateNameMethod(lithoMethodImplementation: MethodImplementation): MutableMethod {
|
|
||||||
var counter = 1
|
|
||||||
val descriptors = buildList {
|
|
||||||
for (instruction in lithoMethodImplementation.instructions) {
|
|
||||||
if (instruction !is ReferenceInstruction) continue
|
|
||||||
if (counter++ > 4) break
|
|
||||||
|
|
||||||
add(instruction.toDescriptor<MethodReference>())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val getTemplateNameImplementation = MutableMethodImplementation(2)
|
|
||||||
|
|
||||||
// create code blocks
|
|
||||||
val block1 = """
|
|
||||||
invoke-virtual {p0}, ${descriptors[0]}
|
|
||||||
move-result-object p0
|
|
||||||
const v0, $lithoConstant
|
|
||||||
invoke-static {p0, v0}, ${descriptors[1]}
|
|
||||||
move-result-object p0
|
|
||||||
""".toInstructions()
|
|
||||||
val block2 = """
|
|
||||||
invoke-static {p0}, ${descriptors[2]}
|
|
||||||
move-result-object p0
|
|
||||||
invoke-virtual {p0}, ${descriptors[3]}
|
|
||||||
move-result-object v0
|
|
||||||
invoke-static {v0}, ${this.type}->getIsEmpty(Ljava/lang/String;)Z
|
|
||||||
move-result v0
|
|
||||||
""".toInstructions()
|
|
||||||
val block3 = """
|
|
||||||
invoke-virtual {p0}, ${descriptors[3]}
|
|
||||||
move-result-object p0
|
|
||||||
return-object p0
|
|
||||||
""".toInstructions()
|
|
||||||
|
|
||||||
// create target instruction
|
|
||||||
val targetInstruction = BuilderInstruction11n(Opcode.CONST_4, 1, 0)
|
|
||||||
// and remaining instruction
|
|
||||||
val returnInstruction = BuilderInstruction11x(Opcode.RETURN_OBJECT, 1)
|
|
||||||
|
|
||||||
// insert blocks and instructions
|
|
||||||
getTemplateNameImplementation.insertBlocks(
|
|
||||||
0,
|
|
||||||
block1,
|
|
||||||
block2,
|
|
||||||
block3,
|
|
||||||
listOf(
|
|
||||||
targetInstruction, returnInstruction
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
// create label for target instruction
|
|
||||||
val targetInstructionLabel =
|
|
||||||
getTemplateNameImplementation.newLabelForIndex(getTemplateNameImplementation.instructions.size - 2)
|
|
||||||
|
|
||||||
// create branch instructions to the label
|
|
||||||
val ifEqzInstruction = BuilderInstruction21t(Opcode.IF_EQZ, 1, targetInstructionLabel)
|
|
||||||
val ifNezInstruction = BuilderInstruction21t(Opcode.IF_NEZ, 0, targetInstructionLabel)
|
|
||||||
|
|
||||||
// insert branch instructions
|
|
||||||
getTemplateNameImplementation.addInstruction(
|
|
||||||
block1.size, ifEqzInstruction
|
|
||||||
)
|
|
||||||
getTemplateNameImplementation.addInstruction(
|
|
||||||
block1.size + block2.size + 1, ifNezInstruction
|
|
||||||
)
|
|
||||||
|
|
||||||
// create the method
|
|
||||||
return createMutableMethod(
|
|
||||||
this.type,
|
|
||||||
"getTemplateName",
|
|
||||||
"Ljava/lang/String;",
|
|
||||||
descriptors[0].split("->")[0], // a bit weird to get the type this way,
|
|
||||||
getTemplateNameImplementation
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.startupshortsreset.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility(
|
||||||
|
[Package(
|
||||||
|
"com.google.android.youtube", arrayOf("17.33.42", "17.36.37")
|
||||||
|
)]
|
||||||
|
)
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class StartupShortsResetCompatibility
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.startupshortsreset.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.startupshortsreset.annotations.StartupShortsResetCompatibility
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
@Name("action-open-shorts-fingerprint")
|
||||||
|
@MatchingMethod("Lkyt;", "l")
|
||||||
|
@StartupShortsResetCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object ActionOpenShortsFingerprint : MethodFingerprint(
|
||||||
|
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L", "L"),
|
||||||
|
strings = listOf("com.google.android.youtube.action.open.shorts"),
|
||||||
|
)
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.startupshortsreset.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.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||||
|
import app.revanced.patches.youtube.layout.startupshortsreset.annotations.StartupShortsResetCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.startupshortsreset.fingerprints.ActionOpenShortsFingerprint
|
||||||
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||||
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
||||||
|
import org.jf.dexlib2.builder.instruction.BuilderInstruction21c
|
||||||
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||||
|
@Name("disable-startup-shorts-player")
|
||||||
|
@Description("Disables playing YouTube Shorts when launching YouTube.")
|
||||||
|
@StartupShortsResetCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class DisableShortsOnStartupPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
ActionOpenShortsFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
|
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_startup_shorts_player_enabled",
|
||||||
|
StringResource("revanced_startup_shorts_player_title", "Disable shorts player at app startup"),
|
||||||
|
false,
|
||||||
|
StringResource("revanced_startup_shorts_player_summary_on", "Shorts player is disabled at app startup"),
|
||||||
|
StringResource("revanced_startup_shorts_player_summary_off", "Shorts player is enabled at app startup")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
val actionOpenShortsResult = ActionOpenShortsFingerprint.result
|
||||||
|
val actionOpenShortsMethod = actionOpenShortsResult!!.mutableMethod
|
||||||
|
val actionOpenShortsInstructions = actionOpenShortsMethod.implementation!!.instructions
|
||||||
|
|
||||||
|
val moveResultIndex = actionOpenShortsResult.scanResult.stringsScanResult!!.matches.first().index + 4
|
||||||
|
val iPutBooleanIndex = moveResultIndex + 2
|
||||||
|
|
||||||
|
val moveResultRegister = (actionOpenShortsInstructions[moveResultIndex] as OneRegisterInstruction).registerA
|
||||||
|
val iPutBooleanRegister = (actionOpenShortsInstructions[iPutBooleanIndex] as TwoRegisterInstruction).registerA
|
||||||
|
|
||||||
|
actionOpenShortsMethod.addInstructions(
|
||||||
|
moveResultIndex + 1, """
|
||||||
|
invoke-static { }, Lapp/revanced/integrations/patches/DisableStartupShortsPlayerPatch;->disableStartupShortsPlayer()Z
|
||||||
|
move-result v$moveResultRegister
|
||||||
|
if-eqz v$moveResultRegister, :cond_startup_shorts_reset
|
||||||
|
const/4 v$iPutBooleanRegister, 0x0
|
||||||
|
:cond_startup_shorts_reset
|
||||||
|
nop
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
|||||||
|
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package(
|
[Package(
|
||||||
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
"com.google.android.youtube", arrayOf("17.33.42", "17.34.35", "17.34.36", "17.36.37")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import app.revanced.patcher.annotation.Version
|
|||||||
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
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.misc.hdrbrightness.annotations.HDRBrightnessCompatibility
|
import app.revanced.patches.youtube.misc.hdrbrightness.annotations.HDRBrightnessCompatibility
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
|
||||||
@Name("hdr-brightness-fingerprint")
|
@Name("hdr-brightness-fingerprint")
|
||||||
@MatchingMethod(
|
@MatchingMethod(
|
||||||
@@ -13,6 +14,6 @@ import app.revanced.patches.youtube.misc.hdrbrightness.annotations.HDRBrightness
|
|||||||
@HDRBrightnessCompatibility
|
@HDRBrightnessCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
object HDRBrightnessFingerprint : MethodFingerprint(
|
object HDRBrightnessFingerprint : MethodFingerprint(
|
||||||
"V",
|
"V", AccessFlags.FINAL.value,
|
||||||
strings = listOf("c.SettingNotFound;", "screen_brightness", "android.mediaview", "lux"),
|
strings = listOf("c.SettingNotFound;", "screen_brightness", "android.mediaview"),
|
||||||
)
|
)
|
||||||
Reference in New Issue
Block a user