From ea1c99b3ee75bebcd98f3c22c4a47803c240ca35 Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Sat, 30 Sep 2023 01:32:50 +0900 Subject: [PATCH] cleanup --- .../music/player/replace/patch/ReplaceCastButtonPatch.kt | 6 ++++-- .../music/utils/videotype/patch/VideoTypeHookPatch.kt | 3 ++- .../oldqualitylayout/patch/OldQualityLayoutPatch.kt | 2 +- .../flyoutpanel/player/patch/PlayerFlyoutPanelPatch.kt | 6 ++++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/music/player/replace/patch/ReplaceCastButtonPatch.kt b/src/main/kotlin/app/revanced/patches/music/player/replace/patch/ReplaceCastButtonPatch.kt index 388e0abc3..57317adde 100644 --- a/src/main/kotlin/app/revanced/patches/music/player/replace/patch/ReplaceCastButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/player/replace/patch/ReplaceCastButtonPatch.kt @@ -56,8 +56,10 @@ class ReplaceCastButtonPatch : BytecodePatch( val freeRegister = getInstruction(freeIndex).registerA val getActivityIndex = freeIndex - 4 - val getActivityRegister = getInstruction(getActivityIndex).registerB - val getActivityReference = getInstruction(getActivityIndex).reference + val getActivityRegister = + getInstruction(getActivityIndex).registerB + val getActivityReference = + getInstruction(getActivityIndex).reference for (index in freeIndex + 20 downTo freeIndex) { if (getInstruction(index).opcode != Opcode.INVOKE_VIRTUAL) diff --git a/src/main/kotlin/app/revanced/patches/music/utils/videotype/patch/VideoTypeHookPatch.kt b/src/main/kotlin/app/revanced/patches/music/utils/videotype/patch/VideoTypeHookPatch.kt index b6901e8e3..187fa6ec1 100644 --- a/src/main/kotlin/app/revanced/patches/music/utils/videotype/patch/VideoTypeHookPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/utils/videotype/patch/VideoTypeHookPatch.kt @@ -26,7 +26,8 @@ class VideoTypeHookPatch : BytecodePatch( }.result?.let { it.mutableMethod.apply { val videoTypeIndex = it.scanResult.patternScanResult!!.endIndex - val videoTypeRegister = getInstruction(videoTypeIndex).registerA + val videoTypeRegister = + getInstruction(videoTypeIndex).registerA addInstructions( videoTypeIndex + 1, """ diff --git a/src/main/kotlin/app/revanced/patches/youtube/flyoutpanel/oldqualitylayout/patch/OldQualityLayoutPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/flyoutpanel/oldqualitylayout/patch/OldQualityLayoutPatch.kt index 7724aa809..c6e894150 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/flyoutpanel/oldqualitylayout/patch/OldQualityLayoutPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/flyoutpanel/oldqualitylayout/patch/OldQualityLayoutPatch.kt @@ -9,8 +9,8 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch -import app.revanced.patches.youtube.utils.fingerprints.QualityMenuViewInflateFingerprint import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.fingerprints.QualityMenuViewInflateFingerprint import app.revanced.patches.youtube.utils.fingerprints.RecyclerViewTreeObserverFingerprint import app.revanced.patches.youtube.utils.litho.patch.LithoFilterPatch import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch diff --git a/src/main/kotlin/app/revanced/patches/youtube/flyoutpanel/player/patch/PlayerFlyoutPanelPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/flyoutpanel/player/patch/PlayerFlyoutPanelPatch.kt index 10c5bc9a3..7d599d5b4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/flyoutpanel/player/patch/PlayerFlyoutPanelPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/flyoutpanel/player/patch/PlayerFlyoutPanelPatch.kt @@ -10,10 +10,10 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch -import app.revanced.patches.youtube.utils.fingerprints.QualityMenuViewInflateFingerprint import app.revanced.patches.youtube.flyoutpanel.player.fingerprints.AdvancedQualityBottomSheetFingerprint import app.revanced.patches.youtube.flyoutpanel.player.fingerprints.CaptionsBottomSheetFingerprint import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility +import app.revanced.patches.youtube.utils.fingerprints.QualityMenuViewInflateFingerprint import app.revanced.patches.youtube.utils.litho.patch.LithoFilterPatch import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.BottomSheetFooterText @@ -67,12 +67,14 @@ class PlayerFlyoutPanelPatch : BytecodePatch( SettingsPatch.updatePatchStatus("hide-player-flyout-panel") } + private companion object { fun MethodFingerprint.injectCall(descriptor: String) { result?.let { it.mutableMethod.apply { val insertIndex = getWideLiteralIndex(BottomSheetFooterText) + 3 - val insertRegister = getInstruction(insertIndex).registerA + val insertRegister = + getInstruction(insertIndex).registerA addInstruction( insertIndex,