mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-12-25 10:24:08 +01:00
Compare commits
55 Commits
v2.140.1-d
...
v2.49.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e734b2231a | ||
|
|
efe06d1cdc | ||
|
|
a0f9013fab | ||
|
|
93dcd542d5 | ||
|
|
3bac23f577 | ||
|
|
febcf60efb | ||
|
|
0d74a2dfa6 | ||
|
|
5b04fbb748 | ||
|
|
fbfa0ea3be | ||
|
|
4a30afe1e2 | ||
|
|
dd1df32036 | ||
|
|
a52d674cde | ||
|
|
67f6041bab | ||
|
|
6b3f8e46fd | ||
|
|
b95058f20a | ||
|
|
5b80ac1216 | ||
|
|
6fe1bfb856 | ||
|
|
589a7c01d1 | ||
|
|
4cd6d4459a | ||
|
|
89a92b2057 | ||
|
|
9f265a46cf | ||
|
|
a740690a08 | ||
|
|
d722a64d3c | ||
|
|
abe2674290 | ||
|
|
e5ec40f6fa | ||
|
|
96c43fc6f5 | ||
|
|
4e36d72c5c | ||
|
|
6197246e8e | ||
|
|
15a044cae1 | ||
|
|
ede60b994c | ||
|
|
c15cc431d6 | ||
|
|
fb006f87ab | ||
|
|
28206fd804 | ||
|
|
e425e75152 | ||
|
|
69d6c55942 | ||
|
|
f2b29351b4 | ||
|
|
db0b468e71 | ||
|
|
b75e759348 | ||
|
|
83b41322c4 | ||
|
|
8d8878aa08 | ||
|
|
d628674cdd | ||
|
|
23b182ccbb | ||
|
|
4a784ecd6e | ||
|
|
0165b53c6d | ||
|
|
17a0e16087 | ||
|
|
8cf91f39a5 | ||
|
|
9ef93f6618 | ||
|
|
8c3866f5e3 | ||
|
|
d115d649f4 | ||
|
|
ddc789395e | ||
|
|
e1200d4e3f | ||
|
|
8276340d2b | ||
|
|
8f32af4de1 | ||
|
|
a2bc9f0722 | ||
|
|
f94bb06996 |
6
.github/workflows/release.yml
vendored
6
.github/workflows/release.yml
vendored
@@ -24,16 +24,12 @@ jobs:
|
||||
java-version: '17'
|
||||
distribution: 'adopt'
|
||||
cache: gradle
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: "lts/*"
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v2
|
||||
- name: Build with Gradle
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: ./gradlew build clean generateReadme
|
||||
run: ./gradlew build clean generateMeta
|
||||
- name: Install Android build-tools
|
||||
run: sdkmanager "build-tools;32.0.0"
|
||||
- name: Setup semantic-release
|
||||
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -114,4 +114,7 @@ gradle-app.setting
|
||||
# gradle/wrapper/gradle-wrapper.properties
|
||||
|
||||
# Potentially copyrighted test APK
|
||||
*.apk
|
||||
*.apk
|
||||
|
||||
# Ignore vscode config
|
||||
.vscode/
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
"assets": [
|
||||
"README.md",
|
||||
"CHANGELOG.md",
|
||||
"gradle.properties"
|
||||
"gradle.properties",
|
||||
"patches.json"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -33,7 +34,7 @@
|
||||
"path": "build/libs/*.jar"
|
||||
},
|
||||
{
|
||||
"path": "build/libs/*.dex"
|
||||
"path": "patches.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
180
CHANGELOG.md
180
CHANGELOG.md
@@ -1,3 +1,183 @@
|
||||
# [2.49.0](https://github.com/revanced/revanced-patches/compare/v2.48.2...v2.49.0) (2022-08-31)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* bump YouTube Music patches to v5.22.54 ([#409](https://github.com/revanced/revanced-patches/issues/409)) ([859176e](https://github.com/revanced/revanced-patches/commit/859176e3ece415243ba887424513a961fe4a5ad8))
|
||||
|
||||
## [2.48.2](https://github.com/revanced/revanced-patches/compare/v2.48.1...v2.48.2) (2022-08-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* do not constrain `amoled` patch to versions ([#408](https://github.com/revanced/revanced-patches/issues/408)) ([4af1714](https://github.com/revanced/revanced-patches/commit/4af1714dae4da40fe7488e8b734da91c978f1bdf))
|
||||
|
||||
## [2.48.1](https://github.com/revanced/revanced-patches/compare/v2.48.0...v2.48.1) (2022-08-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* don't overwrite register in `compact-header` patch ([#406](https://github.com/revanced/revanced-patches/issues/406)) ([3da8ab5](https://github.com/revanced/revanced-patches/commit/3da8ab5702f5c2a0384ce85fcb3df3b837cdc90e))
|
||||
|
||||
# [2.48.0](https://github.com/revanced/revanced-patches/compare/v2.47.0...v2.48.0) (2022-08-30)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* bump YouTube Music patches to v5.21.52 ([#404](https://github.com/revanced/revanced-patches/issues/404)) ([0abb196](https://github.com/revanced/revanced-patches/commit/0abb1960c10f03149e45e9e5074cafcc1801fc32))
|
||||
|
||||
# [2.47.0](https://github.com/revanced/revanced-patches/compare/v2.46.0...v2.47.0) (2022-08-29)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* bump youtube version to v17.33.42 ([#398](https://github.com/revanced/revanced-patches/issues/398)) ([769aa25](https://github.com/revanced/revanced-patches/commit/769aa25a6fffbff4c895ae8a291d97836ba03ed9))
|
||||
|
||||
# [2.46.0](https://github.com/revanced/revanced-patches/compare/v2.45.3...v2.46.0) (2022-08-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* `seekbar-tapping` toggling ([#401](https://github.com/revanced/revanced-patches/issues/401)) ([5550244](https://github.com/revanced/revanced-patches/commit/55502446ce5967922f2e9711a5fea2758fe31e83))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* `premium-icon-reddit` patch ([#333](https://github.com/revanced/revanced-patches/issues/333)) ([6739e7b](https://github.com/revanced/revanced-patches/commit/6739e7b94c18200bb3afbc9a8465d97bd18d1945))
|
||||
* blacklist `.vsc` folder in `.gitignore` ([#331](https://github.com/revanced/revanced-patches/issues/331)) ([1922253](https://github.com/revanced/revanced-patches/commit/1922253118e670aa66b33186f5cee2ffb3c55718))
|
||||
|
||||
## [2.45.3](https://github.com/revanced/revanced-patches/compare/v2.45.2...v2.45.3) (2022-08-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* release `patches.json` file ([#402](https://github.com/revanced/revanced-patches/issues/402)) ([17e351c](https://github.com/revanced/revanced-patches/commit/17e351c99a69652f20d89e579f43c1ce110cd81d))
|
||||
|
||||
## [2.45.2](https://github.com/revanced/revanced-patches/compare/v2.45.1...v2.45.2) (2022-08-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add `patches.json` as a release asset ([a0b2c89](https://github.com/revanced/revanced-patches/commit/a0b2c89071d64efa7629a8d6d6bc0492c9772aa9))
|
||||
|
||||
## [2.45.1](https://github.com/revanced/revanced-patches/compare/v2.45.0...v2.45.1) (2022-08-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* run meta generator ([70a2b45](https://github.com/revanced/revanced-patches/commit/70a2b456b4031b3da38a18a71ede7bf84099acd0))
|
||||
|
||||
# [2.45.0](https://github.com/revanced/revanced-patches/compare/v2.44.0...v2.45.0) (2022-08-28)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Add JSON meta ([4c229d3](https://github.com/revanced/revanced-patches/commit/4c229d350859903a782c43b13457628739572f09))
|
||||
|
||||
# [2.44.0](https://github.com/revanced/revanced-patches/compare/v2.43.2...v2.44.0) (2022-08-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add debug switch ([#391](https://github.com/revanced/revanced-patches/issues/391)) ([ee4b776](https://github.com/revanced/revanced-patches/commit/ee4b7761d8bb4549f2f100f721c90c664eedfe4a))
|
||||
|
||||
## [2.43.2](https://github.com/revanced/revanced-patches/compare/v2.43.1...v2.43.2) (2022-08-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* package name for Vanced ([#390](https://github.com/revanced/revanced-patches/issues/390)) ([85206b9](https://github.com/revanced/revanced-patches/commit/85206b99e1399d00e5eaebded8aadc5fb982aaa4))
|
||||
|
||||
## [2.43.1](https://github.com/revanced/revanced-patches/compare/v2.43.0...v2.43.1) (2022-08-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* `Patch` annotation for `client-spoof` patch ([6a8af47](https://github.com/revanced/revanced-patches/commit/6a8af47f2dfb319a53db9b5f9deb0392f10f4185))
|
||||
|
||||
# [2.43.0](https://github.com/revanced/revanced-patches/compare/v2.42.1...v2.43.0) (2022-08-26)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* `client-spoof` patch ([5512c07](https://github.com/revanced/revanced-patches/commit/5512c072fa4b047849dbea0d2d382dd85e3a0827))
|
||||
|
||||
## [2.42.1](https://github.com/revanced/revanced-patches/compare/v2.42.0...v2.42.1) (2022-08-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* changed default value for autorepeat setting ([#386](https://github.com/revanced/revanced-patches/issues/386)) ([d43add7](https://github.com/revanced/revanced-patches/commit/d43add7c21f0d9f45830476704985755e37d33ef))
|
||||
|
||||
# [2.42.0](https://github.com/revanced/revanced-patches/compare/v2.41.0...v2.42.0) (2022-08-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* default values for settings ([834c4ad](https://github.com/revanced/revanced-patches/commit/834c4add71570d36b645246621ba24da3869d613))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* setting for downloader package name ([965d05c](https://github.com/revanced/revanced-patches/commit/965d05cfa55d7a51f64a11f0219e2867568ba852))
|
||||
* v17.29.34 compatibility for `downloads` patch ([#374](https://github.com/revanced/revanced-patches/issues/374)) ([d81f1af](https://github.com/revanced/revanced-patches/commit/d81f1af327e0d7471f410811af46da34ddfb1bb4))
|
||||
|
||||
# [2.41.0](https://github.com/revanced/revanced-patches/compare/v2.40.2...v2.41.0) (2022-08-22)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* `downloads` patch ([#215](https://github.com/revanced/revanced-patches/issues/215)) ([304fbac](https://github.com/revanced/revanced-patches/commit/304fbacab22538fb0945f564e061783b47120120))
|
||||
|
||||
## [2.40.2](https://github.com/revanced/revanced-patches/compare/v2.40.1...v2.40.2) (2022-08-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* correct title for `tablet-miniplayer` setting switch ([6af6c02](https://github.com/revanced/revanced-patches/commit/6af6c02154d170153093bd846dfcb7a6205dd6fa))
|
||||
|
||||
## [2.40.1](https://github.com/revanced/revanced-patches/compare/v2.40.0...v2.40.1) (2022-08-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add missing switch for `tablet-mini-player` patch ([244a1b2](https://github.com/revanced/revanced-patches/commit/244a1b2cb9f77272dc62287a4a34a487b0289295))
|
||||
|
||||
# [2.40.0](https://github.com/revanced/revanced-patches/compare/v2.39.1...v2.40.0) (2022-08-22)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* `settings` patch framework ([#266](https://github.com/revanced/revanced-patches/issues/266)) ([084a99b](https://github.com/revanced/revanced-patches/commit/084a99bc6f5ed67c0b270e219c2dd75a30f302f1))
|
||||
|
||||
## [2.39.1](https://github.com/revanced/revanced-patches/compare/v2.39.0...v2.39.1) (2022-08-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* make `custom-branding` cross-platform ([#366](https://github.com/revanced/revanced-patches/issues/366)) ([02ac62b](https://github.com/revanced/revanced-patches/commit/02ac62b0ea7e47ff3aa5078ce4645421f410b154))
|
||||
|
||||
# [2.39.0](https://github.com/revanced/revanced-patches/compare/v2.38.0...v2.39.0) (2022-08-19)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* bundle `dex` file into `jar` file ([#359](https://github.com/revanced/revanced-patches/issues/359)) ([f419252](https://github.com/revanced/revanced-patches/commit/f4192526eab1e3e0208e7460847b892e077fcf5a))
|
||||
|
||||
# [2.38.0](https://github.com/revanced/revanced-patches/compare/v2.37.0...v2.38.0) (2022-08-17)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* bump YouTube patches to `v17.32.35` ([#347](https://github.com/revanced/revanced-patches/issues/347)) ([5292a0e](https://github.com/revanced/revanced-patches/commit/5292a0e973953225f94eed887a5d8f1ead17bb97))
|
||||
|
||||
# [2.37.0](https://github.com/revanced/revanced-patches/compare/v2.36.2...v2.37.0) (2022-08-15)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ˋpflotsh-ecmwf-subscription-unlockˋ patch ([#332](https://github.com/revanced/revanced-patches/issues/332)) ([ae2a1d8](https://github.com/revanced/revanced-patches/commit/ae2a1d8362e388032c3521101ff60698c4af1583))
|
||||
|
||||
## [2.36.2](https://github.com/revanced/revanced-patches/compare/v2.36.1...v2.36.2) (2022-08-14)
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,72 @@
|
||||
# 🧩 ReVanced Patches
|
||||
## 🧩 Patches
|
||||
|
||||
Official patches by ReVanced
|
||||
The official Patch bundle provided by ReVanced and the community.
|
||||
|
||||
## 📜 List of available patches
|
||||
> Looking for the JSON variant of this? [Click here](patches.json).
|
||||
|
||||
{{ table }}
|
||||
|
||||
## 📝 JSON Format
|
||||
|
||||
This section explains the JSON format for the [patches.json](patches.json) file.
|
||||
|
||||
The file contains an array of objects, each object representing a patch. The object contains the following properties:
|
||||
|
||||
| key | description |
|
||||
|-------------------------------|------------------------------------------------------------------------------------------------------------------|
|
||||
| `name` | The name of the patch. |
|
||||
| `description` | The description of the patch. |
|
||||
| `version` | The version of the patch. |
|
||||
| `excluded` | Whether a patch is excluded by default. If `true`, the patch must never be included by default. |
|
||||
| `dependencies` | An array of dependencies, which are patch names. |
|
||||
| `compatiblePackages` | An array of packages compatible with this patch. |
|
||||
| `compatiblePackages.name` | The name of the package. |
|
||||
| `compatiblePackages.versions` | An array of versions of the package compatible with this patch. If empty, all versions are seemingly compatible. |
|
||||
|
||||
Example:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"name": "remember-video-quality",
|
||||
"description": "Adds the ability to remember the video quality you chose in the video quality flyout.",
|
||||
"version": "0.0.1",
|
||||
"excluded": false,
|
||||
"dependencies": [
|
||||
"integrations",
|
||||
"video-id-hook"
|
||||
],
|
||||
"compatiblePackages": [
|
||||
{
|
||||
"name": "com.google.android.youtube",
|
||||
"versions": [
|
||||
"17.22.36",
|
||||
"17.24.35",
|
||||
"17.26.35",
|
||||
"17.27.39",
|
||||
"17.28.34",
|
||||
"17.29.34",
|
||||
"17.32.35"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "client-spoof",
|
||||
"description": "Spoofs the YouTube or Vanced client to prevent playback issues.",
|
||||
"version": "0.0.1",
|
||||
"excluded": false,
|
||||
"dependencies": [],
|
||||
"compatiblePackages": [
|
||||
{
|
||||
"name": "com.google.android.youtube",
|
||||
"versions": []
|
||||
},
|
||||
{
|
||||
"name": "com.vanced.android.youtube",
|
||||
"versions": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
148
README.md
148
README.md
@@ -1,8 +1,8 @@
|
||||
# 🧩 ReVanced Patches
|
||||
## 🧩 Patches
|
||||
|
||||
Official patches by ReVanced
|
||||
The official Patch bundle provided by ReVanced and the community.
|
||||
|
||||
## 📜 List of available patches
|
||||
> Looking for the JSON variant of this? [Click here](patches.json).
|
||||
|
||||
### 📦 `com.twitter.android`
|
||||
<details>
|
||||
@@ -17,24 +17,33 @@ Official patches by ReVanced
|
||||
|
||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||
|:--------:|:--------------:|:-----------------:|
|
||||
| `premium-icon-reddit` | Unlocking Premium Icons in reddit app. | all |
|
||||
| `general-reddit-ads` | Removes general ads from the Reddit frontpage and subreddits. | all |
|
||||
</details>
|
||||
|
||||
### 📦 `com.garzotto.pflotsh.ecmwf_a`
|
||||
<details>
|
||||
|
||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||
|:--------:|:--------------:|:-----------------:|
|
||||
| `pflotsh-ecmwf-subscription-unlock` | Unlocks all subscription features. | 3.5.4 |
|
||||
</details>
|
||||
|
||||
### 📦 `com.google.android.apps.youtube.music`
|
||||
<details>
|
||||
|
||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||
|:--------:|:--------------:|:-----------------:|
|
||||
| `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.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.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 |
|
||||
| `minimized-playback-music` | Enables minimized playback on Kids music. | 5.22.54 |
|
||||
| `tasteBuilder-remover` | Removes the "Tell us which artists you like" card from the home screen. | 5.22.54 |
|
||||
| `hide-get-premium` | Removes all "Get Premium" evidences from the avatar menu. | 5.22.54 |
|
||||
| `compact-header` | Hides the music category bar at the top of the homepage. | 5.22.54 |
|
||||
| `upgrade-button-remover` | Removes the upgrade tab from the pivot bar. | 5.22.54 |
|
||||
| `background-play` | Enables playing music in the background. | 5.22.54 |
|
||||
| `music-microg-support` | Allows YouTube Music ReVanced to run without root and under a different package name. | 5.22.54 |
|
||||
| `music-video-ads` | Removes ads in the music player. | 5.22.54 |
|
||||
| `codecs-unlock` | Adds more audio codec options. The new audio codecs usually result in better audio quality. | 5.22.54 |
|
||||
| `exclusive-audio-playback` | Enables the option to play music without video. | 5.22.54 |
|
||||
</details>
|
||||
|
||||
### 📦 `de.dwd.warnapp`
|
||||
@@ -58,34 +67,101 @@ Official patches by ReVanced
|
||||
|
||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||
|:--------:|:--------------:|:-----------------:|
|
||||
| `swipe-controls` | Adds volume and brightness swipe controls. | 17.29.34 |
|
||||
| `seekbar-tapping` | Enables tap-to-seek on the seekbar of the video player. | 17.29.34 |
|
||||
| `minimized-playback` | Enables minimized and background playback. | 17.29.34 |
|
||||
| `amoled` | Enables pure black theme. | 17.29.34 |
|
||||
| `disable-create-button` | Hides the create button in the navigation bar. | 17.29.34 |
|
||||
| `swipe-controls` | Adds volume and brightness swipe controls. | 17.33.42 |
|
||||
| `downloads` | Enables downloading music and videos from YouTube. | 17.33.42 |
|
||||
| `seekbar-tapping` | Enables tap-to-seek on the seekbar of the video player. | 17.33.42 |
|
||||
| `amoled` | Enables pure black theme. | all |
|
||||
| `disable-create-button` | Hides the create button in the navigation bar. | 17.33.42 |
|
||||
| `hide-cast-button` | Hides the cast button in the video player. | all |
|
||||
| `return-youtube-dislike` | Shows the dislike count of videos using the Return YouTube Dislike API. | 17.29.34 |
|
||||
| `hide-autoplay-button` | Hides the autoplay button in the video player. | 17.29.34 |
|
||||
| `return-youtube-dislike` | Shows the dislike count of videos using the Return YouTube Dislike API. | 17.33.42 |
|
||||
| `hide-autoplay-button` | Hides the autoplay button in the video player. | 17.33.42 |
|
||||
| `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 |
|
||||
| `disable-fullscreen-panels` | Disables video description and comments panel in fullscreen view. | 17.29.34 |
|
||||
| `old-quality-layout` | Enables the original quality flyout menu. | 17.29.34 |
|
||||
| `hide-shorts-button` | Hides the shorts button on the navigation bar. | 17.29.34 |
|
||||
| `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 |
|
||||
| `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 |
|
||||
| `disable-fullscreen-panels` | Disables video description and comments panel in fullscreen view. | 17.33.42 |
|
||||
| `old-quality-layout` | Enables the original quality flyout menu. | 17.33.42 |
|
||||
| `hide-shorts-button` | Hides the shorts button on the navigation bar. | 17.33.42 |
|
||||
| `hide-watermark` | Hides creator's watermarks on videos. | 17.33.42 |
|
||||
| `sponsorblock` | Integrate SponsorBlock. | 17.33.42 |
|
||||
| `enable-wide-searchbar` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | 17.33.42 |
|
||||
| `tablet-mini-player` | Enables the tablet mini player layout. | 17.33.42 |
|
||||
| `minimized-playback` | Enables minimized and background playback. | 17.33.42 |
|
||||
| `client-spoof` | Spoofs the YouTube or Vanced client to prevent playback issues. | all |
|
||||
| `custom-video-buffer` | Lets you change the buffers of videos. | 17.33.42 |
|
||||
| `always-autorepeat` | Always repeats the playing video again. | 17.33.42 |
|
||||
| `microg-support` | Allows YouTube ReVanced to run without root and under a different package name with Vanced MicroG. | 17.33.42 |
|
||||
| `settings` | Adds settings for ReVanced to YouTube. | all |
|
||||
| `enable-debugging` | Enables app debugging by patching the manifest file. | all |
|
||||
| `custom-playback-speed` | Adds more video playback speed options. | 17.29.34 |
|
||||
| `hdr-auto-brightness` | Makes the brightness of HDR videos follow the system default. | 17.29.34 |
|
||||
| `remember-video-quality` | Adds the ability to remember the video quality you chose in the video quality flyout. | 17.29.34 |
|
||||
| `video-ads` | Removes ads in the video player. | 17.29.34 |
|
||||
| `general-ads` | Removes general ads. | 17.29.34 |
|
||||
| `hide-infocard-suggestions` | Hides infocards in videos. | 17.29.34 |
|
||||
| `custom-playback-speed` | Adds more video playback speed options. | 17.33.42 |
|
||||
| `hdr-auto-brightness` | Makes the brightness of HDR videos follow the system default. | 17.33.42 |
|
||||
| `remember-video-quality` | Adds the ability to remember the video quality you chose in the video quality flyout. | 17.33.42 |
|
||||
| `video-ads` | Removes ads in the video player. | 17.33.42 |
|
||||
| `general-ads` | Removes general ads. | 17.33.42 |
|
||||
| `hide-infocard-suggestions` | Hides infocards in videos. | 17.33.42 |
|
||||
</details>
|
||||
|
||||
|
||||
|
||||
## 📝 JSON Format
|
||||
|
||||
This section explains the JSON format for the [patches.json](patches.json) file.
|
||||
|
||||
The file contains an array of objects, each object representing a patch. The object contains the following properties:
|
||||
|
||||
| key | description |
|
||||
|-------------------------------|------------------------------------------------------------------------------------------------------------------|
|
||||
| `name` | The name of the patch. |
|
||||
| `description` | The description of the patch. |
|
||||
| `version` | The version of the patch. |
|
||||
| `excluded` | Whether a patch is excluded by default. If `true`, the patch must never be included by default. |
|
||||
| `dependencies` | An array of dependencies, which are patch names. |
|
||||
| `compatiblePackages` | An array of packages compatible with this patch. |
|
||||
| `compatiblePackages.name` | The name of the package. |
|
||||
| `compatiblePackages.versions` | An array of versions of the package compatible with this patch. If empty, all versions are seemingly compatible. |
|
||||
|
||||
Example:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"name": "remember-video-quality",
|
||||
"description": "Adds the ability to remember the video quality you chose in the video quality flyout.",
|
||||
"version": "0.0.1",
|
||||
"excluded": false,
|
||||
"dependencies": [
|
||||
"integrations",
|
||||
"video-id-hook"
|
||||
],
|
||||
"compatiblePackages": [
|
||||
{
|
||||
"name": "com.google.android.youtube",
|
||||
"versions": [
|
||||
"17.22.36",
|
||||
"17.24.35",
|
||||
"17.26.35",
|
||||
"17.27.39",
|
||||
"17.28.34",
|
||||
"17.29.34",
|
||||
"17.32.35"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "client-spoof",
|
||||
"description": "Spoofs the YouTube or Vanced client to prevent playback issues.",
|
||||
"version": "0.0.1",
|
||||
"excluded": false,
|
||||
"dependencies": [],
|
||||
"compatiblePackages": [
|
||||
{
|
||||
"name": "com.google.android.youtube",
|
||||
"versions": []
|
||||
},
|
||||
{
|
||||
"name": "com.vanced.android.youtube",
|
||||
"versions": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
@@ -24,18 +24,20 @@ dependencies {
|
||||
|
||||
implementation("app.revanced:revanced-patcher:3.3.3")
|
||||
implementation("app.revanced:multidexlib2:2.5.2.r2")
|
||||
|
||||
// Required for meta
|
||||
implementation("com.google.code.gson:gson:2.9.1")
|
||||
}
|
||||
|
||||
tasks {
|
||||
register<DefaultTask>("generateDex") {
|
||||
description = "Generate dex files from build"
|
||||
register<DefaultTask>("generateBundle") {
|
||||
description = "Generate dex files from build and bundle them in the jar file"
|
||||
dependsOn(build)
|
||||
|
||||
doLast {
|
||||
val androidHome = System.getenv("ANDROID_HOME") ?: throw GradleException("ANDROID_HOME not found")
|
||||
val d8 = "${androidHome}/build-tools/32.0.0/d8"
|
||||
val input = configurations.archives.get().allArtifacts.files.files.first().absolutePath
|
||||
val output = input.replace(".jar", ".dex")
|
||||
val work = File("${buildDir}/libs")
|
||||
|
||||
exec {
|
||||
@@ -45,16 +47,16 @@ tasks {
|
||||
|
||||
exec {
|
||||
workingDir = work
|
||||
commandLine = listOf("mv", "classes.dex", output)
|
||||
commandLine = listOf("zip", "-u", input, "classes.dex")
|
||||
}
|
||||
}
|
||||
}
|
||||
register<JavaExec>("generateReadme") {
|
||||
description = "Generate README.md"
|
||||
register<JavaExec>("generateMeta") {
|
||||
description = "Generate metadata for this bundle"
|
||||
dependsOn(build)
|
||||
|
||||
classpath = sourceSets["main"].runtimeClasspath
|
||||
mainClass.set("app.revanced.meta.readme.Generator")
|
||||
mainClass.set("app.revanced.meta.Meta")
|
||||
}
|
||||
// Dummy task to fix the Gradle semantic-release plugin.
|
||||
// Remove this if you forked it to support building only.
|
||||
@@ -62,6 +64,6 @@ tasks {
|
||||
register<DefaultTask>("publish") {
|
||||
group = "publish"
|
||||
description = "Dummy task"
|
||||
dependsOn(named("generateDex"), named("generateReadme"))
|
||||
dependsOn(named("generateBundle"), named("generateMeta"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
kotlin.code.style = official
|
||||
version = 2.36.2
|
||||
version = 2.49.0
|
||||
|
||||
1
patches.json
Normal file
1
patches.json
Normal file
File diff suppressed because one or more lines are too long
27
src/main/kotlin/app/revanced/meta/Meta.kt
Normal file
27
src/main/kotlin/app/revanced/meta/Meta.kt
Normal file
@@ -0,0 +1,27 @@
|
||||
package app.revanced.meta
|
||||
|
||||
import app.revanced.meta.json.generateJson
|
||||
import app.revanced.meta.readme.generateText
|
||||
import app.revanced.patcher.data.Data
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.util.patch.impl.JarPatchBundle
|
||||
import java.io.File
|
||||
|
||||
typealias Bundle = List<Class<out Patch<Data>>>
|
||||
|
||||
object Meta {
|
||||
@JvmStatic
|
||||
fun main(args: Array<String>) {
|
||||
val patches = accumulatePatches()
|
||||
if (patches.isEmpty()) throw IllegalStateException("No patches found")
|
||||
|
||||
generateText(patches)
|
||||
generateJson(patches)
|
||||
}
|
||||
}
|
||||
|
||||
fun accumulatePatches() = JarPatchBundle(
|
||||
File("build/libs/").listFiles()!!.first {
|
||||
it.name.startsWith("revanced-patches-") && it.name.endsWith(".jar")
|
||||
}.absolutePath
|
||||
).loadPatches()
|
||||
33
src/main/kotlin/app/revanced/meta/json/Generator.kt
Normal file
33
src/main/kotlin/app/revanced/meta/json/Generator.kt
Normal file
@@ -0,0 +1,33 @@
|
||||
package app.revanced.meta.json
|
||||
|
||||
import app.revanced.meta.Bundle
|
||||
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
||||
import app.revanced.patcher.extensions.PatchExtensions.dependencies
|
||||
import app.revanced.patcher.extensions.PatchExtensions.description
|
||||
import app.revanced.patcher.extensions.PatchExtensions.include
|
||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||
import app.revanced.patcher.extensions.PatchExtensions.version
|
||||
import com.google.gson.Gson
|
||||
import java.io.File
|
||||
|
||||
private val gson = Gson()
|
||||
|
||||
fun generateJson(bundle: Bundle) {
|
||||
val patches = bundle.map {
|
||||
JsonPatch(
|
||||
it.patchName,
|
||||
it.description ?: "This patch has no description.",
|
||||
it.version ?: "0.0.0",
|
||||
!it.include,
|
||||
it.dependencies?.map { dep ->
|
||||
dep.java.patchName
|
||||
}?.toTypedArray() ?: emptyArray(),
|
||||
it.compatiblePackages?.map { pkg ->
|
||||
CompatiblePackage(pkg.name, pkg.versions)
|
||||
}?.toTypedArray() ?: emptyArray()
|
||||
)
|
||||
}
|
||||
|
||||
val json = File("patches.json")
|
||||
json.writeText(gson.toJson(patches))
|
||||
}
|
||||
17
src/main/kotlin/app/revanced/meta/json/JsonPatch.kt
Normal file
17
src/main/kotlin/app/revanced/meta/json/JsonPatch.kt
Normal file
@@ -0,0 +1,17 @@
|
||||
@file:Suppress("ArrayInDataClass") // We don't need it here.
|
||||
|
||||
package app.revanced.meta.json
|
||||
|
||||
data class JsonPatch(
|
||||
val name: String,
|
||||
val description: String,
|
||||
val version: String,
|
||||
val excluded: Boolean,
|
||||
val dependencies: Array<String>,
|
||||
val compatiblePackages: Array<CompatiblePackage>,
|
||||
)
|
||||
|
||||
data class CompatiblePackage(
|
||||
val name: String,
|
||||
val versions: Array<String>,
|
||||
)
|
||||
@@ -4,8 +4,7 @@ import app.revanced.patcher.data.Data
|
||||
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
||||
import app.revanced.patcher.patch.Patch
|
||||
|
||||
internal fun Class<out Patch<Data>>.getLatestVersion(): SemanticVersion? =
|
||||
this.compatiblePackages?.first()?.versions?.map { SemanticVersion.fromString(it) }
|
||||
?.maxWithOrNull(
|
||||
SemanticVersionComparator
|
||||
)
|
||||
internal fun Class<out Patch<Data>>.getLatestVersion() =
|
||||
this.compatiblePackages?.first()?.versions?.map {
|
||||
SemanticVersion.fromString(it)
|
||||
}?.maxWithOrNull(SemanticVersionComparator)
|
||||
|
||||
@@ -1,55 +1,44 @@
|
||||
package app.revanced.meta.readme
|
||||
|
||||
import app.revanced.meta.Bundle
|
||||
import app.revanced.patcher.data.Data
|
||||
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.impl.JarPatchBundle
|
||||
import java.io.File
|
||||
|
||||
object Generator {
|
||||
private const val TABLE_HEADER =
|
||||
"| \uD83D\uDC8A Patch | \uD83D\uDCDC Description | \uD83C\uDFF9 Target Version |\n" +
|
||||
"|:--------:|:--------------:|:-----------------:|"
|
||||
private const val TABLE_HEADER =
|
||||
"| \uD83D\uDC8A Patch | \uD83D\uDCDC Description | \uD83C\uDFF9 Target Version |\n" + "|:--------:|:--------------:|:-----------------:|"
|
||||
|
||||
@JvmStatic
|
||||
fun main(args: Array<String>) {
|
||||
val buildDir = File("build/libs/")
|
||||
val buildJar =
|
||||
buildDir.listFiles()?.first { it.name.startsWith("revanced-patches-") && it.name.endsWith(".jar") }!!
|
||||
private val TABLE_REGEX = Regex("\\{\\{\\s?table\\s?}}")
|
||||
|
||||
val bundle = JarPatchBundle(buildJar.absolutePath).loadPatches()
|
||||
fun generateText(bundle: Bundle) {
|
||||
val output = StringBuilder()
|
||||
val packages = mutableMapOf<String, MutableList<Class<out Patch<Data>>>>()
|
||||
|
||||
val output = StringBuilder()
|
||||
|
||||
val packages = mutableMapOf<String, MutableList<Class<out Patch<Data>>>>()
|
||||
|
||||
bundle.map {
|
||||
val packageName = it.compatiblePackages?.first()?.name!!
|
||||
if (!packages.contains(packageName)) {
|
||||
packages[packageName] = mutableListOf()
|
||||
}
|
||||
|
||||
packages[packageName]?.add(it)
|
||||
bundle.map {
|
||||
val packageName = it.compatiblePackages?.first()?.name!!
|
||||
if (!packages.contains(packageName)) {
|
||||
packages[packageName] = mutableListOf()
|
||||
}
|
||||
|
||||
for (pkg in packages) {
|
||||
output.appendLine("### \uD83D\uDCE6 `${pkg.key}`")
|
||||
output.appendLine("<details>\n")
|
||||
|
||||
output.appendLine(TABLE_HEADER)
|
||||
pkg.value.forEach { output.appendLine("| `${it.patchName}` | ${it.description} | ${it.getLatestVersion() ?: "all"} |") }
|
||||
|
||||
output.appendLine("</details>\n")
|
||||
}
|
||||
|
||||
val readMeTemplateFile = File("README-template.md")
|
||||
val readmeTemplate = Template(readMeTemplateFile.readText())
|
||||
|
||||
readmeTemplate.replaceVariable("table", output.toString())
|
||||
|
||||
val readme = File("README.md")
|
||||
readme.writeText(readmeTemplate.toString())
|
||||
packages[packageName]?.add(it)
|
||||
}
|
||||
|
||||
for (pkg in packages) {
|
||||
output.appendLine("### \uD83D\uDCE6 `${pkg.key}`")
|
||||
output.appendLine("<details>\n")
|
||||
|
||||
output.appendLine(TABLE_HEADER)
|
||||
pkg.value.forEach { output.appendLine("| `${it.patchName}` | ${it.description} | ${it.getLatestVersion() ?: "all"} |") }
|
||||
|
||||
output.appendLine("</details>\n")
|
||||
}
|
||||
|
||||
val readmeTemplate = Template(File("README-template.md").readText())
|
||||
readmeTemplate.replaceVariable(TABLE_REGEX, output.toString())
|
||||
|
||||
val readme = File("README.md")
|
||||
readme.writeText(readmeTemplate.toString())
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package app.revanced.meta.readme
|
||||
data class SemanticVersion(val major: Int, val minor: Int, val patch: Int) {
|
||||
companion object {
|
||||
fun fromString(version: String): SemanticVersion {
|
||||
var parts = version.split(".")
|
||||
|
||||
val parts = version.split(".")
|
||||
if (parts.count() != 3) throw IllegalArgumentException("Invalid semantic version")
|
||||
|
||||
val versionNumbers = parts.map { it.toInt() }
|
||||
return SemanticVersion(versionNumbers[0], versionNumbers[1], versionNumbers[2])
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package app.revanced.meta.readme
|
||||
|
||||
class Template(template: String) {
|
||||
val result: StringBuilder = StringBuilder(template)
|
||||
val result = StringBuilder(template)
|
||||
|
||||
fun replaceVariable(name: String, value: String) {
|
||||
val regex = Regex("\\{\\{\\s?$name\\s?}}")
|
||||
fun replaceVariable(regex: Regex, value: String) {
|
||||
val range = regex.find(result)!!.range
|
||||
|
||||
result.replace(range.first, range.last + 1, value)
|
||||
}
|
||||
|
||||
|
||||
@@ -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", "5.17.51")
|
||||
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51", "5.21.52", "5.22.54")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -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", "5.17.51")
|
||||
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51", "5.21.52", "5.22.54")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -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", "5.17.51")
|
||||
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51", "5.21.52", "5.22.54")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -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.21.52", "5.22.54")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -31,8 +31,8 @@ class CompactHeaderPatch : BytecodePatch(
|
||||
val register = (method.implementation!!.instructions[insertIndex - 1] as BuilderInstruction11x).registerA
|
||||
method.addInstructions(
|
||||
insertIndex, """
|
||||
const/16 v0, 0x8
|
||||
invoke-virtual {v${register}, v0}, Landroid/view/View;->setVisibility(I)V
|
||||
const/16 v2, 0x8
|
||||
invoke-virtual {v${register}, v2}, Landroid/view/View;->setVisibility(I)V
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
@@ -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", "5.17.51")
|
||||
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51", "5.21.52", "5.22.54")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -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", "5.17.51")
|
||||
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51", "5.21.52", "5.22.54")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -10,7 +10,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.21.52", "5.22.54")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.jf.dexlib2.Opcode
|
||||
@RemoveTasteBuilderCompatibility
|
||||
@Version("0.0.1")
|
||||
object TasteBuilderConstructorFingerprint : MethodFingerprint(
|
||||
"V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf("L", "L", "L", "L"), listOf(
|
||||
"V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf("L", "L", "L"), listOf(
|
||||
Opcode.INVOKE_DIRECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.NEW_INSTANCE,
|
||||
@@ -35,9 +35,9 @@ object TasteBuilderConstructorFingerprint : MethodFingerprint(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.CHECK_CAST,
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.NEW_INSTANCE,
|
||||
Opcode.INVOKE_DIRECT,
|
||||
Opcode.IPUT_OBJECT
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.CONST
|
||||
)
|
||||
)
|
||||
@@ -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", "5.17.51")
|
||||
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51", "5.21.52", "5.22.54")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -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", "5.17.51")
|
||||
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51", "5.21.52", "5.22.54")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -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", "5.17.51")
|
||||
"com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51", "5.21.52", "5.22.54")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.revanced.patches.reddit.layout.premiumicon.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.reddit.frontpage", arrayOf()
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
internal annotation class PremiumIconCompatibility
|
||||
@@ -0,0 +1,24 @@
|
||||
package app.revanced.patches.reddit.layout.premiumicon.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.reddit.layout.premiumicon.annotations.PremiumIconCompatibility
|
||||
|
||||
@Name("premium-icon-fingerprint")
|
||||
@MatchingMethod(
|
||||
"Lcom/reddit/domain/model/MyAccount;", "isPremiumSubscriber"
|
||||
)
|
||||
@PremiumIconCompatibility
|
||||
@Version("0.0.1")
|
||||
object PremiumIconFingerprint : MethodFingerprint(
|
||||
"Z",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
{ methodDef ->
|
||||
methodDef.definingClass.endsWith("MyAccount;") && methodDef.name == "isPremiumSubscriber"
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,32 @@
|
||||
package app.revanced.patches.reddit.layout.premiumicon.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.patches.reddit.layout.premiumicon.annotations.PremiumIconCompatibility
|
||||
import app.revanced.patches.reddit.layout.premiumicon.fingerprints.PremiumIconFingerprint
|
||||
|
||||
@Patch
|
||||
@Name("premium-icon-reddit")
|
||||
@Description("Unlocking Premium Icons in reddit app.")
|
||||
@PremiumIconCompatibility
|
||||
@Version("0.0.1")
|
||||
class PremiumIconPatch : BytecodePatch() {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
val method = PremiumIconFingerprint.result!!.mutableMethod
|
||||
method.addInstructions(
|
||||
0,
|
||||
"""
|
||||
const/4 v0, 0x1
|
||||
return v0
|
||||
"""
|
||||
)
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34")
|
||||
"com.google.android.youtube", arrayOf("17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -23,6 +23,9 @@ import app.revanced.patches.youtube.ad.general.bytecode.extensions.MethodExtensi
|
||||
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.mapping.patch.ResourceIdMappingProviderResourcePatch
|
||||
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.Opcode
|
||||
import org.jf.dexlib2.builder.MutableMethodImplementation
|
||||
import org.jf.dexlib2.builder.instruction.*
|
||||
@@ -38,7 +41,7 @@ import org.jf.dexlib2.iface.reference.StringReference
|
||||
import org.jf.dexlib2.immutable.reference.ImmutableMethodReference
|
||||
|
||||
@Patch
|
||||
@DependsOn([ResourceIdMappingProviderResourcePatch::class, IntegrationsPatch::class])
|
||||
@DependsOn([ResourceIdMappingProviderResourcePatch::class, IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Name("general-ads")
|
||||
@Description("Removes general ads.")
|
||||
@GeneralAdsCompatibility
|
||||
@@ -68,6 +71,135 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
|
||||
)
|
||||
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.ADS.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_home_ads_removal",
|
||||
StringResource("revanced_home_ads_removal_title", "Remove home ads"),
|
||||
true,
|
||||
StringResource("revanced_home_ads_removal_summary_on", "Home ads are hidden"),
|
||||
StringResource("revanced_home_ads_removal_summary_off", "Home ads are shown")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_adremover_ad_removal",
|
||||
StringResource("revanced_adremover_ad_removal_enabled_title", "Remove general ads"),
|
||||
true,
|
||||
StringResource("revanced_adremover_ad_removal_enabled_summary_on", "General ads are hidden"),
|
||||
StringResource("revanced_adremover_ad_removal_enabled_summary_off", "General ads are shown")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_adremover_merchandise",
|
||||
StringResource("revanced_adremover_merchandise_enabled_title", "Remove merchandise banners"),
|
||||
true,
|
||||
StringResource("revanced_adremover_merchandise_enabled_summary_on", "Merchandise banners are hidden"),
|
||||
StringResource("revanced_adremover_merchandise_enabled_summary_off", "Merchandise banners are shown")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_adremover_community_posts_removal",
|
||||
StringResource("revanced_adremover_community_posts_enabled_title", "Remove community posts"),
|
||||
true,
|
||||
StringResource("revanced_adremover_community_posts_enabled_summary_on", "Community posts are hidden"),
|
||||
StringResource("revanced_adremover_community_posts_enabled_summary_off", "Community posts are shown")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_adremover_compact_banner_removal",
|
||||
StringResource("revanced_adremover_compact_banner_enabled_title", "Remove compact banners"),
|
||||
true,
|
||||
StringResource("revanced_adremover_compact_banner_enabled_summary_on", "Compact banners are hidden"),
|
||||
StringResource("revanced_adremover_compact_banner_enabled_summary_off", "Compact banners are shown")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_adremover_comments_removal",
|
||||
StringResource("revanced_adremover_comments_enabled_title", "Remove comments section"),
|
||||
false,
|
||||
StringResource("revanced_adremover_comments_enabled_summary_on", "Comment section is hidden"),
|
||||
StringResource("revanced_adremover_comments_enabled_summary_off", "Comment section is shown")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_adremover_movie",
|
||||
StringResource("revanced_adremover_movie_enabled_title", "Remove movies section"),
|
||||
true,
|
||||
StringResource("revanced_adremover_movie_enabled_summary_on", "Movies section is hidden"),
|
||||
StringResource("revanced_adremover_movie_enabled_summary_off", "Movies section is shown")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_adremover_feed_survey",
|
||||
StringResource("revanced_adremover_feed_survey_enabled_title", "Remove feed surveys"),
|
||||
true,
|
||||
StringResource("revanced_adremover_feed_survey_enabled_summary_on", "Feed surveys are hidden"),
|
||||
StringResource("revanced_adremover_feed_survey_enabled_summary_off", "Feed surveys are shown")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_adremover_shorts_shelf",
|
||||
StringResource("revanced_adremover_shorts_shelf_enabled_title", "Remove shorts shelf"),
|
||||
true,
|
||||
StringResource("revanced_adremover_shorts_shelf_enabled_summary_on", "Shorts shelves are hidden"),
|
||||
StringResource("revanced_adremover_shorts_shelf_enabled_summary_off", "Shorts shelves are shown")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_adremover_community_guidelines",
|
||||
StringResource("revanced_adremover_community_guidelines_enabled_title", "Remove community guidelines"),
|
||||
true,
|
||||
StringResource("revanced_adremover_community_guidelines_enabled_summary_on", "Community guidelines are hidden"),
|
||||
StringResource("revanced_adremover_community_guidelines_enabled_summary_off", "Community guidelines are shown")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_adremover_emergency_box_removal",
|
||||
StringResource("revanced_adremover_emergency_box_enabled_title", "Remove emergency boxes"),
|
||||
true,
|
||||
StringResource("revanced_adremover_emergency_box_enabled_summary_on", "Emergency boxes are hidden"),
|
||||
StringResource("revanced_adremover_emergency_box_enabled_summary_off", "Emergency boxes are shown")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_adremover_info_panel",
|
||||
StringResource("revanced_adremover_info_panel_enabled_title", "Remove info panels"),
|
||||
true,
|
||||
StringResource("revanced_adremover_info_panel_enabled_summary_on", "Merchandise banners are hidden"),
|
||||
StringResource("revanced_adremover_info_panel_enabled_summary_off", "Merchandise banners are shown")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_adremover_medical_panel",
|
||||
StringResource("revanced_adremover_medical_panel_enabled_title", "Remove medical panels"),
|
||||
true,
|
||||
StringResource("revanced_adremover_medical_panel_enabled_summary_on", "Medical panels are hidden"),
|
||||
StringResource("revanced_adremover_medical_panel_enabled_summary_off", "Medical panels are shown")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_adremover_paid_content",
|
||||
StringResource("revanced_adremover_paid_content_enabled_title", "Remove paid content"),
|
||||
true,
|
||||
StringResource("revanced_adremover_paid_content_enabled_summary_on", "Paid content is hidden"),
|
||||
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(
|
||||
"revanced_adremover_hide_suggestions",
|
||||
StringResource("revanced_adremover_hide_suggestions_enabled_title", "Hide suggestions"),
|
||||
true,
|
||||
StringResource("revanced_adremover_hide_suggestions_enabled_summary_on", "Suggestions are hidden"),
|
||||
StringResource("revanced_adremover_hide_suggestions_enabled_summary_off", "Suggestions are shown")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_adremover_hide_latest_posts",
|
||||
StringResource("revanced_adremover_hide_latest_posts_enabled_title", "Hide latest posts"),
|
||||
true,
|
||||
StringResource("revanced_adremover_hide_latest_posts_enabled_summary_on", "Latest posts are hidden"),
|
||||
StringResource("revanced_adremover_hide_latest_posts_enabled_summary_off", "Latest posts are shown")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_adremover_hide_channel_guidelines",
|
||||
StringResource("revanced_adremover_hide_channel_guidelines_enabled_title", "Hide channel guidelines"),
|
||||
true,
|
||||
StringResource("revanced_adremover_hide_channel_guidelines_enabled_summary_on", "Channel guidelines are hidden"),
|
||||
StringResource("revanced_adremover_hide_channel_guidelines_enabled_summary_off", "Channel guidelines are shown")
|
||||
),
|
||||
)
|
||||
|
||||
// iterating through all classes is expensive
|
||||
for (classDef in data.classes) {
|
||||
var mutableClass: MutableClass? = null
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34")
|
||||
"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")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -16,10 +16,13 @@ import app.revanced.patches.youtube.ad.infocardsuggestions.annotations.HideInfoc
|
||||
import app.revanced.patches.youtube.ad.infocardsuggestions.fingerprints.HideInfocardSuggestionsFingerprint
|
||||
import app.revanced.patches.youtube.ad.infocardsuggestions.fingerprints.HideInfocardSuggestionsParentFingerprint
|
||||
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.BuilderInstruction35c
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class])
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Name("hide-infocard-suggestions")
|
||||
@Description("Hides infocards in videos.")
|
||||
@HideInfocardSuggestionsCompatibility
|
||||
@@ -30,6 +33,16 @@ class HideInfocardSuggestionsPatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.ADS.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_info_cards_enabled",
|
||||
StringResource("revanced_info_cards_enabled_title", "Show info-cards"),
|
||||
false,
|
||||
StringResource("revanced_info_cards_enabled_summary_on", "Info-cards are shown"),
|
||||
StringResource("revanced_info_cards_enabled_summary_off", "Info-cards are hidden")
|
||||
)
|
||||
)
|
||||
|
||||
val parentResult = HideInfocardSuggestionsParentFingerprint.result
|
||||
?: return PatchResultError("Parent fingerprint not resolved!")
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34")
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -15,9 +15,12 @@ import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility
|
||||
import app.revanced.patches.youtube.ad.video.fingerprints.ShowVideoAdsConstructorFingerprint
|
||||
import app.revanced.patches.youtube.ad.video.fingerprints.ShowVideoAdsFingerprint
|
||||
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
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class])
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Name("video-ads")
|
||||
@Description("Removes ads in the video player.")
|
||||
@VideoAdsCompatibility
|
||||
@@ -28,7 +31,19 @@ class VideoAdsPatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
ShowVideoAdsFingerprint.resolve(data, ShowVideoAdsConstructorFingerprint.result!!.classDef)
|
||||
SettingsPatch.PreferenceScreen.ADS.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_video_ads_removal",
|
||||
StringResource("revanced_video_ads_removal_title", "Hide video ads"),
|
||||
true,
|
||||
StringResource("revanced_video_ads_removal_summary_on", "Video ads are hidden"),
|
||||
StringResource("revanced_video_ads_removal_summary_off", "Video ads are shown")
|
||||
)
|
||||
)
|
||||
|
||||
ShowVideoAdsFingerprint.resolve(
|
||||
data, ShowVideoAdsConstructorFingerprint.result!!.classDef
|
||||
)
|
||||
|
||||
// Override the parameter by calling shouldShowAds and setting the parameter to the result
|
||||
ShowVideoAdsFingerprint.result!!.mutableMethod.addInstructions(
|
||||
@@ -40,4 +55,4 @@ class VideoAdsPatch : BytecodePatch(
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package app.revanced.patches.youtube.interaction.downloads.annotation
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.27.39", "17.29.34", "17.32.35", "17.33.42")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
internal annotation class DownloadsCompatibility
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package app.revanced.patches.youtube.interaction.downloads.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.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.interaction.downloads.annotation.DownloadsCompatibility
|
||||
import app.revanced.patches.youtube.interaction.downloads.resource.patch.DownloadsResourcePatch
|
||||
import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch
|
||||
import app.revanced.patches.youtube.misc.videoid.patch.VideoIdPatch
|
||||
|
||||
@Patch
|
||||
@Name("downloads")
|
||||
@DependsOn([DownloadsResourcePatch::class, PlayerControlsBytecodePatch::class, VideoIdPatch::class])
|
||||
@Description("Enables downloading music and videos from YouTube.")
|
||||
@DownloadsCompatibility
|
||||
@Version("0.0.1")
|
||||
class DownloadsBytecodePatch : BytecodePatch() {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
val integrationsPackage = "app/revanced/integrations"
|
||||
val classDescriptor = "L$integrationsPackage/videoplayer/DownloadButton;"
|
||||
|
||||
/*
|
||||
initialize the control
|
||||
*/
|
||||
|
||||
val initializeDownloadsDescriptor = "$classDescriptor->initializeDownloadButton(Ljava/lang/Object;)V"
|
||||
PlayerControlsBytecodePatch.initializeControl(initializeDownloadsDescriptor)
|
||||
|
||||
/*
|
||||
add code to change the visibility of the control
|
||||
*/
|
||||
|
||||
val changeVisibilityDescriptor = "$classDescriptor->changeVisibility(Z)V"
|
||||
PlayerControlsBytecodePatch.injectVisibilityCheckCall(changeVisibilityDescriptor)
|
||||
|
||||
/*
|
||||
add code to change to update the video id
|
||||
*/
|
||||
|
||||
val setVideoIdDescriptor =
|
||||
"L$integrationsPackage/patches/downloads/DownloadsPatch;->setVideoId(Ljava/lang/String;)V"
|
||||
VideoIdPatch.injectCall(setVideoIdDescriptor)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package app.revanced.patches.youtube.interaction.downloads.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.youtube.interaction.downloads.annotation.DownloadsCompatibility
|
||||
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||
import app.revanced.patches.youtube.misc.playercontrols.resource.patch.BottomControlsResourcePatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.*
|
||||
import app.revanced.util.resources.ResourceUtils
|
||||
import app.revanced.util.resources.ResourceUtils.Settings.mergeStrings
|
||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||
|
||||
@Name("downloads-resource-patch")
|
||||
@DependsOn([BottomControlsResourcePatch::class, FixLocaleConfigErrorPatch::class, SettingsPatch::class])
|
||||
@Description("Makes necessary changes to resources for the download button.")
|
||||
@DownloadsCompatibility
|
||||
@Version("0.0.1")
|
||||
class DownloadsResourcePatch : ResourcePatch() {
|
||||
override fun execute(data: ResourceData): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
|
||||
PreferenceScreen(
|
||||
"revanced_downloads",
|
||||
StringResource("revanced_downloads_title", "Download settings"),
|
||||
listOf(
|
||||
SwitchPreference(
|
||||
"revanced_downloads",
|
||||
StringResource("revanced_downloads_enabled_title", "Show download button"),
|
||||
true,
|
||||
StringResource("revanced_downloads_enabled_summary_on", "Download button is visible"),
|
||||
StringResource("revanced_downloads_enabled_summary_off", "Download button is hidden")
|
||||
),
|
||||
TextPreference(
|
||||
"revanced_downloads_package_name",
|
||||
StringResource("revanced_downloads_package_name_title", "Downloader package name"),
|
||||
InputType.STRING,
|
||||
"org.schabi.newpipe" /* NewPipe */,
|
||||
StringResource("revanced_downloads_package_name_summary", "Package name of the downloader app such as NewPipe\\'s or PowerTube\\'s")
|
||||
)
|
||||
),
|
||||
StringResource("revanced_downloads_summary", "Settings related to downloads")
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
/*
|
||||
* Copy strings
|
||||
*/
|
||||
|
||||
data.mergeStrings("downloads/host/values/strings.xml")
|
||||
|
||||
/*
|
||||
* Copy resources
|
||||
*/
|
||||
|
||||
data.copyResources("downloads", ResourceUtils.ResourceGroup("drawable", "revanced_yt_download_button.xml"))
|
||||
|
||||
/*
|
||||
* Add download button node
|
||||
*/
|
||||
|
||||
BottomControlsResourcePatch.addControls("downloads/host/layout/${BottomControlsResourcePatch.TARGET_RESOURCE_NAME}")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34")
|
||||
"com.google.android.youtube", arrayOf("17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -15,6 +15,9 @@ import app.revanced.patches.youtube.interaction.seekbar.annotation.SeekbarTappin
|
||||
import app.revanced.patches.youtube.interaction.seekbar.fingerprints.SeekbarTappingFingerprint
|
||||
import app.revanced.patches.youtube.interaction.seekbar.fingerprints.SeekbarTappingParentFingerprint
|
||||
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.Opcode
|
||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
|
||||
import org.jf.dexlib2.iface.Method
|
||||
@@ -22,7 +25,7 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction11n
|
||||
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class])
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Name("seekbar-tapping")
|
||||
@Description("Enables tap-to-seek on the seekbar of the video player.")
|
||||
@SeekbarTappingCompatibility
|
||||
@@ -33,6 +36,16 @@ class EnableSeekbarTappingPatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_enable_tap_seeking",
|
||||
StringResource("revanced_seekbar_tapping_enabled_title", "Enable seekbar tapping"),
|
||||
true,
|
||||
StringResource("revanced_seekbar_tapping_summary_on", "Seekbar tapping is enabled"),
|
||||
StringResource("revanced_seekbar_tapping_summary_off", "Seekbar tapping is disabled")
|
||||
)
|
||||
)
|
||||
|
||||
var result = SeekbarTappingParentFingerprint.result!!
|
||||
|
||||
val tapSeekMethods = mutableMapOf<String, Method>()
|
||||
@@ -42,7 +55,7 @@ class EnableSeekbarTappingPatch : BytecodePatch(
|
||||
if (it.implementation == null) continue
|
||||
|
||||
val instructions = it.implementation!!.instructions
|
||||
// here we make sure we actually find the method because it has more then 7 instructions
|
||||
// here we make sure we actually find the method because it has more than 7 instructions
|
||||
if (instructions.count() < 7) continue
|
||||
|
||||
// we know that the 7th instruction has the opcode CONST_4
|
||||
@@ -71,6 +84,7 @@ class EnableSeekbarTappingPatch : BytecodePatch(
|
||||
if (instruction.opcode != Opcode.INVOKE_VIRTUAL) return PatchResultError("Could not find the correct register")
|
||||
val register = (instruction as Instruction35c).registerC
|
||||
|
||||
val elseLabel = implementation.newLabelForIndex(result.patternScanResult!!.endIndex + 1)
|
||||
// the instructions are written in reverse order.
|
||||
result.mutableMethod.addInstructions(
|
||||
result.patternScanResult!!.endIndex + 1, """
|
||||
@@ -80,7 +94,6 @@ class EnableSeekbarTappingPatch : BytecodePatch(
|
||||
)
|
||||
|
||||
// if tap-seeking is disabled, do not invoke the two methods above by jumping to the else label
|
||||
val elseLabel = implementation.newLabelForIndex(result.patternScanResult!!.endIndex + 1)
|
||||
implementation.addInstruction(
|
||||
result.patternScanResult!!.endIndex + 1, BuilderInstruction21t(Opcode.IF_EQZ, 0, elseLabel)
|
||||
)
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.24.34", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34")
|
||||
"com.google.android.youtube", arrayOf("17.24.34", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -65,5 +65,4 @@ class SwipeControlsBytecodePatch : BytecodePatch(
|
||||
}
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,31 +1,108 @@
|
||||
package app.revanced.patches.youtube.interaction.swipecontrols.patch.resource
|
||||
|
||||
import app.revanced.extensions.injectResources
|
||||
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.youtube.interaction.swipecontrols.annotation.SwipeControlsCompatibility
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.*
|
||||
import app.revanced.util.resources.ResourceUtils
|
||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||
|
||||
@Name("swipe-controls-resource-patch")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@SwipeControlsCompatibility
|
||||
@Version("0.0.1")
|
||||
class SwipeControlsResourcePatch : ResourcePatch() {
|
||||
override fun execute(data: ResourceData): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
|
||||
PreferenceScreen(
|
||||
"revanced_swipe_controls", StringResource("revanced_swipe_controls_title", "Swipe controls"), listOf(
|
||||
SwitchPreference(
|
||||
"revanced_enable_swipe_brightness",
|
||||
StringResource("revanced_swipe_brightness_enabled_title", "Enable brightness gesture"),
|
||||
true,
|
||||
StringResource("revanced_swipe_brightness_summary_on", "Brightness swipe is enabled"),
|
||||
StringResource("revanced_swipe_brightness_summary_off", "Brightness swipe is disabled")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_enable_swipe_volume",
|
||||
StringResource("revanced_swipe_volume_enabled_title", "Enable volume gesture"),
|
||||
true,
|
||||
StringResource("revanced_swipe_volume_summary_on", "Volume swipe is enabled"),
|
||||
StringResource("revanced_swipe_volume_summary_off", "Volume swipe is disabled")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_enable_press_to_swipe",
|
||||
StringResource("revanced_press_to_swipe_enabled_title", "Enable press-to-swipe gesture"),
|
||||
false,
|
||||
StringResource("revanced_press_to_swipe_summary_on", "Press-to-swipe is enabled"),
|
||||
StringResource("revanced_press_to_swipe_summary_off", "Press-to-swipe is disabled")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_enable_swipe_haptic_feedback",
|
||||
StringResource("revanced_swipe_haptic_feedback_enabled_title", "Enable haptic feedback"),
|
||||
true,
|
||||
StringResource("revanced_swipe_haptic_feedback_summary_on", "Haptic feedback is enabled"),
|
||||
StringResource("revanced_swipe_haptic_feedback_summary_off", "Haptic feedback is disabled")
|
||||
),
|
||||
TextPreference(
|
||||
"revanced_swipe_overlay_timeout",
|
||||
StringResource("revanced_swipe_overlay_timeout_title", "Swipe overlay timeout"),
|
||||
InputType.NUMBER,
|
||||
"500",
|
||||
StringResource(
|
||||
"revanced_swipe_overlay_timeout_summary",
|
||||
"The amount of milliseconds the overlay is visible"
|
||||
)
|
||||
),
|
||||
TextPreference(
|
||||
"revanced_swipe_overlay_text_size",
|
||||
StringResource("revanced_swipe_overlay_text_size_title", "Swipe overlay text size"),
|
||||
InputType.NUMBER,
|
||||
"22",
|
||||
StringResource("revanced_swipe_overlay_text_size_summary", "The text size for swipe overlay")
|
||||
),
|
||||
TextPreference(
|
||||
"revanced_swipe_overlay_background_alpha",
|
||||
StringResource("revanced_swipe_overlay_background_alpha_title", "Swipe background visibility"),
|
||||
InputType.NUMBER,
|
||||
"127",
|
||||
StringResource(
|
||||
"revanced_swipe_overlay_background_alpha_summary",
|
||||
"The visibility of swipe overlay background"
|
||||
)
|
||||
),
|
||||
TextPreference(
|
||||
"revanced_swipe_magnitude_threshold",
|
||||
StringResource("revanced_swipe_magnitude_threshold_title", "Swipe magnitude threshold"),
|
||||
InputType.NUMBER,
|
||||
"30",
|
||||
StringResource(
|
||||
"revanced_swipe_magnitude_threshold_summary",
|
||||
"The amount of threshold for swipe to occur"
|
||||
)
|
||||
)
|
||||
),
|
||||
StringResource("revanced_swipe_controls_summary","Control volume and brightness")
|
||||
)
|
||||
)
|
||||
|
||||
val resourcesDir = "swipecontrols"
|
||||
|
||||
data.injectResources(
|
||||
this.javaClass.classLoader,
|
||||
resourcesDir,
|
||||
"drawable",
|
||||
listOf(
|
||||
"ic_sc_brightness_auto",
|
||||
"ic_sc_brightness_manual",
|
||||
"ic_sc_volume_mute",
|
||||
"ic_sc_volume_normal"
|
||||
).map { "$it.xml" }
|
||||
data.copyResources(
|
||||
"swipecontrols",
|
||||
ResourceUtils.ResourceGroup(
|
||||
"drawable",
|
||||
"ic_sc_brightness_auto.xml",
|
||||
"ic_sc_brightness_manual.xml",
|
||||
"ic_sc_volume_mute.xml",
|
||||
"ic_sc_volume_normal.xml"
|
||||
)
|
||||
)
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34")
|
||||
"com.google.android.youtube", arrayOf()
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34")
|
||||
"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")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -14,10 +14,9 @@ import org.jf.dexlib2.Opcode
|
||||
@MatchingMethod(
|
||||
"LWillAutonavInformer;", "k"
|
||||
)
|
||||
@FuzzyPatternScanMethod(2)
|
||||
@AutoplayButtonCompatibility
|
||||
@Version("0.0.1")
|
||||
object AutonavInformerFingerprint : MethodFingerprint(
|
||||
object AutoNavInformerFingerprint : MethodFingerprint(
|
||||
"Z",
|
||||
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
null,
|
||||
@@ -31,4 +30,4 @@ object AutonavInformerFingerprint : MethodFingerprint(
|
||||
),
|
||||
null,
|
||||
{ it.definingClass.endsWith("WillAutonavInformer;") }
|
||||
)
|
||||
)
|
||||
@@ -2,31 +2,19 @@ package app.revanced.patches.youtube.layout.autoplaybutton.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.autoplaybutton.annotations.AutoplayButtonCompatibility
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@Name("layout-constructor-fingerprint")
|
||||
@MatchingMethod(
|
||||
"LYouTubeControlsOverlay;", "F"
|
||||
)
|
||||
@FuzzyPatternScanMethod(2)
|
||||
@AutoplayButtonCompatibility
|
||||
@Version("0.0.1")
|
||||
object LayoutConstructorFingerprint : MethodFingerprint(
|
||||
"V",
|
||||
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
null,
|
||||
listOf(
|
||||
Opcode.CONST,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.CHECK_CAST,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
),
|
||||
listOf("1.0x")
|
||||
)
|
||||
null, null, null, null, listOf("1.0x"),
|
||||
{ methodDef ->
|
||||
methodDef.definingClass.endsWith("YouTubeControlsOverlay;")
|
||||
}
|
||||
)
|
||||
@@ -1,88 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.autoplaybutton.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.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.autoplaybutton.annotations.AutoplayButtonCompatibility
|
||||
import app.revanced.patches.youtube.layout.autoplaybutton.fingerprints.AutonavInformerFingerprint
|
||||
import app.revanced.patches.youtube.layout.autoplaybutton.fingerprints.LayoutConstructorFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.mapping.patch.ResourceIdMappingProviderResourcePatch
|
||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
||||
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
||||
|
||||
@Patch
|
||||
@DependsOn([ResourceIdMappingProviderResourcePatch::class, IntegrationsPatch::class])
|
||||
@Name("hide-autoplay-button")
|
||||
@Description("Hides the autoplay button in the video player.")
|
||||
@AutoplayButtonCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideAutoplayButton : BytecodePatch(
|
||||
listOf(
|
||||
LayoutConstructorFingerprint, AutonavInformerFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
val layoutGenMethod = LayoutConstructorFingerprint.result!!.mutableMethod
|
||||
|
||||
val autonavToggle =
|
||||
ResourceIdMappingProviderResourcePatch.resourceMappings.single { it.type == "id" && it.name == "autonav_toggle" }
|
||||
val autonavPreviewStub =
|
||||
ResourceIdMappingProviderResourcePatch.resourceMappings.single { it.type == "id" && it.name == "autonav_preview_stub" }
|
||||
|
||||
val instructions = layoutGenMethod.implementation!!.instructions
|
||||
|
||||
val autonavToggleConstIndex =
|
||||
instructions.indexOfFirst { (it as? WideLiteralInstruction)?.wideLiteral == autonavToggle.id } + 4
|
||||
val autonavPreviewStubConstIndex =
|
||||
instructions.indexOfFirst { (it as? WideLiteralInstruction)?.wideLiteral == autonavPreviewStub.id } + 4
|
||||
|
||||
injectIfBranch(layoutGenMethod, autonavToggleConstIndex)
|
||||
injectIfBranch(layoutGenMethod, autonavPreviewStubConstIndex)
|
||||
|
||||
val autonavInformerMethod = AutonavInformerFingerprint.result!!.mutableMethod
|
||||
|
||||
//force disable autoplay since it's hard to do without the button
|
||||
autonavInformerMethod.addInstructions(
|
||||
0, """
|
||||
invoke-static {}, Lapp/revanced/integrations/patches/HideAutoplayButtonPatch;->isButtonShown()Z
|
||||
move-result v0
|
||||
if-nez v0, :hidden
|
||||
const/4 v0, 0x0
|
||||
return v0
|
||||
:hidden
|
||||
nop
|
||||
"""
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private fun injectIfBranch(method: MutableMethod, index: Int) {
|
||||
val instructions = method.implementation!!.instructions
|
||||
val insn = (instructions.get(index) as? Instruction35c)!!
|
||||
val methodToCall = insn.reference.toString()
|
||||
|
||||
//remove the invoke-virtual because we want to put it in an if-statement
|
||||
method.removeInstruction(index)
|
||||
method.addInstructions(
|
||||
index, """
|
||||
invoke-static {}, Lapp/revanced/integrations/patches/HideAutoplayButtonPatch;->isButtonShown()Z
|
||||
move-result v11
|
||||
if-eqz v11, :hidebutton
|
||||
invoke-virtual {v${insn.registerC}, v${insn.registerD}, v${insn.registerE}}, $methodToCall
|
||||
:hidebutton
|
||||
nop
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package app.revanced.patches.youtube.layout.autoplaybutton.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.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.youtube.layout.autoplaybutton.annotations.AutoplayButtonCompatibility
|
||||
import app.revanced.patches.youtube.layout.autoplaybutton.fingerprints.AutoNavInformerFingerprint
|
||||
import app.revanced.patches.youtube.layout.autoplaybutton.fingerprints.LayoutConstructorFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.mapping.patch.ResourceIdMappingProviderResourcePatch
|
||||
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.iface.instruction.Instruction
|
||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
||||
import org.jf.dexlib2.iface.reference.MethodReference
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class, ResourceIdMappingProviderResourcePatch::class])
|
||||
@Name("hide-autoplay-button")
|
||||
@Description("Hides the autoplay button in the video player.")
|
||||
@AutoplayButtonCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideAutoplayButtonPatch : BytecodePatch(
|
||||
listOf(
|
||||
LayoutConstructorFingerprint, AutoNavInformerFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_autoplay_button_enabled",
|
||||
StringResource("revanced_autoplay_button_enabled_title", "Show autoplay button"),
|
||||
false,
|
||||
StringResource("revanced_autoplay_button_summary_on", "Autoplay button is shown"),
|
||||
StringResource("revanced_autoplay_button_summary_off", "Autoplay button is hidden")
|
||||
)
|
||||
)
|
||||
|
||||
val autoNavInformerMethod = AutoNavInformerFingerprint.result!!.mutableMethod
|
||||
|
||||
val layoutGenMethodResult = LayoutConstructorFingerprint.result!!
|
||||
val layoutGenMethod = layoutGenMethodResult.mutableMethod
|
||||
val layoutGenMethodInstructions = layoutGenMethod.implementation!!.instructions
|
||||
|
||||
// resolve the offsets such as ...
|
||||
val autoNavPreviewStubId = ResourceIdMappingProviderResourcePatch.resourceMappings.single {
|
||||
it.name == "autonav_preview_stub"
|
||||
}.id
|
||||
// where to insert the branch instructions and ...
|
||||
val insertIndex = layoutGenMethodInstructions.indexOfFirst {
|
||||
(it as? WideLiteralInstruction)?.wideLiteral == autoNavPreviewStubId
|
||||
}
|
||||
// where to branch away
|
||||
val branchIndex = layoutGenMethodInstructions.subList(insertIndex + 1, layoutGenMethodInstructions.size - 1).indexOfFirst {
|
||||
((it as? ReferenceInstruction)?.reference as? MethodReference)?.name == "addOnLayoutChangeListener"
|
||||
} + 2
|
||||
|
||||
val jumpInstruction = layoutGenMethodInstructions[insertIndex + branchIndex] as Instruction
|
||||
layoutGenMethod.addInstructions(
|
||||
insertIndex, """
|
||||
invoke-static {}, Lapp/revanced/integrations/patches/HideAutoplayButtonPatch;->isButtonShown()Z
|
||||
move-result v11
|
||||
if-eqz v11, :hidden
|
||||
""", listOf(ExternalLabel("hidden", jumpInstruction))
|
||||
)
|
||||
|
||||
//force disable autoplay since it's hard to do without the button
|
||||
autoNavInformerMethod.addInstructions(
|
||||
0, """
|
||||
invoke-static {}, Lapp/revanced/integrations/patches/HideAutoplayButtonPatch;->isButtonShown()Z
|
||||
move-result v0
|
||||
if-nez v0, :hidden
|
||||
const/4 v0, 0x0
|
||||
return v0
|
||||
:hidden
|
||||
nop
|
||||
"""
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.impl.ResourcePatch
|
||||
import app.revanced.patches.youtube.layout.branding.icon.annotations.CustomBrandingCompatibility
|
||||
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.File
|
||||
import java.io.FileInputStream
|
||||
import java.io.InputStream
|
||||
@@ -45,9 +46,16 @@ class CustomBrandingPatch : ResourcePatch() {
|
||||
val iconFile = getIconStream("branding/$size/$iconName.png")
|
||||
?: return PatchResultError("The icon $iconName can not be found.")
|
||||
|
||||
val outputStream = ByteArrayOutputStream()
|
||||
iconFile.use { input ->
|
||||
outputStream.use { output ->
|
||||
input.copyTo(output)
|
||||
}
|
||||
}
|
||||
|
||||
Files.write(
|
||||
resDirectory.resolve("mipmap-$iconDirectory").resolve("$iconName.png").toPath(),
|
||||
iconFile.readAllBytes()
|
||||
outputStream.toByteArray()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,15 +12,28 @@ import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patches.youtube.layout.castbutton.annotations.CastButtonCompatibility
|
||||
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
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class])
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Name("hide-cast-button")
|
||||
@Description("Hides the cast button in the video player.")
|
||||
@CastButtonCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideCastButtonPatch : BytecodePatch() {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_cast_button_enabled",
|
||||
StringResource("revanced_cast_button_enabled_title", "Show cast button"),
|
||||
false,
|
||||
StringResource("revanced_cast_button_summary_on", "Cast button is shown"),
|
||||
StringResource("revanced_cast_button_summary_off", "Cast button is hidden")
|
||||
)
|
||||
)
|
||||
|
||||
data.classes.forEach { classDef ->
|
||||
classDef.methods.forEach { method ->
|
||||
if (classDef.type.endsWith("MediaRouteButton;") && method.name == "setVisibility") {
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34")
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -50,8 +50,5 @@ object CreateButtonFingerprint : MethodFingerprint(
|
||||
Opcode.MOVE_OBJECT,
|
||||
Opcode.MOVE_OBJECT,
|
||||
Opcode.INVOKE_DIRECT_RANGE,
|
||||
Opcode.CONST_4,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
)
|
||||
)
|
||||
@@ -15,6 +15,9 @@ import app.revanced.patches.youtube.layout.createbutton.annotations.CreateButton
|
||||
import app.revanced.patches.youtube.layout.createbutton.fingerprints.CreateButtonFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.mapping.patch.ResourceIdMappingProviderResourcePatch
|
||||
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.Opcode
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||
@@ -22,7 +25,7 @@ import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
||||
import org.jf.dexlib2.iface.reference.MethodReference
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class, ResourceIdMappingProviderResourcePatch::class])
|
||||
@DependsOn([IntegrationsPatch::class, ResourceIdMappingProviderResourcePatch::class, SettingsPatch::class])
|
||||
@Name("disable-create-button")
|
||||
@Description("Hides the create button in the navigation bar.")
|
||||
@CreateButtonCompatibility
|
||||
@@ -33,6 +36,16 @@ class CreateButtonRemoverPatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_create_button_enabled",
|
||||
StringResource("revanced_create_button_enabled_title", "Show create button"),
|
||||
false,
|
||||
StringResource("revanced_create_button_summary_on", "Create button is shown"),
|
||||
StringResource("revanced_create_button_summary_off", "Create button is hidden")
|
||||
)
|
||||
)
|
||||
|
||||
val result = CreateButtonFingerprint.result!!
|
||||
|
||||
// Get the required register which holds the view object we need to pass to the method hideCreateButton
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34")
|
||||
"com.google.android.youtube", arrayOf("17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -17,10 +17,13 @@ import app.revanced.patches.youtube.layout.fullscreenpanels.annotations.Fullscre
|
||||
import app.revanced.patches.youtube.layout.fullscreenpanels.fingerprints.FullscreenViewAdderFingerprint
|
||||
import app.revanced.patches.youtube.layout.fullscreenpanels.fingerprints.FullscreenViewAdderParentFingerprint
|
||||
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
|
||||
|
||||
@Patch
|
||||
@Name("disable-fullscreen-panels")
|
||||
@DependsOn([IntegrationsPatch::class])
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Description("Disables video description and comments panel in fullscreen view.")
|
||||
@FullscreenPanelsCompatibility
|
||||
@Version("0.0.1")
|
||||
@@ -30,6 +33,16 @@ class FullscreenPanelsRemoverPatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_fullscreen_panels_enabled",
|
||||
StringResource("revanced_fullscreen_panels_enabled_title", "Show fullscreen panels"),
|
||||
false,
|
||||
StringResource("revanced_fullscreen_panels_summary_on", "Fullscreen panels are shown"),
|
||||
StringResource("revanced_fullscreen_panels_summary_off", "Fullscreen panels are hidden")
|
||||
)
|
||||
)
|
||||
|
||||
val parentResult = FullscreenViewAdderParentFingerprint.result!!
|
||||
FullscreenViewAdderFingerprint.resolve(data, parentResult.method, parentResult.classDef)
|
||||
val result = FullscreenViewAdderParentFingerprint.result
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34")
|
||||
"com.google.android.youtube", arrayOf("17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -13,10 +13,13 @@ import app.revanced.patcher.patch.impl.BytecodePatch
|
||||
import app.revanced.patches.youtube.layout.oldqualitylayout.annotations.OldQualityLayoutCompatibility
|
||||
import app.revanced.patches.youtube.layout.oldqualitylayout.fingerprints.QualityMenuViewInflateFingerprint
|
||||
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.iface.instruction.FiveRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class])
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Name("old-quality-layout")
|
||||
@Description("Enables the original quality flyout menu.")
|
||||
@OldQualityLayoutCompatibility
|
||||
@@ -25,6 +28,16 @@ class OldQualityLayoutPatch : BytecodePatch(
|
||||
listOf(QualityMenuViewInflateFingerprint)
|
||||
) {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_use_old_style_quality_settings",
|
||||
StringResource("revanced_old_style_quality_settings_enabled_title", "Use old quality layout"),
|
||||
true,
|
||||
StringResource("revanced_old_style_quality_settings_summary_on", "Old quality settings are shown"),
|
||||
StringResource("revanced_old_style_quality_settings_summary_off", "New quality settings are shown")
|
||||
)
|
||||
)
|
||||
|
||||
val inflateFingerprintResult = QualityMenuViewInflateFingerprint.result!!
|
||||
val method = inflateFingerprintResult.mutableMethod
|
||||
val instructions = method.implementation!!.instructions
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34")
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -7,13 +7,18 @@ import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.impl.BytecodeData
|
||||
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.BytecodePatch
|
||||
import app.revanced.patches.youtube.layout.reels.annotations.HideReelsCompatibility
|
||||
import app.revanced.patches.youtube.layout.reels.fingerprints.HideReelsFingerprint
|
||||
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
|
||||
|
||||
//@Patch TODO: this is currently in the general-bytecode-ads patch due to the integrations having a preference for including reels or not. Move it here.
|
||||
@Name("hide-reels")
|
||||
@Description("Hides reels on the home page.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@HideReelsCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideReelsPatch : BytecodePatch(
|
||||
@@ -22,6 +27,16 @@ class HideReelsPatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_reel_button_enabled",
|
||||
StringResource("revanced_reel_button_enabled_title", "Show reels button"),
|
||||
false,
|
||||
StringResource("revanced_reel_button_summary_on", "Reels button is shown"),
|
||||
StringResource("revanced_reel_button_summary_off", "Reels button is hidden")
|
||||
)
|
||||
)
|
||||
|
||||
val result = HideReelsFingerprint.result!!
|
||||
|
||||
// HideReel will hide the reel view before it is being used,
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.26.35", "17.27.39", "17.28.34", "17.29.34")
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -12,15 +12,16 @@ 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.returnyoutubedislike.annotations.ReturnYouTubeDislikeCompatibility
|
||||
import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.TextComponentSpecParentFingerprint
|
||||
import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.DislikeFingerprint
|
||||
import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.LikeFingerprint
|
||||
import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.RemoveLikeFingerprint
|
||||
import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.TextComponentSpecParentFingerprint
|
||||
import app.revanced.patches.youtube.layout.returnyoutubedislike.resource.patch.ReturnYouTubeDislikeResourcePatch
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.videoid.patch.VideoIdPatch
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class, VideoIdPatch::class])
|
||||
@DependsOn([IntegrationsPatch::class, VideoIdPatch::class, ReturnYouTubeDislikeResourcePatch::class])
|
||||
@Name("return-youtube-dislike")
|
||||
@Description("Shows the dislike count of videos using the Return YouTube Dislike API.")
|
||||
@ReturnYouTubeDislikeCompatibility
|
||||
@@ -57,9 +58,9 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
|
||||
|
||||
val parentResult = TextComponentSpecParentFingerprint.result!!
|
||||
val createComponentMethod = parentResult.mutableClass.methods.find { method ->
|
||||
method.parameters.size >= 19 && method.parameterTypes.takeLast(4)
|
||||
.all { param -> param == "Ljava/util/concurrent/atomic/AtomicReference;" }
|
||||
}
|
||||
method.parameters.size >= 19 && method.parameterTypes.takeLast(4)
|
||||
.all { param -> param == "Ljava/util/concurrent/atomic/AtomicReference;" }
|
||||
}
|
||||
?: return PatchResultError("TextComponentSpec.createComponent not found")
|
||||
|
||||
val conversionContextParam = 5
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package app.revanced.patches.youtube.layout.returnyoutubedislike.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.youtube.layout.returnyoutubedislike.annotations.ReturnYouTubeDislikeCompatibility
|
||||
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.Preference
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||
import app.revanced.util.resources.ResourceUtils.Settings.mergeStrings
|
||||
|
||||
@DependsOn([FixLocaleConfigErrorPatch::class, SettingsPatch::class])
|
||||
@Name("return-youtube-dislike-resource-patch")
|
||||
@Description("Adds the preferences for Return YouTube Dislike.")
|
||||
@ReturnYouTubeDislikeCompatibility
|
||||
@Version("0.0.1")
|
||||
class ReturnYouTubeDislikeResourcePatch : ResourcePatch() {
|
||||
override fun execute(data: ResourceData): PatchResult {
|
||||
val youtubePackage = "com.google.android.youtube"
|
||||
SettingsPatch.addPreference(
|
||||
Preference(
|
||||
StringResource("revanced_ryd_settings_title", "Return YouTube Dislike"),
|
||||
Preference.Intent(
|
||||
youtubePackage,
|
||||
"ryd_settings",
|
||||
"com.google.android.libraries.social.licenses.LicenseActivity"
|
||||
),
|
||||
StringResource("revanced_ryd_settings_summary", "Settings for Return YouTube Dislike"),
|
||||
)
|
||||
)
|
||||
// merge strings
|
||||
data.mergeStrings("returnyoutubedislike/host/values/strings.xml")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34")
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -22,9 +22,6 @@ object PivotBarButtonTabEnumFingerprint : MethodFingerprint(
|
||||
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
listOf("Z"),
|
||||
listOf(
|
||||
Opcode.CHECK_CAST,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.IF_NEZ,
|
||||
Opcode.SGET_OBJECT,
|
||||
Opcode.IGET,
|
||||
Opcode.INVOKE_STATIC,
|
||||
@@ -35,11 +32,5 @@ object PivotBarButtonTabEnumFingerprint : MethodFingerprint(
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.CHECK_CAST,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.IF_NEZ,
|
||||
Opcode.SGET_OBJECT,
|
||||
Opcode.IGET,
|
||||
Opcode.INVOKE_STATIC, // SomeEnum.fromValue(tabOrdinal)
|
||||
Opcode.MOVE_RESULT_OBJECT
|
||||
)
|
||||
)
|
||||
|
||||
@@ -20,11 +20,6 @@ object PivotBarButtonsViewFingerprint : MethodFingerprint(
|
||||
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
listOf("Z"),
|
||||
listOf(
|
||||
Opcode.INVOKE_VIRTUAL_RANGE,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.GOTO,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.IF_NEZ,
|
||||
Opcode.SGET_OBJECT,
|
||||
Opcode.IGET,
|
||||
Opcode.INVOKE_STATIC,
|
||||
|
||||
@@ -14,10 +14,14 @@ import app.revanced.patches.youtube.layout.shorts.button.annotations.ShortsButto
|
||||
import app.revanced.patches.youtube.layout.shorts.button.fingerprints.PivotBarButtonTabEnumFingerprint
|
||||
import app.revanced.patches.youtube.layout.shorts.button.fingerprints.PivotBarButtonsViewFingerprint
|
||||
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.iface.instruction.OneRegisterInstruction
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class])
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Name("hide-shorts-button")
|
||||
@Description("Hides the shorts button on the navigation bar.")
|
||||
@ShortsButtonCompatibility
|
||||
@@ -28,30 +32,58 @@ class ShortsButtonRemoverPatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_shorts_button_enabled",
|
||||
StringResource("revanced_shorts_button_enabled_title", "Show shorts button"),
|
||||
false,
|
||||
StringResource("revanced_shorts_button_summary_on", "Shorts button is shown"),
|
||||
StringResource("revanced_shorts_button_summary_off", "Shorts button is hidden")
|
||||
)
|
||||
)
|
||||
|
||||
val tabEnumResult = PivotBarButtonTabEnumFingerprint.result!!
|
||||
val tabEnumImplementation = tabEnumResult.mutableMethod.implementation!!
|
||||
val moveEnumInstruction = tabEnumImplementation.instructions[tabEnumResult.patternScanResult!!.endIndex]
|
||||
val scanResultEndIndex = tabEnumResult.patternScanResult!!.endIndex
|
||||
val tabEnumIndex = scanResultEndIndex +
|
||||
if (tabEnumImplementation.instructions[scanResultEndIndex + 1].opcode == Opcode.IGET_OBJECT) {
|
||||
// for 17.31.xx and lower
|
||||
7
|
||||
} else {
|
||||
// since 17.32.xx
|
||||
10
|
||||
}
|
||||
val moveEnumInstruction = tabEnumImplementation.instructions[tabEnumIndex]
|
||||
val enumRegister = (moveEnumInstruction as OneRegisterInstruction).registerA
|
||||
|
||||
val buttonsViewResult = PivotBarButtonsViewFingerprint.result!!
|
||||
val buttonsViewImplementation = buttonsViewResult.mutableMethod.implementation!!
|
||||
val moveViewInstruction = buttonsViewImplementation.instructions[buttonsViewResult.patternScanResult!!.startIndex + 1]
|
||||
val scanResultStartIndex = buttonsViewResult.patternScanResult!!.startIndex
|
||||
val buttonsViewIndex = scanResultStartIndex +
|
||||
if (buttonsViewImplementation.instructions[scanResultStartIndex - 1].opcode == Opcode.GOTO) {
|
||||
// since 17.32.xx
|
||||
-7
|
||||
} else {
|
||||
// for 17.31.xx and lower
|
||||
-3
|
||||
}
|
||||
val moveViewInstruction = buttonsViewImplementation.instructions[buttonsViewIndex - 1]
|
||||
val viewRegister = (moveViewInstruction as OneRegisterInstruction).registerA
|
||||
|
||||
|
||||
// Save the tab enum in XGlobals to avoid smali/register workarounds
|
||||
tabEnumResult.mutableMethod.addInstruction(
|
||||
tabEnumResult.patternScanResult!!.endIndex + 1,
|
||||
tabEnumIndex,
|
||||
"sput-object v$enumRegister, Lapp/revanced/integrations/patches/HideShortsButtonPatch;->lastPivotTab:Ljava/lang/Enum;"
|
||||
)
|
||||
|
||||
// Hide the button view via proxy by passing it to the hideShortsButton method
|
||||
// It only hides it if the last tab name is "TAB_SHORTS"
|
||||
buttonsViewResult.mutableMethod.addInstruction(
|
||||
buttonsViewResult.patternScanResult!!.startIndex + 3,
|
||||
buttonsViewIndex + 1,
|
||||
"invoke-static { v$viewRegister }, Lapp/revanced/integrations/patches/HideShortsButtonPatch;->hideShortsButton(Landroid/view/View;)V"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.22.36", "17.26.35", "17.27.39", "17.28.34", "17.29.34")
|
||||
"com.google.android.youtube", arrayOf("17.22.36", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
|
||||
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility
|
||||
|
||||
@Name("show-player-controls-fingerprint")
|
||||
@MatchingMethod(
|
||||
"LYouTubeControlsOverlay;", "ac"
|
||||
)
|
||||
@DirectPatternScanMethod
|
||||
@SponsorBlockCompatibility
|
||||
@Version("0.0.1")
|
||||
object ShowPlayerControlsFingerprint : MethodFingerprint(
|
||||
"V", null, listOf("Z","Z"), null, null
|
||||
)
|
||||
@@ -23,6 +23,7 @@ import app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints.*
|
||||
import app.revanced.patches.youtube.layout.sponsorblock.resource.patch.SponsorBlockResourcePatch
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.mapping.patch.ResourceIdMappingProviderResourcePatch
|
||||
import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch
|
||||
import app.revanced.patches.youtube.misc.videoid.patch.VideoIdPatch
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
@@ -38,7 +39,7 @@ import org.jf.dexlib2.util.MethodUtil
|
||||
|
||||
@Patch
|
||||
@DependsOn(
|
||||
dependencies = [IntegrationsPatch::class, ResourceIdMappingProviderResourcePatch::class, SponsorBlockResourcePatch::class, VideoIdPatch::class]
|
||||
dependencies = [PlayerControlsBytecodePatch::class, IntegrationsPatch::class, ResourceIdMappingProviderResourcePatch::class, SponsorBlockResourcePatch::class, VideoIdPatch::class]
|
||||
)
|
||||
@Name("sponsorblock")
|
||||
@Description("Integrate SponsorBlock.")
|
||||
@@ -147,7 +148,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
||||
it.registerC to it.registerE
|
||||
}
|
||||
seekbarMethod.addInstruction(
|
||||
drawSegmentInstructionInsertIndex - 1,
|
||||
drawSegmentInstructionInsertIndex,
|
||||
"invoke-static {v$canvasInstance, v$centerY}, Lapp/revanced/integrations/sponsorblock/PlayerController;->drawSponsorTimeBars(Landroid/graphics/Canvas;F)V"
|
||||
)
|
||||
|
||||
@@ -171,8 +172,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
||||
/*
|
||||
Voting & Shield button
|
||||
*/
|
||||
ShowPlayerControlsFingerprint.resolve(data, data.classes.find { it.type.endsWith("YouTubeControlsOverlay;") }!!)
|
||||
val controlsMethodResult = ShowPlayerControlsFingerprint.result!!
|
||||
val controlsMethodResult = PlayerControlsBytecodePatch.showPlayerControlsFingerprintResult
|
||||
|
||||
val controlsLayoutStubResourceId =
|
||||
ResourceIdMappingProviderResourcePatch.resourceMappings.single { it.type == "id" && it.name == "controls_layout_stub" }.id
|
||||
@@ -217,12 +217,8 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
||||
}
|
||||
|
||||
// change visibility of the buttons
|
||||
controlsMethodResult.mutableMethod.addInstructions(
|
||||
0, """
|
||||
invoke-static {p1}, Lapp/revanced/integrations/sponsorblock/ShieldButton;->changeVisibility(Z)V
|
||||
invoke-static {p1}, Lapp/revanced/integrations/sponsorblock/VotingButton;->changeVisibility(Z)V
|
||||
""".trimIndent()
|
||||
)
|
||||
PlayerControlsBytecodePatch.injectVisibilityCheckCall("Lapp/revanced/integrations/sponsorblock/ShieldButton;->changeVisibility(Z)V")
|
||||
PlayerControlsBytecodePatch.injectVisibilityCheckCall("Lapp/revanced/integrations/sponsorblock/VotingButton;->changeVisibility(Z)V")
|
||||
|
||||
// set SegmentHelperLayout.context to the player layout instance
|
||||
val instanceRegister = 0
|
||||
|
||||
@@ -9,96 +9,99 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.impl.ResourcePatch
|
||||
import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility
|
||||
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.Preference
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||
import app.revanced.util.resources.ResourceUtils
|
||||
import app.revanced.util.resources.ResourceUtils.Settings.mergeStrings
|
||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||
import app.revanced.util.resources.ResourceUtils.copyXmlNode
|
||||
import java.nio.file.Files
|
||||
|
||||
@Name("sponsorblock-resource-patch")
|
||||
@SponsorBlockCompatibility
|
||||
@DependsOn([FixLocaleConfigErrorPatch::class])
|
||||
@DependsOn([FixLocaleConfigErrorPatch::class, SettingsPatch::class])
|
||||
@Version("0.0.1")
|
||||
class SponsorBlockResourcePatch : ResourcePatch() {
|
||||
override fun execute(data: ResourceData): PatchResult {
|
||||
val youtubePackage = "com.google.android.youtube"
|
||||
SettingsPatch.addPreference(
|
||||
Preference(
|
||||
StringResource("sb_settings", "SponsorBlock"),
|
||||
Preference.Intent(
|
||||
youtubePackage,
|
||||
"sponsorblock_settings",
|
||||
"com.google.android.libraries.social.licenses.LicenseActivity"
|
||||
),
|
||||
StringResource("revanced_sponsorblock_settings_summary", "SponsorBlock related settings"),
|
||||
)
|
||||
)
|
||||
val classLoader = this.javaClass.classLoader
|
||||
|
||||
/*
|
||||
merge SponsorBlock strings to main strings
|
||||
*/
|
||||
val stringsResourcePath = "values/strings.xml"
|
||||
val stringsResourceInputStream = classLoader.getResourceAsStream("sponsorblock/$stringsResourcePath")!!
|
||||
|
||||
// copy nodes from the resources node to the real resource node
|
||||
"resources".copyXmlNode(
|
||||
data.xmlEditor[stringsResourceInputStream],
|
||||
data.xmlEditor["res/$stringsResourcePath"]
|
||||
).close() // close afterwards
|
||||
data.mergeStrings("sponsorblock/host/values/strings.xml")
|
||||
|
||||
/*
|
||||
merge SponsorBlock drawables to main drawables
|
||||
*/
|
||||
val drawables = "drawable" to arrayOf(
|
||||
"ic_sb_adjust",
|
||||
"ic_sb_compare",
|
||||
"ic_sb_edit",
|
||||
"ic_sb_logo",
|
||||
"ic_sb_publish",
|
||||
"ic_sb_voting"
|
||||
)
|
||||
|
||||
val layouts = "layout" to arrayOf(
|
||||
"inline_sponsor_overlay", "new_segment", "skip_sponsor_button"
|
||||
)
|
||||
|
||||
// collect resources
|
||||
val xmlResources = arrayOf(drawables, layouts)
|
||||
|
||||
// write resources
|
||||
xmlResources.forEach { (path, resourceNames) ->
|
||||
resourceNames.forEach { name ->
|
||||
val relativePath = "$path/$name.xml"
|
||||
|
||||
Files.copy(
|
||||
classLoader.getResourceAsStream("sponsorblock/$relativePath")!!,
|
||||
data["res"].resolve(relativePath).toPath()
|
||||
)
|
||||
}
|
||||
arrayOf(
|
||||
ResourceUtils.ResourceGroup(
|
||||
"layout",
|
||||
"inline_sponsor_overlay.xml",
|
||||
"new_segment.xml",
|
||||
"skip_sponsor_button.xml"
|
||||
),
|
||||
ResourceUtils.ResourceGroup(
|
||||
// required resource for back button, because when the base APK is used, this resource will not exist
|
||||
"drawable",
|
||||
"ic_sb_adjust.xml",
|
||||
"ic_sb_compare.xml",
|
||||
"ic_sb_edit.xml",
|
||||
"ic_sb_logo.xml",
|
||||
"ic_sb_publish.xml",
|
||||
"ic_sb_voting.xml"
|
||||
),
|
||||
ResourceUtils.ResourceGroup(
|
||||
// required resource for back button, because when the base APK is used, this resource will not exist
|
||||
"drawable-xxxhdpi", "quantum_ic_skip_next_white_24.png"
|
||||
)
|
||||
).forEach { resourceGroup ->
|
||||
data.copyResources("sponsorblock", resourceGroup)
|
||||
}
|
||||
|
||||
/*
|
||||
merge xml nodes from the host to their real xml files
|
||||
*/
|
||||
|
||||
// collect all host resources
|
||||
val hostingXmlResources = mapOf("layout" to arrayOf("youtube_controls_layout"))
|
||||
|
||||
// copy nodes from host resources to their real xml files
|
||||
hostingXmlResources.forEach { (path, resources) ->
|
||||
resources.forEach { resource ->
|
||||
val hostingResourceStream = classLoader.getResourceAsStream("sponsorblock/host/$path/$resource.xml")!!
|
||||
val hostingResourceStream =
|
||||
classLoader.getResourceAsStream("sponsorblock/host/layout/youtube_controls_layout.xml")!!
|
||||
|
||||
val targetXmlEditor = data.xmlEditor["res/$path/$resource.xml"]
|
||||
"RelativeLayout".copyXmlNode(
|
||||
data.xmlEditor[hostingResourceStream],
|
||||
targetXmlEditor
|
||||
).also {
|
||||
val children = targetXmlEditor.file.getElementsByTagName("RelativeLayout").item(0).childNodes
|
||||
val targetXmlEditor = data.xmlEditor["res/layout/youtube_controls_layout.xml"]
|
||||
"RelativeLayout".copyXmlNode(
|
||||
data.xmlEditor[hostingResourceStream],
|
||||
targetXmlEditor
|
||||
).also {
|
||||
val children = targetXmlEditor.file.getElementsByTagName("RelativeLayout").item(0).childNodes
|
||||
|
||||
// Replace the startOf with the voting button view so that the button does not overlap
|
||||
for (i in 1 until children.length) {
|
||||
val view = children.item(i)
|
||||
// Replace the startOf with the voting button view so that the button does not overlap
|
||||
for (i in 1 until children.length) {
|
||||
val view = children.item(i)
|
||||
|
||||
// Replace the attribute for a specific node only
|
||||
if (!(view.hasAttributes() && view.attributes.getNamedItem("android:id").nodeValue.endsWith("live_chat_overlay_button"))) continue
|
||||
// Replace the attribute for a specific node only
|
||||
if (!(view.hasAttributes() && view.attributes.getNamedItem("android:id").nodeValue.endsWith("live_chat_overlay_button"))) continue
|
||||
|
||||
// voting button id from the voting button view from the youtube_controls_layout.xml host file
|
||||
val votingButtonId = "@+id/voting_button"
|
||||
// voting button id from the voting button view from the youtube_controls_layout.xml host file
|
||||
val votingButtonId = "@+id/voting_button"
|
||||
|
||||
view.attributes.getNamedItem("android:layout_toStartOf").nodeValue = votingButtonId
|
||||
view.attributes.getNamedItem("android:layout_toStartOf").nodeValue = votingButtonId
|
||||
|
||||
break
|
||||
}
|
||||
}.close() // close afterwards
|
||||
break
|
||||
}
|
||||
}
|
||||
}.close() // close afterwards
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.26.35", "17.29.34")
|
||||
"com.google.android.youtube", arrayOf("17.26.35", "17.29.34", "17.32.35", "17.33.42")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -22,15 +22,6 @@ object MiniPlayerDimensionsCalculatorFingerprint : MethodFingerprint(
|
||||
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,
|
||||
|
||||
@@ -19,10 +19,13 @@ import app.revanced.patches.youtube.layout.tabletminiplayer.fingerprints.MiniPla
|
||||
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 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.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class])
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Name("tablet-mini-player")
|
||||
@Description("Enables the tablet mini player layout.")
|
||||
@TabletMiniPlayerCompatibility
|
||||
@@ -34,6 +37,14 @@ class TabletMiniPlayerPatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(SwitchPreference(
|
||||
"revanced_tablet_miniplayer",
|
||||
StringResource("revanced_tablet_miniplayer_title", "Enable the tablet Mini-player"),
|
||||
false,
|
||||
StringResource("revanced_tablet_miniplayer_summary_on", "Tablet Mini-player is enabled"),
|
||||
StringResource("revanced_tablet_miniplayer_summary_off", "Tablet Mini-player is disabled")
|
||||
))
|
||||
|
||||
// first resolve the fingerprints via the parent fingerprint
|
||||
val miniPlayerClass = MiniPlayerDimensionsCalculatorFingerprint.result!!.classDef
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34")
|
||||
"com.google.android.youtube", arrayOf("17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -17,9 +17,12 @@ import app.revanced.patches.youtube.layout.watermark.annotations.HideWatermarkCo
|
||||
import app.revanced.patches.youtube.layout.watermark.fingerprints.HideWatermarkParentFingerprint
|
||||
import app.revanced.patches.youtube.layout.watermark.fingerprints.HideWatermarkFingerprint
|
||||
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
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class])
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Name("hide-watermark")
|
||||
@Description("Hides creator's watermarks on videos.")
|
||||
@HideWatermarkCompatibility
|
||||
@@ -30,6 +33,16 @@ class HideWatermarkPatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_branding_watermark_enabled",
|
||||
StringResource("revanced_branding_watermark_enabled_title", "Show branding watermark"),
|
||||
false,
|
||||
StringResource("revanced_branding_watermark_summary_on", "Branding watermark is shown"),
|
||||
StringResource("revanced_branding_watermark_summary_off", "Branding watermark is hidden")
|
||||
)
|
||||
)
|
||||
|
||||
HideWatermarkFingerprint.resolve(data, HideWatermarkParentFingerprint.result!!.classDef)
|
||||
val result = HideWatermarkFingerprint.result
|
||||
?: return PatchResultError("Required parent method could not be found.")
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34")
|
||||
"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")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -42,7 +42,7 @@ See:
|
||||
*/
|
||||
|
||||
object WideSearchbarTwoFingerprint : MethodFingerprint(
|
||||
"L", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L", "L", "L", "L"), listOf(
|
||||
"L", AccessFlags.PUBLIC or AccessFlags.STATIC, null, listOf(
|
||||
Opcode.INVOKE_STATIC, Opcode.MOVE_RESULT, Opcode.IF_EQZ, Opcode.NEW_INSTANCE
|
||||
),
|
||||
null, null
|
||||
|
||||
@@ -3,10 +3,8 @@ package app.revanced.patches.youtube.layout.widesearchbar.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.impl.MethodFingerprint
|
||||
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
||||
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||
import app.revanced.patches.youtube.layout.reels.annotations.HideReelsCompatibility
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.layout.widesearchbar.annotations.WideSearchbarCompatibility
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
|
||||
@@ -14,7 +12,6 @@ import org.jf.dexlib2.AccessFlags
|
||||
@MatchingMethod(
|
||||
"Lkrf;", "i"
|
||||
)
|
||||
@FuzzyPatternScanMethod(3)
|
||||
@WideSearchbarCompatibility
|
||||
@Version("0.0.1")
|
||||
|
||||
|
||||
@@ -19,9 +19,12 @@ import app.revanced.patches.youtube.layout.widesearchbar.fingerprints.WideSearch
|
||||
import app.revanced.patches.youtube.layout.widesearchbar.fingerprints.WideSearchbarTwoFingerprint
|
||||
import app.revanced.patches.youtube.layout.widesearchbar.fingerprints.WideSearchbarTwoParentFingerprint
|
||||
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
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class])
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Name("enable-wide-searchbar")
|
||||
@Description("Replaces the search icon with a wide search bar. This will hide the YouTube logo when active.")
|
||||
@WideSearchbarCompatibility
|
||||
@@ -32,6 +35,16 @@ class WideSearchbarPatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_wide_searchbar",
|
||||
StringResource("revanced_wide_searchbar_enabled_title", "Enable wide search bar"),
|
||||
false,
|
||||
StringResource("revanced_wide_searchbar_summary_on", "Wide search bar is enabled"),
|
||||
StringResource("revanced_wide_searchbar_summary_off", "Wide search bar is disabled")
|
||||
)
|
||||
)
|
||||
|
||||
WideSearchbarOneFingerprint.resolve(data, WideSearchbarOneParentFingerprint.result!!.classDef)
|
||||
WideSearchbarTwoFingerprint.resolve(data, WideSearchbarTwoParentFingerprint.result!!.classDef)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34")
|
||||
"com.google.android.youtube", arrayOf("17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -17,6 +17,9 @@ import app.revanced.patches.youtube.misc.autorepeat.annotations.AutoRepeatCompat
|
||||
import app.revanced.patches.youtube.misc.autorepeat.fingerprints.AutoRepeatFingerprint
|
||||
import app.revanced.patches.youtube.misc.autorepeat.fingerprints.AutoRepeatParentFingerprint
|
||||
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
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class])
|
||||
@@ -30,6 +33,16 @@ class AutoRepeatPatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.MISC.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_pref_auto_repeat",
|
||||
StringResource("revanced_auto_repeat_enabled_title", "Enable auto-repeat"),
|
||||
false,
|
||||
StringResource("revanced_auto_repeat_summary_on", "Auto-repeat is enabled"),
|
||||
StringResource("revanced_auto_repeat_summary_off", "Auto-repeat is disabled")
|
||||
)
|
||||
)
|
||||
|
||||
//Get Result from the ParentFingerprint which is the playMethod we need to get.
|
||||
val parentResult = AutoRepeatParentFingerprint.result
|
||||
?: return PatchResultError("ParentFingerprint did not resolve.")
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package app.revanced.patches.youtube.misc.clientspoof.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[
|
||||
Package("com.google.android.youtube", arrayOf()),
|
||||
Package("com.vanced.android.youtube", arrayOf())
|
||||
]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
internal annotation class ClientSpoofCompatibility
|
||||
@@ -0,0 +1,20 @@
|
||||
package app.revanced.patches.youtube.misc.clientspoof.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.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.clientspoof.annotations.ClientSpoofCompatibility
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@Name("user-agent-header-builder-fingerprint")
|
||||
@ClientSpoofCompatibility
|
||||
@DirectPatternScanMethod
|
||||
@Version("0.0.1")
|
||||
object UserAgentHeaderBuilderFingerprint : MethodFingerprint(
|
||||
null,
|
||||
null,
|
||||
listOf("L", "L", "L"),
|
||||
listOf(Opcode.MOVE_RESULT_OBJECT, Opcode.INVOKE_VIRTUAL),
|
||||
listOf("(Linux; U; Android "),
|
||||
)
|
||||
@@ -0,0 +1,38 @@
|
||||
package app.revanced.patches.youtube.misc.clientspoof.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.extensions.instruction
|
||||
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.patches.youtube.misc.clientspoof.annotations.ClientSpoofCompatibility
|
||||
import app.revanced.patches.youtube.misc.clientspoof.fingerprints.UserAgentHeaderBuilderFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@Name("client-spoof")
|
||||
@Description("Spoofs the YouTube or Vanced client to prevent playback issues.")
|
||||
@ClientSpoofCompatibility
|
||||
@Version("0.0.1")
|
||||
class ClientSpoofPatch : BytecodePatch(
|
||||
listOf(UserAgentHeaderBuilderFingerprint)
|
||||
) {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
val result = UserAgentHeaderBuilderFingerprint.result!!
|
||||
val method = result.mutableMethod
|
||||
|
||||
val insertIndex = result.patternScanResult!!.endIndex
|
||||
val packageNameRegister = (method.instruction(insertIndex) as FiveRegisterInstruction).registerD
|
||||
|
||||
val originalPackageName = "com.google.android.youtube"
|
||||
method.addInstruction(insertIndex, "const-string v$packageNameRegister, \"$originalPackageName\"")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.24.34", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34")
|
||||
"com.google.android.youtube", arrayOf("17.24.34", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -35,6 +35,8 @@ class CustomPlaybackSpeedPatch : BytecodePatch(
|
||||
) {
|
||||
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
//TODO: include setting to skip remembering the new speed
|
||||
|
||||
val arrayGenMethod = SpeedArrayGeneratorFingerprint.result?.mutableMethod!!
|
||||
val arrayGenMethodImpl = arrayGenMethod.implementation!!
|
||||
|
||||
|
||||
@@ -6,18 +6,34 @@ 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.annotations.Patch
|
||||
import app.revanced.patcher.patch.impl.ResourcePatch
|
||||
import app.revanced.patches.youtube.misc.enabledebugging.annotations.EnableDebuggingCompatibility
|
||||
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.w3c.dom.Element
|
||||
|
||||
@Patch(false)
|
||||
@Name("enable-debugging")
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Description("Enables app debugging by patching the manifest file.")
|
||||
@EnableDebuggingCompatibility
|
||||
@Version("0.0.1")
|
||||
class EnableDebuggingPatch : ResourcePatch() {
|
||||
override fun execute(data: ResourceData): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.MISC.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_debug_enabled",
|
||||
StringResource("revanced_debug_title", "Debug"),
|
||||
false,
|
||||
StringResource("revanced_debug_on", "Debug logs are enabled"),
|
||||
StringResource("revanced_debug_off", "Debug logs are disabled")
|
||||
)
|
||||
)
|
||||
|
||||
// create an xml editor instance
|
||||
data.xmlEditor["AndroidManifest.xml"].use { dom ->
|
||||
// get the application node
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34")
|
||||
"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")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
package app.revanced.patches.youtube.misc.hdrbrightness.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.misc.hdrbrightness.annotations.HDRBrightnessCompatibility
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
|
||||
|
||||
@Name("hdr-brightness-fingerprint-ghz")
|
||||
@MatchingMethod(
|
||||
"Lghz;", "g"
|
||||
)
|
||||
@FuzzyPatternScanMethod(3)
|
||||
@HDRBrightnessCompatibility
|
||||
@Version("0.0.1")
|
||||
object HDRBrightnessFingerprintGHZ : MethodFingerprint(
|
||||
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, null,
|
||||
listOf(
|
||||
/* WindowManager.LayoutParams lp = br.getWindow().getAttributes();
|
||||
* lp.screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_FULL;
|
||||
* br.getWindow().setAttributes(lp);
|
||||
*/
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.CONST_HIGH16,
|
||||
Opcode.IPUT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL
|
||||
),
|
||||
null,
|
||||
customFingerprint = { methodDef ->
|
||||
methodDef.implementation!!.instructions.count() == 16 && methodDef.implementation!!.instructions.any {
|
||||
((it as? NarrowLiteralInstruction)?.narrowLiteral == (/*BRIGHTNESS_OVERRIDE_FULL*/ 1.0f).toRawBits())
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -1,44 +0,0 @@
|
||||
package app.revanced.patches.youtube.misc.hdrbrightness.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.misc.hdrbrightness.annotations.HDRBrightnessCompatibility
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
|
||||
|
||||
@Name("hdr-brightness-fingerprint-gul")
|
||||
@MatchingMethod(
|
||||
"Lgul;", "g"
|
||||
)
|
||||
@FuzzyPatternScanMethod(3)
|
||||
@HDRBrightnessCompatibility
|
||||
@Version("0.0.1")
|
||||
object HDRBrightnessFingerprintGUL : MethodFingerprint(
|
||||
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, null,
|
||||
listOf(
|
||||
/* WindowManager.LayoutParams lp = br.getWindow().getAttributes();
|
||||
* lp.screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_FULL;
|
||||
* br.getWindow().setAttributes(lp);
|
||||
*/
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.CONST_HIGH16,
|
||||
Opcode.IPUT,
|
||||
//Opcode.INVOKE_VIRTUAL,
|
||||
//Opcode.MOVE_RESULT_OBJECT,
|
||||
//Opcode.INVOKE_VIRTUAL
|
||||
),
|
||||
null,
|
||||
customFingerprint = { methodDef ->
|
||||
methodDef.implementation!!.instructions.count() == 14 && methodDef.implementation!!.instructions.any {
|
||||
((it as? NarrowLiteralInstruction)?.narrowLiteral == (/*BRIGHTNESS_OVERRIDE_FULL*/ 1.0f).toRawBits())
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -1,44 +0,0 @@
|
||||
package app.revanced.patches.youtube.misc.hdrbrightness.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.misc.hdrbrightness.annotations.HDRBrightnessCompatibility
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
|
||||
|
||||
@Name("hdr-brightness-fingerprint-tio")
|
||||
@MatchingMethod(
|
||||
"Ltio;", "g"
|
||||
)
|
||||
@FuzzyPatternScanMethod(3)
|
||||
@HDRBrightnessCompatibility
|
||||
@Version("0.0.1")
|
||||
object HDRBrightnessFingerprintTIO : MethodFingerprint(
|
||||
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, null,
|
||||
listOf(
|
||||
/* WindowManager.LayoutParams lp = br.getWindow().getAttributes();
|
||||
* lp.screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_FULL;
|
||||
* br.getWindow().setAttributes(lp);
|
||||
*/
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.CONST_HIGH16,
|
||||
Opcode.IPUT,
|
||||
//Opcode.INVOKE_VIRTUAL,
|
||||
//Opcode.MOVE_RESULT_OBJECT,
|
||||
//Opcode.INVOKE_VIRTUAL
|
||||
),
|
||||
null,
|
||||
customFingerprint = { methodDef ->
|
||||
methodDef.implementation!!.instructions.count() == 22 && methodDef.implementation!!.instructions.any {
|
||||
((it as? NarrowLiteralInstruction)?.narrowLiteral == (/*BRIGHTNESS_OVERRIDE_FULL*/ 1.0f).toRawBits())
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -14,12 +14,12 @@ import org.jf.dexlib2.iface.reference.FieldReference
|
||||
|
||||
@Name("hdr-brightness-fingerprint-xxz")
|
||||
@MatchingMethod(
|
||||
"Lxxz;", "G"
|
||||
"Lyel;", "G"
|
||||
)
|
||||
@FuzzyPatternScanMethod(3)
|
||||
@HDRBrightnessCompatibility
|
||||
@Version("0.0.1")
|
||||
object HDRBrightnessFingerprintXXZ : MethodFingerprint(
|
||||
object HDRBrightnessFingerprintYEL : MethodFingerprint(
|
||||
"V", AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
listOf("I", "I", "I", "I"),
|
||||
listOf(
|
||||
@@ -0,0 +1,31 @@
|
||||
package app.revanced.patches.youtube.misc.hdrbrightness.fingerprints
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
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.misc.hdrbrightness.annotations.HDRBrightnessCompatibility
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@Name("hdr-brightness-fingerprint-xxz")
|
||||
@MatchingMethod(
|
||||
"Lyjk;", "D"
|
||||
)
|
||||
@FuzzyPatternScanMethod(3)
|
||||
@HDRBrightnessCompatibility
|
||||
@Version("0.0.1")
|
||||
object HDRBrightnessFingerprintYJK : MethodFingerprint(
|
||||
"V", null, null,
|
||||
listOf(
|
||||
Opcode.SGET_OBJECT,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.IGET,
|
||||
Opcode.IPUT,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL
|
||||
),
|
||||
listOf("c.SettingNotFound;", "screen_brightness", "android.mediaview"),
|
||||
)
|
||||
@@ -6,14 +6,17 @@ 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.PatchResultError
|
||||
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.misc.hdrbrightness.annotations.HDRBrightnessCompatibility
|
||||
import app.revanced.patches.youtube.misc.hdrbrightness.fingerprints.HDRBrightnessFingerprintXXZ
|
||||
import app.revanced.patches.youtube.misc.hdrbrightness.fingerprints.HDRBrightnessFingerprintYEL
|
||||
import app.revanced.patches.youtube.misc.hdrbrightness.fingerprints.HDRBrightnessFingerprintYJK
|
||||
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.iface.instruction.ReferenceInstruction
|
||||
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
import org.jf.dexlib2.iface.reference.FieldReference
|
||||
@@ -23,15 +26,31 @@ import org.jf.dexlib2.iface.reference.FieldReference
|
||||
@Description("Makes the brightness of HDR videos follow the system default.")
|
||||
@HDRBrightnessCompatibility
|
||||
@Version("0.0.2")
|
||||
@DependsOn([IntegrationsPatch::class])
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
class HDRBrightnessPatch : BytecodePatch(
|
||||
listOf(
|
||||
HDRBrightnessFingerprintXXZ
|
||||
HDRBrightnessFingerprintYEL,
|
||||
HDRBrightnessFingerprintYJK
|
||||
)
|
||||
) {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
val method = HDRBrightnessFingerprintXXZ.result?.mutableMethod
|
||||
?: return PatchResultError("HDRBrightnessFingerprint could not resolve the method!")
|
||||
SettingsPatch.PreferenceScreen.MISC.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_pref_hdr_autobrightness",
|
||||
StringResource("revanced_hdr_autobrightness_enabled_title", "Enable auto HDR brightness"),
|
||||
true,
|
||||
StringResource("revanced_hdr_autobrightness_summary_on", "Auto HDR brightness is enabled"),
|
||||
StringResource("revanced_hdr_autobrightness_summary_off", "Auto HDR brightness is disabled")
|
||||
)
|
||||
)
|
||||
|
||||
val result = try {
|
||||
HDRBrightnessFingerprintYEL.result!!
|
||||
} catch (e: Exception) {
|
||||
HDRBrightnessFingerprintYJK.result!!
|
||||
}
|
||||
|
||||
val method = result.mutableMethod
|
||||
|
||||
method.implementation!!.instructions.filter {
|
||||
((it as? ReferenceInstruction)?.reference as? FieldReference)?.let { field ->
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.03.38", "17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34")
|
||||
"com.google.android.youtube", arrayOf("17.03.38", "17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34")
|
||||
"com.google.android.youtube", arrayOf()
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
|
||||
@@ -28,8 +28,7 @@ class FixLocaleConfigErrorPatch : ResourcePatch() {
|
||||
// by replacing the attributes name
|
||||
val attribute = "android:localeConfig"
|
||||
applicationNode.setAttribute("localeConfig", applicationNode.getAttribute(attribute))
|
||||
applicationNode.removeAttribute("android:localeConfig")
|
||||
|
||||
applicationNode.removeAttribute(attribute)
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user