SMAPI - Stardew Modding API

SMAPI - Stardew Modding API

971k Downloads

Detect incompatible mods automatically

Pathoschild opened this issue ยท 1 comments

commented

SMAPI has a manual list of incompatible mods in its StardewModdingAPI.config.json, but maintaining it is tedious and it'll always be incomplete. Detect common reasons for incompatibility before loading a mod (e.g. using obsolete APIs), and mark matching mods incompatible automatically.

commented

Done in the upcoming SMAPI 1.9 release. Mods detected as being incompatible will now show an error like this:

Skipped Better Sprinklers because it's not compatible with the latest version of the game (detected obsolete StardewModdingAPI.Extensions type). Please check for a newer version of the mod (you have v2.2).

This happens after SMAPI checks if the mod is listed as incompatible in StardewModdingAPI.config.json, which has a more user-friendly error:

Skipped Better Sprinklers because it's not compatible with the latest version of the game. Please check for a version newer than 2.2 here: http://www.nexusmods.com/stardewvalley/mods/41

This code shows what SMAPI 1.9 will flag as incompatible:

return new IInstructionFinder[]
{
    // changes in Stardew Valley 1.2 (that don't have rewriters)
    new GenericFieldFinder("StardewValley.Game1", "borderFont", isStatic: true),
    new GenericFieldFinder("StardewValley.Game1", "smoothFont", isStatic: true),
    new GenericFieldFinder("StardewValley.Item", "set_Name", isStatic: false),

    // APIs removed in SMAPI 1.9
    new GenericTypeFinder("StardewModdingAPI.Entities.SPlayer"),
    new GenericTypeFinder("StardewModdingAPI.Extensions"),
    new GenericTypeFinder("StardewModdingAPI.Inheritance.ItemStackChange"),
    new GenericTypeFinder("StardewModdingAPI.Inheritance.SGame"),
    new GenericTypeFinder("StardewModdingAPI.Inheritance.SObject"),
    new GenericTypeFinder("StardewModdingAPI.LogWriter"),
    new GenericTypeFinder("StardewModdingAPI.Manifest"),
    new GenericTypeFinder("StardewModdingAPI.Version"),
    new GenericEventFinder("StardewModdingAPI.Events.GraphicsEvents", "DrawDebug"),
    new GenericEventFinder("StardewModdingAPI.Events.GraphicsEvents", "DrawTick"),
    new GenericEventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPostRenderHudEventNoCheck"),
    new GenericEventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPostRenderGuiEventNoCheck"),
    new GenericEventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPreRenderHudEventNoCheck"),
    new GenericEventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPreRenderGuiEventNoCheck")
};