/// <summary>
/// Initializes jZm onto a certain game process. Make sure the game is the correct process, This function doesn't check if the process is correct.
/// </summary>
/// <remarks>
/// DO NOT CALL FROM A PLUGIN. This function is called from the jZm frontend and you should not call it from a plugin.
/// </remarks>
/// <param name="Game">The game process jZm reads/writes to (must be a valid CODBOII zombies process)</param>
public void Bootstrap(Process Game)
{
ZombieAPI._instance = this;
WriteLine("Initializing jZm...");
long start = DateTime.Now.Ticks;
WriteLine("Connecting to game...", true);
this.BaseProcess = Game;
Memory = new RemoteMemory(Game);
// this is to redirect the hooks to jZm (and optionally a buffer together)
//CurrentIPC = new IPC();
//CurrentIPC.InitJZMEventHookingManager(Memory.ProcessHandle);
WriteLine("Recognizing patterns...", true);
PatternRecognition.Run(Memory.ProcessHandle);
WriteLine("Reading entities...", true);
_level = new GameObjects.Level(Game, Addresses.Level, this);
int x = 0;
while (x != 1024)
{
_entities.Add(new GEntity(Memory.Process, Addresses.GEntity + (Addresses.GEntity_Size * x), this));
x++;
}
WriteLine("Reading DVars...", true);
x = 0;
Memory.Position = Addresses.DvarPointers;
while (x != 1024)
{
DVar dvar = new DVar(Game, Memory.ReadInt32(), this);
_dvars.Add(dvar);
x++;
}
WriteLine("Injecting hooks...", true);
HookManager.Init(Memory.ProcessHandle, this);
initPlugins();
DateTime initTime = new DateTime(DateTime.Now.Ticks - start);
new TestingPlugin().Init(this);
WriteLine("Initialized in " + initTime.Second + "." + initTime.Millisecond + " second(s)");
// add infinite event waiter
ThreadPool.QueueUserWorkItem(new WaitCallback(zFrame), Game);
}