Image Drawing libraries in C++
#3

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:

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);
}
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..
Reply


Messages In This Thread
Image Drawing libraries in C++ - by SlashPT - 26.12.2011, 01:07
Re: Image Drawing libraries in C++ - by FarSe. - 26.12.2011, 05:34
Re: Image Drawing libraries in C++ - by SlashPT - 26.12.2011, 10:27
Re: Image Drawing libraries in C++ - by Tony_Montana - 26.12.2011, 18:23
Re: Image Drawing libraries in C++ - by SlashPT - 26.12.2011, 18:30
Re: Image Drawing libraries in C++ - by StreetGT - 26.12.2011, 19:09
Re: Image Drawing libraries in C++ - by SlashPT - 26.12.2011, 19:17
Re: Image Drawing libraries in C++ - by Tony_Montana - 26.12.2011, 20:31
Re: Image Drawing libraries in C++ - by SlashPT - 26.12.2011, 20:36

Forum Jump:


Users browsing this thread: 3 Guest(s)