mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-29 05:31:02 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79a0ea78cf | ||
|
|
2a54e624a0 | ||
|
|
e8cc0de11c | ||
|
|
d2209569e0 | ||
|
|
492cce9452 | ||
|
|
a17232da24 | ||
|
|
3ae7858adf | ||
|
|
1a6bb30789 | ||
|
|
2b10b834c7 |
29
CHANGELOG.md
29
CHANGELOG.md
@@ -1,3 +1,32 @@
|
|||||||
|
# [2.82.0](https://github.com/revanced/revanced-patches/compare/v2.81.11...v2.82.0) (2022-10-13)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **youtube/remember-video-quality:** remember the quality until changed by default ([1aebabe](https://github.com/revanced/revanced-patches/commit/1aebabefdb0b163e0020fd3b52d7d1fa2404764b))
|
||||||
|
|
||||||
|
## [2.81.11](https://github.com/revanced/revanced-patches/compare/v2.81.10...v2.81.11) (2022-10-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **youtube/theme:** add missing theme condition check ([#771](https://github.com/revanced/revanced-patches/issues/771)) ([40b70b9](https://github.com/revanced/revanced-patches/commit/40b70b9f9a24cfbf76bcd69f562b87e5cfade66f))
|
||||||
|
|
||||||
|
## [2.81.10](https://github.com/revanced/revanced-patches/compare/v2.81.9...v2.81.10) (2022-10-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **spotify/disable-capture-restriction:** dynamically find indices ([#759](https://github.com/revanced/revanced-patches/issues/759)) ([2cc64c6](https://github.com/revanced/revanced-patches/commit/2cc64c61d1bc18a1717354085ddc60a251173837))
|
||||||
|
|
||||||
|
## [2.81.9](https://github.com/revanced/revanced-patches/compare/v2.81.8...v2.81.9) (2022-10-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **youtube/general-ads:** hide ads on wide screens ([#765](https://github.com/revanced/revanced-patches/issues/765)) ([f0d2f3e](https://github.com/revanced/revanced-patches/commit/f0d2f3e01b90bbe6d2b55b941eaf96be2295cd3c))
|
||||||
|
* **youtube/theme:** colore the comment action bar ([#762](https://github.com/revanced/revanced-patches/issues/762)) ([4b3abe0](https://github.com/revanced/revanced-patches/commit/4b3abe0d45ac8c0c5ae6cf4955681ba76ce10309))
|
||||||
|
|
||||||
## [2.81.8](https://github.com/revanced/revanced-patches/compare/v2.81.7...v2.81.8) (2022-10-10)
|
## [2.81.8](https://github.com/revanced/revanced-patches/compare/v2.81.7...v2.81.8) (2022-10-10)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.81.8
|
version = 2.82.0
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -8,46 +8,79 @@ import app.revanced.patcher.extensions.instruction
|
|||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultError
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
|
||||||
import app.revanced.patches.spotify.audio.annotation.DisableCaptureRestrictionCompatibility
|
import app.revanced.patches.spotify.audio.annotation.DisableCaptureRestrictionCompatibility
|
||||||
import app.revanced.patches.spotify.audio.fingerprints.DisableCaptureRestrictionAudioDriverFingerprint
|
import app.revanced.patches.spotify.audio.fingerprints.DisableCaptureRestrictionAudioDriverFingerprint
|
||||||
import app.revanced.patches.spotify.audio.resource.patch.DisableCaptureRestrictionResourcePatch
|
import app.revanced.patches.spotify.audio.resource.patch.DisableCaptureRestrictionResourcePatch
|
||||||
import org.jf.dexlib2.iface.instruction.Instruction
|
import org.jf.dexlib2.Opcode
|
||||||
|
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
|
import org.jf.dexlib2.iface.reference.MethodReference
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("disable-capture-restriction")
|
@Name("disable-capture-restriction")
|
||||||
@DependsOn([DisableCaptureRestrictionResourcePatch::class])
|
@DependsOn([DisableCaptureRestrictionResourcePatch::class])
|
||||||
@Description("Allows capturing Spotify's audio output while screen sharing or screen recording.")
|
@Description("Allows capturing Spotify's audio output while screen sharing or screen recording.")
|
||||||
@DisableCaptureRestrictionCompatibility
|
@DisableCaptureRestrictionCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.2")
|
||||||
class DisableCaptureRestrictionBytecodePatch : BytecodePatch(
|
class DisableCaptureRestrictionBytecodePatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
DisableCaptureRestrictionAudioDriverFingerprint
|
DisableCaptureRestrictionAudioDriverFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
private fun MutableMethod.replaceConstant4Instruction(index: Int, instruction: Instruction, with: Int) {
|
|
||||||
val register = (instruction as OneRegisterInstruction).registerA
|
|
||||||
this.replaceInstruction(
|
|
||||||
index, "const/4 v$register, $with"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
val method = DisableCaptureRestrictionAudioDriverFingerprint.result!!.mutableMethod
|
val method = DisableCaptureRestrictionAudioDriverFingerprint.result!!.mutableMethod
|
||||||
|
|
||||||
// Replace constant that contains the capture policy parameter for AudioAttributesBuilder.setAllowedCapturePolicy()
|
var invokePosition: Int? = null
|
||||||
val instruction = method.instruction(CONST_INSTRUCTION_POSITION)
|
var invokeParamRegister: Int? = null
|
||||||
method.replaceConstant4Instruction(CONST_INSTRUCTION_POSITION, instruction, ALLOW_CAPTURE_BY_ALL)
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
// Find INVOKE_VIRTUAL opcode with call to AudioAttributesBuilder.setAllowedCapturePolicy(I)
|
||||||
|
for ((index, instruction) in method.implementation!!.instructions.withIndex()) {
|
||||||
|
if(instruction.opcode != Opcode.INVOKE_VIRTUAL)
|
||||||
|
continue
|
||||||
|
|
||||||
|
val methodName = ((instruction as ReferenceInstruction).reference as MethodReference).name
|
||||||
|
if (methodName != "setAllowedCapturePolicy")
|
||||||
|
continue
|
||||||
|
|
||||||
|
// Store register of the integer parameter for setAllowedCapturePolicy
|
||||||
|
invokeParamRegister = (instruction as FiveRegisterInstruction).registerD
|
||||||
|
invokePosition = index
|
||||||
|
}
|
||||||
|
|
||||||
|
if(invokePosition == null || invokeParamRegister == null)
|
||||||
|
return PatchResultError("Cannot find setAllowedCapturePolicy method call")
|
||||||
|
|
||||||
|
// Walk back to the const/4 instruction that sets the parameter register
|
||||||
|
var matchFound = false
|
||||||
|
for (index in invokePosition downTo 0) {
|
||||||
|
val instruction = method.instruction(index)
|
||||||
|
if(instruction.opcode != Opcode.CONST_4)
|
||||||
|
continue
|
||||||
|
|
||||||
|
val register = (instruction as OneRegisterInstruction).registerA
|
||||||
|
if(register != invokeParamRegister)
|
||||||
|
continue
|
||||||
|
|
||||||
|
// Replace parameter value
|
||||||
|
method.replaceInstruction(
|
||||||
|
index, "const/4 v$register, $ALLOW_CAPTURE_BY_ALL"
|
||||||
|
)
|
||||||
|
matchFound = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return if (matchFound)
|
||||||
|
PatchResultSuccess()
|
||||||
|
else
|
||||||
|
PatchResultError("Const instruction not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
const val CONST_INSTRUCTION_POSITION = 2
|
|
||||||
const val ALLOW_CAPTURE_BY_ALL = 0x01
|
const val ALLOW_CAPTURE_BY_ALL = 0x01
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,7 @@ import app.revanced.patches.spotify.audio.annotation.DisableCaptureRestrictionCo
|
|||||||
@Name("disable-capture-restriction-audio-driver-fingerprint")
|
@Name("disable-capture-restriction-audio-driver-fingerprint")
|
||||||
|
|
||||||
@DisableCaptureRestrictionCompatibility
|
@DisableCaptureRestrictionCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.2")
|
||||||
object DisableCaptureRestrictionAudioDriverFingerprint : MethodFingerprint(
|
object DisableCaptureRestrictionAudioDriverFingerprint : MethodFingerprint(
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { methodDef ->
|
||||||
methodDef.definingClass == "Lcom/spotify/playback/playbacknative/AudioDriver;" && methodDef.name == "constructAudioAttributes"
|
methodDef.definingClass == "Lcom/spotify/playback/playbacknative/AudioDriver;" && methodDef.name == "constructAudioAttributes"
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import org.w3c.dom.Element
|
|||||||
@Name("disable-capture-restriction-resource-patch")
|
@Name("disable-capture-restriction-resource-patch")
|
||||||
@Description("Sets allowAudioPlaybackCapture in manifest to true.")
|
@Description("Sets allowAudioPlaybackCapture in manifest to true.")
|
||||||
@DisableCaptureRestrictionCompatibility
|
@DisableCaptureRestrictionCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.2")
|
||||||
class DisableCaptureRestrictionResourcePatch : ResourcePatch {
|
class DisableCaptureRestrictionResourcePatch : ResourcePatch {
|
||||||
override fun execute(context: ResourceContext): PatchResult {
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
// create an xml editor instance
|
// create an xml editor instance
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import app.revanced.patcher.util.smali.ExternalLabel
|
|||||||
import app.revanced.patches.youtube.ad.general.annotation.GeneralAdsCompatibility
|
import app.revanced.patches.youtube.ad.general.annotation.GeneralAdsCompatibility
|
||||||
import app.revanced.patches.youtube.ad.general.bytecode.extensions.MethodExtensions.findMutableMethodOf
|
import app.revanced.patches.youtube.ad.general.bytecode.extensions.MethodExtensions.findMutableMethodOf
|
||||||
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.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.ResourceMappingResourcePatch
|
import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
@@ -38,7 +39,7 @@ import org.jf.dexlib2.iface.reference.MethodReference
|
|||||||
import org.jf.dexlib2.iface.reference.StringReference
|
import org.jf.dexlib2.iface.reference.StringReference
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@DependsOn([ResourceMappingResourcePatch::class, IntegrationsPatch::class, SettingsPatch::class])
|
@DependsOn([ResourceMappingResourcePatch::class, IntegrationsPatch::class, SettingsPatch::class, GeneralResourceAdsPatch::class])
|
||||||
@Name("general-ads")
|
@Name("general-ads")
|
||||||
@Description("Removes general ads.")
|
@Description("Removes general ads.")
|
||||||
@GeneralAdsCompatibility
|
@GeneralAdsCompatibility
|
||||||
@@ -386,4 +387,4 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
|
|||||||
instruction.opcode == Opcode.CONST && (instruction as Instruction31i).narrowLiteral == lithoConstant
|
instruction.opcode == Opcode.CONST && (instruction as Instruction31i).narrowLiteral == lithoConstant
|
||||||
} ?: false
|
} ?: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
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.ResourceContext
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
|
import app.revanced.patches.youtube.ad.general.annotation.GeneralAdsCompatibility
|
||||||
|
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||||
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
|
@DependsOn(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_",
|
||||||
|
"promoted_video_",
|
||||||
|
)
|
||||||
|
|
||||||
|
// the attributes to change the value of
|
||||||
|
private val replacements = arrayOf(
|
||||||
|
"height",
|
||||||
|
"width",
|
||||||
|
"marginTop",
|
||||||
|
)
|
||||||
|
|
||||||
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
context.forEach {
|
||||||
|
if (!it.name.startsWithAny(*resourceFileNames)) return@forEach
|
||||||
|
|
||||||
|
// for each file in the "layouts" directory replace all necessary attributes content
|
||||||
|
context.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()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.theme.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
@Name("comment-actionbar-fingerprint")
|
||||||
|
@ThemeCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object CommentsFilterBarFingerprint : MethodFingerprint(
|
||||||
|
"V", AccessFlags.PROTECTED or AccessFlags.FINAL, listOf("L"), listOf(
|
||||||
|
Opcode.APUT,
|
||||||
|
Opcode.NEW_INSTANCE,
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.SGET_OBJECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.IGET,
|
||||||
|
Opcode.IF_EQZ,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT,
|
||||||
|
Opcode.IF_NEZ,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.RETURN_VOID
|
||||||
|
)
|
||||||
|
)
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.theme.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
|
import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.theme.fingerprints.CommentsFilterBarFingerprint
|
||||||
|
|
||||||
|
@Name("comment-filter-bar-theme")
|
||||||
|
@Description("Applies custom theming to comments filter action bar.")
|
||||||
|
@ThemeCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class CommentsFilterBarPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
CommentsFilterBarFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
val result = CommentsFilterBarFingerprint.result!!
|
||||||
|
val method = result.mutableMethod
|
||||||
|
val patchIndex = result.scanResult.patternScanResult!!.endIndex - 1
|
||||||
|
|
||||||
|
method.addInstructions(
|
||||||
|
patchIndex, """
|
||||||
|
invoke-static {}, Lapp/revanced/integrations/utils/ThemeHelper;->isDarkTheme()Z
|
||||||
|
move-result v2
|
||||||
|
if-nez v2, :comments_filter_white
|
||||||
|
const v1, -0x1
|
||||||
|
if-ne v1, p1, :comments_filter_white
|
||||||
|
const/4 p1, 0x0
|
||||||
|
:comments_filter_white
|
||||||
|
if-eqz v2, :comments_filter_dark
|
||||||
|
const v1, -0xdededf
|
||||||
|
if-ne v1, p1, :comments_filter_dark
|
||||||
|
const/4 p1, 0x0
|
||||||
|
""", listOf(ExternalLabel("comments_filter_dark", method.instruction(patchIndex)))
|
||||||
|
)
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@ import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatc
|
|||||||
import org.w3c.dom.Element
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@DependsOn([FixLocaleConfigErrorPatch::class])
|
@DependsOn([CommentsFilterBarPatch::class, FixLocaleConfigErrorPatch::class])
|
||||||
@Name("theme")
|
@Name("theme")
|
||||||
@Description("Applies a custom theme.")
|
@Description("Applies a custom theme.")
|
||||||
@ThemeCompatibility
|
@ThemeCompatibility
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class RememberVideoQualityPatch : BytecodePatch(
|
|||||||
SwitchPreference(
|
SwitchPreference(
|
||||||
"revanced_remember_video_quality_selection",
|
"revanced_remember_video_quality_selection",
|
||||||
StringResource("revanced_remember_video_quality_selection_title", "Remember current video quality"),
|
StringResource("revanced_remember_video_quality_selection_title", "Remember current video quality"),
|
||||||
true,
|
false,
|
||||||
StringResource(
|
StringResource(
|
||||||
"revanced_remember_video_quality_selection_summary_on",
|
"revanced_remember_video_quality_selection_summary_on",
|
||||||
"The current video quality will not change"
|
"The current video quality will not change"
|
||||||
|
|||||||
Reference in New Issue
Block a user