Originally Posted by Verson
Also,
da bei meinen beiden Chams-Mothode das Spiel abstürzt, wollt ich mal wissen wer laufende Chams hat und wie er dies Programmtechnisch umgesetzt hat.
Mothode 1[(1.Funktion "mySetStreamSource"=Stride auslesen);(2.Funktion "myDrawIndexedPrimitive"=Texturen Zeichnen und auf pDevice anwenden)]:
Code:
typedef HRESULT (WINAPI* oSetStreamSource)(LPDIRECT3DDEVICE9 pDevice,UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride);
oSetStreamSource pSetStreamSource;
typedef HRESULT (WINAPI* oDrawIndexedPrimitive)(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount);
oDrawIndexedPrimitive pDrawIndexedPrimitive;
LPDIRECT3DVERTEXBUFFER9 StreamData;
UINT OffsetInBytes;
LPDIRECT3DTEXTURE9 D3Red;
LPDIRECT3DTEXTURE9 D3Green;
bool TxtGenCheck=true;
unsigned int myStride=NULL;
HRESULT WINAPI mySetStreamSource(LPDIRECT3DDEVICE9 pDevice,UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride){
HRESULT hRet = pSetStreamSource(pDevice, StreamNumber, pStreamData,OffsetInBytes, Stride);
if(Stride!=NULL){ //*StreamNumber == 0
myStride = Stride;
}
return hRet;
}
HRESULT WINAPI myDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice,D3DPRIMITIVETYPE Type,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount){
if(pDevice->GetStreamSource(0,&StreamData,&OffsetInBytes,&myStride) == D3D_OK)
{
StreamData->Release();
}
if(truecheck){
GenerateTexture(pDevice, &D3Green,D3DCOLOR_ARGB (255 , 0 , 255 , 0 ));
GenerateTexture(pDevice, &D3Red, D3DCOLOR_ARGB (255 , 255 , 0 , 0 ));
truecheck=false;
}
if(nClass.nD3D.WH_Chams) if(myStride==36 || myStride==32 || myStride==44){
pDevice->SetRenderState(D3DRS_ZENABLE,false);
pDevice->SetRenderState(D3DRS_FILLMODE,D3DFILL_SOLID);
pDevice->SetTexture(0,D3Red);
pDrawIndexedPrimitive(pDevice, Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
pDevice->SetRenderState(D3DRS_ZENABLE,true);
pDevice->SetRenderState(D3DRS_FILLMODE,D3DFILL_SOLID);
pDevice->SetTexture(0,D3Green);
//pDevice->SetRenderState(D3DRS_FOGENABLE, FALSE); NoFog
}
return pDrawIndexedPrimitive(pDevice, Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
}
Methode 2[(1.Funktion "myDrawIndexedPrimitive"=mit "GetStreamSource" Stride auslesen & Texturen Zeichnen und auf pDevice anwenden)]:
Code:
typedef HRESULT (WINAPI* oDrawIndexedPrimitive)(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount);
oDrawIndexedPrimitive pDrawIndexedPrimitive;
LPDIRECT3DVERTEXBUFFER9 StreamData;
UINT OffsetInBytes;
LPDIRECT3DTEXTURE9 D3Red;
LPDIRECT3DTEXTURE9 D3Green;
bool TxtGenCheck=true;
unsigned int myStride=NULL;
HRESULT WINAPI myDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice,D3DPRIMITIVETYPE Type,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount){
if(pDevice->GetStreamSource(0,&StreamData,&OffsetInBytes,&myStride) == D3D_OK)
{
StreamData->Release();
}
if(TxtGenCheck){
GenerateTexture(pDevice, &D3Green,D3DCOLOR_ARGB (255 , 0 , 255 , 0 ));
GenerateTexture(pDevice, &D3Red, D3DCOLOR_ARGB (255 , 255 , 0 , 0 ));
TxtGenCheck=false;
}
if(nClass.nD3D.WH_Chams) if(myStride==36 || myStride==32 || myStride==44){
pDevice->SetRenderState(D3DRS_ZENABLE,0);//false
pDevice->SetRenderState(D3DRS_FILLMODE,D3DFILL_SOLID);
pDevice->SetTexture(0,D3Red);
pDrawIndexedPrimitive(pDevice, Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
pDevice->SetRenderState(D3DRS_ZENABLE,1);//true
pDevice->SetRenderState(D3DRS_FILLMODE,D3DFILL_SOLID);
pDevice->SetTexture(0,D3Green);
//pDevice->SetRenderState(D3DRS_FOGENABLE, FALSE); NoFog
}
return pDrawIndexedPrimitive(pDevice, Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
}
Mit den beiden Methoden stürtzt mein hack immer ab ... Meine Frage an die,die es geschafft haben, wie habt ihr das konkret gelöst ? Ich verzweifel langsam ... weil ich so nah dran bin (es funktioniert alles > aber nicht ingame) !
|