ZaneYork / SMAPI-Android-Installer

SMAPI Installer for Android
GNU Lesser General Public License v3.0
672 stars 58 forks source link

Mods don't work #302

Open FanKud opened 1 year ago

FanKud commented 1 year ago

Mods like json assets, saat, sve don't work.

Screenshot_2023-04-04-15-00-26-072_com zane stardewvalley Screenshot_2023-04-04-14-57-49-225_com zane stardewvalley

RakanIV commented 1 year ago

Don't expect too much it's in alpha release.

You can't play the major expansions for now. spacecore and json assets don't work and content patcher ignoring a lot of mods.

EiKQr commented 1 year ago

the same here fails a lot content patcher and texture packs the vast majority of textures do not load, we can only wait for future updates

XR-GAMES-REAL commented 1 year ago

It's that (SAAT) mode isn't compatible yet but i tried other modes and they worked fine like better ranching. We just have to wait for zaneyork to fix it. And please be patient.

Pathoschild commented 1 year ago

Make sure you upload your full SMAPI log and post the link here when reporting a mod which doesn't work. It has more info than the console (like why the mod isn't compatible).


If you're curious, here's how to see the technical reason in the log:

expand for steps 1. On the uploaded log's page, enable 'TRACE' messages: > ![screenshot of log filters with 'TRACE' enabled](https://user-images.githubusercontent.com/230581/230116756-8ab0b4e2-b5c7-4b55-8065-888b7cd1d465.png) 2. Under "Loading mods..." in the log text, check the faded-out text for the broken mod. > ![screenshot of logs loading NPC Map Locations](https://user-images.githubusercontent.com/230581/230118568-e186eb76-4468-44b1-b68d-451287f30811.png)
Shockah commented 1 year ago

This isn't mine log, but it does include the SAAT error: https://smapi.io/log/f78e698820da437686ff439780966078

RakanIV commented 1 year ago

https://smapi.io/log/ec05ee82977c46619ff79cbfbe0e01d2

yorboi commented 1 year ago

NPC map location mod doesn't work as well, here's the log: smapi log

LilimVipera commented 1 year ago

I tested Content Patch without any other mods, here the log: https://smapi.io/log/45dc0ff386454b5795c88cec8643c323 Hopefully it's helpful

Btw, I also tried Generic Mod Configuration Menu. You see the cog button on start, but can't click it. Inside the game, you can enter the settings, but scrollbars don't work, as well as scrolling in general. Checkboxes work, as well as saving changes

Pathoschild commented 1 year ago

Since logs will expire after a few weeks, here's a summary of the logged errors so far:

Common errors

Collection was modified

Collection was modified; enumeration operation may not execute.

In .NET 5.0, you can edit a dictionary's values (but not keys) while enumerating it. Some PC mods do that to avoid copying the collection (which is expensive) or creating a separate list of edits (which is clunky). Unfortunately it seems Xamarin still has the old behavior. That might be tricky for SMAPI to rewrite; modders might need to avoid that optimization (at least when running on Android).

Reference to {some facade} (no such method)

Broken code in CJBCheatsMenu.dll: reference to StardewModdingAPI.Framework.ModLoading.RewriteFacades.OptionsElementMethods.draw (no such method).

SMAPI automatically rewrites mods for compatibility with the current OS (e.g. Android), and 'rewrite facades' are one of the ways it does that. We probably just need to add the missing methods to SMAPI's rewrite facades.

Invalid IL code

InvalidProgramException: Invalid IL code in Pathoschild.Stardew.Common.CommonHelper:GetLocations (bool): IL_0000: callvirt 0x0a000063

SMAPI's rewriters may be producing broken code somehow, or .NET 5.0 code may need to be rewritten for Xamarin compatibility.

For many mods, this happens when they reference Game1.locations, even if it's just assigned to a variable:

// works fine
IList<GameLocation> gameLocations = new List<GameLocation>();
this.CustomLocationManager.Apply(SaveGame.loaded?.locations, gameLocations);

// fails
IList<GameLocation> gameLocations = Game1.locations;
this.CustomLocationManager.Apply(SaveGame.loaded?.locations, gameLocations);

That field is IList<GameLocation> on Windows but List<GameLocation> on Android. So adding a rewriter to change Game1.location references from IList to List might fix a lot of the still-broken mods, including Content Patcher.

Reported mods

Automate 1.28.3 (partly broken)

MissingMethodException: Method not found: string[] System.Enum.GetNames<!0>()

Could probably be fixed with a rewrite facade in SMAPI?

InvalidProgramException: Invalid IL code in Pathoschild.Stardew.Common.CommonHelper:GetLocations (bool): IL_0000: callvirt 0x0a00003f

See common errors.

CJB Cheats Menu 1.33.0

Broken code in CJBCheatsMenu.dll: reference to StardewModdingAPI.Framework.ModLoading.RewriteFacades.OptionsElementMethods.draw (no such method), reference to StardewModdingAPI.Framework.ModLoading.RewriteFacades.OptionsElementMethods..ctor (no matching constructor).

See common errors.

Content Patcher 1.29.1 (partly broken)

Collection was modified; enumeration operation may not execute.

See common errors.

InvalidProgramException: Invalid IL code in ContentPatcher.Framework.ScreenManager:OnLoadStageChanged (StardewModdingAPI.Enums.LoadStage,StardewModdingAPI.Enums.LoadStage): IL_0026: callvirt 0x06000910

InvalidProgramException: Invalid IL code in Pathoschild.Stardew.Common.CommonHelper:GetLocations (bool): IL_0000: callvirt 0x0a000063

See common errors.

Custom Companions 3.0.0 (partly broken)

InvalidProgramException: Invalid IL code in CustomCompanions.CustomCompanions:OnDayStarted (object,System.EventArgs): IL_0012: callvirt 0x0a00003a

See common errors.

Dynamic Reflections 1.4.0 (partly broken)

BadImageFormatException: Image with invalid assemblyref token 0000000b. File name: 'DynamicReflections'

Possibly related to the .NET 5.0 → Xamarin rewrites?

Farm Type Manager 1.16.0 (partly broken)

InvalidProgramException: Invalid IL code in FarmTypeManager.ModEntry/Utility:GetAllLocationsFromName (string): IL_0048: callvirt 0x0a000209

See common errors.

Greenhouse Sprinklers 2.1.1 (partly broken)

Collection was modified; enumeration operation may not execute.

See common errors.

InvalidProgramException: Invalid IL code in ContentPatcher.Framework.ScreenManager:OnLoadStageChanged (StardewModdingAPI.Enums.LoadStage,StardewModdingAPI.Enums.LoadStage): IL_0026: callvirt 0x06000910

InvalidProgramException: Invalid IL code in Pathoschild.Stardew.Common.CommonHelper:GetLocations (bool): IL_0000: callvirt 0x0a000063

See common errors.

More Grass 1.1.7

InvalidOperationException: Operation not called on UI thread. at Microsoft.Xna.Framework.Threading.EnsureUIThread () [0x00007] in <e20f96084554426fb05eaf55b19e7962>:0 at Microsoft.Xna.Framework.Graphics.Texture2D.PlatformGetData[T] (System.Int32 level, System.Int32 arraySlice, Microsoft.Xna.Framework.Rectangle rect, T[] data, System.Int32 startIndex, System.Int32 elementCount) [0x00000] in <e20f96084554426fb05eaf55b19e7962>:0 at Microsoft.Xna.Framework.Graphics.Texture2D.GetData[T] (System.Int32 level, System.Int32 arraySlice, System.Nullable`1[T] rect, T[] data, System.Int32 startIndex, System.Int32 elementCount) [0x00011] in <e20f96084554426fb05eaf55b19e7962>:0 at Microsoft.Xna.Framework.Graphics.Texture2D.GetData[T] (System.Int32 level, System.Nullable`1[T] rect, T[] data, System.Int32 startIndex, System.Int32 elementCount) [0x00000] in <e20f96084554426fb05eaf55b19e7962>:0 at MoreGrass.ModEntry.LoadDefaultGrass (Microsoft.Xna.Framework.Graphics.Texture2D grassTexture) [0x00189] in <90ddcc547fc64835b43bc4ff305b97f7>:0 at MoreGrass.ModEntry.Entry (StardewModdingAPI.IModHelper helper) [0x0006b] in <90ddcc547fc64835b43bc4ff305b97f7>:0 at StardewModdingAPI.Framework.SCore.LoadMods (StardewModdingAPI.Framework.IModMetadata[] mods, StardewModdingAPI.Toolkit.Serialization.JsonHelper jsonHelper, StardewModdingAPI.Framework.ContentCoordinator contentCore, StardewModdingAPI.Toolkit.Framework.ModData.ModDatabase modDatabase) [0x0045b] in <fc71efeda14b42148ec0e2d645008c20>:0

???

NPC Map Locations 2.11.3

Broken code in NPCMapLocations.dll: reference to StardewModdingAPI.Framework.ModLoading.RewriteFacades.OptionsElementMethods.draw (no such method), reference to StardewModdingAPI.Framework.ModLoading.RewriteFacades.OptionsElementMethods..ctor (no matching constructor).

See common errors.

PyTK 1.23.2 (doesn't load)

Skipped [...] because its DLL couldn't be loaded. (Error: Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'System.Diagnostics.Debug, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00074] in <ee112d265aad4e098cf6cf7bf2806b0e>:0 at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00007] in <ee112d265aad4e098cf6cf7bf2806b0e>:0 at ...

I guess System.Diagnostics.Debug doesn't work on Android, or possibly SMAPI isn't rewriting it correctly?

SAAT.API 1.1.2 (doesn't load)

Broken code in SAAT.API.dll: reference to StardewModdingAPI.Framework.ModLoading.RewriteFacades.ISoundBankMethods.GetCueDefinition (no such method), reference to StardewValley.ISoundBank.AddCue (no such method).

See common errors.

Stardew Notification 1.8.7 (partly broken)

InvalidProgramException: Invalid IL code in StardewNotification.GeneralNotification:CheckForSpringOnions (StardewModdingAPI.ITranslationHelper): IL_0001: callvirt 0x0a000019

This seems like SMAPI's rewriters producing broken code somehow.

TMXL Map Toolkit 1.24.1 (doesn't load)

Same error as PyTK.

Tractor Mod 4.16.4 (partly broken)

InvalidProgramException: Invalid IL code in Pathoschild.Stardew.TractorMod.ModEntry/<GetLocations>d__37:MoveNext (): IL_0047: callvirt 0x0a00003c

See common errors.

sipudadek commented 1 year ago

please help my mod keep showing this error https://smapi.io/log/248b41207c114560ac46265ab9ec50bf

Pathoschild commented 1 year ago

I looked into the Content Patcher errors with an affected user.

The "invalid IL code" error happens when a mod references Game1.locations, even if it's just assigned to a variable:

// works fine
IList<GameLocation> gameLocations = new List<GameLocation>();
this.CustomLocationManager.Apply(SaveGame.loaded?.locations, gameLocations);

// fails
IList<GameLocation> gameLocations = Game1.locations;
this.CustomLocationManager.Apply(SaveGame.loaded?.locations, gameLocations);

That field is IList<GameLocation> on Windows but List<GameLocation> on Android. So adding a rewriter to change Game1.location references from IList to List might fix a lot of the still-broken mods, including Content Patcher.