mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-28 05:01:03 +00:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1177c41373 | ||
|
|
be4de62c8f | ||
|
|
528156aec9 | ||
|
|
e377ecf208 | ||
|
|
fa147bd6cc | ||
|
|
88211e28ca | ||
|
|
a4e3a97937 | ||
|
|
02bd807a27 | ||
|
|
a06e81ae39 | ||
|
|
a87d0bc440 | ||
|
|
a2b64f63e0 | ||
|
|
80ab1592c3 | ||
|
|
e17f476c46 | ||
|
|
bfa9abe4cf | ||
|
|
0e0118eaa6 | ||
|
|
7b6439b200 |
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@@ -19,10 +19,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Setup JDK
|
- name: Setup JDK
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
java-version: '17'
|
java-version: '17'
|
||||||
distribution: 'adopt'
|
distribution: 'temurin'
|
||||||
cache: gradle
|
cache: gradle
|
||||||
- name: Setup Android SDK
|
- name: Setup Android SDK
|
||||||
uses: android-actions/setup-android@v2
|
uses: android-actions/setup-android@v2
|
||||||
|
|||||||
42
CHANGELOG.md
42
CHANGELOG.md
@@ -1,3 +1,45 @@
|
|||||||
|
## [2.104.2](https://github.com/revanced/revanced-patches/compare/v2.104.1...v2.104.2) (2022-11-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **youtube/hide-endscreen-cards:** restore functionality ([#993](https://github.com/revanced/revanced-patches/issues/993)) ([eb1bae2](https://github.com/revanced/revanced-patches/commit/eb1bae2c55e65ad29030dce6746a18662dd0fe25))
|
||||||
|
|
||||||
|
## [2.104.1](https://github.com/revanced/revanced-patches/compare/v2.104.0...v2.104.1) (2022-11-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **youtube/general-ads:** incorrect description for info panels ([77b029e](https://github.com/revanced/revanced-patches/commit/77b029e82e481a13516b1c8a888c42817507cdea))
|
||||||
|
* **youtube/hide-info-cards:** remove initial popup of info-cards ([#992](https://github.com/revanced/revanced-patches/issues/992)) ([19f3f03](https://github.com/revanced/revanced-patches/commit/19f3f038585c313a969adf3d4095a60ab4c83ede))
|
||||||
|
|
||||||
|
# [2.104.0](https://github.com/revanced/revanced-patches/compare/v2.103.0...v2.104.0) (2022-11-06)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **hexeditor:** `disable-ads` patch ([#973](https://github.com/revanced/revanced-patches/issues/973)) ([a48e5fd](https://github.com/revanced/revanced-patches/commit/a48e5fd50dcf9ee061ffd5c5ed0b997067f40652))
|
||||||
|
|
||||||
|
# [2.103.0](https://github.com/revanced/revanced-patches/compare/v2.102.1...v2.103.0) (2022-11-05)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* apply multiple changes from integrations, refactor package structure, class names and implementations ([e756fac](https://github.com/revanced/revanced-patches/commit/e756face362e4abf2c7b17afa536feed9b0cd631))
|
||||||
|
* **youtube/video-information:** use correct compatibility annotation ([b42e048](https://github.com/revanced/revanced-patches/commit/b42e04884bb9a60c3df30b668bfba55b1cf8eaa4))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **debugging:** simplify patch name and description ([61762f7](https://github.com/revanced/revanced-patches/commit/61762f76c457f348ef599e146f3853e941d4c45c))
|
||||||
|
|
||||||
|
## [2.102.1](https://github.com/revanced/revanced-patches/compare/v2.102.0...v2.102.1) (2022-11-04)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* use original app name ([#977](https://github.com/revanced/revanced-patches/issues/977)) ([ffc3c08](https://github.com/revanced/revanced-patches/commit/ffc3c08d96734893121397d506a97bd50b06bc1d))
|
||||||
|
|
||||||
# [2.102.0](https://github.com/revanced/revanced-patches/compare/v2.101.0...v2.102.0) (2022-11-03)
|
# [2.102.0](https://github.com/revanced/revanced-patches/compare/v2.101.0...v2.102.0) (2022-11-03)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
17
README.md
17
README.md
@@ -50,6 +50,14 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `promo-code-unlock` | Disables the validation of promo code. Any code will work to unlock all features. | all |
|
| `promo-code-unlock` | Disables the validation of promo code. Any code will work to unlock all features. | all |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
### 📦 `com.myprog.hexedit`
|
||||||
|
<details>
|
||||||
|
|
||||||
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|
|:--------:|:--------------:|:-----------------:|
|
||||||
|
| `disable-ads` | Disables ads in HexEditor. | all |
|
||||||
|
</details>
|
||||||
|
|
||||||
### 📦 `com.spotify.music`
|
### 📦 `com.spotify.music`
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
@@ -73,6 +81,7 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `hide-shorts-button` | Hides the shorts button on the navigation bar. | 17.43.36 |
|
| `hide-shorts-button` | Hides the shorts button on the navigation bar. | 17.43.36 |
|
||||||
| `hide-create-button` | Hides the create button in the navigation bar. | 17.43.36 |
|
| `hide-create-button` | Hides the create button in the navigation bar. | 17.43.36 |
|
||||||
| `disable-startup-shorts-player` | Disables playing YouTube Shorts when launching YouTube. | 17.43.36 |
|
| `disable-startup-shorts-player` | Disables playing YouTube Shorts when launching YouTube. | 17.43.36 |
|
||||||
|
| `hide-endscreen-cards` | Hides the suggested video cards at the end of a video in fullscreen. | 17.43.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 |
|
||||||
| `sponsorblock` | Integrate SponsorBlock. | 17.43.36 |
|
| `sponsorblock` | Integrate SponsorBlock. | 17.43.36 |
|
||||||
| `hide-autoplay-button` | Hides the autoplay button in the video player. | 17.43.36 |
|
| `hide-autoplay-button` | Hides the autoplay button in the video player. | 17.43.36 |
|
||||||
@@ -88,13 +97,13 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `hide-email-address` | Hides the email address in the account switcher. | 17.43.36 |
|
| `hide-email-address` | Hides the email address in the account switcher. | 17.43.36 |
|
||||||
| `tablet-mini-player` | Enables the tablet mini player layout. | 17.43.36 |
|
| `tablet-mini-player` | Enables the tablet mini player layout. | 17.43.36 |
|
||||||
| `hide-watermark` | Hides creator's watermarks on videos. | 17.43.36 |
|
| `hide-watermark` | Hides creator's watermarks on videos. | 17.43.36 |
|
||||||
|
| `hide-info-cards` | Hides info-cards in videos. | 17.43.36 |
|
||||||
| `hide-my-mix` | Hides mix playlists. | 17.43.36 |
|
| `hide-my-mix` | Hides mix playlists. | 17.43.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 |
|
||||||
| `premium-heading` | Shows premium branding on the home screen. | all |
|
| `premium-heading` | Shows premium branding on the home screen. | all |
|
||||||
| `old-quality-layout` | Enables the original quality flyout menu. | 17.43.36 |
|
| `old-quality-layout` | Enables the original quality flyout menu. | 17.43.36 |
|
||||||
| `general-ads` | Removes general ads. | 17.43.36 |
|
| `general-ads` | Removes general ads. | 17.43.36 |
|
||||||
| `video-ads` | Removes ads in the video player. | 17.43.36 |
|
| `video-ads` | Removes ads in the video player. | 17.43.36 |
|
||||||
| `hide-infocard-suggestions` | Hides infocards in videos. | 17.43.36 |
|
|
||||||
| `swipe-controls` | Adds volume and brightness swipe controls. | 17.43.36 |
|
| `swipe-controls` | Adds volume and brightness swipe controls. | 17.43.36 |
|
||||||
| `downloads` | Enables downloading music and videos from YouTube. | 17.43.36 |
|
| `downloads` | Enables downloading music and videos from YouTube. | 17.43.36 |
|
||||||
| `seekbar-tapping` | Enables tap-to-seek on the seekbar of the video player. | 17.43.36 |
|
| `seekbar-tapping` | Enables tap-to-seek on the seekbar of the video player. | 17.43.36 |
|
||||||
@@ -103,10 +112,10 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `custom-video-buffer` | Lets you change the buffers of videos. | 17.43.36 |
|
| `custom-video-buffer` | Lets you change the buffers of videos. | 17.43.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 |
|
||||||
| `always-autorepeat` | Always repeats the playing video again. | 17.43.36 |
|
| `always-autorepeat` | Always repeats the playing video again. | 17.43.36 |
|
||||||
| `enable-debugging` | Enables app debugging by patching the manifest file. | all |
|
| `debugging` | Adds debugging options. | all |
|
||||||
| `remember-video-quality` | Adds the ability to remember the video quality you chose in the video quality flyout. | 17.43.36 |
|
|
||||||
| `minimized-playback` | Enables minimized and background playback. | 17.43.36 |
|
| `minimized-playback` | Enables minimized and background playback. | 17.43.36 |
|
||||||
| `custom-playback-speed` | Adds more video playback speed options. | 17.43.36 |
|
| `custom-video-speed` | Adds more video speed options. | 17.43.36 |
|
||||||
|
| `remember-video-quality` | Adds the ability to remember the video quality you chose in the video quality flyout. | 17.43.36 |
|
||||||
| `hdr-auto-brightness` | Makes the brightness of HDR videos follow the system default. | 17.43.36 |
|
| `hdr-auto-brightness` | Makes the brightness of HDR videos follow the system default. | 17.43.36 |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.102.0
|
version = 2.104.2
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,13 @@
|
|||||||
|
package app.revanced.patches.hexeditor.ad.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility(
|
||||||
|
[
|
||||||
|
Package("com.myprog.hexedit")
|
||||||
|
]
|
||||||
|
)
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class HexEditorAdsCompatibility
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package app.revanced.patches.hexeditor.ad.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.hexeditor.ad.annotations.HexEditorAdsCompatibility
|
||||||
|
|
||||||
|
@Name("ads-fingerprint-primary")
|
||||||
|
@HexEditorAdsCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object PrimaryAdsFingerprint : MethodFingerprint(
|
||||||
|
customFingerprint = { methodDef ->
|
||||||
|
methodDef.definingClass.endsWith("PreferencesHelper;") && methodDef.name == "isAdsDisabled"
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package app.revanced.patches.hexeditor.ad.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.removeInstruction
|
||||||
|
import app.revanced.patcher.extensions.replaceInstructions
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patches.hexeditor.ad.annotations.HexEditorAdsCompatibility
|
||||||
|
import app.revanced.patches.hexeditor.ad.fingerprints.PrimaryAdsFingerprint
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("disable-ads")
|
||||||
|
@Description("Disables ads in HexEditor.")
|
||||||
|
@HexEditorAdsCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class HexEditorAdsPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
PrimaryAdsFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
val method = PrimaryAdsFingerprint.result!!.mutableMethod
|
||||||
|
|
||||||
|
method.replaceInstructions(
|
||||||
|
0,
|
||||||
|
"""
|
||||||
|
const/4 v0, 0x1
|
||||||
|
return v0
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package app.revanced.patches.music.misc.microg.shared
|
package app.revanced.patches.music.misc.microg.shared
|
||||||
|
|
||||||
object Constants {
|
object Constants {
|
||||||
internal const val REVANCED_MUSIC_APP_NAME = "YouTube Music ReVanced"
|
internal const val REVANCED_MUSIC_APP_NAME = "YT Music ReVanced"
|
||||||
internal const val REVANCED_MUSIC_PACKAGE_NAME = "app.revanced.android.apps.youtube.music"
|
internal const val REVANCED_MUSIC_PACKAGE_NAME = "app.revanced.android.apps.youtube.music"
|
||||||
internal const val MUSIC_PACKAGE_NAME = "com.google.android.apps.youtube.music"
|
internal const val MUSIC_PACKAGE_NAME = "com.google.android.apps.youtube.music"
|
||||||
internal const val SPOOFED_PACKAGE_NAME = MUSIC_PACKAGE_NAME
|
internal const val SPOOFED_PACKAGE_NAME = MUSIC_PACKAGE_NAME
|
||||||
internal const val SPOOFED_PACKAGE_SIGNATURE = "afb0fed5eeaebdd86f56a97742f4b6b33ef59875"
|
internal const val SPOOFED_PACKAGE_SIGNATURE = "afb0fed5eeaebdd86f56a97742f4b6b33ef59875"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,11 +29,9 @@ import app.revanced.patches.youtube.misc.settings.framework.components.impl.Stri
|
|||||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction10x
|
import org.jf.dexlib2.builder.instruction.BuilderInstruction10x
|
||||||
|
import org.jf.dexlib2.dexbacked.instruction.DexBackedInstruction21c
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction21c
|
import org.jf.dexlib2.iface.instruction.formats.*
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction22c
|
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
|
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
|
||||||
import org.jf.dexlib2.iface.reference.FieldReference
|
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
|
import org.jf.dexlib2.iface.reference.StringReference
|
||||||
@@ -53,11 +51,6 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
|
|||||||
"ad_attribution",
|
"ad_attribution",
|
||||||
"reel_multiple_items_shelf",
|
"reel_multiple_items_shelf",
|
||||||
"info_cards_drawer_header",
|
"info_cards_drawer_header",
|
||||||
"endscreen_element_layout_video",
|
|
||||||
"endscreen_element_layout_circle",
|
|
||||||
"endscreen_element_layout_icon",
|
|
||||||
"promoted_video_item_land",
|
|
||||||
"promoted_video_item_full_bleed",
|
|
||||||
).map { name ->
|
).map { name ->
|
||||||
ResourceMappingResourcePatch.resourceMappings.single { it.name == name }.id
|
ResourceMappingResourcePatch.resourceMappings.single { it.name == name }.id
|
||||||
}
|
}
|
||||||
@@ -144,8 +137,8 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
|
|||||||
"revanced_adremover_info_panel",
|
"revanced_adremover_info_panel",
|
||||||
StringResource("revanced_adremover_info_panel_enabled_title", "Remove info panels"),
|
StringResource("revanced_adremover_info_panel_enabled_title", "Remove info panels"),
|
||||||
true,
|
true,
|
||||||
StringResource("revanced_adremover_info_panel_enabled_summary_on", "Merchandise banners are hidden"),
|
StringResource("revanced_adremover_info_panel_enabled_summary_on", "Info panels are hidden"),
|
||||||
StringResource("revanced_adremover_info_panel_enabled_summary_off", "Merchandise banners are shown")
|
StringResource("revanced_adremover_info_panel_enabled_summary_off", "Info panels are shown")
|
||||||
),
|
),
|
||||||
SwitchPreference(
|
SwitchPreference(
|
||||||
"revanced_adremover_medical_panel",
|
"revanced_adremover_medical_panel",
|
||||||
@@ -246,46 +239,6 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
|
|||||||
//ToDo: Add Settings toggle for whatever this is
|
//ToDo: Add Settings toggle for whatever this is
|
||||||
mutableMethod!!.implementation!!.removeInstruction(removeIndex)
|
mutableMethod!!.implementation!!.removeInstruction(removeIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
resourceIds[3], resourceIds[4], resourceIds[5] -> { // end screen ads
|
|
||||||
// and is followed by an instruction with the mnemonic IPUT_OBJECT
|
|
||||||
val insertIndex = index + 7
|
|
||||||
val invokeInstruction = instructions.elementAt(insertIndex)
|
|
||||||
if (invokeInstruction.opcode != Opcode.IPUT_OBJECT) return@forEachIndexed
|
|
||||||
|
|
||||||
// create proxied method, make sure to not re-resolve() the current class
|
|
||||||
if (mutableClass == null) mutableClass = context.proxy(classDef).mutableClass
|
|
||||||
if (mutableMethod == null) mutableMethod =
|
|
||||||
mutableClass!!.findMutableMethodOf(method)
|
|
||||||
|
|
||||||
// TODO: dynamically get registers
|
|
||||||
mutableMethod!!.addInstructions(
|
|
||||||
insertIndex, """
|
|
||||||
const/16 v1, 0x8
|
|
||||||
invoke-virtual {v0,v1}, Landroid/widget/FrameLayout;->setVisibility(I)V
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
resourceIds[6] -> {
|
|
||||||
// and is followed by an instruction with the mnemonic INVOKE_DIRECT
|
|
||||||
val insertIndex = index + 3
|
|
||||||
val invokeInstruction = instructions.elementAt(insertIndex)
|
|
||||||
if (invokeInstruction.opcode != Opcode.INVOKE_DIRECT) return@forEachIndexed
|
|
||||||
|
|
||||||
// create proxied method, make sure to not re-resolve() the current class
|
|
||||||
if (mutableClass == null) mutableClass = context.proxy(classDef).mutableClass
|
|
||||||
if (mutableMethod == null) mutableMethod =
|
|
||||||
mutableClass!!.findMutableMethodOf(method)
|
|
||||||
|
|
||||||
// insert hide call to hide the view corresponding to the resource
|
|
||||||
val viewRegister = (invokeInstruction as Instruction35c).registerE
|
|
||||||
mutableMethod!!.implementation!!.injectHideCall(insertIndex, viewRegister)
|
|
||||||
}
|
|
||||||
|
|
||||||
resourceIds[7] -> {
|
|
||||||
// TODO, go to class, hide the inflated view
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,4 +333,4 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
|
|||||||
instruction.opcode == Opcode.CONST && (instruction as Instruction31i).narrowLiteral == lithoConstant
|
instruction.opcode == Opcode.CONST && (instruction as Instruction31i).narrowLiteral == lithoConstant
|
||||||
} ?: false
|
} ?: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.ad.infocardsuggestions.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.impl.MethodFingerprint
|
|
||||||
import app.revanced.patches.youtube.ad.infocardsuggestions.annotations.HideInfocardSuggestionsCompatibility
|
|
||||||
import org.jf.dexlib2.AccessFlags
|
|
||||||
|
|
||||||
@Name("hide-infocard-suggestions-fingerprint")
|
|
||||||
@FuzzyPatternScanMethod(2)
|
|
||||||
@HideInfocardSuggestionsCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
object HideInfocardSuggestionsFingerprint : MethodFingerprint(
|
|
||||||
"Ljava/lang/Boolean;",
|
|
||||||
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
|
||||||
strings = listOf("vibrator")
|
|
||||||
)
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.ad.infocardsuggestions.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.impl.MethodFingerprint
|
|
||||||
import app.revanced.patches.youtube.ad.infocardsuggestions.annotations.HideInfocardSuggestionsCompatibility
|
|
||||||
import org.jf.dexlib2.AccessFlags
|
|
||||||
|
|
||||||
@Name("hide-infocard-suggestions-parent-fingerprint")
|
|
||||||
@FuzzyPatternScanMethod(2)
|
|
||||||
@HideInfocardSuggestionsCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
object HideInfocardSuggestionsParentFingerprint : MethodFingerprint(
|
|
||||||
"Ljava/lang/String;",
|
|
||||||
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
|
||||||
strings = listOf("player_overlay_info_card_teaser"),
|
|
||||||
)
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.ad.infocardsuggestions.patch
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
import app.revanced.patches.youtube.ad.infocardsuggestions.annotations.HideInfocardSuggestionsCompatibility
|
|
||||||
import app.revanced.patches.youtube.ad.infocardsuggestions.fingerprints.HideInfocardSuggestionsFingerprint
|
|
||||||
import app.revanced.patches.youtube.ad.infocardsuggestions.fingerprints.HideInfocardSuggestionsParentFingerprint
|
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
|
||||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
|
||||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
|
|
||||||
|
|
||||||
@Patch
|
|
||||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
|
||||||
@Name("hide-infocard-suggestions")
|
|
||||||
@Description("Hides infocards in videos.")
|
|
||||||
@HideInfocardSuggestionsCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class HideInfocardSuggestionsPatch : BytecodePatch(
|
|
||||||
listOf(
|
|
||||||
HideInfocardSuggestionsParentFingerprint
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
|
||||||
SettingsPatch.PreferenceScreen.ADS.addPreferences(
|
|
||||||
SwitchPreference(
|
|
||||||
"revanced_info_cards_enabled",
|
|
||||||
StringResource("revanced_info_cards_enabled_title", "Show info-cards"),
|
|
||||||
false,
|
|
||||||
StringResource("revanced_info_cards_enabled_summary_on", "Info-cards are shown"),
|
|
||||||
StringResource("revanced_info_cards_enabled_summary_off", "Info-cards are hidden")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
val parentResult = HideInfocardSuggestionsParentFingerprint.result
|
|
||||||
?: return PatchResultError("Parent fingerprint not resolved!")
|
|
||||||
|
|
||||||
|
|
||||||
HideInfocardSuggestionsFingerprint.resolve(context, parentResult.classDef)
|
|
||||||
val result = HideInfocardSuggestionsFingerprint.result
|
|
||||||
?: return PatchResultError("Required parent method could not be found.")
|
|
||||||
|
|
||||||
val method = result.mutableMethod
|
|
||||||
val implementation = method.implementation
|
|
||||||
?: return PatchResultError("Implementation not found.")
|
|
||||||
|
|
||||||
val index = implementation.instructions.indexOfFirst { ((it as? BuilderInstruction35c)?.reference.toString() == "Landroid/view/View;->setVisibility(I)V") }
|
|
||||||
|
|
||||||
method.replaceInstruction(index, """
|
|
||||||
invoke-static {p1}, Lapp/revanced/integrations/patches/HideInfoCardSuggestionsPatch;->hideInfoCardSuggestions(Landroid/view/View;)V
|
|
||||||
""")
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -15,7 +15,7 @@ import app.revanced.patcher.util.smali.ExternalLabel
|
|||||||
import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility
|
import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility
|
||||||
import app.revanced.patches.youtube.ad.video.fingerprints.LoadVideoAdsFingerprint
|
import app.revanced.patches.youtube.ad.video.fingerprints.LoadVideoAdsFingerprint
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.playback.patch.FixPlaybackPatch
|
import app.revanced.patches.youtube.misc.playback.fix.patch.FixPlaybackPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import app.revanced.patcher.patch.annotations.Patch
|
|||||||
import app.revanced.patches.youtube.interaction.downloads.annotation.DownloadsCompatibility
|
import app.revanced.patches.youtube.interaction.downloads.annotation.DownloadsCompatibility
|
||||||
import app.revanced.patches.youtube.interaction.downloads.resource.patch.DownloadsResourcePatch
|
import app.revanced.patches.youtube.interaction.downloads.resource.patch.DownloadsResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch
|
import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch
|
||||||
import app.revanced.patches.youtube.misc.videoid.patch.VideoIdPatch
|
import app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("downloads")
|
@Name("downloads")
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
package app.revanced.patches.youtube.misc.quality.annotations
|
package app.revanced.patches.youtube.layout.hideendscreencards.annotations
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package(
|
[Package(
|
||||||
"com.google.android.youtube", arrayOf("17.36.37", "17.41.37", "17.42.35", "17.43.36")
|
"com.google.android.youtube", arrayOf("17.36.37", "17.41.37", "17.42.35", "17.43.36")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
internal annotation class DefaultVideoQualityCompatibility
|
internal annotation class HideEndscreenCardsCompatibility
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hideendscreencards.bytecode.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.hideendscreencards.annotations.HideEndscreenCardsCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.hideendscreencards.resource.patch.HideEndscreenCardsResourcePatch
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
||||||
|
|
||||||
|
@Name("layout-circle-fingerprint")
|
||||||
|
@HideEndscreenCardsCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object LayoutCircleFingerprint : MethodFingerprint(
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.CONST,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.CHECK_CAST,
|
||||||
|
),
|
||||||
|
customFingerprint = { methodDef ->
|
||||||
|
methodDef.implementation?.instructions?.any { instruction ->
|
||||||
|
instruction.opcode.ordinal == Opcode.CONST.ordinal &&
|
||||||
|
(instruction as? WideLiteralInstruction)?.wideLiteral == HideEndscreenCardsResourcePatch.layoutCircle
|
||||||
|
} == true
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hideendscreencards.bytecode.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.hideendscreencards.annotations.HideEndscreenCardsCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.hideendscreencards.resource.patch.HideEndscreenCardsResourcePatch
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
||||||
|
|
||||||
|
@Name("layout-icon-fingerprint")
|
||||||
|
@HideEndscreenCardsCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object LayoutIconFingerprint : MethodFingerprint(
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.CONST,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.CHECK_CAST,
|
||||||
|
),
|
||||||
|
customFingerprint = { methodDef ->
|
||||||
|
methodDef.implementation?.instructions?.any { instruction ->
|
||||||
|
instruction.opcode.ordinal == Opcode.CONST.ordinal &&
|
||||||
|
(instruction as? WideLiteralInstruction)?.wideLiteral == HideEndscreenCardsResourcePatch.layoutIcon
|
||||||
|
} == true
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hideendscreencards.bytecode.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.hideendscreencards.annotations.HideEndscreenCardsCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.hideendscreencards.resource.patch.HideEndscreenCardsResourcePatch
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
||||||
|
|
||||||
|
@Name("layout-video-fingerprint")
|
||||||
|
@HideEndscreenCardsCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object LayoutVideoFingerprint : MethodFingerprint(
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.CONST,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.CHECK_CAST,
|
||||||
|
),
|
||||||
|
customFingerprint = { methodDef ->
|
||||||
|
methodDef.implementation?.instructions?.any { instruction ->
|
||||||
|
instruction.opcode.ordinal == Opcode.CONST.ordinal &&
|
||||||
|
(instruction as? WideLiteralInstruction)?.wideLiteral == HideEndscreenCardsResourcePatch.layoutVideo
|
||||||
|
} == true
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hideendscreencards.bytecode.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
import app.revanced.patcher.fingerprint.Fingerprint
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
|
import app.revanced.patches.youtube.layout.hideendscreencards.annotations.HideEndscreenCardsCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.hideendscreencards.bytecode.fingerprints.LayoutCircleFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.hideendscreencards.bytecode.fingerprints.LayoutIconFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.hideendscreencards.bytecode.fingerprints.LayoutVideoFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.hideendscreencards.resource.patch.HideEndscreenCardsResourcePatch
|
||||||
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
|
import org.jf.dexlib2.iface.instruction.formats.Instruction21c
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@DependsOn([IntegrationsPatch::class, HideEndscreenCardsResourcePatch::class])
|
||||||
|
@Name("hide-endscreen-cards")
|
||||||
|
@Description("Hides the suggested video cards at the end of a video in fullscreen.")
|
||||||
|
@HideEndscreenCardsCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class HideEndscreenCardsPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
LayoutCircleFingerprint,
|
||||||
|
LayoutIconFingerprint,
|
||||||
|
LayoutVideoFingerprint,
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
fun MethodFingerprint.injectHideCall() {
|
||||||
|
val layoutResult = result!!
|
||||||
|
val layoutMethod = layoutResult.mutableMethod
|
||||||
|
|
||||||
|
val checkCastIndex = layoutResult.scanResult.patternScanResult!!.endIndex
|
||||||
|
val viewRegister = (layoutMethod.instruction(checkCastIndex) as Instruction21c).registerA
|
||||||
|
|
||||||
|
layoutMethod.addInstruction(
|
||||||
|
checkCastIndex + 1,
|
||||||
|
"invoke-static { v$viewRegister }, Lapp/revanced/integrations/patches/HideEndscreenCardsPatch;->hideEndscreen(Landroid/view/View;)V"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
listOf(LayoutCircleFingerprint, LayoutIconFingerprint, LayoutVideoFingerprint).forEach(MethodFingerprint::injectHideCall)
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hideendscreencards.resource.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.ResourceContext
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patches.youtube.layout.hideendscreencards.annotations.HideEndscreenCardsCompatibility
|
||||||
|
import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||||
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
||||||
|
|
||||||
|
@Name("hide-endscreen-cards-resource-patch")
|
||||||
|
@HideEndscreenCardsCompatibility
|
||||||
|
@DependsOn([SettingsPatch::class, ResourceMappingResourcePatch::class])
|
||||||
|
@Version("0.0.1")
|
||||||
|
class HideEndscreenCardsResourcePatch : ResourcePatch {
|
||||||
|
internal companion object {
|
||||||
|
var layoutCircle: Long = -1
|
||||||
|
var layoutIcon: Long = -1
|
||||||
|
var layoutVideo: Long = -1
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_hide_endscreen_cards",
|
||||||
|
StringResource("revanced_hide_endscreen_cards_title", "Hide end-screen cards"),
|
||||||
|
true,
|
||||||
|
StringResource("revanced_hide_endscreen_cards_summary_on", "End-screen cards are hidden"),
|
||||||
|
StringResource("revanced_hide_endscreen_cards_summary_off", "End-screen cards are shown")
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
fun findEndscreenResourceId(name: String) = ResourceMappingResourcePatch.resourceMappings.single {
|
||||||
|
it.type == "layout" && it.name == "endscreen_element_layout_$name"
|
||||||
|
}.id
|
||||||
|
|
||||||
|
layoutCircle = findEndscreenResourceId("circle")
|
||||||
|
layoutIcon = findEndscreenResourceId("icon")
|
||||||
|
layoutVideo = findEndscreenResourceId("video")
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.ad.infocardsuggestions.annotations
|
package app.revanced.patches.youtube.layout.hideinfocards.annotations
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
@@ -10,4 +10,4 @@ import app.revanced.patcher.annotation.Package
|
|||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
internal annotation class HideInfocardSuggestionsCompatibility
|
internal annotation class HideInfocardsCompatibility
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hideinfocards.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.patches.youtube.layout.hideinfocards.annotations.HideInfocardsCompatibility
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
@Name("infocards-incognito-fingerprint")
|
||||||
|
@HideInfocardsCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object InfocardsIncognitoFingerprint : MethodFingerprint(
|
||||||
|
"Ljava/lang/Boolean;",
|
||||||
|
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
strings = listOf("vibrator")
|
||||||
|
)
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hideinfocards.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.patches.youtube.layout.hideinfocards.annotations.HideInfocardsCompatibility
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
@Name("infocards-incognito-parent-fingerprint")
|
||||||
|
@HideInfocardsCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object InfocardsIncognitoParentFingerprint : MethodFingerprint(
|
||||||
|
"Ljava/lang/String;",
|
||||||
|
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
strings = listOf("player_overlay_info_card_teaser"),
|
||||||
|
)
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hideinfocards.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.hideinfocards.annotations.HideInfocardsCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.hideinfocards.resource.patch.HideInfocardsResourcePatch
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
||||||
|
|
||||||
|
@Name("infocards-method-call-fingerprint")
|
||||||
|
@HideInfocardsCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object InfocardsMethodCallFingerprint : MethodFingerprint(
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.INVOKE_INTERFACE,
|
||||||
|
),
|
||||||
|
customFingerprint = { methodDef ->
|
||||||
|
methodDef.implementation?.instructions?.any { instruction ->
|
||||||
|
(instruction as? WideLiteralInstruction)?.wideLiteral == HideInfocardsResourcePatch.drawerResourceId
|
||||||
|
} == true
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hideinfocards.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
|
import app.revanced.patches.youtube.layout.hideinfocards.annotations.HideInfocardsCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.hideinfocards.fingerprints.InfocardsIncognitoFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.hideinfocards.fingerprints.InfocardsMethodCallFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.hideinfocards.fingerprints.InfocardsIncognitoParentFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.hideinfocards.resource.patch.HideInfocardsResourcePatch
|
||||||
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@DependsOn([IntegrationsPatch::class, HideInfocardsResourcePatch::class])
|
||||||
|
@Name("hide-info-cards")
|
||||||
|
@Description("Hides info-cards in videos.")
|
||||||
|
@HideInfocardsCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class HideInfocardsPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
InfocardsIncognitoParentFingerprint,
|
||||||
|
InfocardsMethodCallFingerprint,
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
with(InfocardsIncognitoFingerprint.also {
|
||||||
|
it.resolve(context, InfocardsIncognitoParentFingerprint.result!!.classDef)
|
||||||
|
}.result!!.mutableMethod) {
|
||||||
|
val invokeInstructionIndex = implementation!!.instructions.indexOfFirst {
|
||||||
|
it.opcode.ordinal == Opcode.INVOKE_VIRTUAL.ordinal &&
|
||||||
|
((it as? BuilderInstruction35c)?.reference.toString() ==
|
||||||
|
"Landroid/view/View;->setVisibility(I)V")
|
||||||
|
}
|
||||||
|
|
||||||
|
replaceInstruction(invokeInstructionIndex, """
|
||||||
|
invoke-static {v${(instruction(invokeInstructionIndex) as? BuilderInstruction35c)?.registerC}}, Lapp/revanced/integrations/patches/HideInfocardsPatch;->hideInfocardsIncognito(Landroid/view/View;)V
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
with(InfocardsMethodCallFingerprint.result!!) {
|
||||||
|
val hideInfocardsCallMethod = mutableMethod
|
||||||
|
|
||||||
|
val invokeInterfaceIndex = scanResult.patternScanResult!!.endIndex
|
||||||
|
val toggleRegister = hideInfocardsCallMethod.implementation!!.registerCount - 1
|
||||||
|
|
||||||
|
hideInfocardsCallMethod.addInstructions(
|
||||||
|
invokeInterfaceIndex, """
|
||||||
|
invoke-static {}, Lapp/revanced/integrations/patches/HideInfocardsPatch;->hideInfocardsMethodCall()Z
|
||||||
|
move-result v$toggleRegister
|
||||||
|
if-nez v$toggleRegister, :hide_info_cards
|
||||||
|
""", listOf(ExternalLabel("hide_info_cards", hideInfocardsCallMethod.instruction(invokeInterfaceIndex + 1)))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hideinfocards.resource.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.ResourceContext
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patches.youtube.layout.hideinfocards.annotations.HideInfocardsCompatibility
|
||||||
|
import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||||
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
||||||
|
|
||||||
|
@HideInfocardsCompatibility
|
||||||
|
@DependsOn([SettingsPatch::class, ResourceMappingResourcePatch::class])
|
||||||
|
@Version("0.0.1")
|
||||||
|
class HideInfocardsResourcePatch : ResourcePatch {
|
||||||
|
internal companion object {
|
||||||
|
var drawerResourceId: Long = -1
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_hide_infocards",
|
||||||
|
StringResource("revanced_hide_infocards_title", "Hide info-cards"),
|
||||||
|
true,
|
||||||
|
StringResource("revanced_hide_infocards_summary_on", "Info-cards are hidden"),
|
||||||
|
StringResource("revanced_hide_infocards_summary_off", "Info-cards are shown")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
drawerResourceId = ResourceMappingResourcePatch.resourceMappings.single {
|
||||||
|
it.type == "id" && it.name == "info_cards_drawer_header"
|
||||||
|
}.id
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -51,7 +51,7 @@ class OldQualityLayoutPatch : BytecodePatch(
|
|||||||
// insert the integrations method
|
// insert the integrations method
|
||||||
method.addInstruction(
|
method.addInstruction(
|
||||||
listenerInvokeRegister, // insert the integrations instructions right before the listener
|
listenerInvokeRegister, // insert the integrations instructions right before the listener
|
||||||
"invoke-static { v$onItemClickViewRegister }, Lapp/revanced/integrations/patches/OldQualityLayoutPatch;->showOldQualityMenu(Landroid/widget/ListView;)V"
|
"invoke-static { v$onItemClickViewRegister }, Lapp/revanced/integrations/patches/playback/quality/OldQualityLayoutPatch;->showOldQualityMenu(Landroid/widget/ListView;)V"
|
||||||
)
|
)
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ 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.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])
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ 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.extensions.replaceInstruction
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
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
|
||||||
@@ -23,9 +22,9 @@ 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.mapping.patch.ResourceMappingResourcePatch
|
import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.playercontroller.patch.PlayerControllerPatch
|
|
||||||
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.videoid.patch.VideoIdPatch
|
import app.revanced.patches.youtube.misc.video.information.patch.VideoInformationPatch
|
||||||
|
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
|
||||||
@@ -36,7 +35,7 @@ import org.jf.dexlib2.iface.reference.StringReference
|
|||||||
@Patch
|
@Patch
|
||||||
@DependsOn(
|
@DependsOn(
|
||||||
dependencies = [
|
dependencies = [
|
||||||
PlayerControllerPatch::class, // updates video length and adds method to seek in video
|
VideoInformationPatch::class, // updates video information and adds method to seek in video
|
||||||
PlayerControlsBytecodePatch::class,
|
PlayerControlsBytecodePatch::class,
|
||||||
IntegrationsPatch::class,
|
IntegrationsPatch::class,
|
||||||
SponsorBlockResourcePatch::class,
|
SponsorBlockResourcePatch::class,
|
||||||
@@ -49,9 +48,7 @@ import org.jf.dexlib2.iface.reference.StringReference
|
|||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class SponsorBlockBytecodePatch : BytecodePatch(
|
class SponsorBlockBytecodePatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
PlayerControllerSetTimeReferenceFingerprint,
|
|
||||||
CreateVideoPlayerSeekbarFingerprint,
|
CreateVideoPlayerSeekbarFingerprint,
|
||||||
VideoTimeFingerprint,
|
|
||||||
NextGenWatchLayoutFingerprint,
|
NextGenWatchLayoutFingerprint,
|
||||||
AppendTimeFingerprint,
|
AppendTimeFingerprint,
|
||||||
PlayerOverlaysLayoutInitFingerprint,
|
PlayerOverlaysLayoutInitFingerprint,
|
||||||
@@ -59,36 +56,31 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||||||
StartVideoInformerFingerprint
|
StartVideoInformerFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {/*
|
|
||||||
Set current video time
|
|
||||||
*/
|
|
||||||
val referenceResult = PlayerControllerSetTimeReferenceFingerprint.result!!
|
|
||||||
val playerControllerSetTimeMethod =
|
|
||||||
context.toMethodWalker(referenceResult.method)
|
|
||||||
.nextMethod(referenceResult.scanResult.patternScanResult!!.startIndex, true)
|
|
||||||
.getMethod() as MutableMethod
|
|
||||||
playerControllerSetTimeMethod.addInstruction(
|
|
||||||
2,
|
|
||||||
"invoke-static {p1, p2}, Lapp/revanced/integrations/sponsorblock/PlayerController;->setCurrentVideoTime(J)V"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
private companion object {
|
||||||
|
const val INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR =
|
||||||
|
"Lapp/revanced/integrations/sponsorblock/PlayerController;"
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
/*
|
/*
|
||||||
Set current video time high precision
|
Hook the video time methods
|
||||||
*/
|
*/
|
||||||
val constructorFingerprint =
|
with(VideoInformationPatch) {
|
||||||
object : MethodFingerprint("V", null, listOf("J", "J", "J", "J", "I", "L"), null) {}
|
videoTimeHook(
|
||||||
constructorFingerprint.resolve(context, VideoTimeFingerprint.result!!.classDef)
|
INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR,
|
||||||
|
"setVideoTime"
|
||||||
val constructor = constructorFingerprint.result!!.mutableMethod
|
)
|
||||||
constructor.addInstruction(
|
highPrecisionTimeHook(
|
||||||
0,
|
INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR,
|
||||||
"invoke-static {p1, p2}, Lapp/revanced/integrations/sponsorblock/PlayerController;->setCurrentVideoTimeHighPrecision(J)V"
|
"setHighPrecisionVideoTime"
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Set current video id
|
Set current video id
|
||||||
*/
|
*/
|
||||||
VideoIdPatch.injectCall("Lapp/revanced/integrations/sponsorblock/PlayerController;->setCurrentVideoId(Ljava/lang/String;)V")
|
VideoIdPatch.injectCall("$INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR->setCurrentVideoId(Ljava/lang/String;)V")
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Seekbar drawing
|
Seekbar drawing
|
||||||
@@ -104,7 +96,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||||||
if (instruction.opcode != Opcode.MOVE_OBJECT_FROM16) continue
|
if (instruction.opcode != Opcode.MOVE_OBJECT_FROM16) continue
|
||||||
seekbarMethod.addInstruction(
|
seekbarMethod.addInstruction(
|
||||||
index + 1,
|
index + 1,
|
||||||
"invoke-static {v0}, Lapp/revanced/integrations/sponsorblock/PlayerController;->setSponsorBarRect(Ljava/lang/Object;)V"
|
"invoke-static {v0}, $INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR->setSponsorBarRect(Ljava/lang/Object;)V"
|
||||||
)
|
)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -120,7 +112,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||||||
// set the thickness of the segment
|
// set the thickness of the segment
|
||||||
seekbarMethod.addInstruction(
|
seekbarMethod.addInstruction(
|
||||||
insertIndex,
|
insertIndex,
|
||||||
"invoke-static {v${invokeInstruction.registerC}}, Lapp/revanced/integrations/sponsorblock/PlayerController;->setSponsorBarThickness(I)V"
|
"invoke-static {v${invokeInstruction.registerC}}, $INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR->setSponsorBarThickness(I)V"
|
||||||
)
|
)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -141,11 +133,11 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||||||
// the reason for that is that we get the index, add instructions and then the offset would be wrong
|
// the reason for that is that we get the index, add instructions and then the offset would be wrong
|
||||||
seekbarMethod.addInstruction(
|
seekbarMethod.addInstruction(
|
||||||
indexLeft + 1,
|
indexLeft + 1,
|
||||||
"invoke-static {v$rectangleLeftRegister}, Lapp/revanced/integrations/sponsorblock/PlayerController;->setSponsorBarAbsoluteLeft(Landroid/graphics/Rect;)V"
|
"invoke-static {v$rectangleLeftRegister}, $INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR->setSponsorBarAbsoluteLeft(Landroid/graphics/Rect;)V"
|
||||||
)
|
)
|
||||||
seekbarMethod.addInstruction(
|
seekbarMethod.addInstruction(
|
||||||
indexRight + 1,
|
indexRight + 1,
|
||||||
"invoke-static {v$rectangleRightRegister}, Lapp/revanced/integrations/sponsorblock/PlayerController;->setSponsorBarAbsoluteRight(Landroid/graphics/Rect;)V"
|
"invoke-static {v$rectangleRightRegister}, $INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR->setSponsorBarAbsoluteRight(Landroid/graphics/Rect;)V"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -157,7 +149,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
seekbarMethod.addInstruction(
|
seekbarMethod.addInstruction(
|
||||||
drawSegmentInstructionInsertIndex,
|
drawSegmentInstructionInsertIndex,
|
||||||
"invoke-static {v$canvasInstance, v$centerY}, Lapp/revanced/integrations/sponsorblock/PlayerController;->drawSponsorTimeBars(Landroid/graphics/Canvas;F)V"
|
"invoke-static {v$canvasInstance, v$centerY}, $INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR->drawSponsorTimeBars(Landroid/graphics/Canvas;F)V"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -215,7 +207,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||||||
val instanceRegister = 0
|
val instanceRegister = 0
|
||||||
NextGenWatchLayoutFingerprint.result!!.mutableMethod.addInstruction(
|
NextGenWatchLayoutFingerprint.result!!.mutableMethod.addInstruction(
|
||||||
3, // after super call
|
3, // after super call
|
||||||
"invoke-static/range {p$instanceRegister}, Lapp/revanced/integrations/sponsorblock/PlayerController;->addSkipSponsorView15(Landroid/view/View;)V"
|
"invoke-static/range {p$instanceRegister}, $INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR->addSkipSponsorView15(Landroid/view/View;)V"
|
||||||
)
|
)
|
||||||
|
|
||||||
// append the new time to the player layout
|
// append the new time to the player layout
|
||||||
@@ -232,7 +224,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
|
|
||||||
// initialize the player controller
|
// initialize the player controller
|
||||||
PlayerControllerPatch.onCreateHook("Lapp/revanced/integrations/sponsorblock/PlayerController;", "initialize")
|
VideoInformationPatch.onCreateHook(INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR, "initialize")
|
||||||
|
|
||||||
// initialize the sponsorblock view
|
// initialize the sponsorblock view
|
||||||
PlayerOverlaysLayoutInitFingerprint.result!!.mutableMethod.addInstruction(
|
PlayerOverlaysLayoutInitFingerprint.result!!.mutableMethod.addInstruction(
|
||||||
@@ -277,7 +269,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||||||
startVideoInformerMethod.addInstructions(
|
startVideoInformerMethod.addInstructions(
|
||||||
0, """
|
0, """
|
||||||
const/4 v0, 0x0
|
const/4 v0, 0x0
|
||||||
sput-boolean v0, Lapp/revanced/integrations/sponsorblock/PlayerController;->shorts_playing:Z
|
sput-boolean v0, $INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR->shorts_playing:Z
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -286,7 +278,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||||||
shortsPlayerConstructorMethod.addInstructions(
|
shortsPlayerConstructorMethod.addInstructions(
|
||||||
0, """
|
0, """
|
||||||
const/4 v0, 0x1
|
const/4 v0, 0x1
|
||||||
sput-boolean v0, Lapp/revanced/integrations/sponsorblock/PlayerController;->shorts_playing:Z
|
sput-boolean v0, $INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR->shorts_playing:Z
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ import app.revanced.patches.youtube.misc.settings.framework.components.impl.Swit
|
|||||||
import org.w3c.dom.Element
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
@Patch(false)
|
@Patch(false)
|
||||||
@Name("enable-debugging")
|
@Name("debugging")
|
||||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||||
@Description("Enables app debugging by patching the manifest file.")
|
@Description("Adds debugging options.")
|
||||||
@EnableDebuggingCompatibility
|
@EnableDebuggingCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class EnableDebuggingPatch : ResourcePatch {
|
class EnableDebuggingPatch : ResourcePatch {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.misc.playback.annotations
|
package app.revanced.patches.youtube.misc.playback.fix.annotations
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.misc.playback.patch
|
package app.revanced.patches.youtube.misc.playback.fix.patch
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
@@ -9,16 +9,16 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
|||||||
import app.revanced.patcher.patch.ResourcePatch
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.playback.annotations.FixPlaybackCompatibility
|
import app.revanced.patches.youtube.misc.playback.fix.annotations.FixPlaybackCompatibility
|
||||||
import app.revanced.patches.youtube.misc.playercontroller.patch.PlayerControllerPatch
|
import app.revanced.patches.youtube.misc.video.information.patch.VideoInformationPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
||||||
import app.revanced.patches.youtube.misc.videoid.patch.VideoIdPatch
|
import app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch
|
||||||
|
|
||||||
@DependsOn([
|
@DependsOn([
|
||||||
IntegrationsPatch::class,
|
IntegrationsPatch::class,
|
||||||
PlayerControllerPatch::class, // updates video length and adds method to seek in video, necessary for this patch
|
VideoInformationPatch::class, // updates video length and adds method to seek in video, necessary for this patch
|
||||||
SettingsPatch::class,
|
SettingsPatch::class,
|
||||||
VideoIdPatch::class
|
VideoIdPatch::class
|
||||||
])
|
])
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.misc.playercontroller.annotation
|
package app.revanced.patches.youtube.misc.video.information.annotation
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
@@ -10,4 +10,4 @@ import app.revanced.patcher.annotation.Package
|
|||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
internal annotation class PlayerControllerCompatibility
|
internal annotation class VideoInformationCompatibility
|
||||||
@@ -1,13 +1,14 @@
|
|||||||
package app.revanced.patches.youtube.misc.playercontroller.fingerprint
|
package app.revanced.patches.youtube.misc.video.information.fingerprints
|
||||||
|
|
||||||
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.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility
|
import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility
|
||||||
|
import app.revanced.patches.youtube.misc.video.information.annotation.VideoInformationCompatibility
|
||||||
|
|
||||||
@Name("create-video-player-seekbar-fingerprint")
|
@Name("create-video-player-seekbar-fingerprint")
|
||||||
@SponsorBlockCompatibility
|
@VideoInformationCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
object CreateVideoPlayerSeekbarFingerprint : MethodFingerprint(
|
object CreateVideoPlayerSeekbarFingerprint : MethodFingerprint(
|
||||||
"V",
|
"V",
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
package app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints
|
package app.revanced.patches.youtube.misc.video.information.fingerprints
|
||||||
|
|
||||||
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.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility
|
import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility
|
||||||
|
import app.revanced.patches.youtube.misc.video.information.annotation.VideoInformationCompatibility
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
@Name("player-controller-set-time-reference-fingerprint")
|
@Name("player-controller-set-time-reference-fingerprint")
|
||||||
|
@VideoInformationCompatibility
|
||||||
@SponsorBlockCompatibility
|
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
object PlayerControllerSetTimeReferenceFingerprint : MethodFingerprint(
|
object PlayerControllerSetTimeReferenceFingerprint : MethodFingerprint(
|
||||||
opcodes = listOf(Opcode.INVOKE_DIRECT_RANGE, Opcode.IGET_OBJECT),
|
opcodes = listOf(Opcode.INVOKE_DIRECT_RANGE, Opcode.IGET_OBJECT),
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
package app.revanced.patches.youtube.misc.playercontroller.fingerprint
|
package app.revanced.patches.youtube.misc.video.information.fingerprints
|
||||||
|
|
||||||
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.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility
|
import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility
|
||||||
|
import app.revanced.patches.youtube.misc.video.information.annotation.VideoInformationCompatibility
|
||||||
|
|
||||||
@Name("player-init-fingerprint")
|
@Name("player-init-fingerprint")
|
||||||
|
@VideoInformationCompatibility
|
||||||
@SponsorBlockCompatibility
|
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
object PlayerInitFingerprint : MethodFingerprint(
|
object PlayerInitFingerprint : MethodFingerprint(
|
||||||
strings = listOf(
|
strings = listOf(
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
package app.revanced.patches.youtube.misc.playercontroller.fingerprint
|
package app.revanced.patches.youtube.misc.video.information.fingerprints
|
||||||
|
|
||||||
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.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility
|
import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility
|
||||||
|
import app.revanced.patches.youtube.misc.video.information.annotation.VideoInformationCompatibility
|
||||||
|
|
||||||
@Name("seek-fingerprint")
|
@Name("seek-fingerprint")
|
||||||
|
@VideoInformationCompatibility
|
||||||
@SponsorBlockCompatibility
|
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
object SeekFingerprint : MethodFingerprint(
|
object SeekFingerprint : MethodFingerprint(
|
||||||
strings = listOf("Attempting to seek during an ad")
|
strings = listOf("Attempting to seek during an ad")
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
package app.revanced.patches.youtube.misc.playercontroller.fingerprint
|
package app.revanced.patches.youtube.misc.video.information.fingerprints
|
||||||
|
|
||||||
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.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility
|
import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility
|
||||||
|
import app.revanced.patches.youtube.misc.video.information.annotation.VideoInformationCompatibility
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
@Name("video-length-fingerprint")
|
@Name("video-length-fingerprint")
|
||||||
|
@VideoInformationCompatibility
|
||||||
@SponsorBlockCompatibility
|
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
object VideoLengthFingerprint : MethodFingerprint(
|
object VideoLengthFingerprint : MethodFingerprint(
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
@@ -1,13 +1,14 @@
|
|||||||
package app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints
|
package app.revanced.patches.youtube.misc.video.information.fingerprints
|
||||||
|
|
||||||
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.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility
|
import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility
|
||||||
|
import app.revanced.patches.youtube.misc.video.information.annotation.VideoInformationCompatibility
|
||||||
|
|
||||||
@Name("video-time-fingerprint")
|
@Name("video-time-fingerprint")
|
||||||
@SponsorBlockCompatibility
|
@VideoInformationCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
object VideoTimeFingerprint : MethodFingerprint(
|
object VideoTimeFingerprint : MethodFingerprint(
|
||||||
strings = listOf("MedialibPlayerTimeInfo{currentPositionMillis=")
|
strings = listOf("MedialibPlayerTimeInfo{currentPositionMillis=")
|
||||||
@@ -1,13 +1,15 @@
|
|||||||
package app.revanced.patches.youtube.misc.playercontroller.patch
|
package app.revanced.patches.youtube.misc.video.information.patch
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
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.addInstruction
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
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.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
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
|
||||||
@@ -16,11 +18,8 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
|||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.playercontroller.annotation.PlayerControllerCompatibility
|
import app.revanced.patches.youtube.misc.video.information.annotation.VideoInformationCompatibility
|
||||||
import app.revanced.patches.youtube.misc.playercontroller.fingerprint.CreateVideoPlayerSeekbarFingerprint
|
import app.revanced.patches.youtube.misc.video.information.fingerprints.*
|
||||||
import app.revanced.patches.youtube.misc.playercontroller.fingerprint.PlayerInitFingerprint
|
|
||||||
import app.revanced.patches.youtube.misc.playercontroller.fingerprint.SeekFingerprint
|
|
||||||
import app.revanced.patches.youtube.misc.playercontroller.fingerprint.VideoLengthFingerprint
|
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.builder.MutableMethodImplementation
|
import org.jf.dexlib2.builder.MutableMethodImplementation
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
@@ -28,15 +27,17 @@ import org.jf.dexlib2.immutable.ImmutableMethod
|
|||||||
import org.jf.dexlib2.immutable.ImmutableMethodParameter
|
import org.jf.dexlib2.immutable.ImmutableMethodParameter
|
||||||
import org.jf.dexlib2.util.MethodUtil
|
import org.jf.dexlib2.util.MethodUtil
|
||||||
|
|
||||||
@Name("player-controller-hook")
|
@Name("video-information")
|
||||||
@Description("Hooks the player controller")
|
@Description("Hooks YouTube to get information about the current playing video.")
|
||||||
@PlayerControllerCompatibility
|
@VideoInformationCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
@DependsOn([IntegrationsPatch::class])
|
@DependsOn([IntegrationsPatch::class])
|
||||||
class PlayerControllerPatch : BytecodePatch(
|
class VideoInformationPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
PlayerInitFingerprint,
|
PlayerInitFingerprint,
|
||||||
CreateVideoPlayerSeekbarFingerprint
|
CreateVideoPlayerSeekbarFingerprint,
|
||||||
|
PlayerControllerSetTimeReferenceFingerprint,
|
||||||
|
VideoTimeFingerprint,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
@@ -88,29 +89,90 @@ class PlayerControllerPatch : BytecodePatch(
|
|||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
videoLengthMethodResult.scanResult.patternScanResult!!.endIndex,
|
videoLengthMethodResult.scanResult.patternScanResult!!.endIndex,
|
||||||
"invoke-static {v$videoLengthRegister, v$dummyRegisterForLong}, $INTEGRATIONS_CLASS_DESCRIPTOR->setCurrentVideoLength(J)V"
|
"invoke-static {v$videoLengthRegister, v$dummyRegisterForLong}, $INTEGRATIONS_CLASS_DESCRIPTOR->setVideoLength(J)V"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Set the video time method
|
||||||
|
*/
|
||||||
|
with(PlayerControllerSetTimeReferenceFingerprint.result!!) {
|
||||||
|
timeMethod = context.toMethodWalker(method)
|
||||||
|
.nextMethod(scanResult.patternScanResult!!.startIndex, true)
|
||||||
|
.getMethod() as MutableMethod
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Set the high precision video time method
|
||||||
|
*/
|
||||||
|
highPrecisionTimeMethod =
|
||||||
|
(object : MethodFingerprint("V", null, listOf("J", "J", "J", "J", "I", "L"), null) {}).also {
|
||||||
|
it.resolve(context, VideoTimeFingerprint.result!!.classDef)
|
||||||
|
}.result!!.mutableMethod
|
||||||
|
|
||||||
|
/*
|
||||||
|
Hook the methods which set the time
|
||||||
|
*/
|
||||||
|
highPrecisionTimeHook(INTEGRATIONS_CLASS_DESCRIPTOR, "setVideoTime")
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/PlayerControllerPatch;"
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/VideoInformation;"
|
||||||
private const val INSERT_INDEX = 4
|
|
||||||
|
|
||||||
private lateinit var playerInitMethod: MutableMethod
|
private lateinit var playerInitMethod: MutableMethod
|
||||||
|
private lateinit var timeMethod: MutableMethod
|
||||||
|
private lateinit var highPrecisionTimeMethod: MutableMethod
|
||||||
|
|
||||||
|
private fun MutableMethod.insert(insert: InsertIndex, register: String, descriptor: String) =
|
||||||
|
addInstruction(insert.index, "invoke-static { $register }, $descriptor")
|
||||||
|
|
||||||
|
private fun MutableMethod.insertTimeHook(insert: InsertIndex, descriptor: String) =
|
||||||
|
insert(insert, "p1, p2", descriptor)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook the player controller.
|
* Hook the player controller.
|
||||||
*
|
*
|
||||||
* @param targetMethodClass The descriptor for the static method to invoke when the player controller is created.
|
* @param targetMethodClass The descriptor for the class to invoke when the player controller is created.
|
||||||
|
* @param targetMethodName The name of the static method to invoke when the player controller is created.
|
||||||
*/
|
*/
|
||||||
internal fun onCreateHook(targetMethodClass: String, targetMethodName: String) =
|
internal fun onCreateHook(targetMethodClass: String, targetMethodName: String) =
|
||||||
playerInitMethod.addInstruction(
|
playerInitMethod.insert(
|
||||||
INSERT_INDEX,
|
InsertIndex.CREATE,
|
||||||
"invoke-static { v0 }, $targetMethodClass->$targetMethodName(Ljava/lang/Object;)V"
|
"v0",
|
||||||
|
"$targetMethodClass->$targetMethodName(Ljava/lang/Object;)V"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hook the video time.
|
||||||
|
*
|
||||||
|
* @param targetMethodClass The descriptor for the static method to invoke when the player controller is created.
|
||||||
|
* @param targetMethodName The name of the static method to invoke when the player controller is created.
|
||||||
|
*/
|
||||||
|
internal fun videoTimeHook(targetMethodClass: String, targetMethodName: String) =
|
||||||
|
timeMethod.insertTimeHook(
|
||||||
|
InsertIndex.TIME,
|
||||||
|
"$targetMethodClass->$targetMethodName(J)V"
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hook the high precision video time.
|
||||||
|
*
|
||||||
|
* @param targetMethodClass The descriptor for the static method to invoke when the player controller is created.
|
||||||
|
* @param targetMethodName The name of the static method to invoke when the player controller is created.
|
||||||
|
*/
|
||||||
|
internal fun highPrecisionTimeHook(targetMethodClass: String, targetMethodName: String) =
|
||||||
|
highPrecisionTimeMethod.insertTimeHook(
|
||||||
|
InsertIndex.HIGH_PRECISION_TIME,
|
||||||
|
"$targetMethodClass->$targetMethodName(J)V"
|
||||||
|
)
|
||||||
|
|
||||||
|
enum class InsertIndex(internal val index: Int) {
|
||||||
|
CREATE(4),
|
||||||
|
TIME(2),
|
||||||
|
HIGH_PRECISION_TIME(0),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package app.revanced.patches.youtube.misc.video.quality.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility(
|
||||||
|
[Package(
|
||||||
|
"com.google.android.youtube", arrayOf("17.36.37", "17.41.37", "17.42.35", "17.43.36")
|
||||||
|
)]
|
||||||
|
)
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class RememberVideoQualityCompatibility
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
package app.revanced.patches.youtube.misc.quality.fingerprints
|
package app.revanced.patches.youtube.misc.video.quality.fingerprints
|
||||||
|
|
||||||
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.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.quality.annotations.DefaultVideoQualityCompatibility
|
import app.revanced.patches.youtube.misc.video.quality.annotations.RememberVideoQualityCompatibility
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
@Name("video-quality-reference-fingerprint")
|
@Name("video-quality-reference-fingerprint")
|
||||||
@DefaultVideoQualityCompatibility
|
@RememberVideoQualityCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
object VideoQualityReferenceFingerprint : MethodFingerprint(
|
object VideoQualityReferenceFingerprint : MethodFingerprint(
|
||||||
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L"), listOf(
|
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L"), listOf(
|
||||||
Opcode.IPUT_OBJECT, Opcode.RETURN_VOID
|
Opcode.IPUT_OBJECT, Opcode.RETURN_VOID
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -1,27 +1,27 @@
|
|||||||
|
|
||||||
package app.revanced.patches.youtube.misc.quality.fingerprints
|
package app.revanced.patches.youtube.misc.video.quality.fingerprints
|
||||||
|
|
||||||
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.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.quality.annotations.DefaultVideoQualityCompatibility
|
import app.revanced.patches.youtube.misc.video.quality.annotations.RememberVideoQualityCompatibility
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
@Name("video-quality-setter-fingerprint")
|
@Name("video-quality-setter-fingerprint")
|
||||||
@DefaultVideoQualityCompatibility
|
@RememberVideoQualityCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
object VideoQualitySetterFingerprint : MethodFingerprint(
|
object VideoQualitySetterFingerprint : MethodFingerprint(
|
||||||
"V",
|
"V",
|
||||||
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
listOf("[L", "I", "I", "Z", "I"),
|
listOf("[L", "I", "I", "Z", "I"),
|
||||||
listOf(
|
listOf(
|
||||||
Opcode.IF_EQZ,
|
Opcode.IF_EQZ,
|
||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.IPUT_BOOLEAN,
|
Opcode.IPUT_BOOLEAN,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -1,26 +1,26 @@
|
|||||||
|
|
||||||
package app.revanced.patches.youtube.misc.quality.fingerprints
|
package app.revanced.patches.youtube.misc.video.quality.fingerprints
|
||||||
|
|
||||||
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.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
|
||||||
import app.revanced.patches.youtube.misc.quality.annotations.DefaultVideoQualityCompatibility
|
import app.revanced.patches.youtube.misc.video.quality.annotations.RememberVideoQualityCompatibility
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
@Name("video-user-quality-change-fingerprint")
|
@Name("video-user-quality-change-fingerprint")
|
||||||
@DefaultVideoQualityCompatibility
|
@RememberVideoQualityCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
object VideoUserQualityChangeFingerprint : MethodFingerprint(
|
object VideoUserQualityChangeFingerprint : MethodFingerprint(
|
||||||
"V",
|
"V",
|
||||||
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
listOf("L","L","I","J"),
|
listOf("L","L","I","J"),
|
||||||
listOf(
|
listOf(
|
||||||
Opcode.MOVE,
|
Opcode.MOVE,
|
||||||
Opcode.MOVE_WIDE,
|
Opcode.MOVE_WIDE,
|
||||||
Opcode.INVOKE_INTERFACE_RANGE,
|
Opcode.INVOKE_INTERFACE_RANGE,
|
||||||
Opcode.RETURN_VOID
|
Opcode.RETURN_VOID
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.misc.quality.patch
|
package app.revanced.patches.youtube.misc.video.quality.patch
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
@@ -13,14 +13,14 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
|||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.quality.annotations.DefaultVideoQualityCompatibility
|
import app.revanced.patches.youtube.misc.video.quality.annotations.RememberVideoQualityCompatibility
|
||||||
import app.revanced.patches.youtube.misc.quality.fingerprints.VideoQualityReferenceFingerprint
|
import app.revanced.patches.youtube.misc.video.quality.fingerprints.VideoQualityReferenceFingerprint
|
||||||
import app.revanced.patches.youtube.misc.quality.fingerprints.VideoQualitySetterFingerprint
|
import app.revanced.patches.youtube.misc.video.quality.fingerprints.VideoQualitySetterFingerprint
|
||||||
import app.revanced.patches.youtube.misc.quality.fingerprints.VideoUserQualityChangeFingerprint
|
import app.revanced.patches.youtube.misc.video.quality.fingerprints.VideoUserQualityChangeFingerprint
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
||||||
import app.revanced.patches.youtube.misc.videoid.patch.VideoIdPatch
|
import app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch
|
||||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
import org.jf.dexlib2.iface.reference.FieldReference
|
import org.jf.dexlib2.iface.reference.FieldReference
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ import org.jf.dexlib2.iface.reference.FieldReference
|
|||||||
@DependsOn([IntegrationsPatch::class, VideoIdPatch::class, SettingsPatch::class])
|
@DependsOn([IntegrationsPatch::class, VideoIdPatch::class, SettingsPatch::class])
|
||||||
@Name("remember-video-quality")
|
@Name("remember-video-quality")
|
||||||
@Description("Adds the ability to remember the video quality you chose in the video quality flyout.")
|
@Description("Adds the ability to remember the video quality you chose in the video quality flyout.")
|
||||||
@DefaultVideoQualityCompatibility
|
@RememberVideoQualityCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class RememberVideoQualityPatch : BytecodePatch(
|
class RememberVideoQualityPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
@@ -63,7 +63,7 @@ class RememberVideoQualityPatch : BytecodePatch(
|
|||||||
(method.implementation!!.instructions.elementAt(0) as ReferenceInstruction).reference as FieldReference
|
(method.implementation!!.instructions.elementAt(0) as ReferenceInstruction).reference as FieldReference
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoIdPatch.injectCall("Lapp/revanced/integrations/patches/VideoQualityPatch;->newVideoStarted(Ljava/lang/String;)V")
|
VideoIdPatch.injectCall("Lapp/revanced/integrations/patches/playback/quality/RememberVideoQualityPatch;->newVideoStarted(Ljava/lang/String;)V")
|
||||||
|
|
||||||
val qIndexMethodName =
|
val qIndexMethodName =
|
||||||
context.classes.single { it.type == qualityFieldReference.type }.methods.single { it.parameterTypes.first() == "I" }.name
|
context.classes.single { it.type == qualityFieldReference.type }.methods.single { it.parameterTypes.first() == "I" }.name
|
||||||
@@ -73,14 +73,14 @@ class RememberVideoQualityPatch : BytecodePatch(
|
|||||||
"""
|
"""
|
||||||
iget-object v0, p0, ${setterMethod.classDef.type}->${qualityFieldReference.name}:${qualityFieldReference.type}
|
iget-object v0, p0, ${setterMethod.classDef.type}->${qualityFieldReference.name}:${qualityFieldReference.type}
|
||||||
const-string v1, "$qIndexMethodName"
|
const-string v1, "$qIndexMethodName"
|
||||||
invoke-static {p1, p2, v0, v1}, Lapp/revanced/integrations/patches/VideoQualityPatch;->setVideoQuality([Ljava/lang/Object;ILjava/lang/Object;Ljava/lang/String;)I
|
invoke-static {p1, p2, v0, v1}, Lapp/revanced/integrations/patches/playback/quality/RememberVideoQualityPatch;->setVideoQuality([Ljava/lang/Object;ILjava/lang/Object;Ljava/lang/String;)I
|
||||||
move-result p2
|
move-result p2
|
||||||
""",
|
""",
|
||||||
)
|
)
|
||||||
|
|
||||||
userQualityMethod.mutableMethod.addInstruction(
|
userQualityMethod.mutableMethod.addInstruction(
|
||||||
0,
|
0,
|
||||||
"invoke-static {p3}, Lapp/revanced/integrations/patches/VideoQualityPatch;->userChangedQuality(I)V"
|
"invoke-static {p3}, Lapp/revanced/integrations/patches/playback/quality/RememberVideoQualityPatch;->userChangedQuality(I)V"
|
||||||
)
|
)
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.misc.customplaybackspeed.annotations
|
package app.revanced.patches.youtube.misc.video.speed.custom.annotations
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package app.revanced.patches.youtube.misc.customplaybackspeed.fingerprints
|
package app.revanced.patches.youtube.misc.video.speed.custom.fingerprints
|
||||||
|
|
||||||
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.extensions.or
|
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 app.revanced.patches.youtube.misc.customplaybackspeed.annotations.CustomPlaybackSpeedCompatibility
|
import app.revanced.patches.youtube.misc.video.speed.custom.annotations.CustomPlaybackSpeedCompatibility
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package app.revanced.patches.youtube.misc.customplaybackspeed.fingerprints
|
package app.revanced.patches.youtube.misc.video.speed.custom.fingerprints
|
||||||
|
|
||||||
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.extensions.or
|
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 app.revanced.patches.youtube.misc.customplaybackspeed.annotations.CustomPlaybackSpeedCompatibility
|
import app.revanced.patches.youtube.misc.video.speed.custom.annotations.CustomPlaybackSpeedCompatibility
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package app.revanced.patches.youtube.misc.customplaybackspeed.fingerprints
|
package app.revanced.patches.youtube.misc.video.speed.custom.fingerprints
|
||||||
|
|
||||||
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.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.customplaybackspeed.annotations.CustomPlaybackSpeedCompatibility
|
import app.revanced.patches.youtube.misc.video.speed.custom.annotations.CustomPlaybackSpeedCompatibility
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
@Name("video-speed-patch-fingerprint")
|
@Name("video-speed-patch-fingerprint")
|
||||||
@@ -12,6 +12,6 @@ import org.jf.dexlib2.Opcode
|
|||||||
object VideoSpeedPatchFingerprint : MethodFingerprint(
|
object VideoSpeedPatchFingerprint : MethodFingerprint(
|
||||||
opcodes = listOf(Opcode.FILL_ARRAY_DATA),
|
opcodes = listOf(Opcode.FILL_ARRAY_DATA),
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { methodDef ->
|
||||||
methodDef.definingClass.endsWith("VideoSpeedPatch;") && methodDef.name == "<clinit>"
|
methodDef.definingClass.endsWith("CustomVideoSpeedPatch;") && methodDef.name == "<clinit>"
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.misc.customplaybackspeed.patch
|
package app.revanced.patches.youtube.misc.video.speed.custom.patch
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
@@ -9,12 +9,11 @@ import app.revanced.patcher.extensions.replaceInstruction
|
|||||||
import app.revanced.patcher.patch.*
|
import app.revanced.patcher.patch.*
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patches.youtube.misc.customplaybackspeed.annotations.CustomPlaybackSpeedCompatibility
|
import app.revanced.patches.youtube.misc.video.speed.custom.annotations.CustomPlaybackSpeedCompatibility
|
||||||
import app.revanced.patches.youtube.misc.customplaybackspeed.fingerprints.SpeedArrayGeneratorFingerprint
|
import app.revanced.patches.youtube.misc.video.speed.custom.fingerprints.SpeedArrayGeneratorFingerprint
|
||||||
import app.revanced.patches.youtube.misc.customplaybackspeed.fingerprints.SpeedLimiterFingerprint
|
import app.revanced.patches.youtube.misc.video.speed.custom.fingerprints.SpeedLimiterFingerprint
|
||||||
import app.revanced.patches.youtube.misc.customplaybackspeed.fingerprints.VideoSpeedPatchFingerprint
|
import app.revanced.patches.youtube.misc.video.speed.custom.fingerprints.VideoSpeedPatchFingerprint
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch
|
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderArrayPayload
|
import org.jf.dexlib2.builder.instruction.BuilderArrayPayload
|
||||||
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
|
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
@@ -25,20 +24,18 @@ import java.util.stream.DoubleStream
|
|||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("custom-playback-speed")
|
@Name("custom-video-speed")
|
||||||
@Description("Adds more video playback speed options.")
|
@Description("Adds more video speed options.")
|
||||||
@DependsOn([IntegrationsPatch::class, ResourceMappingResourcePatch::class])
|
@DependsOn([IntegrationsPatch::class])
|
||||||
@CustomPlaybackSpeedCompatibility
|
@CustomPlaybackSpeedCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class CustomPlaybackSpeedPatch : BytecodePatch(
|
class CustomVideoSpeedPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
SpeedArrayGeneratorFingerprint, SpeedLimiterFingerprint, VideoSpeedPatchFingerprint
|
SpeedArrayGeneratorFingerprint, SpeedLimiterFingerprint, VideoSpeedPatchFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
//TODO: include setting to skip remembering the new speed
|
|
||||||
|
|
||||||
val speedLimitMin = minVideoSpeed!!.toFloat()
|
val speedLimitMin = minVideoSpeed!!.toFloat()
|
||||||
val speedLimitMax = maxVideoSpeed!!.toFloat().coerceAtLeast(speedLimitMin)
|
val speedLimitMax = maxVideoSpeed!!.toFloat().coerceAtLeast(speedLimitMin)
|
||||||
val speedsGranularity = videoSpeedsGranularity!!.toFloat()
|
val speedsGranularity = videoSpeedsGranularity!!.toFloat()
|
||||||
@@ -64,7 +61,7 @@ class CustomPlaybackSpeedPatch : BytecodePatch(
|
|||||||
|
|
||||||
val arrayLengthConstDestination = (arrayLengthConst as OneRegisterInstruction).registerA
|
val arrayLengthConstDestination = (arrayLengthConst as OneRegisterInstruction).registerA
|
||||||
|
|
||||||
val videoSpeedsArrayType = "Lapp/revanced/integrations/patches/VideoSpeedPatch;->videoSpeeds:[F"
|
val videoSpeedsArrayType = "Lapp/revanced/integrations/patches/playback/speed/CustomVideoSpeedPatch;->videoSpeeds:[F"
|
||||||
|
|
||||||
arrayGenMethod.addInstructions(
|
arrayGenMethod.addInstructions(
|
||||||
arrayLengthConstIndex + 1,
|
arrayLengthConstIndex + 1,
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.misc.videoid.annotation
|
package app.revanced.patches.youtube.misc.video.videoid.annotation
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package app.revanced.patches.youtube.misc.videoid.fingerprint
|
package app.revanced.patches.youtube.misc.video.videoid.fingerprint
|
||||||
|
|
||||||
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.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.videoid.annotation.VideoIdCompatibility
|
import app.revanced.patches.youtube.misc.video.videoid.annotation.VideoIdCompatibility
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
package app.revanced.patches.youtube.misc.videoid.patch
|
package app.revanced.patches.youtube.misc.video.videoid.patch
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
|
import app.revanced.patcher.extensions.instruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.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.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.videoid.annotation.VideoIdCompatibility
|
import app.revanced.patches.youtube.misc.video.videoid.annotation.VideoIdCompatibility
|
||||||
import app.revanced.patches.youtube.misc.videoid.fingerprint.VideoIdFingerprint
|
import app.revanced.patches.youtube.misc.video.videoid.fingerprint.VideoIdFingerprint
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
@Name("video-id-hook")
|
@Name("video-id-hook")
|
||||||
@@ -27,24 +27,20 @@ class VideoIdPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
result = VideoIdFingerprint.result!!
|
with(VideoIdFingerprint.result!!) {
|
||||||
|
insertMethod = mutableMethod
|
||||||
|
insertIndex = scanResult.patternScanResult!!.endIndex + 2
|
||||||
|
|
||||||
insertMethod = result.mutableMethod
|
videoIdRegister = (insertMethod.instruction(insertIndex - 1) as OneRegisterInstruction).registerA
|
||||||
videoIdRegister =
|
}
|
||||||
(insertMethod.implementation!!.instructions[result.scanResult.patternScanResult!!.endIndex + 1] as OneRegisterInstruction).registerA
|
|
||||||
|
|
||||||
injectCall("Lapp/revanced/integrations/videoplayer/VideoInformation;->setCurrentVideoId(Ljava/lang/String;)V")
|
|
||||||
|
|
||||||
offset++ // offset so setCurrentVideoId is called before any injected call
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private var offset = 2
|
private var videoIdRegister = 0
|
||||||
|
private var insertIndex = 0
|
||||||
|
|
||||||
private var videoIdRegister: Int = 0
|
|
||||||
private lateinit var result: MethodFingerprintResult
|
|
||||||
private lateinit var insertMethod: MutableMethod
|
private lateinit var insertMethod: MutableMethod
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,12 +49,10 @@ class VideoIdPatch : BytecodePatch(
|
|||||||
*/
|
*/
|
||||||
fun injectCall(
|
fun injectCall(
|
||||||
methodDescriptor: String
|
methodDescriptor: String
|
||||||
) {
|
) = insertMethod.addInstructions(
|
||||||
insertMethod.addInstructions(
|
insertIndex, // move-result-object offset
|
||||||
result.scanResult.patternScanResult!!.endIndex + offset, // move-result-object offset
|
"invoke-static {v$videoIdRegister}, $methodDescriptor"
|
||||||
"invoke-static {v$videoIdRegister}, $methodDescriptor"
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,10 +109,6 @@
|
|||||||
|
|
||||||
<string name="general_time_without_sb">Show time without segments</string>
|
<string name="general_time_without_sb">Show time without segments</string>
|
||||||
<string name="general_time_without_sb_sum">This time appears in brackets next to the current time. This shows the total video duration minus any segments.</string>
|
<string name="general_time_without_sb_sum">This time appears in brackets next to the current time. This shows the total video duration minus any segments.</string>
|
||||||
<string name="general_whitelisting">Channel whitelisting</string>
|
|
||||||
<string name="general_whitelisting_sum">Use the Segments button under the player to whitelist a channel</string>
|
|
||||||
<string name="general_browser_button">Enable SB Browser button</string>
|
|
||||||
<string name="general_browser_button_sum">Clicking this button under the player will open sb.ltn.fi where you can see all the segments on the video.</string>
|
|
||||||
<string name="segments_preview">Preview/Recap</string>
|
<string name="segments_preview">Preview/Recap</string>
|
||||||
<string name="segments_preview_sum">Recap of previous episodes, or a preview of what\'s coming up later in the current video or future videos in the same series. Clips should not provide additional information.</string>
|
<string name="segments_preview_sum">Recap of previous episodes, or a preview of what\'s coming up later in the current video or future videos in the same series. Clips should not provide additional information.</string>
|
||||||
<string name="stats">Stats</string>
|
<string name="stats">Stats</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user