mirror of
https://github.com/revanced/revanced-patches
synced 2024-11-10 11:49:29 +01:00
refactor: YouTube Music patches
This commit is contained in:
parent
a6aeca31bd
commit
8ea34036e5
@ -3,8 +3,9 @@ package app.revanced.patches
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patches.music.audio.EnableAudioOnlyPatch
|
||||
import app.revanced.patches.music.layout.RemoveUpgradeTabPatch
|
||||
import app.revanced.patches.music.layout.RemoveTastebuilderPatch
|
||||
import app.revanced.patches.music.layout.RemoveTasteBuilderPatch
|
||||
import app.revanced.patches.music.premium.BackgroundPlayPatch
|
||||
import app.revanced.patches.music.audio.CodecsUnlockPatch
|
||||
import app.revanced.patches.youtube.ad.HomeAdsPatch
|
||||
import app.revanced.patches.youtube.ad.HomePromoPatch
|
||||
import app.revanced.patches.youtube.ad.VideoAdsPatch
|
||||
@ -34,7 +35,7 @@ object Index {
|
||||
::EnableSeekbarTappingPatch,
|
||||
::EnableAudioOnlyPatch,
|
||||
::RemoveUpgradeTabPatch,
|
||||
::RemoveTastebuilderPatch,
|
||||
::RemoveTasteBuilderPatch,
|
||||
::BackgroundPlayPatch,
|
||||
::CodecsUnlockPatch
|
||||
)
|
||||
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches
|
||||
package app.revanced.patches.music.audio
|
||||
|
||||
import app.revanced.patcher.PatcherData
|
||||
import app.revanced.patcher.extensions.or
|
||||
@ -22,7 +22,7 @@ private val packageMetadata = listOf(
|
||||
private val patchMetadata = PatchMetadata(
|
||||
"codecs-unlock",
|
||||
"Audio codecs unlock patch",
|
||||
"Patch to unlock more audio codecs",
|
||||
"Enables more audio codecs. Usually results in better audio quality but may depend on song and device.",
|
||||
packageMetadata,
|
||||
"0.0.1"
|
||||
)
|
||||
|
@ -20,18 +20,18 @@ private val compatiblePackages = listOf(
|
||||
)
|
||||
)
|
||||
|
||||
class RemoveTastebuilderPatch : Patch(
|
||||
class RemoveTasteBuilderPatch : Patch(
|
||||
PatchMetadata(
|
||||
"tastebuilder-remover",
|
||||
"Remove Tastebuilder Patch",
|
||||
"Remove the tastebuilder from the Home screen.",
|
||||
"tasteBuilder-remover",
|
||||
"Remove TasteBuilder Patch",
|
||||
"Removes the \"Tell us which artists you like\" card from the Home screen. The same functionality can be triggered from the settings anyway.",
|
||||
compatiblePackages,
|
||||
"0.0.1"
|
||||
),
|
||||
listOf(
|
||||
MethodSignature(
|
||||
MethodSignatureMetadata(
|
||||
"tastebuilder-constructor",
|
||||
"taste-builder-constructor",
|
||||
MethodMetadata("Lkyu;", "<init>"),
|
||||
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
|
||||
compatiblePackages,
|
||||
@ -53,6 +53,14 @@ class RemoveTastebuilderPatch : Patch(
|
||||
Opcode.CONST_4,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.CONST,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.CHECK_CAST,
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.NEW_INSTANCE,
|
||||
Opcode.INVOKE_DIRECT,
|
||||
Opcode.IPUT_OBJECT
|
||||
)
|
||||
)
|
||||
@ -62,7 +70,9 @@ class RemoveTastebuilderPatch : Patch(
|
||||
val result = signatures.first().result!!
|
||||
val implementation = result.method.implementation!!
|
||||
|
||||
val register = (implementation.instructions[result.scanData.endIndex] as Instruction22c).registerA
|
||||
val insertIndex = result.scanData.endIndex - 8
|
||||
|
||||
val register = (implementation.instructions[insertIndex] as Instruction22c).registerA
|
||||
|
||||
val instructionList =
|
||||
"""
|
||||
@ -71,7 +81,7 @@ class RemoveTastebuilderPatch : Patch(
|
||||
""".trimIndent().toInstructions().toMutableList()
|
||||
|
||||
implementation.addInstructions(
|
||||
result.scanData.endIndex,
|
||||
insertIndex,
|
||||
instructionList
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user