mirror of
https://github.com/revanced/revanced-patches
synced 2025-01-11 20:56:15 +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.patcher.patch.Patch
|
||||||
import app.revanced.patches.music.audio.EnableAudioOnlyPatch
|
import app.revanced.patches.music.audio.EnableAudioOnlyPatch
|
||||||
import app.revanced.patches.music.layout.RemoveUpgradeTabPatch
|
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.premium.BackgroundPlayPatch
|
||||||
|
import app.revanced.patches.music.audio.CodecsUnlockPatch
|
||||||
import app.revanced.patches.youtube.ad.HomeAdsPatch
|
import app.revanced.patches.youtube.ad.HomeAdsPatch
|
||||||
import app.revanced.patches.youtube.ad.HomePromoPatch
|
import app.revanced.patches.youtube.ad.HomePromoPatch
|
||||||
import app.revanced.patches.youtube.ad.VideoAdsPatch
|
import app.revanced.patches.youtube.ad.VideoAdsPatch
|
||||||
@ -34,7 +35,7 @@ object Index {
|
|||||||
::EnableSeekbarTappingPatch,
|
::EnableSeekbarTappingPatch,
|
||||||
::EnableAudioOnlyPatch,
|
::EnableAudioOnlyPatch,
|
||||||
::RemoveUpgradeTabPatch,
|
::RemoveUpgradeTabPatch,
|
||||||
::RemoveTastebuilderPatch,
|
::RemoveTasteBuilderPatch,
|
||||||
::BackgroundPlayPatch,
|
::BackgroundPlayPatch,
|
||||||
::CodecsUnlockPatch
|
::CodecsUnlockPatch
|
||||||
)
|
)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches
|
package app.revanced.patches.music.audio
|
||||||
|
|
||||||
import app.revanced.patcher.PatcherData
|
import app.revanced.patcher.PatcherData
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
@ -22,7 +22,7 @@ private val packageMetadata = listOf(
|
|||||||
private val patchMetadata = PatchMetadata(
|
private val patchMetadata = PatchMetadata(
|
||||||
"codecs-unlock",
|
"codecs-unlock",
|
||||||
"Audio codecs unlock patch",
|
"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,
|
packageMetadata,
|
||||||
"0.0.1"
|
"0.0.1"
|
||||||
)
|
)
|
||||||
|
@ -20,18 +20,18 @@ private val compatiblePackages = listOf(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
class RemoveTastebuilderPatch : Patch(
|
class RemoveTasteBuilderPatch : Patch(
|
||||||
PatchMetadata(
|
PatchMetadata(
|
||||||
"tastebuilder-remover",
|
"tasteBuilder-remover",
|
||||||
"Remove Tastebuilder Patch",
|
"Remove TasteBuilder Patch",
|
||||||
"Remove the tastebuilder from the Home screen.",
|
"Removes the \"Tell us which artists you like\" card from the Home screen. The same functionality can be triggered from the settings anyway.",
|
||||||
compatiblePackages,
|
compatiblePackages,
|
||||||
"0.0.1"
|
"0.0.1"
|
||||||
),
|
),
|
||||||
listOf(
|
listOf(
|
||||||
MethodSignature(
|
MethodSignature(
|
||||||
MethodSignatureMetadata(
|
MethodSignatureMetadata(
|
||||||
"tastebuilder-constructor",
|
"taste-builder-constructor",
|
||||||
MethodMetadata("Lkyu;", "<init>"),
|
MethodMetadata("Lkyu;", "<init>"),
|
||||||
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
|
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
|
||||||
compatiblePackages,
|
compatiblePackages,
|
||||||
@ -53,6 +53,14 @@ class RemoveTastebuilderPatch : Patch(
|
|||||||
Opcode.CONST_4,
|
Opcode.CONST_4,
|
||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
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
|
Opcode.IPUT_OBJECT
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -62,7 +70,9 @@ class RemoveTastebuilderPatch : Patch(
|
|||||||
val result = signatures.first().result!!
|
val result = signatures.first().result!!
|
||||||
val implementation = result.method.implementation!!
|
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 =
|
val instructionList =
|
||||||
"""
|
"""
|
||||||
@ -71,7 +81,7 @@ class RemoveTastebuilderPatch : Patch(
|
|||||||
""".trimIndent().toInstructions().toMutableList()
|
""".trimIndent().toInstructions().toMutableList()
|
||||||
|
|
||||||
implementation.addInstructions(
|
implementation.addInstructions(
|
||||||
result.scanData.endIndex,
|
insertIndex,
|
||||||
instructionList
|
instructionList
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user