Jump to content

Question: static "main" method; bootup function


Recommended Posts

Maybe this is explained somewhere, but I couldn't find it. What is the entry point for a static single run main method. Like in any program. I would like to do stuff on bootup. For example, the harmony wiki page says something about manual patching: https://github.com/pardeike/Harmony/wiki/Bootstrapping

But where do you put that stuff? Thanks for any help.

Link to comment
Share on other sites

We don't have that - instead all methods marked with [HarmonyPatch] are executed by the game calling PatchAll(). 

 

For one-time stuff on boot we now have the game looking for a public void OnLoad() (can be static) method. - can be in any class.

Link to comment
Share on other sites

Oh, okay. I think that answers my question. Just need to define any class with OnLoad(). Is there also a OnUnload()? Not that I need it, just wondering.

Also, about the PatchAll(), who calls this? Should I call it? PatchAll(Assembly.GetExecutingAssembly()) sounds like it takes everything in my assembly to process. So, I just put PatchAll in my OnLoad method?

Sorry if these are rookie questions. I not used to this :) And thanks for your help.

Link to comment
Share on other sites

No, the game code does PatchAll() which executes all methods that you annotate with [HarmonyPatch]

 

There is no Unload. For specifics and other methods check out the method LoadDLLs() in the game's mod manager

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...