Öffters mal was neues.
Ich habe einen Fehler, den ich noch nie hatte, obwohl der Code schon einmal lief. Der Fehler:
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
Dieser soll scheinbar auftreten beim Laden aus DLLs, wenn was mit der Aufruf Konvention nicht stimmt. Naja also ich benutze hier keine DLLs, sondern alles steckt sogar in einer Header.
Ich möchte kurz den betreffenden Code zeigen:
|
C-/C++-Quelltext
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
BOOL cTexture::Blit(long DestX, long DestY,
long SrcX, long SrcY,
long Width, long Height,
float XScale, float YScale,
D3DCOLOR Color)
{
RECT Rect;
ID3DXSprite *pSprite;
if(m_Texture == NULL)
return FALSE;
if(m_Graphics == NULL)
return FALSE;
if((pSprite = m_Graphics->GetSpriteCOM()) == NULL)
return FALSE;
if(!Width)
Width = m_Width;
if(!Height)
Height = m_Height;
Rect.left = SrcX;
Rect.top = SrcY;
Rect.right = Rect.left + Width;
Rect.bottom = Rect.top + Height;
if(FAILED(pSprite->Draw(m_Texture,
&Rect, &D3DXVECTOR2(XScale, YScale),
NULL, 0.0f,
&D3DXVECTOR2((float)DestX, (float)DestY),
Color)))
return FALSE;
return TRUE;
}
|
Das ist eine Methode die im Prinzip nur die Draw Funktion von ID3DXSprite aufruft.
Der Fehler kommt u.a. bei folgeder Anwendung:
|
C-/C++-Quelltext
|
1
2
3
4
5
6
7
8
9
|
m_Texture.Load(&m_Graphics, "Tiles.bmp");
// Begin scene
m_Graphics.BeginScene();
m_Texture.Blit(50,50);
// End scene
m_Graphics.EndScene();
|
Also ich hab echt keine Ahnung warum der Fehler kommt, ich weiss nicht wirkliich was die Fehlermeldung bedeutet und ich habe schon alles möglich probiert woran es liegen könnte.
Der Fehler tritt bei diesem Aufruf auf:
|
C-/C++-Quelltext
|
1
2
3
4
5
|
pSprite->Draw(m_Texture,
&Rect, &D3DXVECTOR2(XScale, YScale),
NULL, 0.0f,
&D3DXVECTOR2((float)DestX, (float)DestY),
Color)
|
siehe oben.
Hoffentlich weiss jemand Rat :help: