Exemplo n.º 1
0
/*
 * Description :	Function called when the DLL in injected in League of Legends.exe process.
 * 					It installs LCAPI into LoL process, find game structures and store them
 *					into a LoLProcess structure.
 */
void startInjection (void)
{
	LoLProcess *LoL;
	srand (time(NULL));

	// Install LoLServerAPI inside League of Legends.exe process
	if ((LoL = LoLProcess_new ()) == NULL) {
		warn ("Injection failed.");
		return;
	}

	// Create CheatEngine file (optional)
	LoLProcess_exportToCE (LoL);

	// Instanciate and listen to a connection
	if ((connection = LoLServerAPI_new ()) == NULL) {
		warn ("API server connection error.");
		return;
	}

	// Answer to requests
	LoLServerAPI_main (connection);

	// Clean and exit
	dbg ("ServerAPI cleaning memory...");
	LoLProcess_free (LoL);
	LoLServerAPI_free (connection);
	dbg ("ServerAPI stopped working normally.");
}
Exemplo n.º 2
0
/*
 * Description 	: Allocate a new LoLProcess structure.
 * Return		: A pointer to an allocated LoLProcess.
 */
LoLProcess *
LoLProcess_new (void)
{
	LoLProcess *this;

	if ((this = calloc (1, sizeof(LoLProcess))) == NULL) {
		return NULL;
	}

	if (!LoLProcess_init (this)) {
		warning ("Initialization failed.");
		LoLProcess_free (this);
		return NULL;
	}

	// Initialization successful :
	// Bind the current LoLProcess to the LoLServerAPI instance
	set_LoLProcess (this);
	LoLProcess_setState (this, STATE_TESTING);

	// Unit testing
	if (!LoLProcess_test (this)) {
		error ("LoLProcess unit test failed.");
		log_chat_message ("<font color=\"#ff3333\">LoLClientAPI failed to start.</font>", -1);
		LoLProcess_setState (this, STATE_ERROR);
		return NULL;
	}
	else {
		dbg ("[OK] LoLProcess test success.");
	}

	LoLProcess_setState (this, STATE_READY);

	// Send a ready message to the chat log
	log_chat_message ("<font color=\"#33ff33\">LoLClientAPI is ready.</font>", -1);

	return this;
}