Compare commits

...

11 Commits

Author SHA1 Message Date
semantic-release-bot
9ff595d5df chore(release): 2.157.0-dev.5 [skip ci]
# [2.157.0-dev.5](https://github.com/revanced/revanced-patches/compare/v2.157.0-dev.4...v2.157.0-dev.5) (2023-01-28)

### Features

* **youtube:** show toasts along exceptions ([#1511](https://github.com/revanced/revanced-patches/issues/1511)) ([46effd3](46effd337f))
2023-01-28 07:40:38 +00:00
LisoUseInAIKyrios
46effd337f feat(youtube): show toasts along exceptions (#1511)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-01-28 08:38:39 +01:00
semantic-release-bot
06a981a317 chore(release): 2.157.0-dev.4 [skip ci]
# [2.157.0-dev.4](https://github.com/revanced/revanced-patches/compare/v2.157.0-dev.3...v2.157.0-dev.4) (2023-01-28)

### Bug Fixes

* **youtube/return-youtube-dislike:** do not fetch voting stats when watching shorts ([#1532](https://github.com/revanced/revanced-patches/issues/1532)) ([dd3a9a4](dd3a9a4f38))
2023-01-28 07:30:33 +00:00
LisoUseInAIKyrios
dd3a9a4f38 fix(youtube/return-youtube-dislike): do not fetch voting stats when watching shorts (#1532)
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-01-28 08:28:48 +01:00
oSumAtrIX
5228700317 refactor(youtube/sponsorblock): remove dead code
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-01-28 08:11:52 +01:00
semantic-release-bot
e68a65c950 chore(release): 2.157.0-dev.3 [skip ci]
# [2.157.0-dev.3](https://github.com/revanced/revanced-patches/compare/v2.157.0-dev.2...v2.157.0-dev.3) (2023-01-28)

### Bug Fixes

* **youtube/settings:** resolve fingerprints robustly ([3bf8d1d](3bf8d1d3cb))
* **youtube:** reliably resolve fingerprints ([57e13cf](57e13cf8a8))

### Features

* **youtube/general-ads:** remove hiding video shelf ([e4fa523](e4fa523b15))
2023-01-28 07:06:55 +00:00
oSumAtrIX
817ad0b9f2 chore(youtube): bump patches compatibility to v18.03.36
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-01-28 08:00:30 +01:00
oSumAtrIX
57e13cf8a8 fix(youtube): reliably resolve fingerprints
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-01-28 07:58:58 +01:00
oSumAtrIX
e4fa523b15 feat(youtube/general-ads): remove hiding video shelf
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-01-28 06:00:36 +01:00
oSumAtrIX
440278be33 refactor(youtube/custom-video-buffer): apply Kotlin idioms
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-01-28 05:30:44 +01:00
oSumAtrIX
3bf8d1d3cb fix(youtube/settings): resolve fingerprints robustly
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-01-28 03:55:20 +01:00
75 changed files with 320 additions and 383 deletions

View File

@@ -1,3 +1,30 @@
# [2.157.0-dev.5](https://github.com/revanced/revanced-patches/compare/v2.157.0-dev.4...v2.157.0-dev.5) (2023-01-28)
### Features
* **youtube:** show toasts along exceptions ([#1511](https://github.com/revanced/revanced-patches/issues/1511)) ([5817e4d](https://github.com/revanced/revanced-patches/commit/5817e4d27fab692c0e95ab4aa2fa8f13005cb780))
# [2.157.0-dev.4](https://github.com/revanced/revanced-patches/compare/v2.157.0-dev.3...v2.157.0-dev.4) (2023-01-28)
### Bug Fixes
* **youtube/return-youtube-dislike:** do not fetch voting stats when watching shorts ([#1532](https://github.com/revanced/revanced-patches/issues/1532)) ([f46fcad](https://github.com/revanced/revanced-patches/commit/f46fcadd855a13d9f8916f21980abcf5564e97d7))
# [2.157.0-dev.3](https://github.com/revanced/revanced-patches/compare/v2.157.0-dev.2...v2.157.0-dev.3) (2023-01-28)
### Bug Fixes
* **youtube/settings:** resolve fingerprints robustly ([8e98605](https://github.com/revanced/revanced-patches/commit/8e98605a7491d69e99c6b1aeb2de3db9396faa20))
* **youtube:** reliably resolve fingerprints ([1598306](https://github.com/revanced/revanced-patches/commit/1598306eb58ae8f8dc38b472628b237e55ec0f1b))
### Features
* **youtube/general-ads:** remove hiding video shelf ([c4c9e5b](https://github.com/revanced/revanced-patches/commit/c4c9e5bb3765d08d6653864d33546c25ba367292))
# [2.157.0-dev.2](https://github.com/revanced/revanced-patches/compare/v2.157.0-dev.1...v2.157.0-dev.2) (2023-01-24) # [2.157.0-dev.2](https://github.com/revanced/revanced-patches/compare/v2.157.0-dev.1...v2.157.0-dev.2) (2023-01-24)

View File

@@ -9,58 +9,57 @@ The official Patch bundle provided by ReVanced and the community.
| 💊 Patch | 📜 Description | 🏹 Target Version | | 💊 Patch | 📜 Description | 🏹 Target Version |
|:--------:|:--------------:|:-----------------:| |:--------:|:--------------:|:-----------------:|
| `always-autorepeat` | Always repeats the playing video again. | 17.49.37 | | `always-autorepeat` | Always repeats the playing video again. | 18.03.36 |
| `client-spoof` | Spoofs the YouTube or Vanced client to prevent playback issues. | all | | `client-spoof` | Spoofs the YouTube or Vanced client to prevent playback issues. | all |
| `comments` | Hides components related to comments. | 17.49.37 | | `comments` | Hides components related to comments. | 18.03.36 |
| `copy-video-url` | Adds buttons in player to copy video links. | 17.49.37 | | `copy-video-url` | Adds buttons in player to copy video links. | 18.03.36 |
| `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. | 17.49.37 | | `custom-video-buffer` | Lets you change the buffers of videos. | 18.03.36 |
| `custom-video-speed` | Adds more video speed options. | 17.49.37 | | `custom-video-speed` | Adds more video speed options. | 18.03.36 |
| `debugging` | Adds debugging options. | all | | `debugging` | Adds debugging options. | all |
| `disable-auto-captions` | Disable forced captions from being automatically enabled. | 17.49.37 | | `disable-auto-captions` | Disable forced captions from being automatically enabled. | 18.03.36 |
| `disable-auto-player-popup-panels` | Disable automatic popup panels (playlist or live chat) on video player. | 17.49.37 | | `disable-auto-player-popup-panels` | Disable automatic popup panels (playlist or live chat) on video player. | 18.03.36 |
| `disable-fullscreen-panels` | Disables video description and comments panel in fullscreen view. | 17.49.37 | | `disable-fullscreen-panels` | Disables video description and comments panel in fullscreen view. | 18.03.36 |
| `disable-startup-shorts-player` | Disables playing YouTube Shorts when launching YouTube. | 17.49.37 | | `disable-startup-shorts-player` | Disables playing YouTube Shorts when launching YouTube. | 18.03.36 |
| `disable-zoom-haptics` | Disables haptics when zooming. | all | | `disable-zoom-haptics` | Disables haptics when zooming. | all |
| `downloads` | Enables downloading music and videos from YouTube. | 17.49.37 | | `downloads` | Enables downloading music and videos from YouTube. | 18.03.36 |
| `enable-wide-searchbar` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | 17.49.37 | | `enable-wide-searchbar` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | 18.03.36 |
| `general-ads` | Removes general ads. | 17.49.37 | | `general-ads` | Removes general ads. | 18.03.36 |
| `hdr-auto-brightness` | Makes the brightness of HDR videos follow the system default. | 17.49.37 | | `hdr-auto-brightness` | Makes the brightness of HDR videos follow the system default. | 18.03.36 |
| `hide-album-cards` | Hides the album cards below the artist description. | 17.49.37 | | `hide-album-cards` | Hides the album cards below the artist description. | 18.03.36 |
| `hide-artist-card` | Hides the artist card below the searchbar. | 17.49.37 | | `hide-artist-card` | Hides the artist card below the searchbar. | 18.03.36 |
| `hide-autoplay-button` | Hides the autoplay button in the video player. | 17.49.37 | | `hide-autoplay-button` | Hides the autoplay button in the video player. | 18.03.36 |
| `hide-breaking-news-shelf` | Hides the breaking news shelf on the homepage tab. | 17.49.37 | | `hide-breaking-news-shelf` | Hides the breaking news shelf on the homepage tab. | 18.03.36 |
| `hide-captions-button` | Hides the captions button on video player. | 17.49.37 | | `hide-captions-button` | Hides the captions button on video player. | 18.03.36 |
| `hide-cast-button` | Hides the cast button in the video player. | all | | `hide-cast-button` | Hides the cast button in the video player. | all |
| `hide-create-button` | Hides the create button in the navigation bar. | 17.49.37 | | `hide-create-button` | Hides the create button in the navigation bar. | 18.03.36 |
| `hide-crowdfunding-box` | Hides the crowdfunding box between the player and video description. | 17.49.37 | | `hide-crowdfunding-box` | Hides the crowdfunding box between the player and video description. | 18.03.36 |
| `hide-email-address` | Hides the email address in the account switcher. | 17.49.37 | | `hide-email-address` | Hides the email address in the account switcher. | 18.03.36 |
| `hide-endscreen-cards` | Hides the suggested video cards at the end of a video in fullscreen. | 17.49.37 | | `hide-endscreen-cards` | Hides the suggested video cards at the end of a video in fullscreen. | 18.03.36 |
| `hide-info-cards` | Hides info-cards in videos. | 17.49.37 | | `hide-info-cards` | Hides info-cards in videos. | 18.03.36 |
| `hide-my-mix` | Hides mix playlists. | 17.49.37 | | `hide-my-mix` | Hides mix playlists. | 18.03.36 |
| `hide-shorts-button` | Hides the shorts button on the navigation bar. | 17.49.37 | | `hide-shorts-button` | Hides the shorts button on the navigation bar. | 18.03.36 |
| `hide-time-and-seekbar` | Hides progress bar and time counter on videos. | 17.49.37 | | `hide-time-and-seekbar` | Hides progress bar and time counter on videos. | 18.03.36 |
| `hide-video-buttons` | Adds options to hide action buttons under a video. | 17.49.37 | | `hide-video-buttons` | Adds options to hide action buttons under a video. | 18.03.36 |
| `hide-watch-in-vr` | Hides the Watch in VR option in the player settings flyout panel. | 17.49.37 | | `hide-watch-in-vr` | Hides the Watch in VR option in the player settings flyout panel. | 18.03.36 |
| `hide-watermark` | Hides creator's watermarks on videos. | 17.49.37 | | `hide-watermark` | Hides creator's watermarks on videos. | 18.03.36 |
| `microg-support` | Allows YouTube ReVanced to run without root and under a different package name with Vanced MicroG. | 17.49.37 | | `microg-support` | Allows YouTube ReVanced to run without root and under a different package name with Vanced MicroG. | 18.03.36 |
| `minimized-playback` | Enables minimized and background playback. | 17.49.37 | | `minimized-playback` | Enables minimized and background playback. | 18.03.36 |
| `old-quality-layout` | Enables the original video quality flyout in the video player settings | 17.49.37 | | `old-quality-layout` | Enables the original video quality flyout in the video player settings | 18.03.36 |
| `open-links-directly` | Bypasses https://youtube.com/redirect URLs. | 17.49.37 | | `open-links-directly` | Bypasses https://youtube.com/redirect URLs. | 18.03.36 |
| `open-links-externally` | Open links outside of the app directly in your browser. | 17.49.37 | | `open-links-externally` | Open links outside of the app directly in your browser. | 18.03.36 |
| `premium-heading` | Shows premium branding on the home screen. | all | | `premium-heading` | Shows premium branding on the home screen. | all |
| `remember-playback-rate` | Adds the ability to remember the playback rate you chose in the video playback rate flyout. | 17.49.37 | | `remember-playback-rate` | Adds the ability to remember the playback rate you chose in the video playback rate flyout. | 18.03.36 |
| `remember-video-quality` | Adds the ability to remember the video quality you chose in the video quality flyout. | 17.49.37 | | `remember-video-quality` | Adds the ability to remember the video quality you chose in the video quality flyout. | 18.03.36 |
| `remove-player-button-background` | Removes the background from the video player buttons. | 17.49.37 | | `remove-player-button-background` | Removes the background from the video player buttons. | 18.03.36 |
| `return-youtube-dislike` | Shows the dislike count of videos using the Return YouTube Dislike API. | 17.49.37 | | `return-youtube-dislike` | Shows the dislike count of videos using the Return YouTube Dislike API. | 18.03.36 |
| `seekbar-tapping` | Enables tap-to-seek on the seekbar of the video player. | 17.49.37 | | `seekbar-tapping` | Enables tap-to-seek on the seekbar of the video player. | 18.03.36 |
| `settings` | Adds settings for ReVanced to YouTube. | all | | `sponsorblock` | Integrate SponsorBlock. | 18.03.36 |
| `sponsorblock` | Integrate SponsorBlock. | 17.49.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.03.36 |
| `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. | 17.49.37 | | `swipe-controls` | Adds volume and brightness swipe controls. | 18.03.36 |
| `swipe-controls` | Adds volume and brightness swipe controls. | 17.49.37 | | `tablet-mini-player` | Enables the tablet mini player layout. | 18.03.36 |
| `tablet-mini-player` | Enables the tablet mini player layout. | 17.49.37 |
| `theme` | Applies a custom theme. | all | | `theme` | Applies a custom theme. | all |
| `video-ads` | Removes ads in the video player. | 17.49.37 | | `video-ads` | Removes ads in the video player. | 18.03.36 |
</details> </details>
### [📦 `com.google.android.apps.youtube.music`](https://play.google.com/store/apps/details?id=com.google.android.apps.youtube.music) ### [📦 `com.google.android.apps.youtube.music`](https://play.google.com/store/apps/details?id=com.google.android.apps.youtube.music)

View File

@@ -1,2 +1,2 @@
kotlin.code.style = official kotlin.code.style = official
version = 2.157.0-dev.2 version = 2.157.0-dev.5

File diff suppressed because one or more lines are too long

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -197,13 +197,6 @@ class GeneralAdsResourcePatch : ResourcePatch {
StringResource("revanced_adremover_paid_content_enabled_summary_on", "Paid content is hidden"), StringResource("revanced_adremover_paid_content_enabled_summary_on", "Paid content is hidden"),
StringResource("revanced_adremover_paid_content_enabled_summary_off", "Paid content is shown") StringResource("revanced_adremover_paid_content_enabled_summary_off", "Paid content is shown")
), ),
SwitchPreference(
"revanced_adremover_hide_suggestions",
StringResource("revanced_adremover_hide_suggestions_enabled_title", "Hide suggestions"),
true,
StringResource("revanced_adremover_hide_suggestions_enabled_summary_on", "Suggestions are hidden"),
StringResource("revanced_adremover_hide_suggestions_enabled_summary_off", "Suggestions are shown")
),
SwitchPreference( SwitchPreference(
"revanced_adremover_hide_latest_posts", "revanced_adremover_hide_latest_posts",
StringResource("revanced_adremover_hide_latest_posts_enabled_title", "Hide latest posts"), StringResource("revanced_adremover_hide_latest_posts_enabled_title", "Hide latest posts"),

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[ [
Package("com.google.android.youtube", arrayOf("17.49.37")) Package("com.google.android.youtube", arrayOf("17.49.37", "18.03.36"))
] ]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,10 +5,7 @@ import org.jf.dexlib2.Opcode
object PivotBarCreateButtonViewFingerprint : MethodFingerprint( object PivotBarCreateButtonViewFingerprint : MethodFingerprint(
opcodes = listOf( opcodes = listOf(
Opcode.MOVE_OBJECT,
Opcode.INVOKE_DIRECT_RANGE, // unique instruction anchor Opcode.INVOKE_DIRECT_RANGE, // unique instruction anchor
Opcode.CONST_4,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_STATIC
) )
) )

View File

@@ -22,6 +22,7 @@ import app.revanced.patches.youtube.layout.pivotbar.utils.InjectionUtils.REGISTE
import app.revanced.patches.youtube.layout.pivotbar.utils.InjectionUtils.injectHook import app.revanced.patches.youtube.layout.pivotbar.utils.InjectionUtils.injectHook
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 org.jf.dexlib2.Opcode
@Patch @Patch
@DependsOn([IntegrationsPatch::class, ResourceMappingPatch::class, SettingsPatch::class, ResolvePivotBarFingerprintsPatch::class]) @DependsOn([IntegrationsPatch::class, ResourceMappingPatch::class, SettingsPatch::class, ResolvePivotBarFingerprintsPatch::class])
@@ -54,17 +55,24 @@ class CreateButtonRemoverPatch : BytecodePatch() {
return PivotBarCreateButtonViewFingerprint.toErrorResult() return PivotBarCreateButtonViewFingerprint.toErrorResult()
} }
val createButtonResult = PivotBarCreateButtonViewFingerprint.result!! PivotBarCreateButtonViewFingerprint.result!!.apply {
val insertIndex = createButtonResult.scanResult.patternScanResult!!.endIndex val insertIndex = mutableMethod.implementation!!.instructions.let {
val scanStart = scanResult.patternScanResult!!.endIndex
scanStart + it.subList(scanStart, it.size - 1).indexOfFirst { instruction ->
instruction.opcode == Opcode.INVOKE_STATIC
}
}
/* /*
* Inject hooks * Inject hooks
*/ */
val hook = "invoke-static { v$REGISTER_TEMPLATE_REPLACEMENT }, " + val hook = "invoke-static { v$REGISTER_TEMPLATE_REPLACEMENT }, " +
"$INTEGRATIONS_CLASS_DESCRIPTOR->hideCreateButton(Landroid/view/View;)V" "$INTEGRATIONS_CLASS_DESCRIPTOR->hideCreateButton(Landroid/view/View;)V"
createButtonResult.mutableMethod.injectHook(hook, insertIndex) mutableMethod.injectHook(hook, insertIndex)
}
return PatchResultSuccess() return PatchResultSuccess()
} }

View File

@@ -4,7 +4,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[ [
Package("com.google.android.youtube", arrayOf("17.49.37")) Package("com.google.android.youtube", arrayOf("17.49.37", "18.03.36"))
] ]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -4,33 +4,14 @@ import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
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.AccessFlags
import org.jf.dexlib2.Opcode
@FuzzyPatternScanMethod(3) @FuzzyPatternScanMethod(3)
object EngagementPanelControllerFingerprint : MethodFingerprint( object EngagementPanelControllerFingerprint : MethodFingerprint(
"L", AccessFlags.PRIVATE or AccessFlags.FINAL, listOf("L", "L", "Z", "Z", "Z"), listOf( returnType = "L",
Opcode.MOVE_OBJECT_FROM16, access = AccessFlags.PRIVATE or AccessFlags.FINAL,
Opcode.MOVE_OBJECT_FROM16, strings = listOf(
Opcode.MOVE_FROM16, "EngagementPanelController: cannot show EngagementPanel before EngagementPanelController.init() has been called.",
Opcode.IGET_BOOLEAN, "[EngagementPanel] Cannot show EngagementPanel before EngagementPanelController.init() has been called."
Opcode.CONST_4,
Opcode.IF_NEZ,
Opcode.CONST_STRING,
Opcode.INVOKE_STATIC,
Opcode.SGET_OBJECT,
Opcode.SGET_OBJECT,
Opcode.CONST_STRING,
Opcode.INVOKE_STATIC,
Opcode.RETURN_OBJECT,
Opcode.IGET_OBJECT,
Opcode.IGET_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.CONST_4,
Opcode.CONST_4,
Opcode.CONST_4,
Opcode.CONST_4,
Opcode.CONST_4,
Opcode.CONST_4,
) )
) )

View File

@@ -1,5 +1,6 @@
package app.revanced.patches.youtube.layout.playerpopuppanels.patch package app.revanced.patches.youtube.layout.playerpopuppanels.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
@@ -10,12 +11,12 @@ 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.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.layout.playerpopuppanels.annotations.PlayerPopupPanelsCompatibility import app.revanced.patches.youtube.layout.playerpopuppanels.annotations.PlayerPopupPanelsCompatibility
import app.revanced.patches.youtube.layout.playerpopuppanels.fingerprints.EngagementPanelControllerFingerprint import app.revanced.patches.youtube.layout.playerpopuppanels.fingerprints.EngagementPanelControllerFingerprint
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.SwitchPreference
@Patch @Patch
@DependsOn([IntegrationsPatch::class, SettingsPatch::class]) @DependsOn([IntegrationsPatch::class, SettingsPatch::class])
@@ -39,7 +40,8 @@ class PlayerPopupPanelsPatch : BytecodePatch(
) )
) )
val engagementPanelControllerMethod = EngagementPanelControllerFingerprint.result!!.mutableMethod val engagementPanelControllerMethod = EngagementPanelControllerFingerprint
.result?.mutableMethod ?: return EngagementPanelControllerFingerprint.toErrorResult()
engagementPanelControllerMethod.addInstructions( engagementPanelControllerMethod.addInstructions(
0, """ 0, """

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -19,17 +19,28 @@ import app.revanced.patches.youtube.layout.returnyoutubedislike.annotations.Retu
import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.* 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.video.videoid.patch.VideoIdPatch import app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch
@Patch @Patch
@DependsOn([IntegrationsPatch::class, VideoIdPatch::class, ReturnYouTubeDislikeResourcePatch::class]) @DependsOn(
[
IntegrationsPatch::class,
VideoIdPatch::class,
ReturnYouTubeDislikeResourcePatch::class,
PlayerTypeHookPatch::class,
]
)
@Name("return-youtube-dislike") @Name("return-youtube-dislike")
@Description("Shows the dislike count of videos using the Return YouTube Dislike API.") @Description("Shows the dislike count of videos using the Return YouTube Dislike API.")
@ReturnYouTubeDislikeCompatibility @ReturnYouTubeDislikeCompatibility
@Version("0.0.1") @Version("0.0.1")
class ReturnYouTubeDislikePatch : BytecodePatch( class ReturnYouTubeDislikePatch : BytecodePatch(
listOf( listOf(
TextComponentSpecParentFingerprint, LikeFingerprint, DislikeFingerprint, RemoveLikeFingerprint TextComponentSpecParentFingerprint,
LikeFingerprint,
DislikeFingerprint,
RemoveLikeFingerprint,
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext): PatchResult {

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -1,22 +0,0 @@
package app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.reference.MethodReference
object RectangleFieldInvalidatorFingerprint : MethodFingerprint(
"V",
customFingerprint = custom@{ methodDef ->
val instructions = methodDef.implementation?.instructions!!
val instructionCount = instructions.count()
// the method has definitely more than 5 instructions
if (instructionCount < 5) return@custom false
val referenceInstruction = instructions.elementAt(instructionCount - 2) // the second to last instruction
val reference = ((referenceInstruction as? ReferenceInstruction)?.reference as? MethodReference)
reference?.parameterTypes?.size == 1 && reference.name == "invalidate" // the reference is the invalidate(..) method
}
)

View File

@@ -1,41 +0,0 @@
package app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.sponsorblock.resource.patch.SponsorBlockResourcePatch
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
@FuzzyPatternScanMethod(3)
object ShortsPlayerConstructorFingerprint : MethodFingerprint(
"V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
opcodes = listOf(
Opcode.MOVE_OBJECT_FROM16,
Opcode.MOVE_OBJECT_FROM16,
Opcode.MOVE_OBJECT_FROM16,
Opcode.INVOKE_DIRECT_RANGE,
Opcode.NEW_INSTANCE,
Opcode.INVOKE_DIRECT,
Opcode.IPUT_OBJECT,
Opcode.NEW_INSTANCE,
Opcode.INVOKE_DIRECT,
Opcode.IPUT_OBJECT,
Opcode.NEW_INSTANCE,
Opcode.INVOKE_DIRECT,
Opcode.IPUT_OBJECT,
Opcode.NEW_INSTANCE,
Opcode.INVOKE_DIRECT,
Opcode.IPUT_OBJECT,
Opcode.IPUT_OBJECT,
Opcode.CONST_4
),
customFingerprint = { methodDef ->
methodDef.implementation?.instructions?.any { instruction ->
instruction.opcode.ordinal == Opcode.CONST.ordinal &&
(instruction as? WideLiteralInstruction)?.wideLiteral == SponsorBlockResourcePatch.reelButtonGroupResourceId
} == true
}
)

View File

@@ -7,11 +7,9 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.data.toMethodWalker import app.revanced.patcher.data.toMethodWalker
import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
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
@@ -25,20 +23,20 @@ import app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints.*
import app.revanced.patches.youtube.layout.sponsorblock.resource.patch.SponsorBlockResourcePatch import app.revanced.patches.youtube.layout.sponsorblock.resource.patch.SponsorBlockResourcePatch
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.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.video.information.patch.VideoInformationPatch import app.revanced.patches.youtube.misc.video.information.patch.VideoInformationPatch
import app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch import app.revanced.patches.youtube.misc.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
import org.jf.dexlib2.iface.reference.FieldReference
import org.jf.dexlib2.iface.reference.MethodReference import org.jf.dexlib2.iface.reference.MethodReference
import org.jf.dexlib2.iface.reference.StringReference
@Patch @Patch
@DependsOn( @DependsOn(
dependencies = [ dependencies = [
VideoInformationPatch::class, // updates video information and adds method to seek in video VideoInformationPatch::class, // updates video information and adds method to seek in video
PlayerControlsBytecodePatch::class, PlayerControlsBytecodePatch::class,
PlayerTypeHookPatch::class,
IntegrationsPatch::class, IntegrationsPatch::class,
SponsorBlockResourcePatch::class, SponsorBlockResourcePatch::class,
VideoIdPatch::class VideoIdPatch::class
@@ -54,7 +52,6 @@ class SponsorBlockBytecodePatch : BytecodePatch(
NextGenWatchLayoutFingerprint, NextGenWatchLayoutFingerprint,
AppendTimeFingerprint, AppendTimeFingerprint,
PlayerOverlaysLayoutInitFingerprint, PlayerOverlaysLayoutInitFingerprint,
ShortsPlayerConstructorFingerprint,
StartVideoInformerFingerprint StartVideoInformerFingerprint
) )
) { ) {
@@ -236,56 +233,6 @@ class SponsorBlockBytecodePatch : BytecodePatch(
"invoke-static {p0}, Lapp/revanced/integrations/sponsorblock/player/ui/SponsorBlockView;->initialize(Ljava/lang/Object;)V" "invoke-static {p0}, Lapp/revanced/integrations/sponsorblock/player/ui/SponsorBlockView;->initialize(Ljava/lang/Object;)V"
) )
// get rectangle field name
RectangleFieldInvalidatorFingerprint.resolve(context, seekbarSignatureResult.classDef)
val rectangleFieldInvalidatorInstructions =
RectangleFieldInvalidatorFingerprint.result!!.method.implementation!!.instructions
val rectangleFieldName =
((rectangleFieldInvalidatorInstructions.elementAt(rectangleFieldInvalidatorInstructions.count() - 3) as ReferenceInstruction).reference as FieldReference).name
// replace the "replaceMeWith*" strings
context
.proxy(context.classes.first { it.type.endsWith("PlayerController;") })
.mutableClass
.methods
.find { it.name == "setSponsorBarRect" }
?.let { method ->
fun MutableMethod.replaceStringInstruction(index: Int, instruction: Instruction, with: String) {
val register = (instruction as OneRegisterInstruction).registerA
this.replaceInstruction(
index, "const-string v$register, \"$with\""
)
}
for ((index, it) in method.implementation!!.instructions.withIndex()) {
if (it.opcode.ordinal != Opcode.CONST_STRING.ordinal) continue
when (((it as ReferenceInstruction).reference as StringReference).string) {
"replaceMeWithsetSponsorBarRect" ->
method.replaceStringInstruction(index, it, rectangleFieldName)
"replaceMeWithsetMillisecondMethod" ->
method.replaceStringInstruction(index, it, "seekHelper")
}
}
} ?: return PatchResultError("Could not find the method which contains the replaceMeWith* strings")
val startVideoInformerMethod = StartVideoInformerFingerprint.result!!.mutableMethod
startVideoInformerMethod.addInstructions(
0, """
const/4 v0, 0x0
sput-boolean v0, $INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR->shorts_playing:Z
"""
)
val shortsPlayerConstructorMethod = ShortsPlayerConstructorFingerprint.result!!.mutableMethod
shortsPlayerConstructorMethod.addInstructions(
0, """
const/4 v0, 0x1
sput-boolean v0, $INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR->shorts_playing:Z
"""
)
// TODO: isSBChannelWhitelisting implementation // TODO: isSBChannelWhitelisting implementation
return PatchResultSuccess() return PatchResultSuccess()

View File

@@ -23,9 +23,6 @@ import app.revanced.util.resources.ResourceUtils.mergeStrings
@DependsOn([FixLocaleConfigErrorPatch::class, SettingsPatch::class, ResourceMappingPatch::class]) @DependsOn([FixLocaleConfigErrorPatch::class, SettingsPatch::class, ResourceMappingPatch::class])
@Version("0.0.1") @Version("0.0.1")
class SponsorBlockResourcePatch : ResourcePatch { class SponsorBlockResourcePatch : ResourcePatch {
companion object {
internal var reelButtonGroupResourceId: Long = 0
}
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext): PatchResult {
val youtubePackage = "com.google.android.youtube" val youtubePackage = "com.google.android.youtube"
@@ -107,10 +104,6 @@ class SponsorBlockResourcePatch : ResourcePatch {
} }
}.close() // close afterwards }.close() // close afterwards
reelButtonGroupResourceId = ResourceMappingPatch.resourceMappings.single {
it.type == "id" && it.name == "reel_persistent_edu_button_group"
}.id
return PatchResultSuccess() return PatchResultSuccess()
} }
} }

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -29,7 +29,7 @@ class DebuggingPatch : ResourcePatch {
listOf( listOf(
SwitchPreference( SwitchPreference(
"revanced_debug_enabled", "revanced_debug_enabled",
StringResource("revanced_debug_enabled_title", "Enable debug logs"), StringResource("revanced_debug_enabled_title", "Debug logging"),
false, false,
StringResource("revanced_debug_summary_on", "Debug logs are enabled"), StringResource("revanced_debug_summary_on", "Debug logs are enabled"),
StringResource("revanced_debug_summary_off", "Debug logs are disabled") StringResource("revanced_debug_summary_off", "Debug logs are disabled")
@@ -38,11 +38,21 @@ class DebuggingPatch : ResourcePatch {
"revanced_debug_stacktrace_enabled", "revanced_debug_stacktrace_enabled",
StringResource( StringResource(
"revanced_debug_stacktrace_enabled_title", "revanced_debug_stacktrace_enabled_title",
"Print stack traces" "Log stack traces"
), ),
false, false,
StringResource("revanced_debug_stacktrace_summary_on", "Enabled printing stack traces"), StringResource("revanced_debug_stacktrace_summary_on", "Debug logs include stack trace"),
StringResource("revanced_debug_stacktrace_summary_off", "Disabled printing stack traces") StringResource("revanced_debug_stacktrace_summary_off", "Debug logs do not include stack trace")
),
SwitchPreference(
"revanced_debug_toast_on_error_enabled",
StringResource(
"revanced_debug_toast_on_error_enabled_title",
"Show toast on ReVanced error"
),
true,
StringResource("revanced_debug_toast_on_error_summary_on", "Toast shown if error occurs"),
StringResource("revanced_debug_toast_on_error_summary_off", "Toast not shown if error occurs")
), ),
), ),
StringResource("revanced_debug_summary", "Enable or disable debugging options") StringResource("revanced_debug_summary", "Enable or disable debugging options")

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -1,9 +0,0 @@
package app.revanced.patches.youtube.misc.settings.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube")])
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class SettingsCompatibility

View File

@@ -1,12 +0,0 @@
package app.revanced.patches.youtube.misc.settings.bytecode.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
object ThemeConstructorFingerprint : MethodFingerprint(
"L",
AccessFlags.PUBLIC or AccessFlags.STATIC,
listOf("L"),
strings = listOf("settings.SettingsActivity", ":android:show_fragment", "settings.GeneralPrefsFragment")
)

View File

@@ -6,7 +6,10 @@ import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
object ThemeSetterAppFingerprint : MethodFingerprint( object ThemeSetterAppFingerprint : MethodFingerprint(
"L", AccessFlags.PUBLIC or AccessFlags.STATIC, opcodes = listOf( "L",
AccessFlags.PUBLIC or AccessFlags.STATIC,
parameters = listOf("L", "L", "L", "L"),
opcodes = listOf(
Opcode.CONST, //target reference Opcode.CONST, //target reference
Opcode.GOTO, Opcode.GOTO,
Opcode.CONST, //target reference Opcode.CONST, //target reference

View File

@@ -7,24 +7,19 @@ import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
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.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.patches.shared.settings.preference.impl.Preference import app.revanced.patches.shared.settings.preference.impl.Preference
import app.revanced.patches.shared.settings.util.AbstractPreferenceScreen import app.revanced.patches.shared.settings.util.AbstractPreferenceScreen
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.annotations.SettingsCompatibility
import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.LicenseActivityFingerprint import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.LicenseActivityFingerprint
import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.ThemeConstructorFingerprint
import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.ThemeSetterAppFingerprint import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.ThemeSetterAppFingerprint
import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.ThemeSetterSystemFingerprint import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.ThemeSetterSystemFingerprint
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsResourcePatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsResourcePatch
import org.jf.dexlib2.util.MethodUtil import org.jf.dexlib2.util.MethodUtil
@Patch
@DependsOn( @DependsOn(
[ [
IntegrationsPatch::class, IntegrationsPatch::class,
@@ -33,10 +28,9 @@ import org.jf.dexlib2.util.MethodUtil
) )
@Name("settings") @Name("settings")
@Description("Adds settings for ReVanced to YouTube.") @Description("Adds settings for ReVanced to YouTube.")
@SettingsCompatibility
@Version("0.0.1") @Version("0.0.1")
class SettingsPatch : BytecodePatch( class SettingsPatch : BytecodePatch(
listOf(LicenseActivityFingerprint, ThemeSetterSystemFingerprint, ThemeConstructorFingerprint) listOf(LicenseActivityFingerprint, ThemeSetterSystemFingerprint, ThemeSetterAppFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
fun buildInvokeInstructionsString( fun buildInvokeInstructionsString(
@@ -60,11 +54,7 @@ class SettingsPatch : BytecodePatch(
} }
// set the theme based on the preference of the app // set the theme based on the preference of the app
with((ThemeConstructorFingerprint.result?.let { ThemeSetterAppFingerprint.result?.apply {
ThemeSetterAppFingerprint.apply {
if (!resolve(context, it.classDef)) return ThemeSetterAppFingerprint.toErrorResult()
}
} ?: return ThemeConstructorFingerprint.toErrorResult()).result!!) {
fun buildInstructionsString(theme: Int) = """ fun buildInstructionsString(theme: Int) = """
const/4 v0, 0x$theme const/4 v0, 0x$theme
${buildInvokeInstructionsString(parameters = "I")} ${buildInvokeInstructionsString(parameters = "I")}
@@ -79,7 +69,6 @@ class SettingsPatch : BytecodePatch(
addInstructions( addInstructions(
patternScanResult.endIndex - 7, buildInstructionsString(0) patternScanResult.endIndex - 7, buildInstructionsString(0)
) )
addInstructions( addInstructions(
patternScanResult.endIndex - 9, buildInstructionsString(1) patternScanResult.endIndex - 9, buildInstructionsString(1)
) )
@@ -87,12 +76,11 @@ class SettingsPatch : BytecodePatch(
implementation!!.instructions.size - 2, buildInstructionsString(0) implementation!!.instructions.size - 2, buildInstructionsString(0)
) )
} }
} ?: return ThemeSetterAppFingerprint.toErrorResult()
}
// set the theme based on the preference of the device // set the theme based on the preference of the device
with(LicenseActivityFingerprint.result!!) licenseActivity@{ LicenseActivityFingerprint.result!!.apply licenseActivity@{
with(mutableMethod) { mutableMethod.apply {
fun buildSettingsActivityInvokeString( fun buildSettingsActivityInvokeString(
registers: String = "p0", registers: String = "p0",
classDescriptor: String = SETTINGS_ACTIVITY_DESCRIPTOR, classDescriptor: String = SETTINGS_ACTIVITY_DESCRIPTOR,
@@ -113,7 +101,7 @@ class SettingsPatch : BytecodePatch(
} }
// remove method overrides // remove method overrides
with(mutableClass) { mutableClass.apply {
methods.removeIf { it.name != "onCreate" && !MethodUtil.isConstructor(it) } methods.removeIf { it.name != "onCreate" && !MethodUtil.isConstructor(it) }
} }
} }

View File

@@ -15,7 +15,6 @@ import app.revanced.patches.shared.settings.preference.impl.Preference
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen 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.StringResource
import app.revanced.patches.shared.settings.resource.patch.AbstractSettingsResourcePatch import app.revanced.patches.shared.settings.resource.patch.AbstractSettingsResourcePatch
import app.revanced.patches.youtube.misc.settings.annotations.SettingsCompatibility
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,7 +22,6 @@ import org.w3c.dom.Node
@Name("settings-resource-patch") @Name("settings-resource-patch")
@DependsOn([ResourceMappingPatch::class]) @DependsOn([ResourceMappingPatch::class])
@SettingsCompatibility
@Description("Applies mandatory patches to implement ReVanced settings into the application.") @Description("Applies mandatory patches to implement ReVanced settings into the application.")
@Version("0.0.1") @Version("0.0.1")
class SettingsResourcePatch : AbstractSettingsResourcePatch( class SettingsResourcePatch : AbstractSettingsResourcePatch(

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.49.37") "com.google.android.youtube", arrayOf("17.49.37", "18.03.36")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -0,0 +1,12 @@
package app.revanced.patches.youtube.misc.videobuffer.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
object InvokeMaxBufferFingerprint : MethodFingerprint(
"Z", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("J", "J", "F"),
listOf(Opcode.CONST_WIDE_16),
strings = listOf("scl.")
)

View File

@@ -1,19 +1,8 @@
package app.revanced.patches.youtube.misc.videobuffer.fingerprints package app.revanced.patches.youtube.misc.videobuffer.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.Opcode
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
object MaxBufferFingerprint : MethodFingerprint( object MaxBufferFingerprint : MethodFingerprint(
"I", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf(), opcodes = listOf(Opcode.SGET_OBJECT, Opcode.IGET, Opcode.IF_EQZ, Opcode.RETURN),
listOf(Opcode.SGET_OBJECT, Opcode.IGET, Opcode.IF_EQZ, Opcode.RETURN),
customFingerprint = { methodDef ->
methodDef.definingClass == "Lcom/google/android/libraries/youtube/innertube/model/media/PlayerConfigModel;"
&& methodDef.implementation!!.instructions.any {
((it as? NarrowLiteralInstruction)?.narrowLiteral == 120000)
&& methodDef.name == "r"
}
}
) )

View File

@@ -1,24 +1,28 @@
package app.revanced.patches.youtube.misc.videobuffer.patch package app.revanced.patches.youtube.misc.videobuffer.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.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
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.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.youtube.misc.settings.bytecode.patch.SettingsPatch
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.PreferenceScreen 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.StringResource
import app.revanced.patches.shared.settings.preference.impl.TextPreference import app.revanced.patches.shared.settings.preference.impl.TextPreference
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import app.revanced.patches.youtube.misc.videobuffer.annotations.CustomVideoBufferCompatibility import app.revanced.patches.youtube.misc.videobuffer.annotations.CustomVideoBufferCompatibility
import app.revanced.patches.youtube.misc.videobuffer.fingerprints.InvokeMaxBufferFingerprint
import app.revanced.patches.youtube.misc.videobuffer.fingerprints.MaxBufferFingerprint import app.revanced.patches.youtube.misc.videobuffer.fingerprints.MaxBufferFingerprint
import app.revanced.patches.youtube.misc.videobuffer.fingerprints.PlaybackBufferFingerprint import app.revanced.patches.youtube.misc.videobuffer.fingerprints.PlaybackBufferFingerprint
import app.revanced.patches.youtube.misc.videobuffer.fingerprints.ReBufferFingerprint import app.revanced.patches.youtube.misc.videobuffer.fingerprints.ReBufferFingerprint
@@ -32,7 +36,9 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Version("0.0.1") @Version("0.0.1")
class CustomVideoBufferPatch : BytecodePatch( class CustomVideoBufferPatch : BytecodePatch(
listOf( listOf(
MaxBufferFingerprint, PlaybackBufferFingerprint, ReBufferFingerprint InvokeMaxBufferFingerprint,
PlaybackBufferFingerprint,
ReBufferFingerprint,
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
@@ -78,60 +84,118 @@ class CustomVideoBufferPatch : BytecodePatch(
StringResource("revanced_custom_video_buffer_summary", "Custom settings for video buffer") StringResource("revanced_custom_video_buffer_summary", "Custom settings for video buffer")
) )
) )
BufferType.values().forEach { type ->
type.hook(context)
}
execMaxBuffer()
execPlaybackBuffer()
execReBuffer()
return PatchResultSuccess() return PatchResultSuccess()
} }
private fun execMaxBuffer() { /**
val (method, result) = MaxBufferFingerprint.unwrap(true, -1) * The type of buffer.
val (index, register) = result *
* @param patchInfo The corresponding information to patch the buffer type.
* @param preparation Optional preparation before patching.
*/
private enum class BufferType(
private val patchInfo: PatchInfo,
private val preparation: (BytecodeContext.() -> Unit)? = null,
) {
method.addInstructions( PLAYBACK(PatchInfo(PlaybackBufferFingerprint, "getPlaybackBuffer")),
index + 1, """ RE(PatchInfo(ReBufferFingerprint, "getReBuffer")),
invoke-static {}, Lapp/revanced/integrations/patches/VideoBufferPatch;->getMaxBuffer()I MAX(
move-result v$register PatchInfo(
""" MaxBufferFingerprint,
"getMaxBuffer",
PatchInfo.UnwrapInfo(true, -1)
),
preparation@{
InvokeMaxBufferFingerprint.result?.apply {
val maxBufferMethodCallOffset = 2
val maxBufferMethod = this@preparation.toMethodWalker(method)
.nextMethod(scanResult.patternScanResult!!.endIndex + maxBufferMethodCallOffset)
.getMethod()
if (!MaxBufferFingerprint.resolve(
this@preparation,
maxBufferMethod,
// This is inefficient because toMethodWalker technically already has context about this.
// Alternatively you can iterate manually over all classes
// instead of relying on toMethodWalker.
this@preparation.findClass(maxBufferMethod.definingClass)!!.immutableClass,
) )
) throw MaxBufferFingerprint.toErrorResult()
} ?: throw InvokeMaxBufferFingerprint.toErrorResult()
});
/**
* Information about a patch.
*
* @param fingerprint The corresponding [MethodFingerprint] for the patch.
* @param integrationsMethodName The corresponding name of the hooking method.
* @param unwrapInfo Optional information on how to treat the [MethodFingerprint].
*/
private class PatchInfo(
val fingerprint: MethodFingerprint,
val integrationsMethodName: String,
val unwrapInfo: UnwrapInfo? = null
) {
/**
* Information on how to treat a [MethodFingerprint].
*
* @param useEndIndex Whether to retrieve information of the [MethodFingerprint]
* from the end index of its pattern scan result.
* @param offset An additional offset to [useEndIndex].
*/
class UnwrapInfo(val useEndIndex: Boolean = false, val offset: Int = 0)
} }
private fun execPlaybackBuffer() { fun hook(context: BytecodeContext) {
val (method, result) = PlaybackBufferFingerprint.unwrap() /**
val (index, register) = result * The resulting instruction info for unwrapping [MethodFingerprint].
*
* @param index The index of the instruction.
* @param register The register of the instruction.
*/
data class InstructionResult(val index: Int, val register: Int)
method.addInstructions( /***
index + 1, """ * The result of unwrapping [MethodFingerprint].
invoke-static {}, Lapp/revanced/integrations/patches/VideoBufferPatch;->getPlaybackBuffer()I *
move-result v$register * @param method The method which was retrieved from the [MethodFingerprint].
""" * @param instructionResult The resulting instruction info for unwrapping [MethodFingerprint].
) */
} data class UnwrapResult(val method: MutableMethod, val instructionResult: InstructionResult)
private fun execReBuffer() { fun MethodFingerprint.unwrap(unwrapInfo: PatchInfo.UnwrapInfo? = null): UnwrapResult {
val (method, result) = ReBufferFingerprint.unwrap()
val (index, register) = result
method.addInstructions(
index + 1, """
invoke-static {}, Lapp/revanced/integrations/patches/VideoBufferPatch;->getReBuffer()I
move-result v$register
"""
)
}
private fun MethodFingerprint.unwrap(
forEndIndex: Boolean = false,
offset: Int = 0
): Pair<MutableMethod, Pair<Int, Int>> {
val result = this.result!! val result = this.result!!
val method = result.mutableMethod val method = result.mutableMethod
val scanResult = result.scanResult.patternScanResult!! val scanResult = result.scanResult.patternScanResult!!
val index = (if (forEndIndex) scanResult.endIndex else scanResult.startIndex) + offset val index =
if (unwrapInfo?.useEndIndex == true) scanResult.endIndex
else {
scanResult.startIndex
} + (unwrapInfo?.offset ?: 0)
val register = (method.instruction(index) as OneRegisterInstruction).registerA val register = (method.instruction(index) as OneRegisterInstruction).registerA
return method to (index to register) return UnwrapResult(method, InstructionResult(index, register))
}
preparation?.invoke(context)
val (method, result) = patchInfo.fingerprint.unwrap(patchInfo.unwrapInfo)
val (index, register) = result
method.addInstructions(
index + 1,
"""
invoke-static {}, Lapp/revanced/integrations/patches/VideoBufferPatch;->${patchInfo.integrationsMethodName}()I
move-result v$register
"""
)
}
} }
} }

View File

@@ -3,10 +3,9 @@
<string name="revanced_ryd_failure_connection_timeout">Dislikes temporarily not available (API timed out)</string> <string name="revanced_ryd_failure_connection_timeout">Dislikes temporarily not available (API timed out)</string>
<string name="revanced_ryd_failure_client_rate_limit_requested">Dislikes not available (client API limit reached)</string> <string name="revanced_ryd_failure_client_rate_limit_requested">Dislikes not available (client API limit reached)</string>
<string name="revanced_ryd_failure_register_user">ReturnYouTubeDislike failed to register as new user</string>
<string name="revanced_ryd_failure_confirm_user">ReturnYouTubeDislike failed to confirm new user</string> <!-- corner case situation, where user enables RYD while video is playing and then tries to vote for the video -->
<string name="revanced_ryd_failure_send_vote_failed">ReturnYouTubeDislike failed to send vote</string> <string name="revanced_ryd_failure_ryd_enabled_while_playing_video_then_user_voted">Reload video to vote using ReturnYouTubeDislike</string>
<string name="revanced_ryd_failure_confirm_vote_failed">ReturnYouTubeDislike failed to confirm vote</string>
<string name="revanced_ryd_enable_title">Return YouTube Dislike</string> <string name="revanced_ryd_enable_title">Return YouTube Dislike</string>
<string name="revanced_ryd_enable_summary_on">Dislikes are shown</string> <string name="revanced_ryd_enable_summary_on">Dislikes are shown</string>
@@ -34,16 +33,16 @@
<string name="revanced_ryd_statistics_getFetchCallResponseTimeLast_rate_limit_summary">Dislikes temporarily not available - Client API rate limit in effect</string> <string name="revanced_ryd_statistics_getFetchCallResponseTimeLast_rate_limit_summary">Dislikes temporarily not available - Client API rate limit in effect</string>
<string name="revanced_ryd_statistics_getFetchCallCount_title">API fetch votes, number of calls</string> <string name="revanced_ryd_statistics_getFetchCallCount_title">API fetch votes, number of calls</string>
<string name="revanced_ryd_statistics_getFetchCallCount_zero_summary">No network calls have been made</string> <string name="revanced_ryd_statistics_getFetchCallCount_zero_summary">No network calls made</string>
<string name="revanced_ryd_statistics_getFetchCallCount_non_zero_summary">%d network calls have been made</string> <string name="revanced_ryd_statistics_getFetchCallCount_non_zero_summary">%d network calls made</string>
<string name="revanced_ryd_statistics_getFetchCallNumberOfFailures_title">API fetch votes, number of timeouts</string> <string name="revanced_ryd_statistics_getFetchCallNumberOfFailures_title">API fetch votes, number of timeouts</string>
<string name="revanced_ryd_statistics_getFetchCallNumberOfFailures_zero_summary">No network calls have timed out</string> <string name="revanced_ryd_statistics_getFetchCallNumberOfFailures_zero_summary">No network calls timed out</string>
<string name="revanced_ryd_statistics_getFetchCallNumberOfFailures_non_zero_summary">%d network calls timed out</string> <string name="revanced_ryd_statistics_getFetchCallNumberOfFailures_non_zero_summary">%d network calls timed out</string>
<string name="revanced_ryd_statistics_getNumberOfRateLimitRequestsEncountered_title">API client rate limits</string> <string name="revanced_ryd_statistics_getNumberOfRateLimitRequestsEncountered_title">API client rate limits</string>
<string name="revanced_ryd_statistics_getNumberOfRateLimitRequestsEncountered_zero_summary">No client rate limits have been encountered</string> <string name="revanced_ryd_statistics_getNumberOfRateLimitRequestsEncountered_zero_summary">No client rate limits encountered</string>
<string name="revanced_ryd_statistics_getNumberOfRateLimitRequestsEncountered_non_zero_summary">Client rate limit was encountered %d times</string> <string name="revanced_ryd_statistics_getNumberOfRateLimitRequestsEncountered_non_zero_summary">Client rate limit encountered %d times</string>
<string name="revanced_ryd_statistics_millisecond_text">%d milliseconds</string> <string name="revanced_ryd_statistics_millisecond_text">%d milliseconds</string>
</resources> </resources>