Compare commits

...

21 Commits

Author SHA1 Message Date
semantic-release-bot
b0d6cee4db chore(release): 2.15.0 [skip ci]
# [2.15.0](https://github.com/revanced/revanced-patches/compare/v2.14.1...v2.15.0) (2022-07-16)

### Features

* `return-youtube-dislikes` patch ([#175](https://github.com/revanced/revanced-patches/issues/175)) ([6bbcdf8](6bbcdf8ebd))
2022-07-16 14:52:58 +00:00
j4k0xb
6bbcdf8ebd feat: return-youtube-dislikes patch (#175)
* feat: ryd

* refactor: use ryd patches class

* feat: add video id dependency patch

* fix: compatibility with 17.26.35

* refactor: named param variable, simpler mutableClass access
2022-07-16 16:50:37 +02:00
semantic-release-bot
6fa8289ca6 chore(release): 2.14.1 [skip ci]
## [2.14.1](https://github.com/revanced/revanced-patches/compare/v2.14.0...v2.14.1) (2022-07-15)

### Bug Fixes

* `codecs-unlock` patch and update Music patches to `5.14.53` ([97dbb43](97dbb43caa))
2022-07-15 12:57:47 +00:00
Alberto Ponces
97dbb43caa fix: codecs-unlock patch and update Music patches to 5.14.53 2022-07-15 14:56:10 +02:00
semantic-release-bot
8cda5663ef chore(release): 2.14.0 [skip ci]
# [2.14.0](https://github.com/revanced/revanced-patches/compare/v2.13.6...v2.14.0) (2022-07-15)

### Features

* `music-video-ads` patch ([#172](https://github.com/revanced/revanced-patches/issues/172)) ([5587c91](5587c91899))
2022-07-15 11:20:04 +00:00
Alberto Ponces
5587c91899 feat: music-video-ads patch (#172) 2022-07-15 13:18:25 +02:00
semantic-release-bot
4e6d82a334 chore(release): 2.13.6 [skip ci]
## [2.13.6](https://github.com/revanced/revanced-patches/compare/v2.13.5...v2.13.6) (2022-07-14)
2022-07-14 16:48:23 +00:00
TheJeterLP
be7302689e build: trigger build 2022-07-14 18:46:33 +02:00
TheJeterLP
14d94d6a44 refactor: prepare for settings patch (#168) 2022-07-14 18:42:22 +02:00
genericness
8d598f5b82 style: casing in description (#174) 2022-07-14 18:40:21 +02:00
semantic-release-bot
918782908b chore(release): 2.13.5 [skip ci]
## [2.13.5](https://github.com/revanced/revanced-patches/compare/v2.13.4...v2.13.5) (2022-07-14)

### Bug Fixes

* `swipe-controls` with active engagement panel ([#177](https://github.com/revanced/revanced-patches/issues/177)) ([524fe19](524fe19840))
2022-07-14 15:23:07 +00:00
Chris
524fe19840 fix: swipe-controls with active engagement panel (#177) 2022-07-14 17:21:26 +02:00
semantic-release-bot
18aafb400b chore(release): 2.13.4 [skip ci]
## [2.13.4](https://github.com/revanced/revanced-patches/compare/v2.13.3...v2.13.4) (2022-07-13)

### Bug Fixes

* constrain `old-quality-layout` to older version ([83ac6b3](83ac6b3e34))
2022-07-13 11:38:21 +00:00
oSumAtrIX
83ac6b3e34 fix: constrain old-quality-layout to older version 2022-07-13 13:36:09 +02:00
oSumAtrIX
890ebf04df docs: change size of headings [skip ci] 2022-07-12 01:13:09 +02:00
oSumAtrIX
6838daf1c3 refactor: rename class and move to sub-package 2022-07-12 00:04:22 +02:00
bogadana
08f4e8532c docs: properly handle semantic versions (#156) [skip ci] 2022-07-11 21:08:47 +02:00
semantic-release-bot
30d25a87da chore(release): 2.13.3 [skip ci]
## [2.13.3](https://github.com/revanced/revanced-patches/compare/v2.13.2...v2.13.3) (2022-07-11)

### Bug Fixes

* `exclusive-audio-playback` patch ([#153](https://github.com/revanced/revanced-patches/issues/153)) ([af0523d](af0523df39))
2022-07-11 18:07:27 +00:00
Alberto Ponces
af0523df39 fix: exclusive-audio-playback patch (#153) 2022-07-11 20:05:03 +02:00
semantic-release-bot
18a3f8e80c chore(release): 2.13.2 [skip ci]
## [2.13.2](https://github.com/revanced/revanced-patches/compare/v2.13.1...v2.13.2) (2022-07-11)

### Bug Fixes

* `hrd-auto-brightness` ([#152](https://github.com/revanced/revanced-patches/issues/152)) ([ce32c6f](ce32c6f3f7))
2022-07-11 17:01:08 +00:00
Chris
ce32c6f3f7 fix: hrd-auto-brightness (#152) 2022-07-11 18:59:26 +02:00
42 changed files with 796 additions and 88 deletions

View File

@@ -3,21 +3,22 @@ name: Bug report
about: Create a bug report on patches
title: 'problem: `some-patch`'
labels: bug
assignees: ''
---
# 🐞 Issue
## 🐞 Issue
<!-- Describe your issue in detail here -->
# ⚙ Reproduce
## ⚙ Reproduce
<!-- Include your environment and steps to reproduce the issue as detailed as possible -->
# 🛠 Solution
## 🛠 Solution
<!-- If applicable, add a possible solution -->
# ⚠ Additional context
## ⚠ Additional context
<!-- Add any other context about the problem here -->

View File

@@ -3,21 +3,22 @@ name: Feature request
about: Suggest a change to some patch. Do not submit suggestions for patches here.
title: 'feat: some feature'
labels: feature-request
assignees: ''
---
# 🐞 Issue
## 🐞 Issue
<!-- Explain here, what the current problem is and why it lead you to request a feature change -->
<!-- Explain here, what the current problem is and why it leads you to request a feature change -->
# ❗ Solution
## ❗ Solution
<!-- Explain how your current issue can be solved -->
# ❓ Motivation
## ❓ Motivation
<!-- Explain why your feature should be considered -->
# ⚠ Additional context
## ⚠ Additional context
<!-- Add any other context or screenshots about the feature request here -->

View File

@@ -1,3 +1,54 @@
# [2.15.0](https://github.com/revanced/revanced-patches/compare/v2.14.1...v2.15.0) (2022-07-16)
### Features
* `return-youtube-dislikes` patch ([#175](https://github.com/revanced/revanced-patches/issues/175)) ([18a66d8](https://github.com/revanced/revanced-patches/commit/18a66d8454cf6e7cfdd4183631a6870c80d16b90))
## [2.14.1](https://github.com/revanced/revanced-patches/compare/v2.14.0...v2.14.1) (2022-07-15)
### Bug Fixes
* `codecs-unlock` patch and update Music patches to `5.14.53` ([2437d30](https://github.com/revanced/revanced-patches/commit/2437d3070f6a630d353619f642cefebd47abee20))
# [2.14.0](https://github.com/revanced/revanced-patches/compare/v2.13.6...v2.14.0) (2022-07-15)
### Features
* `music-video-ads` patch ([#172](https://github.com/revanced/revanced-patches/issues/172)) ([cbb71b5](https://github.com/revanced/revanced-patches/commit/cbb71b5faf1386ed31dd9e0387f6cf0509d92d31))
## [2.13.6](https://github.com/revanced/revanced-patches/compare/v2.13.5...v2.13.6) (2022-07-14)
## [2.13.5](https://github.com/revanced/revanced-patches/compare/v2.13.4...v2.13.5) (2022-07-14)
### Bug Fixes
* `swipe-controls` with active engagement panel ([#177](https://github.com/revanced/revanced-patches/issues/177)) ([000ec6d](https://github.com/revanced/revanced-patches/commit/000ec6d8f6ecbb910a06ec852564ee9e5f03dcf8))
## [2.13.4](https://github.com/revanced/revanced-patches/compare/v2.13.3...v2.13.4) (2022-07-13)
### Bug Fixes
* constrain `old-quality-layout` to older version ([add7232](https://github.com/revanced/revanced-patches/commit/add72326199e90f677b450b553b9d88c0bb4c490))
## [2.13.3](https://github.com/revanced/revanced-patches/compare/v2.13.2...v2.13.3) (2022-07-11)
### Bug Fixes
* `exclusive-audio-playback` patch ([#153](https://github.com/revanced/revanced-patches/issues/153)) ([9beff95](https://github.com/revanced/revanced-patches/commit/9beff9567f1586e5c58690c1f1d2f7f204025ab7))
## [2.13.2](https://github.com/revanced/revanced-patches/compare/v2.13.1...v2.13.2) (2022-07-11)
### Bug Fixes
* `hrd-auto-brightness` ([#152](https://github.com/revanced/revanced-patches/issues/152)) ([5f2e9ba](https://github.com/revanced/revanced-patches/commit/5f2e9ba30b7432be04bdc9f9f7ec7ac75fdc4b34))
## [2.13.1](https://github.com/revanced/revanced-patches/compare/v2.13.0...v2.13.1) (2022-07-11)

View File

@@ -6,31 +6,33 @@
| 💊 Patch | 📜 Description | 🎯 Target Package | 🏹 Target Version |
|:--------:|:--------------:|:-----------------:|:-----------------:|
| `swipe-controls` | Adds volume and brightness swipe controls. | `com.google.android.youtube` | 17.26.35 |
| `seekbar-tapping` | Enables tapping on the seekbar of the YouTube player. | `com.google.android.youtube` | 17.26.35 |
| `general-ads` | Removes general ads in bytecode. | `com.google.android.youtube` | 17.26.35 |
| `video-ads` | Removes ads in the YouTube video player. | `com.google.android.youtube` | 17.26.35 |
| `music-video-ads` | Removes ads in the YouTube Music player. | `com.google.android.apps.youtube.music` | 5.14.53 |
| `exclusive-audio-playback` | Adds the option to play music without video. | `com.google.android.apps.youtube.music` | 5.14.53 |
| `codecs-unlock` | Enables more audio codecs. Usually results in better audio quality but may depend on song and device. | `com.google.android.apps.youtube.music` | 5.14.53 |
| `background-play` | Enables playing music in the background. | `com.google.android.apps.youtube.music` | 5.14.53 |
| `tasteBuilder-remover` | Removes the "Tell us which artists you like" card from the Home screen. The same functionality can be triggered from the settings anyway. | `com.google.android.apps.youtube.music` | 5.14.53 |
| `upgrade-button-remover` | Removes the upgrade tab from the pivot bar in YouTube Music. | `com.google.android.apps.youtube.music` | 5.14.53 |
| `hide-infocard-suggestions` | Hides infocards in videos. | `com.google.android.youtube` | 17.26.35 |
| `custom-branding` | Changes the branding of YouTube. | `com.google.android.youtube` | all |
| `premium-heading` | Shows premium branding on the YouTube home screen. | `com.google.android.youtube` | all |
| `minimized-playback` | Enables minimized and background playback. | `com.google.android.youtube` | 17.26.35 |
| `enable-wide-searchbar` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | `com.google.android.youtube` | 17.26.35 |
| `disable-fullscreen-panels` | Disables comments panel in fullscreen view. | `com.google.android.youtube` | 17.26.35 |
| `old-quality-layout` | Enables the original quality flyout menu. | `com.google.android.youtube` | 17.26.35 |
| `hide-autoplay-button` | Disables the autoplay button. | `com.google.android.youtube` | 17.26.35 |
| `disable-create-button` | Disables the create button. | `com.google.android.youtube` | 17.26.35 |
| `amoled` | Enables pure black theme. | `com.google.android.youtube` | 17.26.35 |
| `hide-shorts-button` | Hides the shorts button. | `com.google.android.youtube` | 17.26.35 |
| `hide-cast-button` | Hides the cast button. | `com.google.android.youtube` | all |
| `hide-watermark` | Hides the creator's watermark on videos. | `com.google.android.youtube` | 17.26.35 |
| `video-ads` | Removes ads in the YouTube video player. | `com.google.android.youtube` | 17.26.35 |
| `general-ads` | Removes general ads in bytecode. | `com.google.android.youtube` | 17.26.35 |
| `seekbar-tapping` | Enables tapping on the seekbar of the YouTube player. | `com.google.android.youtube` | 17.26.35 |
| `swipe-controls` | Adds volume and brightness swipe controls. | `com.google.android.youtube` | 17.26.35 |
| `microg-support` | Allows YouTube ReVanced to run without root and under a different package name. | `com.google.android.youtube` | 17.26.35 |
| `hdr-auto-brightness` | Makes the brightness of HDR videos follow the system default. | `com.google.android.youtube` | 17.26.35 |
| `autorepeat-by-default` | Enables auto repeating of videos by default. | `com.google.android.youtube` | 17.26.35 |
| `custom-playback-speed` | Allows to change the default playback speed options. | `com.google.android.youtube` | 17.26.35 |
| `hdr-max-brightness` | Sets brightness to max for HDR videos in fullscreen mode. | `com.google.android.youtube` | 17.26.35 |
| `enable-debugging` | Enables app debugging by patching the manifest file. | `com.google.android.youtube` | all |
| `background-play` | Enables playing music in the background. | `com.google.android.apps.youtube.music` | 5.03.50 |
| `exclusive-audio-playback` | Adds the option to play music without video. | `com.google.android.apps.youtube.music` | 5.03.50 |
| `codecs-unlock` | Enables more audio codecs. Usually results in better audio quality but may depend on song and device. | `com.google.android.apps.youtube.music` | 5.03.50 |
| `upgrade-button-remover` | Removes the upgrade tab from the pivot bar in YouTube music. | `com.google.android.apps.youtube.music` | 5.03.50 |
| `tasteBuilder-remover` | Removes the "Tell us which artists you like" card from the Home screen. The same functionality can be triggered from the settings anyway. | `com.google.android.apps.youtube.music` | 5.03.50 |
| `old-quality-layout` | Enables the original quality flyout menu. | `com.google.android.youtube` | 17.24.35 |
| `hide-cast-button` | Hides the cast button. | `com.google.android.youtube` | all |
| `amoled` | Enables pure black theme. | `com.google.android.youtube` | 17.26.35 |
| `hide-autoplay-button` | Disables the autoplay button. | `com.google.android.youtube` | 17.26.35 |
| `minimized-playback` | Enables minimized and background playback. | `com.google.android.youtube` | 17.26.35 |
| `premium-heading` | Shows premium branding on the YouTube home screen. | `com.google.android.youtube` | all |
| `custom-branding` | Changes the branding of YouTube. | `com.google.android.youtube` | all |
| `enable-wide-searchbar` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | `com.google.android.youtube` | 17.26.35 |
| `return-youtube-dislikes` | Shows the dislike count of videos. | `com.google.android.youtube` | 17.26.35 |
| `disable-fullscreen-panels` | Disables comments panel in fullscreen view. | `com.google.android.youtube` | 17.26.35 |
| `hide-shorts-button` | Hides the shorts button. | `com.google.android.youtube` | 17.26.35 |
| `disable-create-button` | Disables the create button. | `com.google.android.youtube` | 17.26.35 |
| `hide-watermark` | Hides the creator's watermark on videos. | `com.google.android.youtube` | 17.26.35 |

View File

@@ -1,2 +1,2 @@
kotlin.code.style = official
version = 2.13.1
version = 2.15.0

View File

@@ -21,7 +21,10 @@ class Generator {
for (patch in bundle) {
val patchName = patch.patchName
val compatiblePackage = patch.compatiblePackages?.first()
val latestVersion = compatiblePackage?.versions?.maxByOrNull { it.replace(".", "").toInt() } ?: "all"
val latestVersion =
compatiblePackage?.versions?.map { SemanticVersion.fromString(it) }?.maxWithOrNull(
SemanticVersionComparator
) ?: "all"
patches.appendLine("| `$patchName` | ${patch.description} | `${compatiblePackage?.name}` | $latestVersion |")
}

View File

@@ -0,0 +1,24 @@
package app.revanced.meta.readme
data class SemanticVersion(val major: Int, val minor: Int, val patch: Int) {
companion object {
fun fromString(version: String): SemanticVersion {
var parts = version.split(".")
if (parts.count() != 3) throw IllegalArgumentException("Invalid semantic version")
val versionNumbers = parts.map { it.toInt() }
return SemanticVersion(versionNumbers[0], versionNumbers[1], versionNumbers[2])
}
}
override fun toString(): String = "$major.$minor.$patch"
}
object SemanticVersionComparator : Comparator<SemanticVersion> {
override fun compare(a: SemanticVersion, b: SemanticVersion): Int = when {
a.major != b.major -> a.major - b.major
a.minor != b.minor -> a.minor - b.minor
else -> a.patch - b.patch
}
}

View File

@@ -0,0 +1,13 @@
package app.revanced.patches.music.ad.video.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.apps.youtube.music", arrayOf("5.14.53")
)]
)
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class MusicVideoAdsCompatibility

View File

@@ -0,0 +1,39 @@
package app.revanced.patches.music.ad.video.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.music.ad.video.annotations.MusicVideoAdsCompatibility
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@Name("show-video-ads-constructor-fingerprint")
@MatchingMethod(
"Laghd;",
"<init>",
)
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@MusicVideoAdsCompatibility
@Version("0.0.1")
object ShowMusicVideoAdsConstructorFingerprint : MethodFingerprint(
"V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf("L", "L", "L"), listOf(
Opcode.INVOKE_DIRECT,
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.IPUT_OBJECT,
Opcode.CONST_4,
Opcode.IPUT_BOOLEAN,
Opcode.RETURN_VOID
)
)

View File

@@ -0,0 +1,26 @@
package app.revanced.patches.music.ad.video.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.ad.video.annotations.MusicVideoAdsCompatibility
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@Name("show-video-ads-method-fingerprint")
@MatchingMethod(
"Laghd;", "d"
)
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@MusicVideoAdsCompatibility
@Version("0.0.1")
object ShowMusicVideoAdsFingerprint : MethodFingerprint(
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("Z"), listOf(
Opcode.IPUT_BOOLEAN,
Opcode.INVOKE_VIRTUAL,
Opcode.RETURN_VOID
)
)

View File

@@ -0,0 +1,40 @@
package app.revanced.patches.music.ad.video.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.music.ad.video.annotations.MusicVideoAdsCompatibility
import app.revanced.patches.music.ad.video.fingerprints.ShowMusicVideoAdsConstructorFingerprint
import app.revanced.patches.music.ad.video.fingerprints.ShowMusicVideoAdsFingerprint
@Patch
@Name("music-video-ads")
@Description("Removes ads in the YouTube Music player.")
@MusicVideoAdsCompatibility
@Version("0.0.1")
class MusicVideoAdsPatch : BytecodePatch(
listOf(
ShowMusicVideoAdsConstructorFingerprint
)
) {
override fun execute(data: BytecodeData): PatchResult {
ShowMusicVideoAdsFingerprint.resolve(data, ShowMusicVideoAdsConstructorFingerprint.result!!.classDef)
val result = ShowMusicVideoAdsFingerprint.result!!
result.mutableMethod.addInstructions(
result.patternScanResult!!.startIndex, """
const/4 p1, 0x0
"""
)
return PatchResultSuccess()
}
}

View File

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

View File

@@ -20,8 +20,9 @@ import org.jf.dexlib2.Opcode
@Version("0.0.1")
object CodecsLockFingerprint : MethodFingerprint(
"L", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L", "L", "L", "L"), listOf(
Opcode.INVOKE_STATIC,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST,
Opcode.INVOKE_DIRECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT,
@@ -29,18 +30,11 @@ object CodecsLockFingerprint : MethodFingerprint(
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT,
Opcode.IF_NEZ,
Opcode.SGET,
Opcode.SGET_OBJECT,
Opcode.IGET_OBJECT,
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_INTERFACE,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT,
Opcode.IF_NEZ,
Opcode.SGET_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST,
Opcode.INVOKE_INTERFACE,
Opcode.INVOKE_DIRECT,
Opcode.RETURN_OBJECT
)

View File

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

View File

@@ -26,9 +26,7 @@ class ExclusiveAudioPatch : BytecodePatch(
)
) {
override fun execute(data: BytecodeData): PatchResult {
ExclusiveAudioFingerprint.resolve(data, AudioOnlyEnablerFingerprint.result!!.classDef)
val method = ExclusiveAudioFingerprint.result!!.mutableMethod
val method = AudioOnlyEnablerFingerprint.result!!.mutableMethod
method.replaceInstruction(method.implementation!!.instructions.count() - 1, "const/4 v0, 0x1")
method.addInstruction("return v0")

View File

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

View File

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

View File

@@ -20,7 +20,7 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction35c
@Patch
@Name("upgrade-button-remover")
@Description("Removes the upgrade tab from the pivot bar in YouTube music.")
@Description("Removes the upgrade tab from the pivot bar in YouTube Music.")
@RemoveUpgradeButtonCompatibility
@Version("0.0.1")
class RemoveUpgradeButtonPatch : BytecodePatch(

View File

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

View File

@@ -1,4 +1,4 @@
package app.revanced.patches.youtube.interaction.swipecontrols.patch
package app.revanced.patches.youtube.interaction.swipecontrols.patch.bytecode
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
@@ -12,7 +12,9 @@ import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.youtube.interaction.swipecontrols.annotation.SwipeControlsCompatibility
import app.revanced.patches.youtube.interaction.swipecontrols.fingerprints.WatchWhileOnStartFingerprint
import app.revanced.patches.youtube.interaction.swipecontrols.patch.resource.SwipeControlsResourcePatch
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.playeroverlay.patch.PlayerOverlaysHookPatch
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
@Patch
@@ -24,10 +26,11 @@ import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
dependencies = [
IntegrationsPatch::class,
PlayerTypeHookPatch::class,
SwipeControlsResourcesPatch::class
PlayerOverlaysHookPatch::class,
SwipeControlsResourcePatch::class
]
)
class SwipeControlsPatch : BytecodePatch(
class SwipeControlsBytecodePatch : BytecodePatch(
listOf(
WatchWhileOnStartFingerprint
)

View File

@@ -1,4 +1,4 @@
package app.revanced.patches.youtube.interaction.swipecontrols.patch
package app.revanced.patches.youtube.interaction.swipecontrols.patch.resource
import app.revanced.extensions.injectResources
import app.revanced.patcher.annotation.Name
@@ -12,7 +12,7 @@ import app.revanced.patches.youtube.interaction.swipecontrols.annotation.SwipeCo
@Name("swipe-controls-resource-patch")
@SwipeControlsCompatibility
@Version("0.0.1")
class SwipeControlsResourcesPatch : ResourcePatch() {
class SwipeControlsResourcePatch : ResourcePatch() {
override fun execute(data: ResourceData): PatchResult {
val resourcesDir = "swipecontrols"

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf("17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35")
"com.google.android.youtube", arrayOf("17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35")
)]
)
@Target(AnnotationTarget.CLASS)

View File

@@ -37,15 +37,23 @@ class OldQualityLayoutPatch : BytecodePatch(
val implementation = result.mutableMethod.implementation!!
// use this register because it is free
val containerRegister = 5
// if useOldStyleQualitySettings == true, jump over all instructions
val jmpInstruction = BuilderInstruction21t(
Opcode.IF_NEZ, 0, implementation.instructions[result.patternScanResult!!.endIndex].location.labels.first()
implementation.addInstruction(
4, BuilderInstruction21t(
Opcode.IF_NEZ,
containerRegister,
implementation.instructions[result.patternScanResult!!.endIndex].location.labels.first()
)
)
implementation.addInstruction(5, jmpInstruction)
// insert the new condition
result.mutableMethod.addInstructions(
0, """
invoke-static { }, Lapp/revanced/integrations/patches/OldStyleQualityPatch;->useOldStyleQualitySettings()Z
move-result v0
move-result v$containerRegister
"""
)

View File

@@ -0,0 +1,13 @@
package app.revanced.patches.youtube.layout.returnyoutubedislikes.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf("17.14.35", "17.26.35")
)]
)
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class RYDCompatibility

View File

@@ -0,0 +1,25 @@
package app.revanced.patches.youtube.layout.returnyoutubedislikes.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.returnyoutubedislikes.annotations.RYDCompatibility
import org.jf.dexlib2.AccessFlags
@Name("dislike-fingerprint")
@MatchingMethod(
"Luqs;", "<init>"
)
@FuzzyPatternScanMethod(2)
@RYDCompatibility
@Version("0.0.2")
object DislikeFingerprint : MethodFingerprint(
"V",
AccessFlags.PROTECTED or AccessFlags.CONSTRUCTOR,
null,
null,
listOf("like/dislike")
)

View File

@@ -0,0 +1,25 @@
package app.revanced.patches.youtube.layout.returnyoutubedislikes.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.returnyoutubedislikes.annotations.RYDCompatibility
import org.jf.dexlib2.AccessFlags
@Name("like-fingerprint")
@MatchingMethod(
"Luqt;", "<init>"
)
@FuzzyPatternScanMethod(2)
@RYDCompatibility
@Version("0.0.2")
object LikeFingerprint : MethodFingerprint(
"V",
AccessFlags.PROTECTED or AccessFlags.CONSTRUCTOR,
null,
null,
listOf("like/like")
)

View File

@@ -0,0 +1,25 @@
package app.revanced.patches.youtube.layout.returnyoutubedislikes.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.returnyoutubedislikes.annotations.RYDCompatibility
import org.jf.dexlib2.AccessFlags
@Name("remove-like-fingerprint")
@MatchingMethod(
"Luqw;", "<init>"
)
@FuzzyPatternScanMethod(2)
@RYDCompatibility
@Version("0.0.2")
object RemoveLikeFingerprint : MethodFingerprint(
"V",
AccessFlags.PROTECTED or AccessFlags.CONSTRUCTOR,
null,
null,
listOf("like/removelike")
)

View File

@@ -0,0 +1,23 @@
package app.revanced.patches.youtube.layout.returnyoutubedislikes.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.returnyoutubedislikes.annotations.RYDCompatibility
@Name("text-component-spec-parent-fingerprint")
@MatchingMethod(
"Lnvy;", "e"
)
@DirectPatternScanMethod
@RYDCompatibility
@Version("0.0.1")
object TextComponentSpecParentFingerprint : MethodFingerprint(
null,
null,
null,
null,
listOf("TextComponentSpec: No converter for extension: ")
)

View File

@@ -0,0 +1,79 @@
package app.revanced.patches.youtube.layout.returnyoutubedislikes.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.youtube.layout.returnyoutubedislikes.annotations.RYDCompatibility
import app.revanced.patches.youtube.layout.returnyoutubedislikes.fingerprints.TextComponentSpecParentFingerprint
import app.revanced.patches.youtube.layout.returnyoutubedislikes.fingerprints.DislikeFingerprint
import app.revanced.patches.youtube.layout.returnyoutubedislikes.fingerprints.LikeFingerprint
import app.revanced.patches.youtube.layout.returnyoutubedislikes.fingerprints.RemoveLikeFingerprint
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.videoid.patch.VideoIdPatch
@Patch
@Dependencies(dependencies = [IntegrationsPatch::class, VideoIdPatch::class])
@Name("return-youtube-dislikes")
@Description("Shows the dislike count of videos.")
@RYDCompatibility
@Version("0.0.1")
class RYDPatch : BytecodePatch(
listOf(
TextComponentSpecParentFingerprint, LikeFingerprint, DislikeFingerprint, RemoveLikeFingerprint
)
) {
override fun execute(data: BytecodeData): PatchResult {
LikeFingerprint.result!!.mutableMethod.addInstructions(
0,
"""
const/4 v0, 1
invoke-static {v0}, Lapp/revanced/integrations/patches/ReturnYouTubeDislikesPatch;->sendVote(I)V
"""
)
DislikeFingerprint.result!!.mutableMethod.addInstructions(
0,
"""
const/4 v0, -1
invoke-static {v0}, Lapp/revanced/integrations/patches/ReturnYouTubeDislikesPatch;->sendVote(I)V
"""
)
RemoveLikeFingerprint.result!!.mutableMethod.addInstructions(
0,
"""
const/4 v0, 0
invoke-static {v0}, Lapp/revanced/integrations/patches/ReturnYouTubeDislikesPatch;->sendVote(I)V
"""
)
VideoIdPatch.injectCall("Lapp/revanced/integrations/patches/ReturnYouTubeDislikesPatch;->newVideoLoaded(Ljava/lang/String;)V")
val parentResult = TextComponentSpecParentFingerprint.result!!
val createComponentMethod = parentResult.mutableClass.methods.find { method ->
method.parameters.size >= 19 && method.parameterTypes.takeLast(4)
.all { param -> param == "Ljava/util/concurrent/atomic/AtomicReference;" }
}
?: return PatchResultError("TextComponentSpec.createComponent not found")
val conversionContextParam = 5
val textRefParam = createComponentMethod.parameters.size - 2
createComponentMethod.addInstructions(
0,
"""
move-object/from16 v0, p$conversionContextParam
move-object/from16 v1, p$textRefParam
invoke-static {v0, v1}, Lapp/revanced/integrations/patches/ReturnYouTubeDislikesPatch;->onComponentCreated(Ljava/lang/Object;Ljava/util/concurrent/atomic/AtomicReference;)V
"""
)
return PatchResultSuccess()
}
}

View File

@@ -56,7 +56,7 @@ class CustomPlaybackSpeedPatch : BytecodePatch(
val arrayLengthConstDestination = (arrayLengthConst as OneRegisterInstruction).registerA
val videoSpeedsArrayType = "Lapp/revanced/integrations/videoplayer/videosettings/VideoSpeed;->videoSpeeds:[F"
val videoSpeedsArrayType = "Lapp/revanced/integrations/patches/VideoSpeedPatch;->videoSpeeds:[F"
arrayGenMethod.addInstructions(
arrayLengthConstIndex + 1,

View File

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

View File

@@ -11,25 +11,34 @@ import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
@Name("hdrbrightness-fingerprint")
@Name("hdr-brightness-fingerprint-ghz")
@MatchingMethod(
"Lghz;", "mZ"
"Lghz;", "g"
)
@FuzzyPatternScanMethod(3)
@HDRBrightnessCompatibility
@Version("0.0.1")
object HDRBrightnessFingerprint : MethodFingerprint(
object HDRBrightnessFingerprintGHZ : MethodFingerprint(
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, null,
listOf(
/* WindowManager.LayoutParams lp = br.getWindow().getAttributes();
* lp.screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_FULL;
* br.getWindow().setAttributes(lp);
*/
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CONST_HIGH16,
Opcode.IPUT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_VIRTUAL
),
null,
customFingerprint = { methodDef ->
methodDef.implementation!!.instructions.count() == 16 && methodDef.implementation!!.instructions.any {((it as? NarrowLiteralInstruction)?.narrowLiteral == (-1.0f).toRawBits())}
methodDef.implementation!!.instructions.count() == 16 && methodDef.implementation!!.instructions.any {
((it as? NarrowLiteralInstruction)?.narrowLiteral == (/*BRIGHTNESS_OVERRIDE_FULL*/ 1.0f).toRawBits())
}
}
)
)

View File

@@ -0,0 +1,44 @@
package app.revanced.patches.youtube.misc.hdrbrightness.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.hdrbrightness.annotations.HDRBrightnessCompatibility
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
@Name("hdr-brightness-fingerprint-gul")
@MatchingMethod(
"Lgul;", "g"
)
@FuzzyPatternScanMethod(3)
@HDRBrightnessCompatibility
@Version("0.0.1")
object HDRBrightnessFingerprintGUL : MethodFingerprint(
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, null,
listOf(
/* WindowManager.LayoutParams lp = br.getWindow().getAttributes();
* lp.screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_FULL;
* br.getWindow().setAttributes(lp);
*/
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CONST_HIGH16,
Opcode.IPUT,
//Opcode.INVOKE_VIRTUAL,
//Opcode.MOVE_RESULT_OBJECT,
//Opcode.INVOKE_VIRTUAL
),
null,
customFingerprint = { methodDef ->
methodDef.implementation!!.instructions.count() == 14 && methodDef.implementation!!.instructions.any {
((it as? NarrowLiteralInstruction)?.narrowLiteral == (/*BRIGHTNESS_OVERRIDE_FULL*/ 1.0f).toRawBits())
}
}
)

View File

@@ -0,0 +1,44 @@
package app.revanced.patches.youtube.misc.hdrbrightness.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.hdrbrightness.annotations.HDRBrightnessCompatibility
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
@Name("hdr-brightness-fingerprint-tio")
@MatchingMethod(
"Ltio;", "g"
)
@FuzzyPatternScanMethod(3)
@HDRBrightnessCompatibility
@Version("0.0.1")
object HDRBrightnessFingerprintTIO : MethodFingerprint(
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, null,
listOf(
/* WindowManager.LayoutParams lp = br.getWindow().getAttributes();
* lp.screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_FULL;
* br.getWindow().setAttributes(lp);
*/
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CONST_HIGH16,
Opcode.IPUT,
//Opcode.INVOKE_VIRTUAL,
//Opcode.MOVE_RESULT_OBJECT,
//Opcode.INVOKE_VIRTUAL
),
null,
customFingerprint = { methodDef ->
methodDef.implementation!!.instructions.count() == 22 && methodDef.implementation!!.instructions.any {
((it as? NarrowLiteralInstruction)?.narrowLiteral == (/*BRIGHTNESS_OVERRIDE_FULL*/ 1.0f).toRawBits())
}
}
)

View File

@@ -0,0 +1,44 @@
package app.revanced.patches.youtube.misc.hdrbrightness.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.hdrbrightness.annotations.HDRBrightnessCompatibility
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.reference.FieldReference
@Name("hdr-brightness-fingerprint-xxz")
@MatchingMethod(
"Lxxz;", "G"
)
@FuzzyPatternScanMethod(3)
@HDRBrightnessCompatibility
@Version("0.0.1")
object HDRBrightnessFingerprintXXZ : MethodFingerprint(
"V", AccessFlags.PUBLIC or AccessFlags.FINAL,
listOf("I", "I", "I", "I"),
listOf(
Opcode.SGET_OBJECT,
Opcode.IGET_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.IGET,
Opcode.IPUT,
Opcode.IGET_OBJECT,
Opcode.INVOKE_VIRTUAL
),
null,
customFingerprint = { methodDef ->
methodDef.implementation!!.instructions.any {
((it as? ReferenceInstruction)?.reference as? FieldReference)?.let { field ->
// iput vx, vy, Landroid/view/WindowManager$LayoutParams;->screenBrightness:F
field.definingClass == "Landroid/view/WindowManager\$LayoutParams;" && field.name == "screenBrightness"
} == true
}
}
)

View File

@@ -8,41 +8,49 @@ import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.youtube.misc.hdrbrightness.annotations.HDRBrightnessCompatibility
import app.revanced.patches.youtube.misc.hdrbrightness.fingerprints.HDRBrightnessFingerprint
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
import app.revanced.patches.youtube.misc.hdrbrightness.fingerprints.HDRBrightnessFingerprintXXZ
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
import org.jf.dexlib2.iface.reference.FieldReference
@Patch
@Name("hdr-max-brightness")
@Description("Sets brightness to max for HDR videos in fullscreen mode.")
@Patch(false)
@Name("hdr-auto-brightness")
@Description("Makes the brightness of HDR videos follow the system default.")
@HDRBrightnessCompatibility
@Version("0.0.1")
@Version("0.0.2")
@Dependencies([IntegrationsPatch::class])
class HDRBrightnessPatch : BytecodePatch(
listOf(
HDRBrightnessFingerprint
HDRBrightnessFingerprintXXZ
)
) {
override fun execute(data: BytecodeData): PatchResult {
val result = HDRBrightnessFingerprint.result
val method = HDRBrightnessFingerprintXXZ.result?.mutableMethod
?: return PatchResultError("HDRBrightnessFingerprint could not resolve the method!")
method.implementation!!.instructions.filter {
((it as? ReferenceInstruction)?.reference as? FieldReference)?.let { field ->
// iput vx, vy, Landroid/view/WindowManager$LayoutParams;->screenBrightness:F
field.definingClass == "Landroid/view/WindowManager\$LayoutParams;" && field.name == "screenBrightness"
} == true
}.forEach { instruction ->
// inject right before the call that sets 'screenBrightness'
val index = method.implementation!!.instructions.indexOf(instruction)
val register = (instruction as TwoRegisterInstruction).registerA
val method = result.mutableMethod
//Get the index here, so we know where to inject our code to override -1.0f
val index = method.implementation!!.instructions.indexOfFirst { ((it as? NarrowLiteralInstruction)?.narrowLiteral == (-1.0f).toRawBits()) }
val register = (method.implementation!!.instructions.get(index) as OneRegisterInstruction).registerA
method.addInstructions(
index + 1, """
// inject the call to
method.addInstructions(
index, """
invoke-static {v$register}, Lapp/revanced/integrations/patches/HDRMaxBrightnessPatch;->getHDRBrightness(F)F
move-result v$register
"""
)
)
}
return PatchResultSuccess()
}
}

View File

@@ -0,0 +1,13 @@
package app.revanced.patches.youtube.misc.playeroverlay.annotation
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf("17.24.34", "17.25.34", "17.26.35")
)]
)
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class PlayerOverlaysHookCompatibility

View File

@@ -0,0 +1,21 @@
package app.revanced.patches.youtube.misc.playeroverlay.fingerprint
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.playeroverlay.annotation.PlayerOverlaysHookCompatibility
@Name("player-overlays-onFinishInflate-fingerprint")
@MatchingMethod(
"LYouTubePlayerOverlaysLayout;", "onFinishInflate"
)
@DirectPatternScanMethod
@PlayerOverlaysHookCompatibility
@Version("0.0.1")
object PlayerOverlaysOnFinishInflateFingerprint : MethodFingerprint(
null, null, null, null, null, { methodDef ->
methodDef.definingClass.endsWith("YouTubePlayerOverlaysLayout;") && methodDef.name == "onFinishInflate"
}
)

View File

@@ -0,0 +1,35 @@
package app.revanced.patches.youtube.misc.playeroverlay.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.playeroverlay.annotation.PlayerOverlaysHookCompatibility
import app.revanced.patches.youtube.misc.playeroverlay.fingerprint.PlayerOverlaysOnFinishInflateFingerprint
@Name("player-overlays-hook")
@Description("hook for adding custom overlays to the video player.")
@PlayerOverlaysHookCompatibility
@Version("0.0.1")
@Dependencies(dependencies = [IntegrationsPatch::class])
class PlayerOverlaysHookPatch : BytecodePatch(
listOf(
PlayerOverlaysOnFinishInflateFingerprint
)
) {
override fun execute(data: BytecodeData): PatchResult {
// hook YouTubePlayerOverlaysLayout.onFinishInflate()
val method = PlayerOverlaysOnFinishInflateFingerprint.result!!.mutableMethod
method.addInstruction(
method.implementation!!.instructions.size - 2,
"invoke-static { p0 }, Lapp/revanced/integrations/patches/PlayerOverlaysHookPatch;->YouTubePlayerOverlaysLayout_onFinishInflateHook(Ljava/lang/Object;)V"
)
return PatchResultSuccess()
}
}

View File

@@ -0,0 +1,13 @@
package app.revanced.patches.youtube.misc.videoid.annotation
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf("17.14.35", "17.22.36", "17.26.35")
)]
)
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class VideoIdCompatibility

View File

@@ -0,0 +1,28 @@
package app.revanced.patches.youtube.misc.videoid.fingerprint
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.videoid.annotation.VideoIdCompatibility
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@Name("video-id-fingerprint")
@MatchingMethod(
"Lcom/google/android/apps/youtube/app/common/player/PlaybackLifecycleMonitor;", "l"
)
@DirectPatternScanMethod
@VideoIdCompatibility
@Version("0.0.1")
object VideoIdFingerprint : MethodFingerprint(
"V",
AccessFlags.DECLARED_SYNCHRONIZED or AccessFlags.FINAL or AccessFlags.PUBLIC,
listOf("L"),
listOf(Opcode.INVOKE_INTERFACE),
customFingerprint = {
it.definingClass.endsWith("PlaybackLifecycleMonitor;")
}
)

View File

@@ -0,0 +1,56 @@
package app.revanced.patches.youtube.misc.videoid.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.videoid.annotation.VideoIdCompatibility
import app.revanced.patches.youtube.misc.videoid.fingerprint.VideoIdFingerprint
import org.jf.dexlib2.iface.instruction.formats.Instruction11x
@Name("video-id-hook")
@Description("hook to detect when the video id changes")
@VideoIdCompatibility
@Version("0.0.1")
@Dependencies(dependencies = [IntegrationsPatch::class])
class VideoIdPatch : BytecodePatch(
listOf(
VideoIdFingerprint
)
) {
override fun execute(data: BytecodeData): PatchResult {
injectCall("Lapp/revanced/integrations/videoplayer/VideoInformation;->setCurrentVideoId(Ljava/lang/String;)V")
return PatchResultSuccess()
}
companion object {
private var offset = 2
/**
* Adds an invoke-static instruction, called with the new id when the video changes
* @param methodDescriptor which method to call. Params have to be `Ljava/lang/String;`
*/
fun injectCall(
methodDescriptor: String
) {
val result = VideoIdFingerprint.result!!
val method = result.mutableMethod
val videoIdRegister =
(method.implementation!!.instructions[result.patternScanResult!!.endIndex + 1] as Instruction11x).registerA
method.addInstructions(
result.patternScanResult!!.endIndex + offset, // after the move-result-object
"invoke-static {v$videoIdRegister}, $methodDescriptor"
)
offset++ // so additional instructions get added later
}
}
}