fix(YouTube/Default playback speed): change default value

This commit is contained in:
inotia00 2023-10-21 05:02:18 +09:00
parent a7043078b2
commit ccf5054b04
4 changed files with 26 additions and 12 deletions

View File

@ -12,6 +12,7 @@ import app.revanced.patches.music.utils.overridespeed.OverrideSpeedHookPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.patches.music.video.speed.fingerprints.PlaybackSpeedBottomSheetFingerprint
import app.revanced.patches.music.video.speed.fingerprints.PlaybackSpeedBottomSheetParentFingerprint
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_VIDEO_PATH
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
@ -67,6 +68,8 @@ object PlaybackSpeedPatch : BytecodePatch(
"false"
)
context.updatePatchStatus("RememberPlaybackSpeed", false)
}
private const val INTEGRATIONS_CLASS_DESCRIPTOR =

View File

@ -13,6 +13,8 @@ import app.revanced.patches.youtube.utils.overridespeed.OverrideSpeedHookPatch
import app.revanced.patches.youtube.utils.settings.SettingsPatch
import app.revanced.patches.youtube.utils.videocpn.VideoCpnPatch
import app.revanced.patches.youtube.video.speed.fingerprints.NewPlaybackSpeedChangedFingerprint
import app.revanced.util.bytecode.BytecodeHelper
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
import app.revanced.util.integrations.Constants.VIDEO_PATH
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
@ -87,6 +89,8 @@ object PlaybackSpeedPatch : BytecodePatch(
SettingsPatch.updatePatchStatus("Default playback speed")
context.updatePatchStatus("DefaultPlaybackSpeed", true)
}
private const val INTEGRATIONS_PLAYBACK_SPEED_CLASS_DESCRIPTOR =

View File

@ -40,18 +40,25 @@ internal object BytecodeHelper {
}
}
internal fun BytecodeContext.updatePatchStatus(patch: String) {
this.classes.forEach { classDef ->
classDef.methods.forEach { method ->
if (classDef.type.endsWith("/PatchStatus;") && method.name == patch) {
val patchStatusMethod =
this.proxy(classDef).mutableClass.methods.first { it.name == patch }
internal fun BytecodeContext.updatePatchStatus(
methodName: String,
isYouTube: Boolean
) {
val integrationPath =
if (isYouTube)
UTILS_PATH
else
MUSIC_UTILS_PATH
patchStatusMethod.replaceInstruction(
0,
"const/4 v0, 0x1"
)
}
this.classes.forEach { classDef ->
if (classDef.type.endsWith("$integrationPath/PatchStatus;")) {
val patchStatusMethod =
this.proxy(classDef).mutableClass.methods.first { it.name == methodName }
patchStatusMethod.replaceInstruction(
0,
"const/4 v0, 0x1"
)
}
}
}

View File

@ -673,7 +673,7 @@
<app.revanced.integrations.settingsmenu.ResettableEditTextPreference android:title="@string/revanced_custom_playback_speeds_title" android:key="revanced_custom_playback_speeds" android:summary="@string/revanced_custom_playback_speeds_summary" android:defaultValue="0.25\n0.5\n0.75\n1.0\n1.25\n1.5\n1.75\n2.0\n2.25\n2.5" android:inputType="textMultiLine" />SETTINGS: CUSTOM_PLAYBACK_SPEED -->
<!-- SETTINGS: DEFAULT_PLAYBACK_SPEED
<SwitchPreference android:title="@string/revanced_enable_save_playback_speed_title" android:key="revanced_enable_save_playback_speed" android:defaultValue="true" android:summaryOn="@string/revanced_enable_save_playback_speed_summary_on" android:summaryOff="@string/revanced_enable_save_playback_speed_summary_off" />SETTINGS: DEFAULT_PLAYBACK_SPEED -->
<SwitchPreference android:title="@string/revanced_enable_save_playback_speed_title" android:key="revanced_enable_save_playback_speed" android:defaultValue="false" android:summaryOn="@string/revanced_enable_save_playback_speed_summary_on" android:summaryOff="@string/revanced_enable_save_playback_speed_summary_off" />SETTINGS: DEFAULT_PLAYBACK_SPEED -->
<!-- SETTINGS: DEFAULT_VIDEO_QUALITY
<SwitchPreference android:title="@string/revanced_enable_save_video_quality_title" android:key="revanced_enable_save_video_quality" android:defaultValue="true" android:summaryOn="@string/revanced_enable_save_video_quality_summary_on" android:summaryOff="@string/revanced_enable_save_video_quality_summary_off" />