Skip to content

Commit

Permalink
Fixed class dump for missing dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
SpartanB312 committed Jul 8, 2024
1 parent 50c1850 commit 2e86ccb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ object Configs {
val mixinPackages by setting("MixinPackage", listOf("net/spartanb312/client/mixins/"))
val generateRemap by setting("DumpMappings", true)
val remapOutput by setting("MappingsOutput", "mappings.json")
val parallel by setting("ParallelProcessing", false)
val useComputeMax by setting("UseComputeMax", false)
val customDictionary by setting("CustomDictionary", listOf())
val dictionaryStartIndex by setting("DictionaryStartIndex", 0)
val corruptOutput by setting("CorruptOutput", false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,16 @@ class ResourceCache(private val input: String, private val libs: List<String>) {
Logger.info("Writing classes...")
for (classNode in classes.values) {
if (classNode.name == "module-info" || classNode.name.shouldRemove) continue
val classInfo = hierarchy.getClassInfo(classNode)
val useComputeMax = Configs.Settings.useComputeMax || classInfo.missingDependencies || classNode.isExcluded
val byteArray = try {
ClassDumper(this@ResourceCache, hierarchy, false).apply {
ClassDumper(this@ResourceCache, hierarchy, useComputeMax).apply {
classNode.accept(this)
}.toByteArray()
} catch (ignore: Exception) {
Logger.error("Failed to dump class ${classNode.name}. Force use COMPUTE_MAXS")
Logger.error("Failed to dump class ${classNode.name}. Trying ${if (useComputeMax) "COMPUTE_FRAMES" else "COMPUTE_MAXS"}")
try {
ClassDumper(this@ResourceCache, hierarchy, true).apply {
ClassDumper(this@ResourceCache, hierarchy, !useComputeMax).apply {
classNode.accept(this)
}.toByteArray()
} catch (exception: Exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import kotlin.random.Random
object InvokeDynamicTransformer : Transformer("InvokeDynamic", Category.Redirect) {

private val rate by setting("ReplacePercentage", 10)
private val massiveRandom by setting("MassiveRandomBlank", true)
private val massiveRandom by setting("MassiveRandomBlank", false)
private val exclusion by setting("Exclusion", listOf())

override fun ResourceCache.transform() {
Expand Down

0 comments on commit 2e86ccb

Please sign in to comment.