VOGONS


First post, by BuXXe

User metadata
Rank Newbie
Rank
Newbie

Hello everyone,
I registered to this Forum cause it seems to be the only way to get in contact with Dege. I really could need your help on something. Could you please leave me a mail?

dante033-0815@yahoo.de

Its my Junk Mail adress so dont worry about the name.

In short:

I am reverse engineering an old game from the ground up and am pretty deep into it. Just to clarify, I am definately no beginner.
The game used to be running under DirectX6 and was using DirectDraw. Your dgVoodoo2 works perfectly fine with the game but not with my current testing code.
I wrote a really simple testcase to nail down the problem. It seems to be some kind of nullpointer exception. I just want to call EnumDisplayModes and when debugging the original game, the dgVoodoo2 lists all the resolutions perfectly fine.
My simple test code though only gets the first resolution and then crashes due to an access violation. I ran through it with ollydbg and it seems that for some reason (that i cant make out currently) the ddraw enumeration runs into the null pointer. I really could need a hand here. Thanks for your time anyway.

HRESULT testoutput(LPDDSURFACEDESC2 arg1, LPVOID arg2) {
OutputDebugStringA("FUNCTION WAS CALLED\n");
return 1;
}
int main()
{
LPDIRECTDRAW a;
IDirectDraw4* b;
HRESULT res = DirectDrawCreate(0, &a, 0);

if (res != DD_OK)
return res;

res = a->QueryInterface(IID_IDirectDraw4, (LPVOID*)&b);
b->EnumDisplayModes(0, 0, (LPVOID)a, (LPDDENUMMODESCALLBACK2)testoutput);
if (res == DD_OK)
return res;
}

Output:

DirectDraw::EnumDisplayModes (this = 00797E10, dwFlags = 0, lpDDSurfaceDesc2 = 00000000, lpContext = 7258a60, lpEnumModesCallback = 00241010)
[dgVoodoo] INFO: DirectDraw (00797E10)::EnumDisplayModes: Display mode 512x384, 8 bit with default refresh rate is enumerated to the application.
FUNCTION WAS CALLED
Exception thrown at 0x61B0A958 (DDraw.dll) in Functiontest.exe: 0xC0000005: Access Violation while reading at position 0x00000238.

Reply 1 of 2, by Dege

User metadata
Rank l33t
Rank
l33t

Hi,

My initial respond is short, so I post it here: function testoutput must have _stdcall calling convention. I don't know what your compiling default is but in the sample code there is no calling convention defined for that callback.