我不确定从 asm 调用 c++ 方法的方法是否正确。
c++ hkDrawIndexdPrimitive 方法:
HRESULT WINAPI hkDrawIndexedPrimitive (LPDIRECT3DDEVICE8 pDevice,
D3DPRIMITIVETYPE PrimType, UINT minIndex, UNIT NumVertices, UNIT startIndex, UINT primCount)
调用 hkDrawIndexdPrimitive 方法的 asm 代码:
__declspec(naked) void DIP_Mid( ) {
__asm {
pushad
pushfd
PUSH DWORD PTR SS:[EBP+0x1C] // primCount [4 Bytes]
PUSH DWORD PTR SS:[EBP+0x18] // startIndex [4 Bytes]
PUSH DWORD PTR SS:[EBP+0x14] // NumVertices [4 Bytes]
PUSH DWORD PTR SS:[EBP+0x10] // minIndex [4 Bytes]
PUSH DWORD PTR SS:[EBP+0x0C] // PrimType [4 Bytes]
PUSH DWORD PTR SS:[EBP+0x08] // pDevice [4 Bytes]
CALL hkDrawIndexedPrimitive
popad
popfd
XOR ESI,ESI // Replace Code 0x6D9D73D1 [2 Bytes]
CMP DWORD PTR DS:[ESI+18],EBX // Replace Code 0x6D9D73D3 [3 Bytes]
JMP dwDIPRet; // Return to 0x6D9D73D6
}
}