SRL Archive - Development

Capturing DirectX and OpenGL windows on Microsoft Windows


Wizzup?

2011-06-05 07:02:00

If you came here for a proof of concept I must disappoint you, but it recently came to my mind I did some investigation on this previously. There are very few applications that can actually reliable capture Direct3D and OpenGL windows directly. (That I know of anyway) One of them is fraps. And it's not open source, but someone did a small case study on it, revealing the way Fraps manages to capture the windows.

http://www.ring3circus.com/gameprogramming/case-study-fraps/

Perhaps at some point we can think of adding such a feature to Simba. :)

I'm not actually sure if this is best way to do it though:

So how does it work?

Well it could be a whole lot worse, but I wasn’t thrilled to find out that every process running on my system had an instance of Fraps.dll loaded.


Regardless, if anyone else has some alternative information to share, post it here. :)

PS: On Linux this should be (is!) no problem, all content is accessible with XGetImage.

Flight

2011-06-05 20:25:38

Just a simple question, but what are some examples of instances of where we'd need Simba to be able to capture a DirectX/OpenGL window?

TomTuff

2011-06-05 22:45:24

From: Flight
Just a simple question, but what are some examples of instances of where we'd need Simba to be able to capture a DirectX/OpenGL window?


Runescape. There have been some idea's posted, and iirc a guy even had something like this for opengl but it was never finished. The idea i read that seemed most useful would be recoloring objects. You could recolor a specific NPC to a certain color, and use normal color finding methods to click it. Or something like that :p

LolL

2011-06-05 23:35:42

IIRC, OpenGL capturing does not require updating unless the models change (which is like never). It might be worth the effort. We could have a reflection/color/OpenGL bot that would pwn all day e'r day.

Wizzup?

2011-06-06 06:56:25

From: Flight
Just a simple question, but what are some examples of instances of where we'd need Simba to be able to capture a DirectX/OpenGL window?


By capturing I am really just talking about reading the image. I'm not talking about any hooks. When? I suppose when you want to target any D3D or OGL application. :)

Floor66

2011-06-06 07:19:52

Didn't we have OGL Interception here a while back? What happened to that?

n3ss3s

2011-06-06 14:47:31

I think the OGL interception project kind of died off for an obvious reason.


The idea i read that seemed most useful would be recoloring objects.


Recoloring objects is silly since most forms of "interception" etc give us actual positions (well, polygons).

By capturing I am really just talking about reading the image. I'm not talking about any hooks. When? I suppose when you want to target any D3D or OGL application.


Well for an application where I needed to find the RuneScape window I just found the window with the suitable title and then iterated through the child windows to the "bottom". Should work for any kind of application.

Gu3st...

2011-06-06 15:22:54

From: n3ss3s
I think the OGL interception project kind of died off for an obvious reason.




Recoloring objects is silly since most forms of "interception" etc give us actual positions (well, polygons).



Well for an application where I needed to find the RuneScape window I just found the window with the suitable title and then iterated through the child windows to the "bottom". Should work for any kind of application.
The guy who talked about recoloring as the idea misunderstood a lot. Just sayin' :)

n3ss3s

2011-06-06 17:08:38

Yes Zyt3x ;)

superuser

2011-06-06 18:00:36

Fraps.dll is injected to all system's processes via system wide CBT-hook. Once the library is injected, it examines the process. After the wanted process is identified, it makes few local function hooks (detours) to capture data/images. The data is sent back to the application via IPC. This is rather simple, as it's no biggie to hook for instance OpenGL's functions inside the given process.

Painting objects in certain color can be achieved by injecting own code to OpenGL's default ones with the technique described above.

Narcle

2011-06-06 19:53:53

Other then using DX/OGL for Runescape it would open it up to many other games. Which would be SWEET.

Flight

2011-06-06 20:12:03

From: Narcle
Other then using DX/OGL for Runescape it would open it up to many other games. Which would be SWEET.


This is more along the lines of my previous question. What games are you referring to, if you don't mind saying?

Dgby714

2011-06-06 21:28:24

From: Flight
This is more along the lines of my previous question. What games are you referring to, if you don't mind saying?


This will allow us to capture most games without protection.

Ex: Lotro, Minecraft, WoW

TomTuff

2011-06-06 21:41:56

From: Dgby714
Minecraft


Why on earth would you want to bot minecraft =\

Dgby714

2011-06-06 22:20:32

From: TomTuff
Why on earth would you want to bot minecraft =\


I didn't say bot, I said capture.

Gu3st...

2011-06-07 02:42:39

From: TomTuff
Why on earth would you want to bot minecraft =\
Builder bot? :p It's cool nevertheless

Dgby714

2011-06-07 02:49:19

From: Zyt3x
Builder bot? :p It's cool nevertheless


Spleef bots =P