|
|
@ -17,6 +17,7 @@ import jakarta.inject.Inject |
|
|
|
import jakarta.inject.Singleton |
|
|
|
import jakarta.inject.Singleton |
|
|
|
import net.fornwall.jelf.ElfFile |
|
|
|
import net.fornwall.jelf.ElfFile |
|
|
|
import net.fornwall.jelf.ElfSymbol |
|
|
|
import net.fornwall.jelf.ElfSymbol |
|
|
|
|
|
|
|
import org.objectweb.asm.Opcodes |
|
|
|
import org.objectweb.asm.tree.ClassNode |
|
|
|
import org.objectweb.asm.tree.ClassNode |
|
|
|
import org.objectweb.asm.tree.LdcInsnNode |
|
|
|
import org.objectweb.asm.tree.LdcInsnNode |
|
|
|
import org.objectweb.asm.tree.MethodInsnNode |
|
|
|
import org.objectweb.asm.tree.MethodInsnNode |
|
|
@ -597,20 +598,21 @@ public class ClientImporter @Inject constructor( |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (match in NEW_ENGINE_VERSION_MATCHER.match(method)) { |
|
|
|
var betweenNewAndReturn = false |
|
|
|
val new = match[0] as TypeInsnNode |
|
|
|
|
|
|
|
if (new.desc != "client") { |
|
|
|
|
|
|
|
continue |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val candidates = mutableListOf<Int>() |
|
|
|
val candidates = mutableListOf<Int>() |
|
|
|
|
|
|
|
|
|
|
|
for (insn in match) { |
|
|
|
for (insn in method.instructions) { |
|
|
|
|
|
|
|
if (insn is TypeInsnNode && insn.desc == "client") { |
|
|
|
|
|
|
|
betweenNewAndReturn = true |
|
|
|
|
|
|
|
} else if (insn.opcode == Opcodes.RETURN) { |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
} else if (betweenNewAndReturn) { |
|
|
|
val candidate = insn.intConstant |
|
|
|
val candidate = insn.intConstant |
|
|
|
if (candidate != null && candidate in NEW_ENGINE_BUILDS) { |
|
|
|
if (candidate != null && candidate in NEW_ENGINE_BUILDS) { |
|
|
|
candidates += candidate |
|
|
|
candidates += candidate |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
candidates -= NEW_ENGINE_RESOLUTIONS |
|
|
|
candidates -= NEW_ENGINE_RESOLUTIONS |
|
|
|
|
|
|
|
|
|
|
@ -619,7 +621,6 @@ public class ClientImporter @Inject constructor( |
|
|
|
return CacheExporter.Build(version, null) |
|
|
|
return CacheExporter.Build(version, null) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null |
|
|
|
return null |
|
|
|
} |
|
|
|
} |
|
|
@ -722,7 +723,6 @@ public class ClientImporter @Inject constructor( |
|
|
|
private val OLD_ENGINE_VERSION_MATCHER = |
|
|
|
private val OLD_ENGINE_VERSION_MATCHER = |
|
|
|
InsnMatcher.compile("LDC INVOKESPECIAL (ICONST | BIPUSH | SIPUSH | LDC)") |
|
|
|
InsnMatcher.compile("LDC INVOKESPECIAL (ICONST | BIPUSH | SIPUSH | LDC)") |
|
|
|
|
|
|
|
|
|
|
|
private val NEW_ENGINE_VERSION_MATCHER = InsnMatcher.compile("NEW .*? RETURN") |
|
|
|
|
|
|
|
private val NEW_ENGINE_RESOLUTIONS = listOf(765, 503, 1024, 768) |
|
|
|
private val NEW_ENGINE_RESOLUTIONS = listOf(765, 503, 1024, 768) |
|
|
|
private val NEW_ENGINE_BUILDS = 402..916 |
|
|
|
private val NEW_ENGINE_BUILDS = 402..916 |
|
|
|
|
|
|
|
|
|
|
|