These docs are using a offline/test version of Escape From Tarkov as an example.
This was not developed on the live version of the game.
Used for encrypting strings. Made streamlined with just a single line that needs to be swapped out.
If you intend to encrypt your strings, uncomment and swap the macro with your own!
Used for getting a module's base address.
Swap this out to your custom function for getting a module base.
Used for getting a export fromm a provided module base address.
Swap this out to your custom function for getting a export in a module.
We need the domain to attach thread, get base images etc. This is how we get it.
If you have ATTACH_THREAD_AUTOMATICALLY, it will attach the thread upon calling this function.
auto Domain = Mono_Domain::GetRootDomain();
Attaches you to the mono thread to safely call mono functions without issues.
Domain->AttachThread();
Opening a module for us to use.
auto AssemblyCSharp_Assembly = Domain->OpenAssembly("Assembly-CSharp"); //Adding .dll is not needed
Gets the image base of the module that we just opened.
auto AssemblyCSharp = AssemblyCSharp_Assembly->GetImage();
Getting a class for us to use
auto GameWorldClass = AssemblyCSharp->GetClassFromName("EFT", "GameWorld");
Getting the method object, this is NOT a callable address, it's an object.
auto GameWorldUpdate_Uncompiled = GameWorldClass->GetMethod("Update", -1);
This will compile the method. After compiling, it will be a callable address. If a method is already JIT compiled (from either the game or yourself) it won't be compiled anymore.
auto GameWorldUpdate = GameWorldUpdate_Uncompiled->CompileMethod<void(*)(uint64_t GameWorld>()
You can also do...
auto GameWorldUpdate = GameWorldClass->GetCompiledMethod<void(*)(uint64_t GameWorld)>("Update", -1);