DX7 Surface Lock function

Started by
1 comment, last by Skibum 21 years, 8 months ago
I have the following code:
  
	DWORD * ptr;
	DDSURFACEDESC2 desc;
	int pixelsperrow;
	HRESULT hRet;
	RECT rect;
	
	memset(&desc, 0, sizeof(DDSURFACEDESC2));
	hRet = m_GS->getBackBuffer()->Lock(NULL, &desc, DDLOCK_SURFACEMEMORYPTR | DDLOCK_NOSYSLOCK | DDLOCK_WAIT, NULL);
	FAILED_THROW_DD("Lock failed with value of: ", hRet, INFO);

	ptr = (DWORD*)desc.lpSurface;
	pixelsperrow = desc.lPitch/4;
	for(int i=0;i<500;i++)
		ptr[i+i*pixelsperrow] = i;
	m_GS->getBackBuffer()->Unlock(0);
	FAILED_THROW("Restore failed with value of: ", hRet, INFO);
  
the Lock fails, getting the return value of -2147024809 which I believe to be "One or more of the parameters passed to the method are incorrect." Any ideas?
Advertisement
desc.dwSize = sizeof(desc);
Then try to lock.
Well, now I feel like an idiot, but it worked, so thanks a bunch!

This topic is closed to new replies.

Advertisement