feat(YouTube Music - Spoof client): Add Use old client setting and Default client setting

This commit is contained in:
inotia00
2024-12-21 13:05:11 +09:00
parent 7ff865d25d
commit 61182fe52d
10 changed files with 167 additions and 52 deletions

View File

@ -4,6 +4,7 @@ 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.extensions.InstructionExtensions.instructions
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
@ -13,11 +14,14 @@ import app.revanced.patches.music.utils.patch.PatchList.SPOOF_CLIENT
import app.revanced.patches.music.utils.playbackSpeedBottomSheetFingerprint
import app.revanced.patches.music.utils.settings.CategoryType
import app.revanced.patches.music.utils.settings.ResourceUtils.updatePatchStatus
import app.revanced.patches.music.utils.settings.addPreferenceWithIntent
import app.revanced.patches.music.utils.settings.addSwitchPreference
import app.revanced.patches.music.utils.settings.settingsPatch
import app.revanced.patches.shared.blockrequest.blockRequestPatch
import app.revanced.patches.shared.createPlayerRequestBodyWithModelFingerprint
import app.revanced.patches.shared.extension.Constants.PATCHES_PATH
import app.revanced.patches.shared.indexOfModelInstruction
import app.revanced.util.findMethodOrThrow
import app.revanced.util.fingerprint.matchOrThrow
import app.revanced.util.fingerprint.methodOrThrow
import app.revanced.util.fingerprint.mutableClassOrThrow
@ -258,11 +262,29 @@ val spoofClientPatch = bytecodePatch(
// endregion
findMethodOrThrow("$PATCHES_PATH/PatchStatus;") {
name == "SpoofClient"
}.replaceInstruction(
0,
"const/4 v0, 0x1"
)
addSwitchPreference(
CategoryType.MISC,
"revanced_spoof_client",
"false"
)
addSwitchPreference(
CategoryType.MISC,
"revanced_spoof_client_legacy",
"false",
"revanced_spoof_client"
)
addPreferenceWithIntent(
CategoryType.MISC,
"revanced_spoof_client_type",
"revanced_spoof_client",
)
updatePatchStatus(SPOOF_CLIENT)

View File

@ -5,15 +5,18 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.instructions
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatchBuilder
import app.revanced.patcher.patch.BytecodePatchContext
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
import app.revanced.patches.shared.blockrequest.blockRequestPatch
import app.revanced.patches.shared.extension.Constants.PATCHES_PATH
import app.revanced.patches.shared.extension.Constants.SPOOF_PATH
import app.revanced.patches.shared.formatStreamModelConstructorFingerprint
import app.revanced.util.findInstructionIndicesReversedOrThrow
import app.revanced.util.findMethodOrThrow
import app.revanced.util.fingerprint.definingClassOrThrow
import app.revanced.util.fingerprint.injectLiteralInstructionBooleanCall
import app.revanced.util.fingerprint.matchOrThrow
@ -269,6 +272,13 @@ fun baseSpoofStreamingDataPatch(
// endregion
findMethodOrThrow("$PATCHES_PATH/PatchStatus;") {
name == "SpoofStreamingData"
}.replaceInstruction(
0,
"const/4 v0, 0x1"
)
executeBlock()
}

View File

@ -55,6 +55,14 @@
<item>6.11.52</item>
<item>4.27.53</item>
</string-array>
<string-array name="revanced_spoof_client_type_entries">
<item>@string/revanced_spoof_client_type_entry_android_music</item>
<item>@string/revanced_spoof_client_type_entry_ios_music</item>
</string-array>
<string-array name="revanced_spoof_client_type_entry_values">
<item>ANDROID_MUSIC</item>
<item>IOS_MUSIC</item>
</string-array>
<string-array name="revanced_spoof_streaming_data_type_entries">
<item>@string/revanced_spoof_streaming_data_type_entry_android_vr</item>
<item>@string/revanced_spoof_streaming_data_type_entry_ios</item>

View File

@ -451,12 +451,15 @@ Tap the continue button and allow optimization changes."</string>
<string name="revanced_spoof_client_title">Spoof client</string>
<string name="revanced_spoof_client_summary">"Spoof the client to prevent playback issues.
Limitations:
• OPUS audio codec may not be supported.
• Seekbar thumbnail may not be present.
• Watch history does not work with a brand account.
※ When used with 'Spoofing streaming data', playback issues may occur."</string>
<string name="revanced_spoof_client_legacy_title">Use old client</string>
<string name="revanced_spoof_client_legacy_summary">"Spoofing with version 4.27.53.
OPUS codec may not work."</string>
<string name="revanced_spoof_client_type_title">Default client</string>
<string name="revanced_spoof_client_type_summary">Defines a default client to spoofing.</string>
<string name="revanced_spoof_client_type_entry_android_music">Android Music</string>
<string name="revanced_spoof_client_type_entry_ios_music">iOS Music</string>
<string name="revanced_spoof_streaming_data_title">Spoof streaming data</string>
<string name="revanced_spoof_streaming_data_summary">"Spoof the streaming data to prevent playback issues.