Jump to content
  • Advertisement
Sign in to follow this  
stenny

IDirectXFileData-GetData() - Deprecated!

This topic is 4416 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I'll cut straight to the chase. I have a ParseXFileData function, which (of course) parses XFiles for their data. It first gives a call to ID3DXFileData->GetType() and stores the information into a GUID *Type. Then all the possible Types are checked:
void cMesh::ParseXFileData(ID3DXFileData *pDataObj, sFrame *ParentFrame, char *TexturePath)
{
	GUID		*Type = NULL;
	char		*Name = NULL;
	DWORD		Size;
	sFrame		*SubFrame = NULL;
	char		Path[MAX_PATH];

	sFrame		*Frame = NULL;
	D3DXMATRIX	*FrameMatrix = NULL;

	sMesh			*Mesh = NULL;
	ID3DXBuffer		*MaterialBuffer = NULL;
	D3DXMATERIAL	*Materials = NULL;
	ID3DXBuffer		*Adjecancy = NULL;
	DWORD			*ADjecancyIn = NULL;
	DWORD			*AdjecancyOut = NULL;

	DWORD	i;
	BYTE	**Ptr;

	if(FAILED(pDataObj->GetType(Type))) { return; }
	if(FAILED(pDataObj->GetName(NULL, &Size))) { return; }
	if(Size)
	{
		if((Name = new char[Size]) != NULL) { pDataObj->GetName(Name, &Size); }
	}

	if(Name == NULL)
	{
		if((Name = new char[9]) == NULL) { return; }
		strcpy(Name, "%NoName%");
	}

	SubFrame = ParentFrame;

	if(*Type == TID_D3DRMFrame)
	{
		Frame = new sFrame();

		Frame->m_Name = Name;
		Name = NULL;

		Frame->m_Parent = ParentFrame;
		Frame->m_Sibling = ParentFrame->m_Child;
		ParentFrame->m_Child = Frame;

		m_NumFrames++;

		SubFrame = Frame;
	}

	if(*Type == TID_D3DRMFrameTransformationMatrix)
	{
		if(FAILED(pDataObj->GetData(NULL, &Size, (PVOID*)&FrameMatrix))) { return; }
		ParentFrame->m_MatOriginal = *FrameMatrix;
	}
}
Most of the function isn't that important but the last part of the function gives some errors. I'm converting code from a book that uses DirectX 9.0a so instead of IDirectXFileData I use ID3DXFileData. The problem is that ID3DXFileData doesn't have a GetData() function as used in the last part of the code. Can someone help to convert this part to DirectX SDK9.0c? (Also: I use C++, MVSC++, and the books' "programming Role Playing Games with DirectX") -Stenny

Share this post


Link to post
Share on other sites
Advertisement
If I'm not wrong, this should be it [smile]


if (Type == TID_D3DRMFrameTransformMatrix)
{
BYTE** DataPtr = NULL;

if (FAILED(pDataObj->Lock(&Size, (LPCVOID*)&DataPtr)))
return;

memcpy(&ParentFrame->m_MatOriginal, (void*)DataPtr, Size);
pDataObj->Unlock();
}






I've changed this line as well (removing the * pointer), not sure if it's necessary:
GUID Type = GUID_NULL;

Share this post


Link to post
Share on other sites
Thank you! It's working! [smile]!

Although I don't even dare to doubt you (hehe), is there someone who can tell me that is indeed (one of) the right way(s) to do it? I don't want to end up with a wrong function.

-Stenny

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!