VOGONS


First post, by Rubenator

User metadata
Rank Newbie
Rank
Newbie

Wanted to first just say thanks for everyone's (not sure if-anyone/who helps Dege but ty!) hard work on this project!! It helps our game community so very much!

Brief context:
I'm a dev for Windower (Hi again!), a third-party tool for Final Fantasy XI.
We've had an issue for a long time involving taking screenshots when DGVoodoo2 is in use.
In a nutshell we:
1) Grab the screen buffer with `Direct3DDevice8->GetBackBuffer`
2) Write it out with `D3DXSaveSurfaceToFileA` (as a BMP)

Issue:
The issue is that, this works perfectly without dgvoodoo2, but with it, we don't get a file created at all.

Question(s):
Any idea what could possibly be going wrong?
Permissions issue seems unlikely (as the program is running as administrator).
Is the buffer not where we think it is when dgvoodoo2 is in use?
Is `D3DXSaveSurfaceToFileA` not available?
Also accepting generic debugging advice.
Thanks!

Thanks so much for your time!

Reply 1 of 2, by Rubenator

User metadata
Rank Newbie
Rank
Newbie
vigo67 wrote on 2024-02-23, 10:14:

hey
seem like problem lies within your buffer location, debug it.

Debug it how exactly?
The buffer works flawlessly without dgvoodoo2.
So the question is, how could/would using dgvoodoo2 modify the inner workings to relocate buffer 0 (and why?)? Because that's where it comes from.
https://learn.microsoft.com/en-us/previ ... v=msdn.10)

Reply 2 of 2, by Dege

User metadata
Rank l33t
Rank
l33t

Hi,

I whipped up a small test code for that:

UINT sdkVersion = D3D_SDK_VERSION;

LPDIRECT3D8 lpD3D8 = Direct3DCreate8 (sdkVersion);

D3DDISPLAYMODE mode;
lpD3D8->GetAdapterDisplayMode (0, &mode);

D3DPRESENT_PARAMETERS d3dPP = {1280, 1024, mode.Format, 2/*1*/, D3DMULTISAMPLE_NONE, D3DSWAPEFFECT_FLIP, hwnd, FALSE, TRUE, D3DFMT_D24X8,
0/*D3DPRESENTFLAG_LOCKABLE_BACKBUFFER*/, D3DPRESENT_RATE_DEFAULT, D3DPRESENT_INTERVAL_DEFAULT};

LPDIRECT3DDEVICE8 pD3D8Device = NULL;
lpD3D8->CreateDevice (0, D3DDEVTYPE_HAL, hwnd, D3DCREATE_FPU_PRESERVE | D3DCREATE_SOFTWARE_VERTEXPROCESSING , &d3dPP, &pD3D8Device);

pD3D8Device->Clear (0, NULL, D3DCLEAR_TARGET, 0xFF00FF00, 0.0f, 0);

IDirect3DSurface8* pBackBuffer = NULL;
pD3D8Device->GetBackBuffer (0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);
D3DXSaveSurfaceToFileA ("Test.bmp", D3DXIFF_BMP, pBackBuffer, NULL, NULL);

And it works for me with the latest dgv release (2.82.3), I get a test.bmp with a pure green bitmap.
Unfortunately I cannot test FFXI. What are the device creation parameters? Maybe there is something 'special' about them?

You could check out if you get an error with the _dbg version. I get the following log when calling into D3DXSaveSurfaceToFileA:

Direct3DSurface8::GetDesc (this = 0ED36348, pDesc = 0047F7C4)
DebugSetMute ()
[dgVoodoo] WARNING: DebugSetMute: This function has no effect on debug output of dgVoodoo.
Direct3DSurface8::GetContainer (this = 0ED36348, ppContainer = 0047F810)
Direct3DDevice8::QueryInterface (this = 0EC714D0)
Direct3DDevice8::Release (this = 0EC714D0)
DebugSetMute ()
[dgVoodoo] WARNING: DebugSetMute: This function has no effect on debug output of dgVoodoo.
Direct3DSurface8::GetDevice (this = 0ED36348)
Direct3DDevice8::QueryInterface (this = 0EC714D0)
Direct3DDevice8::CreateImageSurface (this = 0EC714D0, Width = 1280, Height = 1024, Format = D3DFMT_X8R8G8B8, ppSurface = 0047F8F4)
Direct3DSurface8::QueryInterface (this = 0EFE39E0)
Direct3DDevice8::AddRef (this = 0EC714D0)
[dgVoodoo] INFO: Direct3DDevice8 (0EC714D0)::CreateImageSurface: Direct3DSurface8 (0EFE39E0, IDirect3DSurface8 = 0EFE3B0C) is created.
Direct3DDevice8::CopyRects (this = 0EC714D0, pSourceSurface = 0ED36474, pSourceRectsArray = 00000000, cRects = 0, pDestinationSurface = 0EFE3B0C, pDestPointsArray = 00000000)
Direct3DSurface8::LockRect (this = 0EFE39E0, pLockedRect = 0047F804, pRect = 00000000, Flags = 0x810)
Direct3DSurface8::UnlockRect (this = 0EFE39E0)
Direct3DSurface8::Release (this = 0EFE39E0)
[dgVoodoo] INFO: Direct3DSurface8 (0EFE39E0) is released.
Direct3DDevice8::Release (this = 0EC714D0)
Direct3DDevice8::Release (this = 0EC714D0)