From 243dba7751de8c5cee0f3ec2f5e4d8897c7c5e11 Mon Sep 17 00:00:00 2001 From: autergame Date: Fri, 6 May 2022 20:17:10 -0300 Subject: [PATCH 1/2] Replace ReVancedTeam with revanced in build.gradle.kts --- build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index b10681a..192e4c7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ group = "app.revanced" repositories { mavenCentral() maven { - url = uri("https://maven.pkg.github.com/ReVancedTeam/multidexlib2") + url = uri("https://maven.pkg.github.com/revanced/multidexlib2") credentials { // DO NOT set these variables in the project's gradle.properties. // Instead, you should set them in: @@ -52,7 +52,7 @@ publishing { if (isGitHubCI) { maven { name = "GitHubPackages" - url = uri("https://maven.pkg.github.com/ReVancedTeam/revanced-patcher") + url = uri("https://maven.pkg.github.com/revanced/revanced-patcher") credentials { username = System.getenv("GITHUB_ACTOR") password = System.getenv("GITHUB_TOKEN") From 38556d61ab192dfa84083d935ee3e9eee5450d06 Mon Sep 17 00:00:00 2001 From: j4k0xb <55899582+j4k0xb@users.noreply.github.com> Date: Sat, 7 May 2022 02:22:18 +0200 Subject: [PATCH 2/2] feat: add `p` naming scheme to smali compiler --- .../revanced/patcher/smali/InlineSmaliCompiler.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/app/revanced/patcher/smali/InlineSmaliCompiler.kt b/src/main/kotlin/app/revanced/patcher/smali/InlineSmaliCompiler.kt index ed3fe18..f0ac965 100644 --- a/src/main/kotlin/app/revanced/patcher/smali/InlineSmaliCompiler.kt +++ b/src/main/kotlin/app/revanced/patcher/smali/InlineSmaliCompiler.kt @@ -15,8 +15,8 @@ import java.io.InputStreamReader private const val METHOD_TEMPLATE = """ .class public Linlinecompiler; .super Ljava/lang/Object; -.method public static compiler()V - .registers 1 +.method public static compiler(%s)V + .registers %d %s .end method """ @@ -25,14 +25,15 @@ class InlineSmaliCompiler { companion object { /** * Compiles a string of Smali code to a list of instructions. + * p0, p1 etc. will only work correctly if the parameters and registers are passed. * Do not cross the boundaries of the control flow (if-nez insn, etc), * as that will result in exceptions since the labels cannot be calculated. * Do not create dummy labels to fix the issue, since the code addresses will * be messed up and results in broken Dalvik bytecode. * FIXME: Fix the above issue. When this is fixed, add the proper conversions in [InstructionConverter]. */ - fun compileMethodInstructions(instructions: String): List { - val input = METHOD_TEMPLATE.format(instructions) + fun compileMethodInstructions(instructions: String, parameters: String, registers: Int): List { + val input = METHOD_TEMPLATE.format(parameters, registers, instructions) val reader = InputStreamReader(input.byteInputStream()) val lexer: LexerErrorInterface = smaliFlexLexer(reader, 15) val tokens = CommonTokenStream(lexer as TokenSource) @@ -53,5 +54,5 @@ class InlineSmaliCompiler { } } -fun String.toInstructions() = InlineSmaliCompiler.compileMethodInstructions(this) -fun String.toInstruction() = this.toInstructions().first() +fun String.toInstructions(parameters: String = "", registers: Int = 1) = InlineSmaliCompiler.compileMethodInstructions(this, parameters, registers) +fun String.toInstruction(parameters: String = "", registers: Int = 1) = this.toInstructions(parameters, registers).first()