Kasuromi / GTFO-API

GNU General Public License v3.0
9 stars 7 forks source link

Implement unload when rundown id is not 1 #6

Closed Dexusan closed 3 years ago

Dexusan commented 3 years ago

D0c requested that we use rundown id 1 when playing modded content, either automatically adjust this for clients or unload if the id is not 1.

using BepInEx;
using BepInEx.IL2CPP;
using Globals;

[BepInPlugin("GUID","NAME","0.0.0")]
class Plugin : BasePlugin
{
   public override void Load()
   {
      if (Global.RundownIdToLoad != 1) base.Unload();
   }
}
Kasuromi commented 3 years ago

Unloading a plugin when it comes to the Il2CppChainloader does nothing except return false.

The assembly is still in the app domain so static APIs that don't require classes to be injected into Il2Cpp will still work.

A potential fix for this will be to make BepInEx load plugins in a separate AppDomain so full assembly unloading is possible.

Kasuromi commented 3 years ago

Resolved by #7