This commit is contained in:
inotia00 2023-09-14 16:37:53 +09:00
parent d98d4fad00
commit 8e28386a19
7 changed files with 37 additions and 15 deletions

View File

@ -10,9 +10,9 @@ import app.revanced.patcher.patch.BytecodePatch
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.utils.fingerprints.MenuItemFingerprint
import app.revanced.patches.music.flyoutpanel.utils.EnumUtils.getEnumIndex
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.fingerprints.MenuItemFingerprint
import app.revanced.patches.music.utils.flyoutbutton.patch.FlyoutButtonContainerResourcePatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.enum.CategoryType

View File

@ -9,9 +9,9 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.fingerprints.MenuItemFingerprint
import app.revanced.patches.music.flyoutpanel.utils.EnumUtils.getEnumIndex
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.fingerprints.MenuItemFingerprint
import app.revanced.patches.music.utils.flyoutbutton.patch.FlyoutButtonItemResourcePatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.videoid.patch.VideoIdPatch
@ -42,8 +42,10 @@ class ReplaceDismissQueuePatch : BytecodePatch(
val textViewIndex = it.scanResult.patternScanResult!!.startIndex
val imageViewIndex = it.scanResult.patternScanResult!!.endIndex
val textViewRegister = getInstruction<OneRegisterInstruction>(textViewIndex).registerA
val imageViewRegister = getInstruction<OneRegisterInstruction>(imageViewIndex).registerA
val textViewRegister =
getInstruction<OneRegisterInstruction>(textViewIndex).registerA
val imageViewRegister =
getInstruction<OneRegisterInstruction>(imageViewIndex).registerA
addInstruction(
enumIndex + 1,

View File

@ -6,5 +6,9 @@ import app.revanced.util.bytecode.isWideLiteralExists
object SeekBarConstructorFingerprint : MethodFingerprint(
returnType = "V",
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(InlineTimeBarAdBreakMarkerColor) }
customFingerprint = { methodDef, _ ->
methodDef.isWideLiteralExists(
InlineTimeBarAdBreakMarkerColor
)
}
)

View File

@ -29,7 +29,11 @@ class ReturnYouTubeDislikePatch : ResourcePatch {
context.addReVancedMusicPreference(RETURN_YOUTUBE_DISLIKE_SETTINGS_KEY)
context.addSwitchPreference("revanced_ryd_enabled", "true")
context.addSwitchPreference("revanced_ryd_dislike_percentage", "false", "revanced_ryd_enabled")
context.addSwitchPreference(
"revanced_ryd_dislike_percentage",
"false",
"revanced_ryd_enabled"
)
context.addSwitchPreference("revanced_ryd_compact_layout", "false", "revanced_ryd_enabled")
context.addPreferenceCategory("revanced_ryd_about")
context.addAboutPreference("revanced_ryd_attribution")
@ -76,7 +80,9 @@ class ReturnYouTubeDislikePatch : ResourcePatch {
this.xmlEditor[YOUTUBE_MUSIC_SETTINGS_PATH].use { editor ->
val tags = editor.file.getElementsByTagName("PreferenceScreen")
List(tags.length) { tags.item(it) as Element }
.filter { it.getAttribute("android:key").contains(RETURN_YOUTUBE_DISLIKE_SETTINGS_KEY) }
.filter {
it.getAttribute("android:key").contains(RETURN_YOUTUBE_DISLIKE_SETTINGS_KEY)
}
.forEach {
it.adoptChild(PREFERENCE_CATEGORY_TAG_NAME) {
setAttribute("android:title", "@string/$category")
@ -101,7 +107,9 @@ class ReturnYouTubeDislikePatch : ResourcePatch {
this.xmlEditor[YOUTUBE_MUSIC_SETTINGS_PATH].use { editor ->
val tags = editor.file.getElementsByTagName("PreferenceScreen")
List(tags.length) { tags.item(it) as Element }
.filter { it.getAttribute("android:key").contains(RETURN_YOUTUBE_DISLIKE_SETTINGS_KEY) }
.filter {
it.getAttribute("android:key").contains(RETURN_YOUTUBE_DISLIKE_SETTINGS_KEY)
}
.forEach {
it.adoptChild(SWITCH_PREFERENCE_TAG_NAME) {
setAttribute("android:title", "@string/$key" + "_title")

View File

@ -123,7 +123,8 @@ class SponsorBlockBytecodePatch : BytecodePatch(
MusicPlaybackControlsTimeBarOnMeasureFingerprint.result?.let {
it.mutableMethod.apply {
val rectangleIndex = it.scanResult.patternScanResult!!.startIndex
val rectangleReference = getInstruction<ReferenceInstruction>(rectangleIndex).reference
val rectangleReference =
getInstruction<ReferenceInstruction>(rectangleIndex).reference
rectangleFieldName = (rectangleReference as FieldReference).name
}
} ?: throw MusicPlaybackControlsTimeBarOnMeasureFingerprint.exception

View File

@ -59,7 +59,10 @@ class SponsorBlockPatch : ResourcePatch {
context["res/xml/sponsorblock_prefs.xml"].writeText(
context["res/xml/sponsorblock_prefs.xml"].readText()
.replace("\"com.google.android.apps.youtube.music\"", "\"" + MusicResourceHelper.targetPackage + "\"")
.replace(
"\"com.google.android.apps.youtube.music\"",
"\"" + MusicResourceHelper.targetPackage + "\""
)
)
}

View File

@ -14,10 +14,10 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.fingerprints.SeekBarConstructorFingerprint
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.videoinformation.fingerprints.PlayerControllerSetTimeReferenceFingerprint
import app.revanced.patches.music.utils.videoinformation.fingerprints.PlayerInitFingerprint
import app.revanced.patches.music.utils.fingerprints.SeekBarConstructorFingerprint
import app.revanced.patches.music.utils.videoinformation.fingerprints.SeekFingerprint
import app.revanced.patches.music.utils.videoinformation.fingerprints.VideoLengthFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
@ -91,12 +91,15 @@ class VideoInformationPatch : BytecodePatch(
)
}.result?.let {
it.mutableMethod.apply {
val rectangleReference = getInstruction<ReferenceInstruction>(implementation!!.instructions.count() - 3).reference
val rectangleReference =
getInstruction<ReferenceInstruction>(implementation!!.instructions.count() - 3).reference
rectangleFieldName = (rectangleReference as FieldReference).name
val videoLengthRegisterIndex = it.scanResult.patternScanResult!!.startIndex + 1
val videoLengthRegister = getInstruction<OneRegisterInstruction>(videoLengthRegisterIndex).registerA
val dummyRegisterForLong = videoLengthRegister + 1 // required for long values since they are wide
val videoLengthRegister =
getInstruction<OneRegisterInstruction>(videoLengthRegisterIndex).registerA
val dummyRegisterForLong =
videoLengthRegister + 1 // required for long values since they are wide
addInstruction(
videoLengthRegisterIndex + 1,
@ -122,7 +125,8 @@ class VideoInformationPatch : BytecodePatch(
}
companion object {
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/music/patches/utils/VideoInformation;"
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
"Lapp/revanced/music/patches/utils/VideoInformation;"
private lateinit var playerInitMethod: MutableMethod
private var playerInitInsertIndex = 4