Jump to content

  • Log In with Google      Sign In   
  • Create Account

accessing screen buffer of other programs


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
23 replies to this topic

#1 cody   Members   -  Reputation: 199

Like
Likes
Like

Posted 06 January 2002 - 01:24 AM

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

Sponsor:

#2 Dodger   Members   -  Reputation: 122

Like
Likes
Like

Posted 06 January 2002 - 07:40 AM

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.


#3 LilBudyWizer   Members   -  Reputation: 491

Like
Likes
Like

Posted 06 January 2002 - 08:42 AM

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.

#4 a person   Members   -  Reputation: 118

Like
Likes
Like

Posted 06 January 2002 - 05:55 PM

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.


#5 cody   Members   -  Reputation: 199

Like
Likes
Like

Posted 07 January 2002 - 12:11 AM

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

#6 ANSI2000   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 January 2002 - 02:43 AM

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...

#7 cody   Members   -  Reputation: 199

Like
Likes
Like

Posted 07 January 2002 - 04:52 AM

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...

#8 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 07 January 2002 - 05:24 AM

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

#9 ANSI2000   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 January 2002 - 05:24 AM

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...

#10 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 07 January 2002 - 05:38 AM

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

#11 Promit   Moderators   -  Reputation: 7197

Like
Likes
Like

Posted 07 January 2002 - 05:39 AM

If you want to capture the entire screen, you could just go to the video memory offsets and copy them. Or if you know the rect, you can use that area instead of the entire memory block.

-----------------------------
The sad thing about artificial intelligence is that it lacks artifice and therefore intelligence.

#12 ANSI2000   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 January 2002 - 07:10 AM

I wasnt quoting you Anon I think are posts got submitted at same time...

The fact that cody will record the screen with a cam corder will look like crap! Wont the cam corder capture the vsync of the monitor so it will look like you you have these big black lines go up and arround through your screen?

#13 cody   Members   -  Reputation: 199

Like
Likes
Like

Posted 07 January 2002 - 07:11 AM

i think ansi ment the thing with the digi-cam.
i tested it with a cheap web-cam and yeah, it looks really bad, but with super cool digital camera it will look much better!

what billy wrote is interesting, but where do i get the source for this dll? i will take a look at some unreal sites...

#14 cody   Members   -  Reputation: 199

Like
Likes
Like

Posted 07 January 2002 - 10:19 AM

i found the source but theres a problem:
ut doesnt call ClearZ on every frame... damn again!

#15 a person   Members   -  Reputation: 118

Like
Likes
Like

Posted 07 January 2002 - 01:08 PM

i highly doubt you have a pc capable of capturing to ram as you would need quite a bit of ram (talking about 1gig or so). since very few pcs can run ut AND compress video on the fly at 25 frames per second. you do realize at 16bit video would get you (at 320x240 res) about 3.6 meg per SECOND. or 219meg per minute or 1089meg for a nice 5 minute video. now you probally could use some of the crappier codecs to get realtime compression on a 800mhz+ pc. if you got a pentium4 the divx4.11 codec is quite optimized and MAY yeild fast enough performance at 320x240 so that ut framerates dont go to crap. though ut may "steal" too much cpu to make it useful. also no matter how good the video camera it will look like crap thanks to the anomolies you get from the "scanning" the moniter performs during rereshing of the screen. basically if if avi capture is not built into the game dont even bother since the quality will suck unless you really want to work hard at writing all the required components.

as to demos not working. the thing is that they do, just not if you dont have the required levels/mods installed that the demo uses. i am not sure about player models, though i am pretty sure they dont matter (like if you were to play the game online).

#16 cody   Members   -  Reputation: 199

Like
Likes
Like

Posted 08 January 2002 - 02:29 AM

well, i have 1gig ram and i will need about 10-20mb per second.
thats enough for half a minute video. there wont be single sequences that take longer.
i know all that is not perfect, but i will try...

and it really often happens that ut demos dont work!
when you play on a internet server there are downloaded many packages. (like cshp(anti-aimbot), ut map vote,skins and other stuff, and all that in many different versions)

compressing the video while recording is not an option i think.
divx is very fast and can compress in realtime without problems, but not when ut is running...

perhaps i will wait until there´s a new version of movieunreal...

#17 LordKronos   Members   -  Reputation: 122

Like
Likes
Like

Posted 08 January 2002 - 03:11 AM

Optionally, you could write an opengl32.dll wrapper that passes all calls directly through to the real opengl32.dll, except for calls to wglSwapBuffers. When SwapBuffers is called, you could do a glReadPixels and save to a file (or whatever).

As far as creating the wrapper, probably a good place to start would be glTrace (http://www.hawksoft.com/gltrace/).

#18 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 08 January 2002 - 03:21 AM

LordKronos: That was going to be my original idea (instead of when ZClear is called), but the problem is when writing an OpenGL app, you simply do a SwapBuffers (windows call) and it does not call a glSwapBuffers (well, not that i''m aware of anyways). I would not do a glReadPixels for an entire screen though!! :o). Using the OpenGL driver for UT gives you access to the windows DC (device context) and RC (rednering context), which makes image capturing pretty easy and fast (much better than "getting" every pixel). Cody, are you sure that UT doesn''t call ZClear every frame? If so, how did you determine this? I am trying to think of a good way to capture the screen on every refresh, it has to do something every 1 frame :o).

Billy - BillyB@mrsnj.com

#19 LordKronos   Members   -  Reputation: 122

Like
Likes
Like

Posted 08 January 2002 - 03:36 AM

I am almost positive from experience that it doesnt call clear every frame, because I remember playing one level once where the level data was messed up and there were places where no poly existed. As I recall, when you looked at these areas, you would just see garbage (blurred from previous frames). I suppose it could also have been doing something really strange, but to me it looked like it wasnt clearing.

#20 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 08 January 2002 - 03:45 AM

LordKronos: I know the Color Buffer isn''t cleared AT ALL, but I beleive the Z-Buffer is. They are 2 seperate entities.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS