chore: migrate to new changes from the patcher
This commit is contained in:
-4
@@ -4,16 +4,12 @@ import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
||||
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.layout.tabletminiplayer.annotations.TabletMiniPlayerCompatibility
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@Name("mini-player-dimensions-calculator-fingerprint")
|
||||
@MatchingMethod(
|
||||
"Lkkr;", "pM"
|
||||
)
|
||||
@FuzzyPatternScanMethod(2) // TODO: Find a good threshold value
|
||||
@TabletMiniPlayerCompatibility
|
||||
@Version("0.0.1")
|
||||
|
||||
-4
@@ -3,16 +3,12 @@ package app.revanced.patches.youtube.layout.tabletminiplayer.fingerprints
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.layout.tabletminiplayer.annotations.TabletMiniPlayerCompatibility
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@Name("mini-player-override-fingerprint")
|
||||
@MatchingMethod(
|
||||
"Lkkr;", "j"
|
||||
)
|
||||
@TabletMiniPlayerCompatibility
|
||||
@Version("0.0.1")
|
||||
object MiniPlayerOverrideFingerprint : MethodFingerprint(
|
||||
|
||||
-4
@@ -3,16 +3,12 @@ package app.revanced.patches.youtube.layout.tabletminiplayer.fingerprints
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.layout.tabletminiplayer.annotations.TabletMiniPlayerCompatibility
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@Name("mini-player-override-no-context-fingerprint")
|
||||
@MatchingMethod(
|
||||
"Lkkr;", "k"
|
||||
)
|
||||
@TabletMiniPlayerCompatibility
|
||||
@Version("0.0.1")
|
||||
object MiniPlayerOverrideNoContextFingerprint : MethodFingerprint(
|
||||
|
||||
-4
@@ -3,16 +3,12 @@ package app.revanced.patches.youtube.layout.tabletminiplayer.fingerprints
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.layout.tabletminiplayer.annotations.TabletMiniPlayerCompatibility
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@Name("mini-player-response-model-size-check-fingerprint")
|
||||
@MatchingMethod(
|
||||
"Lenv;", "a"
|
||||
)
|
||||
@TabletMiniPlayerCompatibility
|
||||
@Version("0.0.1")
|
||||
object MiniPlayerResponseModelSizeCheckFingerprint : MethodFingerprint(
|
||||
|
||||
+14
-12
@@ -3,15 +3,15 @@ package app.revanced.patches.youtube.layout.tabletminiplayer.patch
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.impl.BytecodeData
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
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.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.youtube.layout.tabletminiplayer.annotations.TabletMiniPlayerCompatibility
|
||||
import app.revanced.patches.youtube.layout.tabletminiplayer.fingerprints.MiniPlayerDimensionsCalculatorFingerprint
|
||||
@@ -36,14 +36,16 @@ class TabletMiniPlayerPatch : BytecodePatch(
|
||||
MiniPlayerResponseModelSizeCheckFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(SwitchPreference(
|
||||
"revanced_tablet_miniplayer",
|
||||
StringResource("revanced_tablet_miniplayer_title", "Enable the tablet Mini-player"),
|
||||
false,
|
||||
StringResource("revanced_tablet_miniplayer_summary_on", "Tablet Mini-player is enabled"),
|
||||
StringResource("revanced_tablet_miniplayer_summary_off", "Tablet Mini-player is disabled")
|
||||
))
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_tablet_miniplayer",
|
||||
StringResource("revanced_tablet_miniplayer_title", "Enable the tablet Mini-player"),
|
||||
false,
|
||||
StringResource("revanced_tablet_miniplayer_summary_on", "Tablet Mini-player is enabled"),
|
||||
StringResource("revanced_tablet_miniplayer_summary_off", "Tablet Mini-player is disabled")
|
||||
)
|
||||
)
|
||||
|
||||
// first resolve the fingerprints via the parent fingerprint
|
||||
val miniPlayerClass = MiniPlayerDimensionsCalculatorFingerprint.result!!.classDef
|
||||
@@ -51,7 +53,7 @@ class TabletMiniPlayerPatch : BytecodePatch(
|
||||
/*
|
||||
* no context parameter method
|
||||
*/
|
||||
MiniPlayerOverrideNoContextFingerprint.resolve(data, miniPlayerClass)
|
||||
MiniPlayerOverrideNoContextFingerprint.resolve(context, miniPlayerClass)
|
||||
val (method, _, parameterRegister) = MiniPlayerOverrideNoContextFingerprint.addProxyCall()
|
||||
// - 1 means to insert before the return instruction
|
||||
val secondInsertIndex = method.implementation!!.instructions.size - 1
|
||||
@@ -60,7 +62,7 @@ class TabletMiniPlayerPatch : BytecodePatch(
|
||||
/*
|
||||
* method with context parameter
|
||||
*/
|
||||
MiniPlayerOverrideFingerprint.resolve(data, miniPlayerClass)
|
||||
MiniPlayerOverrideFingerprint.resolve(context, miniPlayerClass)
|
||||
val (_, _, _) = MiniPlayerOverrideFingerprint.addProxyCall()
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user