Archived

This topic is now archived and is closed to further replies.

Skibum

DX7 Surface Lock function

Recommended Posts

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?

Share this post


Link to post
Share on other sites