quilt-loader icon indicating copy to clipboard operation
quilt-loader copied to clipboard

Chasm support

Open CheaterCodes opened this issue 3 years ago • 0 comments

Introduction

One of the goals of The Quilt Project is to eventually replace Mixin and Accesswidener with Chasm. While this is likely still some ways off, I'm opening this issue to keep track of what needs to be done in order to achieve this.

Knot Launcher

First, let me summarize the current behaviour of Knot:

  1. Scan the class path for a GameProvider using the ServiceLoader
  2. Create a ClassLoader
  3. Initialize the GameProvider (discover the game jar)
  4. Find mod candidates
  5. Resolve mod set
  6. Add mods to class path
  7. Load AccessWideners
  8. Bootstrap mixin
  9. Add game and libs to classpath
  10. Invoke pre-launch entrypoints
  11. Launch game

Quilt Launcher

This works fine, but since note that the classpath gets created before mixin bootstrap, but completed after it. For Chasm this means that there never is an easy place have access to the entire classpath while also having the ability to easily transform it and cache results. Because of this, I propose a cleanup and reimplementation of Knot, i.e. create a new QuiltLauncher:

  1. Use the ServiceLoader to discover a GameProvider
  2. Initialize the game provider
  3. Find mod candidates (including built-in mods)
  4. Resolve mods (including plugins)
  5. Apply Chasm
  6. Create a ClassLoader
  7. Invoke pre-launch entry points
  8. Launch game

Legacy Transformations

With Chasm, Mixin will have to work differently. While it would be nice to still apply Sponge-Mixin and AccessWideners besides Chasm to allow for a transition period, this is against the design principle of Chasm. Therefore, legacy bytecode transformers will have to be transformed to Chasm transformers at launch. This will probably be done via a built-in compatibility plugin. This plugin would have to consume a mod jar and generate a new one, replacing legacy mixins with transformer files.

Timeline

As mentioned before, this would have to happen after loader plugins. Additionally, since running Mixin and Chasm side-by-side is probably not feasible, this will require Chasm to be production ready. Even further, Chasm-Mixin and Chasm-AccessWidener would also need to be functional. Integration into build-tools would not be necessary, but preferred.

CheaterCodes avatar Jun 15 '22 10:06 CheaterCodes