refactor: remove all parameter names

also fixed some warnings.
This commit is contained in:
Lucaskyy
2022-04-14 18:45:34 +02:00
parent f55d917db4
commit 8034fee8ea
8 changed files with 177 additions and 168 deletions

View File

@ -17,27 +17,27 @@ import org.jf.dexlib2.Opcode
private val compatiblePackages = listOf("com.google.android.youtube")
class CreateButtonRemoverPatch : Patch(
metadata = PatchMetadata(
PatchMetadata(
"create-button",
"Create button patch",
"Disable the create button.",
compatiblePackages,
"1.0.0"
),
signatures = listOf(
listOf(
MethodSignature(
methodSignatureMetadata = MethodSignatureMetadata(
name = "create-button-method",
methodMetadata = MethodMetadata(null, null), // unknown
patternScanMethod = PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages = compatiblePackages,
description = "Signature for the method required to be patched.",
version = "0.0.1"
MethodSignatureMetadata(
"create-button-method",
MethodMetadata(null, null), // unknown
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages,
"Signature for the method required to be patched.",
"0.0.1"
),
returnType = "V",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
methodParameters = listOf("Z"),
opcodes = listOf(
"V",
AccessFlags.PUBLIC or AccessFlags.FINAL,
listOf("Z"),
listOf(
Opcode.IGET,
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT,

View File

@ -17,26 +17,26 @@ import org.jf.dexlib2.Opcode
private val compatiblePackages = listOf("com.google.android.youtube")
class HideReelsPatch : Patch(
metadata = PatchMetadata(
PatchMetadata(
"hide-reels",
"Hide reels patch",
"Hide reels on the page.",
compatiblePackages,
"1.0.0"
),
signatures = listOf(
listOf(
MethodSignature(
methodSignatureMetadata = MethodSignatureMetadata(
name = "hide-reels-signature",
methodMetadata = MethodMetadata(null, null), // unknown
patternScanMethod = PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages = compatiblePackages,
description = "Signature for the method required to be patched.",
version = "0.0.1"
MethodSignatureMetadata(
"hide-reels-signature",
MethodMetadata(null, null), // unknown
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages,
"Signature for the method required to be patched.",
"0.0.1"
),
returnType = "V",
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
methodParameters = listOf(
"V",
AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
listOf(
"L",
"L",
"L",
@ -55,7 +55,7 @@ class HideReelsPatch : Patch(
"[B",
"[B"
),
opcodes = listOf(
listOf(
Opcode.MOVE_OBJECT,
Opcode.MOVE_OBJECT,
Opcode.INVOKE_DIRECT,

View File

@ -2,7 +2,10 @@ package app.revanced.patches.layout
import app.revanced.patcher.PatcherData
import app.revanced.patcher.extensions.or
import app.revanced.patcher.patch.*
import app.revanced.patcher.patch.Patch
import app.revanced.patcher.patch.PatchMetadata
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.signature.MethodMetadata
import app.revanced.patcher.signature.MethodSignature
import app.revanced.patcher.signature.MethodSignatureMetadata
@ -13,27 +16,27 @@ import org.jf.dexlib2.Opcode
private val compatiblePackages = listOf("com.google.android.youtube")
class HideSuggestionsPatch : Patch(
metadata = PatchMetadata(
PatchMetadata(
"hide-suggestions",
"Hide suggestions patch",
"Hide suggested videos.",
compatiblePackages,
"1.0.0"
),
signatures = listOf(
listOf(
MethodSignature(
methodSignatureMetadata = MethodSignatureMetadata(
name = "hide-suggestions-parent-method",
methodMetadata = MethodMetadata(null, null), // unknown
patternScanMethod = PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages = compatiblePackages,
description = "Signature for a parent method, which is needed to find the actual method required to be patched.",
version = "0.0.1"
MethodSignatureMetadata(
"hide-suggestions-parent-method",
MethodMetadata(null, null), // unknown
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages,
"Signature for a parent method, which is needed to find the actual method required to be patched.",
"0.0.1"
),
returnType = "V",
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
methodParameters = listOf("L", "Z"),
opcodes = listOf(
"V",
AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
listOf("L", "Z"),
listOf(
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST,
@ -67,16 +70,16 @@ class HideSuggestionsPatch : Patch(
/*
val result = signatures.first().result!!.findParentMethod(
MethodSignature(
methodSignatureMetadata = MethodSignatureMetadata(
name = "hide-suggestions-method",
methodMetadata = MethodMetadata(null, null), // unknown
patternScanMethod = PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages = compatiblePackages,
description = "Signature for the method, which is required to be patched.",
version = "0.0.1"
MethodSignatureMetadata(
"hide-suggestions-method",
MethodMetadata(null, null), // unknown
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages,
"Signature for the method, which is required to be patched.",
"0.0.1"
),
returnType = "V",
accessFlags = AccessFlags.FINAL or AccessFlags.PUBLIC,
"V",
AccessFlags.FINAL or AccessFlags.PUBLIC,
listOf("Z"),
listOf(
Opcode.IPUT_BOOLEAN,

View File

@ -1,9 +1,12 @@
package app.revanced.patches.layout
import app.revanced.patcher.PatcherData
import app.revanced.patcher.extensions.or
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.*
import app.revanced.patcher.extensions.or
import app.revanced.patcher.patch.Patch
import app.revanced.patcher.patch.PatchMetadata
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.signature.MethodMetadata
import app.revanced.patcher.signature.MethodSignature
import app.revanced.patcher.signature.MethodSignatureMetadata
@ -15,27 +18,27 @@ import org.jf.dexlib2.Opcode
private val compatiblePackages = listOf("com.google.android.youtube")
class MinimizedPlaybackPatch : Patch(
metadata = PatchMetadata(
PatchMetadata(
"minimized-playback",
"Minimized Playback Patch",
"Enable minimized and background playback.",
compatiblePackages,
"1.0.0"
),
signatures = listOf(
listOf(
MethodSignature(
methodSignatureMetadata = MethodSignatureMetadata(
name = "minimized-playback-manager",
methodMetadata = MethodMetadata(null, null), // unknown
patternScanMethod = PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages = compatiblePackages,
description = "Signature for the method required to be patched.",
version = "0.0.1"
MethodSignatureMetadata(
"minimized-playback-manager",
MethodMetadata(null, null), // unknown
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages,
"Signature for the method required to be patched.",
"0.0.1"
),
returnType = "Z",
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
methodParameters = listOf("L"),
opcodes = listOf(
"Z",
AccessFlags.PUBLIC or AccessFlags.STATIC,
listOf("L"),
listOf(
Opcode.CONST_4,
Opcode.IF_EQZ,
Opcode.IGET,

View File

@ -1,8 +1,8 @@
package app.revanced.patches.layout
import app.revanced.patcher.PatcherData
import app.revanced.patcher.extensions.or
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.or
import app.revanced.patcher.patch.*
import app.revanced.patcher.signature.MethodMetadata
import app.revanced.patcher.signature.MethodSignature
@ -16,27 +16,27 @@ import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
private val compatiblePackages = listOf("com.google.android.youtube")
class OldQualityLayoutPatch : Patch(
metadata = PatchMetadata(
PatchMetadata(
"old-quality-layout",
"Old Quality Layout Patch",
"Enable the original quality flyout menu",
compatiblePackages,
"1.0.0"
),
signatures = listOf(
listOf(
MethodSignature(
methodSignatureMetadata = MethodSignatureMetadata(
name = "old-quality-parent-method-signature",
methodMetadata = MethodMetadata(null, null), // unknown
patternScanMethod = PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages = compatiblePackages,
description = "Signature to find a parent method required by the Old Quality Layout patch.",
version = "0.0.1"
MethodSignatureMetadata(
"old-quality-parent-method-signature",
MethodMetadata(null, null), // unknown
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages,
"Signature to find a parent method required by the Old Quality Layout patch.",
"0.0.1"
),
returnType = "V",
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
methodParameters = listOf("L", "L", "L", "L", "L", "L", "L"),
opcodes = listOf(
"V",
AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
listOf("L", "L", "L", "L", "L", "L", "L"),
listOf(
Opcode.IPUT_OBJECT,
Opcode.CONST,
Opcode.CONST,
@ -72,20 +72,20 @@ class OldQualityLayoutPatch : Patch(
)
) {
override fun execute(patcherData: PatcherData): PatchResult {
var result = signatures.first().result!!
val result = signatures.first().result!!
result = result.findParentMethod(
result.findParentMethod(
MethodSignature(
methodSignatureMetadata = MethodSignatureMetadata(
name = "old-quality-method-signature",
methodMetadata = MethodMetadata(null, null), // unknown
patternScanMethod = PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages = compatiblePackages,
description = "Signature to find the method required by the Old Quality Layout patch",
version = "0.0.1"
MethodSignatureMetadata(
"old-quality-method-signature",
MethodMetadata(null, null), // unknown
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages,
"Signature to find the method required by the Old Quality Layout patch",
"0.0.1"
),
returnType = "L",
accessFlags = AccessFlags.FINAL or AccessFlags.PUBLIC,
"L",
AccessFlags.FINAL or AccessFlags.PUBLIC,
emptyList(),
listOf(
Opcode.IGET,