HelpC# Direct3D9 EndScene Hook Rendering

Posts 1–8 of 8 · Page 1 of 1
C# Direct3D9 EndScene Hook Rendering
Hey,

I'm trying to draw text on the screen of a direct3d9 game using an EndScene() hook!

I've set it up and I can log debug messages in my hook but drawing something simply doesn't work.

Code:
public int EndSceneHook(IntPtr Direct3dDevice)
{
    using (Device device = Device.FromPointer(Direct3dDevice))
    {
        try
        {
            Font text = new Font(device, font);
            text.DrawString(null, "HELLO", 100, 100, (Color4) 0xFFFF00);
            text.Dispose();
        }
        catch(Exception e)
        {
            MessageBox.Show("Exception " + e.Message);
        }

        return device.EndScene().Code;
    }
}
I'm probably just stupid but I would appreciate it if you could tell me what I am doing wrong
Thank you
Wrong section.
And try not to dispose the font
Quote Originally Posted by user590177 View Post
Wrong section.
Oh right, sorry
Quote Originally Posted by user590177 View Post
Have you tried to check the pointer?
How should I do that? Also, how would I get the device otherwise? I'm really bad at this...
Quote Originally Posted by prodigy64 View Post
How should I do that? Also, how would I get the device otherwise? I'm really bad at this...
You pretty much read it when the game calls CreateDevice(). So declare a pointer which points to the memory on which the device is assigned. (Reverse Engineer it to find the pointer)
Once done remove the parameter from your hooked EndScene() and simply use the declared pointer above to make use of the device.
Quote Originally Posted by user590177 View Post


You pretty much read it when the game calls CreateDevice(). So declare a pointer which points to the memory on which the device is assigned. (Reverse Engineer it to find the pointer)
Once done remove the parameter from your hooked EndScene() and simply use the declared pointer above to make use of the device.
Must You Capitalize Every Word You Type?
Quote Originally Posted by Hitokiri~ View Post

Must You Capitalize Every Word You Type?
It's a CS thing. Every word is being capitalized by the system once I post my reply. Pretty annoying thing ikr
Posts 1–8 of 8 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us