26.12.2011, 10:27
(
Last edited by SlashPT; 26/12/2011 at 10:59 AM.
)
Well yeah that's my problem with the Direct3D lib, I don't really know if I actually need to inject my code onto the d3d9.dll, does it has special functions or something? I gotta search that better :3
Edit:
While browsing around on GTA Forums I found this:
As you can see he hooks there everything without a problem , the thing is that it is made to render 2D objects, not sure how it is supposed to be done..
Edit:
While browsing around on GTA Forums I found this:
pawn Code:
typedef void (*Render2dStuffPtr)();
// Pointer to Render2dStuff function
Render2dStuffPtr fpRender2dStuff = (Render2dStuffPtr)0x0053E230;
// This function will be called by SA after hook is installed
void MyDrawFunction()
{
// first draw SA's 2d stuff
fpRender2dStuff();
// draw own stuff here using d3d device or SA functions
}
// This function should typically be called in DllMain
void SetupMyDrawFunctionHook()
{
DWORD oldProtect;
DWORD *workAddress = (DWORD *)0x0053EB13; // Pointer to the call to Render2dStuff
// change protection/permissions to allow modification to instructions
VirtualProtect(workAddress, 4, PAGE_READWRITE, &oldProtect);
// modify instruction with a pointer to our draw function
*workAddress = (DWORD)&MyDrawFunction - (DWORD)(workAddress + 1);
// restore original protection/permissions to allow code to be executed again
VirtualProtect(workAddress, 4, oldProtect, NULL);
}