QUOTE(grimdoomer @ Oct 17 2008, 11:33 PM)

I've been messing with the XDk for a couple days. Now I want to start drawing some textures. I have all the necessary code in place, but it always throws an exceptions stating that it cant find the texture on the HDD. So I added some drive mounting code, thinking it might help. But when I make an extern call to IoCreateSymbolicLink I get a build error - unresolved external symbol. I can't for the life of me figure this out. Can someone please help me out? I'll be on aim a lot so you can hit me up there too.
What is the path of your texture? Are you using "D:\\" in front of your directory? If not, that's one fatal problem right there. Example: Let's say texture.dds is in $(XbeDir)\Media\Textures\texture.dds... in order to load it you need to use this string "D:\\Media\\Textures\\texture.dds"
Also, when calling kernel functions directly, you need to declare them as extern functions before using them and you also need to make sure that they retain C linkage (that's if you're using C++), and make sure the parameters are correct or you will get link errors. Example:
CODE
extern "C" {
// Declare any kernel functions here
extern XBOXAPI KeRaiseIrql( ... );
extern DWORD KeTickCount;
extern XBOXAPI IoCreateSymbolicLink( ... );
};
Let me know if this helps.
CODE
if (FAILED(D3DXCreateTextureFromFile(g_pd3dDevice, "D:\\Media\\test.bmp", &m_BGTexture)))
{
OutputDebugString("Error: Could not Initialize Texture!");
}
Rendering:
CODE
VOID Render()
{
// Clear the backbuffer to a blue color
g_pd3dDevice->Clear( 0L, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER|D3DCLEAR_STENCIL,
D3DCOLOR_XRGB(0,0,255), 1.0f, 0L );
// Begin the scene
g_pd3dDevice->BeginScene();
g_pd3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
g_pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
g_pd3dDevice->SetRenderState( D3DRS_LIGHTING, FALSE);
g_pd3dDevice->SetStreamSource( 0, g_pVB, sizeof(CUSTOMVERTEX) );
g_pd3dDevice->SetVertexShader( D3DFVF_CUSTOMVERTEX );
g_pd3dDevice->SetTexture(0, m_BGTexture);
g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, 1 );
// End the scene
g_pd3dDevice->EndScene();
//Present
g_pd3dDevice->Present(NULL, NULL, NULL, NULL);
}