CELLO_Dev-OldModCompat icon

OldModCompat

Lets mods built before v80 load on v80/v81. Forwards DunGen types and rewrites calls to changed game methods (KillPlayer, DisplayMenuNotification and more) in old mod DLLs.

Last updated 2 hours ago
Total downloads 27
Total rating 0 
Categories AI Generated BepInEx Mods Libraries Misc
Dependency string CELLO_Dev-OldModCompat-1.0.0
Dependants 0 other packages depend on this package

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2305 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2305

README

OldModCompat

A BepInEx preloader patcher that lets Lethal Company mods built before v80 load on v80 and v81.

What it fixes

  • DunGen moved out of Assembly-CSharp. In v80, DunGen's types moved into DunGen.dll. Older mods still look for them in Assembly-CSharp and fail with TypeLoadException. On every launch, LegacyCompat adds type forwarders in memory that point those lookups at DunGen.dll.
  • Game methods whose signatures changed in v80. LegacyCompat rewrites calls in old mod DLLs to use the new signatures, filling any added parameters with their default values:
    • MenuManager.DisplayMenuNotification
    • PlayerControllerB.KillPlayer
    • PlayerControllerB.HasLineOfSightToPosition
    • PlayerControllerB.DropAllHeldItemsServerRpc → DropAllHeldItemsAndSyncNonexact
    • the SpawnableEnemyWithRarity constructor
  • HUDManager.loadingDarkenScreen was removed in v80. LegacyCompat drops code that sets loadingDarkenScreen.enabled (used by LethalCasino's roulette).

Tested on v81 with:

  • IntegrityChaos-Diversity 3.1.0
  • mrgrm7-LethalCasino 1.1.3
  • Magic_Wesley-WesleysInteriors and Wesleys_Shenanigans
  • Zehs-WesleysInteriorsAddon
  • loaforc-loaforcsSoundAPI_LethalCompany

How it works

  • At startup, it scans BepInEx/plugins. Only DLLs that still call one of the changed members are rewritten, once, on disk. Mods that are already up to date are not touched.
  • If your mod manager reinstalls or updates a mod, LegacyCompat fixes it again on the next launch.
  • The game itself never gets old-signature overloads. Adding an extra KillPlayer, for example, would break every mod that looks the method up by name with AmbiguousMatchException.
  • If one DLL can't be written (it's locked or read-only, for example), LegacyCompat logs an error and keeps fixing the others.

Your log will show lines like these:

[Info   :LegacyCompat] Forwarded 134 DunGen types
[Info   :LegacyCompat] Rewrote 15 old call(s), 0 removed-field use(s) in Diversity Remastered.dll

Multiplayer

Every player in the lobby who runs the old mods needs LegacyCompat installed.

Uninstalling

Uninstall LegacyCompat, then reinstall the mods it rewrote. The rewritten DLLs stay changed until those mods are reinstalled.

Limitations

LegacyCompat only fixes the changes listed above. A mod that depends on any other behavior that changed or was removed in v80 will still break.

This is an unofficial compatibility patch. It isn't affiliated with the authors of the mods it fixes.