SMAPI - Stardew Modding API

SMAPI - Stardew Modding API

971k Downloads

Load any mod on any platform

Pathoschild opened this issue · 6 comments

commented

SMAPI should support all mods on all platform (Linux/Mac/Windows), regardless of which platform the mods were compiled on. (Use Mono.Cecil to dynamically adjust the assemblies to use the correct dependencies.)

To do

  • Preprocess all mod assemblies through Cecil.
  • Cache preprocessed assemblies in Mods/.cache.
  • Invalidate cache when assembly's MD5 hash changes.
  • Rewrite mod assemblies to change references.
  • Rewrite mod assemblies to address API changes between XNA and MonoGame.
commented

See prototype implementation in Farmhand, with permission to backport into SMAPI.

commented

Making some progress on this. SMAPI 1.3 now rewrites mod assemblies using Mono.Cecil to convert types between MonoGame and XNA as needed by the current platform.

  • SMAPI 1.3 on Windows should now support most Linux/Mac mods. There are a few edge cases where method signatures are inconsistent between MonoGame and XNA (mainly SpriteBatch::Begin), but few mods will be affected by this. I'll look into the edge cases more once I've figured out the next point.
  • SMAPI 1.3 on Linux/Mac supports a few Windows mods. Most mods fail with variations of this error:
    image
    I haven't figured out why that happens yet, but I suspect it's the last big blocker for supporting most mods.
commented

SMAPI 1.3 now runs most mods on Linux/Mac and Windows, regardless of their original platform. Some mods are affected by API differences between the two (e.g. SpriteBatch.Begin has a different method signature), which will need to be rewritten too.

commented

Done and merged into the develop branch; pending alpha testing before release.

commented

Known mod issues:

mod issue found via status
Better Sprinklers JSON parse error on Linux/Mac testing ✓fixed in 2.0-EntoPatch5
FarmAutomation.ItemCollector config stored in .cache directory
(reported for official and unofficial version)
forums ✘ open
Loved Labels hardcoded path separator testing ✘ open
commented

This was released with SMAPI 1.3 and seems to be working pretty well. We can open new issues for further improvements as needed.