Jump to content
  • Advertisement
Sign in to follow this  
zzz822163

OpenGL how to steal texture from directdraw application?

This topic is 3655 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Write a proxy ddraw.dll file that intercepts all DirectDraw calls, then passes them off to the real ddraw.dll.
Or hook an application as it starts up.

Nitpick: There's no such thing as a texture in a DirectDraw application, just surfaces. A texture is a collection of surfaces, and only exists in D3D.

Share this post


Link to post
Share on other sites
Quote:
Original post by zzz822163
thanks Evil Steve .
do as you tell me ,i can capture screen.
but can i get the image resource?
Well, you'll be able to accept all calls to DDraw, so when you get a surface unlock call you can just read the contents of the surface.

However, remember that there's about 5 different DirectDraw versions; you'll need to support all of them if you want your DLL to work for all apps that use DirectDraw.

Share this post


Link to post
Share on other sites
to Evil Steve
read the contents of the surface after surface unlock call,i can get screen,
but i cannot get the image resource.
i want to get the bitmap the application load.

Share this post


Link to post
Share on other sites
Quote:
Original post by zzz822163
i want to get the bitmap the application load.
Short answer: You can't.
Long answer: How do you know it's a bitmap that the application is loading and not a code-generated resource, or some other file format?
Assuming it is actually an image in a file of some sort, the code will load the file, decompress / decrypt it, then create a DirectDraw surface and copy the bits in. That means that there doesn't have to be a source file for the image.

Share this post


Link to post
Share on other sites
This sort of code is very low level, and you will have no knowledge of where the image came from. It could come from a local file, over the web or be noise generated from a microphone.

If you're wanting to intercept calls to DirectDraw and work it back to which bitmap the game/application originally loaded the data from you're out of luck.

However, if you're wanting to save the data to a disk so that you can load it up in a graphics program you follow Steve's advice and simply write the data to a file yourself. The bitmap format is easy enough to follow and documented in numerous places online. Try wotsit.org.


hth
Jack

EDIT: Too slow!

Share this post


Link to post
Share on other sites
Quote:
Original post by zzz822163
I am appreciated for your Enthusiastic help .
In fact,i want to replace the picture in the game.
Is this an impossible mission?
If you want to replace it, then you don't need to know where it came from. When the application locks the surface and puts data into it, you can just put your own data in. The application presumably creates the resources in the same order each time it runs, and if it doesn't you can always check the bit data going in to see if it's the one you want to replace.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!