diff --git a/src/main/kotlin/net/revanced/patcher/Patcher.kt b/src/main/kotlin/net/revanced/patcher/Patcher.kt index ae0fe86..c4a8579 100644 --- a/src/main/kotlin/net/revanced/patcher/Patcher.kt +++ b/src/main/kotlin/net/revanced/patcher/Patcher.kt @@ -1,4 +1,25 @@ package net.revanced.patcher +import net.revanced.patcher.sigscan.Sig +import net.revanced.patcher.sigscan.SigScanner +import org.jf.dexlib2.Opcode +import java.io.File +import java.lang.reflect.Modifier + class Patcher { -} \ No newline at end of file + companion object { + /** + * Invokes the patcher on the given input file. + * + * @param input the input file + * @param output the output file + */ + fun invoke(input: File, output: File) { + SigScanner(Sig( + arrayOf(Opcode.ADD_INT), + Modifier.PUBLIC or Modifier.STATIC, + String.Companion::class + )).scan(emptyArray()) + } + } +} diff --git a/src/main/kotlin/net/revanced/patcher/sigscan/Sig.kt b/src/main/kotlin/net/revanced/patcher/sigscan/Sig.kt new file mode 100644 index 0000000..3d570e8 --- /dev/null +++ b/src/main/kotlin/net/revanced/patcher/sigscan/Sig.kt @@ -0,0 +1,30 @@ +package net.revanced.patcher.sigscan + +import org.jf.dexlib2.Opcode +import kotlin.reflect.KClass + +data class Sig( + val opcodes: Array, + val attributes: Int, + val returnType: KClass<*> +) { + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (javaClass != other?.javaClass) return false + + other as Sig + + if (!opcodes.contentEquals(other.opcodes)) return false + if (attributes != other.attributes) return false + if (returnType != other.returnType) return false + + return true + } + + override fun hashCode(): Int { + var result = opcodes.contentHashCode() + result = 31 * result + attributes.hashCode() + result = 31 * result + returnType.hashCode() + return result + } +} diff --git a/src/main/kotlin/net/revanced/patcher/sigscan/SigScanner.kt b/src/main/kotlin/net/revanced/patcher/sigscan/SigScanner.kt new file mode 100644 index 0000000..505c361 --- /dev/null +++ b/src/main/kotlin/net/revanced/patcher/sigscan/SigScanner.kt @@ -0,0 +1,9 @@ +package net.revanced.patcher.sigscan + +import org.jf.dexlib2.iface.ClassDef + +class SigScanner (sig: Sig) { + fun scan(classes: Array) { + + } +} \ No newline at end of file