remove dead code

This commit is contained in:
inotia00 2023-04-09 07:32:07 +09:00
parent ee9e69e328
commit 3c16f3eb55
4 changed files with 2 additions and 41 deletions

View File

@ -1,18 +0,0 @@
package app.revanced.patches.youtube.layout.flyoutpanel.oldqualitylayout.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
object VideoQualitySettingsFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("[L", "I", "Z"),
opcodes = listOf(
Opcode.IF_EQZ,
Opcode.IF_EQ,
Opcode.IF_EQ
),
strings = listOf("menu_item_video_quality")
)

View File

@ -6,7 +6,6 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
@ -14,7 +13,7 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.flyoutpanel.oldqualitylayout.fingerprints.*
import app.revanced.patches.youtube.layout.flyoutpanel.oldqualitylayout.fingerprints.QualityMenuViewInflateFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.patches.youtube.misc.videoid.legacy.patch.LegacyVideoIdPatch
@ -35,8 +34,7 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Version("0.0.1")
class OldQualityLayoutPatch : BytecodePatch(
listOf(
QualityMenuViewInflateFingerprint,
VideoQualitySettingsFingerprint
QualityMenuViewInflateFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
@ -52,19 +50,6 @@ class OldQualityLayoutPatch : BytecodePatch(
}
} ?: return QualityMenuViewInflateFingerprint.toErrorResult()
VideoQualitySettingsFingerprint.result?.let {
with (it.mutableMethod) {
val insertIndex = it.scanResult.patternScanResult!!.startIndex + LegacyVideoIdPatch.qualityOffSet
val register = (this.implementation!!.instructions[insertIndex] as OneRegisterInstruction).registerA
addInstructions(
insertIndex, """
invoke-static { v$register }, $FLYOUT_PANEL->enableOldQualityLayout(I)I
move-result v$register
"""
)
}
} ?: return VideoQualitySettingsFingerprint.toErrorResult()
/*
* Add settings
*/

View File

@ -41,8 +41,6 @@ class LegacyVideoIdPatch : BytecodePatch(
companion object {
private var offset = 2
internal var qualityOffSet: Int = 0
private var insertIndex: Int = 0
private var videoIdRegister: Int = 0
private lateinit var insertMethod: MutableMethod

View File

@ -6,7 +6,6 @@ import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.removeInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
@ -52,7 +51,6 @@ class VideoQualityBytecodePatch : BytecodePatch(
relayFieldReference = (it.implementation!!.instructions.elementAt(0) as ReferenceInstruction).reference as FieldReference
} ?: return VideoQualitySettingsFingerprint.toErrorResult()
parentResult.mutableMethod.removeInstruction(parentResult.scanResult.patternScanResult!!.endIndex)
parentResult.mutableMethod.addInstructions(
0, """
iget-object v0, p0, ${parentResult.classDef.type}->${relayFieldReference.name}:${relayFieldReference.type}
@ -62,8 +60,6 @@ class VideoQualityBytecodePatch : BytecodePatch(
move-result p2
"""
)
LegacyVideoIdPatch.qualityOffSet = 4
} ?: return VideoQualitySettingsParentFingerprint.toErrorResult()
LegacyVideoIdPatch.injectCall("$INTEGRATIONS_VIDEO_QUALITY_CLASS_DESCRIPTOR->newVideoStarted(Ljava/lang/String;)V")