mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-23 02:31:03 +00:00
Compare commits
16 Commits
v2.174.0-d
...
v2.174.0-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45784eceee | ||
|
|
f891aa937c | ||
|
|
aa493c4f67 | ||
|
|
a83e0dc257 | ||
|
|
5ea4d3c2a6 | ||
|
|
f4ae7fd9d7 | ||
|
|
b6539922fe | ||
|
|
a697b16aa3 | ||
|
|
ab22794ef2 | ||
|
|
cd6988a688 | ||
|
|
74ad4fa5ea | ||
|
|
382c441de5 | ||
|
|
7953a1a07b | ||
|
|
ac0ed24ef2 | ||
|
|
489663c890 | ||
|
|
599e089c12 |
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
|||||||
- name: Setup JDK
|
- name: Setup JDK
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
java-version: '11'
|
java-version: '17'
|
||||||
distribution: 'zulu'
|
distribution: 'zulu'
|
||||||
cache: gradle
|
cache: gradle
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
|
|||||||
49
CHANGELOG.md
49
CHANGELOG.md
@@ -1,3 +1,52 @@
|
|||||||
|
# [2.174.0-dev.18](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.17...v2.174.0-dev.18) (2023-05-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **youtube/theme:** apply custom seekbar color to video thumbnails ([#2085](https://github.com/revanced/revanced-patches/issues/2085)) ([d497027](https://github.com/revanced/revanced-patches/commit/d4970273ad10f62cd9455ef9b847c686147f7dca))
|
||||||
|
|
||||||
|
# [2.174.0-dev.17](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.16...v2.174.0-dev.17) (2023-05-09)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **youtube/remember-video-quality:** fix default video quality/speed being applied when resuming app. ([#2112](https://github.com/revanced/revanced-patches/issues/2112)) ([f68a41c](https://github.com/revanced/revanced-patches/commit/f68a41ce9f9a78818d3f28b069e70b8c66125f53))
|
||||||
|
|
||||||
|
# [2.174.0-dev.16](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.15...v2.174.0-dev.16) (2023-05-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* check for opcode type `CONST` ([e5bb63c](https://github.com/revanced/revanced-patches/commit/e5bb63c7ab4427b6116de4a999be306e0f3cf12e))
|
||||||
|
|
||||||
|
# [2.174.0-dev.15](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.14...v2.174.0-dev.15) (2023-05-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **messenger:** add `disable-switching-emoji-to-sticker-in-message-input-field` patch ([#2099](https://github.com/revanced/revanced-patches/issues/2099)) ([ac5532a](https://github.com/revanced/revanced-patches/commit/ac5532a65c353b1964d9b7d990341fc7362e510d))
|
||||||
|
|
||||||
|
# [2.174.0-dev.14](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.13...v2.174.0-dev.14) (2023-05-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **youtube/hide-player-overlay:** make it toggleable in settings ([#2044](https://github.com/revanced/revanced-patches/issues/2044)) ([f693d55](https://github.com/revanced/revanced-patches/commit/f693d55caf1e0b72bb1f4c39b1eeb59436191e02))
|
||||||
|
|
||||||
|
# [2.174.0-dev.13](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.12...v2.174.0-dev.13) (2023-05-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* account fo breaking changes from ReVanced Patcher ([#2103](https://github.com/revanced/revanced-patches/issues/2103)) ([5be25cd](https://github.com/revanced/revanced-patches/commit/5be25cde4b34d58ced35a7edbb499477b538b748))
|
||||||
|
|
||||||
|
# [2.174.0-dev.12](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.11...v2.174.0-dev.12) (2023-05-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **readme-generator:** attempt sorting versions with `FlexVer` ([#2059](https://github.com/revanced/revanced-patches/issues/2059)) ([a54c464](https://github.com/revanced/revanced-patches/commit/a54c464522fa2a6a2d2525c8cb0ec961c2cc771c))
|
||||||
|
|
||||||
# [2.174.0-dev.11](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.10...v2.174.0-dev.11) (2023-05-07)
|
# [2.174.0-dev.11](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.10...v2.174.0-dev.11) (2023-05-07)
|
||||||
|
|
||||||
# [2.174.0-dev.10](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.9...v2.174.0-dev.10) (2023-05-07)
|
# [2.174.0-dev.10](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.9...v2.174.0-dev.10) (2023-05-07)
|
||||||
|
|||||||
70
README.md
70
README.md
@@ -38,7 +38,7 @@ The official ReVanced Patches.
|
|||||||
| `hide-get-premium` | Hides advertisement for YouTube Premium under the video player. | 18.16.37 |
|
| `hide-get-premium` | Hides advertisement for YouTube Premium under the video player. | 18.16.37 |
|
||||||
| `hide-info-cards` | Hides info cards in videos. | 18.16.37 |
|
| `hide-info-cards` | Hides info cards in videos. | 18.16.37 |
|
||||||
| `hide-player-buttons` | Adds the option to hide video player previous and next buttons. | all |
|
| `hide-player-buttons` | Adds the option to hide video player previous and next buttons. | all |
|
||||||
| `hide-player-overlay` | Hides the dark player overlay when player controls are visible. | all |
|
| `hide-player-overlay` | Hides the dark background overlay from the player when player controls are visible. | all |
|
||||||
| `hide-seekbar` | Hides the seekbar. | 18.16.37 |
|
| `hide-seekbar` | Hides the seekbar. | 18.16.37 |
|
||||||
| `hide-timestamp` | Hides timestamp in video player. | 18.16.37 |
|
| `hide-timestamp` | Hides timestamp in video player. | 18.16.37 |
|
||||||
| `hide-video-action-buttons` | Adds the options to hide action buttons under a video. | 18.16.37 |
|
| `hide-video-action-buttons` | Adds the options to hide action buttons under a video. | 18.16.37 |
|
||||||
@@ -58,7 +58,6 @@ The official ReVanced Patches.
|
|||||||
| `spoof-app-version` | Tricks YouTube into thinking, you are running an older version of the app. One of the side effects also includes restoring the old UI. | 18.16.37 |
|
| `spoof-app-version` | Tricks YouTube into thinking, you are running an older version of the app. One of the side effects also includes restoring the old UI. | 18.16.37 |
|
||||||
| `swipe-controls` | Adds volume and brightness swipe controls. | 18.16.37 |
|
| `swipe-controls` | Adds volume and brightness swipe controls. | 18.16.37 |
|
||||||
| `tablet-mini-player` | Enables the tablet mini player layout. | 18.16.37 |
|
| `tablet-mini-player` | Enables the tablet mini player layout. | 18.16.37 |
|
||||||
| `theme` | Applies a custom theme. | all |
|
|
||||||
| `vanced-microg-support` | Allows YouTube ReVanced to run without root and under a different package name with Vanced MicroG. | 18.16.37 |
|
| `vanced-microg-support` | Allows YouTube ReVanced to run without root and under a different package name with Vanced MicroG. | 18.16.37 |
|
||||||
| `video-ads` | Removes ads in the video player. | 18.16.37 |
|
| `video-ads` | Removes ads in the video player. | 18.16.37 |
|
||||||
| `wide-searchbar` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | 18.16.37 |
|
| `wide-searchbar` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | 18.16.37 |
|
||||||
@@ -158,6 +157,15 @@ The official ReVanced Patches.
|
|||||||
| `premium-icon-reddit` | Unlocks premium Reddit app icons. | all |
|
| `premium-icon-reddit` | Unlocks premium Reddit app icons. | all |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
### [📦 `com.facebook.orca`](https://play.google.com/store/apps/details?id=com.facebook.orca)
|
||||||
|
<details>
|
||||||
|
|
||||||
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|
|:--------:|:--------------:|:-----------------:|
|
||||||
|
| `disable-switching-emoji-to-sticker-in-message-input-field` | Disables switching from emoji to sticker search mode in message input field | all |
|
||||||
|
| `hide-inbox-ads` | Hides ads in inbox. | all |
|
||||||
|
</details>
|
||||||
|
|
||||||
### [📦 `at.gv.bmf.bmf2go`](https://play.google.com/store/apps/details?id=at.gv.bmf.bmf2go)
|
### [📦 `at.gv.bmf.bmf2go`](https://play.google.com/store/apps/details?id=at.gv.bmf.bmf2go)
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
@@ -216,14 +224,6 @@ The official ReVanced Patches.
|
|||||||
| `hide-ads` | Removes general ads. | all |
|
| `hide-ads` | Removes general ads. | all |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
### [📦 `com.facebook.orca`](https://play.google.com/store/apps/details?id=com.facebook.orca)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `hide-inbox-ads` | Hides ads in inbox. | all |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `com.instagram.android`](https://play.google.com/store/apps/details?id=com.instagram.android)
|
### [📦 `com.instagram.android`](https://play.google.com/store/apps/details?id=com.instagram.android)
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
@@ -312,30 +312,6 @@ The official ReVanced Patches.
|
|||||||
| `unlock-prime` | Unlocks Nova Prime and all functions of the app. | all |
|
| `unlock-prime` | Unlocks Nova Prime and all functions of the app. | all |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
### [📦 `co.windyapp.android`](https://play.google.com/store/apps/details?id=co.windyapp.android)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `unlock-pro` | Unlocks all pro features. | all |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `org.totschnig.myexpenses`](https://play.google.com/store/apps/details?id=org.totschnig.myexpenses)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `unlock-pro` | Unlocks all professional features. | 3.4.9 |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `com.zombodroid.MemeGenerator`](https://play.google.com/store/apps/details?id=com.zombodroid.MemeGenerator)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `unlock-pro` | Unlocks pro features. | 4.6377 |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `com.ithebk.expensemanager`](https://play.google.com/store/apps/details?id=com.ithebk.expensemanager)
|
### [📦 `com.ithebk.expensemanager`](https://play.google.com/store/apps/details?id=com.ithebk.expensemanager)
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
@@ -344,6 +320,14 @@ The official ReVanced Patches.
|
|||||||
| `unlock-pro` | Unlocks pro features. | all |
|
| `unlock-pro` | Unlocks pro features. | all |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
### [📦 `com.awedea.nyx`](https://play.google.com/store/apps/details?id=com.awedea.nyx)
|
||||||
|
<details>
|
||||||
|
|
||||||
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|
|:--------:|:--------------:|:-----------------:|
|
||||||
|
| `unlock-pro` | Unlocks all pro features. | all |
|
||||||
|
</details>
|
||||||
|
|
||||||
### [📦 `ginlemon.iconpackstudio`](https://play.google.com/store/apps/details?id=ginlemon.iconpackstudio)
|
### [📦 `ginlemon.iconpackstudio`](https://play.google.com/store/apps/details?id=ginlemon.iconpackstudio)
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
@@ -352,7 +336,7 @@ The official ReVanced Patches.
|
|||||||
| `unlock-pro` | Unlocks all pro features. | all |
|
| `unlock-pro` | Unlocks all pro features. | all |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
### [📦 `com.awedea.nyx`](https://play.google.com/store/apps/details?id=com.awedea.nyx)
|
### [📦 `co.windyapp.android`](https://play.google.com/store/apps/details?id=co.windyapp.android)
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
@@ -360,6 +344,22 @@ The official ReVanced Patches.
|
|||||||
| `unlock-pro` | Unlocks all pro features. | all |
|
| `unlock-pro` | Unlocks all pro features. | all |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
### [📦 `com.zombodroid.MemeGenerator`](https://play.google.com/store/apps/details?id=com.zombodroid.MemeGenerator)
|
||||||
|
<details>
|
||||||
|
|
||||||
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|
|:--------:|:--------------:|:-----------------:|
|
||||||
|
| `unlock-pro` | Unlocks pro features. | 4.6377 |
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### [📦 `org.totschnig.myexpenses`](https://play.google.com/store/apps/details?id=org.totschnig.myexpenses)
|
||||||
|
<details>
|
||||||
|
|
||||||
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|
|:--------:|:--------------:|:-----------------:|
|
||||||
|
| `unlock-pro` | Unlocks all professional features. | 3.4.9 |
|
||||||
|
</details>
|
||||||
|
|
||||||
### [📦 `com.ticktick.task`](https://play.google.com/store/apps/details?id=com.ticktick.task)
|
### [📦 `com.ticktick.task`](https://play.google.com/store/apps/details?id=com.ticktick.task)
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,13 @@ repositories {
|
|||||||
password = githubPassword
|
password = githubPassword
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Required for FlexVer-Java
|
||||||
|
maven {
|
||||||
|
url = uri("https://repo.sleeping.town")
|
||||||
|
content {
|
||||||
|
includeGroup("com.unascribed")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -24,6 +31,8 @@ dependencies {
|
|||||||
implementation("app.revanced:multidexlib2:2.5.3-a3836654")
|
implementation("app.revanced:multidexlib2:2.5.3-a3836654")
|
||||||
// Required for meta
|
// Required for meta
|
||||||
implementation("com.google.code.gson:gson:2.10.1")
|
implementation("com.google.code.gson:gson:2.10.1")
|
||||||
|
// Required for FlexVer-Java
|
||||||
|
implementation("com.unascribed:flexver-java:1.0.2")
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.174.0-dev.11
|
version = 2.174.0-dev.18
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -5,6 +5,7 @@ import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
|||||||
import app.revanced.patcher.extensions.PatchExtensions.description
|
import app.revanced.patcher.extensions.PatchExtensions.description
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||||
import app.revanced.patcher.patch.Patch
|
import app.revanced.patcher.patch.Patch
|
||||||
|
import com.unascribed.flexver.FlexVerComparator
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
internal class ReadmeGenerator : PatchesFileGenerator {
|
internal class ReadmeGenerator : PatchesFileGenerator {
|
||||||
@@ -37,9 +38,8 @@ internal class ReadmeGenerator : PatchesFileGenerator {
|
|||||||
}
|
}
|
||||||
}.let { commonMap ->
|
}.let { commonMap ->
|
||||||
commonMap.maxByOrNull { it.value }?.value?.let {
|
commonMap.maxByOrNull { it.value }?.value?.let {
|
||||||
// This is not foolproof, because for example v1.0.0-dev.0 will be returned instead of v1.0.0-release.
|
commonMap.entries.filter { mostCommon -> mostCommon.value == it }
|
||||||
// Unfortunately this can not be solved easily because versioning can be complex.
|
.maxOfWith(FlexVerComparator::compare, Map.Entry<String, Int>::key)
|
||||||
commonMap.entries.filter { mostCommon -> mostCommon.value == it }.maxBy { it.key }.key
|
|
||||||
} ?: "all"
|
} ?: "all"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package app.revanced.patches.messenger.inputfield.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object SwitchMessangeInputEmojiButtonFingerprint : MethodFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
parameters = listOf("L", "Z"),
|
||||||
|
strings = listOf("afterTextChanged", "expression_search"),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.IF_EQZ,
|
||||||
|
Opcode.CONST_STRING,
|
||||||
|
Opcode.GOTO,
|
||||||
|
Opcode.CONST_STRING,
|
||||||
|
Opcode.GOTO
|
||||||
|
)
|
||||||
|
)
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package app.revanced.patches.messenger.inputfield.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
import app.revanced.patcher.annotation.*
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patches.messenger.inputfield.fingerprints.SwitchMessangeInputEmojiButtonFingerprint
|
||||||
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("disable-switching-emoji-to-sticker-in-message-input-field")
|
||||||
|
@Description("Disables switching from emoji to sticker search mode in message input field")
|
||||||
|
@Compatibility([Package("com.facebook.orca")])
|
||||||
|
@Version("0.0.1")
|
||||||
|
class DisableSwitchingEmojiToStickerInMessageInputField : BytecodePatch(listOf(SwitchMessangeInputEmojiButtonFingerprint)) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
SwitchMessangeInputEmojiButtonFingerprint.result?.let {
|
||||||
|
val setStringIndex = it.scanResult.patternScanResult!!.startIndex + 2
|
||||||
|
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val targetRegister = instruction<OneRegisterInstruction>(setStringIndex).registerA
|
||||||
|
|
||||||
|
replaceInstruction(
|
||||||
|
setStringIndex,
|
||||||
|
"const-string v$targetRegister, \"expression\""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: throw SwitchMessangeInputEmojiButtonFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -36,7 +36,7 @@ class UnlockProPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
|
|
||||||
val setThemeMethod = SetThemeFingerprint.result!!.mutableMethod
|
val setThemeMethod = SetThemeFingerprint.result!!.mutableMethod
|
||||||
setThemeMethod.removeInstructions(0, 9)
|
setThemeMethod.removeInstructions(0, 10)
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class UnlockPaidWidgetsPatch : BytecodePatch(
|
|||||||
fingerprint.result?.mutableMethod ?: return fingerprint.toErrorResult()
|
fingerprint.result?.mutableMethod ?: return fingerprint.toErrorResult()
|
||||||
}.forEach { method ->
|
}.forEach { method ->
|
||||||
method.apply {
|
method.apply {
|
||||||
removeInstructions(4, 2)
|
removeInstructions(4, 3)
|
||||||
addInstructions(
|
addInstructions(
|
||||||
implementation?.instructions?.size!!, """
|
implementation?.instructions?.size!!, """
|
||||||
const/4 v1, 0x0
|
const/4 v1, 0x0
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class HideViewsBytecodePatch : BytecodePatch(
|
|||||||
TweetStatsContainerConstructorFingerprint,
|
TweetStatsContainerConstructorFingerprint,
|
||||||
returnFingerprint
|
returnFingerprint
|
||||||
) { patternScanResult, method ->
|
) { patternScanResult, method ->
|
||||||
method.removeInstructions(patternScanResult.endIndex - 3, 2)
|
method.removeInstructions(patternScanResult.endIndex - 3, 3)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,13 +80,13 @@ class HideViewsBytecodePatch : BytecodePatch(
|
|||||||
TweetStatsContainerWrapperConstructorFingerprint,
|
TweetStatsContainerWrapperConstructorFingerprint,
|
||||||
wrapperReturnFingerprint
|
wrapperReturnFingerprint
|
||||||
) { patternScanResult, method ->
|
) { patternScanResult, method ->
|
||||||
method.removeInstructions(patternScanResult.startIndex - 4, 3)
|
method.removeInstructions(patternScanResult.startIndex - 4, 4)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun removeViewDelegateBinderSubscription() {
|
private fun removeViewDelegateBinderSubscription() {
|
||||||
transformMethod(TweetStatsViewDelegateBinderFingerprint) { result, method ->
|
transformMethod(TweetStatsViewDelegateBinderFingerprint) { result, method ->
|
||||||
method.removeInstructions(result.scanResult.patternScanResult!!.startIndex - 4, 9)
|
method.removeInstructions(result.scanResult.patternScanResult!!.startIndex - 4, 10)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,16 +12,12 @@ import app.revanced.patcher.patch.annotations.Patch
|
|||||||
import app.revanced.patches.youtube.layout.buttons.player.background.annotations.PlayerButtonBackgroundCompatibility
|
import app.revanced.patches.youtube.layout.buttons.player.background.annotations.PlayerButtonBackgroundCompatibility
|
||||||
import org.w3c.dom.Element
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
@Patch
|
@Patch(false)
|
||||||
@Name("remove-player-button-background")
|
@Name("remove-player-button-background")
|
||||||
@Description("Removes the background from the video player buttons.")
|
@Description("Removes the background from the video player buttons.")
|
||||||
@PlayerButtonBackgroundCompatibility
|
@PlayerButtonBackgroundCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class PlayerButtonBackgroundPatch : ResourcePatch {
|
class PlayerButtonBackgroundPatch : ResourcePatch {
|
||||||
private companion object {
|
|
||||||
const val RESOURCE_FILE_PATH = "res/drawable/player_button_circle_background.xml"
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun execute(context: ResourceContext): PatchResult {
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
context.xmlEditor[RESOURCE_FILE_PATH].use { editor ->
|
context.xmlEditor[RESOURCE_FILE_PATH].use { editor ->
|
||||||
editor.file.doRecursively node@{ node ->
|
editor.file.doRecursively node@{ node ->
|
||||||
@@ -35,4 +31,8 @@ class PlayerButtonBackgroundPatch : ResourcePatch {
|
|||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private companion object {
|
||||||
|
const val RESOURCE_FILE_PATH = "res/drawable/player_button_circle_background.xml"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hide.player.overlay.bytecode.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.hide.player.overlay.resource.patch.HidePlayerOverlayResourcePatch
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
||||||
|
|
||||||
|
object CreatePlayerOverviewFingerprint : MethodFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
access = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.CONST,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.CHECK_CAST
|
||||||
|
),
|
||||||
|
customFingerprint = { methodDef ->
|
||||||
|
methodDef.implementation?.instructions?.any {
|
||||||
|
if (it.opcode != Opcode.CONST) return@any false
|
||||||
|
|
||||||
|
val literal = (it as WideLiteralInstruction).wideLiteral
|
||||||
|
|
||||||
|
literal == HidePlayerOverlayResourcePatch.scrimOverlayId
|
||||||
|
} ?: false
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hide.player.overlay.bytecode.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patches.youtube.layout.hide.player.overlay.annotations.HidePlayerOverlayPatchCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.hide.player.overlay.bytecode.fingerprints.CreatePlayerOverviewFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.hide.player.overlay.resource.patch.HidePlayerOverlayResourcePatch
|
||||||
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("hide-player-overlay")
|
||||||
|
@Description("Hides the dark background overlay from the player when player controls are visible.")
|
||||||
|
@DependsOn([HidePlayerOverlayResourcePatch::class])
|
||||||
|
@HidePlayerOverlayPatchCompatibility
|
||||||
|
@Version("0.0.2")
|
||||||
|
class HidePlayerOverlayPatch : BytecodePatch(listOf(CreatePlayerOverviewFingerprint)) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
CreatePlayerOverviewFingerprint.result?.let { result ->
|
||||||
|
result.mutableMethod.apply {
|
||||||
|
val viewRegisterIndex = implementation!!.instructions.indexOfFirst {
|
||||||
|
val literal = (it as? WideLiteralInstruction)?.wideLiteral
|
||||||
|
|
||||||
|
literal == HidePlayerOverlayResourcePatch.scrimOverlayId
|
||||||
|
} + 3
|
||||||
|
val viewRegister = instruction<OneRegisterInstruction>(viewRegisterIndex).registerA
|
||||||
|
|
||||||
|
val insertIndex = viewRegisterIndex + 1
|
||||||
|
addInstruction(
|
||||||
|
insertIndex,
|
||||||
|
"invoke-static { v$viewRegister }, " +
|
||||||
|
"$INTEGRATIONS_CLASS_DESCRIPTOR->hidePlayerOverlay(Landroid/widget/ImageView;)V"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: return CreatePlayerOverviewFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
private companion object {
|
||||||
|
const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/HidePlayerOverlayPatch;"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.layout.hide.player.overlay.patch
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.ResourceContext
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.ResourcePatch
|
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
import app.revanced.patches.youtube.layout.hide.player.overlay.annotations.HidePlayerOverlayPatchCompatibility
|
|
||||||
|
|
||||||
@Patch(false)
|
|
||||||
@Name("hide-player-overlay")
|
|
||||||
@Description("Hides the dark player overlay when player controls are visible.")
|
|
||||||
@HidePlayerOverlayPatchCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class HidePlayerOverlayPatch : ResourcePatch {
|
|
||||||
override fun execute(context: ResourceContext): PatchResult {
|
|
||||||
val attributes = arrayOf("height", "width")
|
|
||||||
|
|
||||||
context.xmlEditor[RESOURCE_FILE_PATH].use { editor ->
|
|
||||||
editor.file.getElementsByTagName("FrameLayout").item(0).childNodes.apply {
|
|
||||||
for (i in 1 until length) {
|
|
||||||
val view = item(i)
|
|
||||||
if (
|
|
||||||
view.attributes.getNamedItem("android:id")
|
|
||||||
?.nodeValue
|
|
||||||
?.endsWith("scrim_overlay") == true
|
|
||||||
) {
|
|
||||||
attributes.forEach {
|
|
||||||
view.attributes.getNamedItem("android:layout_$it").nodeValue = "0.0dip"
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
|
|
||||||
private companion object {
|
|
||||||
const val RESOURCE_FILE_PATH = "res/layout/youtube_controls_overlay.xml"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hide.player.overlay.resource.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.data.ResourceContext
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||||
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||||
|
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||||
|
import app.revanced.patches.youtube.layout.hide.player.overlay.annotations.HidePlayerOverlayPatchCompatibility
|
||||||
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
|
import jdk.jfr.Name
|
||||||
|
|
||||||
|
@Name("hide-player-overlay-resource-patch")
|
||||||
|
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||||
|
@HidePlayerOverlayPatchCompatibility
|
||||||
|
class HidePlayerOverlayResourcePatch : ResourcePatch {
|
||||||
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_hide_player_overlay",
|
||||||
|
StringResource("revanced_hide_player_overlay_title", "Hide background overlay in player"),
|
||||||
|
false,
|
||||||
|
StringResource("revanced_hide_player_overlay_summary_on", "Background overlay is hidden"),
|
||||||
|
StringResource("revanced_hide_player_overlay_summary_off", "Background overlay is shown")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
scrimOverlayId = ResourceMappingPatch.resourceMappings.single {
|
||||||
|
it.type == "id" && it.name == "scrim_overlay"
|
||||||
|
}.id
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
internal companion object {
|
||||||
|
var scrimOverlayId: Long = -1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,11 +16,16 @@ import app.revanced.patches.shared.fingerprints.SeekbarOnDrawFingerprint
|
|||||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||||
import app.revanced.patches.youtube.layout.hide.seekbar.annotations.HideSeekbarCompatibility
|
import app.revanced.patches.youtube.layout.hide.seekbar.annotations.HideSeekbarCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.seekbar.bytecode.patch.SeekbarColorBytecodePatch
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
@DependsOn([
|
||||||
|
IntegrationsPatch::class,
|
||||||
|
SettingsPatch::class,
|
||||||
|
SeekbarColorBytecodePatch::class // Used to hide the seekbar in the feed and watch history
|
||||||
|
])
|
||||||
@Name("hide-seekbar")
|
@Name("hide-seekbar")
|
||||||
@Description("Hides the seekbar.")
|
@Description("Hides the seekbar.")
|
||||||
@HideSeekbarCompatibility
|
@HideSeekbarCompatibility
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.seekbar.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility([Package("com.google.android.youtube")])
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
internal annotation class SeekbarColorCompatibility
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.seekbar.bytecode.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.seekbar.resource.SeekbarColorResourcePatch
|
||||||
|
import app.revanced.util.patch.indexOfFirstConstantInstruction
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
object CreateDarkThemeSeekbarFingerprint : MethodFingerprint(
|
||||||
|
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||||
|
customFingerprint = { method ->
|
||||||
|
method.indexOfFirstConstantInstruction(SeekbarColorResourcePatch.inlineTimeBarColorizedBarPlayedColorDarkId) != -1
|
||||||
|
&& method.indexOfFirstConstantInstruction(SeekbarColorResourcePatch.inlineTimeBarPlayedNotHighlightedColorId) != -1
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.layout.theme.bytecode.fingerprints
|
package app.revanced.patches.youtube.layout.seekbar.bytecode.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.seekbar.bytecode.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.data.toMethodWalker
|
||||||
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
|
import app.revanced.patches.youtube.layout.seekbar.annotations.SeekbarColorCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.seekbar.bytecode.fingerprints.CreateDarkThemeSeekbarFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.seekbar.bytecode.fingerprints.SetSeekbarClickedColorFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.theme.bytecode.patch.LithoColorHookPatch
|
||||||
|
import app.revanced.patches.youtube.layout.theme.bytecode.patch.LithoColorHookPatch.Companion.lithoColorOverrideHook
|
||||||
|
import app.revanced.patches.youtube.layout.seekbar.resource.SeekbarColorResourcePatch
|
||||||
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
|
import app.revanced.util.patch.indexOfFirstConstantInstruction
|
||||||
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
|
|
||||||
|
@Description("Hide or set a custom seekbar color")
|
||||||
|
@DependsOn([IntegrationsPatch::class, LithoColorHookPatch::class, SeekbarColorResourcePatch::class])
|
||||||
|
@SeekbarColorCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class SeekbarColorBytecodePatch : BytecodePatch(
|
||||||
|
listOf(CreateDarkThemeSeekbarFingerprint, SetSeekbarClickedColorFingerprint)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
CreateDarkThemeSeekbarFingerprint.result?.mutableMethod?.apply {
|
||||||
|
var registerIndex = indexOfFirstConstantInstruction(SeekbarColorResourcePatch.inlineTimeBarColorizedBarPlayedColorDarkId) + 2
|
||||||
|
var colorRegister = (instruction(registerIndex) as OneRegisterInstruction).registerA
|
||||||
|
addInstructions(
|
||||||
|
registerIndex + 1,
|
||||||
|
"""
|
||||||
|
invoke-static { v$colorRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->getSeekbarColorValue(I)I
|
||||||
|
move-result v$colorRegister
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
registerIndex = indexOfFirstConstantInstruction(SeekbarColorResourcePatch.inlineTimeBarPlayedNotHighlightedColorId) + 2
|
||||||
|
colorRegister = (instruction(registerIndex) as OneRegisterInstruction).registerA
|
||||||
|
addInstructions(
|
||||||
|
registerIndex + 1,
|
||||||
|
"""
|
||||||
|
invoke-static { v$colorRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->getSeekbarColorValue(I)I
|
||||||
|
move-result v$colorRegister
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
} ?: return CreateDarkThemeSeekbarFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
SetSeekbarClickedColorFingerprint.result?.let { result ->
|
||||||
|
result.mutableMethod.let {
|
||||||
|
val setColorMethodIndex = result.scanResult.patternScanResult!!.startIndex + 1
|
||||||
|
val method = context
|
||||||
|
.toMethodWalker(it)
|
||||||
|
.nextMethod(setColorMethodIndex, true)
|
||||||
|
.getMethod() as MutableMethod
|
||||||
|
|
||||||
|
method.apply {
|
||||||
|
val colorRegister = (method.instruction(0) as TwoRegisterInstruction).registerA
|
||||||
|
addInstructions(
|
||||||
|
0,
|
||||||
|
"""
|
||||||
|
invoke-static { v$colorRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->getSeekbarColorOverride(I)I
|
||||||
|
move-result v$colorRegister
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} ?: return SetSeekbarClickedColorFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
lithoColorOverrideHook(INTEGRATIONS_CLASS_DESCRIPTOR, "getSeekbarColorOverride")
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
private companion object {
|
||||||
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/theme/SeekbarColorPatch;"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.seekbar.resource
|
||||||
|
|
||||||
|
import app.revanced.patcher.data.ResourceContext
|
||||||
|
import app.revanced.patcher.patch.*
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
|
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||||
|
class SeekbarColorResourcePatch : ResourcePatch {
|
||||||
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
// Edit theme colors via bytecode.
|
||||||
|
// For that the resource id is used in a bytecode patch to change the color.
|
||||||
|
|
||||||
|
val seekbarErrorMessage = "Could not find seekbar resource"
|
||||||
|
inlineTimeBarColorizedBarPlayedColorDarkId = ResourceMappingPatch.resourceMappings
|
||||||
|
.find { it.name == "inline_time_bar_colorized_bar_played_color_dark" }?.id
|
||||||
|
?: return PatchResultError(seekbarErrorMessage)
|
||||||
|
inlineTimeBarPlayedNotHighlightedColorId = ResourceMappingPatch.resourceMappings
|
||||||
|
.find { it.name == "inline_time_bar_played_not_highlighted_color" }?.id
|
||||||
|
?: return PatchResultError(seekbarErrorMessage)
|
||||||
|
|
||||||
|
// Edit the resume playback drawable and replace the progress bar with a custom drawable
|
||||||
|
context.xmlEditor["res/drawable/resume_playback_progressbar_drawable.xml"].use { editor ->
|
||||||
|
val layerList = editor.file.getElementsByTagName("layer-list").item(0) as Element
|
||||||
|
val progressNode = layerList.getElementsByTagName("item").item(1) as Element
|
||||||
|
if (!progressNode.getAttributeNode("android:id").value.endsWith("progress")) {
|
||||||
|
return PatchResultError("Could not find progress bar")
|
||||||
|
}
|
||||||
|
val scaleNode = progressNode.getElementsByTagName("scale").item(0) as Element
|
||||||
|
val shapeNode = scaleNode.getElementsByTagName("shape").item(0) as Element
|
||||||
|
val replacementNode = editor.file.createElement(
|
||||||
|
"app.revanced.integrations.patches.theme.ProgressBarDrawable")
|
||||||
|
scaleNode.replaceChild(replacementNode, shapeNode)
|
||||||
|
}
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
internal var inlineTimeBarColorizedBarPlayedColorDarkId = -1L
|
||||||
|
internal var inlineTimeBarPlayedNotHighlightedColorId = -1L
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.layout.theme.bytecode.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import app.revanced.patches.youtube.layout.theme.bytecode.fingerprints.CreateDarkThemeSeekbarFingerprint.indexOfInstructionWithSeekbarId
|
|
||||||
import app.revanced.patches.youtube.layout.theme.resource.ThemeResourcePatch
|
|
||||||
import org.jf.dexlib2.AccessFlags
|
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
import org.jf.dexlib2.iface.Method
|
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
object CreateDarkThemeSeekbarFingerprint : MethodFingerprint(
|
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
|
||||||
customFingerprint = { method -> method.indexOfInstructionWithSeekbarId != -1 },
|
|
||||||
) {
|
|
||||||
/**
|
|
||||||
* The index of the instruction that loads the resource id of the seekbar.
|
|
||||||
*/
|
|
||||||
internal val Method.indexOfInstructionWithSeekbarId
|
|
||||||
get() = implementation?.let {
|
|
||||||
it.instructions.indexOfFirst { instruction ->
|
|
||||||
instruction.opcode == Opcode.CONST && (instruction as WideLiteralInstruction).wideLiteral == ThemeResourcePatch.inlineTimeBarColorizedBarPlayedColorDarkId
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.layout.theme.fingerprints
|
package app.revanced.patches.youtube.layout.theme.bytecode.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.theme.bytecode.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
|
import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.theme.bytecode.fingerprints.LithoThemeFingerprint
|
||||||
|
|
||||||
|
@Name("litho-color-hook")
|
||||||
|
@Description("Adds a hook to set color of Litho components.")
|
||||||
|
@ThemeCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class LithoColorHookPatch : BytecodePatch(listOf(LithoThemeFingerprint)) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
LithoThemeFingerprint.result?.let {
|
||||||
|
insertionIndex = it.scanResult.patternScanResult!!.endIndex - 1
|
||||||
|
colorRegister = "p1"
|
||||||
|
insertionMethod = it.mutableMethod
|
||||||
|
} ?: return LithoThemeFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
companion object {
|
||||||
|
private var insertionIndex : Int = -1
|
||||||
|
private lateinit var colorRegister : String
|
||||||
|
private lateinit var insertionMethod : MutableMethod
|
||||||
|
|
||||||
|
internal fun lithoColorOverrideHook(targetMethodClass: String, targetMethodName: String) {
|
||||||
|
insertionMethod.addInstructions(
|
||||||
|
insertionIndex,
|
||||||
|
"""
|
||||||
|
invoke-static {$colorRegister}, $targetMethodClass->$targetMethodName(I)I
|
||||||
|
move-result $colorRegister
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
insertionIndex += 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,76 +1,34 @@
|
|||||||
package app.revanced.patches.youtube.layout.theme.bytecode.patch
|
package app.revanced.patches.youtube.layout.theme.bytecode.patch
|
||||||
|
|
||||||
import app.revanced.extensions.toErrorResult
|
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.data.toMethodWalker
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
|
||||||
import app.revanced.patcher.extensions.instruction
|
|
||||||
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.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patches.youtube.layout.seekbar.bytecode.patch.SeekbarColorBytecodePatch
|
||||||
import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
|
import app.revanced.patches.youtube.layout.seekbar.bytecode.fingerprints.CreateDarkThemeSeekbarFingerprint
|
||||||
import app.revanced.patches.youtube.layout.theme.bytecode.fingerprints.CreateDarkThemeSeekbarFingerprint
|
import app.revanced.patches.youtube.layout.seekbar.bytecode.fingerprints.SetSeekbarClickedColorFingerprint
|
||||||
import app.revanced.patches.youtube.layout.theme.bytecode.fingerprints.CreateDarkThemeSeekbarFingerprint.indexOfInstructionWithSeekbarId
|
|
||||||
import app.revanced.patches.youtube.layout.theme.bytecode.fingerprints.SetSeekbarClickedColorFingerprint
|
|
||||||
import app.revanced.patches.youtube.layout.theme.resource.ThemeResourcePatch
|
import app.revanced.patches.youtube.layout.theme.resource.ThemeResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
|
||||||
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("theme")
|
@Name("theme")
|
||||||
@Description("Applies a custom theme.")
|
@Description("Applies a custom theme.")
|
||||||
@DependsOn([ThemeLithoComponentsPatch::class, ThemeResourcePatch::class, IntegrationsPatch::class])
|
@DependsOn([LithoColorHookPatch::class, SeekbarColorBytecodePatch::class, ThemeResourcePatch::class])
|
||||||
@ThemeCompatibility
|
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class ThemeBytecodePatch : BytecodePatch(
|
class ThemeBytecodePatch : BytecodePatch(
|
||||||
listOf(CreateDarkThemeSeekbarFingerprint, SetSeekbarClickedColorFingerprint)
|
listOf(CreateDarkThemeSeekbarFingerprint, SetSeekbarClickedColorFingerprint)
|
||||||
) {
|
) {
|
||||||
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
CreateDarkThemeSeekbarFingerprint.result?.let {
|
LithoColorHookPatch.lithoColorOverrideHook(INTEGRATIONS_CLASS_DESCRIPTOR, "getValue")
|
||||||
val putColorValueIndex = it.method.indexOfInstructionWithSeekbarId!! + 3
|
|
||||||
|
|
||||||
it.mutableMethod.apply {
|
|
||||||
val overrideRegister = instruction<TwoRegisterInstruction>(putColorValueIndex).registerA
|
|
||||||
|
|
||||||
addInstructions(
|
|
||||||
putColorValueIndex,
|
|
||||||
"""
|
|
||||||
invoke-static { }, $INTEGRATIONS_CLASS_DESCRIPTOR->getSeekbarColorValue()I
|
|
||||||
move-result v$overrideRegister
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} ?: return CreateDarkThemeSeekbarFingerprint.toErrorResult()
|
|
||||||
|
|
||||||
SetSeekbarClickedColorFingerprint.result?.let { result ->
|
|
||||||
result.mutableMethod.let {
|
|
||||||
val setColorMethodIndex = result.scanResult.patternScanResult!!.startIndex + 1
|
|
||||||
val method = context
|
|
||||||
.toMethodWalker(it)
|
|
||||||
.nextMethod(setColorMethodIndex, true)
|
|
||||||
.getMethod() as MutableMethod
|
|
||||||
|
|
||||||
method.apply {
|
|
||||||
val colorRegister = method.instruction<TwoRegisterInstruction>(0).registerA
|
|
||||||
addInstructions(
|
|
||||||
0,
|
|
||||||
"""
|
|
||||||
invoke-static { v$colorRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->getSeekbarClickedColorValue(I)I
|
|
||||||
move-result v$colorRegister
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} ?: return SetSeekbarClickedColorFingerprint.toErrorResult()
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object : OptionsContainer() {
|
companion object : OptionsContainer() {
|
||||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/theme/ThemePatch;"
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/theme/ThemeLithoComponentsPatch;"
|
||||||
|
|
||||||
var darkThemeBackgroundColor: String? by option(
|
var darkThemeBackgroundColor: String? by option(
|
||||||
PatchOption.StringOption(
|
PatchOption.StringOption(
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.layout.theme.bytecode.patch
|
|
||||||
|
|
||||||
import app.revanced.extensions.toErrorResult
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
|
|
||||||
import app.revanced.patches.youtube.layout.theme.fingerprints.LithoThemeFingerprint
|
|
||||||
|
|
||||||
@Name("theme-litho-components")
|
|
||||||
@Description("Applies a custom theme to Litho components.")
|
|
||||||
@ThemeCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class ThemeLithoComponentsPatch : BytecodePatch(listOf(LithoThemeFingerprint)) {
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
|
||||||
LithoThemeFingerprint.result?.let {
|
|
||||||
it.mutableMethod.apply {
|
|
||||||
val patchIndex = it.scanResult.patternScanResult!!.endIndex - 1
|
|
||||||
|
|
||||||
addInstructions(
|
|
||||||
patchIndex,
|
|
||||||
"""
|
|
||||||
invoke-static {p1}, $INTEGRATIONS_CLASS_DESCRIPTOR->getValue(I)I
|
|
||||||
move-result p1
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} ?: return LithoThemeFingerprint.toErrorResult()
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
|
|
||||||
private companion object {
|
|
||||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/theme/ThemeLithoComponentsPatch;"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +1,7 @@
|
|||||||
package app.revanced.patches.youtube.layout.theme.resource
|
package app.revanced.patches.youtube.layout.theme.resource
|
||||||
|
|
||||||
import app.revanced.patcher.data.ResourceContext
|
import app.revanced.patcher.data.ResourceContext
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.*
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.ResourcePatch
|
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||||
import app.revanced.patches.shared.settings.preference.impl.InputType
|
import app.revanced.patches.shared.settings.preference.impl.InputType
|
||||||
@@ -28,19 +25,11 @@ class ThemeResourcePatch : ResourcePatch {
|
|||||||
"#FF0000",
|
"#FF0000",
|
||||||
StringResource(
|
StringResource(
|
||||||
"revanced_seekbar_color_summary",
|
"revanced_seekbar_color_summary",
|
||||||
"The color of the seekbar for the dark theme."
|
"The color of the seekbar"
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
// Edit theme colors via bytecode.
|
|
||||||
// For that the resource id is used in a bytecode patch to change the color.
|
|
||||||
|
|
||||||
inlineTimeBarColorizedBarPlayedColorDarkId = ResourceMappingPatch.resourceMappings
|
|
||||||
.find { it.name == "inline_time_bar_colorized_bar_played_color_dark" }?.id
|
|
||||||
?: return PatchResultError("Could not find seekbar resource")
|
|
||||||
|
|
||||||
|
|
||||||
val darkThemeBackgroundColor = darkThemeBackgroundColor!!
|
val darkThemeBackgroundColor = darkThemeBackgroundColor!!
|
||||||
val lightThemeBackgroundColor = lightThemeBackgroundColor!!
|
val lightThemeBackgroundColor = lightThemeBackgroundColor!!
|
||||||
|
|
||||||
@@ -72,7 +61,4 @@ class ThemeResourcePatch : ResourcePatch {
|
|||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
internal companion object {
|
|
||||||
var inlineTimeBarColorizedBarPlayedColorDarkId = -1L
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class VideoInformationPatch : BytecodePatch(
|
|||||||
playerInitMethod = mutableClass.methods.first { MethodUtil.isConstructor(it) }
|
playerInitMethod = mutableClass.methods.first { MethodUtil.isConstructor(it) }
|
||||||
|
|
||||||
// hook the player controller for use through integrations
|
// hook the player controller for use through integrations
|
||||||
onCreateHook(INTEGRATIONS_CLASS_DESCRIPTOR, "playerController_onCreateHook")
|
onCreateHook(INTEGRATIONS_CLASS_DESCRIPTOR, "initialize")
|
||||||
|
|
||||||
// seek method
|
// seek method
|
||||||
val seekFingerprintResultMethod = SeekFingerprint.also { it.resolve(context, classDef) }.result!!.method
|
val seekFingerprintResultMethod = SeekFingerprint.also { it.resolve(context, classDef) }.result!!.method
|
||||||
@@ -160,24 +160,32 @@ class VideoInformationPatch : BytecodePatch(
|
|||||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/VideoInformation;"
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/VideoInformation;"
|
||||||
|
|
||||||
private lateinit var playerInitMethod: MutableMethod
|
private lateinit var playerInitMethod: MutableMethod
|
||||||
|
private var playerInitInsertIndex = 4
|
||||||
|
|
||||||
private lateinit var timeMethod: MutableMethod
|
private lateinit var timeMethod: MutableMethod
|
||||||
|
private var timeInitInsertIndex = 2
|
||||||
|
|
||||||
private lateinit var highPrecisionTimeMethod: MutableMethod
|
private lateinit var highPrecisionTimeMethod: MutableMethod
|
||||||
|
private var highPrecisionInsertIndex = 0
|
||||||
|
|
||||||
private fun MutableMethod.insert(insert: InsertIndex, register: String, descriptor: String) =
|
private fun MutableMethod.insert(insertIndex: Int, register: String, descriptor: String) =
|
||||||
addInstruction(insert.index, "invoke-static { $register }, $descriptor")
|
addInstruction(insertIndex, "invoke-static { $register }, $descriptor")
|
||||||
|
|
||||||
private fun MutableMethod.insertTimeHook(insert: InsertIndex, descriptor: String) =
|
private fun MutableMethod.insertTimeHook(insertIndex: Int, descriptor: String) =
|
||||||
insert(insert, "p1, p2", descriptor)
|
insert(insertIndex, "p1, p2", descriptor)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook the player controller.
|
* Hook the player controller. Called when a video is opened or the current video is changed.
|
||||||
|
*
|
||||||
|
* Note: This hook is called very early and is called before the video id, video time, video length,
|
||||||
|
* and many other data fields are set.
|
||||||
*
|
*
|
||||||
* @param targetMethodClass The descriptor for the class to invoke when the player controller is created.
|
* @param targetMethodClass The descriptor for the class to invoke when the player controller is created.
|
||||||
* @param targetMethodName The name of the static method to invoke when the player controller is created.
|
* @param targetMethodName The name of the static method to invoke when the player controller is created.
|
||||||
*/
|
*/
|
||||||
internal fun onCreateHook(targetMethodClass: String, targetMethodName: String) =
|
internal fun onCreateHook(targetMethodClass: String, targetMethodName: String) =
|
||||||
playerInitMethod.insert(
|
playerInitMethod.insert(
|
||||||
InsertIndex.CREATE,
|
playerInitInsertIndex++,
|
||||||
"v0",
|
"v0",
|
||||||
"$targetMethodClass->$targetMethodName(Ljava/lang/Object;)V"
|
"$targetMethodClass->$targetMethodName(Ljava/lang/Object;)V"
|
||||||
)
|
)
|
||||||
@@ -191,7 +199,7 @@ class VideoInformationPatch : BytecodePatch(
|
|||||||
*/
|
*/
|
||||||
internal fun videoTimeHook(targetMethodClass: String, targetMethodName: String) =
|
internal fun videoTimeHook(targetMethodClass: String, targetMethodName: String) =
|
||||||
timeMethod.insertTimeHook(
|
timeMethod.insertTimeHook(
|
||||||
InsertIndex.TIME,
|
timeInitInsertIndex++,
|
||||||
"$targetMethodClass->$targetMethodName(J)V"
|
"$targetMethodClass->$targetMethodName(J)V"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -205,16 +213,10 @@ class VideoInformationPatch : BytecodePatch(
|
|||||||
*/
|
*/
|
||||||
internal fun highPrecisionTimeHook(targetMethodClass: String, targetMethodName: String) =
|
internal fun highPrecisionTimeHook(targetMethodClass: String, targetMethodName: String) =
|
||||||
highPrecisionTimeMethod.insertTimeHook(
|
highPrecisionTimeMethod.insertTimeHook(
|
||||||
InsertIndex.HIGH_PRECISION_TIME,
|
highPrecisionInsertIndex++,
|
||||||
"$targetMethodClass->$targetMethodName(J)V"
|
"$targetMethodClass->$targetMethodName(J)V"
|
||||||
)
|
)
|
||||||
|
|
||||||
enum class InsertIndex(internal val index: Int) {
|
|
||||||
CREATE(4),
|
|
||||||
TIME(2),
|
|
||||||
HIGH_PRECISION_TIME(0),
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getReference(instructions: List<BuilderInstruction>, offset: Int, opcode: Opcode) =
|
private fun getReference(instructions: List<BuilderInstruction>, offset: Int, opcode: Opcode) =
|
||||||
instructions[instructions.indexOfFirst { it.opcode == opcode } + offset].reference
|
instructions[instructions.indexOfFirst { it.opcode == opcode } + offset].reference
|
||||||
|
|
||||||
|
|||||||
@@ -20,16 +20,16 @@ import app.revanced.patches.shared.settings.preference.impl.StringResource
|
|||||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
|
import app.revanced.patches.youtube.misc.video.information.patch.VideoInformationPatch
|
||||||
import app.revanced.patches.youtube.misc.video.quality.annotations.RememberVideoQualityCompatibility
|
import app.revanced.patches.youtube.misc.video.quality.annotations.RememberVideoQualityCompatibility
|
||||||
import app.revanced.patches.youtube.misc.video.quality.fingerprints.SetQualityByIndexMethodClassFieldReferenceFingerprint
|
import app.revanced.patches.youtube.misc.video.quality.fingerprints.SetQualityByIndexMethodClassFieldReferenceFingerprint
|
||||||
import app.revanced.patches.youtube.misc.video.quality.fingerprints.VideoQualityItemOnClickParentFingerprint
|
import app.revanced.patches.youtube.misc.video.quality.fingerprints.VideoQualityItemOnClickParentFingerprint
|
||||||
import app.revanced.patches.youtube.misc.video.quality.fingerprints.VideoQualitySetterFingerprint
|
import app.revanced.patches.youtube.misc.video.quality.fingerprints.VideoQualitySetterFingerprint
|
||||||
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
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@DependsOn([IntegrationsPatch::class, VideoIdPatch::class, SettingsPatch::class])
|
@DependsOn([IntegrationsPatch::class, VideoInformationPatch::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.")
|
||||||
@RememberVideoQualityCompatibility
|
@RememberVideoQualityCompatibility
|
||||||
@@ -114,7 +114,7 @@ class RememberVideoQualityPatch : BytecodePatch(
|
|||||||
* Conveniently, at this point the video quality is overridden to the remembered playback speed.
|
* Conveniently, at this point the video quality is overridden to the remembered playback speed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
VideoIdPatch.injectCall("$INTEGRATIONS_CLASS_DESCRIPTOR->newVideoStarted(Ljava/lang/String;)V")
|
VideoInformationPatch.onCreateHook(INTEGRATIONS_CLASS_DESCRIPTOR, "newVideoStarted")
|
||||||
|
|
||||||
// Inject a call to set the remembered quality once a video loads.
|
// Inject a call to set the remembered quality once a video loads.
|
||||||
VideoQualitySetterFingerprint.result?.also {
|
VideoQualitySetterFingerprint.result?.also {
|
||||||
|
|||||||
@@ -23,12 +23,11 @@ import app.revanced.patches.youtube.misc.video.information.patch.VideoInformatio
|
|||||||
import app.revanced.patches.youtube.misc.video.information.patch.VideoInformationPatch.Companion.reference
|
import app.revanced.patches.youtube.misc.video.information.patch.VideoInformationPatch.Companion.reference
|
||||||
import app.revanced.patches.youtube.misc.video.speed.remember.annotation.RememberPlaybackSpeedCompatibility
|
import app.revanced.patches.youtube.misc.video.speed.remember.annotation.RememberPlaybackSpeedCompatibility
|
||||||
import app.revanced.patches.youtube.misc.video.speed.remember.fingerprint.InitializePlaybackSpeedValuesFingerprint
|
import app.revanced.patches.youtube.misc.video.speed.remember.fingerprint.InitializePlaybackSpeedValuesFingerprint
|
||||||
import app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch
|
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("remember-playback-speed")
|
@Name("remember-playback-speed")
|
||||||
@Description("Adds the ability to remember the playback speed you chose in the video playback speed flyout.")
|
@Description("Adds the ability to remember the playback speed you chose in the video playback speed flyout.")
|
||||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class, VideoIdPatch::class, VideoInformationPatch::class])
|
@DependsOn([IntegrationsPatch::class, SettingsPatch::class, VideoInformationPatch::class])
|
||||||
@RememberPlaybackSpeedCompatibility
|
@RememberPlaybackSpeedCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class RememberPlaybackSpeedPatch : BytecodePatch(
|
class RememberPlaybackSpeedPatch : BytecodePatch(
|
||||||
@@ -77,8 +76,7 @@ class RememberPlaybackSpeedPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
VideoIdPatch.injectCall("${INTEGRATIONS_CLASS_DESCRIPTOR}->newVideoLoaded(Ljava/lang/String;)V")
|
VideoInformationPatch.onCreateHook(INTEGRATIONS_CLASS_DESCRIPTOR, "newVideoStarted")
|
||||||
|
|
||||||
VideoInformationPatch.userSelectedPlaybackSpeedHook(
|
VideoInformationPatch.userSelectedPlaybackSpeedHook(
|
||||||
INTEGRATIONS_CLASS_DESCRIPTOR, "userSelectedPlaybackSpeed")
|
INTEGRATIONS_CLASS_DESCRIPTOR, "userSelectedPlaybackSpeed")
|
||||||
|
|
||||||
|
|||||||
16
src/main/kotlin/app/revanced/util/patch/BytecodeUtils.kt
Normal file
16
src/main/kotlin/app/revanced/util/patch/BytecodeUtils.kt
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package app.revanced.util.patch
|
||||||
|
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
import org.jf.dexlib2.iface.Method
|
||||||
|
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the first constant instruction with the resource id, or -1 if not found.
|
||||||
|
*/
|
||||||
|
fun Method.indexOfFirstConstantInstruction(constantValue: Long): Int {
|
||||||
|
return implementation?.let {
|
||||||
|
it.instructions.indexOfFirst { instruction ->
|
||||||
|
instruction.opcode == Opcode.CONST && (instruction as WideLiteralInstruction).wideLiteral == constantValue
|
||||||
|
}
|
||||||
|
} ?: -1
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user