mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-20 17:43:56 +00:00
Compare commits
54 Commits
v2.174.0-d
...
v2.174.0-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8399eaa288 | ||
|
|
63460542d0 | ||
|
|
ba52570ad6 | ||
|
|
bb303713bd | ||
|
|
1541e73e92 | ||
|
|
1d707b07b4 | ||
|
|
79e36e2b74 | ||
|
|
46552a5ab8 | ||
|
|
529e90d232 | ||
|
|
c72fd1e2fc | ||
|
|
48965ace7e | ||
|
|
08f1702b18 | ||
|
|
45784eceee | ||
|
|
f891aa937c | ||
|
|
aa493c4f67 | ||
|
|
a83e0dc257 | ||
|
|
5ea4d3c2a6 | ||
|
|
f4ae7fd9d7 | ||
|
|
b6539922fe | ||
|
|
a697b16aa3 | ||
|
|
ab22794ef2 | ||
|
|
cd6988a688 | ||
|
|
74ad4fa5ea | ||
|
|
382c441de5 | ||
|
|
7953a1a07b | ||
|
|
ac0ed24ef2 | ||
|
|
489663c890 | ||
|
|
599e089c12 | ||
|
|
0d54b73958 | ||
|
|
943f6de55b | ||
|
|
7649e54c22 | ||
|
|
671c822fe9 | ||
|
|
56727bbe68 | ||
|
|
5ff5d804e2 | ||
|
|
9ca1f853e0 | ||
|
|
d229095087 | ||
|
|
bc38b9ebc2 | ||
|
|
3d79d5b7f0 | ||
|
|
b2de406844 | ||
|
|
35cd7780d0 | ||
|
|
6951e4a0e9 | ||
|
|
9bfcf99a22 | ||
|
|
56d3cf258c | ||
|
|
81a5d37bc3 | ||
|
|
c50f703551 | ||
|
|
85516401be | ||
|
|
311f5d80fc | ||
|
|
73c86c85c6 | ||
|
|
9727cfc169 | ||
|
|
751d74f5c0 | ||
|
|
fe72363c52 | ||
|
|
d763108110 | ||
|
|
0af514d76c | ||
|
|
6a1cc85439 |
@@ -7,7 +7,13 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"@semantic-release/commit-analyzer",
|
[
|
||||||
|
"@semantic-release/commit-analyzer", {
|
||||||
|
"releaseRules": [
|
||||||
|
{ "type": "build", "scope": "revanced-patcher", "release": "patch" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"@semantic-release/release-notes-generator",
|
"@semantic-release/release-notes-generator",
|
||||||
"@semantic-release/changelog",
|
"@semantic-release/changelog",
|
||||||
"gradle-semantic-release-plugin",
|
"gradle-semantic-release-plugin",
|
||||||
|
|||||||
150
CHANGELOG.md
150
CHANGELOG.md
@@ -1,3 +1,153 @@
|
|||||||
|
# [2.174.0-dev.24](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.23...v2.174.0-dev.24) (2023-05-13)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **twitch/auto-claim-channel-points:** use correct casing for "Channel Points" ([#2138](https://github.com/revanced/revanced-patches/issues/2138)) ([76a3bf2](https://github.com/revanced/revanced-patches/commit/76a3bf23b5e5591ae635e612af07cbbd78d49f53))
|
||||||
|
|
||||||
|
# [2.174.0-dev.23](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.22...v2.174.0-dev.23) (2023-05-13)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **youtube/custom-video-speed:** add missing class for `video-speeds` patch ([#2137](https://github.com/revanced/revanced-patches/issues/2137)) ([758ef42](https://github.com/revanced/revanced-patches/commit/758ef42f9cd36d665b1737b67bcdde22d3e3eb98))
|
||||||
|
|
||||||
|
# [2.174.0-dev.22](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.21...v2.174.0-dev.22) (2023-05-12)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **youtube:** move video settings to `Video` settings category ([#2010](https://github.com/revanced/revanced-patches/issues/2010)) ([f4b9180](https://github.com/revanced/revanced-patches/commit/f4b918075a70d1a4ed9ac7e9c1f0e0acd1c77404))
|
||||||
|
|
||||||
|
# [2.174.0-dev.21](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.20...v2.174.0-dev.21) (2023-05-12)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **twitch:** add `auto-claim-channel-points` patch ([#2131](https://github.com/revanced/revanced-patches/issues/2131)) ([80fb670](https://github.com/revanced/revanced-patches/commit/80fb6701b52a8c6c6bada5546dffe3438f0e4879))
|
||||||
|
|
||||||
|
# [2.174.0-dev.20](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.19...v2.174.0-dev.20) (2023-05-12)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **youtube:** add `hide-filter-bar` patch ([6cc5f61](https://github.com/revanced/revanced-patches/commit/6cc5f61e0712fe25cd45b137773decaf4b9bb582))
|
||||||
|
|
||||||
|
# [2.174.0-dev.19](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.18...v2.174.0-dev.19) (2023-05-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **youtube/video-speed:** change custom video speeds inside app settings ([#2114](https://github.com/revanced/revanced-patches/issues/2114)) ([d97815a](https://github.com/revanced/revanced-patches/commit/d97815af18e645fd0fa087db0174bcc2a771ec72))
|
||||||
|
|
||||||
|
# [2.174.0-dev.18](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.17...v2.174.0-dev.18) (2023-05-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **youtube/theme:** apply custom seekbar color to video thumbnails ([#2085](https://github.com/revanced/revanced-patches/issues/2085)) ([d497027](https://github.com/revanced/revanced-patches/commit/d4970273ad10f62cd9455ef9b847c686147f7dca))
|
||||||
|
|
||||||
|
# [2.174.0-dev.17](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.16...v2.174.0-dev.17) (2023-05-09)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **youtube/remember-video-quality:** fix default video quality/speed being applied when resuming app. ([#2112](https://github.com/revanced/revanced-patches/issues/2112)) ([f68a41c](https://github.com/revanced/revanced-patches/commit/f68a41ce9f9a78818d3f28b069e70b8c66125f53))
|
||||||
|
|
||||||
|
# [2.174.0-dev.16](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.15...v2.174.0-dev.16) (2023-05-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* check for opcode type `CONST` ([e5bb63c](https://github.com/revanced/revanced-patches/commit/e5bb63c7ab4427b6116de4a999be306e0f3cf12e))
|
||||||
|
|
||||||
|
# [2.174.0-dev.15](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.14...v2.174.0-dev.15) (2023-05-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **messenger:** add `disable-switching-emoji-to-sticker-in-message-input-field` patch ([#2099](https://github.com/revanced/revanced-patches/issues/2099)) ([ac5532a](https://github.com/revanced/revanced-patches/commit/ac5532a65c353b1964d9b7d990341fc7362e510d))
|
||||||
|
|
||||||
|
# [2.174.0-dev.14](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.13...v2.174.0-dev.14) (2023-05-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **youtube/hide-player-overlay:** make it toggleable in settings ([#2044](https://github.com/revanced/revanced-patches/issues/2044)) ([f693d55](https://github.com/revanced/revanced-patches/commit/f693d55caf1e0b72bb1f4c39b1eeb59436191e02))
|
||||||
|
|
||||||
|
# [2.174.0-dev.13](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.12...v2.174.0-dev.13) (2023-05-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* account fo breaking changes from ReVanced Patcher ([#2103](https://github.com/revanced/revanced-patches/issues/2103)) ([5be25cd](https://github.com/revanced/revanced-patches/commit/5be25cde4b34d58ced35a7edbb499477b538b748))
|
||||||
|
|
||||||
|
# [2.174.0-dev.12](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.11...v2.174.0-dev.12) (2023-05-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **readme-generator:** attempt sorting versions with `FlexVer` ([#2059](https://github.com/revanced/revanced-patches/issues/2059)) ([a54c464](https://github.com/revanced/revanced-patches/commit/a54c464522fa2a6a2d2525c8cb0ec961c2cc771c))
|
||||||
|
|
||||||
|
# [2.174.0-dev.11](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.10...v2.174.0-dev.11) (2023-05-07)
|
||||||
|
|
||||||
|
# [2.174.0-dev.10](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.9...v2.174.0-dev.10) (2023-05-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* incorrect instruction offsets ([42a5a38](https://github.com/revanced/revanced-patches/commit/42a5a387da3c53c579234a44c124ab0ba26117cb))
|
||||||
|
* incorrect smali syntax ([4e74a80](https://github.com/revanced/revanced-patches/commit/4e74a800c311d7acb2c2ddb492b43747db8a8def))
|
||||||
|
|
||||||
|
# [2.174.0-dev.9](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.8...v2.174.0-dev.9) (2023-05-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* incorrect cast of instruction ([fb94a1c](https://github.com/revanced/revanced-patches/commit/fb94a1cb48e8952981e2f9146eb90ee92a517b2e))
|
||||||
|
|
||||||
|
# [2.174.0-dev.8](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.7...v2.174.0-dev.8) (2023-05-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **youtube/integrations:** allow playback of embedded videos ([#2092](https://github.com/revanced/revanced-patches/issues/2092)) ([8a43d75](https://github.com/revanced/revanced-patches/commit/8a43d75e2db63c47bb9ad1b75027df0868c094e5))
|
||||||
|
|
||||||
|
# [2.174.0-dev.7](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.6...v2.174.0-dev.7) (2023-05-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **syncforreddit:** add `disable-ads` patch ([#2066](https://github.com/revanced/revanced-patches/issues/2066)) ([c1de5d6](https://github.com/revanced/revanced-patches/commit/c1de5d6e433263b9a17305fa1c65807921594731))
|
||||||
|
|
||||||
|
# [2.174.0-dev.6](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.5...v2.174.0-dev.6) (2023-05-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **youtube:** `hide-load-more-button` patch ([#2078](https://github.com/revanced/revanced-patches/issues/2078)) ([7170802](https://github.com/revanced/revanced-patches/commit/71708022a06453f6f56c19d686fc505286523391))
|
||||||
|
|
||||||
|
# [2.174.0-dev.5](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.4...v2.174.0-dev.5) (2023-05-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **spotify/disable-capture-restriction:** make compatible with latest versions ([#2095](https://github.com/revanced/revanced-patches/issues/2095)) ([e48f127](https://github.com/revanced/revanced-patches/commit/e48f1278da2a9d82e70be41fa2c4c480c574816b))
|
||||||
|
|
||||||
|
# [2.174.0-dev.4](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.3...v2.174.0-dev.4) (2023-05-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **youtube/theme:** move options out of dependency patch ([a953448](https://github.com/revanced/revanced-patches/commit/a95344879c2ac2cd6da8ce0273dcb05e8a35d2ec))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* improve structure of `README` ([279b193](https://github.com/revanced/revanced-patches/commit/279b193b687ad9cba44ab9c2a88d2ce06be0bbf0))
|
||||||
|
|
||||||
|
# [2.174.0-dev.3](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.2...v2.174.0-dev.3) (2023-05-06)
|
||||||
|
|
||||||
# [2.174.0-dev.2](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.1...v2.174.0-dev.2) (2023-05-03)
|
# [2.174.0-dev.2](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.1...v2.174.0-dev.2) (2023-05-03)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
## 🧩 Patches
|
## 🧩 ReVanced Patches
|
||||||
|
|
||||||
The official Patch bundle provided by ReVanced and the community.
|
The official ReVanced Patches.
|
||||||
|
|
||||||
> Looking for the JSON variant of this? [Click here](patches.json).
|
## 📋 List of patches in this repository
|
||||||
|
|
||||||
{{ table }}
|
{{ table }}
|
||||||
|
|
||||||
|
> Looking for the JSON variant of this? [Click here](patches.json).
|
||||||
|
|
||||||
## 📝 JSON Format
|
## 📝 JSON Format
|
||||||
|
|
||||||
This section explains the JSON format for the [patches.json](patches.json) file.
|
This section explains the JSON format for the [patches.json](patches.json) file.
|
||||||
@@ -64,7 +66,6 @@ Example:
|
|||||||
"description": "Enables a custom theme.",
|
"description": "Enables a custom theme.",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"excluded": false,
|
"excluded": false,
|
||||||
"deprecated": false,
|
|
||||||
"options": [
|
"options": [
|
||||||
{
|
{
|
||||||
"key": "theme",
|
"key": "theme",
|
||||||
@@ -91,7 +92,6 @@ Example:
|
|||||||
"description": "Changes the YouTube launcher icon and name to your choice (defaults to ReVanced).",
|
"description": "Changes the YouTube launcher icon and name to your choice (defaults to ReVanced).",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"excluded": false,
|
"excluded": false,
|
||||||
"deprecated": false,
|
|
||||||
"options": [
|
"options": [
|
||||||
{
|
{
|
||||||
"key": "appName",
|
"key": "appName",
|
||||||
|
|||||||
92
README.md
92
README.md
@@ -1,8 +1,8 @@
|
|||||||
## 🧩 Patches
|
## 🧩 ReVanced Patches
|
||||||
|
|
||||||
The official Patch bundle provided by ReVanced and the community.
|
The official ReVanced Patches.
|
||||||
|
|
||||||
> Looking for the JSON variant of this? [Click here](patches.json).
|
## 📋 List of patches in this repository
|
||||||
|
|
||||||
### [📦 `com.google.android.youtube`](https://play.google.com/store/apps/details?id=com.google.android.youtube)
|
### [📦 `com.google.android.youtube`](https://play.google.com/store/apps/details?id=com.google.android.youtube)
|
||||||
<details>
|
<details>
|
||||||
@@ -15,7 +15,6 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `copy-video-url` | Adds buttons in player to copy video links. | 18.16.37 |
|
| `copy-video-url` | Adds buttons in player to copy video links. | 18.16.37 |
|
||||||
| `custom-branding` | Changes the YouTube launcher icon and name to your choice (defaults to ReVanced). | all |
|
| `custom-branding` | Changes the YouTube launcher icon and name to your choice (defaults to ReVanced). | all |
|
||||||
| `custom-video-buffer` | Lets you change the buffers of videos. | 18.16.37 |
|
| `custom-video-buffer` | Lets you change the buffers of videos. | 18.16.37 |
|
||||||
| `custom-video-speed` | Adds more video speed options. | 18.16.37 |
|
|
||||||
| `disable-auto-captions` | Disable forced captions from being automatically enabled. | 18.16.37 |
|
| `disable-auto-captions` | Disable forced captions from being automatically enabled. | 18.16.37 |
|
||||||
| `disable-fullscreen-panels` | Disables video description and comments panel in fullscreen view. | 18.16.37 |
|
| `disable-fullscreen-panels` | Disables video description and comments panel in fullscreen view. | 18.16.37 |
|
||||||
| `disable-player-popup-panels` | Disables panels from appearing automatically when going into fullscreen (playlist or live chat). | 18.16.37 |
|
| `disable-player-popup-panels` | Disables panels from appearing automatically when going into fullscreen (playlist or live chat). | 18.16.37 |
|
||||||
@@ -34,11 +33,12 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `hide-crowdfunding-box` | Hides the crowdfunding box between the player and video description. | 18.16.37 |
|
| `hide-crowdfunding-box` | Hides the crowdfunding box between the player and video description. | 18.16.37 |
|
||||||
| `hide-email-address` | Hides the email address in the account switcher. | 18.16.37 |
|
| `hide-email-address` | Hides the email address in the account switcher. | 18.16.37 |
|
||||||
| `hide-endscreen-cards` | Hides the suggested video cards at the end of a video in fullscreen. | 18.16.37 |
|
| `hide-endscreen-cards` | Hides the suggested video cards at the end of a video in fullscreen. | 18.16.37 |
|
||||||
|
| `hide-filter-bar` | Hides the filter bar in video feeds. | 18.16.37 |
|
||||||
| `hide-floating-microphone-button` | Hides the floating microphone button which appears in search. | 18.16.37 |
|
| `hide-floating-microphone-button` | Hides the floating microphone button which appears in search. | 18.16.37 |
|
||||||
| `hide-get-premium` | Hides advertisement for YouTube Premium under the video player. | 18.16.37 |
|
| `hide-get-premium` | Hides advertisement for YouTube Premium under the video player. | 18.16.37 |
|
||||||
| `hide-info-cards` | Hides info cards in videos. | 18.16.37 |
|
| `hide-info-cards` | Hides info cards in videos. | 18.16.37 |
|
||||||
| `hide-player-buttons` | Adds the option to hide video player previous and next buttons. | all |
|
| `hide-player-buttons` | Adds the option to hide video player previous and next buttons. | all |
|
||||||
| `hide-player-overlay` | Hides the dark player overlay when player controls are visible. | all |
|
| `hide-player-overlay` | Hides the dark background overlay from the player when player controls are visible. | all |
|
||||||
| `hide-seekbar` | Hides the seekbar. | 18.16.37 |
|
| `hide-seekbar` | Hides the seekbar. | 18.16.37 |
|
||||||
| `hide-timestamp` | Hides timestamp in video player. | 18.16.37 |
|
| `hide-timestamp` | Hides timestamp in video player. | 18.16.37 |
|
||||||
| `hide-video-action-buttons` | Adds the options to hide action buttons under a video. | 18.16.37 |
|
| `hide-video-action-buttons` | Adds the options to hide action buttons under a video. | 18.16.37 |
|
||||||
@@ -49,7 +49,6 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `old-quality-layout` | Enables the original video quality flyout in the video player settings | 18.16.37 |
|
| `old-quality-layout` | Enables the original video quality flyout in the video player settings | 18.16.37 |
|
||||||
| `open-links-externally` | Open links outside of the app directly in your browser. | 18.16.37 |
|
| `open-links-externally` | Open links outside of the app directly in your browser. | 18.16.37 |
|
||||||
| `premium-heading` | Shows premium branding on the home screen. | all |
|
| `premium-heading` | Shows premium branding on the home screen. | all |
|
||||||
| `remember-playback-speed` | Adds the ability to remember the playback speed you chose in the video playback speed flyout. | 18.16.37 |
|
|
||||||
| `remember-video-quality` | Adds the ability to remember the video quality you chose in the video quality flyout. | 18.16.37 |
|
| `remember-video-quality` | Adds the ability to remember the video quality you chose in the video quality flyout. | 18.16.37 |
|
||||||
| `remove-player-button-background` | Removes the background from the video player buttons. | 18.16.37 |
|
| `remove-player-button-background` | Removes the background from the video player buttons. | 18.16.37 |
|
||||||
| `return-youtube-dislike` | Shows the dislike count of videos using the Return YouTube Dislike API. | 18.16.37 |
|
| `return-youtube-dislike` | Shows the dislike count of videos using the Return YouTube Dislike API. | 18.16.37 |
|
||||||
@@ -58,7 +57,6 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `spoof-app-version` | Tricks YouTube into thinking, you are running an older version of the app. One of the side effects also includes restoring the old UI. | 18.16.37 |
|
| `spoof-app-version` | Tricks YouTube into thinking, you are running an older version of the app. One of the side effects also includes restoring the old UI. | 18.16.37 |
|
||||||
| `swipe-controls` | Adds volume and brightness swipe controls. | 18.16.37 |
|
| `swipe-controls` | Adds volume and brightness swipe controls. | 18.16.37 |
|
||||||
| `tablet-mini-player` | Enables the tablet mini player layout. | 18.16.37 |
|
| `tablet-mini-player` | Enables the tablet mini player layout. | 18.16.37 |
|
||||||
| `theme` | Applies a custom theme. | all |
|
|
||||||
| `vanced-microg-support` | Allows YouTube ReVanced to run without root and under a different package name with Vanced MicroG. | 18.16.37 |
|
| `vanced-microg-support` | Allows YouTube ReVanced to run without root and under a different package name with Vanced MicroG. | 18.16.37 |
|
||||||
| `video-ads` | Removes ads in the video player. | 18.16.37 |
|
| `video-ads` | Removes ads in the video player. | 18.16.37 |
|
||||||
| `wide-searchbar` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | 18.16.37 |
|
| `wide-searchbar` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | 18.16.37 |
|
||||||
@@ -119,6 +117,7 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|:--------:|:--------------:|:-----------------:|
|
||||||
|
| `auto-claim-channel-points` | Automatically claim Channel Points. | all |
|
||||||
| `block-audio-ads` | Blocks audio ads in streams and VODs. | 14.6.1 |
|
| `block-audio-ads` | Blocks audio ads in streams and VODs. | 14.6.1 |
|
||||||
| `block-embedded-ads` | Blocks embedded stream ads using services like TTV.lol or PurpleAdBlocker. | 14.6.1 |
|
| `block-embedded-ads` | Blocks embedded stream ads using services like TTV.lol or PurpleAdBlocker. | 14.6.1 |
|
||||||
| `block-video-ads` | Blocks video ads in streams and VODs. | 14.6.1 |
|
| `block-video-ads` | Blocks video ads in streams and VODs. | 14.6.1 |
|
||||||
@@ -158,6 +157,15 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `premium-icon-reddit` | Unlocks premium Reddit app icons. | all |
|
| `premium-icon-reddit` | Unlocks premium Reddit app icons. | all |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
### [📦 `com.facebook.orca`](https://play.google.com/store/apps/details?id=com.facebook.orca)
|
||||||
|
<details>
|
||||||
|
|
||||||
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|
|:--------:|:--------------:|:-----------------:|
|
||||||
|
| `disable-switching-emoji-to-sticker-in-message-input-field` | Disables switching from emoji to sticker search mode in message input field | all |
|
||||||
|
| `hide-inbox-ads` | Hides ads in inbox. | all |
|
||||||
|
</details>
|
||||||
|
|
||||||
### [📦 `at.gv.bmf.bmf2go`](https://play.google.com/store/apps/details?id=at.gv.bmf.bmf2go)
|
### [📦 `at.gv.bmf.bmf2go`](https://play.google.com/store/apps/details?id=at.gv.bmf.bmf2go)
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
@@ -176,6 +184,14 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `spoof-signature` | Spoofs the signature of the app. | all |
|
| `spoof-signature` | Spoofs the signature of the app. | all |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
### [📦 `com.laurencedawson.reddit_sync`](https://play.google.com/store/apps/details?id=com.laurencedawson.reddit_sync)
|
||||||
|
<details>
|
||||||
|
|
||||||
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|
|:--------:|:--------------:|:-----------------:|
|
||||||
|
| `disable-ads` | Disables ads. | all |
|
||||||
|
</details>
|
||||||
|
|
||||||
### [📦 `com.myprog.hexedit`](https://play.google.com/store/apps/details?id=com.myprog.hexedit)
|
### [📦 `com.myprog.hexedit`](https://play.google.com/store/apps/details?id=com.myprog.hexedit)
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
@@ -208,14 +224,6 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `hide-ads` | Removes general ads. | all |
|
| `hide-ads` | Removes general ads. | all |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
### [📦 `com.facebook.orca`](https://play.google.com/store/apps/details?id=com.facebook.orca)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `hide-inbox-ads` | Hides ads in inbox. | all |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `com.instagram.android`](https://play.google.com/store/apps/details?id=com.instagram.android)
|
### [📦 `com.instagram.android`](https://play.google.com/store/apps/details?id=com.instagram.android)
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
@@ -304,30 +312,6 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `unlock-prime` | Unlocks Nova Prime and all functions of the app. | all |
|
| `unlock-prime` | Unlocks Nova Prime and all functions of the app. | all |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
### [📦 `co.windyapp.android`](https://play.google.com/store/apps/details?id=co.windyapp.android)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `unlock-pro` | Unlocks all pro features. | all |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `org.totschnig.myexpenses`](https://play.google.com/store/apps/details?id=org.totschnig.myexpenses)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `unlock-pro` | Unlocks all professional features. | 3.4.9 |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `com.zombodroid.MemeGenerator`](https://play.google.com/store/apps/details?id=com.zombodroid.MemeGenerator)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `unlock-pro` | Unlocks pro features. | 4.6377 |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `com.ithebk.expensemanager`](https://play.google.com/store/apps/details?id=com.ithebk.expensemanager)
|
### [📦 `com.ithebk.expensemanager`](https://play.google.com/store/apps/details?id=com.ithebk.expensemanager)
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
@@ -336,6 +320,14 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `unlock-pro` | Unlocks pro features. | all |
|
| `unlock-pro` | Unlocks pro features. | all |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
### [📦 `com.awedea.nyx`](https://play.google.com/store/apps/details?id=com.awedea.nyx)
|
||||||
|
<details>
|
||||||
|
|
||||||
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|
|:--------:|:--------------:|:-----------------:|
|
||||||
|
| `unlock-pro` | Unlocks all pro features. | all |
|
||||||
|
</details>
|
||||||
|
|
||||||
### [📦 `ginlemon.iconpackstudio`](https://play.google.com/store/apps/details?id=ginlemon.iconpackstudio)
|
### [📦 `ginlemon.iconpackstudio`](https://play.google.com/store/apps/details?id=ginlemon.iconpackstudio)
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
@@ -344,7 +336,7 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `unlock-pro` | Unlocks all pro features. | all |
|
| `unlock-pro` | Unlocks all pro features. | all |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
### [📦 `com.awedea.nyx`](https://play.google.com/store/apps/details?id=com.awedea.nyx)
|
### [📦 `co.windyapp.android`](https://play.google.com/store/apps/details?id=co.windyapp.android)
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
@@ -352,6 +344,22 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `unlock-pro` | Unlocks all pro features. | all |
|
| `unlock-pro` | Unlocks all pro features. | all |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
### [📦 `com.zombodroid.MemeGenerator`](https://play.google.com/store/apps/details?id=com.zombodroid.MemeGenerator)
|
||||||
|
<details>
|
||||||
|
|
||||||
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|
|:--------:|:--------------:|:-----------------:|
|
||||||
|
| `unlock-pro` | Unlocks pro features. | 4.6377 |
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### [📦 `org.totschnig.myexpenses`](https://play.google.com/store/apps/details?id=org.totschnig.myexpenses)
|
||||||
|
<details>
|
||||||
|
|
||||||
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|
|:--------:|:--------------:|:-----------------:|
|
||||||
|
| `unlock-pro` | Unlocks all professional features. | 3.4.9 |
|
||||||
|
</details>
|
||||||
|
|
||||||
### [📦 `com.ticktick.task`](https://play.google.com/store/apps/details?id=com.ticktick.task)
|
### [📦 `com.ticktick.task`](https://play.google.com/store/apps/details?id=com.ticktick.task)
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
@@ -370,6 +378,8 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
> Looking for the JSON variant of this? [Click here](patches.json).
|
||||||
|
|
||||||
## 📝 JSON Format
|
## 📝 JSON Format
|
||||||
|
|
||||||
This section explains the JSON format for the [patches.json](patches.json) file.
|
This section explains the JSON format for the [patches.json](patches.json) file.
|
||||||
@@ -428,7 +438,6 @@ Example:
|
|||||||
"description": "Enables a custom theme.",
|
"description": "Enables a custom theme.",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"excluded": false,
|
"excluded": false,
|
||||||
"deprecated": false,
|
|
||||||
"options": [
|
"options": [
|
||||||
{
|
{
|
||||||
"key": "theme",
|
"key": "theme",
|
||||||
@@ -455,7 +464,6 @@ Example:
|
|||||||
"description": "Changes the YouTube launcher icon and name to your choice (defaults to ReVanced).",
|
"description": "Changes the YouTube launcher icon and name to your choice (defaults to ReVanced).",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"excluded": false,
|
"excluded": false,
|
||||||
"deprecated": false,
|
|
||||||
"options": [
|
"options": [
|
||||||
{
|
{
|
||||||
"key": "appName",
|
"key": "appName",
|
||||||
|
|||||||
@@ -17,13 +17,26 @@ repositories {
|
|||||||
password = githubPassword
|
password = githubPassword
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Required for FlexVer-Java
|
||||||
|
maven {
|
||||||
|
url = uri("https://repo.sleeping.town")
|
||||||
|
content {
|
||||||
|
includeGroup("com.unascribed")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("app.revanced:revanced-patcher:7.0.0")
|
implementation("app.revanced:revanced-patcher:7.1.1")
|
||||||
implementation("app.revanced:multidexlib2:2.5.3-a3836654")
|
implementation("app.revanced:multidexlib2:2.5.3-a3836654")
|
||||||
// Required for meta
|
// Required for meta
|
||||||
implementation("com.google.code.gson:gson:2.10.1")
|
implementation("com.google.code.gson:gson:2.10.1")
|
||||||
|
// Required for FlexVer-Java
|
||||||
|
implementation("com.unascribed:flexver-java:1.0.2")
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
jvmToolchain(11)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.174.0-dev.2
|
version = 2.174.0-dev.24
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -5,6 +5,7 @@ import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
|||||||
import app.revanced.patcher.extensions.PatchExtensions.description
|
import app.revanced.patcher.extensions.PatchExtensions.description
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||||
import app.revanced.patcher.patch.Patch
|
import app.revanced.patcher.patch.Patch
|
||||||
|
import com.unascribed.flexver.FlexVerComparator
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
internal class ReadmeGenerator : PatchesFileGenerator {
|
internal class ReadmeGenerator : PatchesFileGenerator {
|
||||||
@@ -37,9 +38,8 @@ internal class ReadmeGenerator : PatchesFileGenerator {
|
|||||||
}
|
}
|
||||||
}.let { commonMap ->
|
}.let { commonMap ->
|
||||||
commonMap.maxByOrNull { it.value }?.value?.let {
|
commonMap.maxByOrNull { it.value }?.value?.let {
|
||||||
// This is not foolproof, because for example v1.0.0-dev.0 will be returned instead of v1.0.0-release.
|
commonMap.entries.filter { mostCommon -> mostCommon.value == it }
|
||||||
// Unfortunately this can not be solved easily because versioning can be complex.
|
.maxOfWith(FlexVerComparator::compare, Map.Entry<String, Int>::key)
|
||||||
commonMap.entries.filter { mostCommon -> mostCommon.value == it }.maxBy { it.key }.key
|
|
||||||
} ?: "all"
|
} ?: "all"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class ChangePackageNamePatch : ResourcePatch {
|
|||||||
if (!packageName.matches(packageNameRegex))
|
if (!packageName.matches(packageNameRegex))
|
||||||
return PatchResultError("Invalid package name")
|
return PatchResultError("Invalid package name")
|
||||||
|
|
||||||
var originalPackageName = ""
|
var originalPackageName: String
|
||||||
context.xmlEditor["AndroidManifest.xml"].use { editor ->
|
context.xmlEditor["AndroidManifest.xml"].use { editor ->
|
||||||
val manifest = editor.file.getElementsByTagName("manifest").item(0) as Element
|
val manifest = editor.file.getElementsByTagName("manifest").item(0) as Element
|
||||||
originalPackageName = manifest.getAttribute("package")
|
originalPackageName = manifest.getAttribute("package")
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
package app.revanced.patches.backdrops.misc.pro.patch
|
package app.revanced.patches.backdrops.misc.pro.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.instruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patches.backdrops.misc.pro.annotations.ProUnlockCompatibility
|
import app.revanced.patches.backdrops.misc.pro.annotations.ProUnlockCompatibility
|
||||||
@@ -25,17 +24,20 @@ class ProUnlockPatch : BytecodePatch(
|
|||||||
listOf(ProUnlockFingerprint)
|
listOf(ProUnlockFingerprint)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
val result = ProUnlockFingerprint.result ?: return PatchResultError("${ProUnlockFingerprint.name} not found")
|
ProUnlockFingerprint.result?.let { result ->
|
||||||
|
val registerIndex = result.scanResult.patternScanResult!!.endIndex - 1
|
||||||
|
|
||||||
val moveRegisterInstruction = result.mutableMethod.instruction(result.scanResult.patternScanResult!!.endIndex - 1)
|
result.mutableMethod.apply {
|
||||||
val register = (moveRegisterInstruction as OneRegisterInstruction).registerA
|
val register = instruction<OneRegisterInstruction>(registerIndex).registerA
|
||||||
|
addInstructions(
|
||||||
|
result.scanResult.patternScanResult!!.endIndex,
|
||||||
|
"""
|
||||||
|
const/4 v$register, 0x1
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
result.mutableMethod.addInstructions(
|
} ?: return ProUnlockFingerprint.toErrorResult()
|
||||||
result.scanResult.patternScanResult!!.endIndex,
|
|
||||||
"""
|
|
||||||
const/4 v$register, 0x1
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ class HideTimelineAdsPatch : BytecodePatch(
|
|||||||
val scanStart = scanResult.patternScanResult!!.startIndex
|
val scanStart = scanResult.patternScanResult!!.startIndex
|
||||||
val jumpIndex = scanStart - 1
|
val jumpIndex = scanStart - 1
|
||||||
|
|
||||||
val mediaInstanceRegister = (mutableMethod.instruction(scanStart) as FiveRegisterInstruction).registerC
|
val mediaInstanceRegister = mutableMethod.instruction<FiveRegisterInstruction>(scanStart).registerC
|
||||||
val freeRegister = (mutableMethod.instruction(jumpIndex) as OneRegisterInstruction).registerA
|
val freeRegister = mutableMethod.instruction<OneRegisterInstruction>(jumpIndex).registerA
|
||||||
|
|
||||||
val returnFalseLabel = "an_ad"
|
val returnFalseLabel = "an_ad"
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package app.revanced.patches.messenger.inputfield.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object SwitchMessangeInputEmojiButtonFingerprint : MethodFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
parameters = listOf("L", "Z"),
|
||||||
|
strings = listOf("afterTextChanged", "expression_search"),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.IF_EQZ,
|
||||||
|
Opcode.CONST_STRING,
|
||||||
|
Opcode.GOTO,
|
||||||
|
Opcode.CONST_STRING,
|
||||||
|
Opcode.GOTO
|
||||||
|
)
|
||||||
|
)
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package app.revanced.patches.messenger.inputfield.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
import app.revanced.patcher.annotation.*
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patches.messenger.inputfield.fingerprints.SwitchMessangeInputEmojiButtonFingerprint
|
||||||
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("disable-switching-emoji-to-sticker-in-message-input-field")
|
||||||
|
@Description("Disables switching from emoji to sticker search mode in message input field")
|
||||||
|
@Compatibility([Package("com.facebook.orca")])
|
||||||
|
@Version("0.0.1")
|
||||||
|
class DisableSwitchingEmojiToStickerInMessageInputField : BytecodePatch(listOf(SwitchMessangeInputEmojiButtonFingerprint)) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
SwitchMessangeInputEmojiButtonFingerprint.result?.let {
|
||||||
|
val setStringIndex = it.scanResult.patternScanResult!!.startIndex + 2
|
||||||
|
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val targetRegister = instruction<OneRegisterInstruction>(setStringIndex).registerA
|
||||||
|
|
||||||
|
replaceInstruction(
|
||||||
|
setStringIndex,
|
||||||
|
"const-string v$targetRegister, \"expression\""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: throw SwitchMessangeInputEmojiButtonFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,6 +9,7 @@ import app.revanced.patcher.patch.BytecodePatch
|
|||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
import app.revanced.patcher.patch.PatchResultError
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.iface.Method
|
import org.jf.dexlib2.iface.Method
|
||||||
|
|
||||||
@Description("Applies mandatory patches to implement the ReVanced integrations into the application.")
|
@Description("Applies mandatory patches to implement the ReVanced integrations into the application.")
|
||||||
@@ -24,10 +25,21 @@ abstract class AbstractIntegrationsPatch(
|
|||||||
* @see MethodFingerprint
|
* @see MethodFingerprint
|
||||||
*/
|
*/
|
||||||
abstract class IntegrationsFingerprint(
|
abstract class IntegrationsFingerprint(
|
||||||
|
returnType: String? = null,
|
||||||
|
access: Int? = null,
|
||||||
|
parameters: Iterable<String>? = null,
|
||||||
|
opcodes: Iterable<Opcode?>? = null,
|
||||||
strings: Iterable<String>? = null,
|
strings: Iterable<String>? = null,
|
||||||
customFingerprint: ((methodDef: Method) -> Boolean)? = null,
|
customFingerprint: ((methodDef: Method) -> Boolean)? = null,
|
||||||
private val contextRegisterResolver: (Method) -> Int = object : RegisterResolver {}
|
private val contextRegisterResolver: (Method) -> Int = object : RegisterResolver {}
|
||||||
) : MethodFingerprint(strings = strings, customFingerprint = customFingerprint) {
|
) : MethodFingerprint(
|
||||||
|
returnType,
|
||||||
|
access,
|
||||||
|
parameters,
|
||||||
|
opcodes,
|
||||||
|
strings,
|
||||||
|
customFingerprint
|
||||||
|
) {
|
||||||
fun invoke(integrationsDescriptor: String): PatchResult {
|
fun invoke(integrationsDescriptor: String): PatchResult {
|
||||||
result?.mutableMethod?.let { method ->
|
result?.mutableMethod?.let { method ->
|
||||||
val contextRegister = contextRegisterResolver(method)
|
val contextRegister = contextRegisterResolver(method)
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ class ClientSpoofPatch : BytecodePatch(
|
|||||||
UserAgentHeaderBuilderFingerprint.result?.let { result ->
|
UserAgentHeaderBuilderFingerprint.result?.let { result ->
|
||||||
val insertIndex = result.scanResult.patternScanResult!!.endIndex
|
val insertIndex = result.scanResult.patternScanResult!!.endIndex
|
||||||
result.mutableMethod.apply {
|
result.mutableMethod.apply {
|
||||||
val packageNameRegister = (instruction(insertIndex) as FiveRegisterInstruction).registerD
|
val packageNameRegister = instruction<FiveRegisterInstruction>(insertIndex).registerD
|
||||||
|
|
||||||
addInstruction(insertIndex, "const-string v$packageNameRegister, \"$ORIGINAL_PACKAGE_NAME\"")
|
addInstruction(insertIndex, "const-string v$packageNameRegister, \"$ORIGINAL_PACKAGE_NAME\"")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,19 +20,18 @@ class VerticalScrollPatch : BytecodePatch(
|
|||||||
listOf(CanScrollVerticallyFingerprint)
|
listOf(CanScrollVerticallyFingerprint)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
val result = CanScrollVerticallyFingerprint.result ?: return CanScrollVerticallyFingerprint.toErrorResult()
|
CanScrollVerticallyFingerprint.result?.let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val moveResultIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
|
val moveResultRegister = instruction<OneRegisterInstruction>(moveResultIndex).registerA
|
||||||
|
|
||||||
with(result) {
|
val insertIndex = moveResultIndex + 1
|
||||||
val method = mutableMethod
|
addInstruction(
|
||||||
|
insertIndex,
|
||||||
val moveResultIndex = scanResult.patternScanResult!!.endIndex
|
"const/4 v$moveResultRegister, 0x0"
|
||||||
val moveResultRegister = (method.instruction(moveResultIndex) as OneRegisterInstruction).registerA
|
)
|
||||||
|
}
|
||||||
method.addInstruction(
|
} ?: return CanScrollVerticallyFingerprint.toErrorResult()
|
||||||
moveResultIndex + 1,
|
|
||||||
"const/4 v$moveResultRegister, 0x0"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package app.revanced.patches.shared.settings.preference.impl
|
package app.revanced.patches.shared.settings.preference.impl
|
||||||
|
|
||||||
enum class InputType(val type: String) {
|
enum class InputType(val type: String) {
|
||||||
STRING("text"),
|
STRING("text"), // TODO: rename to "TEXT"
|
||||||
|
TEXT_CAP_CHARACTERS("textCapCharacters"),
|
||||||
|
TEXT_MULTI_LINE("textMultiLine"),
|
||||||
NUMBER("number"),
|
NUMBER("number"),
|
||||||
}
|
}
|
||||||
@@ -8,18 +8,13 @@ import app.revanced.patcher.extensions.instruction
|
|||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patches.spotify.audio.annotation.DisableCaptureRestrictionCompatibility
|
import app.revanced.patches.spotify.audio.annotation.DisableCaptureRestrictionCompatibility
|
||||||
import app.revanced.patches.spotify.audio.fingerprints.DisableCaptureRestrictionAudioDriverFingerprint
|
import app.revanced.patches.spotify.audio.fingerprints.DisableCaptureRestrictionAudioDriverFingerprint
|
||||||
import app.revanced.patches.spotify.audio.resource.patch.DisableCaptureRestrictionResourcePatch
|
import app.revanced.patches.spotify.audio.resource.patch.DisableCaptureRestrictionResourcePatch
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
|
||||||
import org.jf.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("disable-capture-restriction")
|
@Name("disable-capture-restriction")
|
||||||
@@ -35,49 +30,16 @@ class DisableCaptureRestrictionBytecodePatch : BytecodePatch(
|
|||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
val method = DisableCaptureRestrictionAudioDriverFingerprint.result!!.mutableMethod
|
val method = DisableCaptureRestrictionAudioDriverFingerprint.result!!.mutableMethod
|
||||||
|
|
||||||
var invokePosition: Int? = null
|
method.apply {
|
||||||
var invokeParamRegister: Int? = null
|
// Replace constant
|
||||||
|
val original = instruction(0) as OneRegisterInstruction
|
||||||
// Find INVOKE_VIRTUAL opcode with call to AudioAttributesBuilder.setAllowedCapturePolicy(I)
|
replaceInstruction(
|
||||||
for ((index, instruction) in method.implementation!!.instructions.withIndex()) {
|
0,
|
||||||
if(instruction.opcode != Opcode.INVOKE_VIRTUAL)
|
"const/4 v${original.registerA}, $ALLOW_CAPTURE_BY_ALL"
|
||||||
continue
|
|
||||||
|
|
||||||
val methodName = ((instruction as ReferenceInstruction).reference as MethodReference).name
|
|
||||||
if (methodName != "setAllowedCapturePolicy")
|
|
||||||
continue
|
|
||||||
|
|
||||||
// Store register of the integer parameter for setAllowedCapturePolicy
|
|
||||||
invokeParamRegister = (instruction as FiveRegisterInstruction).registerD
|
|
||||||
invokePosition = index
|
|
||||||
}
|
|
||||||
|
|
||||||
if(invokePosition == null || invokeParamRegister == null)
|
|
||||||
return PatchResultError("Cannot find setAllowedCapturePolicy method call")
|
|
||||||
|
|
||||||
// Walk back to the const/4 instruction that sets the parameter register
|
|
||||||
var matchFound = false
|
|
||||||
for (index in invokePosition downTo 0) {
|
|
||||||
val instruction = method.instruction(index)
|
|
||||||
if(instruction.opcode != Opcode.CONST_4)
|
|
||||||
continue
|
|
||||||
|
|
||||||
val register = (instruction as OneRegisterInstruction).registerA
|
|
||||||
if(register != invokeParamRegister)
|
|
||||||
continue
|
|
||||||
|
|
||||||
// Replace parameter value
|
|
||||||
method.replaceInstruction(
|
|
||||||
index, "const/4 v$register, $ALLOW_CAPTURE_BY_ALL"
|
|
||||||
)
|
)
|
||||||
matchFound = true
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return if (matchFound)
|
return PatchResultSuccess()
|
||||||
PatchResultSuccess()
|
|
||||||
else
|
|
||||||
PatchResultError("Const instruction not found")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
|
|||||||
@@ -1,10 +1,27 @@
|
|||||||
package app.revanced.patches.spotify.audio.fingerprints
|
package app.revanced.patches.spotify.audio.fingerprints
|
||||||
|
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
|
import org.jf.dexlib2.iface.reference.MethodReference
|
||||||
|
|
||||||
object DisableCaptureRestrictionAudioDriverFingerprint : MethodFingerprint(
|
object DisableCaptureRestrictionAudioDriverFingerprint : MethodFingerprint(
|
||||||
|
"L",
|
||||||
|
AccessFlags.PUBLIC or AccessFlags.STATIC or AccessFlags.SYNTHETIC or AccessFlags.BRIDGE,
|
||||||
|
listOf("L"),
|
||||||
|
listOf(
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.RETURN_OBJECT
|
||||||
|
),
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { methodDef ->
|
||||||
methodDef.definingClass == "Lcom/spotify/playback/playbacknative/AudioDriver;" && methodDef.name == "constructAudioAttributes"
|
// Check for method call to AudioAttributes$Builder.setAllowedCapturePolicy Android API
|
||||||
|
methodDef.implementation?.instructions?.any {
|
||||||
|
((it as? ReferenceInstruction)?.reference as? MethodReference)?.name == "setAllowedCapturePolicy"
|
||||||
|
} == true
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package app.revanced.patches.syncforreddit.ads.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility([Package("com.laurencedawson.reddit_sync")])
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
internal annotation class DisableAdsCompatibility
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package app.revanced.patches.syncforreddit.ads.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
object IsAdsEnabledFingerprint : MethodFingerprint(
|
||||||
|
returnType = "Z",
|
||||||
|
access = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||||
|
strings = listOf("SyncIapHelper")
|
||||||
|
)
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package app.revanced.patches.syncforreddit.ads.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
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.patches.syncforreddit.ads.annotations.DisableAdsCompatibility
|
||||||
|
import app.revanced.patches.syncforreddit.ads.fingerprints.IsAdsEnabledFingerprint
|
||||||
|
import app.revanced.patches.syncforreddit.detection.piracy.patch.DisablePiracyDetectionPatch
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("disable-ads")
|
||||||
|
@DependsOn([DisablePiracyDetectionPatch::class])
|
||||||
|
@Description("Disables ads.")
|
||||||
|
@Version("0.0.1")
|
||||||
|
@DisableAdsCompatibility
|
||||||
|
class DisableAdsPatch : BytecodePatch(listOf(IsAdsEnabledFingerprint)) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
IsAdsEnabledFingerprint.result?.mutableMethod?.apply {
|
||||||
|
addInstructions(
|
||||||
|
0,
|
||||||
|
"""
|
||||||
|
const/4 v0, 0x0
|
||||||
|
return v0
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
} ?: return IsAdsEnabledFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package app.revanced.patches.syncforreddit.detection.piracy.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
|
import org.jf.dexlib2.iface.reference.TypeReference
|
||||||
|
|
||||||
|
object PiracyDetectionFingerprint : MethodFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
access = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.NEW_INSTANCE,
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.NEW_INSTANCE,
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL
|
||||||
|
),
|
||||||
|
customFingerprint = { method ->
|
||||||
|
method.implementation?.instructions?.any {
|
||||||
|
if (it.opcode != Opcode.NEW_INSTANCE) return@any false
|
||||||
|
|
||||||
|
val reference = (it as ReferenceInstruction).reference
|
||||||
|
|
||||||
|
reference.toString() == "Lcom/github/javiersantos/piracychecker/PiracyChecker;"
|
||||||
|
} ?: false
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package app.revanced.patches.syncforreddit.detection.piracy.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patches.syncforreddit.detection.piracy.fingerprints.PiracyDetectionFingerprint
|
||||||
|
|
||||||
|
@Description("Disables detection of modified versions.")
|
||||||
|
@Version("0.0.1")
|
||||||
|
class DisablePiracyDetectionPatch : BytecodePatch(listOf(PiracyDetectionFingerprint)) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
PiracyDetectionFingerprint.result?.mutableMethod?.apply {
|
||||||
|
addInstructions(
|
||||||
|
0,
|
||||||
|
"""
|
||||||
|
return-void
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
} ?: return PiracyDetectionFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -36,7 +36,7 @@ class UnlockProPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
|
|
||||||
val setThemeMethod = SetThemeFingerprint.result!!.mutableMethod
|
val setThemeMethod = SetThemeFingerprint.result!!.mutableMethod
|
||||||
setThemeMethod.removeInstructions(0, 9)
|
setThemeMethod.removeInstructions(0, 10)
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
|||||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
||||||
import org.jf.dexlib2.iface.reference.StringReference
|
import org.jf.dexlib2.iface.reference.StringReference
|
||||||
import org.jf.dexlib2.iface.reference.TypeReference
|
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@DependsOn([IntegrationsPatch::class])
|
@DependsOn([IntegrationsPatch::class])
|
||||||
@@ -96,7 +95,7 @@ class SettingsPatch : BytecodePatch(
|
|||||||
private fun patchOptionNameAndOnClickEvent(index: Int, context: BytecodeContext) {
|
private fun patchOptionNameAndOnClickEvent(index: Int, context: BytecodeContext) {
|
||||||
with(SettingsOnViewCreatedFingerprint.result!!.mutableMethod) {
|
with(SettingsOnViewCreatedFingerprint.result!!.mutableMethod) {
|
||||||
// Patch option name
|
// Patch option name
|
||||||
val overrideRegister = (instruction(index - 4) as OneRegisterInstruction).registerA
|
val overrideRegister = instruction<OneRegisterInstruction>(index - 4).registerA
|
||||||
replaceInstruction(
|
replaceInstruction(
|
||||||
index - 4,
|
index - 4,
|
||||||
"""
|
"""
|
||||||
@@ -105,16 +104,14 @@ class SettingsPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Patch option OnClick Event
|
// Patch option OnClick Event
|
||||||
with(((instruction(index) as ReferenceInstruction).reference as TypeReference).type) {
|
val type = instruction<ReferenceInstruction>(index).reference.toString()
|
||||||
context.findClass(this)!!.mutableClass.methods.first { it.name == "onClick" }
|
context.findClass(type)!!.mutableClass.methods.first { type == "onClick" }.addInstructions(
|
||||||
.addInstructions(
|
0,
|
||||||
0,
|
"""
|
||||||
"""
|
invoke-static {}, Lapp/revanced/tiktok/settingsmenu/SettingsMenu;->startSettingsActivity()V
|
||||||
invoke-static {}, Lapp/revanced/tiktok/settingsmenu/SettingsMenu;->startSettingsActivity()V
|
return-void
|
||||||
return-void
|
"""
|
||||||
"""
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -97,14 +97,14 @@ class SpoofSimPatch : BytecodePatch() {
|
|||||||
|
|
||||||
// Patch Android API and return fake sim information
|
// Patch Android API and return fake sim information
|
||||||
private fun MutableMethod.replaceReference(index: Int, replacement: String) {
|
private fun MutableMethod.replaceReference(index: Int, replacement: String) {
|
||||||
val resultReg = (instruction(index + 1) as OneRegisterInstruction).registerA
|
val resultReg = instruction<OneRegisterInstruction>(index + 1).registerA
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
index + 2,
|
index + 2,
|
||||||
"""
|
"""
|
||||||
invoke-static {v$resultReg}, Lapp/revanced/tiktok/spoof/sim/SpoofSimPatch;->$replacement(Ljava/lang/String;)Ljava/lang/String;
|
invoke-static {v$resultReg}, Lapp/revanced/tiktok/spoof/sim/SpoofSimPatch;->$replacement(Ljava/lang/String;)Ljava/lang/String;
|
||||||
move-result-object v$resultReg
|
move-result-object v$resultReg
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -38,7 +38,7 @@ class UnlockPaidWidgetsPatch : BytecodePatch(
|
|||||||
fingerprint.result?.mutableMethod ?: return fingerprint.toErrorResult()
|
fingerprint.result?.mutableMethod ?: return fingerprint.toErrorResult()
|
||||||
}.forEach { method ->
|
}.forEach { method ->
|
||||||
method.apply {
|
method.apply {
|
||||||
removeInstructions(4, 2)
|
removeInstructions(4, 3)
|
||||||
addInstructions(
|
addInstructions(
|
||||||
implementation?.instructions?.size!!, """
|
implementation?.instructions?.size!!, """
|
||||||
const/4 v1, 0x0
|
const/4 v1, 0x0
|
||||||
|
|||||||
@@ -4,8 +4,12 @@ import app.revanced.patcher.annotation.Description
|
|||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.*
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
import app.revanced.patcher.patch.*
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
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.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patcher.util.smali.ExternalLabel
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
@@ -13,7 +17,9 @@ import app.revanced.patches.shared.settings.preference.impl.ArrayResource
|
|||||||
import app.revanced.patches.shared.settings.preference.impl.ListPreference
|
import app.revanced.patches.shared.settings.preference.impl.ListPreference
|
||||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||||
import app.revanced.patches.twitch.chat.antidelete.annotations.ShowDeletedMessagesCompatibility
|
import app.revanced.patches.twitch.chat.antidelete.annotations.ShowDeletedMessagesCompatibility
|
||||||
import app.revanced.patches.twitch.chat.antidelete.fingerprints.*
|
import app.revanced.patches.twitch.chat.antidelete.fingerprints.ChatUtilCreateDeletedSpanFingerprint
|
||||||
|
import app.revanced.patches.twitch.chat.antidelete.fingerprints.DeletedMessageClickableSpanCtorFingerprint
|
||||||
|
import app.revanced.patches.twitch.chat.antidelete.fingerprints.SetHasModAccessFingerprint
|
||||||
import app.revanced.patches.twitch.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.twitch.misc.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.twitch.misc.settings.bytecode.patch.SettingsPatch
|
import app.revanced.patches.twitch.misc.settings.bytecode.patch.SettingsPatch
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package app.revanced.patches.twitch.chat.autoclaim.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility([Package("tv.twitch.android.app")])
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
internal annotation class AutoClaimChannelPointsCompatibility
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package app.revanced.patches.twitch.chat.autoclaim.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
|
||||||
|
object CommunityPointsButtonViewDelegateFingerprint : MethodFingerprint(
|
||||||
|
customFingerprint = { methodDef ->
|
||||||
|
methodDef.definingClass.endsWith("CommunityPointsButtonViewDelegate;")
|
||||||
|
&& methodDef.name == "showClaimAvailable"
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package app.revanced.patches.twitch.chat.autoclaim.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
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.util.smali.ExternalLabel
|
||||||
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||||
|
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||||
|
import app.revanced.patches.twitch.chat.autoclaim.annotations.AutoClaimChannelPointsCompatibility
|
||||||
|
import app.revanced.patches.twitch.chat.autoclaim.fingerprints.CommunityPointsButtonViewDelegateFingerprint
|
||||||
|
import app.revanced.patches.twitch.misc.settings.bytecode.patch.SettingsPatch
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@DependsOn([SettingsPatch::class])
|
||||||
|
@Name("auto-claim-channel-points")
|
||||||
|
@Description("Automatically claim Channel Points.")
|
||||||
|
@AutoClaimChannelPointsCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class AutoClaimChannelPointPatch : BytecodePatch(
|
||||||
|
listOf(CommunityPointsButtonViewDelegateFingerprint)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
SettingsPatch.PreferenceScreen.CHAT.GENERAL.addPreferences(
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_auto_claim_channel_points",
|
||||||
|
StringResource(
|
||||||
|
"revanced_auto_claim_channel_points",
|
||||||
|
"Automatically claim Channel Points"
|
||||||
|
),
|
||||||
|
true,
|
||||||
|
StringResource(
|
||||||
|
"revanced_auto_claim_channel_points_on",
|
||||||
|
"Channel Points are claimed automatically"
|
||||||
|
),
|
||||||
|
StringResource(
|
||||||
|
"revanced_auto_claim_channel_points_off",
|
||||||
|
"Channel Points are not claimed automatically"
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
CommunityPointsButtonViewDelegateFingerprint.result?.mutableMethod?.apply {
|
||||||
|
val lastIndex = implementation!!.instructions.lastIndex
|
||||||
|
addInstructions(
|
||||||
|
lastIndex, // place in front of return-void
|
||||||
|
"""
|
||||||
|
invoke-static {}, Lapp/revanced/twitch/patches/AutoClaimChannelPointsPatch;->shouldAutoClaim()Z
|
||||||
|
move-result v0
|
||||||
|
if-eqz v0, :auto_claim
|
||||||
|
|
||||||
|
# Claim by calling the button's onClick method
|
||||||
|
|
||||||
|
iget-object v0, p0, Ltv/twitch/android/shared/community/points/viewdelegate/CommunityPointsButtonViewDelegate;->buttonLayout:Landroid/view/ViewGroup;
|
||||||
|
invoke-virtual { v0 }, Landroid/view/View;->callOnClick()Z
|
||||||
|
""",
|
||||||
|
listOf(ExternalLabel("auto_claim", instruction(lastIndex)))
|
||||||
|
)
|
||||||
|
} ?: return CommunityPointsButtonViewDelegateFingerprint.toErrorResult()
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,7 +4,9 @@ import app.revanced.patcher.annotation.Description
|
|||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.*
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
@@ -19,7 +21,10 @@ import app.revanced.patches.shared.settings.util.AbstractPreferenceScreen
|
|||||||
import app.revanced.patches.twitch.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.twitch.misc.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.twitch.misc.settings.annotations.SettingsCompatibility
|
import app.revanced.patches.twitch.misc.settings.annotations.SettingsCompatibility
|
||||||
import app.revanced.patches.twitch.misc.settings.components.CustomPreferenceCategory
|
import app.revanced.patches.twitch.misc.settings.components.CustomPreferenceCategory
|
||||||
import app.revanced.patches.twitch.misc.settings.fingerprints.*
|
import app.revanced.patches.twitch.misc.settings.fingerprints.MenuGroupsOnClickFingerprint
|
||||||
|
import app.revanced.patches.twitch.misc.settings.fingerprints.MenuGroupsUpdatedFingerprint
|
||||||
|
import app.revanced.patches.twitch.misc.settings.fingerprints.SettingsActivityOnCreateFingerprint
|
||||||
|
import app.revanced.patches.twitch.misc.settings.fingerprints.SettingsMenuItemEnumFingerprint
|
||||||
import app.revanced.patches.twitch.misc.settings.resource.patch.SettingsResourcePatch
|
import app.revanced.patches.twitch.misc.settings.resource.patch.SettingsResourcePatch
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.immutable.ImmutableField
|
import org.jf.dexlib2.immutable.ImmutableField
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class HideViewsBytecodePatch : BytecodePatch(
|
|||||||
TweetStatsContainerConstructorFingerprint,
|
TweetStatsContainerConstructorFingerprint,
|
||||||
returnFingerprint
|
returnFingerprint
|
||||||
) { patternScanResult, method ->
|
) { patternScanResult, method ->
|
||||||
method.removeInstructions(patternScanResult.endIndex - 3, 2)
|
method.removeInstructions(patternScanResult.endIndex - 3, 3)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,13 +80,13 @@ class HideViewsBytecodePatch : BytecodePatch(
|
|||||||
TweetStatsContainerWrapperConstructorFingerprint,
|
TweetStatsContainerWrapperConstructorFingerprint,
|
||||||
wrapperReturnFingerprint
|
wrapperReturnFingerprint
|
||||||
) { patternScanResult, method ->
|
) { patternScanResult, method ->
|
||||||
method.removeInstructions(patternScanResult.startIndex - 4, 3)
|
method.removeInstructions(patternScanResult.startIndex - 4, 4)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun removeViewDelegateBinderSubscription() {
|
private fun removeViewDelegateBinderSubscription() {
|
||||||
transformMethod(TweetStatsViewDelegateBinderFingerprint) { result, method ->
|
transformMethod(TweetStatsViewDelegateBinderFingerprint) { result, method ->
|
||||||
method.removeInstructions(result.scanResult.patternScanResult!!.startIndex - 4, 9)
|
method.removeInstructions(result.scanResult.patternScanResult!!.startIndex - 4, 10)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package app.revanced.patches.youtube.ad.general.bytecode.patch
|
package app.revanced.patches.youtube.ad.general.bytecode.patch
|
||||||
|
|
||||||
import app.revanced.extensions.findMutableMethodOf
|
import app.revanced.extensions.findMutableMethodOf
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
@@ -9,16 +10,15 @@ import app.revanced.patcher.extensions.addInstruction
|
|||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.instruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
|
import app.revanced.patches.shared.misc.fix.verticalscroll.patch.VerticalScrollPatch
|
||||||
import app.revanced.patches.youtube.ad.general.annotation.GeneralAdsCompatibility
|
import app.revanced.patches.youtube.ad.general.annotation.GeneralAdsCompatibility
|
||||||
import app.revanced.patches.youtube.ad.general.bytecode.fingerprints.ReelConstructorFingerprint
|
import app.revanced.patches.youtube.ad.general.bytecode.fingerprints.ReelConstructorFingerprint
|
||||||
import app.revanced.patches.youtube.ad.general.resource.patch.GeneralAdsResourcePatch
|
import app.revanced.patches.youtube.ad.general.resource.patch.GeneralAdsResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.fix.backtoexitgesture.patch.FixBackToExitGesturePatch
|
import app.revanced.patches.youtube.misc.fix.backtoexitgesture.patch.FixBackToExitGesturePatch
|
||||||
import app.revanced.patches.shared.misc.fix.verticalscroll.patch.VerticalScrollPatch
|
|
||||||
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
|
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
||||||
@@ -71,20 +71,16 @@ class GeneralAdsPatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
with(
|
ReelConstructorFingerprint.result?.let {
|
||||||
ReelConstructorFingerprint.result
|
|
||||||
?: return PatchResultError("Could not resolve fingerprint")
|
|
||||||
) {
|
|
||||||
// iput-object v$viewRegister, ...
|
// iput-object v$viewRegister, ...
|
||||||
val insertIndex = this.scanResult.patternScanResult!!.startIndex + 2
|
val insertIndex = it.scanResult.patternScanResult!!.startIndex + 2
|
||||||
|
|
||||||
with(this.mutableMethod) {
|
it.mutableMethod.apply {
|
||||||
val viewRegister = (instruction(insertIndex) as TwoRegisterInstruction).registerA
|
val viewRegister = instruction<TwoRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
injectHideCall(insertIndex, viewRegister, "hideReelView")
|
injectHideCall(insertIndex, viewRegister, "hideReelView")
|
||||||
}
|
}
|
||||||
|
} ?: return ReelConstructorFingerprint.toErrorResult()
|
||||||
}
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import app.revanced.patcher.patch.annotations.Patch
|
|||||||
import app.revanced.patches.youtube.interaction.copyvideourl.annotation.CopyVideoUrlCompatibility
|
import app.revanced.patches.youtube.interaction.copyvideourl.annotation.CopyVideoUrlCompatibility
|
||||||
import app.revanced.patches.youtube.interaction.copyvideourl.resource.patch.CopyVideoUrlResourcePatch
|
import app.revanced.patches.youtube.interaction.copyvideourl.resource.patch.CopyVideoUrlResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch
|
import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch
|
||||||
import app.revanced.patches.youtube.misc.video.information.patch.VideoInformationPatch
|
import app.revanced.patches.youtube.video.information.patch.VideoInformationPatch
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("copy-video-url")
|
@Name("copy-video-url")
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import app.revanced.patcher.patch.annotations.Patch
|
|||||||
import app.revanced.patches.youtube.interaction.downloads.annotation.DownloadsCompatibility
|
import app.revanced.patches.youtube.interaction.downloads.annotation.DownloadsCompatibility
|
||||||
import app.revanced.patches.youtube.interaction.downloads.resource.patch.DownloadsResourcePatch
|
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.playercontrols.bytecode.patch.PlayerControlsBytecodePatch
|
||||||
import app.revanced.patches.youtube.misc.video.information.patch.VideoInformationPatch
|
import app.revanced.patches.youtube.video.information.patch.VideoInformationPatch
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("downloads")
|
@Name("downloads")
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class HideAutoplayButtonPatch : BytecodePatch(
|
|||||||
val jumpInstruction = layoutGenMethodInstructions[insertIndex + branchIndex] as Instruction
|
val jumpInstruction = layoutGenMethodInstructions[insertIndex + branchIndex] as Instruction
|
||||||
|
|
||||||
// can be clobbered because this register is overwritten after the injected code
|
// can be clobbered because this register is overwritten after the injected code
|
||||||
val clobberRegister = (instruction(insertIndex) as OneRegisterInstruction).registerA
|
val clobberRegister = instruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
insertIndex,
|
insertIndex,
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ class NavigationButtonsPatch : BytecodePatch(listOf(AddCreateButtonViewFingerpri
|
|||||||
}!!.index
|
}!!.index
|
||||||
|
|
||||||
val conditionalCheckIndex = stringIndex - 1
|
val conditionalCheckIndex = stringIndex - 1
|
||||||
val conditionRegister = (instruction(conditionalCheckIndex) as OneRegisterInstruction).registerA
|
val conditionRegister = instruction<OneRegisterInstruction>(conditionalCheckIndex).registerA
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
conditionalCheckIndex,
|
conditionalCheckIndex,
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ internal object InjectionUtils {
|
|||||||
|
|
||||||
// Register to pass to the hook
|
// Register to pass to the hook
|
||||||
val registerIndex = insertIndex - 1 // MOVE_RESULT_OBJECT is always the previous instruction
|
val registerIndex = insertIndex - 1 // MOVE_RESULT_OBJECT is always the previous instruction
|
||||||
val register = (injectTarget.instruction(registerIndex) as OneRegisterInstruction).registerA
|
val register = injectTarget.instruction<OneRegisterInstruction>(registerIndex).registerA
|
||||||
|
|
||||||
injectTarget.addInstruction(
|
injectTarget.addInstruction(
|
||||||
insertIndex,
|
insertIndex,
|
||||||
|
|||||||
@@ -12,16 +12,12 @@ import app.revanced.patcher.patch.annotations.Patch
|
|||||||
import app.revanced.patches.youtube.layout.buttons.player.background.annotations.PlayerButtonBackgroundCompatibility
|
import app.revanced.patches.youtube.layout.buttons.player.background.annotations.PlayerButtonBackgroundCompatibility
|
||||||
import org.w3c.dom.Element
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
@Patch
|
@Patch(false)
|
||||||
@Name("remove-player-button-background")
|
@Name("remove-player-button-background")
|
||||||
@Description("Removes the background from the video player buttons.")
|
@Description("Removes the background from the video player buttons.")
|
||||||
@PlayerButtonBackgroundCompatibility
|
@PlayerButtonBackgroundCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class PlayerButtonBackgroundPatch : ResourcePatch {
|
class PlayerButtonBackgroundPatch : ResourcePatch {
|
||||||
private companion object {
|
|
||||||
const val RESOURCE_FILE_PATH = "res/drawable/player_button_circle_background.xml"
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun execute(context: ResourceContext): PatchResult {
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
context.xmlEditor[RESOURCE_FILE_PATH].use { editor ->
|
context.xmlEditor[RESOURCE_FILE_PATH].use { editor ->
|
||||||
editor.file.doRecursively node@{ node ->
|
editor.file.doRecursively node@{ node ->
|
||||||
@@ -35,4 +31,8 @@ class PlayerButtonBackgroundPatch : ResourcePatch {
|
|||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private companion object {
|
||||||
|
const val RESOURCE_FILE_PATH = "res/drawable/player_button_circle_background.xml"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class HidePlayerButtonsPatch : BytecodePatch(
|
|||||||
|
|
||||||
PlayerControlsVisibilityModelFingerprint.result?.apply {
|
PlayerControlsVisibilityModelFingerprint.result?.apply {
|
||||||
val callIndex = scanResult.patternScanResult!!.endIndex
|
val callIndex = scanResult.patternScanResult!!.endIndex
|
||||||
val callInstruction = mutableMethod.instruction(callIndex) as Instruction3rc
|
val callInstruction = mutableMethod.instruction<Instruction3rc>(callIndex)
|
||||||
|
|
||||||
// overriding this parameter register hides the previous and next buttons
|
// overriding this parameter register hides the previous and next buttons
|
||||||
val hasNextParameterRegister = callInstruction.startRegister + ParameterOffsets.HAS_NEXT
|
val hasNextParameterRegister = callInstruction.startRegister + ParameterOffsets.HAS_NEXT
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package app.revanced.patches.youtube.layout.hide.albumcards.bytecode.patch
|
package app.revanced.patches.youtube.layout.hide.albumcards.bytecode.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
@@ -29,16 +30,22 @@ class AlbumCardsPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
val albumCardsResult = AlbumCardsFingerprint.result!!
|
AlbumCardsFingerprint.result?.let {
|
||||||
val albumCardsMethod = albumCardsResult.mutableMethod
|
it.mutableMethod.apply {
|
||||||
|
val checkCastAnchorIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
|
val insertIndex = checkCastAnchorIndex + 1
|
||||||
|
|
||||||
val checkCastAnchorIndex = albumCardsResult.scanResult.patternScanResult!!.endIndex
|
val albumCardViewRegister = instruction<OneRegisterInstruction>(checkCastAnchorIndex).registerA
|
||||||
|
|
||||||
albumCardsMethod.addInstruction(
|
addInstruction(
|
||||||
checkCastAnchorIndex + 1, """
|
insertIndex,
|
||||||
invoke-static {v${(albumCardsMethod.instruction(checkCastAnchorIndex) as OneRegisterInstruction).registerA}}, Lapp/revanced/integrations/patches/HideAlbumCardsPatch;->hideAlbumCards(Landroid/view/View;)V
|
"invoke-static {v$albumCardViewRegister}, " +
|
||||||
"""
|
"Lapp/revanced/integrations/patches/HideAlbumCardsPatch;" +
|
||||||
)
|
"->" +
|
||||||
|
"hideAlbumCards(Landroid/view/View;)V"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: return AlbumCardsFingerprint.toErrorResult()
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package app.revanced.patches.youtube.layout.hide.breakingnews.bytecode.patch
|
package app.revanced.patches.youtube.layout.hide.breakingnews.bytecode.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
@@ -24,22 +25,29 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
|||||||
@BreakingNewsCompatibility
|
@BreakingNewsCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class BreakingNewsPatch : BytecodePatch(
|
class BreakingNewsPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(BreakingNewsFingerprint)
|
||||||
BreakingNewsFingerprint,
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
val breakingNewsResult = BreakingNewsFingerprint.result!!
|
BreakingNewsFingerprint.result?.let {
|
||||||
val breakingNewsMethod = breakingNewsResult.mutableMethod
|
val insertIndex = it.scanResult.patternScanResult!!.endIndex - 1
|
||||||
|
val moveResultIndex = insertIndex - 1
|
||||||
|
|
||||||
val moveResultObjectIndex =
|
it.mutableMethod.apply {
|
||||||
breakingNewsResult.scanResult.patternScanResult!!.endIndex - 2
|
val breakingNewsViewRegister = instruction<OneRegisterInstruction>(moveResultIndex).registerA
|
||||||
|
|
||||||
|
addInstruction(
|
||||||
|
insertIndex,
|
||||||
|
"""
|
||||||
|
invoke-static {v$breakingNewsViewRegister},
|
||||||
|
Lapp/revanced/integrations/patches/HideBreakingNewsPatch;
|
||||||
|
->
|
||||||
|
hideBreakingNews(Landroid/view/View;)V
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
} ?: return BreakingNewsFingerprint.toErrorResult()
|
||||||
|
|
||||||
breakingNewsMethod.addInstruction(
|
|
||||||
moveResultObjectIndex + 1, """
|
|
||||||
invoke-static {v${(breakingNewsMethod.instruction(moveResultObjectIndex) as OneRegisterInstruction).registerA}}, Lapp/revanced/integrations/patches/HideBreakingNewsPatch;->hideBreakingNews(Landroid/view/View;)V
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package app.revanced.patches.youtube.layout.hide.comments.bytecode.patch
|
package app.revanced.patches.youtube.layout.hide.comments.bytecode.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
@@ -32,9 +33,6 @@ class CommentsPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
val shortsCommentsButtonResult = ShortsCommentsButtonFingerprint.result!!
|
|
||||||
val shortsCommentsButtonMethod = shortsCommentsButtonResult.mutableMethod
|
|
||||||
|
|
||||||
val checkCastAnchorFingerprint = object : MethodFingerprint(
|
val checkCastAnchorFingerprint = object : MethodFingerprint(
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.CONST,
|
Opcode.CONST,
|
||||||
@@ -47,15 +45,24 @@ class CommentsPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
val checkCastAnchorIndex = checkCastAnchorFingerprint.also {
|
ShortsCommentsButtonFingerprint.result?.let {
|
||||||
it.resolve(context, shortsCommentsButtonMethod, shortsCommentsButtonResult.classDef)
|
it.mutableMethod.apply {
|
||||||
}.result!!.scanResult.patternScanResult!!.endIndex
|
val checkCastAnchorIndex = checkCastAnchorFingerprint.also { result ->
|
||||||
|
if (!result.resolve(context, this, it.classDef))
|
||||||
|
throw checkCastAnchorFingerprint.toErrorResult()
|
||||||
|
}.result!!.scanResult.patternScanResult!!.endIndex
|
||||||
|
|
||||||
shortsCommentsButtonMethod.addInstructions(
|
val shortsCommentsButtonRegister = instruction<OneRegisterInstruction>(checkCastAnchorIndex).registerA
|
||||||
checkCastAnchorIndex + 1, """
|
val insertIndex = checkCastAnchorIndex + 1
|
||||||
invoke-static {v${(shortsCommentsButtonMethod.instruction(checkCastAnchorIndex) as OneRegisterInstruction).registerA}}, Lapp/revanced/integrations/patches/HideShortsCommentsButtonPatch;->hideShortsCommentsButton(Landroid/view/View;)V
|
|
||||||
"""
|
addInstructions(
|
||||||
)
|
insertIndex,
|
||||||
|
"""
|
||||||
|
invoke-static { v$shortsCommentsButtonRegister }, Lapp/revanced/integrations/patches/HideShortsCommentsButtonPatch;->hideShortsCommentsButton(Landroid/view/View;)V
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: return ShortsCommentsButtonFingerprint.toErrorResult()
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class CrowdfundingBoxPatch : BytecodePatch(
|
|||||||
CrowdfundingBoxFingerprint.result?.let {
|
CrowdfundingBoxFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val objectRegister = (instruction(insertIndex) as TwoRegisterInstruction).registerA
|
val objectRegister = instruction<TwoRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
addInstruction(insertIndex, "invoke-static {v$objectRegister}, $INTEGRATIONS_METHOD_DESCRIPTOR")
|
addInstruction(insertIndex, "invoke-static {v$objectRegister}, $INTEGRATIONS_METHOD_DESCRIPTOR")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package app.revanced.patches.youtube.layout.hide.endscreencards.bytecode.patch
|
package app.revanced.patches.youtube.layout.hide.endscreencards.bytecode.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
@@ -35,19 +36,23 @@ class HideEndscreenCardsPatch : BytecodePatch(
|
|||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
fun MethodFingerprint.injectHideCall() {
|
fun MethodFingerprint.injectHideCall() {
|
||||||
val layoutResult = result!!
|
val layoutResult = result ?: throw toErrorResult()
|
||||||
val layoutMethod = layoutResult.mutableMethod
|
layoutResult.mutableMethod.apply {
|
||||||
|
val insertIndex = layoutResult.scanResult.patternScanResult!!.endIndex + 1
|
||||||
|
val viewRegister = instruction<Instruction21c>(insertIndex - 1).registerA
|
||||||
|
|
||||||
val checkCastIndex = layoutResult.scanResult.patternScanResult!!.endIndex
|
addInstruction(
|
||||||
val viewRegister = (layoutMethod.instruction(checkCastIndex) as Instruction21c).registerA
|
insertIndex,
|
||||||
|
"invoke-static { v$viewRegister }, Lapp/revanced/integrations/patches/HideEndscreenCardsPatch;->hideEndscreen(Landroid/view/View;)V"
|
||||||
layoutMethod.addInstruction(
|
)
|
||||||
checkCastIndex + 1,
|
}
|
||||||
"invoke-static { v$viewRegister }, Lapp/revanced/integrations/patches/HideEndscreenCardsPatch;->hideEndscreen(Landroid/view/View;)V"
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
listOf(LayoutCircleFingerprint, LayoutIconFingerprint, LayoutVideoFingerprint).forEach(MethodFingerprint::injectHideCall)
|
listOf(
|
||||||
|
LayoutCircleFingerprint,
|
||||||
|
LayoutIconFingerprint,
|
||||||
|
LayoutVideoFingerprint
|
||||||
|
).forEach(MethodFingerprint::injectHideCall)
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hide.filterbar.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37"))])
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
internal annotation class HideFilterBar
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hide.filterbar.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patches.youtube.layout.hide.filterbar.patch.HideFilterBarResourcePatch.Companion.filterBarHeightId
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object FilterBarHeightFingerprint : LiteralOpcodesFingerprint(
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.CONST,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT,
|
||||||
|
Opcode.IPUT
|
||||||
|
),
|
||||||
|
filterBarHeightId
|
||||||
|
)
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hide.filterbar.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
||||||
|
|
||||||
|
|
||||||
|
abstract class LiteralOpcodesFingerprint(opcodes: List<Opcode>, literal: Long) : MethodFingerprint(
|
||||||
|
opcodes = opcodes,
|
||||||
|
customFingerprint = {
|
||||||
|
it.implementation?.instructions?.any { instruction ->
|
||||||
|
if (instruction.opcode != Opcode.CONST) return@any false
|
||||||
|
|
||||||
|
val wideLiteral = (instruction as WideLiteralInstruction).wideLiteral
|
||||||
|
|
||||||
|
literal == wideLiteral
|
||||||
|
} ?: false
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hide.filterbar.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patches.youtube.layout.hide.filterbar.patch.HideFilterBarResourcePatch.Companion.relatedChipCloudMarginId
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object RelatedChipCloudFingerprint : LiteralOpcodesFingerprint(
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.CONST,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT
|
||||||
|
),
|
||||||
|
relatedChipCloudMarginId
|
||||||
|
)
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hide.filterbar.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patches.youtube.layout.hide.filterbar.patch.HideFilterBarResourcePatch.Companion.barContainerHeightId
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object SearchResultsChipBarFingerprint : LiteralOpcodesFingerprint(
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.CONST,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT
|
||||||
|
),
|
||||||
|
barContainerHeightId
|
||||||
|
)
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hide.filterbar.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
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.patches.youtube.layout.hide.filterbar.annotations.HideFilterBar
|
||||||
|
import app.revanced.patches.youtube.layout.hide.filterbar.fingerprints.FilterBarHeightFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.hide.filterbar.fingerprints.RelatedChipCloudFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.hide.filterbar.fingerprints.SearchResultsChipBarFingerprint
|
||||||
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("hide-filter-bar")
|
||||||
|
@Description("Hides the filter bar in video feeds.")
|
||||||
|
@DependsOn([HideFilterBarResourcePatch::class])
|
||||||
|
@HideFilterBar
|
||||||
|
@Version("0.0.1")
|
||||||
|
class HideFilterBarPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
RelatedChipCloudFingerprint,
|
||||||
|
SearchResultsChipBarFingerprint,
|
||||||
|
FilterBarHeightFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
FilterBarHeightFingerprint.patch<TwoRegisterInstruction> { register ->
|
||||||
|
"""
|
||||||
|
invoke-static { v$register }, $INTEGRATIONS_CLASS_DESCRIPTOR->hideInFeed(I)I
|
||||||
|
move-result v$register
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
|
||||||
|
RelatedChipCloudFingerprint.patch<OneRegisterInstruction>(1) { register ->
|
||||||
|
"invoke-static { v$register }, " +
|
||||||
|
"$INTEGRATIONS_CLASS_DESCRIPTOR->hideInRelatedVideos(Landroid/view/View;)V"
|
||||||
|
}
|
||||||
|
|
||||||
|
SearchResultsChipBarFingerprint.patch<OneRegisterInstruction>(-1, -2) { register ->
|
||||||
|
"""
|
||||||
|
invoke-static { v$register }, $INTEGRATIONS_CLASS_DESCRIPTOR->hideInSearch(I)I
|
||||||
|
move-result v$register
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
private companion object {
|
||||||
|
const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||||
|
"Lapp/revanced/integrations/patches/HideFilterBarPatch;"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Patch a [MethodFingerprint] with a given [instructions].
|
||||||
|
*
|
||||||
|
* @param RegisterInstruction The type of instruction to get the register from.
|
||||||
|
* @param insertIndexOffset The offset to add to the end index of the [MethodFingerprint].
|
||||||
|
* @param hookRegisterOffset The offset to add to the register of the hook.
|
||||||
|
* @param instructions The instructions to add with the register as a parameter.
|
||||||
|
*/
|
||||||
|
private fun <RegisterInstruction: OneRegisterInstruction> MethodFingerprint.patch(
|
||||||
|
insertIndexOffset: Int = 0,
|
||||||
|
hookRegisterOffset: Int = 0,
|
||||||
|
instructions: (Int) -> String
|
||||||
|
) =
|
||||||
|
result?.let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
|
|
||||||
|
val insertIndex = endIndex + insertIndexOffset
|
||||||
|
val register = instruction<RegisterInstruction>(endIndex + hookRegisterOffset).registerA
|
||||||
|
|
||||||
|
addInstructions(insertIndex, instructions(register))
|
||||||
|
}
|
||||||
|
} ?: throw toErrorResult()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hide.filterbar.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.ResourceContext
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||||
|
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
|
||||||
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||||
|
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||||
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
|
|
||||||
|
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||||
|
@Version("0.0.1")
|
||||||
|
class HideFilterBarResourcePatch : ResourcePatch {
|
||||||
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||||
|
PreferenceScreen(
|
||||||
|
"revanced_hide_filter_bar_preference",
|
||||||
|
StringResource(
|
||||||
|
"revanced_hide_filter_bar_preference_title",
|
||||||
|
"Hide filter bar"
|
||||||
|
),
|
||||||
|
listOf(
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_hide_filter_bar_feed_in_feed",
|
||||||
|
StringResource(
|
||||||
|
"revanced_hide_filter_bar_feed_in_feed_title",
|
||||||
|
"Hide in feed"
|
||||||
|
),
|
||||||
|
false,
|
||||||
|
StringResource(
|
||||||
|
"revanced_hide_filter_bar_feed_in_feed_summary_on",
|
||||||
|
"Hidden in feed"
|
||||||
|
),
|
||||||
|
StringResource(
|
||||||
|
"revanced_hide_filter_bar_feed_in_feed_summary_off",
|
||||||
|
"Shown in feed"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_hide_filter_bar_feed_in_search",
|
||||||
|
StringResource(
|
||||||
|
"revanced_hide_filter_bar_feed_in_search_title",
|
||||||
|
"Hide in search"
|
||||||
|
),
|
||||||
|
false,
|
||||||
|
StringResource(
|
||||||
|
"revanced_hide_filter_bar_feed_in_search_summary_on",
|
||||||
|
"Hidden in search"
|
||||||
|
),
|
||||||
|
StringResource(
|
||||||
|
"revanced_hide_filter_bar_feed_in_search_summary_off",
|
||||||
|
"Shown in search"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_hide_filter_bar_feed_in_related_videos",
|
||||||
|
StringResource(
|
||||||
|
"revanced_hide_filter_bar_feed_in_related_videos_title",
|
||||||
|
"Hide in related videos"
|
||||||
|
),
|
||||||
|
false,
|
||||||
|
StringResource(
|
||||||
|
"revanced_hide_filter_bar_feed_in_related_videos_summary_on",
|
||||||
|
"Hidden in related videos"
|
||||||
|
),
|
||||||
|
StringResource(
|
||||||
|
"revanced_hide_filter_bar_feed_in_related_videos_summary_off",
|
||||||
|
"Shown in related videos"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
relatedChipCloudMarginId = "related_chip_cloud_reduced_margins".layoutResourceId("layout")
|
||||||
|
filterBarHeightId = "filter_bar_height".layoutResourceId()
|
||||||
|
barContainerHeightId = "bar_container_height".layoutResourceId()
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
internal companion object {
|
||||||
|
var filterBarHeightId = -1L
|
||||||
|
var relatedChipCloudMarginId = -1L
|
||||||
|
var barContainerHeightId = -1L
|
||||||
|
|
||||||
|
private fun String.layoutResourceId(type: String = "dimen") =
|
||||||
|
ResourceMappingPatch.resourceMappings.single { it.type == type && it.name == this }.id
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,7 +29,7 @@ class HideFloatingMicrophoneButtonPatch : BytecodePatch(
|
|||||||
ShowFloatingMicrophoneButtonFingerprint.result?.let { result ->
|
ShowFloatingMicrophoneButtonFingerprint.result?.let { result ->
|
||||||
with(result.mutableMethod) {
|
with(result.mutableMethod) {
|
||||||
val insertIndex = result.scanResult.patternScanResult!!.startIndex + 1
|
val insertIndex = result.scanResult.patternScanResult!!.startIndex + 1
|
||||||
val showButtonRegister = (instruction(insertIndex - 1) as TwoRegisterInstruction).registerA
|
val showButtonRegister = instruction<TwoRegisterInstruction>(insertIndex - 1).registerA
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
insertIndex,
|
insertIndex,
|
||||||
|
|||||||
@@ -45,8 +45,9 @@ class HideGetPremiumPatch : BytecodePatch(
|
|||||||
GetPremiumViewFingerprint.result?.let {
|
GetPremiumViewFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
||||||
val measuredWidthRegister = (instruction(startIndex) as TwoRegisterInstruction).registerA
|
val measuredWidthRegister = instruction<TwoRegisterInstruction>(startIndex).registerA
|
||||||
val measuredHeightInstruction = instruction(startIndex + 1) as TwoRegisterInstruction
|
val measuredHeightInstruction = instruction<TwoRegisterInstruction>(startIndex + 1)
|
||||||
|
|
||||||
val measuredHeightRegister = measuredHeightInstruction.registerA
|
val measuredHeightRegister = measuredHeightInstruction.registerA
|
||||||
val tempRegister = measuredHeightInstruction.registerB
|
val tempRegister = measuredHeightInstruction.registerB
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ import app.revanced.patches.youtube.layout.hide.infocards.fingerprints.Infocards
|
|||||||
import app.revanced.patches.youtube.layout.hide.infocards.resource.patch.HideInfocardsResourcePatch
|
import app.revanced.patches.youtube.layout.hide.infocards.resource.patch.HideInfocardsResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
|
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
|
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@DependsOn([IntegrationsPatch::class, HideInfocardsResourcePatch::class])
|
@DependsOn([IntegrationsPatch::class, HideInfocardsResourcePatch::class])
|
||||||
@@ -35,18 +36,17 @@ class HideInfoCardsPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
with(InfocardsIncognitoFingerprint.also {
|
InfocardsIncognitoFingerprint.also {
|
||||||
it.resolve(context, InfocardsIncognitoParentFingerprint.result!!.classDef)
|
it.resolve(context, InfocardsIncognitoParentFingerprint.result!!.classDef)
|
||||||
}.result!!.mutableMethod) {
|
}.result!!.mutableMethod.apply {
|
||||||
val invokeInstructionIndex = implementation!!.instructions.indexOfFirst {
|
val invokeInstructionIndex = implementation!!.instructions.indexOfFirst {
|
||||||
it.opcode.ordinal == Opcode.INVOKE_VIRTUAL.ordinal &&
|
it.opcode.ordinal == Opcode.INVOKE_VIRTUAL.ordinal &&
|
||||||
((it as? BuilderInstruction35c)?.reference.toString() ==
|
((it as ReferenceInstruction).reference.toString() == "Landroid/view/View;->setVisibility(I)V")
|
||||||
"Landroid/view/View;->setVisibility(I)V")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
invokeInstructionIndex,
|
invokeInstructionIndex,
|
||||||
"invoke-static {v${(instruction(invokeInstructionIndex) as? BuilderInstruction35c)?.registerC}}," +
|
"invoke-static {v${instruction<FiveRegisterInstruction>(invokeInstructionIndex).registerC}}," +
|
||||||
" Lapp/revanced/integrations/patches/HideInfoCardsPatch;->hideInfoCardsIncognito(Landroid/view/View;)V"
|
" Lapp/revanced/integrations/patches/HideInfoCardsPatch;->hideInfoCardsIncognito(Landroid/view/View;)V"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hide.loadmorebutton.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility(
|
||||||
|
[Package(
|
||||||
|
"com.google.android.youtube", arrayOf(
|
||||||
|
"17.49.37",
|
||||||
|
"18.03.36",
|
||||||
|
"18.03.42",
|
||||||
|
"18.04.35",
|
||||||
|
"18.04.41",
|
||||||
|
"18.05.32",
|
||||||
|
"18.05.35",
|
||||||
|
"18.05.40",
|
||||||
|
"18.08.37",
|
||||||
|
"18.15.40",
|
||||||
|
"18.16.37"
|
||||||
|
)
|
||||||
|
)]
|
||||||
|
)
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
internal annotation class HideLoadMoreButtonCompatibility
|
||||||
|
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hide.loadmorebutton.bytecode.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.hide.loadmorebutton.resource.patch.HideLoadMoreButtonResourcePatch
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
||||||
|
|
||||||
|
object HideLoadMoreButtonFingerprint : MethodFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||||
|
parameters = listOf("L", "L", "L", "L"),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.CONST,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT
|
||||||
|
),
|
||||||
|
customFingerprint = { methodDef ->
|
||||||
|
methodDef.implementation?.instructions?.any {
|
||||||
|
if (it.opcode != Opcode.CONST) return@any false
|
||||||
|
|
||||||
|
val literal = (it as WideLiteralInstruction).wideLiteral
|
||||||
|
|
||||||
|
literal == HideLoadMoreButtonResourcePatch.expandButtonDownId
|
||||||
|
} ?: false
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hide.loadmorebutton.bytecode.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
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.patches.youtube.layout.hide.loadmorebutton.bytecode.fingerprints.HideLoadMoreButtonFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.hide.loadmorebutton.resource.patch.HideLoadMoreButtonResourcePatch
|
||||||
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("hide-load-more-button")
|
||||||
|
@Description("Hides the button under videos that loads similar videos.")
|
||||||
|
@DependsOn([HideLoadMoreButtonResourcePatch::class])
|
||||||
|
@Version("0.0.1")
|
||||||
|
class HideLoadMoreButtonPatch : BytecodePatch(listOf(HideLoadMoreButtonFingerprint)) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
HideLoadMoreButtonFingerprint.result?.let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val moveRegisterIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
|
val viewRegister = instruction<OneRegisterInstruction>(moveRegisterIndex).registerA
|
||||||
|
|
||||||
|
val insertIndex = moveRegisterIndex + 1
|
||||||
|
addInstruction(
|
||||||
|
insertIndex,
|
||||||
|
"invoke-static { v$viewRegister }, " +
|
||||||
|
"$INTEGRATIONS_CLASS_DESCRIPTOR->hideLoadMoreButton(Landroid/view/View;)V"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: return HideLoadMoreButtonFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
private companion object {
|
||||||
|
const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||||
|
"Lapp/revanced/integrations/patches/HideLoadMoreButtonPatch;"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hide.loadmorebutton.resource.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.data.ResourceContext
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||||
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||||
|
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||||
|
import app.revanced.patches.youtube.layout.hide.loadmorebutton.annotations.HideLoadMoreButtonCompatibility
|
||||||
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
|
|
||||||
|
@Name("hide-load-more-button-resource-patch")
|
||||||
|
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||||
|
@HideLoadMoreButtonCompatibility
|
||||||
|
class HideLoadMoreButtonResourcePatch : ResourcePatch {
|
||||||
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_hide_load_more_button",
|
||||||
|
StringResource("revanced_hide_load_more_button_title", "Hide Load More button"),
|
||||||
|
true,
|
||||||
|
StringResource("revanced_hide_load_more_button_summary_on", "Load More button is hidden"),
|
||||||
|
StringResource("revanced_hide_load_more_button_summary_off", "Load More button is shown")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
expandButtonDownId = ResourceMappingPatch.resourceMappings.single {
|
||||||
|
it.type == "layout" && it.name == "expand_button_down"
|
||||||
|
}.id
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
internal companion object {
|
||||||
|
var expandButtonDownId: Long = -1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package app.revanced.patches.youtube.layout.hide.personalinformation.bytecode.patch
|
package app.revanced.patches.youtube.layout.hide.personalinformation.bytecode.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
@@ -29,23 +30,22 @@ class HideEmailAddressPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
val accountSwitcherAccessibilityLabelResult = AccountSwitcherAccessibilityLabelFingerprint.result!!
|
AccountSwitcherAccessibilityLabelFingerprint.result?.let {
|
||||||
val accountSwitcherAccessibilityLabelMethod = accountSwitcherAccessibilityLabelResult.mutableMethod
|
it.mutableMethod.apply {
|
||||||
|
val setVisibilityConstIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
|
|
||||||
val setVisibilityConstIndex =
|
val setVisibilityConstRegister =
|
||||||
accountSwitcherAccessibilityLabelResult.scanResult.patternScanResult!!.endIndex
|
instruction<OneRegisterInstruction>(setVisibilityConstIndex - 2).registerA
|
||||||
|
|
||||||
val setVisibilityConstRegister = (
|
addInstructions(
|
||||||
accountSwitcherAccessibilityLabelMethod.instruction
|
setVisibilityConstIndex,
|
||||||
(setVisibilityConstIndex - 2) as OneRegisterInstruction
|
"""
|
||||||
).registerA
|
invoke-static {v$setVisibilityConstRegister}, Lapp/revanced/integrations/patches/HideEmailAddressPatch;->hideEmailAddress(I)I
|
||||||
|
move-result v$setVisibilityConstRegister
|
||||||
accountSwitcherAccessibilityLabelMethod.addInstructions(
|
"""
|
||||||
setVisibilityConstIndex, """
|
)
|
||||||
invoke-static {v$setVisibilityConstRegister}, Lapp/revanced/integrations/patches/HideEmailAddressPatch;->hideEmailAddress(I)I
|
}
|
||||||
move-result v$setVisibilityConstRegister
|
} ?: return AccountSwitcherAccessibilityLabelFingerprint.toErrorResult()
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hide.player.overlay.bytecode.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.hide.player.overlay.resource.patch.HidePlayerOverlayResourcePatch
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
||||||
|
|
||||||
|
object CreatePlayerOverviewFingerprint : MethodFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
access = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.CONST,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.CHECK_CAST
|
||||||
|
),
|
||||||
|
customFingerprint = { methodDef ->
|
||||||
|
methodDef.implementation?.instructions?.any {
|
||||||
|
if (it.opcode != Opcode.CONST) return@any false
|
||||||
|
|
||||||
|
val literal = (it as WideLiteralInstruction).wideLiteral
|
||||||
|
|
||||||
|
literal == HidePlayerOverlayResourcePatch.scrimOverlayId
|
||||||
|
} ?: false
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hide.player.overlay.bytecode.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
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.patches.youtube.layout.hide.player.overlay.annotations.HidePlayerOverlayPatchCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.hide.player.overlay.bytecode.fingerprints.CreatePlayerOverviewFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.hide.player.overlay.resource.patch.HidePlayerOverlayResourcePatch
|
||||||
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("hide-player-overlay")
|
||||||
|
@Description("Hides the dark background overlay from the player when player controls are visible.")
|
||||||
|
@DependsOn([HidePlayerOverlayResourcePatch::class])
|
||||||
|
@HidePlayerOverlayPatchCompatibility
|
||||||
|
@Version("0.0.2")
|
||||||
|
class HidePlayerOverlayPatch : BytecodePatch(listOf(CreatePlayerOverviewFingerprint)) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
CreatePlayerOverviewFingerprint.result?.let { result ->
|
||||||
|
result.mutableMethod.apply {
|
||||||
|
val viewRegisterIndex = implementation!!.instructions.indexOfFirst {
|
||||||
|
val literal = (it as? WideLiteralInstruction)?.wideLiteral
|
||||||
|
|
||||||
|
literal == HidePlayerOverlayResourcePatch.scrimOverlayId
|
||||||
|
} + 3
|
||||||
|
val viewRegister = instruction<OneRegisterInstruction>(viewRegisterIndex).registerA
|
||||||
|
|
||||||
|
val insertIndex = viewRegisterIndex + 1
|
||||||
|
addInstruction(
|
||||||
|
insertIndex,
|
||||||
|
"invoke-static { v$viewRegister }, " +
|
||||||
|
"$INTEGRATIONS_CLASS_DESCRIPTOR->hidePlayerOverlay(Landroid/widget/ImageView;)V"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: return CreatePlayerOverviewFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
private companion object {
|
||||||
|
const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/HidePlayerOverlayPatch;"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.layout.hide.player.overlay.patch
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.ResourceContext
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.ResourcePatch
|
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
import app.revanced.patches.youtube.layout.hide.player.overlay.annotations.HidePlayerOverlayPatchCompatibility
|
|
||||||
|
|
||||||
@Patch(false)
|
|
||||||
@Name("hide-player-overlay")
|
|
||||||
@Description("Hides the dark player overlay when player controls are visible.")
|
|
||||||
@HidePlayerOverlayPatchCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class HidePlayerOverlayPatch : ResourcePatch {
|
|
||||||
override fun execute(context: ResourceContext): PatchResult {
|
|
||||||
val attributes = arrayOf("height", "width")
|
|
||||||
|
|
||||||
context.xmlEditor[RESOURCE_FILE_PATH].use { editor ->
|
|
||||||
editor.file.getElementsByTagName("FrameLayout").item(0).childNodes.apply {
|
|
||||||
for (i in 1 until length) {
|
|
||||||
val view = item(i)
|
|
||||||
if (
|
|
||||||
view.attributes.getNamedItem("android:id")
|
|
||||||
?.nodeValue
|
|
||||||
?.endsWith("scrim_overlay") == true
|
|
||||||
) {
|
|
||||||
attributes.forEach {
|
|
||||||
view.attributes.getNamedItem("android:layout_$it").nodeValue = "0.0dip"
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
|
|
||||||
private companion object {
|
|
||||||
const val RESOURCE_FILE_PATH = "res/layout/youtube_controls_overlay.xml"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hide.player.overlay.resource.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.data.ResourceContext
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||||
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||||
|
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||||
|
import app.revanced.patches.youtube.layout.hide.player.overlay.annotations.HidePlayerOverlayPatchCompatibility
|
||||||
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
|
import jdk.jfr.Name
|
||||||
|
|
||||||
|
@Name("hide-player-overlay-resource-patch")
|
||||||
|
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||||
|
@HidePlayerOverlayPatchCompatibility
|
||||||
|
class HidePlayerOverlayResourcePatch : ResourcePatch {
|
||||||
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_hide_player_overlay",
|
||||||
|
StringResource("revanced_hide_player_overlay_title", "Hide background overlay in player"),
|
||||||
|
false,
|
||||||
|
StringResource("revanced_hide_player_overlay_summary_on", "Background overlay is hidden"),
|
||||||
|
StringResource("revanced_hide_player_overlay_summary_off", "Background overlay is shown")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
scrimOverlayId = ResourceMappingPatch.resourceMappings.single {
|
||||||
|
it.type == "id" && it.name == "scrim_overlay"
|
||||||
|
}.id
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
internal companion object {
|
||||||
|
var scrimOverlayId: Long = -1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,11 +16,16 @@ import app.revanced.patches.shared.fingerprints.SeekbarOnDrawFingerprint
|
|||||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||||
import app.revanced.patches.youtube.layout.hide.seekbar.annotations.HideSeekbarCompatibility
|
import app.revanced.patches.youtube.layout.hide.seekbar.annotations.HideSeekbarCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.seekbar.bytecode.patch.SeekbarColorBytecodePatch
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
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.bytecode.patch.SettingsPatch
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
@DependsOn([
|
||||||
|
IntegrationsPatch::class,
|
||||||
|
SettingsPatch::class,
|
||||||
|
SeekbarColorBytecodePatch::class // Used to hide the seekbar in the feed and watch history
|
||||||
|
])
|
||||||
@Name("hide-seekbar")
|
@Name("hide-seekbar")
|
||||||
@Description("Hides the seekbar.")
|
@Description("Hides the seekbar.")
|
||||||
@HideSeekbarCompatibility
|
@HideSeekbarCompatibility
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.*
|
|||||||
import app.revanced.patches.youtube.layout.returnyoutubedislike.resource.patch.ReturnYouTubeDislikeResourcePatch
|
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.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
||||||
import app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch
|
import app.revanced.patches.youtube.video.videoid.patch.VideoIdPatch
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
|
import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
|
||||||
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
@@ -102,18 +102,21 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
|
|||||||
val atomicReferenceStartIndex = TextComponentAtomicReferenceFingerprint.result!!
|
val atomicReferenceStartIndex = TextComponentAtomicReferenceFingerprint.result!!
|
||||||
.scanResult.patternScanResult!!.startIndex
|
.scanResult.patternScanResult!!.startIndex
|
||||||
|
|
||||||
|
val insertIndex = atomicReferenceStartIndex + 8
|
||||||
|
|
||||||
textComponentContextFingerprintResult.mutableMethod.apply {
|
textComponentContextFingerprintResult.mutableMethod.apply {
|
||||||
// Get the conversion context obfuscated field name, and the registers for the AtomicReference and CharSequence
|
// Get the conversion context obfuscated field name, and the registers for the AtomicReference and CharSequence
|
||||||
val conversionContextFieldReference =
|
val conversionContextFieldReference =
|
||||||
(instruction(conversionContextIndex) as ReferenceInstruction).reference
|
instruction<ReferenceInstruction>(conversionContextIndex).reference
|
||||||
|
|
||||||
// any free register
|
// any free register
|
||||||
val contextRegister =
|
val contextRegister =
|
||||||
(instruction(atomicReferenceStartIndex) as TwoRegisterInstruction).registerB
|
instruction<TwoRegisterInstruction>(atomicReferenceStartIndex).registerB
|
||||||
val atomicReferenceRegister =
|
|
||||||
(instruction(atomicReferenceStartIndex + 5) as FiveRegisterInstruction).registerC
|
|
||||||
|
|
||||||
val insertIndex = atomicReferenceStartIndex + 8
|
val atomicReferenceRegister =
|
||||||
val moveCharSequenceInstruction = instruction(insertIndex) as TwoRegisterInstruction
|
instruction<FiveRegisterInstruction>(atomicReferenceStartIndex + 5).registerC
|
||||||
|
|
||||||
|
val moveCharSequenceInstruction = instruction<TwoRegisterInstruction>(insertIndex)
|
||||||
val charSequenceRegister = moveCharSequenceInstruction.registerB
|
val charSequenceRegister = moveCharSequenceInstruction.registerB
|
||||||
|
|
||||||
// Insert as first instructions at the control flow label.
|
// Insert as first instructions at the control flow label.
|
||||||
@@ -145,8 +148,8 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
|
|||||||
return PatchResultError("Method signature did not match: $this $parameterTypes")
|
return PatchResultError("Method signature did not match: $this $parameterTypes")
|
||||||
|
|
||||||
val insertIndex = implementation!!.instructions.size - 1
|
val insertIndex = implementation!!.instructions.size - 1
|
||||||
val spannedParameterRegister = (instruction(insertIndex) as OneRegisterInstruction).registerA
|
val spannedParameterRegister = instruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
val parameter = (instruction(insertIndex - 2) as BuilderInstruction35c).reference
|
val parameter = instruction<BuilderInstruction35c>(insertIndex - 2).reference
|
||||||
|
|
||||||
if (!parameter.toString().endsWith("Landroid/text/Spanned;"))
|
if (!parameter.toString().endsWith("Landroid/text/Spanned;"))
|
||||||
return PatchResultError("Method signature parameter did not match: $parameter")
|
return PatchResultError("Method signature parameter did not match: $parameter")
|
||||||
@@ -171,9 +174,12 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
|
|||||||
DislikesOldLayoutTextViewFingerprint.result?.let {
|
DislikesOldLayoutTextViewFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
||||||
val resourceIdentifierRegister = (instruction(startIndex) as OneRegisterInstruction).registerA
|
|
||||||
val textViewRegister = (instruction(startIndex + 4) as OneRegisterInstruction).registerA
|
val resourceIdentifierRegister = instruction<OneRegisterInstruction>(startIndex).registerA
|
||||||
addInstruction(startIndex + 4,
|
val textViewRegister = instruction<OneRegisterInstruction>(startIndex + 4).registerA
|
||||||
|
|
||||||
|
addInstruction(
|
||||||
|
startIndex + 4,
|
||||||
"invoke-static {v$resourceIdentifierRegister, v$textViewRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->setOldUILayoutDislikes(ILandroid/widget/TextView;)V"
|
"invoke-static {v$resourceIdentifierRegister, v$textViewRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->setOldUILayoutDislikes(ILandroid/widget/TextView;)V"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.seekbar.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility([Package("com.google.android.youtube")])
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
internal annotation class SeekbarColorCompatibility
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.seekbar.bytecode.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.seekbar.resource.SeekbarColorResourcePatch
|
||||||
|
import app.revanced.util.patch.indexOfFirstConstantInstruction
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
object CreateDarkThemeSeekbarFingerprint : MethodFingerprint(
|
||||||
|
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||||
|
customFingerprint = { method ->
|
||||||
|
method.indexOfFirstConstantInstruction(SeekbarColorResourcePatch.inlineTimeBarColorizedBarPlayedColorDarkId) != -1
|
||||||
|
&& method.indexOfFirstConstantInstruction(SeekbarColorResourcePatch.inlineTimeBarPlayedNotHighlightedColorId) != -1
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.layout.theme.bytecode.fingerprints
|
package app.revanced.patches.youtube.layout.seekbar.bytecode.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.seekbar.bytecode.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.data.toMethodWalker
|
||||||
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
|
import app.revanced.patches.youtube.layout.seekbar.annotations.SeekbarColorCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.seekbar.bytecode.fingerprints.CreateDarkThemeSeekbarFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.seekbar.bytecode.fingerprints.SetSeekbarClickedColorFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.theme.bytecode.patch.LithoColorHookPatch
|
||||||
|
import app.revanced.patches.youtube.layout.theme.bytecode.patch.LithoColorHookPatch.Companion.lithoColorOverrideHook
|
||||||
|
import app.revanced.patches.youtube.layout.seekbar.resource.SeekbarColorResourcePatch
|
||||||
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
|
import app.revanced.util.patch.indexOfFirstConstantInstruction
|
||||||
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
|
|
||||||
|
@Description("Hide or set a custom seekbar color")
|
||||||
|
@DependsOn([IntegrationsPatch::class, LithoColorHookPatch::class, SeekbarColorResourcePatch::class])
|
||||||
|
@SeekbarColorCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class SeekbarColorBytecodePatch : BytecodePatch(
|
||||||
|
listOf(CreateDarkThemeSeekbarFingerprint, SetSeekbarClickedColorFingerprint)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
CreateDarkThemeSeekbarFingerprint.result?.mutableMethod?.apply {
|
||||||
|
var registerIndex = indexOfFirstConstantInstruction(SeekbarColorResourcePatch.inlineTimeBarColorizedBarPlayedColorDarkId) + 2
|
||||||
|
var colorRegister = (instruction(registerIndex) as OneRegisterInstruction).registerA
|
||||||
|
addInstructions(
|
||||||
|
registerIndex + 1,
|
||||||
|
"""
|
||||||
|
invoke-static { v$colorRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->getSeekbarColorValue(I)I
|
||||||
|
move-result v$colorRegister
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
registerIndex = indexOfFirstConstantInstruction(SeekbarColorResourcePatch.inlineTimeBarPlayedNotHighlightedColorId) + 2
|
||||||
|
colorRegister = (instruction(registerIndex) as OneRegisterInstruction).registerA
|
||||||
|
addInstructions(
|
||||||
|
registerIndex + 1,
|
||||||
|
"""
|
||||||
|
invoke-static { v$colorRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->getSeekbarColorValue(I)I
|
||||||
|
move-result v$colorRegister
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
} ?: return CreateDarkThemeSeekbarFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
SetSeekbarClickedColorFingerprint.result?.let { result ->
|
||||||
|
result.mutableMethod.let {
|
||||||
|
val setColorMethodIndex = result.scanResult.patternScanResult!!.startIndex + 1
|
||||||
|
val method = context
|
||||||
|
.toMethodWalker(it)
|
||||||
|
.nextMethod(setColorMethodIndex, true)
|
||||||
|
.getMethod() as MutableMethod
|
||||||
|
|
||||||
|
method.apply {
|
||||||
|
val colorRegister = (method.instruction(0) as TwoRegisterInstruction).registerA
|
||||||
|
addInstructions(
|
||||||
|
0,
|
||||||
|
"""
|
||||||
|
invoke-static { v$colorRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->getSeekbarColorOverride(I)I
|
||||||
|
move-result v$colorRegister
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} ?: return SetSeekbarClickedColorFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
lithoColorOverrideHook(INTEGRATIONS_CLASS_DESCRIPTOR, "getSeekbarColorOverride")
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
private companion object {
|
||||||
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/theme/SeekbarColorPatch;"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.seekbar.resource
|
||||||
|
|
||||||
|
import app.revanced.patcher.data.ResourceContext
|
||||||
|
import app.revanced.patcher.patch.*
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
|
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||||
|
class SeekbarColorResourcePatch : ResourcePatch {
|
||||||
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
// Edit theme colors via bytecode.
|
||||||
|
// For that the resource id is used in a bytecode patch to change the color.
|
||||||
|
|
||||||
|
val seekbarErrorMessage = "Could not find seekbar resource"
|
||||||
|
inlineTimeBarColorizedBarPlayedColorDarkId = ResourceMappingPatch.resourceMappings
|
||||||
|
.find { it.name == "inline_time_bar_colorized_bar_played_color_dark" }?.id
|
||||||
|
?: return PatchResultError(seekbarErrorMessage)
|
||||||
|
inlineTimeBarPlayedNotHighlightedColorId = ResourceMappingPatch.resourceMappings
|
||||||
|
.find { it.name == "inline_time_bar_played_not_highlighted_color" }?.id
|
||||||
|
?: return PatchResultError(seekbarErrorMessage)
|
||||||
|
|
||||||
|
// Edit the resume playback drawable and replace the progress bar with a custom drawable
|
||||||
|
context.xmlEditor["res/drawable/resume_playback_progressbar_drawable.xml"].use { editor ->
|
||||||
|
val layerList = editor.file.getElementsByTagName("layer-list").item(0) as Element
|
||||||
|
val progressNode = layerList.getElementsByTagName("item").item(1) as Element
|
||||||
|
if (!progressNode.getAttributeNode("android:id").value.endsWith("progress")) {
|
||||||
|
return PatchResultError("Could not find progress bar")
|
||||||
|
}
|
||||||
|
val scaleNode = progressNode.getElementsByTagName("scale").item(0) as Element
|
||||||
|
val shapeNode = scaleNode.getElementsByTagName("shape").item(0) as Element
|
||||||
|
val replacementNode = editor.file.createElement(
|
||||||
|
"app.revanced.integrations.patches.theme.ProgressBarDrawable")
|
||||||
|
scaleNode.replaceChild(replacementNode, shapeNode)
|
||||||
|
}
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
internal var inlineTimeBarColorizedBarPlayedColorDarkId = -1L
|
||||||
|
internal var inlineTimeBarPlayedNotHighlightedColorId = -1L
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -31,8 +31,8 @@ import app.revanced.patches.youtube.misc.autorepeat.fingerprints.AutoRepeatParen
|
|||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch
|
import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch
|
||||||
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
||||||
import app.revanced.patches.youtube.misc.video.information.patch.VideoInformationPatch
|
import app.revanced.patches.youtube.video.information.patch.VideoInformationPatch
|
||||||
import app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch
|
import app.revanced.patches.youtube.video.videoid.patch.VideoIdPatch
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.iface.instruction.*
|
import org.jf.dexlib2.iface.instruction.*
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.layout.theme.bytecode.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import app.revanced.patches.youtube.layout.theme.bytecode.fingerprints.CreateDarkThemeSeekbarFingerprint.indexOfInstructionWithSeekbarId
|
|
||||||
import app.revanced.patches.youtube.layout.theme.resource.ThemeResourcePatch
|
|
||||||
import org.jf.dexlib2.AccessFlags
|
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
import org.jf.dexlib2.iface.Method
|
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
object CreateDarkThemeSeekbarFingerprint : MethodFingerprint(
|
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
|
||||||
customFingerprint = { method -> method.indexOfInstructionWithSeekbarId != -1 },
|
|
||||||
) {
|
|
||||||
/**
|
|
||||||
* The index of the instruction that loads the resource id of the seekbar.
|
|
||||||
*/
|
|
||||||
internal val Method.indexOfInstructionWithSeekbarId
|
|
||||||
get() = implementation?.let {
|
|
||||||
it.instructions.indexOfFirst { instruction ->
|
|
||||||
instruction.opcode == Opcode.CONST && (instruction as WideLiteralInstruction).wideLiteral == ThemeResourcePatch.inlineTimeBarColorizedBarPlayedColorDarkId
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.layout.theme.fingerprints
|
package app.revanced.patches.youtube.layout.theme.bytecode.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.theme.bytecode.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
|
import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.theme.bytecode.fingerprints.LithoThemeFingerprint
|
||||||
|
|
||||||
|
@Name("litho-color-hook")
|
||||||
|
@Description("Adds a hook to set color of Litho components.")
|
||||||
|
@ThemeCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class LithoColorHookPatch : BytecodePatch(listOf(LithoThemeFingerprint)) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
LithoThemeFingerprint.result?.let {
|
||||||
|
insertionIndex = it.scanResult.patternScanResult!!.endIndex - 1
|
||||||
|
colorRegister = "p1"
|
||||||
|
insertionMethod = it.mutableMethod
|
||||||
|
} ?: return LithoThemeFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
companion object {
|
||||||
|
private var insertionIndex : Int = -1
|
||||||
|
private lateinit var colorRegister : String
|
||||||
|
private lateinit var insertionMethod : MutableMethod
|
||||||
|
|
||||||
|
internal fun lithoColorOverrideHook(targetMethodClass: String, targetMethodName: String) {
|
||||||
|
insertionMethod.addInstructions(
|
||||||
|
insertionIndex,
|
||||||
|
"""
|
||||||
|
invoke-static {$colorRegister}, $targetMethodClass->$targetMethodName(I)I
|
||||||
|
move-result $colorRegister
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
insertionIndex += 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,77 +1,51 @@
|
|||||||
package app.revanced.patches.youtube.layout.theme.bytecode.patch
|
package app.revanced.patches.youtube.layout.theme.bytecode.patch
|
||||||
|
|
||||||
import app.revanced.extensions.toErrorResult
|
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.data.toMethodWalker
|
import app.revanced.patcher.patch.*
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
|
||||||
import app.revanced.patcher.extensions.instruction
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
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.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patches.youtube.layout.seekbar.bytecode.patch.SeekbarColorBytecodePatch
|
||||||
import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
|
import app.revanced.patches.youtube.layout.seekbar.bytecode.fingerprints.CreateDarkThemeSeekbarFingerprint
|
||||||
import app.revanced.patches.youtube.layout.theme.bytecode.fingerprints.CreateDarkThemeSeekbarFingerprint
|
import app.revanced.patches.youtube.layout.seekbar.bytecode.fingerprints.SetSeekbarClickedColorFingerprint
|
||||||
import app.revanced.patches.youtube.layout.theme.bytecode.fingerprints.CreateDarkThemeSeekbarFingerprint.indexOfInstructionWithSeekbarId
|
|
||||||
import app.revanced.patches.youtube.layout.theme.bytecode.fingerprints.SetSeekbarClickedColorFingerprint
|
|
||||||
import app.revanced.patches.youtube.layout.theme.resource.ThemeResourcePatch
|
import app.revanced.patches.youtube.layout.theme.resource.ThemeResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
|
||||||
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("theme")
|
@Name("theme")
|
||||||
@Description("Applies a custom theme.")
|
@Description("Applies a custom theme.")
|
||||||
@DependsOn([ThemeLithoComponentsPatch::class, ThemeResourcePatch::class, IntegrationsPatch::class])
|
@DependsOn([LithoColorHookPatch::class, SeekbarColorBytecodePatch::class, ThemeResourcePatch::class])
|
||||||
@ThemeCompatibility
|
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class ThemeBytecodePatch : BytecodePatch(
|
class ThemeBytecodePatch : BytecodePatch(
|
||||||
listOf(CreateDarkThemeSeekbarFingerprint, SetSeekbarClickedColorFingerprint)
|
listOf(CreateDarkThemeSeekbarFingerprint, SetSeekbarClickedColorFingerprint)
|
||||||
) {
|
) {
|
||||||
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
CreateDarkThemeSeekbarFingerprint.result?.let {
|
LithoColorHookPatch.lithoColorOverrideHook(INTEGRATIONS_CLASS_DESCRIPTOR, "getValue")
|
||||||
val putColorValueIndex = it.method.indexOfInstructionWithSeekbarId!! + 3
|
|
||||||
|
|
||||||
it.mutableMethod.apply {
|
|
||||||
val overrideRegister = (instruction(putColorValueIndex) as TwoRegisterInstruction).registerA
|
|
||||||
|
|
||||||
addInstructions(
|
|
||||||
putColorValueIndex,
|
|
||||||
"""
|
|
||||||
invoke-static { }, $INTEGRATIONS_CLASS_DESCRIPTOR->getSeekbarColorValue()I
|
|
||||||
move-result v$overrideRegister
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} ?: return CreateDarkThemeSeekbarFingerprint.toErrorResult()
|
|
||||||
|
|
||||||
SetSeekbarClickedColorFingerprint.result?.let { result ->
|
|
||||||
result.mutableMethod.let {
|
|
||||||
val setColorMethodIndex = result.scanResult.patternScanResult!!.startIndex + 1
|
|
||||||
val method = context
|
|
||||||
.toMethodWalker(it)
|
|
||||||
.nextMethod(setColorMethodIndex, true)
|
|
||||||
.getMethod() as MutableMethod
|
|
||||||
|
|
||||||
method.apply {
|
|
||||||
val colorRegister = (method.instruction(0) as TwoRegisterInstruction).registerA
|
|
||||||
addInstructions(
|
|
||||||
0,
|
|
||||||
"""
|
|
||||||
invoke-static { v$colorRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->getSeekbarClickedColorValue(I)I
|
|
||||||
move-result v$colorRegister
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} ?: return SetSeekbarClickedColorFingerprint.toErrorResult()
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
private companion object {
|
companion object : OptionsContainer() {
|
||||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/theme/ThemePatch;"
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/theme/ThemeLithoComponentsPatch;"
|
||||||
|
|
||||||
|
var darkThemeBackgroundColor: String? by option(
|
||||||
|
PatchOption.StringOption(
|
||||||
|
key = "darkThemeBackgroundColor",
|
||||||
|
default = "@android:color/black",
|
||||||
|
title = "Background color for the dark theme",
|
||||||
|
description = "The background color of the dark theme. Can be a hex color or a resource reference.",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
var lightThemeBackgroundColor: String? by option(
|
||||||
|
PatchOption.StringOption(
|
||||||
|
key = "lightThemeBackgroundColor",
|
||||||
|
default = "@android:color/white",
|
||||||
|
title = "Background color for the light theme",
|
||||||
|
description = "The background color of the light theme. Can be a hex color or a resource reference.",
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.layout.theme.bytecode.patch
|
|
||||||
|
|
||||||
import app.revanced.extensions.toErrorResult
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
|
|
||||||
import app.revanced.patches.youtube.layout.theme.fingerprints.LithoThemeFingerprint
|
|
||||||
|
|
||||||
@Name("theme-litho-components")
|
|
||||||
@Description("Applies a custom theme to Litho components.")
|
|
||||||
@ThemeCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class ThemeLithoComponentsPatch : BytecodePatch(listOf(LithoThemeFingerprint)) {
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
|
||||||
LithoThemeFingerprint.result?.let {
|
|
||||||
it.mutableMethod.apply {
|
|
||||||
val patchIndex = it.scanResult.patternScanResult!!.endIndex - 1
|
|
||||||
|
|
||||||
addInstructions(
|
|
||||||
patchIndex,
|
|
||||||
"""
|
|
||||||
invoke-static {p1}, $INTEGRATIONS_CLASS_DESCRIPTOR->getValue(I)I
|
|
||||||
move-result p1
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} ?: return LithoThemeFingerprint.toErrorResult()
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
|
|
||||||
private companion object {
|
|
||||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/theme/ThemeLithoComponentsPatch;"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -7,6 +7,8 @@ import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
|||||||
import app.revanced.patches.shared.settings.preference.impl.InputType
|
import app.revanced.patches.shared.settings.preference.impl.InputType
|
||||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||||
import app.revanced.patches.shared.settings.preference.impl.TextPreference
|
import app.revanced.patches.shared.settings.preference.impl.TextPreference
|
||||||
|
import app.revanced.patches.youtube.layout.theme.bytecode.patch.ThemeBytecodePatch.Companion.darkThemeBackgroundColor
|
||||||
|
import app.revanced.patches.youtube.layout.theme.bytecode.patch.ThemeBytecodePatch.Companion.lightThemeBackgroundColor
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
import app.revanced.util.resources.ResourceUtils
|
import app.revanced.util.resources.ResourceUtils
|
||||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||||
@@ -23,19 +25,11 @@ class ThemeResourcePatch : ResourcePatch {
|
|||||||
"#FF0000",
|
"#FF0000",
|
||||||
StringResource(
|
StringResource(
|
||||||
"revanced_seekbar_color_summary",
|
"revanced_seekbar_color_summary",
|
||||||
"The color of the seekbar for the dark theme."
|
"The color of the seekbar"
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
// Edit theme colors via bytecode.
|
|
||||||
// For that the resource id is used in a bytecode patch to change the color.
|
|
||||||
|
|
||||||
inlineTimeBarColorizedBarPlayedColorDarkId = ResourceMappingPatch.resourceMappings
|
|
||||||
.find { it.name == "inline_time_bar_colorized_bar_played_color_dark" }?.id
|
|
||||||
?: return PatchResultError("Could not find seekbar resource")
|
|
||||||
|
|
||||||
|
|
||||||
val darkThemeBackgroundColor = darkThemeBackgroundColor!!
|
val darkThemeBackgroundColor = darkThemeBackgroundColor!!
|
||||||
val lightThemeBackgroundColor = lightThemeBackgroundColor!!
|
val lightThemeBackgroundColor = lightThemeBackgroundColor!!
|
||||||
|
|
||||||
@@ -67,25 +61,4 @@ class ThemeResourcePatch : ResourcePatch {
|
|||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object : OptionsContainer() {
|
|
||||||
internal var inlineTimeBarColorizedBarPlayedColorDarkId = -1L
|
|
||||||
|
|
||||||
var darkThemeBackgroundColor: String? by option(
|
|
||||||
PatchOption.StringOption(
|
|
||||||
key = "darkThemeBackgroundColor",
|
|
||||||
default = "@android:color/black",
|
|
||||||
title = "Background color for the dark theme",
|
|
||||||
description = "The background color of the dark theme. Can be a hex color or a resource reference.",
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
var lightThemeBackgroundColor: String? by option(
|
|
||||||
PatchOption.StringOption(
|
|
||||||
key = "lightThemeBackgroundColor",
|
|
||||||
default = "@android:color/white",
|
|
||||||
title = "Background color for the light theme",
|
|
||||||
description = "The background color of the light theme. Can be a hex color or a resource reference.",
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import app.revanced.patches.youtube.misc.fix.playback.fingerprints.SubtitleWindo
|
|||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
import app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch
|
import app.revanced.patches.youtube.video.videoid.patch.VideoIdPatch
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
@Name("spoof-signature-verification")
|
@Name("spoof-signature-verification")
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package app.revanced.patches.youtube.misc.integrations.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
object EmbeddedPlayerControlsOverlayFingerprint : IntegrationsFingerprint(
|
||||||
|
access = AccessFlags.PRIVATE or AccessFlags.CONSTRUCTOR,
|
||||||
|
returnType = "V",
|
||||||
|
parameters = listOf("L", "L", "L"),
|
||||||
|
customFingerprint = { methodDef ->
|
||||||
|
methodDef.definingClass.startsWith("Lcom/google/android/apps/youtube/embeddedplayer/service/ui/overlays/controlsoverlay/remoteloaded/")
|
||||||
|
},
|
||||||
|
contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size }
|
||||||
|
)
|
||||||
@@ -5,6 +5,7 @@ import app.revanced.patcher.patch.annotations.RequiresIntegrations
|
|||||||
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch
|
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.integrations.annotations.IntegrationsCompatibility
|
import app.revanced.patches.youtube.misc.integrations.annotations.IntegrationsCompatibility
|
||||||
import app.revanced.patches.youtube.misc.integrations.fingerprints.InitFingerprint
|
import app.revanced.patches.youtube.misc.integrations.fingerprints.InitFingerprint
|
||||||
|
import app.revanced.patches.youtube.misc.integrations.fingerprints.EmbeddedPlayerControlsOverlayFingerprint
|
||||||
import app.revanced.patches.youtube.misc.integrations.fingerprints.ServiceFingerprint
|
import app.revanced.patches.youtube.misc.integrations.fingerprints.ServiceFingerprint
|
||||||
import app.revanced.patches.youtube.misc.integrations.fingerprints.StandalonePlayerFingerprint
|
import app.revanced.patches.youtube.misc.integrations.fingerprints.StandalonePlayerFingerprint
|
||||||
|
|
||||||
@@ -13,5 +14,5 @@ import app.revanced.patches.youtube.misc.integrations.fingerprints.StandalonePla
|
|||||||
@RequiresIntegrations
|
@RequiresIntegrations
|
||||||
class IntegrationsPatch : AbstractIntegrationsPatch(
|
class IntegrationsPatch : AbstractIntegrationsPatch(
|
||||||
"Lapp/revanced/integrations/utils/ReVancedUtils;",
|
"Lapp/revanced/integrations/utils/ReVancedUtils;",
|
||||||
listOf(InitFingerprint, StandalonePlayerFingerprint, ServiceFingerprint),
|
listOf(InitFingerprint, StandalonePlayerFingerprint, ServiceFingerprint, EmbeddedPlayerControlsOverlayFingerprint),
|
||||||
)
|
)
|
||||||
@@ -137,6 +137,7 @@ class SettingsPatch : BytecodePatch(
|
|||||||
val ADS = Screen("ads", "Ads", "Ad related settings")
|
val ADS = Screen("ads", "Ads", "Ad related settings")
|
||||||
val INTERACTIONS = Screen("interactions", "Interaction", "Settings related to interactions")
|
val INTERACTIONS = Screen("interactions", "Interaction", "Settings related to interactions")
|
||||||
val LAYOUT = Screen("layout", "Layout", "Settings related to the layout")
|
val LAYOUT = Screen("layout", "Layout", "Settings related to the layout")
|
||||||
|
val VIDEO = Screen("video", "Video", "Settings related to the video player")
|
||||||
val MISC = Screen("misc", "Misc", "Miscellaneous patches")
|
val MISC = Screen("misc", "Misc", "Miscellaneous patches")
|
||||||
|
|
||||||
override fun commit(screen: app.revanced.patches.shared.settings.preference.impl.PreferenceScreen) {
|
override fun commit(screen: app.revanced.patches.shared.settings.preference.impl.PreferenceScreen) {
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.misc.video.speed.custom.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
|
|
||||||
object VideoSpeedPatchFingerprint : MethodFingerprint(
|
|
||||||
opcodes = listOf(Opcode.FILL_ARRAY_DATA),
|
|
||||||
customFingerprint = { methodDef ->
|
|
||||||
methodDef.definingClass.endsWith("CustomVideoSpeedPatch;") && methodDef.name == "<clinit>"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@@ -1,195 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.misc.video.speed.custom.patch
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
|
||||||
import app.revanced.patcher.patch.*
|
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
|
||||||
import app.revanced.patches.youtube.misc.video.speed.custom.annotations.CustomPlaybackSpeedCompatibility
|
|
||||||
import app.revanced.patches.youtube.misc.video.speed.custom.fingerprints.SpeedArrayGeneratorFingerprint
|
|
||||||
import app.revanced.patches.youtube.misc.video.speed.custom.fingerprints.SpeedLimiterFingerprint
|
|
||||||
import app.revanced.patches.youtube.misc.video.speed.custom.fingerprints.VideoSpeedPatchFingerprint
|
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderArrayPayload
|
|
||||||
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
|
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
|
||||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
|
||||||
import org.jf.dexlib2.iface.reference.FieldReference
|
|
||||||
import org.jf.dexlib2.iface.reference.MethodReference
|
|
||||||
import java.util.stream.DoubleStream
|
|
||||||
import kotlin.math.roundToInt
|
|
||||||
|
|
||||||
@Patch
|
|
||||||
@Name("custom-video-speed")
|
|
||||||
@Description("Adds more video speed options.")
|
|
||||||
@DependsOn([IntegrationsPatch::class])
|
|
||||||
@CustomPlaybackSpeedCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class CustomVideoSpeedPatch : BytecodePatch(
|
|
||||||
listOf(
|
|
||||||
SpeedArrayGeneratorFingerprint, SpeedLimiterFingerprint, VideoSpeedPatchFingerprint
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
|
||||||
val speedLimitMin = minVideoSpeed!!.toFloat()
|
|
||||||
val speedLimitMax = maxVideoSpeed!!.toFloat().coerceAtLeast(speedLimitMin)
|
|
||||||
val speedsGranularity = videoSpeedsGranularity!!.toFloat()
|
|
||||||
|
|
||||||
val arrayGenMethod = SpeedArrayGeneratorFingerprint.result?.mutableMethod!!
|
|
||||||
val arrayGenMethodImpl = arrayGenMethod.implementation!!
|
|
||||||
|
|
||||||
val sizeCallIndex = arrayGenMethodImpl.instructions
|
|
||||||
.indexOfFirst { ((it as? ReferenceInstruction)?.reference as? MethodReference)?.name == "size" }
|
|
||||||
|
|
||||||
if (sizeCallIndex == -1) return PatchResultError("Couldn't find call to size()")
|
|
||||||
|
|
||||||
val sizeCallResultRegister =
|
|
||||||
(arrayGenMethodImpl.instructions.elementAt(sizeCallIndex + 1) as OneRegisterInstruction).registerA
|
|
||||||
|
|
||||||
arrayGenMethod.replaceInstruction(
|
|
||||||
sizeCallIndex + 1,
|
|
||||||
"const/4 v$sizeCallResultRegister, 0x0"
|
|
||||||
)
|
|
||||||
|
|
||||||
val (arrayLengthConstIndex, arrayLengthConst) = arrayGenMethodImpl.instructions.withIndex()
|
|
||||||
.first { (it.value as? NarrowLiteralInstruction)?.narrowLiteral == 7 }
|
|
||||||
|
|
||||||
val arrayLengthConstDestination = (arrayLengthConst as OneRegisterInstruction).registerA
|
|
||||||
|
|
||||||
val videoSpeedsArrayType = "Lapp/revanced/integrations/patches/playback/speed/CustomVideoSpeedPatch;->videoSpeeds:[F"
|
|
||||||
|
|
||||||
arrayGenMethod.addInstructions(
|
|
||||||
arrayLengthConstIndex + 1,
|
|
||||||
"""
|
|
||||||
sget-object v$arrayLengthConstDestination, $videoSpeedsArrayType
|
|
||||||
array-length v$arrayLengthConstDestination, v$arrayLengthConstDestination
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
val (originalArrayFetchIndex, originalArrayFetch) = arrayGenMethodImpl.instructions.withIndex()
|
|
||||||
.first {
|
|
||||||
val reference = ((it.value as? ReferenceInstruction)?.reference as? FieldReference)
|
|
||||||
reference?.definingClass?.contains("PlayerConfigModel") ?: false &&
|
|
||||||
reference?.type == "[F"
|
|
||||||
}
|
|
||||||
|
|
||||||
val originalArrayFetchDestination = (originalArrayFetch as OneRegisterInstruction).registerA
|
|
||||||
|
|
||||||
arrayGenMethod.replaceInstruction(
|
|
||||||
originalArrayFetchIndex,
|
|
||||||
"sget-object v$originalArrayFetchDestination, $videoSpeedsArrayType"
|
|
||||||
)
|
|
||||||
|
|
||||||
val limiterMethod = SpeedLimiterFingerprint.result?.mutableMethod!!
|
|
||||||
val limiterMethodImpl = limiterMethod.implementation!!
|
|
||||||
|
|
||||||
val (limiterMinConstIndex, limiterMinConst) = limiterMethodImpl.instructions.withIndex()
|
|
||||||
.first { (it.value as? NarrowLiteralInstruction)?.narrowLiteral == 0.25f.toRawBits() }
|
|
||||||
val (limiterMaxConstIndex, limiterMaxConst) = limiterMethodImpl.instructions.withIndex()
|
|
||||||
.first { (it.value as? NarrowLiteralInstruction)?.narrowLiteral == 2.0f.toRawBits() }
|
|
||||||
|
|
||||||
val limiterMinConstDestination = (limiterMinConst as OneRegisterInstruction).registerA
|
|
||||||
val limiterMaxConstDestination = (limiterMaxConst as OneRegisterInstruction).registerA
|
|
||||||
|
|
||||||
fun hexFloat(float: Float): String = "0x%08x".format(float.toRawBits())
|
|
||||||
|
|
||||||
limiterMethod.replaceInstruction(
|
|
||||||
limiterMinConstIndex,
|
|
||||||
"const/high16 v$limiterMinConstDestination, ${hexFloat(speedLimitMin)}"
|
|
||||||
)
|
|
||||||
limiterMethod.replaceInstruction(
|
|
||||||
limiterMaxConstIndex,
|
|
||||||
"const/high16 v$limiterMaxConstDestination, ${hexFloat(speedLimitMax)}"
|
|
||||||
)
|
|
||||||
|
|
||||||
val constructorResult = VideoSpeedPatchFingerprint.result!!
|
|
||||||
val constructor = constructorResult.mutableMethod
|
|
||||||
val implementation = constructor.implementation!!
|
|
||||||
|
|
||||||
val stepsGranularity = 8F
|
|
||||||
val step = speedLimitMax
|
|
||||||
.minus(speedLimitMin) // calculate the range of the speeds
|
|
||||||
.div(speedsGranularity)
|
|
||||||
.times(stepsGranularity)
|
|
||||||
.roundToInt()
|
|
||||||
.div(stepsGranularity)// round to nearest multiple of stepsGranularity
|
|
||||||
.coerceAtLeast(1 / stepsGranularity) // ensure steps are at least 1/8th of the step granularity
|
|
||||||
|
|
||||||
val videoSpeedsArray = buildList<Number> {
|
|
||||||
DoubleStream
|
|
||||||
.iterate(speedLimitMin.toDouble()) { it + step } // create a stream of speeds
|
|
||||||
.let { speedStream ->
|
|
||||||
for (speed in speedStream) {
|
|
||||||
if (speed > speedLimitMax) break
|
|
||||||
add(speed.toFloat().toRawBits())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// adjust the new array of speeds size
|
|
||||||
constructor.replaceInstruction(
|
|
||||||
0,
|
|
||||||
"const/16 v0, ${videoSpeedsArray.size}"
|
|
||||||
)
|
|
||||||
|
|
||||||
// create the payload with the new speeds
|
|
||||||
val arrayPayloadIndex = implementation.instructions.size - 1
|
|
||||||
implementation.replaceInstruction(
|
|
||||||
arrayPayloadIndex,
|
|
||||||
BuilderArrayPayload(
|
|
||||||
4,
|
|
||||||
videoSpeedsArray
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object : OptionsContainer() {
|
|
||||||
private fun String?.validate(max: Int? = null) = this?.toFloatOrNull() != null &&
|
|
||||||
toFloat().let { float ->
|
|
||||||
float > 0 && max?.let { max -> float <= max } ?: true
|
|
||||||
}
|
|
||||||
|
|
||||||
val videoSpeedsGranularity by option(
|
|
||||||
PatchOption.StringOption(
|
|
||||||
"granularity",
|
|
||||||
"16",
|
|
||||||
"Video speed granularity",
|
|
||||||
"The granularity of the video speeds. The higher the value, the more speeds will be available.",
|
|
||||||
true
|
|
||||||
) {
|
|
||||||
it.validate()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
val minVideoSpeed by option(
|
|
||||||
PatchOption.StringOption(
|
|
||||||
"min",
|
|
||||||
"0.25",
|
|
||||||
"Minimum video speed",
|
|
||||||
"The minimum video speed.",
|
|
||||||
true
|
|
||||||
) {
|
|
||||||
it.validate()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
val maxVideoSpeed by option(
|
|
||||||
PatchOption.StringOption(
|
|
||||||
"max",
|
|
||||||
"5.0",
|
|
||||||
"Maximum video speed",
|
|
||||||
"The maximum video speed. Must be greater than the minimum video speed and smaller than 5.",
|
|
||||||
true
|
|
||||||
) {
|
|
||||||
it.validate(5)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -12,9 +12,9 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
|||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patcher.util.smali.ExternalLabel
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
|
||||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||||
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
import app.revanced.patches.youtube.misc.zoomhaptics.annotations.ZoomHapticsCompatibility
|
import app.revanced.patches.youtube.misc.zoomhaptics.annotations.ZoomHapticsCompatibility
|
||||||
import app.revanced.patches.youtube.misc.zoomhaptics.fingerprints.ZoomHapticsFingerprint
|
import app.revanced.patches.youtube.misc.zoomhaptics.fingerprints.ZoomHapticsFingerprint
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.misc.hdrbrightness.annotations
|
package app.revanced.patches.youtube.video.hdrbrightness.annotations
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.misc.hdrbrightness.fingerprints
|
package app.revanced.patches.youtube.video.hdrbrightness.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.misc.hdrbrightness.patch
|
package app.revanced.patches.youtube.video.hdrbrightness.patch
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
@@ -10,8 +10,8 @@ import app.revanced.patcher.patch.PatchResult
|
|||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patches.youtube.misc.hdrbrightness.annotations.HDRBrightnessCompatibility
|
import app.revanced.patches.youtube.video.hdrbrightness.annotations.HDRBrightnessCompatibility
|
||||||
import app.revanced.patches.youtube.misc.hdrbrightness.fingerprints.HDRBrightnessFingerprint
|
import app.revanced.patches.youtube.video.hdrbrightness.fingerprints.HDRBrightnessFingerprint
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
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.bytecode.patch.SettingsPatch
|
||||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||||
@@ -30,7 +30,7 @@ class HDRBrightnessPatch : BytecodePatch(
|
|||||||
listOf(HDRBrightnessFingerprint)
|
listOf(HDRBrightnessFingerprint)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
SettingsPatch.PreferenceScreen.MISC.addPreferences(
|
SettingsPatch.PreferenceScreen.VIDEO.addPreferences(
|
||||||
SwitchPreference(
|
SwitchPreference(
|
||||||
"revanced_pref_hdr_autobrightness",
|
"revanced_pref_hdr_autobrightness",
|
||||||
StringResource("revanced_hdr_autobrightness_enabled_title", "Enable auto HDR brightness"),
|
StringResource("revanced_hdr_autobrightness_enabled_title", "Enable auto HDR brightness"),
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.misc.video.information.annotation
|
package app.revanced.patches.youtube.video.information.annotation
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.misc.video.information.fingerprints
|
package app.revanced.patches.youtube.video.information.fingerprints
|
||||||
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.misc.video.information.fingerprints
|
package app.revanced.patches.youtube.video.information.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.misc.video.information.fingerprints
|
package app.revanced.patches.youtube.video.information.fingerprints
|
||||||
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.misc.video.information.fingerprints
|
package app.revanced.patches.youtube.video.information.fingerprints
|
||||||
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.misc.video.information.fingerprints
|
package app.revanced.patches.youtube.video.information.fingerprints
|
||||||
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.misc.video.information.fingerprints
|
package app.revanced.patches.youtube.video.information.fingerprints
|
||||||
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.misc.video.information.fingerprints
|
package app.revanced.patches.youtube.video.information.fingerprints
|
||||||
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.misc.video.information.patch
|
package app.revanced.patches.youtube.video.information.patch
|
||||||
|
|
||||||
import app.revanced.extensions.toErrorResult
|
import app.revanced.extensions.toErrorResult
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
@@ -19,10 +19,10 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
|||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.video.information.annotation.VideoInformationCompatibility
|
import app.revanced.patches.youtube.video.information.annotation.VideoInformationCompatibility
|
||||||
import app.revanced.patches.youtube.misc.video.information.fingerprints.*
|
import app.revanced.patches.youtube.video.information.fingerprints.*
|
||||||
import app.revanced.patches.youtube.misc.video.speed.remember.patch.RememberPlaybackSpeedPatch
|
import app.revanced.patches.youtube.video.speed.remember.patch.RememberPlaybackSpeedPatch
|
||||||
import app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch
|
import app.revanced.patches.youtube.video.videoid.patch.VideoIdPatch
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.builder.BuilderInstruction
|
import org.jf.dexlib2.builder.BuilderInstruction
|
||||||
@@ -54,7 +54,7 @@ class VideoInformationPatch : BytecodePatch(
|
|||||||
playerInitMethod = mutableClass.methods.first { MethodUtil.isConstructor(it) }
|
playerInitMethod = mutableClass.methods.first { MethodUtil.isConstructor(it) }
|
||||||
|
|
||||||
// hook the player controller for use through integrations
|
// hook the player controller for use through integrations
|
||||||
onCreateHook(INTEGRATIONS_CLASS_DESCRIPTOR, "playerController_onCreateHook")
|
onCreateHook(INTEGRATIONS_CLASS_DESCRIPTOR, "initialize")
|
||||||
|
|
||||||
// seek method
|
// seek method
|
||||||
val seekFingerprintResultMethod = SeekFingerprint.also { it.resolve(context, classDef) }.result!!.method
|
val seekFingerprintResultMethod = SeekFingerprint.also { it.resolve(context, classDef) }.result!!.method
|
||||||
@@ -93,7 +93,7 @@ class VideoInformationPatch : BytecodePatch(
|
|||||||
|
|
||||||
with(videoLengthMethodResult.mutableMethod) {
|
with(videoLengthMethodResult.mutableMethod) {
|
||||||
val videoLengthRegisterIndex = videoLengthMethodResult.scanResult.patternScanResult!!.endIndex - 2
|
val videoLengthRegisterIndex = videoLengthMethodResult.scanResult.patternScanResult!!.endIndex - 2
|
||||||
val videoLengthRegister = (instruction(videoLengthRegisterIndex) as OneRegisterInstruction).registerA
|
val videoLengthRegister = instruction<OneRegisterInstruction>(videoLengthRegisterIndex).registerA
|
||||||
val dummyRegisterForLong = videoLengthRegister + 1 // required for long values since they are wide
|
val dummyRegisterForLong = videoLengthRegister + 1 // required for long values since they are wide
|
||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
@@ -140,7 +140,7 @@ class VideoInformationPatch : BytecodePatch(
|
|||||||
speedSelectionInsertMethod = mutableMethod
|
speedSelectionInsertMethod = mutableMethod
|
||||||
speedSelectionInsertIndex = scanResult.patternScanResult!!.startIndex - 3
|
speedSelectionInsertIndex = scanResult.patternScanResult!!.startIndex - 3
|
||||||
speedSelectionValueRegister =
|
speedSelectionValueRegister =
|
||||||
(mutableMethod.instruction(speedSelectionInsertIndex) as FiveRegisterInstruction).registerD
|
mutableMethod.instruction<FiveRegisterInstruction>(speedSelectionInsertIndex).registerD
|
||||||
|
|
||||||
val speedSelectionMethodInstructions = mutableMethod.implementation!!.instructions
|
val speedSelectionMethodInstructions = mutableMethod.implementation!!.instructions
|
||||||
setPlaybackSpeedContainerClassFieldReference =
|
setPlaybackSpeedContainerClassFieldReference =
|
||||||
@@ -160,24 +160,32 @@ class VideoInformationPatch : BytecodePatch(
|
|||||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/VideoInformation;"
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/VideoInformation;"
|
||||||
|
|
||||||
private lateinit var playerInitMethod: MutableMethod
|
private lateinit var playerInitMethod: MutableMethod
|
||||||
|
private var playerInitInsertIndex = 4
|
||||||
|
|
||||||
private lateinit var timeMethod: MutableMethod
|
private lateinit var timeMethod: MutableMethod
|
||||||
|
private var timeInitInsertIndex = 2
|
||||||
|
|
||||||
private lateinit var highPrecisionTimeMethod: MutableMethod
|
private lateinit var highPrecisionTimeMethod: MutableMethod
|
||||||
|
private var highPrecisionInsertIndex = 0
|
||||||
|
|
||||||
private fun MutableMethod.insert(insert: InsertIndex, register: String, descriptor: String) =
|
private fun MutableMethod.insert(insertIndex: Int, register: String, descriptor: String) =
|
||||||
addInstruction(insert.index, "invoke-static { $register }, $descriptor")
|
addInstruction(insertIndex, "invoke-static { $register }, $descriptor")
|
||||||
|
|
||||||
private fun MutableMethod.insertTimeHook(insert: InsertIndex, descriptor: String) =
|
private fun MutableMethod.insertTimeHook(insertIndex: Int, descriptor: String) =
|
||||||
insert(insert, "p1, p2", descriptor)
|
insert(insertIndex, "p1, p2", descriptor)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook the player controller.
|
* Hook the player controller. Called when a video is opened or the current video is changed.
|
||||||
|
*
|
||||||
|
* Note: This hook is called very early and is called before the video id, video time, video length,
|
||||||
|
* and many other data fields are set.
|
||||||
*
|
*
|
||||||
* @param targetMethodClass The descriptor for the class to invoke when the player controller is created.
|
* @param targetMethodClass The descriptor for the class to invoke when the player controller is created.
|
||||||
* @param targetMethodName The name of the static method to invoke when the player controller is created.
|
* @param targetMethodName The name of the static method to invoke when the player controller is created.
|
||||||
*/
|
*/
|
||||||
internal fun onCreateHook(targetMethodClass: String, targetMethodName: String) =
|
internal fun onCreateHook(targetMethodClass: String, targetMethodName: String) =
|
||||||
playerInitMethod.insert(
|
playerInitMethod.insert(
|
||||||
InsertIndex.CREATE,
|
playerInitInsertIndex++,
|
||||||
"v0",
|
"v0",
|
||||||
"$targetMethodClass->$targetMethodName(Ljava/lang/Object;)V"
|
"$targetMethodClass->$targetMethodName(Ljava/lang/Object;)V"
|
||||||
)
|
)
|
||||||
@@ -191,7 +199,7 @@ class VideoInformationPatch : BytecodePatch(
|
|||||||
*/
|
*/
|
||||||
internal fun videoTimeHook(targetMethodClass: String, targetMethodName: String) =
|
internal fun videoTimeHook(targetMethodClass: String, targetMethodName: String) =
|
||||||
timeMethod.insertTimeHook(
|
timeMethod.insertTimeHook(
|
||||||
InsertIndex.TIME,
|
timeInitInsertIndex++,
|
||||||
"$targetMethodClass->$targetMethodName(J)V"
|
"$targetMethodClass->$targetMethodName(J)V"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -205,16 +213,10 @@ class VideoInformationPatch : BytecodePatch(
|
|||||||
*/
|
*/
|
||||||
internal fun highPrecisionTimeHook(targetMethodClass: String, targetMethodName: String) =
|
internal fun highPrecisionTimeHook(targetMethodClass: String, targetMethodName: String) =
|
||||||
highPrecisionTimeMethod.insertTimeHook(
|
highPrecisionTimeMethod.insertTimeHook(
|
||||||
InsertIndex.HIGH_PRECISION_TIME,
|
highPrecisionInsertIndex++,
|
||||||
"$targetMethodClass->$targetMethodName(J)V"
|
"$targetMethodClass->$targetMethodName(J)V"
|
||||||
)
|
)
|
||||||
|
|
||||||
enum class InsertIndex(internal val index: Int) {
|
|
||||||
CREATE(4),
|
|
||||||
TIME(2),
|
|
||||||
HIGH_PRECISION_TIME(0),
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getReference(instructions: List<BuilderInstruction>, offset: Int, opcode: Opcode) =
|
private fun getReference(instructions: List<BuilderInstruction>, offset: Int, opcode: Opcode) =
|
||||||
instructions[instructions.indexOfFirst { it.opcode == opcode } + offset].reference
|
instructions[instructions.indexOfFirst { it.opcode == opcode } + offset].reference
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.layout.oldqualitylayout.annotations
|
package app.revanced.patches.youtube.video.oldqualitylayout.annotations
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user