accessing screen buffer of other programs

Started by
22 comments, last by cody 22 years, 3 months ago
hi i wanna make a video capture program for unreal tournament because i didnt find a good one. so i must get access to unreal´s screen buffer through opengl. i know that is possible because i think the hl-wallhacks and aimbots used the same method. so how do i do this? cody
Advertisement
There is no ''clean'' way to do this through OpenGL. The rendering context for UT belongs to UT, so by that means you have no access to the video memory allocated for that context.
The only thing you could do is work around the API and somehow retrieve the address of the currently displayed video buffer from the system, and capture the frames from there. To get every single frame you''d have to enable vsync in UT and time your machine to retrieve the screen at every vsync (which means it''ll also have to be fast enough to copy and save a buffer in one vertical retrace). Or, capture every second frame (every other retrace).
As of how to get the address of the currently displayed video buffer - I don''t know.
One way would be to patch the DLLs. You run your program, initialize and then patch the Windows function for loading modules. Your function checks for specific DLLs and if it isn''t one of them just passes it on to Windows. If it is one of the ones you are looking for then after Windows loads it you patch the specific ones you are looking for. Using that general procedure you could get the program to render into the DC you specify. Then whenever they flip surfaces you log the image. That will slow down your frame rate because eventually you are going to be constrained by the rate at which you can write data to the disk drive. You could intercept the timer functions as well to put the program in a differant time frame, i.e. make one minute one second for the program.

The only place I''ve seen it documented how to patch DLLs as they are loaded was in Windows 95 System Programming Secrets. It shows how futile it can be to attempt to foil a knowledgable and determined hacker. People always argue it will stop most hackers, but it only takes one hacker to write the program that thousands then use.
Keys to success: Ability, ambition and opportunity.
first off aimbots DONT look at the video info. they use the actual game engine calls to get player positions and such. wallhacks simple control the rendering pipline by making an opengl pass through, bassicall an opengl32.dll which modifies certain calls before passing them to the real opengl32.dll it may also add calls as needed.


video capture? hmmm, you could just record demos (ut does have that capability right?) and then the ppl who wish to view them must have the game. benifits are massivly reduced file size, smooth frame rates (assuming ou have an average pc (400+ with 3d card)), and the best part its built into the engine.


on the other hand if you are creating videos for ppl without the game. (pretty stupid unless its to show off an unreleased mod). you will have to do some crazy stuff.

method 1, easy method (decent quality if you have extremly fast pc and harddrive):
use directshow''s screen capture feature. this can be accessed via filtergraph editor (comes with the dx sdk). you can setup compression as well as audio capture.

method 2, the hard way you wont be able to do since you are asking how:

1. you MUST control the rendering and game timing if you wish to even attempt to compress the video while recording. sound increases complexity since you will have to control ALL audio output as well.

2. no input will be avaiblible to the game in its slowed down state. oh well.

method 3:
try to write a mod that can do this, though it seems unlikly.
damn, i thought it could be done easier :-(

i know there are also aimbots that look at the position info of the game engine. but i have also seen one where you could set a rectangle on the screen where the bot should scan the pixels. you had to use couloured models and the aimbot aims on these.
anyway, these bots suck.

of course i know that u can record demos in unreal.(demorec filename)
but u cant but some cool stuff into it and cant cut pieces out and such.
something like that(u need divx, and turn brightness up):
http://uz.clanzenkai.net/stuff/video/TRUE-ASMD-STYLES-XERO.zip
this is recorded with movieunreal, and u see it doenst run smooth at all and the shock rifle shots fly with wrong speed.
i have tried it myself and it really doesnt look good.

another problem with demos is that they dont run on every unreal installation. even if they are the same version.

i think a better way to record videos is to run unreal in windowmode and capture the windows dc, that shouldnt be a problem, right?

or wait until movieunreal gets smooth motion...

cody
Why not just run the game in windowed mode and use a capture program, that allows you to specify a rectangle, over the window and have it do it...
i need 25 frames per second and i dont know a program that can do that.

i think saving to harddisk on the fly wont be possible, so i have to save to ram first, i will see. if nothing works good i can record the screen with a digital camcorder...
Simplest way I can think of:
Download/re-compile the OpenGLDrv sources, and change the function ClearZ to output the display to either memory/file/virtual file. ClearZ *should* only be called once per frame, and will display EVERY frame (assuming it is called once per frame) as fast as the game can run. If you need help doing this, let me know, i may be able to help (and I stress, MAY, because I don''t know a whole lot about the Plugins sytem of UT as IU didn''t write it).

Billy - BillyB@mrsnj.com
That will look like crap!

I think the screen capture programs depends on how fast your card is... That why you wont get the 25 frames a second...
I fail to see why that would look like crap? It would be much better than setting a region to caption, and will give you DIRECT access to the display. You can put a flag in to capture only every other frame or however many frames you want to capture. The only thing that wouldn''t work good with this, is you wouldn''t know how many frames you''re grabbing per second unless you put some sort of timer system in.

Billy - BillyB@mrsnj.com

This topic is closed to new replies.

Advertisement