Sign in to follow this  

IDirectXFileData-GetData() - Deprecated!

This topic is 4112 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
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

This topic is 4112 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this