ArchipelagoMW-HollowKnight / Archipelago.HollowKnight

Hollow Knight mod enabling Archipelago multiworld interoperability.
MIT License
6 stars 10 forks source link

See if we can just use MAPI's NewtonSoft #151

Closed BadMagic100 closed 1 year ago

BadMagic100 commented 1 year ago

Currently we're duplicating Newtonsoft.json. A bit odd. See if we can link against the MAPI one and remove this

Ijwu commented 1 year ago

Could the duplicate newtonsoft be due to Multiclient? That's where I imagine it's coming from. It may not be an easy option to switch that out unless you perform custom assembly resolution.

BadMagic100 commented 1 year ago

I mean, yes, the duplicate newtonsoft is coming via multiclient. However, end of the day the build script is choosing to export it with the zip for publication. Since these are all dynamically linked anyway we can potentially just... Not include it. The only requirement is that you need to know where it is at compile time, and that it needs to be somewhere loaded at runtime

We do actually have some very fancy assembly resolution happening in MAPI but I'm not sure that it's even relevant to this case

Ijwu commented 1 year ago

The newtonsoft that ships with multiclient is compiled with specific flags to disable reflection.emit stuff, so the (older at the time) unity runtime would be okay with it. I assume since MAPI is using newtonsoft successfully, it does not have similar issues. It should be okay to redirect assembly bindings, I know some HK mods have done that before.

My POV is that I was assuming there would be some form of strong binding due to the differing compilation outcomes, but if it works dynamically then, yeah, a drop and replace would probably work.