diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/resourceid/patch/SharedResourceIdPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/resourceid/patch/SharedResourceIdPatch.kt index d5dce2222..1a8eafd5a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/resourceid/patch/SharedResourceIdPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/resourceid/patch/SharedResourceIdPatch.kt @@ -29,7 +29,6 @@ class SharedResourceIdPatch : ResourcePatch { var compactLinkLabelId: Long = -1 var controlsLayoutStubResourceId: Long = -1 var donationCompanionResourceId: Long = -1 - var emptyColorLabelId: Long = -1 var fabLabelId: Long = -1 var filterBarHeightLabelId: Long = -1 var floatyBarQueueLabelId: Long = -1 @@ -71,7 +70,6 @@ class SharedResourceIdPatch : ResourcePatch { compactLinkLabelId = find(LAYOUT, "compact_link") controlsLayoutStubResourceId = find(ID, "controls_layout_stub") donationCompanionResourceId = find(LAYOUT, "donation_companion") - emptyColorLabelId = find(COLOR, "inline_time_bar_colorized_bar_empty_color_dark") fabLabelId = find(ID, "fab") filterBarHeightLabelId = find(DIMEN, "filter_bar_height") floatyBarQueueLabelId = find(STRING, "floaty_bar_queue_status") diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/patch/SponsorBlockBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/patch/SponsorBlockBytecodePatch.kt index 2d310cff4..de0c97e62 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/patch/SponsorBlockBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/patch/SponsorBlockBytecodePatch.kt @@ -8,6 +8,7 @@ import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.replaceInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult +import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod @@ -33,6 +34,7 @@ import org.jf.dexlib2.iface.reference.MethodReference @Name("sponsorblock-bytecode-patch") @DependsOn( [ + HookTimebarPatch::class, LegacyVideoIdPatch::class, MainstreamVideoIdPatch::class, OverrideSpeedHookPatch::class, @@ -112,6 +114,9 @@ class SponsorBlockBytecodePatch : BytecodePatch( insertInstructions.indexOf(it) to (it as FiveRegisterInstruction).registerD } + if (drawRectangleInstructions.size < 4) + return PatchResultError("Couldn't find drawRect reference") + mapOf( "setSponsorBarAbsoluteLeft" to 3, "setSponsorBarAbsoluteRight" to 0 diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/timebar/fingerprints/EmptyColorFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/timebar/fingerprints/EmptyColorFingerprint.kt index 79c59735b..a3b60a38f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/timebar/fingerprints/EmptyColorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/timebar/fingerprints/EmptyColorFingerprint.kt @@ -1,17 +1,20 @@ package app.revanced.patches.youtube.misc.timebar.fingerprints import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch -import org.jf.dexlib2.iface.instruction.WideLiteralInstruction import org.jf.dexlib2.Opcode object EmptyColorFingerprint : MethodFingerprint( returnType = "V", - opcodes = listOf(Opcode.DIV_LONG_2ADDR), - customFingerprint = { methodDef -> - methodDef.implementation?.instructions?.any { - it.opcode.ordinal == Opcode.CONST.ordinal && - (it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.emptyColorLabelId - } == true - } + opcodes = listOf( + Opcode.MOVE_RESULT_WIDE, + Opcode.CMP_LONG, + Opcode.IF_LEZ, + Opcode.IGET_OBJECT, + Opcode.CHECK_CAST, + Opcode.INVOKE_VIRTUAL, + Opcode.MOVE_RESULT_WIDE, + Opcode.GOTO, + Opcode.INVOKE_VIRTUAL, + Opcode.MOVE_RESULT_WIDE + ) ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/timebar/patch/HookTimebarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/timebar/patch/HookTimebarPatch.kt index bb611e630..891716d76 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/timebar/patch/HookTimebarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/timebar/patch/HookTimebarPatch.kt @@ -8,14 +8,11 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion. import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess -import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patches.shared.annotation.YouTubeCompatibility -import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.misc.timebar.fingerprints.* @Name("hook-timebar-patch") -@DependsOn([SharedResourceIdPatch::class]) @YouTubeCompatibility @Version("0.0.1") class HookTimebarPatch : BytecodePatch( diff --git a/src/main/resources/youtube/settings/host/values/strings.xml b/src/main/resources/youtube/settings/host/values/strings.xml index e0aee1d02..176a3166f 100644 --- a/src/main/resources/youtube/settings/host/values/strings.xml +++ b/src/main/resources/youtube/settings/host/values/strings.xml @@ -543,38 +543,56 @@ Since these setting is quite outdated, it may not be valid" Enable SponsorBlock SponsorBlock is a crowd-sourced system for skipping annoying parts of YouTube videos + + Appearance Show voting button Segment voting button is shown Segment voting button is not shown - Show create new segment button - Create new segment button is shown - Create new segment button is not shown Use compact skip button Skip button styled for minimum width Skip button styled for best appearance - What to do with different segments - General - Show a toast when skipping segment automatically + Automatically hide skip button + Skip button hides after a few seconds + Skip button displayed for entire segment + Show a toast when skipping automatically Toast shown when a segment is automatically skipped. Tap here to see an example Toast not shown. Tap here to see an example - Enable skip count tracking - Lets the SponsorBlock leaderboard know how much time is saved. A message is sent to the leaderboard each time a segment is skipped - Skip count tracking is not enabled Show video length without segments Video length minus all segments, shown in parentheses next to the full video length Full video length shown + + Creating new segments + Show create new segment button + Create new segment button is shown + Create new segment button is not shown + Adjust new segment step Number of milliseconds the time adjustment buttons move when creating new segments Value must be a positive number + View guidelines + Guidelines contain rules and tips for creating new segments + Follow the guidelines + Read the SponsorBlock guidelines before creating new segments + Already read + Show me + + General + Enable skip count tracking + Lets the SponsorBlock leaderboard know how much time is saved. A message is sent to the leaderboard each time a segment is skipped + Skip count tracking is not enabled Minimum segment duration Segments shorter than this value (in seconds) will not be shown or skipped Your private user id This should be kept private. This is like a password and should not be shared with anyone. If someone has this, they can impersonate you User id cannot be blank - Your SponsorBlock JSON configuration that can be imported/exported to ReVanced and other SponsorBlock platforms. This includes your private user id. Be sure to share this wisely Change API URL - The address SponsorBlock uses to make calls to the server. <b>Don\'t change this unless you know what you\'re doing</b> + The address SponsorBlock uses to make calls to the server. Do not change this unless you know what you\'re doing + API URL reset + API URL is invalid + API URL changed + Your SponsorBlock JSON configuration that can be imported/exported to ReVanced and other SponsorBlock platforms. This includes your private user id. Be sure to share this wisely + Change segment behavior Sponsor Paid promotion, paid referrals and direct advertisements. Not for self-promotion or free shout-outs to causes/creators/websites/products they like Unpaid/Self Promotion @@ -625,9 +643,6 @@ Since these setting is quite outdated, it may not be valid" Show in seek bar Disable - Data is provided by the SponsorBlock API. Tap here to learn more and see downloads for other platforms - Integration made by JakubWeg - Can\'t submit the segment: %s Unable to submit segments (API timed out) Unable to submit segments (status: %d %s) @@ -661,13 +676,6 @@ Since these setting is quite outdated, it may not be valid" Do you want to edit the timing for the start or end of the segment? Invalid time given - View guidelines - Guidelines contain rules and tips for creating new segments - Follow the guidelines - Read the SponsorBlock guidelines before creating new segments - Already read - Show me - Stats Stats temporarily not available (API is down) SponsorBlock is disabled @@ -687,6 +695,7 @@ Since these setting is quite outdated, it may not be valid" %d hours %d minutes %d minutes %d seconds %d seconds + Color: Color changed Color reset @@ -694,9 +703,9 @@ Since these setting is quite outdated, it may not be valid" Reset color Reset - API URL reset - API URL is invalid - API URL changed + + Data is provided by the SponsorBlock API. Tap here to learn more and see downloads for other platforms + Integration made by JakubWeg sec Failed to export settings