tl;dr - I have no intention of rewriting AtraCore for Android 1.5.6. For technical reasons, it's very hard to do right.
Hi! With the recent release of SMAPI 3.18.3 on mobile, I've been getting an influx of queries about porting AtraCore to mobile. Unfortunately, for technical reasons, it's very hard to do this correctly.
Stardew on PC runs off a framework known as Net 5.0. On mobile, it runs off Xamarin, which is close to but not quite the same as Net 5.0, and quite a number of small details are not the same. Methods I expect to exist don't, some methods have slightly different behavior, and on and on. In order to properly port AtraCore to Android, I would need to set up an android development environment and carefully check over every line of code.
One of the bigger differences is how enumerators for dictionaries work. For Net 5.0, for example, I can remove entries or edit them while enumerating. This is an runtime error on Xamarin. Unfortunately, I do this quite often, since it's significantly more efficient to do so. So, for Android, I would have to hunt down every usage and hope I didn't miss anything, or you'd get a runtime crash.
That's just the start of it, though, there's plenty of little-used methods I rely on that may have issues. (I vaguely recall the BitOperations class not being available? IReadOnlySet is gone, and I use that one heavily too. Stuff like that. Edit: so is MethodInfo.CreateDelegate<> and System.Runtime.InteropServices.) While it would be technically possible to dig out every missing API somehow, it'd be (a) a lot of work and (b) would result in slower code, which isn't great since phones tend to be less powerful.
Luckily for us, this particular issue is likely to go away in the next version of Stardew, which uses Net 6.0, and the Xamarin NET 6.0 should be much closer and have less weird differences.
Next, we come up to the fact that the Android codebase seems to be wildly different from the PC codebase, and some code added specifically for mods seems to be gone. For example, the PC version runs a custom version of Monogame that has special code for audio; this seems entirely missing from the Android version. The PC version uses emitted code for xml serialization, the Android version doesn't. Some types were changed (and it feels somewhat arbitrary as to why?). I also attach listeners to various bit of net code, and the networking code looks very different.
See also, from Pathos: https://github.com/ZaneYork/SMAPI-Android-Installer/issues/302#issuecomment-1509423634
0 comments