mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-25 03:31:03 +00:00
Compare commits
3 Commits
v2.8.1
...
v2.6.0-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3de6790e9f | ||
|
|
c95c241887 | ||
|
|
0f05fbfad9 |
43
CHANGELOG.md
43
CHANGELOG.md
@@ -1,46 +1,3 @@
|
|||||||
## [2.8.1](https://github.com/revanced/revanced-patches/compare/v2.8.0...v2.8.1) (2022-07-05)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* remove unnecessary version constraints ([#117](https://github.com/revanced/revanced-patches/issues/117)) ([1cddf8d](https://github.com/revanced/revanced-patches/commit/1cddf8d9063da3bbdba0fd7080c8c93768b83a4c))
|
|
||||||
|
|
||||||
# [2.8.0](https://github.com/revanced/revanced-patches/compare/v2.7.0...v2.8.0) (2022-07-04)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* `enable-debugging` patch ([#116](https://github.com/revanced/revanced-patches/issues/116)) ([bb355e7](https://github.com/revanced/revanced-patches/commit/bb355e7b7e78e602a10b346fe7e5795463615a81))
|
|
||||||
|
|
||||||
# [2.7.0](https://github.com/revanced/revanced-patches/compare/v2.6.0...v2.7.0) (2022-07-03)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* `hdr-max-brightness` patch ([#105](https://github.com/revanced/revanced-patches/issues/105)) ([1310573](https://github.com/revanced/revanced-patches/commit/131057366a777786d6016d3385584b4e17bc4a8b))
|
|
||||||
* `hide-infocard-suggestions` patch ([#107](https://github.com/revanced/revanced-patches/issues/107)) ([31a767a](https://github.com/revanced/revanced-patches/commit/31a767adbb152906303ab0ae5250769fc38d0625))
|
|
||||||
|
|
||||||
# [2.6.0](https://github.com/revanced/revanced-patches/compare/v2.5.0...v2.6.0) (2022-07-02)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* freezing panels when watching video in fullscreen ([#89](https://github.com/revanced/revanced-patches/issues/89)) ([f5d4f6c](https://github.com/revanced/revanced-patches/commit/f5d4f6c3419916c6a9cf67babc6be8a64c854d3b))
|
|
||||||
* invalid version in compatibility annotation ([#90](https://github.com/revanced/revanced-patches/issues/90)) ([df43547](https://github.com/revanced/revanced-patches/commit/df435475cdd0494a1e4ea9e2980c2998c9bc7048))
|
|
||||||
* remove refreshing home screen not working ([6c24ebe](https://github.com/revanced/revanced-patches/commit/6c24ebef2fb4f0d58e369ac5bf63e4cab6ca0e80))
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* migrate to breaking changes of patcher ([d9147cd](https://github.com/revanced/revanced-patches/commit/d9147cd60c0c25d0c5cc05409b8889dfacd89af9))
|
|
||||||
|
|
||||||
# [2.6.0-dev.2](https://github.com/revanced/revanced-patches/compare/v2.6.0-dev.1...v2.6.0-dev.2) (2022-07-02)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* remove refreshing home screen not working ([ec7ae90](https://github.com/revanced/revanced-patches/commit/ec7ae900181b6456c692adb3b5bb337e81bc5fea))
|
|
||||||
|
|
||||||
# [2.6.0-dev.1](https://github.com/revanced/revanced-patches/compare/v2.5.1-dev.1...v2.6.0-dev.1) (2022-07-02)
|
# [2.6.0-dev.1](https://github.com/revanced/revanced-patches/compare/v2.5.1-dev.1...v2.6.0-dev.1) (2022-07-02)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ repositories {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("stdlib"))
|
implementation(kotlin("stdlib"))
|
||||||
|
|
||||||
implementation("app.revanced:revanced-patcher:2.2.0")
|
implementation("app.revanced:revanced-patcher:2.1.2")
|
||||||
implementation("app.revanced:multidexlib2:2.5.2.r2")
|
implementation("app.revanced:multidexlib2:2.5.2.r2")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.8.1
|
version = 2.6.0-dev.1
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
package app.revanced.patches.music.audio.exclusiveaudio.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
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package app.revanced.patches.music.audio.exclusiveaudio.patch
|
package app.revanced.patches.music.audio.exclusiveaudio.patch
|
||||||
|
|
||||||
|
import AudioOnlyEnablerFingerprint
|
||||||
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
|
||||||
@@ -12,7 +13,6 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
|||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patcher.patch.impl.BytecodePatch
|
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||||
import app.revanced.patches.music.audio.exclusiveaudio.annotations.ExclusiveAudioCompatibility
|
import app.revanced.patches.music.audio.exclusiveaudio.annotations.ExclusiveAudioCompatibility
|
||||||
import app.revanced.patches.music.audio.exclusiveaudio.fingerprints.AudioOnlyEnablerFingerprint
|
|
||||||
import app.revanced.patches.music.audio.exclusiveaudio.fingerprints.ExclusiveAudioFingerprint
|
import app.revanced.patches.music.audio.exclusiveaudio.fingerprints.ExclusiveAudioFingerprint
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import app.revanced.patches.youtube.ad.general.bytecode.extensions.MethodExtensi
|
|||||||
import app.revanced.patches.youtube.ad.general.bytecode.extensions.MethodExtensions.insertBlocks
|
import app.revanced.patches.youtube.ad.general.bytecode.extensions.MethodExtensions.insertBlocks
|
||||||
import app.revanced.patches.youtube.ad.general.bytecode.extensions.MethodExtensions.toDescriptor
|
import app.revanced.patches.youtube.ad.general.bytecode.extensions.MethodExtensions.toDescriptor
|
||||||
import app.revanced.patches.youtube.ad.general.bytecode.utils.MethodUtils.createMutableMethod
|
import app.revanced.patches.youtube.ad.general.bytecode.utils.MethodUtils.createMutableMethod
|
||||||
|
import app.revanced.patches.youtube.ad.general.resource.patch.GeneralResourceAdsPatch
|
||||||
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.ResourceIdMappingProviderResourcePatch
|
import app.revanced.patches.youtube.misc.mapping.patch.ResourceIdMappingProviderResourcePatch
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
@@ -39,7 +40,7 @@ import org.jf.dexlib2.immutable.reference.ImmutableMethodReference
|
|||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Dependencies(
|
@Dependencies(
|
||||||
dependencies = [ResourceIdMappingProviderResourcePatch::class, IntegrationsPatch::class]
|
dependencies = [ResourceIdMappingProviderResourcePatch::class, IntegrationsPatch::class, GeneralResourceAdsPatch::class]
|
||||||
)
|
)
|
||||||
@Name("general-ads")
|
@Name("general-ads")
|
||||||
@Description("Patch to remove general ads in bytecode.")
|
@Description("Patch to remove general ads in bytecode.")
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package app.revanced.patches.youtube.ad.general.resource.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.doRecursively
|
||||||
|
import app.revanced.extensions.startsWithAny
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.impl.ResourceData
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.Dependencies
|
||||||
|
import app.revanced.patcher.patch.impl.ResourcePatch
|
||||||
|
import app.revanced.patches.youtube.ad.general.annotation.GeneralAdsCompatibility
|
||||||
|
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||||
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
|
@Dependencies(dependencies = [FixLocaleConfigErrorPatch::class])
|
||||||
|
@Name("general-resource-ads")
|
||||||
|
@Description("Patch to remove general ads in resources.")
|
||||||
|
@GeneralAdsCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class GeneralResourceAdsPatch : ResourcePatch() {
|
||||||
|
// list of resource file names which need to be hidden
|
||||||
|
private val resourceFileNames = arrayOf(
|
||||||
|
"compact_promoted_video_item.xml",
|
||||||
|
"inline_muted_metadata_swap.xml",
|
||||||
|
"interstitial_promo_view.xml",
|
||||||
|
"pip_ad_overlay.xml",
|
||||||
|
"promoted_",
|
||||||
|
"watch_metadata_companion_cards.xml",
|
||||||
|
//"watch_while_activity.xml" // FIXME: find out why patching this resource fails
|
||||||
|
)
|
||||||
|
|
||||||
|
// the attributes to change the value of
|
||||||
|
private val replacements = arrayOf(
|
||||||
|
"height",
|
||||||
|
"width",
|
||||||
|
"marginTop",
|
||||||
|
)
|
||||||
|
|
||||||
|
override fun execute(data: ResourceData): PatchResult {
|
||||||
|
data.forEach {
|
||||||
|
if (!it.name.startsWithAny(*resourceFileNames)) return@forEach
|
||||||
|
|
||||||
|
// for each file in the "layouts" directory replace all necessary attributes content
|
||||||
|
data.xmlEditor[it.absolutePath].use { editor ->
|
||||||
|
editor.file.doRecursively { node ->
|
||||||
|
replacements.forEach replacement@{ replacement ->
|
||||||
|
if (node !is Element) return@replacement
|
||||||
|
|
||||||
|
node.getAttributeNode("android:layout_$replacement")?.let { attribute ->
|
||||||
|
attribute.textContent = "1.0dip"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.ad.infocardsuggestions.annotations
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
|
||||||
import app.revanced.patcher.annotation.Package
|
|
||||||
|
|
||||||
@Compatibility(
|
|
||||||
[Package(
|
|
||||||
"com.google.android.youtube", arrayOf("17.25.34")
|
|
||||||
)]
|
|
||||||
)
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
|
||||||
internal annotation class HideInfocardSuggestionsCompatibility
|
|
||||||
@@ -1,24 +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.annotation.MatchingMethod
|
|
||||||
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")
|
|
||||||
@MatchingMethod("Liff;", "i")
|
|
||||||
@FuzzyPatternScanMethod(2)
|
|
||||||
@HideInfocardSuggestionsCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
object HideInfocardSuggestionsFingerprint : MethodFingerprint(
|
|
||||||
"Ljava/lang/Boolean;",
|
|
||||||
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
listOf("vibrator"),
|
|
||||||
null
|
|
||||||
)
|
|
||||||
@@ -1,24 +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.impl.MethodFingerprint
|
|
||||||
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
|
||||||
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
|
||||||
import app.revanced.patches.youtube.ad.infocardsuggestions.annotations.HideInfocardSuggestionsCompatibility
|
|
||||||
import org.jf.dexlib2.AccessFlags
|
|
||||||
|
|
||||||
@Name("hide-infocard-suggestions-parent-fingerprint")
|
|
||||||
@MatchingMethod("Liff;", "lE")
|
|
||||||
@FuzzyPatternScanMethod(2)
|
|
||||||
@HideInfocardSuggestionsCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
object HideInfocardSuggestionsParentFingerprint : MethodFingerprint(
|
|
||||||
"Ljava/lang/String;",
|
|
||||||
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
|
||||||
listOf(),
|
|
||||||
null,
|
|
||||||
listOf("player_overlay_info_card_teaser"),
|
|
||||||
null
|
|
||||||
)
|
|
||||||
@@ -1,71 +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.impl.BytecodeData
|
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
|
||||||
import app.revanced.patcher.extensions.removeInstruction
|
|
||||||
import app.revanced.patcher.extensions.removeInstructions
|
|
||||||
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve
|
|
||||||
import app.revanced.patcher.patch.annotations.Dependencies
|
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
import app.revanced.patcher.patch.impl.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.util.smali.toBuilderInstruction
|
|
||||||
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 org.jf.dexlib2.Opcode
|
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
|
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
|
|
||||||
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
|
||||||
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
|
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
|
||||||
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
|
||||||
|
|
||||||
@Patch
|
|
||||||
@Dependencies(dependencies = [IntegrationsPatch::class])
|
|
||||||
@Name("hide-infocard-suggestions")
|
|
||||||
@Description("Hides infocards in videos.")
|
|
||||||
@HideInfocardSuggestionsCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class HideInfocardSuggestionsPatch : BytecodePatch(
|
|
||||||
listOf(
|
|
||||||
HideInfocardSuggestionsParentFingerprint
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
override fun execute(data: BytecodeData): PatchResult {
|
|
||||||
val parentResult = HideInfocardSuggestionsParentFingerprint.result
|
|
||||||
?: return PatchResultError("Parent fingerprint not resolved!")
|
|
||||||
|
|
||||||
|
|
||||||
HideInfocardSuggestionsFingerprint.resolve(data, 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") }
|
|
||||||
val register = "v" + (implementation.instructions.get(index) as FiveRegisterInstruction).registerD
|
|
||||||
|
|
||||||
method.removeInstruction(index)
|
|
||||||
|
|
||||||
method.addInstructions(
|
|
||||||
index, """
|
|
||||||
invoke-static {}, Lapp/revanced/integrations/patches/HideInfoCardSuggestionsPatch;->hideInfoCardSuggestions()I
|
|
||||||
move-result $register
|
|
||||||
invoke-virtual {p1, $register}, Landroid/view/View;->setVisibility(I)V
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
package app.revanced.patches.youtube.ad.video.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
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package app.revanced.patches.youtube.ad.video.patch
|
package app.revanced.patches.youtube.ad.video.patch
|
||||||
|
|
||||||
|
import ShowVideoAdsFingerprint
|
||||||
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
|
||||||
@@ -13,7 +14,6 @@ import app.revanced.patcher.patch.annotations.Patch
|
|||||||
import app.revanced.patcher.patch.impl.BytecodePatch
|
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||||
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.ShowVideoAdsConstructorFingerprint
|
import app.revanced.patches.youtube.ad.video.fingerprints.ShowVideoAdsConstructorFingerprint
|
||||||
import app.revanced.patches.youtube.ad.video.fingerprints.ShowVideoAdsFingerprint
|
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ 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.impl.ResourceData
|
import app.revanced.patcher.data.impl.ResourceData
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.annotations.Dependencies
|
import app.revanced.patcher.patch.annotations.Dependencies
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patcher.patch.impl.ResourcePatch
|
import app.revanced.patcher.patch.impl.ResourcePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultError
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patches.youtube.layout.branding.icon.annotations.CustomBrandingCompatibility
|
import app.revanced.patches.youtube.layout.branding.icon.annotations.CustomBrandingCompatibility
|
||||||
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
@@ -24,7 +24,7 @@ import java.nio.file.Files
|
|||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class CustomBrandingPatch : ResourcePatch() {
|
class CustomBrandingPatch : ResourcePatch() {
|
||||||
override fun execute(data: ResourceData): PatchResult {
|
override fun execute(data: ResourceData): PatchResult {
|
||||||
val resDirectory = data["res"]
|
val resDirectory = data.get("res")
|
||||||
if (!resDirectory.isDirectory) return PatchResultError("The res folder can not be found.")
|
if (!resDirectory.isDirectory) return PatchResultError("The res folder can not be found.")
|
||||||
|
|
||||||
val iconNames = arrayOf(
|
val iconNames = arrayOf(
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
package app.revanced.patches.youtube.layout.oldqualitylayout.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
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
package app.revanced.patches.youtube.layout.oldqualitylayout.patch
|
package app.revanced.patches.youtube.layout.oldqualitylayout.patch
|
||||||
|
|
||||||
|
import OldQualityFingerprint
|
||||||
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.impl.BytecodeData
|
import app.revanced.patcher.data.impl.BytecodeData
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve
|
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.annotations.Dependencies
|
import app.revanced.patcher.patch.annotations.Dependencies
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patcher.patch.impl.BytecodePatch
|
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultError
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patches.youtube.layout.oldqualitylayout.annotations.OldQualityLayoutCompatibility
|
import app.revanced.patches.youtube.layout.oldqualitylayout.annotations.OldQualityLayoutCompatibility
|
||||||
import app.revanced.patches.youtube.layout.oldqualitylayout.fingerprints.OldQualityFingerprint
|
|
||||||
import app.revanced.patches.youtube.layout.oldqualitylayout.fingerprints.OldQualityParentFingerprint
|
import app.revanced.patches.youtube.layout.oldqualitylayout.fingerprints.OldQualityParentFingerprint
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import app.revanced.patcher.annotation.Version
|
|||||||
import app.revanced.patcher.data.impl.BytecodeData
|
import app.revanced.patcher.data.impl.BytecodeData
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.removeInstruction
|
import app.revanced.patcher.extensions.removeInstruction
|
||||||
|
import app.revanced.patcher.extensions.removeInstructions
|
||||||
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve
|
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
import app.revanced.patcher.patch.PatchResultError
|
||||||
@@ -21,7 +22,7 @@ import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
|||||||
@Patch
|
@Patch
|
||||||
@Dependencies(dependencies = [IntegrationsPatch::class])
|
@Dependencies(dependencies = [IntegrationsPatch::class])
|
||||||
@Name("hide-watermark")
|
@Name("hide-watermark")
|
||||||
@Description("Hide the creator's watermark on video's.")
|
@Description("Hide Watermark on the page.")
|
||||||
@HideWatermarkCompatibility
|
@HideWatermarkCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class HideWatermarkPatch : BytecodePatch(
|
class HideWatermarkPatch : BytecodePatch(
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.misc.enabledebugging.annotations
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
|
||||||
import app.revanced.patcher.annotation.Package
|
|
||||||
|
|
||||||
@Compatibility(
|
|
||||||
[Package(
|
|
||||||
"com.google.android.youtube", arrayOf()
|
|
||||||
)]
|
|
||||||
)
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
|
||||||
internal annotation class EnableDebuggingCompatibility
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.misc.enabledebugging.patch
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.impl.ResourceData
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
import app.revanced.patcher.patch.impl.ResourcePatch
|
|
||||||
import app.revanced.patches.youtube.misc.enabledebugging.annotations.EnableDebuggingCompatibility
|
|
||||||
import org.w3c.dom.Element
|
|
||||||
|
|
||||||
@Patch(false)
|
|
||||||
@Name("enable-debugging")
|
|
||||||
@Description("Enable app debugging by patching the manifest file")
|
|
||||||
@EnableDebuggingCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class EnableDebuggingPatch : ResourcePatch() {
|
|
||||||
override fun execute(data: ResourceData): PatchResult {
|
|
||||||
// create an xml editor instance
|
|
||||||
data.xmlEditor["AndroidManifest.xml"].use { dom ->
|
|
||||||
// get the application node
|
|
||||||
val applicationNode = dom
|
|
||||||
.file
|
|
||||||
.getElementsByTagName("application")
|
|
||||||
.item(0) as Element
|
|
||||||
|
|
||||||
// set application as debuggable
|
|
||||||
applicationNode.setAttribute("android:debuggable", "true")
|
|
||||||
}
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.misc.hdrbrightness.annotations
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
|
||||||
import app.revanced.patcher.annotation.Package
|
|
||||||
|
|
||||||
@Compatibility(
|
|
||||||
[Package(
|
|
||||||
"com.google.android.youtube", arrayOf("17.24.34", "17.24.35", "17.25.34")
|
|
||||||
)]
|
|
||||||
)
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
|
||||||
internal annotation class HDRBrightnessCompatibility
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.misc.hdrbrightness.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
|
||||||
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import app.revanced.patches.youtube.misc.hdrbrightness.annotations.HDRBrightnessCompatibility
|
|
||||||
import org.jf.dexlib2.AccessFlags
|
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
|
|
||||||
|
|
||||||
@Name("hdrbrightness-fingerprint")
|
|
||||||
@MatchingMethod(
|
|
||||||
"Lghz;", "mZ"
|
|
||||||
)
|
|
||||||
@FuzzyPatternScanMethod(3)
|
|
||||||
@HDRBrightnessCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
object HDRBrightnessFingerprint : MethodFingerprint(
|
|
||||||
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, null,
|
|
||||||
listOf(
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
|
||||||
Opcode.CONST_HIGH16,
|
|
||||||
Opcode.IPUT,
|
|
||||||
Opcode.INVOKE_VIRTUAL
|
|
||||||
),
|
|
||||||
null,
|
|
||||||
customFingerprint = { methodDef ->
|
|
||||||
methodDef.implementation!!.instructions.count() == 16 && methodDef.implementation!!.instructions.any {((it as? NarrowLiteralInstruction)?.narrowLiteral == (-1.0f).toRawBits())}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.misc.hdrbrightness.patch;
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description;
|
|
||||||
import app.revanced.patcher.annotation.Name;
|
|
||||||
import app.revanced.patcher.annotation.Version;
|
|
||||||
import app.revanced.patcher.data.impl.BytecodeData
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
|
||||||
import app.revanced.patcher.extensions.removeInstruction
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.annotations.Patch;
|
|
||||||
import app.revanced.patcher.patch.impl.BytecodePatch;
|
|
||||||
import app.revanced.patcher.util.smali.toBuilderInstruction
|
|
||||||
import app.revanced.patches.youtube.misc.hdrbrightness.annotations.HDRBrightnessCompatibility;
|
|
||||||
import app.revanced.patches.youtube.misc.hdrbrightness.fingerprints.HDRBrightnessFingerprint
|
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
|
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
|
||||||
|
|
||||||
@Patch
|
|
||||||
@Name("hdr-max-brightness")
|
|
||||||
@Description("Set brightness to max for HDR videos in fullscreen mode.")
|
|
||||||
@HDRBrightnessCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class HDRBrightnessPatch : BytecodePatch(
|
|
||||||
listOf(
|
|
||||||
HDRBrightnessFingerprint
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
override fun execute(data: BytecodeData): PatchResult {
|
|
||||||
val result = HDRBrightnessFingerprint.result
|
|
||||||
?: return PatchResultError("HDRBrightnessFingerprint could not resolve the method!")
|
|
||||||
|
|
||||||
|
|
||||||
val method = result.mutableMethod
|
|
||||||
|
|
||||||
//Get the index here so we know where to inject our code to override -1.0f
|
|
||||||
val index = method.implementation!!.instructions.indexOfFirst { ((it as? NarrowLiteralInstruction)?.narrowLiteral == (-1.0f).toRawBits()) }
|
|
||||||
val register = (method.implementation!!.instructions.get(index) as OneRegisterInstruction).registerA
|
|
||||||
|
|
||||||
method.addInstructions(
|
|
||||||
index + 1, """
|
|
||||||
invoke-static {v$register}, Lapp/revanced/integrations/patches/HDRMaxBrightnessPatch;->getHDRBrightness(F)F
|
|
||||||
move-result v$register
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user