| View previous topic :: View next topic |
| Author |
Message |
sayezz How do I cheat?
Reputation: 0
Joined: 10 Jan 2013 Posts: 5
|
Posted: Thu Jan 10, 2013 7:40 am Post subject: DirecX Injection : GetDesc(&desc) returns wrong format |
|
|
Hey,
i have a game where I inject a directx dll to grab the image. Thats how I do it:
| Code: |
void dumb_buffer(LPDIRECT3DDEVICE9 pDevice){
ret = pDevice->GetRenderTarget(0,&pRenderTarget);
ret = pRenderTarget->GetDesc(&rtDesc);
if(rtDesc.Width != 1){ // <--- THIS IS THE STRANGE BEHAIVIOR
pDevice->CreateOffscreenPlainSurface(rtDesc.Width, rtDesc.Height,rtDesc.Format, D3DPOOL_SYSTEMMEM, &pDestTarget, NULL);
pDevice->GetRenderTargetData(pRenderTarget,pDestTarget);
pDestTarget->LockRect(&rect,0, D3DLOCK_DONOTWAIT);
bits = (unsigned char*)rect.pBits;
pDestTarget->UnlockRect();
pDestTarget->Release();
}
pRenderTarget->Release();
}
|
In the first frame everything works fine and rtDesc looks like this:
| Code: |
rtDesc.Format = D3DFMT_R32F
rtDesc.width = 1920
rtDesc.height = 1200
|
In the second frame rtDesc looks now like this:
| Code: |
rtDesc.Format = 1280070990
rtDesc.width = 1
rtDesc.height = 1
|
Then the next frame everything is fine again and the next frame it is "1280070990" again.
Any suggestions why its behaving like this?
Are there two different renderers?
Also, if i start the injection and framegrabbing with "dumb_buffer(..)" the framerate in the game drops and the game judders.
Thanks
Regards
Denis
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25827 Location: The netherlands
|
Posted: Thu Jan 10, 2013 7:50 am Post subject: |
|
|
check if GetRenderTarget returns success or not, perhaps it fails and you're seeing uninitialized variables
(also, not sure if dx9 already supports that, but perhaps it's rendering to a 1x1 pixel texture for whatever reason)
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
sayezz How do I cheat?
Reputation: 0
Joined: 10 Jan 2013 Posts: 5
|
Posted: Thu Jan 10, 2013 9:36 am Post subject: |
|
|
the return value of GetRenderTarget(..) and GetDesc(..) is
So there is no error. Maybe you are right and its rendering to a 1x1 pixel, but the question is why
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Thu Jan 10, 2013 10:43 pm Post subject: |
|
|
The 1x1 pixel could be used for particle effects or similar.
_________________
- Retired. |
|
| Back to top |
|
 |
sayezz How do I cheat?
Reputation: 0
Joined: 10 Jan 2013 Posts: 5
|
Posted: Fri Jan 11, 2013 2:55 am Post subject: |
|
|
ist there a possibility to ignore this renderer without using
| Code: |
if(rtDesc.Width != 1){
...
}
|
Is it correct that I only grab each image and write it back to the "bits" array, without changing anything so that the framerate of the game cant be slow down because of using
| Code: |
if(rtDesc.Width != 1){
...
}
|
?
The Game i'm using (VBS2) is able to handle two SLI Graphiccards, but I'm using only one Graphiccard at the moment.
Is it possible that the 1x1 Surface is something like a place holder for the second graphiccard?
Regards
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25827 Location: The netherlands
|
Posted: Fri Jan 11, 2013 4:27 am Post subject: |
|
|
It's possible, have you checked it's the same direct3d9device?
Also, that if will hardly slow down the game compared to your other code
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
sayezz How do I cheat?
Reputation: 0
Joined: 10 Jan 2013 Posts: 5
|
Posted: Fri Jan 11, 2013 8:36 am Post subject: |
|
|
the device is the same, but the renderTarget switches from one address to another:
Image one:
Image two:
(I'm not allowed to poste a url)
why does the framerate goes down when i'm using "if" ? Does it mean that only each second frame is passed back to the game?
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25827 Location: The netherlands
|
Posted: Fri Jan 11, 2013 7:49 pm Post subject: |
|
|
Are you sure you're not getting a callback from your own render call?
Anyhow, that it's slow is most likely because every frame you're creating a whole new surface, with the same dimension as the screen, inside system memory.
That means that every frame 9MB ram (1920*1200*4) needs to get initialized.
Perhaps it's more efficient to create it only once, and reuse that surface for every subsequent call, until the resolution changes/devicelost
or perhaps GetRenderTargetData is just slow
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
sayezz How do I cheat?
Reputation: 0
Joined: 10 Jan 2013 Posts: 5
|
Posted: Mon Jan 14, 2013 8:27 am Post subject: |
|
|
What do you mean with "..not getting a callback from your own render call?"
Creating the Surface once does work, but it does not help, there is no change with the performance.
GetRenderTargetData is indeed slow, but I dont know any other way to get the pixels. Also "LockRect(..)" is slow too.
The Performance also changes when using
| Code: | | pDevice->CreateOffscreenPlainSurface(rtDesc.Width, rtDesc.Height,rtDesc.Format, D3DPOOL_SYSTEMMEM, &pDestTarget, NULL); |
and
| Code: | | pDevice->CreateOffscreenPlainSurface(rtDesc.Width, rtDesc.Height,rtDesc.Format, D3DPOOL_DEFAULT, &pDestTarget, NULL); |
When using D3DPOOL_DEFAULT the performance is very good but I don't get an image, so my "bits" array is 0.
|
|
| Back to top |
|
 |
|