#include "stdafx.h"
#include "gta_dll.h"

extern void textInject ();
extern void eventsInject ();
extern void menuInject ();
extern void mainInject ();
extern void streamingInject ();
extern void configInject ();
extern void poolsInject ();
extern void engineInject ();

extern void __menuTest ();

bool attachDll () {
	DWORD oldProtect;
	if (!VirtualProtect ((LPVOID)0x401000, 0x456000, PAGE_EXECUTE_READWRITE, &oldProtect)) {
		debug ("Virtual protect failed, exiting...\n");
		return false;
	}

//	*(BYTE *)0x748C71 = 0;

	/*
	*(BYTE *)0x574010 = 0xC2;
	*(BYTE *)0x574011 = 0x04;
	*(BYTE *)0x574012 = 0x00;
	*/

	
	engineInject ();

	textInject ();	// inject CText
	eventsInject (); // inject CInputEvents
	menuInject ();	// inject CMenu
	mainInject ();	// inject all other functions
	streamingInject ();
	configInject ();
	poolsInject ();

	return true;
}