mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-31 06:31:02 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b0d6cee4db | ||
|
|
6bbcdf8ebd | ||
|
|
6fa8289ca6 | ||
|
|
97dbb43caa |
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,3 +1,17 @@
|
|||||||
|
# [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)
|
# [2.14.0](https://github.com/revanced/revanced-patches/compare/v2.13.6...v2.14.0) (2022-07-15)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
13
README.md
13
README.md
@@ -6,12 +6,12 @@
|
|||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🎯 Target Package | 🏹 Target Version |
|
| 💊 Patch | 📜 Description | 🎯 Target Package | 🏹 Target Version |
|
||||||
|:--------:|:--------------:|:-----------------:|:-----------------:|
|
|:--------:|:--------------:|:-----------------:|:-----------------:|
|
||||||
| `music-video-ads` | Removes ads in the YouTube Music player. | `com.google.android.apps.youtube.music` | 5.3.50 |
|
| `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.3.50 |
|
| `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.3.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.14.53 |
|
||||||
| `background-play` | Enables playing music in the background. | `com.google.android.apps.youtube.music` | 5.3.50 |
|
| `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.3.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.14.53 |
|
||||||
| `upgrade-button-remover` | Removes the upgrade tab from the pivot bar in YouTube Music. | `com.google.android.apps.youtube.music` | 5.3.50 |
|
| `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 |
|
| `hide-infocard-suggestions` | Hides infocards in videos. | `com.google.android.youtube` | 17.26.35 |
|
||||||
| `video-ads` | Removes ads in the YouTube video player. | `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 |
|
| `general-ads` | Removes general ads in bytecode. | `com.google.android.youtube` | 17.26.35 |
|
||||||
@@ -30,6 +30,7 @@
|
|||||||
| `premium-heading` | Shows premium branding on the YouTube home screen. | `com.google.android.youtube` | all |
|
| `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 |
|
| `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 |
|
| `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 |
|
| `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 |
|
| `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 |
|
| `disable-create-button` | Disables the create button. | `com.google.android.youtube` | 17.26.35 |
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.14.0
|
version = 2.15.0
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
|||||||
|
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package(
|
[Package(
|
||||||
"com.google.android.apps.youtube.music", arrayOf("5.03.50")
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
|||||||
|
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package(
|
[Package(
|
||||||
"com.google.android.apps.youtube.music", arrayOf("5.03.50")
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
|||||||
@@ -20,8 +20,9 @@ import org.jf.dexlib2.Opcode
|
|||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
object CodecsLockFingerprint : MethodFingerprint(
|
object CodecsLockFingerprint : MethodFingerprint(
|
||||||
"L", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L", "L", "L", "L"), listOf(
|
"L", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L", "L", "L", "L"), listOf(
|
||||||
Opcode.INVOKE_STATIC,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.CHECK_CAST,
|
||||||
Opcode.INVOKE_DIRECT,
|
Opcode.INVOKE_DIRECT,
|
||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.MOVE_RESULT,
|
Opcode.MOVE_RESULT,
|
||||||
@@ -29,18 +30,11 @@ object CodecsLockFingerprint : MethodFingerprint(
|
|||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.MOVE_RESULT,
|
Opcode.MOVE_RESULT,
|
||||||
Opcode.IF_NEZ,
|
Opcode.IF_NEZ,
|
||||||
Opcode.SGET,
|
Opcode.SGET_OBJECT,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
Opcode.INVOKE_STATIC,
|
Opcode.INVOKE_STATIC,
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
Opcode.INVOKE_INTERFACE,
|
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.INVOKE_DIRECT,
|
||||||
Opcode.RETURN_OBJECT
|
Opcode.RETURN_OBJECT
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
|||||||
|
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package(
|
[Package(
|
||||||
"com.google.android.apps.youtube.music", arrayOf("5.03.50")
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
|||||||
|
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package(
|
[Package(
|
||||||
"com.google.android.apps.youtube.music", arrayOf("5.03.50")
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
|||||||
|
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package(
|
[Package(
|
||||||
"com.google.android.apps.youtube.music", arrayOf("5.03.50")
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
|
|||||||
|
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package(
|
[Package(
|
||||||
"com.google.android.apps.youtube.music", arrayOf("5.03.50")
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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")
|
||||||
|
)
|
||||||
@@ -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")
|
||||||
|
)
|
||||||
@@ -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")
|
||||||
|
)
|
||||||
@@ -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: ")
|
||||||
|
)
|
||||||
@@ -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()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
@@ -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;")
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user