mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 21:27:43 +02:00
cleanup
This commit is contained in:
@ -37,7 +37,8 @@ class CustomVideoSpeedBytecodePatch : BytecodePatch(
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
val speed = PatchOptions.CustomSpeedArrays
|
||||
val splits = speed!!.replace(" ","").split(",")
|
||||
?: return PatchResultError("Invalid video speed array.")
|
||||
val splits = speed.replace(" ","").split(",")
|
||||
if (splits.isEmpty()) throw IllegalArgumentException("Invalid speed elements")
|
||||
val videoSpeedsArray = splits.map { it.toFloat().toRawBits() }
|
||||
|
||||
|
@ -14,7 +14,9 @@ import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.shared.patch.options.PatchOptions
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.video.customspeed.bytecode.patch.CustomVideoSpeedBytecodePatch
|
||||
import app.revanced.util.resources.ResourceHelper
|
||||
import app.revanced.util.resources.ResourceHelper.addSpeedEntries
|
||||
import app.revanced.util.resources.ResourceHelper.addSpeedEntryValues
|
||||
import app.revanced.util.resources.ResourceHelper.replaceCustomSpeed
|
||||
import app.revanced.util.resources.ResourceUtils.copyXmlNode
|
||||
|
||||
@Patch
|
||||
@ -35,7 +37,7 @@ class CustomVideoSpeedPatch : ResourcePatch {
|
||||
/*
|
||||
* Copy arrays
|
||||
*/
|
||||
context.copyXmlNode("youtube/speed/host", "values/arrays.xml", "resources")
|
||||
context.copyXmlNode("youtube/customspeed/host", "values/arrays.xml", "resources")
|
||||
|
||||
val speed = PatchOptions.CustomSpeedArrays
|
||||
?: return PatchResultError("Invalid video speed array.")
|
||||
@ -44,26 +46,23 @@ class CustomVideoSpeedPatch : ResourcePatch {
|
||||
if (splits.isEmpty()) throw IllegalArgumentException("Invalid speed elements")
|
||||
val speedElements = splits.map { it }
|
||||
for (index in 0 until splits.count()) {
|
||||
ResourceHelper.addEntryValues(context, speedElements[index])
|
||||
ResourceHelper.addEntries(context, speedElements[index] + "x")
|
||||
context.addSpeedEntries(speedElements[index] + "x")
|
||||
context.addSpeedEntryValues(speedElements[index])
|
||||
}
|
||||
|
||||
ResourceHelper.addSpeed(context)
|
||||
context.replaceCustomSpeed()
|
||||
|
||||
/*
|
||||
add settings
|
||||
*/
|
||||
ResourceHelper.addSettings(
|
||||
context,
|
||||
"PREFERENCE_CATEGORY: REVANCED_EXTENDED_SETTINGS",
|
||||
"PREFERENCE: VIDEO_SETTINGS",
|
||||
"SETTINGS: CUSTOM_VIDEO_SPEED"
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: VIDEO_SETTINGS",
|
||||
"SETTINGS: CUSTOM_VIDEO_SPEED"
|
||||
)
|
||||
)
|
||||
|
||||
ResourceHelper.patchSuccess(
|
||||
context,
|
||||
"custom-video-speed"
|
||||
)
|
||||
SettingsPatch.updatePatchStatus("custom-video-speed")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.video.quality.bytecode.patch.VideoQualityBytecodePatch
|
||||
import app.revanced.util.resources.ResourceHelper
|
||||
import app.revanced.util.resources.ResourceUtils.copyXmlNode
|
||||
|
||||
@Patch
|
||||
@ -39,17 +38,14 @@ class VideoQualityPatch : ResourcePatch {
|
||||
/*
|
||||
add settings
|
||||
*/
|
||||
ResourceHelper.addSettings(
|
||||
context,
|
||||
"PREFERENCE_CATEGORY: REVANCED_EXTENDED_SETTINGS",
|
||||
"PREFERENCE: VIDEO_SETTINGS",
|
||||
"SETTINGS: DEFAULT_VIDEO_QUALITY"
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: VIDEO_SETTINGS",
|
||||
"SETTINGS: DEFAULT_VIDEO_QUALITY"
|
||||
)
|
||||
)
|
||||
|
||||
ResourceHelper.patchSuccess(
|
||||
context,
|
||||
"default-video-quality"
|
||||
)
|
||||
SettingsPatch.updatePatchStatus("default-video-quality")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ import app.revanced.patcher.util.smali.toInstructions
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.misc.videoid.legacy.patch.LegacyVideoIdPatch
|
||||
import app.revanced.patches.youtube.video.speed.bytecode.fingerprints.*
|
||||
import app.revanced.util.bytecode.BytecodeHelper
|
||||
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
|
||||
import app.revanced.util.integrations.Constants.VIDEO_PATH
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.dexbacked.reference.DexBackedMethodReference
|
||||
@ -114,7 +114,7 @@ class VideoSpeedBytecodePatch : BytecodePatch(
|
||||
|
||||
LegacyVideoIdPatch.injectCall("$INTEGRATIONS_VIDEO_SPEED_CLASS_DESCRIPTOR->newVideoStarted(Ljava/lang/String;)V")
|
||||
|
||||
BytecodeHelper.patchStatus(context, "VideoSpeed")
|
||||
context.updatePatchStatus("VideoSpeed")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.video.speed.bytecode.patch.VideoSpeedBytecodePatch
|
||||
import app.revanced.util.resources.ResourceHelper
|
||||
|
||||
@Patch
|
||||
@Name("default-video-speed")
|
||||
@ -31,17 +30,14 @@ class VideoSpeedPatch : ResourcePatch {
|
||||
/*
|
||||
add settings
|
||||
*/
|
||||
ResourceHelper.addSettings(
|
||||
context,
|
||||
"PREFERENCE_CATEGORY: REVANCED_EXTENDED_SETTINGS",
|
||||
"PREFERENCE: VIDEO_SETTINGS",
|
||||
"SETTINGS: DEFAULT_VIDEO_SPEED"
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: VIDEO_SETTINGS",
|
||||
"SETTINGS: DEFAULT_VIDEO_SPEED"
|
||||
)
|
||||
)
|
||||
|
||||
ResourceHelper.patchSuccess(
|
||||
context,
|
||||
"default-video-speed"
|
||||
)
|
||||
SettingsPatch.updatePatchStatus("default-video-speed")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
Reference in New Issue
Block a user