Overlays

I’ve spent some time lately looking into the various approaches of
displaying overlays in games. If you’ve ever played an online game on Steam,
you know that you can bring up this in-game screen which displays
information about your Steam friends, chatting, and so on. Simple reverse
engineering showed that most products, like Steam, simply inject into the
game process and hook the graphics API. Once the game has finished rendering
a frame, the injected overlay renders its own graphics before passing on
control to Direct3D or OpenGL.

Other products (http://www.gameoverlay.com) inject into all running
processes that have created windows and ‘bitblt’ them into a Direct3D- or
OpenGL-enabled application.

One rather “interesting” approach taken by PLAYXPERT
(http://www.playxpert.com/) is to make use of several kernel mode drivers to
avoid hooking into the game process at all to avoid triggering any
anti-cheat software. I say “interesting” because I personally think this is
the wrong approach - you should stay away from kernel mode if you can really
do it all in user mode. I’d rather have the game crash than bluescreen my
computer or having it introduce security holes in kernel mode.

Still, I’m curious as to what the possibilities are for supporting overlays
the way PLAYXPERT does it. They install keyboard and mouse filter drivers to
pass on input to their application, even when the game uses DirectInput.
They also use some kind of video driver, but that’s where I get a bit fuzzy
on what’s going on and here’s where I look to you, my knowledgeable friends
at NTDEV.

What are the options for rendering your own overlay graphics on top of
whatever is going out on the graphics card? For instance, DirectDraw used to
support overlay surfaces and the display adapter would create a composite of
the primary surface (the actual output) and the overlay on the monitor:

http://msdn.microsoft.com/en-us/library/aa916217.aspx

DirectDraw is long gone, so I’m wondering what the possibilities are these
days.

If you were implementing an overlay, what approach would you take?

Have a great weekend!

/ Soren

>DirectDraw is long gone

Still here as a very base of D3D, WPF, desktop composition and so on.

The APIs are the same, just the documentation moved to D3D one, and the name “DirectDraw” disappeared.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

Even so, I don’t think it allows you to create the same kind of hardware
overlays that DirectDraw allowed you to, or am I wrong?

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: 17. januar 2009 01:59
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Overlays

DirectDraw is long gone

Still here as a very base of D3D, WPF, desktop composition and so on.

The APIs are the same, just the documentation moved to D3D one, and the name
“DirectDraw” disappeared.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Video Mixer Renderer component of DirectShow uses DDraw overlays for years.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

“Soren Dreijer” wrote in message news:xxxxx@ntdev…
> Even so, I don’t think it allows you to create the same kind of hardware
> overlays that DirectDraw allowed you to, or am I wrong?
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
> Sent: 17. januar 2009 01:59
> To: Windows System Software Devs Interest List
> Subject: Re:[ntdev] Overlays
>
>>DirectDraw is long gone
>
> Still here as a very base of D3D, WPF, desktop composition and so on.
>
> The APIs are the same, just the documentation moved to D3D one, and the name
> “DirectDraw” disappeared.
>
> –
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>

Yeah, I was looking at that before posting but I was unclear whether this
only related to actual video output or if you could use it with any
graphical output (such as a fullscreen Direct3D or OpenGL game).

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: 17. januar 2009 13:35
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Overlays

Video Mixer Renderer component of DirectShow uses DDraw overlays for
years.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

“Soren Dreijer” wrote in message news:xxxxx@ntdev…
> Even so, I don’t think it allows you to create the same kind of hardware
> overlays that DirectDraw allowed you to, or am I wrong?
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
> Sent: 17. januar 2009 01:59
> To: Windows System Software Devs Interest List
> Subject: Re:[ntdev] Overlays
>
>>DirectDraw is long gone
>
> Still here as a very base of D3D, WPF, desktop composition and so on.
>
> The APIs are the same, just the documentation moved to D3D one, and the
name
> “DirectDraw” disappeared.
>
> –
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Try using WinCE documentation on DDraw, I expect it to be OK for usual Windows.

I cannot understand why MS declared these working APIs deprecated for usual Windows, but not for WinCE. Looks like some bureaucratic stupidity.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

“Soren Dreijer” wrote in message news:xxxxx@ntdev…
> Yeah, I was looking at that before posting but I was unclear whether this
> only related to actual video output or if you could use it with any
> graphical output (such as a fullscreen Direct3D or OpenGL game).
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
> Sent: 17. januar 2009 13:35
> To: Windows System Software Devs Interest List
> Subject: Re:[ntdev] Overlays
>
> Video Mixer Renderer component of DirectShow uses DDraw overlays for
> years.
>
> –
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
> “Soren Dreijer” wrote in message news:xxxxx@ntdev…
>> Even so, I don’t think it allows you to create the same kind of hardware
>> overlays that DirectDraw allowed you to, or am I wrong?
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
>> Sent: 17. januar 2009 01:59
>> To: Windows System Software Devs Interest List
>> Subject: Re:[ntdev] Overlays
>>
>>>DirectDraw is long gone
>>
>> Still here as a very base of D3D, WPF, desktop composition and so on.
>>
>> The APIs are the same, just the documentation moved to D3D one, and the
> name
>> “DirectDraw” disappeared.
>>
>> –
>> Maxim S. Shatskih
>> Windows DDK MVP
>> xxxxx@storagecraft.com
>> http://www.storagecraft.com
>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>

I think the downside about hardware overlays is that most graphics cards
only support one (if they even support it). At least that’s what the
articles I’ve read so far on this topic have said. Granted, a lot of these
articles are dated because DirectDraw isn’t officially supported anymore
unless you’re working for mobile devices. That’s why I turned to see what
else is out there, and so far DirectShow has shown not to be applicable to
what I want to do.

If DirectDraw isn’t the way to go either, then what other kernel-mode
alternatives are there? Some sort of display filter driver?

/ Soren

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: 18. januar 2009 13:47
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Overlays

Try using WinCE documentation on DDraw, I expect it to be OK for usual
Windows.

I cannot understand why MS declared these working APIs deprecated for
usual Windows, but not for WinCE. Looks like some bureaucratic stupidity.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

“Soren Dreijer” wrote in message news:xxxxx@ntdev…
> Yeah, I was looking at that before posting but I was unclear whether this
> only related to actual video output or if you could use it with any
> graphical output (such as a fullscreen Direct3D or OpenGL game).
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
> Sent: 17. januar 2009 13:35
> To: Windows System Software Devs Interest List
> Subject: Re:[ntdev] Overlays
>
> Video Mixer Renderer component of DirectShow uses DDraw overlays for
> years.
>
> –
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
> “Soren Dreijer” wrote in message
news:xxxxx@ntdev…
>> Even so, I don’t think it allows you to create the same kind of hardware
>> overlays that DirectDraw allowed you to, or am I wrong?
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
>> Sent: 17. januar 2009 01:59
>> To: Windows System Software Devs Interest List
>> Subject: Re:[ntdev] Overlays
>>
>>>DirectDraw is long gone
>>
>> Still here as a very base of D3D, WPF, desktop composition and so on.
>>
>> The APIs are the same, just the documentation moved to D3D one, and the
> name
>> “DirectDraw” disappeared.
>>
>> –
>> Maxim S. Shatskih
>> Windows DDK MVP
>> xxxxx@storagecraft.com
>> http://www.storagecraft.com
>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Maxim S. Shatskih wrote:

Video Mixer Renderer component of DirectShow uses DDraw overlays for years.

VMR7 does (from DirectX 7), but it’s deprecated, and you’re not allowed
to redistribute it. VMR9 (from DirectX 9), which is used by default on
Vista, draws the video into a Direct3D texture.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Soren Dreijer wrote:

I think the downside about hardware overlays is that most graphics cards
only support one (if they even support it). At least that’s what the
articles I’ve read so far on this topic have said.

That’s not true. Most of the graphics cards build in the 21st Century
have 2 or 4 overlays; a few have more.

Granted, a lot of these
articles are dated because DirectDraw isn’t officially supported anymore
unless you’re working for mobile devices. That’s why I turned to see what
else is out there, and so far DirectShow has shown not to be applicable to
what I want to do.

If DirectDraw isn’t the way to go either, then what other kernel-mode
alternatives are there? Some sort of display filter driver?

The “blessed” alternative is, of course, Direct3D. Create your windows
and videos in D3D textures, then composite them on the screen. That is
exactly what the Aero Glass interface does on Vista, which is partly why
DirectDraw is now deprecated: it doesn’t play well with D3D.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

So, if you were doing this, which approach would you take? I’ve done some
more reverse engineering of the PLAYXPERT approach and they create a
passthrough display driver that allows them to plug in everything in the
graphics pipeline.
If I could use actual hardware overlays, which is a much less intrusive
solution in my opinion, I’d totally go for that though. I also realize that
the framework for this is already “in place” with Vista due to the graphics
pipeline rearchitecture, which is now based on DirectX, so I’m mostly
looking for something that works on earlier operating systems (XP, 2003) as
well – and if I can minimize the work required to maintain two different
solutions, I’d be in heaven.

So, to sum up: I need the best way to composite my own windows on top of
whatever is going out on the screen – and I need it to work reliably.

Thanks for the input so far, Tim and Maxim!

On Mon, Jan 19, 2009 at 1:06 PM, Tim Roberts wrote:

> Soren Dreijer wrote:
> > I think the downside about hardware overlays is that most graphics cards
> > only support one (if they even support it). At least that’s what the
> > articles I’ve read so far on this topic have said.
>
> That’s not true. Most of the graphics cards build in the 21st Century
> have 2 or 4 overlays; a few have more.
>
> > Granted, a lot of these
> > articles are dated because DirectDraw isn’t officially supported anymore
> > unless you’re working for mobile devices. That’s why I turned to see what
> > else is out there, and so far DirectShow has shown not to be applicable
> to
> > what I want to do.
> >
> > If DirectDraw isn’t the way to go either, then what other kernel-mode
> > alternatives are there? Some sort of display filter driver?
> >
>
> The “blessed” alternative is, of course, Direct3D. Create your windows
> and videos in D3D textures, then composite them on the screen. That is
> exactly what the Aero Glass interface does on Vista, which is partly why
> DirectDraw is now deprecated: it doesn’t play well with D3D.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>