This commit is contained in:
inotia00
2023-03-11 07:52:06 +09:00
parent 584fcef9b2
commit 8a23742991
59 changed files with 128 additions and 139 deletions

View File

@ -2,7 +2,7 @@ package app.revanced.patches.youtube.misc.minimizedplayback.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@ -22,7 +22,7 @@ object MinimizedPlaybackSettingsFingerprint : MethodFingerprint(
customFingerprint = { methodDef ->
methodDef.implementation?.instructions?.any { instruction ->
instruction.opcode.ordinal == Opcode.CONST.ordinal &&
(instruction as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.backgroundCategoryLabelId
(instruction as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.backgroundCategoryLabelId
} == true
}
)

View File

@ -19,7 +19,7 @@ import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.minimizedplayback.fingerprints.*
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.MISC_PATH
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
@ -33,7 +33,7 @@ import org.jf.dexlib2.iface.reference.MethodReference
[
PlayerTypeHookPatch::class,
SettingsPatch::class,
SharedResourcdIdPatch::class
SharedResourceIdPatch::class
]
)
@YouTubeCompatibility

View File

@ -1,7 +1,7 @@
package app.revanced.patches.youtube.misc.playerbutton.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
import org.jf.dexlib2.Opcode
@ -10,7 +10,7 @@ object LiveChatFingerprint : MethodFingerprint(
customFingerprint = { methodDef ->
methodDef.implementation?.instructions?.any {
it.opcode.ordinal == Opcode.CONST.ordinal &&
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.liveChatButtonId
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.liveChatButtonId
} == true
}
)

View File

@ -13,14 +13,14 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.playerbutton.fingerprints.LiveChatFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.util.integrations.Constants.PLAYER_LAYOUT
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.builder.instruction.BuilderInstruction21c
import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
@Name("hook-player-button-patch")
@DependsOn([SharedResourcdIdPatch::class])
@DependsOn([SharedResourceIdPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class PlayerButtonPatch : BytecodePatch(

View File

@ -1,7 +1,7 @@
package app.revanced.patches.youtube.misc.playercontrols.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
import org.jf.dexlib2.Opcode
@ -14,7 +14,7 @@ object BottomControlsInflateFingerprint : MethodFingerprint(
customFingerprint = { methodDef ->
methodDef.implementation?.instructions?.any {
it.opcode.ordinal == Opcode.CONST.ordinal &&
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.bottomUiContainerResourceId
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.bottomUiContainerResourceId
} == true
}
)

View File

@ -1,7 +1,7 @@
package app.revanced.patches.youtube.misc.playercontrols.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
import org.jf.dexlib2.Opcode
@ -16,7 +16,7 @@ object ControlsLayoutInflateFingerprint : MethodFingerprint(
customFingerprint = { methodDef ->
methodDef.implementation?.instructions?.any {
it.opcode.ordinal == Opcode.CONST.ordinal &&
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.controlsLayoutStubResourceId
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.controlsLayoutStubResourceId
} == true
}
)

View File

@ -14,11 +14,11 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.playercontrols.fingerprints.*
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Name("player-controls-bytecode-patch")
@DependsOn([SharedResourcdIdPatch::class])
@DependsOn([SharedResourceIdPatch::class])
@Description("Manages the code for the player controls of the YouTube player.")
@YouTubeCompatibility
@Version("0.0.1")

View File

@ -14,18 +14,19 @@ import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
@DependsOn([ResourceMappingPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class SharedResourcdIdPatch : ResourcePatch {
class SharedResourceIdPatch : ResourcePatch {
internal companion object {
var accessibilityProgressTimeLabelId: Long = -1
var accountSwitcherAccessibilityLabelId: Long = -1
var appearanceStringId: Long = -1
var backgroundCategoryLabelId: Long = -1
var bottomUiContainerResourceId: Long = -1
var chapterRepeatOnResourceId: Long = -1
var controlsLayoutStubResourceId: Long = -1
var donationCompanionResourceId: Long = -1
var emptycolorLabelId: Long = -1
var emptyColorLabelId: Long = -1
var fabLabelId: Long = -1
var floatybarQueueLabelId: Long = -1
var floatyBarQueueLabelId: Long = -1
var imageOnlyTabId: Long = -1
var imageWithTextTabId: Long = -1
var layoutCircle: Long = -1
@ -35,7 +36,7 @@ class SharedResourcdIdPatch : ResourcePatch {
var scrubbingLabelId: Long = -1
var timeStampsContainerLabelId: Long = -1
var tooltipLabelId: Long = -1
var videoqualityfragmentLabelId: Long = -1
var videoQualityFragmentLabelId: Long = -1
}
override fun execute(context: ResourceContext): PatchResult {
@ -49,11 +50,12 @@ class SharedResourcdIdPatch : ResourcePatch {
appearanceStringId = findSharedResourceId("string", "app_theme_appearance_dark")
backgroundCategoryLabelId = findSharedResourceId("string", "pref_background_and_offline_category")
bottomUiContainerResourceId = findSharedResourceId("id", "bottom_ui_container_stub")
chapterRepeatOnResourceId = findSharedResourceId("string", "chapter_repeat_on")
controlsLayoutStubResourceId = findSharedResourceId("id", "controls_layout_stub")
donationCompanionResourceId = findSharedResourceId("layout", "donation_companion")
emptycolorLabelId = findSharedResourceId("color", "inline_time_bar_colorized_bar_empty_color_dark")
emptyColorLabelId = findSharedResourceId("color", "inline_time_bar_colorized_bar_empty_color_dark")
fabLabelId = findSharedResourceId("id", "fab")
floatybarQueueLabelId = findSharedResourceId("string", "floaty_bar_queue_status")
floatyBarQueueLabelId = findSharedResourceId("string", "floaty_bar_queue_status")
imageOnlyTabId = findSharedResourceId("layout", "image_only_tab")
imageWithTextTabId = findSharedResourceId("layout", "image_with_text_tab")
layoutCircle = findSharedResourceId("layout", "endscreen_element_layout_circle")
@ -63,7 +65,7 @@ class SharedResourcdIdPatch : ResourcePatch {
scrubbingLabelId = findSharedResourceId("dimen", "vertical_touch_offset_to_enter_fine_scrubbing")
timeStampsContainerLabelId = findSharedResourceId("id", "timestamps_container")
tooltipLabelId = findSharedResourceId("layout", "tooltip_content_view")
videoqualityfragmentLabelId = findSharedResourceId("layout", "video_quality_bottom_sheet_list_fragment_title")
videoQualityFragmentLabelId = findSharedResourceId("layout", "video_quality_bottom_sheet_list_fragment_title")
return PatchResultSuccess()
}

View File

@ -1,7 +1,7 @@
package app.revanced.patches.youtube.misc.settings.bytecode.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
import org.jf.dexlib2.Opcode
@ -11,7 +11,7 @@ object ThemeSetterSystemFingerprint : MethodFingerprint(
customFingerprint = { methodDef ->
methodDef.implementation?.instructions?.any {
it.opcode.ordinal == Opcode.CONST.ordinal &&
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.appearanceStringId
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.appearanceStringId
} == true
}
)

View File

@ -14,7 +14,7 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.ThemeSetterSystemFingerprint
import app.revanced.util.bytecode.BytecodeHelper.injectInit
import app.revanced.util.integrations.Constants.INTEGRATIONS_PATH
@ -26,7 +26,7 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction31i
[
IntegrationsPatch::class,
ResourceMappingPatch::class,
SharedResourcdIdPatch::class
SharedResourceIdPatch::class
]
)
@YouTubeCompatibility

View File

@ -12,7 +12,7 @@ import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.options.PatchOptions
import app.revanced.patches.shared.patch.settings.AbstractSettingsResourcePatch
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsBytecodePatch
import app.revanced.util.resources.ResourceHelper.addPreference
import app.revanced.util.resources.ResourceHelper.addReVancedPreference
@ -28,7 +28,7 @@ import org.w3c.dom.Element
[
IntegrationsPatch::class,
PatchOptions::class,
SharedResourcdIdPatch::class,
SharedResourceIdPatch::class,
SettingsBytecodePatch::class
]
)

View File

@ -14,7 +14,7 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.playercontrols.patch.PlayerControlsPatch
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.misc.sponsorblock.bytecode.fingerprints.*
import app.revanced.patches.youtube.misc.timebar.patch.HookTimebarPatch
import app.revanced.patches.youtube.misc.videoid.mainstream.patch.MainstreamVideoIdPatch
@ -34,7 +34,7 @@ import org.jf.dexlib2.iface.reference.MethodReference
MainstreamVideoIdPatch::class,
PlayerControlsPatch::class,
PlayerTypeHookPatch::class,
SharedResourcdIdPatch::class
SharedResourceIdPatch::class
]
)
@YouTubeCompatibility

View File

@ -13,6 +13,7 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
@Name("sponsorblock-secondary-bytecode-patch")
@ -41,20 +42,19 @@ class SponsorBlockSecondaryBytecodePatch : BytecodePatch() {
Opcode.CONST -> {
when ((instruction as Instruction31i).wideLiteral) {
resourceIds[0] -> { // total time
val insertIndex = index + 3
val invokeInstruction = instructions.elementAt(insertIndex)
if (invokeInstruction.opcode != Opcode.IGET_OBJECT) return@forEachIndexed
val targetIndex = index + 2
val targetInstruction = instructions.elementAt(targetIndex)
val targetRegister = (targetInstruction as OneRegisterInstruction).registerA
val mutableMethod = context.proxy(classDef).mutableClass.findMutableMethodOf(method)
mutableMethod.addInstructions(
insertIndex, """
invoke-static {p1}, Lapp/revanced/integrations/sponsorblock/SponsorBlockUtils;->appendTimeWithoutSegments(Ljava/lang/String;)Ljava/lang/String;
move-result-object p1
targetIndex + 1, """
invoke-static {v$targetRegister}, Lapp/revanced/integrations/sponsorblock/SponsorBlockUtils;->appendTimeWithoutSegments(Ljava/lang/String;)Ljava/lang/String;
move-result-object v$targetRegister
"""
)
patchSuccessArray[0] = true;
patchSuccessArray[0] = true
}
resourceIds[1] -> { // player overlay
@ -69,7 +69,7 @@ class SponsorBlockSecondaryBytecodePatch : BytecodePatch() {
"invoke-static {p0}, Lapp/revanced/integrations/sponsorblock/player/ui/SponsorBlockView;->initialize(Ljava/lang/Object;)V"
)
patchSuccessArray[1] = true;
patchSuccessArray[1] = true
}
}
}

View File

@ -1,7 +1,7 @@
package app.revanced.patches.youtube.misc.timebar.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
import org.jf.dexlib2.Opcode
@ -11,7 +11,7 @@ object EmptyColorFingerprint : MethodFingerprint(
customFingerprint = { methodDef ->
methodDef.implementation?.instructions?.any {
it.opcode.ordinal == Opcode.CONST.ordinal &&
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.emptycolorLabelId
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.emptyColorLabelId
} == true
}
)

View File

@ -11,11 +11,11 @@ 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.SharedResourcdIdPatch
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.misc.timebar.fingerprints.*
@Name("hook-timebar-patch")
@DependsOn([SharedResourcdIdPatch::class])
@DependsOn([SharedResourceIdPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class HookTimebarPatch : BytecodePatch(

View File

@ -15,6 +15,5 @@ object MainstreamVideoIdFingerprint : MethodFingerprint(
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT_OBJECT
),
null,
{ it.definingClass.endsWith("SubtitlesOverlayPresenter;") }
customFingerprint = { it.definingClass.endsWith("SubtitlesOverlayPresenter;") }
)