refactor: move the patch to the correct path

This commit is contained in:
inotia00 2023-06-18 23:09:08 +09:00
parent 03148b5c81
commit 5c99e9a16a
410 changed files with 3807 additions and 3505 deletions

View File

@ -10,7 +10,7 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.misc.litho.patch.MusicLithoFilterPatch
import app.revanced.patches.music.misc.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.patches.shared.patch.videoads.GeneralVideoAdsPatch
import app.revanced.util.enum.CategoryType

View File

@ -12,7 +12,7 @@ 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.music.misc.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.patches.shared.fingerprints.SubtitleTrackFingerprint
import app.revanced.util.enum.CategoryType

View File

@ -2,7 +2,7 @@ package app.revanced.patches.music.layout.blacknavbar.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.misc.resourceid.patch.SharedResourceIdPatch.Companion.colorGreyId
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.ColorGrey
import app.revanced.util.bytecode.isWideLiteralExists
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@ -16,6 +16,6 @@ object TabLayoutFingerprint : MethodFingerprint(
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT
),
customFingerprint = { it, _ -> it.isWideLiteralExists(colorGreyId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(ColorGrey) }
)

View File

@ -13,8 +13,8 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.layout.blacknavbar.fingerprints.TabLayoutFingerprint
import app.revanced.patches.music.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.misc.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT

View File

@ -10,7 +10,7 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.misc.litho.patch.MusicLithoFilterPatch
import app.revanced.patches.music.misc.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.util.enum.CategoryType

View File

@ -10,7 +10,7 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.misc.litho.patch.MusicLithoFilterPatch
import app.revanced.patches.music.misc.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.util.enum.CategoryType

View File

@ -14,7 +14,7 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.layout.castbutton.fingerprints.HideCastButtonFingerprint
import app.revanced.patches.music.layout.castbutton.fingerprints.HideCastButtonParentFingerprint
import app.revanced.patches.music.misc.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT

View File

@ -1,7 +1,7 @@
package app.revanced.patches.music.layout.categorybar.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.misc.resourceid.patch.SharedResourceIdPatch.Companion.chipCloudId
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.ChipCloud
import app.revanced.util.bytecode.isWideLiteralExists
import org.jf.dexlib2.Opcode
@ -13,6 +13,6 @@ object ChipCloudFingerprint : MethodFingerprint(
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT
),
customFingerprint = { it, _ -> it.isWideLiteralExists(chipCloudId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(ChipCloud) }
)

View File

@ -13,8 +13,8 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.layout.categorybar.fingerprints.ChipCloudFingerprint
import app.revanced.patches.music.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.misc.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT

View File

@ -17,7 +17,7 @@ import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.music.layout.colormatchplayer.fingerprints.ColorMatchPlayerFingerprint
import app.revanced.patches.music.misc.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.patches.shared.fingerprints.ColorMatchPlayerParentFingerprint
import app.revanced.util.enum.CategoryType

View File

@ -2,7 +2,7 @@ package app.revanced.patches.music.layout.compactdialog.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.misc.resourceid.patch.SharedResourceIdPatch.Companion.dialogSolidId
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.DialogSolid
import app.revanced.util.bytecode.isWideLiteralExists
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@ -16,6 +16,6 @@ object DialogSolidFingerprint : MethodFingerprint(
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_STATIC
),
customFingerprint = { it, _ -> it.isWideLiteralExists(dialogSolidId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(DialogSolid) }
)

View File

@ -14,8 +14,8 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.music.layout.compactdialog.fingerprints.DialogSolidFingerprint
import app.revanced.patches.music.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.misc.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT

View File

@ -15,8 +15,8 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.music.layout.floatingbutton.fingerprints.*
import app.revanced.patches.music.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.misc.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT

View File

@ -2,7 +2,7 @@ package app.revanced.patches.music.layout.landscapemode.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.misc.resourceid.patch.SharedResourceIdPatch.Companion.isTabletId
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.IsTablet
import app.revanced.util.bytecode.isWideLiteralExists
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@ -16,6 +16,6 @@ object TabletIdentifierFingerprint : MethodFingerprint(
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT
),
customFingerprint = { it, _ -> it.isWideLiteralExists(isTabletId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(IsTablet) }
)

View File

@ -12,8 +12,8 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.layout.landscapemode.fingerprints.TabletIdentifierFingerprint
import app.revanced.patches.music.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.misc.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT

View File

@ -12,7 +12,7 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.layout.minimizedplayer.fingerprints.MinimizedPlayerFingerprint
import app.revanced.patches.music.misc.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT

View File

@ -10,7 +10,7 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.misc.litho.patch.MusicLithoFilterPatch
import app.revanced.patches.music.misc.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.util.enum.CategoryType

View File

@ -15,7 +15,7 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.layout.zenmode.fingerprints.ZenModeFingerprint
import app.revanced.patches.music.misc.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.patches.shared.fingerprints.ColorMatchPlayerParentFingerprint
import app.revanced.util.enum.CategoryType

View File

@ -18,7 +18,7 @@ import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.music.misc.codecs.fingerprints.AllCodecsFingerprint
import app.revanced.patches.music.misc.codecs.fingerprints.AllCodecsParentFingerprint
import app.revanced.patches.music.misc.codecs.fingerprints.CodecsLockFingerprint
import app.revanced.patches.music.misc.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_MISC_PATH

View File

@ -1,14 +0,0 @@
package app.revanced.patches.music.misc.microg.bytecode.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
object ServiceCheckFingerprint : MethodFingerprint(
"V",
AccessFlags.PUBLIC or AccessFlags.STATIC,
listOf("L", "I"),
strings = listOf("Google Play Services not available")
)

View File

@ -2,7 +2,7 @@ package app.revanced.patches.music.misc.premium.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.misc.resourceid.patch.SharedResourceIdPatch.Companion.privacyTosFooterId
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.PrivacyTosFooter
import app.revanced.util.bytecode.isWideLiteralExists
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@ -18,5 +18,5 @@ object AccountMenuFooterFingerprint : MethodFingerprint(
Opcode.INVOKE_VIRTUAL,
Opcode.IGET_OBJECT
),
customFingerprint = { it, _ -> it.isWideLiteralExists(privacyTosFooterId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(PrivacyTosFooter) }
)

View File

@ -16,8 +16,8 @@ import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.music.misc.premium.fingerprints.AccountMenuFooterFingerprint
import app.revanced.patches.music.misc.premium.fingerprints.HideGetPremiumFingerprint
import app.revanced.patches.music.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.misc.resourceid.patch.SharedResourceIdPatch.Companion.privacyTosFooterId
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.PrivacyTosFooter
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.util.bytecode.getWideLiteralIndex
import org.jf.dexlib2.Opcode
@ -55,7 +55,7 @@ class HideGetPremiumPatch : BytecodePatch(
AccountMenuFooterFingerprint.result?.let {
it.mutableMethod.apply {
val targetIndex = getWideLiteralIndex(privacyTosFooterId) + 4
val targetIndex = getWideLiteralIndex(PrivacyTosFooter) + 4
targetReference = getInstruction<ReferenceInstruction>(targetIndex + 1).reference
with (context

View File

@ -1,13 +0,0 @@
package app.revanced.patches.music.misc.quality.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode
object MusicVideoQualitySetterFingerprint : MethodFingerprint(
returnType = "V",
opcodes = listOf(
Opcode.CHECK_CAST,
Opcode.IPUT_OBJECT
),
customFingerprint = { it, _ -> it.name == "<init>" }
)

View File

@ -1,11 +0,0 @@
package app.revanced.patches.music.misc.quality.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.misc.resourceid.patch.SharedResourceIdPatch.Companion.qualityAutoId
import app.revanced.util.bytecode.isWideLiteralExists
object MusicVideoQualitySetterParentFingerprint : MethodFingerprint(
returnType = "V",
parameters = listOf("L"),
customFingerprint = { it, _ -> it.isWideLiteralExists(qualityAutoId)}
)

View File

@ -1,11 +1,14 @@
package app.revanced.patches.music.misc.quality.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.misc.resourceid.patch.SharedResourceIdPatch.Companion.qualityTitleId
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.QualityTitle
import app.revanced.util.bytecode.isWideLiteralExists
import org.jf.dexlib2.AccessFlags
object MusicVideoQualitySettingsParentFingerprint : MethodFingerprint(
returnType = "L",
parameters = listOf(),
customFingerprint = { it, _ -> it.isWideLiteralExists(qualityTitleId)}
returnType = "V",
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
parameters = listOf("L"),
customFingerprint = { it, _ -> it.isWideLiteralExists(QualityTitle)}
)

View File

@ -15,16 +15,20 @@ 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.music.misc.quality.fingerprints.*
import app.revanced.patches.music.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.misc.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.music.misc.videoid.patch.MusicVideoIdPatch
import app.revanced.patches.music.misc.quality.fingerprints.MusicVideoQualitySettingsFingerprint
import app.revanced.patches.music.misc.quality.fingerprints.MusicVideoQualitySettingsParentFingerprint
import app.revanced.patches.music.misc.quality.fingerprints.UserQualityChangeFingerprint
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.music.utils.videoid.patch.MusicVideoIdPatch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_MISC_PATH
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.builder.instruction.BuilderInstruction21c
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.reference.FieldReference
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
import org.jf.dexlib2.iface.reference.MethodReference
import org.jf.dexlib2.iface.reference.Reference
@Patch
@ -41,27 +45,40 @@ import org.jf.dexlib2.iface.reference.Reference
@Version("0.0.1")
class VideoQualityPatch : BytecodePatch(
listOf(
MusicVideoQualitySetterParentFingerprint,
MusicVideoQualitySettingsParentFingerprint,
UserQualityChangeFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
MusicVideoQualitySetterParentFingerprint.result?.let { parentResult ->
MusicVideoQualitySetterFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
it.mutableMethod.apply {
val endIndex = it.scanResult.patternScanResult!!.endIndex
UserQualityChangeFingerprint.result?.let {
it.mutableMethod.apply {
val endIndex = it.scanResult.patternScanResult!!.endIndex
val qualityChangedClass =
context.findClass((getInstruction<BuilderInstruction21c>(endIndex))
.reference.toString())!!
.mutableClass
qualityReference = getInstruction<ReferenceInstruction>(endIndex).reference
qualityFieldReference = qualityReference as FieldReference
for (method in qualityChangedClass.methods) {
qualityChangedClass.findMutableMethodOf(method).apply {
if (this.name == "onItemClick") {
for ((index, instruction) in implementation!!.instructions.withIndex()) {
if (instruction.opcode != Opcode.INVOKE_INTERFACE) continue
qIndexMethodName = context
.classes.single { classDef -> classDef.type == qualityFieldReference.type }
.methods.single { method -> method.parameterTypes.first() == "I" }.name
qualityReference = getInstruction<ReferenceInstruction>(index - 1).reference
qIndexMethodName = ((getInstruction<Instruction35c>(index).reference) as MethodReference).name
addInstruction(
0,
"invoke-static {p3}, $INTEGRATIONS_VIDEO_QUALITY_CLASS_DESCRIPTOR->userChangedQuality(I)V"
)
break
}
}
}
}
} ?: return MusicVideoQualitySetterFingerprint.toErrorResult()
} ?: return MusicVideoQualitySetterParentFingerprint.toErrorResult()
}
} ?: return UserQualityChangeFingerprint.toErrorResult()
MusicVideoQualitySettingsParentFingerprint.result?.let { parentResult ->
MusicVideoQualitySettingsFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.mutableMethod?.addInstructions(
@ -75,27 +92,6 @@ class VideoQualityPatch : BytecodePatch(
) ?: return MusicVideoQualitySettingsFingerprint.toErrorResult()
} ?: return MusicVideoQualitySettingsParentFingerprint.toErrorResult()
UserQualityChangeFingerprint.result?.let {
it.mutableMethod.apply {
val endIndex = it.scanResult.patternScanResult!!.endIndex
val qualityChangedClass =
context.findClass((getInstruction<BuilderInstruction21c>(endIndex))
.reference.toString())!!
.mutableClass
for (method in qualityChangedClass.methods) {
with (qualityChangedClass.findMutableMethodOf(method)) {
if (this.name == "onItemClick") {
addInstruction(
0,
"invoke-static {p3}, $INTEGRATIONS_VIDEO_QUALITY_CLASS_DESCRIPTOR->userChangedQuality(I)V"
)
}
}
}
}
} ?: return UserQualityChangeFingerprint.toErrorResult()
MusicVideoIdPatch.injectCall("$INTEGRATIONS_VIDEO_QUALITY_CLASS_DESCRIPTOR->newVideoStarted(Ljava/lang/String;)V")
MusicSettingsPatch.addMusicPreference(CategoryType.MISC, "revanced_enable_save_video_quality", "true")
@ -106,7 +102,6 @@ class VideoQualityPatch : BytecodePatch(
"$MUSIC_MISC_PATH/MusicVideoQualityPatch;"
private lateinit var qIndexMethodName: String
private lateinit var qualityFieldReference: FieldReference
private lateinit var qualityReference: Reference
}
}

View File

@ -1,50 +0,0 @@
package app.revanced.patches.music.misc.resourceid.patch
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
import app.revanced.util.enum.ResourceType
import app.revanced.util.enum.ResourceType.*
@Name("music-resource-id")
@DependsOn([ResourceMappingPatch::class])
@YouTubeMusicCompatibility
@Version("0.0.1")
class SharedResourceIdPatch : ResourcePatch {
internal companion object {
var chipCloudId: Long = -1
var colorGreyId: Long = -1
var dialogSolidId: Long = -1
var disabledIconId: Long = -1
var isTabletId: Long = -1
var notifierShelfId: Long = -1
var privacyTosFooterId: Long = -1
var qualityAutoId: Long = -1
var qualityTitleId: Long = -1
}
override fun execute(context: ResourceContext): PatchResult {
fun find(type: ResourceType, name: String) = ResourceMappingPatch
.resourceMappings
.single { it.type == type.value && it.name == name }.id
chipCloudId = find(LAYOUT, "chip_cloud")
colorGreyId = find(COLOR, "ytm_color_grey_12")
dialogSolidId = find(STYLE, "Theme.YouTubeMusic.Dialog.Solid")
disabledIconId = find(DIMEN, "disabled_icon_alpha")
isTabletId = find(BOOL, "is_tablet")
notifierShelfId = find(LAYOUT, "music_notifier_shelf")
privacyTosFooterId = find(ID, "privacy_tos_footer")
qualityAutoId = find(STRING, "quality_auto")
qualityTitleId = find(STRING, "quality_title")
return PatchResultSuccess()
}
}

View File

@ -3,7 +3,5 @@ package app.revanced.patches.music.misc.sharebuttonhook.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object FullStackTraceActivityFingerprint : MethodFingerprint(
customFingerprint = { it, _ ->
it.definingClass.endsWith("FullStackTraceActivity;") && it.name == "onCreate"
}
customFingerprint = { it, _ -> it.definingClass.endsWith("FullStackTraceActivity;") && it.name == "onCreate" }
)

View File

@ -15,10 +15,10 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.music.misc.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.music.utils.videoid.patch.MusicVideoIdPatch
import app.revanced.patches.music.misc.sharebuttonhook.fingerprints.*
import app.revanced.patches.music.misc.sleeptimerhook.patch.SleepTimerHookPatch
import app.revanced.patches.music.misc.videoid.patch.MusicVideoIdPatch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_INTEGRATIONS_PATH
@ -80,7 +80,6 @@ class ShareButtonHookPatch : BytecodePatch(
) ?: return FullStackTraceActivityFingerprint.toErrorResult()
MusicSettingsPatch.addMusicPreference(CategoryType.MISC, "revanced_hook_share_button", "false")
MusicSettingsPatch.addMusicPreferenceAlt(CategoryType.MISC, "revanced_hook_type", "false", "revanced_hook_share_button")
MusicSettingsPatch.addMusicPreferenceWithIntent(CategoryType.MISC, "revanced_default_downloader", "revanced_hook_share_button")
return PatchResultSuccess()

View File

@ -2,7 +2,7 @@ package app.revanced.patches.music.misc.shuffle.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.misc.resourceid.patch.SharedResourceIdPatch.Companion.disabledIconId
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.DisabledIconAlpha
import app.revanced.util.bytecode.isWideLiteralExists
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@ -18,6 +18,6 @@ object ShuffleClassFingerprint : MethodFingerprint(
Opcode.INVOKE_VIRTUAL,
Opcode.RETURN_VOID
),
customFingerprint = { it, _ -> it.name == "<init>" && it.isWideLiteralExists(disabledIconId) }
customFingerprint = { it, _ -> it.name == "<init>" && it.isWideLiteralExists(DisabledIconAlpha) }
)

View File

@ -19,8 +19,8 @@ import app.revanced.patcher.util.TypeUtil.traverseClassHierarchy
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.music.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.misc.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.music.misc.shuffle.fingerprints.*
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.util.enum.CategoryType
@ -156,7 +156,7 @@ class EnforceShufflePatch : BytecodePatch(
iput-boolean v4, v3, $shuffleReference5
invoke-virtual {v3}, $shuffleReference6
return-void
""".toInstructions(), null, null
""".toInstructions(), null, null
)
).toMutable()
)

View File

@ -9,7 +9,7 @@ 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.Patch
import app.revanced.patches.music.misc.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.util.resources.ResourceHelper.addTranslations

View File

@ -2,7 +2,7 @@ package app.revanced.patches.music.misc.upgradebutton.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.misc.resourceid.patch.SharedResourceIdPatch.Companion.notifierShelfId
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.MusicNotifierShelf
import app.revanced.util.bytecode.isWideLiteralExists
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@ -16,6 +16,6 @@ object NotifierShelfFingerprint : MethodFingerprint(
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT
),
customFingerprint = { it, _ -> it.isWideLiteralExists(notifierShelfId)}
customFingerprint = { it, _ -> it.isWideLiteralExists(MusicNotifierShelf)}
)

View File

@ -14,10 +14,9 @@ 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.music.misc.integrations.patch.MusicIntegrationsPatch
import app.revanced.patches.music.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.misc.upgradebutton.fingerprints.NotifierShelfFingerprint
import app.revanced.patches.music.misc.upgradebutton.fingerprints.PivotBarConstructorFingerprint
import app.revanced.patches.music.utils.integrations.patch.MusicIntegrationsPatch
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.misc.upgradebutton.fingerprints.*
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.util.integrations.Constants.INTEGRATIONS_PATH
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@ -73,7 +72,7 @@ class RemoveUpgradeButtonPatch : BytecodePatch(
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
addInstruction(
targetIndex + 1,
"invoke-static {v$targetRegister}, $INTEGRATIONS_PATH/adremover/AdRemoverAPI;->HideViewWithLayout1dp(Landroid/view/View;)V"
"invoke-static {v$targetRegister}, Lapp/revanced/music/utils/ReVancedUtils;->hideViewByLayoutParams(Landroid/view/View;)V"
)
}
} ?: return NotifierShelfFingerprint.toErrorResult()

View File

@ -9,7 +9,7 @@ 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.music.misc.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.patches.shared.patch.versionspoof.GeneralVersionSpoofPatch
import app.revanced.util.enum.CategoryType

View File

@ -1,4 +1,4 @@
package app.revanced.patches.music.misc.androidauto.fingerprints
package app.revanced.patches.music.utils.fix.androidauto.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.music.misc.androidauto.patch
package app.revanced.patches.music.utils.fix.androidauto.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
@ -10,7 +10,7 @@ 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.music.misc.androidauto.fingerprints.CertificateCheckFingerprint
import app.revanced.patches.music.utils.fix.androidauto.fingerprints.CertificateCheckFingerprint
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
@Patch

View File

@ -1,4 +1,4 @@
package app.revanced.patches.music.misc.clientspoof.fingerprints
package app.revanced.patches.music.utils.fix.clientspoof.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode

View File

@ -1,4 +1,4 @@
package app.revanced.patches.music.misc.clientspoof.patch
package app.revanced.patches.music.utils.fix.clientspoof.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
@ -10,8 +10,8 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.music.misc.clientspoof.fingerprints.UserAgentHeaderBuilderFingerprint
import app.revanced.patches.music.misc.microg.shared.Constants.MUSIC_PACKAGE_NAME
import app.revanced.patches.music.utils.fix.clientspoof.fingerprints.UserAgentHeaderBuilderFingerprint
import app.revanced.patches.music.utils.microg.shared.Constants.MUSIC_PACKAGE_NAME
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction

View File

@ -1,4 +1,4 @@
package app.revanced.patches.music.misc.integrations.fingerprints
package app.revanced.patches.music.utils.integrations.fingerprints
import app.revanced.patches.shared.patch.integrations.AbstractIntegrationsPatch.IntegrationsFingerprint

View File

@ -1,8 +1,8 @@
package app.revanced.patches.music.misc.integrations.patch
package app.revanced.patches.music.utils.integrations.patch
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.patch.annotations.RequiresIntegrations
import app.revanced.patches.music.misc.integrations.fingerprints.InitFingerprint
import app.revanced.patches.music.utils.integrations.fingerprints.InitFingerprint
import app.revanced.patches.shared.patch.integrations.AbstractIntegrationsPatch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.util.integrations.Constants.MUSIC_INTEGRATIONS_PATH

View File

@ -1,4 +1,4 @@
package app.revanced.patches.music.misc.microg.bytecode.fingerprints
package app.revanced.patches.music.utils.microg.bytecode.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.music.misc.microg.bytecode.fingerprints
package app.revanced.patches.music.utils.microg.bytecode.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.music.misc.microg.bytecode.fingerprints
package app.revanced.patches.music.utils.microg.bytecode.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,13 +1,13 @@
package app.revanced.patches.music.misc.microg.bytecode.fingerprints
package app.revanced.patches.music.utils.microg.bytecode.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
object GooglePlayUtilityFingerprint : MethodFingerprint(
"I",
AccessFlags.PUBLIC or AccessFlags.STATIC,
listOf("L", "I"),
returnType = "I",
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
parameters = listOf("L", "I"),
strings = listOf(
"This should never happen.",
"MetadataValueReader",

View File

@ -1,4 +1,4 @@
package app.revanced.patches.music.misc.microg.bytecode.fingerprints
package app.revanced.patches.music.utils.microg.bytecode.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -0,0 +1,12 @@
package app.revanced.patches.music.utils.microg.bytecode.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
object ServiceCheckFingerprint : MethodFingerprint(
returnType = "V",
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
parameters = listOf("L", "I"),
strings = listOf("Google Play Services not available")
)

View File

@ -9,11 +9,16 @@ 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.music.misc.clientspoof.patch.ClientSpoofMusicPatch
import app.revanced.patches.music.misc.microg.bytecode.fingerprints.*
import app.revanced.patches.music.misc.microg.resource.patch.MusicMicroGResourcePatch
import app.revanced.patches.music.misc.microg.shared.Constants.MUSIC_PACKAGE_NAME
import app.revanced.patches.music.misc.microg.shared.Constants.YOUTUBE_PACKAGE_NAME
import app.revanced.patches.music.utils.fix.clientspoof.patch.ClientSpoofMusicPatch
import app.revanced.patches.music.utils.microg.resource.patch.MusicMicroGResourcePatch
import app.revanced.patches.music.utils.microg.shared.Constants.MUSIC_PACKAGE_NAME
import app.revanced.patches.music.utils.microg.shared.Constants.YOUTUBE_PACKAGE_NAME
import app.revanced.patches.music.utils.microg.bytecode.fingerprints.CastContextFetchFingerprint
import app.revanced.patches.music.utils.microg.bytecode.fingerprints.CastDynamiteModuleFingerprint
import app.revanced.patches.music.utils.microg.bytecode.fingerprints.CastDynamiteModuleV2Fingerprint
import app.revanced.patches.music.utils.microg.bytecode.fingerprints.GooglePlayUtilityFingerprint
import app.revanced.patches.music.utils.microg.bytecode.fingerprints.PrimeFingerprint
import app.revanced.patches.music.utils.microg.bytecode.fingerprints.ServiceCheckFingerprint
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.patches.shared.patch.packagename.PackageNamePatch
import app.revanced.util.microg.MicroGBytecodeHelper

View File

@ -1,4 +1,4 @@
package app.revanced.patches.music.misc.microg.resource.patch
package app.revanced.patches.music.utils.microg.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
@ -8,9 +8,9 @@ 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.music.misc.microg.shared.Constants.MUSIC_PACKAGE_NAME
import app.revanced.patches.music.misc.microg.shared.Constants.SPOOFED_PACKAGE_NAME
import app.revanced.patches.music.misc.microg.shared.Constants.SPOOFED_PACKAGE_SIGNATURE
import app.revanced.patches.music.utils.microg.shared.Constants.MUSIC_PACKAGE_NAME
import app.revanced.patches.music.utils.microg.shared.Constants.SPOOFED_PACKAGE_NAME
import app.revanced.patches.music.utils.microg.shared.Constants.SPOOFED_PACKAGE_SIGNATURE
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.patches.shared.patch.packagename.PackageNamePatch
import app.revanced.util.microg.MicroGManifestHelper.addSpoofingMetadata

View File

@ -1,4 +1,4 @@
package app.revanced.patches.music.misc.microg.shared
package app.revanced.patches.music.utils.microg.shared
object Constants {
internal const val YOUTUBE_PACKAGE_NAME = "com.google.android.youtube"

View File

@ -0,0 +1,52 @@
package app.revanced.patches.music.utils.resourceid.patch
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
import app.revanced.util.enum.ResourceType
import app.revanced.util.enum.ResourceType.*
@Name("music-resource-id")
@DependsOn([ResourceMappingPatch::class])
@YouTubeMusicCompatibility
@Version("0.0.1")
class SharedResourceIdPatch : ResourcePatch {
internal companion object {
var ChipCloud: Long = -1
var ColorGrey: Long = -1
var DialogSolid: Long = -1
var DisabledIconAlpha: Long = -1
var IsTablet: Long = -1
var MusicNotifierShelf: Long = -1
var PrivacyTosFooter: Long = -1
var QualityTitle: Long = -1
var Text1: Long = -1
}
override fun execute(context: ResourceContext): PatchResult {
fun find(resourceType: ResourceType, resourceName: String) = ResourceMappingPatch
.resourceMappings
.find { it.type == resourceType.value && it.name == resourceName }?.id
?: throw PatchResultError("Failed to find resource id : $resourceName")
ChipCloud = find(LAYOUT, "chip_cloud")
ColorGrey = find(COLOR, "ytm_color_grey_12")
DialogSolid = find(STYLE, "Theme.YouTubeMusic.Dialog.Solid")
DisabledIconAlpha = find(DIMEN, "disabled_icon_alpha")
IsTablet = find(BOOL, "is_tablet")
MusicNotifierShelf = find(LAYOUT, "music_notifier_shelf")
PrivacyTosFooter = find(ID, "privacy_tos_footer")
QualityTitle = find(STRING, "quality_title")
Text1 = find(ID, "text1")
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.music.misc.settings.bytecode.fingerprints
package app.revanced.patches.music.utils.settings.bytecode.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode

View File

@ -1,4 +1,4 @@
package app.revanced.patches.music.misc.settings.bytecode.fingerprints
package app.revanced.patches.music.utils.settings.bytecode.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode

View File

@ -1,4 +1,4 @@
package app.revanced.patches.music.misc.settings.bytecode.patch
package app.revanced.patches.music.utils.settings.bytecode.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Name
@ -10,8 +10,9 @@ 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.patches.music.misc.integrations.patch.MusicIntegrationsPatch
import app.revanced.patches.music.misc.settings.bytecode.fingerprints.*
import app.revanced.patches.music.utils.integrations.patch.MusicIntegrationsPatch
import app.revanced.patches.music.utils.settings.bytecode.fingerprints.PreferenceFingerprint
import app.revanced.patches.music.utils.settings.bytecode.fingerprints.SettingsHeadersFragmentFingerprint
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.util.integrations.Constants.MUSIC_INTEGRATIONS_PATH
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction

View File

@ -1,4 +1,4 @@
package app.revanced.patches.music.misc.settings.resource.patch
package app.revanced.patches.music.utils.settings.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
@ -8,7 +8,7 @@ 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.music.misc.settings.bytecode.patch.MusicSettingsBytecodePatch
import app.revanced.patches.music.utils.settings.bytecode.patch.MusicSettingsBytecodePatch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.patches.shared.patch.settings.AbstractSettingsResourcePatch
import app.revanced.util.enum.CategoryType
@ -16,7 +16,6 @@ import app.revanced.util.resources.IconHelper
import app.revanced.util.resources.IconHelper.copyFiles
import app.revanced.util.resources.IconHelper.makeDirectoryAndCopyFiles
import app.revanced.util.resources.MusicResourceHelper.addMusicPreference
import app.revanced.util.resources.MusicResourceHelper.addMusicPreferenceAlt
import app.revanced.util.resources.MusicResourceHelper.addMusicPreferenceCategory
import app.revanced.util.resources.MusicResourceHelper.addMusicPreferenceWithIntent
import app.revanced.util.resources.MusicResourceHelper.addReVancedMusicPreference
@ -103,19 +102,6 @@ class MusicSettingsPatch : AbstractSettingsResourcePatch(
contexts.sortMusicPreferenceCategory(categoryValue)
}
internal fun addMusicPreferenceAlt(
category: CategoryType,
key: String,
defaultValue: String,
dependencyKey: String
) {
val categoryValue = category.value
contexts.addMusicPreferenceCategory(categoryValue)
contexts.addMusicPreferenceAlt(categoryValue, key, defaultValue, dependencyKey)
contexts.sortMusicPreferenceCategory(categoryValue)
}
internal fun addMusicPreferenceWithIntent(
category: CategoryType,
key: String,

View File

@ -1,4 +1,4 @@
package app.revanced.patches.music.misc.videoid.fingerprint
package app.revanced.patches.music.utils.videoid.fingerprint
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode

View File

@ -1,17 +1,17 @@
package app.revanced.patches.music.misc.videoid.patch
package app.revanced.patches.music.utils.videoid.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.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
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.music.misc.videoid.fingerprint.MusicVideoIdFingerprint
import app.revanced.patches.music.utils.videoid.fingerprint.MusicVideoIdFingerprint
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.util.integrations.Constants.MUSIC_UTILS_PATH
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@ -55,7 +55,7 @@ class MusicVideoIdPatch : BytecodePatch(
fun injectCall(
methodDescriptor: String
) {
insertMethod.addInstruction(
insertMethod.addInstructions(
insertIndex + offset, // move-result-object offset
"invoke-static {v$videoIdRegister}, $methodDescriptor"
)

View File

@ -1,16 +1,16 @@
package app.revanced.patches.youtube.misc.returnyoutubedislike.oldlayout.fingerprints
package app.revanced.patches.shared.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
object SlimMetadataButtonViewFingerprint : MethodFingerprint(
object EmptyComponentBuilderFingerprint : MethodFingerprint(
returnType = "L",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf(),
opcodes = listOf(
Opcode.IGET_OBJECT,
Opcode.RETURN_OBJECT
)
Opcode.NEW_INSTANCE,
Opcode.INVOKE_DIRECT
),
strings = listOf("Failed to convert Element to Flatbuffers: %s")
)

View File

@ -0,0 +1,9 @@
package app.revanced.patches.shared.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode
object OnBackPressedFingerprint : MethodFingerprint(
opcodes = listOf(Opcode.RETURN_VOID),
customFingerprint = { it, _ -> it.definingClass.endsWith("WatchWhileActivity;") && it.name == "onBackPressed" }
)

View File

@ -2,7 +2,7 @@ package app.revanced.patches.shared.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.imageOnlyTabId
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ImageOnlyTab
import app.revanced.util.bytecode.isWideLiteralExists
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@ -14,5 +14,5 @@ object PivotBarCreateButtonViewFingerprint : MethodFingerprint(
Opcode.MOVE_OBJECT,
Opcode.INVOKE_DIRECT_RANGE, // unique instruction anchor
),
customFingerprint = { it, _ -> it.isWideLiteralExists(imageOnlyTabId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(ImageOnlyTab) }
)

View File

@ -0,0 +1,8 @@
package app.revanced.patches.shared.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object SeekbarFingerprint : MethodFingerprint(
returnType = "V",
strings = listOf("timed_markers_width")
)

View File

@ -0,0 +1,7 @@
package app.revanced.patches.shared.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object SeekbarOnDrawFingerprint : MethodFingerprint(
customFingerprint = { methodDef, _ -> methodDef.name == "onDraw" }
)

View File

@ -1,10 +1,10 @@
package app.revanced.patches.shared.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.totalTimeId
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.TotalTime
import app.revanced.util.bytecode.isWideLiteralExists
object TotalTimeFingerprint : MethodFingerprint(
returnType = "V",
customFingerprint = { it, _ -> it.isWideLiteralExists(totalTimeId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(TotalTime) }
)

View File

@ -10,8 +10,8 @@ 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.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.adAttributionId
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.AdAttribution
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
import app.revanced.util.bytecode.getWideLiteralIndex
import app.revanced.util.bytecode.isWideLiteralExists
@ -25,14 +25,14 @@ class GeneralAdsBytecodePatch : BytecodePatch() {
override fun execute(context: BytecodeContext): PatchResult {
context.classes.forEach { classDef ->
classDef.methods.forEach { method ->
if (!method.isWideLiteralExists(adAttributionId))
if (!method.isWideLiteralExists(AdAttribution))
return@forEach
context.proxy(classDef)
.mutableClass
.findMutableMethodOf(method)
.apply {
val insertIndex = method.getWideLiteralIndex(adAttributionId) + 1
val insertIndex = method.getWideLiteralIndex(AdAttribution) + 1
if (getInstruction(insertIndex).opcode != org.jf.dexlib2.Opcode.INVOKE_VIRTUAL)
return@forEach

View File

@ -15,8 +15,7 @@ import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.ads.general.bytecode.patch.GeneralAdsBytecodePatch
import app.revanced.patches.youtube.ads.getpremium.patch.HideGetPremiumPatch
import app.revanced.patches.youtube.misc.litho.patch.ByteBufferFilterPatch
import app.revanced.patches.youtube.misc.litho.patch.LithoFilterPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
import org.w3c.dom.Element
@Patch

View File

@ -11,7 +11,7 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.videoads.GeneralVideoAdsPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.ADS_PATH
@Patch
@ -31,7 +31,7 @@ class VideoAdsPatch : BytecodePatch() {
GeneralVideoAdsPatch.injectLegacyAds(INTEGRATIONS_CLASS_DESCRIPTOR)
GeneralVideoAdsPatch.injectMainstreamAds(INTEGRATIONS_CLASS_DESCRIPTOR)
/*
/**
* Add settings
*/

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.buttomplayer.buttoncontainer.patch
package app.revanced.patches.youtube.buttomplayer.buttoncontainer.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
@ -11,7 +11,7 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.litho.patch.ByteBufferFilterPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.BOTTOM_PLAYER
@Patch

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.buttomplayer.comment.patch
package app.revanced.patches.youtube.buttomplayer.comment.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
@ -11,7 +11,7 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.ads.general.bytecode.patch.GeneralAdsBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
@Patch
@Name("hide-comment-component")

View File

@ -1,40 +0,0 @@
package app.revanced.patches.youtube.button.overlaybuttons.bytecode.patch
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
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.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.playercontrols.patch.PlayerControlsPatch
import app.revanced.patches.youtube.misc.videoid.legacy.patch.LegacyVideoIdPatch
import app.revanced.util.integrations.Constants.BUTTON_PATH
@Name("overlay-buttons-bytecode-patch")
@DependsOn(
dependencies = [
PlayerControlsPatch::class,
LegacyVideoIdPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class OverlayButtonsBytecodePatch : BytecodePatch() {
override fun execute(context: BytecodeContext): PatchResult {
arrayOf(
"Download",
"AutoRepeat",
"CopyWithTimeStamp",
"Copy",
"Speed"
).forEach {
PlayerControlsPatch.initializeControl("$BUTTON_PATH/$it;")
PlayerControlsPatch.injectVisibility("$BUTTON_PATH/$it;")
}
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.flyoutpanel.flyoutpanel.patch
package app.revanced.patches.youtube.flyoutpanel.flyoutpanel.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
@ -11,7 +11,7 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.ads.general.resource.patch.GeneralAdsPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
@Patch
@Name("hide-flyout-panel")

View File

@ -1,7 +1,7 @@
package app.revanced.patches.youtube.layout.flyoutpanel.oldqualitylayout.fingerprints
package app.revanced.patches.youtube.flyoutpanel.oldqualitylayout.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.videoQualityFragmentId
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.VideoQualityBottomSheet
import app.revanced.util.bytecode.isWideLiteralExists
import org.jf.dexlib2.Opcode
@ -22,5 +22,5 @@ object QualityMenuViewInflateFingerprint : MethodFingerprint(
Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST
),
customFingerprint = { it, _ -> it.isWideLiteralExists(videoQualityFragmentId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(VideoQualityBottomSheet) }
)

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.flyoutpanel.oldqualitylayout.patch
package app.revanced.patches.youtube.flyoutpanel.oldqualitylayout.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
@ -13,9 +13,9 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.flyoutpanel.oldqualitylayout.fingerprints.QualityMenuViewInflateFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.patches.youtube.flyoutpanel.oldqualitylayout.fingerprints.QualityMenuViewInflateFingerprint
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.FLYOUT_PANEL
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@ -31,9 +31,7 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@YouTubeCompatibility
@Version("0.0.1")
class OldQualityLayoutPatch : BytecodePatch(
listOf(
QualityMenuViewInflateFingerprint
)
listOf(QualityMenuViewInflateFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.fullscreen.autoplaypreview.patch
package app.revanced.patches.youtube.fullscreen.autoplaypreview.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
@ -15,9 +15,9 @@ import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.fingerprints.LayoutConstructorFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.autoNavPreviewId
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.AutoNavPreviewStub
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.bytecode.getStringIndex
import app.revanced.util.bytecode.getWideLiteralIndex
import app.revanced.util.integrations.Constants.FULLSCREEN
@ -41,25 +41,27 @@ class HideAutoplayPreviewPatch : BytecodePatch(
listOf(LayoutConstructorFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
LayoutConstructorFingerprint.result?.mutableMethod?.let {
val insertInstruction = it.implementation!!.instructions
LayoutConstructorFingerprint.result?.let {
it.mutableMethod.apply {
val insertInstruction = implementation!!.instructions
val dummyRegister = it.getInstruction<OneRegisterInstruction>(it.getStringIndex("1.0x")).registerA
val insertIndex = it.getWideLiteralIndex(autoNavPreviewId)
val dummyRegister = getInstruction<OneRegisterInstruction>(getStringIndex("1.0x")).registerA
val insertIndex = getWideLiteralIndex(AutoNavPreviewStub)
val branchIndex = insertInstruction.subList(insertIndex + 1, insertInstruction.size - 1).indexOfFirst { instruction ->
((instruction as? ReferenceInstruction)?.reference as? FieldReference)?.type == "Lcom/google/android/apps/youtube/app/player/autonav/AutonavToggleController;"
} + 1
val branchIndex = insertInstruction.subList(insertIndex + 1, insertInstruction.size - 1).indexOfFirst { instruction ->
((instruction as? ReferenceInstruction)?.reference as? FieldReference)?.type == "Lcom/google/android/apps/youtube/app/player/autonav/AutonavToggleController;"
} + 1
val jumpInstruction = it.getInstruction<Instruction>(insertIndex + branchIndex)
val jumpInstruction = getInstruction<Instruction>(insertIndex + branchIndex)
it.addInstructionsWithLabels(
insertIndex, """
invoke-static {}, $FULLSCREEN->hideAutoPlayPreview()Z
move-result v$dummyRegister
if-nez v$dummyRegister, :hidden
""", ExternalLabel("hidden", jumpInstruction)
)
addInstructionsWithLabels(
insertIndex, """
invoke-static {}, $FULLSCREEN->hideAutoPlayPreview()Z
move-result v$dummyRegister
if-nez v$dummyRegister, :hidden
""", ExternalLabel("hidden", jumpInstruction)
)
}
} ?: return LayoutConstructorFingerprint.toErrorResult()
/**

View File

@ -0,0 +1,10 @@
package app.revanced.patches.youtube.fullscreen.endscreenoverlay.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.AppRelatedEndScreenResults
import app.revanced.util.bytecode.isWideLiteralExists
object EndScreenResultsFingerprint : MethodFingerprint(
returnType = "V",
customFingerprint = { it, _ -> it.isWideLiteralExists(AppRelatedEndScreenResults) }
)

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.fullscreen.endscreenoverlay.patch
package app.revanced.patches.youtube.fullscreen.endscreenoverlay.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
@ -14,9 +14,9 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.fullscreen.endscreenoverlay.fingerprints.EndScreenResultsFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.patches.youtube.fullscreen.endscreenoverlay.fingerprints.EndScreenResultsFingerprint
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.FULLSCREEN
@Patch
@ -34,15 +34,17 @@ class HideEndScreenOverlayPatch : BytecodePatch(
listOf(EndScreenResultsFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
EndScreenResultsFingerprint.result?.mutableMethod?.let {
it.addInstructionsWithLabels(
0, """
invoke-static {}, $FULLSCREEN->hideEndScreenOverlay()Z
move-result v0
if-eqz v0, :show
return-void
""", ExternalLabel("show", it.getInstruction(0))
)
EndScreenResultsFingerprint.result?.let {
it.mutableMethod.apply {
addInstructionsWithLabels(
0, """
invoke-static {}, $FULLSCREEN->hideEndScreenOverlay()Z
move-result v0
if-eqz v0, :show
return-void
""", ExternalLabel("show", getInstruction(0))
)
}
} ?: return EndScreenResultsFingerprint.toErrorResult()
/**

View File

@ -0,0 +1,10 @@
package app.revanced.patches.youtube.fullscreen.fullscreenpanels.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.FullScreenEngagementPanel
import app.revanced.util.bytecode.isWideLiteralExists
object FullscreenEngagementPanelFingerprint : MethodFingerprint(
returnType = "L",
customFingerprint = { it, _ -> it.definingClass.endsWith("FullscreenEngagementPanelOverlay;") && it.isWideLiteralExists(FullScreenEngagementPanel) }
)

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.fingerprints
package app.revanced.patches.youtube.fullscreen.fullscreenpanels.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode

View File

@ -1,10 +1,11 @@
package app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.patch
package app.revanced.patches.youtube.fullscreen.fullscreenpanels.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.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
@ -17,10 +18,14 @@ import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.fingerprints.LayoutConstructorFingerprint
import app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.fingerprints.FullscreenViewAdderFingerprint
import app.revanced.patches.youtube.layout.fullscreen.quickactions.patch.QuickActionsPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.patches.youtube.fullscreen.fullscreenpanels.fingerprints.FullscreenEngagementPanelFingerprint
import app.revanced.patches.youtube.fullscreen.fullscreenpanels.fingerprints.FullscreenViewAdderFingerprint
import app.revanced.patches.youtube.utils.quickactionscontainer.patch.HideQuickActionsContainerPatch
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.FullScreenEngagementPanel
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.bytecode.getStringIndex
import app.revanced.util.bytecode.getWideLiteralIndex
import app.revanced.util.integrations.Constants.FULLSCREEN
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@ -32,19 +37,34 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction35c
@Description("Hides video description and comments panel in fullscreen view.")
@DependsOn(
[
QuickActionsPatch::class,
SettingsPatch::class
HideQuickActionsContainerPatch::class,
SettingsPatch::class,
SharedResourceIdPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideFullscreenPanelsPatch : BytecodePatch(
listOf(
FullscreenEngagementPanelFingerprint,
FullscreenViewAdderFingerprint,
LayoutConstructorFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
FullscreenEngagementPanelFingerprint.result?.let {
it.mutableMethod.apply {
val targetIndex = getWideLiteralIndex(FullScreenEngagementPanel) + 3
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
addInstruction(
targetIndex + 1,
"invoke-static {v$targetRegister}, $FULLSCREEN->hideFullscreenPanels(Landroidx/coordinatorlayout/widget/CoordinatorLayout;)V"
)
}
} ?: return FullscreenEngagementPanelFingerprint.toErrorResult()
FullscreenViewAdderFingerprint.result?.let {
it.mutableMethod.apply {
val endIndex = it.scanResult.patternScanResult!!.endIndex
@ -59,25 +79,26 @@ class HideFullscreenPanelsPatch : BytecodePatch(
"""
)
}
} ?: return FullscreenViewAdderFingerprint.toErrorResult()
}
LayoutConstructorFingerprint.result?.mutableMethod?.let {
val instructions = it.implementation!!.instructions
val dummyRegister = it.getInstruction<OneRegisterInstruction>(it.getStringIndex("1.0x")).registerA
LayoutConstructorFingerprint.result?.let {
it.mutableMethod.apply {
val dummyRegister = getInstruction<OneRegisterInstruction>(getStringIndex("1.0x")).registerA
val invokeIndex = instructions.indexOfFirst { instruction ->
instruction.opcode == Opcode.INVOKE_VIRTUAL &&
((instruction as ReferenceInstruction).reference.toString() ==
"Landroid/widget/FrameLayout;->addView(Landroid/view/View;)V")
val invokeIndex = implementation!!.instructions.indexOfFirst { instruction ->
instruction.opcode == Opcode.INVOKE_VIRTUAL &&
((instruction as ReferenceInstruction).reference.toString() ==
"Landroid/widget/FrameLayout;->addView(Landroid/view/View;)V")
}
addInstructionsWithLabels(
invokeIndex, """
invoke-static {}, $FULLSCREEN->showFullscreenTitle()Z
move-result v$dummyRegister
if-eqz v$dummyRegister, :hidden
""", ExternalLabel("hidden", getInstruction(invokeIndex + 1))
)
}
it.addInstructionsWithLabels(
invokeIndex, """
invoke-static {}, $FULLSCREEN->showFullscreenTitle()Z
move-result v$dummyRegister
if-eqz v$dummyRegister, :hidden
""", ExternalLabel("hidden", it.getInstruction(invokeIndex + 1))
)
} ?: return LayoutConstructorFingerprint.toErrorResult()
/**

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.fullscreen.landscapemode.fingerprints
package app.revanced.patches.youtube.fullscreen.landscapemode.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.fullscreen.landscapemode.fingerprints
package app.revanced.patches.youtube.fullscreen.landscapemode.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.fullscreen.landscapemode.fingerprints
package app.revanced.patches.youtube.fullscreen.landscapemode.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.fullscreen.landscapemode.patch
package app.revanced.patches.youtube.fullscreen.landscapemode.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
@ -15,8 +15,8 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.fullscreen.landscapemode.fingerprints.*
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.patches.youtube.fullscreen.landscapemode.fingerprints.*
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.FULLSCREEN
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.fullscreen.quickactions.patch
package app.revanced.patches.youtube.fullscreen.quickactions.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
@ -11,7 +11,8 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.ads.general.resource.patch.GeneralAdsPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.patches.youtube.utils.quickactionscontainer.patch.HideQuickActionsContainerPatch
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
@Patch
@Name("hide-quick-actions")
@ -19,6 +20,7 @@ import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
@DependsOn(
[
GeneralAdsPatch::class,
HideQuickActionsContainerPatch::class,
SettingsPatch::class
]
)

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.accountmenu.fingerprints
package app.revanced.patches.youtube.general.accountmenu.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode

View File

@ -1,7 +1,7 @@
package app.revanced.patches.youtube.layout.general.accountmenu.fingerprints
package app.revanced.patches.youtube.general.accountmenu.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.compactLinkId
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.CompactLink
import app.revanced.util.bytecode.isWideLiteralExists
import org.jf.dexlib2.Opcode
@ -12,5 +12,5 @@ object AccountMenuParentFingerprint : MethodFingerprint(
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT
),
customFingerprint = { it, _ -> it.isWideLiteralExists(compactLinkId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(CompactLink) }
)

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.accountmenu.patch
package app.revanced.patches.youtube.general.accountmenu.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
@ -14,10 +14,10 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.accountmenu.fingerprints.AccountMenuFingerprint
import app.revanced.patches.youtube.layout.general.accountmenu.fingerprints.AccountMenuParentFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.patches.youtube.general.accountmenu.fingerprints.AccountMenuFingerprint
import app.revanced.patches.youtube.general.accountmenu.fingerprints.AccountMenuParentFingerprint
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.autocaptions.fingerprints
package app.revanced.patches.youtube.general.autocaptions.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.autocaptions.patch
package app.revanced.patches.youtube.general.autocaptions.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
@ -18,9 +18,9 @@ import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.fingerprints.SubtitleButtonControllerFingerprint
import app.revanced.patches.shared.fingerprints.SubtitleTrackFingerprint
import app.revanced.patches.youtube.layout.general.autocaptions.fingerprints.StartVideoInformerFingerprint
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.patches.youtube.general.autocaptions.fingerprints.StartVideoInformerFingerprint
import app.revanced.patches.youtube.utils.playertype.patch.PlayerTypeHookPatch
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL
@Patch
@ -46,29 +46,28 @@ class AutoCaptionsPatch : BytecodePatch(
StartVideoInformerFingerprint.toPatch(Status.DISABLED),
SubtitleButtonControllerFingerprint.toPatch(Status.ENABLED)
).forEach { (fingerprint, status) ->
with(fingerprint.result?.mutableMethod ?: return fingerprint.toErrorResult()) {
addInstructions(
0,
fingerprint.result?.mutableMethod?.addInstructions(
0, """
const/4 v0, ${status.value}
sput-boolean v0, $GENERAL->captionsButtonStatus:Z
"""
const/4 v0, ${status.value}
sput-boolean v0, $GENERAL->captionsButtonStatus:Z
"""
)
}
)?: return fingerprint.toErrorResult()
}
SubtitleTrackFingerprint.result?.mutableMethod?.let {
it.addInstructionsWithLabels(
0, """
invoke-static {}, $GENERAL->hideAutoCaptions()Z
move-result v0
if-eqz v0, :auto_captions_shown
sget-boolean v0, $GENERAL->captionsButtonStatus:Z
if-nez v0, :auto_captions_shown
const/4 v0, 0x1
return v0
""", ExternalLabel("auto_captions_shown", it.getInstruction(0))
)
SubtitleTrackFingerprint.result?.let {
it.mutableMethod.apply {
addInstructionsWithLabels(
0, """
invoke-static {}, $GENERAL->hideAutoCaptions()Z
move-result v0
if-eqz v0, :auto_captions_shown
sget-boolean v0, $GENERAL->captionsButtonStatus:Z
if-nez v0, :auto_captions_shown
const/4 v0, 0x1
return v0
""", ExternalLabel("auto_captions_shown", getInstruction(0))
)
}
} ?: return SubtitleTrackFingerprint.toErrorResult()
/**

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.autopopuppanels.fingerprints
package app.revanced.patches.youtube.general.autopopuppanels.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.autopopuppanels.patch
package app.revanced.patches.youtube.general.autopopuppanels.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
@ -14,8 +14,8 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.autopopuppanels.fingerprints.EngagementPanelControllerFingerprint
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.patches.youtube.general.autopopuppanels.fingerprints.EngagementPanelControllerFingerprint
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL
@Patch
@ -29,17 +29,19 @@ class PlayerPopupPanelsPatch : BytecodePatch(
) {
override fun execute(context: BytecodeContext): PatchResult {
EngagementPanelControllerFingerprint.result?.mutableMethod?.let {
it.addInstructionsWithLabels(
0, """
invoke-static {}, $GENERAL->hideAutoPlayerPopupPanels()Z
move-result v0
if-eqz v0, :player_popup_panels_shown
if-eqz p4, :player_popup_panels_shown
const/4 v0, 0x0
return-object v0
""", ExternalLabel("player_popup_panels_shown", it.getInstruction(0))
)
EngagementPanelControllerFingerprint.result?.let {
it.mutableMethod.apply {
addInstructionsWithLabels(
0, """
invoke-static {}, $GENERAL->hideAutoPlayerPopupPanels()Z
move-result v0
if-eqz v0, :player_popup_panels_shown
if-eqz p4, :player_popup_panels_shown
const/4 v0, 0x0
return-object v0
""", ExternalLabel("player_popup_panels_shown", getInstruction(0))
)
}
} ?: return EngagementPanelControllerFingerprint.toErrorResult()
/**

View File

@ -1,7 +1,7 @@
package app.revanced.patches.youtube.layout.general.breakingnews.fingerprints
package app.revanced.patches.youtube.general.breakingnews.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.horizontalCardListId
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.HorizontalCardList
import app.revanced.util.bytecode.isWideLiteralExists
import org.jf.dexlib2.Opcode
@ -12,5 +12,5 @@ object BreakingNewsFingerprint : MethodFingerprint(
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT
),
customFingerprint = { it, _ -> it.isWideLiteralExists(horizontalCardListId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(HorizontalCardList) }
)

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.breakingnews.patch
package app.revanced.patches.youtube.general.breakingnews.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
@ -13,9 +13,9 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.breakingnews.fingerprints.BreakingNewsFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.patches.youtube.general.breakingnews.fingerprints.BreakingNewsFingerprint
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction

View File

@ -1,7 +1,7 @@
package app.revanced.patches.youtube.layout.general.categorybar.fingerprints
package app.revanced.patches.youtube.general.categorybar.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.filterBarHeightId
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.FilterBarHeight
import app.revanced.util.bytecode.isWideLiteralExists
import org.jf.dexlib2.Opcode
@ -12,5 +12,5 @@ object FilterBarHeightFingerprint : MethodFingerprint(
Opcode.MOVE_RESULT,
Opcode.IPUT
),
customFingerprint = { it, _ -> it.isWideLiteralExists(filterBarHeightId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(FilterBarHeight) }
)

View File

@ -1,7 +1,7 @@
package app.revanced.patches.youtube.layout.general.categorybar.fingerprints
package app.revanced.patches.youtube.general.categorybar.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.relatedChipCloudMarginId
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.RelatedChipCloudMargin
import app.revanced.util.bytecode.isWideLiteralExists
import org.jf.dexlib2.Opcode
@ -11,5 +11,5 @@ object RelatedChipCloudFingerprint : MethodFingerprint(
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT
),
customFingerprint = { it, _ -> it.isWideLiteralExists(relatedChipCloudMarginId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(RelatedChipCloudMargin) }
)

View File

@ -1,7 +1,7 @@
package app.revanced.patches.youtube.layout.general.categorybar.fingerprints
package app.revanced.patches.youtube.general.categorybar.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.barContainerHeightId
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.BarContainerHeight
import app.revanced.util.bytecode.isWideLiteralExists
import org.jf.dexlib2.Opcode
@ -13,5 +13,5 @@ object SearchResultsChipBarFingerprint : MethodFingerprint(
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT
),
customFingerprint = { it, _ -> it.isWideLiteralExists(barContainerHeightId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(BarContainerHeight) }
)

View File

@ -0,0 +1,96 @@
package app.revanced.patches.youtube.general.categorybar.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.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
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.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.general.categorybar.fingerprints.FilterBarHeightFingerprint
import app.revanced.patches.youtube.general.categorybar.fingerprints.RelatedChipCloudFingerprint
import app.revanced.patches.youtube.general.categorybar.fingerprints.SearchResultsChipBarFingerprint
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
@Patch
@Name("hide-category-bar")
@Description("Hide the category bar at the top of the feed and at the top of related videos.")
@DependsOn(
[
SettingsPatch::class,
SharedResourceIdPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class CategoryBarPatch : BytecodePatch(
listOf(
FilterBarHeightFingerprint,
RelatedChipCloudFingerprint,
SearchResultsChipBarFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
FilterBarHeightFingerprint.patch<TwoRegisterInstruction> { register ->
"""
invoke-static { v$register }, $GENERAL->hideCategoryBarInFeed(I)I
move-result v$register
"""
}
RelatedChipCloudFingerprint.patch<OneRegisterInstruction>(1) { register ->
"invoke-static { v$register }, " +
"$GENERAL->hideCategoryBarInRelatedVideo(Landroid/view/View;)V"
}
SearchResultsChipBarFingerprint.patch<OneRegisterInstruction>(-1, -2) { register ->
"""
invoke-static { v$register }, $GENERAL->hideCategoryBarInSearchResults(I)I
move-result v$register
"""
}
/**
* Add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: GENERAL_SETTINGS",
"SETTINGS: HIDE_CATEGORY_BAR"
)
)
SettingsPatch.updatePatchStatus("hide-category-bar")
return PatchResultSuccess()
}
private companion object {
private fun <RegisterInstruction: OneRegisterInstruction> MethodFingerprint.patch(
insertIndexOffset: Int = 0,
hookRegisterOffset: Int = 0,
instructions: (Int) -> String
) =
result?.let {
it.mutableMethod.apply {
val endIndex = it.scanResult.patternScanResult!!.endIndex
val insertIndex = endIndex + insertIndexOffset
val register = getInstruction<RegisterInstruction>(endIndex + hookRegisterOffset).registerA
addInstructions(insertIndex, instructions(register))
}
} ?: throw toErrorResult()
}
}

View File

@ -1,7 +1,7 @@
package app.revanced.patches.youtube.layout.general.channellistsubmenu.fingerprints
package app.revanced.patches.youtube.general.channellistsubmenu.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.channelListSubMenuId
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ChannelListSubMenu
import app.revanced.util.bytecode.isWideLiteralExists
import org.jf.dexlib2.Opcode
@ -12,5 +12,5 @@ object ChannelListSubMenuFingerprint : MethodFingerprint(
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT
),
customFingerprint = { it, _ -> it.isWideLiteralExists(channelListSubMenuId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(ChannelListSubMenu) }
)

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.channellistsubmenu.patch
package app.revanced.patches.youtube.general.channellistsubmenu.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
@ -13,9 +13,9 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.channellistsubmenu.fingerprints.ChannelListSubMenuFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.patches.youtube.general.channellistsubmenu.fingerprints.ChannelListSubMenuFingerprint
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction

View File

@ -1,7 +1,7 @@
package app.revanced.patches.youtube.layout.general.crowdfundingbox.fingerprints
package app.revanced.patches.youtube.general.crowdfundingbox.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.Companion.donationCompanionResourceId
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.DonationCompanion
import app.revanced.util.bytecode.isWideLiteralExists
import org.jf.dexlib2.Opcode
@ -11,5 +11,5 @@ object CrowdfundingBoxFingerprint : MethodFingerprint(
Opcode.MOVE_RESULT_OBJECT,
Opcode.IPUT_OBJECT
),
customFingerprint = { it, _ -> it.isWideLiteralExists(donationCompanionResourceId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(DonationCompanion) }
)

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.crowdfundingbox.patch
package app.revanced.patches.youtube.general.crowdfundingbox.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
@ -13,9 +13,9 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.crowdfundingbox.fingerprints.CrowdfundingBoxFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.patches.youtube.general.crowdfundingbox.fingerprints.CrowdfundingBoxFingerprint
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction

Some files were not shown because too many files have changed in this diff Show More