mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 13:17:46 +02:00
feat(YouTube): add Enable music search
patch
This commit is contained in:
@ -0,0 +1,67 @@
|
||||
package app.revanced.patches.youtube.general.musicsearch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.general.musicsearch.fingerprints.VoiceSearchConfigFingerprint
|
||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.GENERAL
|
||||
|
||||
@Patch(
|
||||
name = "Enable music search",
|
||||
description = "Enables music search in the voice search screen.",
|
||||
dependencies = [SettingsPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.30.37",
|
||||
"18.31.40",
|
||||
"18.32.39",
|
||||
"18.33.40",
|
||||
"18.34.38",
|
||||
"18.35.36",
|
||||
"18.36.39",
|
||||
"18.37.36",
|
||||
"18.38.44",
|
||||
"18.39.41",
|
||||
"18.40.34"
|
||||
]
|
||||
)
|
||||
],
|
||||
use = false
|
||||
)
|
||||
@Suppress("unused")
|
||||
object MusicSearchPatch : BytecodePatch(
|
||||
setOf(VoiceSearchConfigFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
VoiceSearchConfigFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
addInstructions(
|
||||
0, """
|
||||
invoke-static { }, $GENERAL->enableMusicSearch()Z
|
||||
move-result v0
|
||||
return v0
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: throw VoiceSearchConfigFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: GENERAL_SETTINGS",
|
||||
"SETTINGS: ENABLE_MUSIC_SEARCH"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("Enable music search")
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package app.revanced.patches.youtube.general.musicsearch.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.util.bytecode.isWide32LiteralExists
|
||||
|
||||
object VoiceSearchConfigFingerprint : MethodFingerprint(
|
||||
returnType = "Z",
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45417109) }
|
||||
)
|
Reference in New Issue
Block a user