Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load any mod on any platform #166

Closed
5 tasks done
Pathoschild opened this issue Nov 7, 2016 · 6 comments
Closed
5 tasks done

Load any mod on any platform #166

Pathoschild opened this issue Nov 7, 2016 · 6 comments
Assignees
Labels
enhancement This is a general improvement that can be addressed with specific development changes.
Milestone

Comments

@Pathoschild
Copy link
Owner

Pathoschild commented Nov 7, 2016

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.
@Pathoschild Pathoschild added the enhancement This is a general improvement that can be addressed with specific development changes. label Nov 7, 2016
@Pathoschild Pathoschild added this to the 1.1 milestone Nov 7, 2016
@Pathoschild
Copy link
Owner Author

Pathoschild commented Nov 7, 2016

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

@Pathoschild
Copy link
Owner Author

Pathoschild commented Nov 27, 2016

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.

@Pathoschild
Copy link
Owner Author

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.

@Pathoschild
Copy link
Owner Author

Pathoschild commented Nov 30, 2016

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

Pathoschild added a commit that referenced this issue Dec 1, 2016
Pathoschild added a commit that referenced this issue Dec 1, 2016
This didn't work on Linux or Mac, caused assembly resolution problems when rewritten mods referenced Json.NET, complicated debugging, and wasn't really needed since players use the installer to cleanly add or remove SMAPI.
@Pathoschild
Copy link
Owner Author

Pathoschild commented Dec 1, 2016

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

@Pathoschild
Copy link
Owner Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is a general improvement that can be addressed with specific development changes.
Projects
None yet
Development

No branches or pull requests

1 participant