Hello everyone I am messing around with some DLL injection stuff. Therefore I downloaded a simple Direct3D 9 sample application (it shows only a cube), which I want to manipulate.
I already managed to hook the EndScene and Reset function of this application, and now simply want to add more light to the current drawn frame.
Here is my EndScene function:
HRESULT WINAPI myEndScene(LPDIRECT3DDEVICE9 pDevice) {
lightHackTest2(pDevice);
auto ret = origEndScene(pDevice);
placeHooks();
return ret;
}
and here is my lightHackTest2 function:
void lightHackTest2(LPDIRECT3DDEVICE9 pDevice) {
pDevice->SetRenderState(D3DRS_AMBIENT, D3DCOLOR_XRGB(100, 100, 100));
}
void lightHackTest(LPDIRECT3DDEVICE9 pDevice) {
D3DLIGHT9 light;
ZeroMemory(&light, sizeof(light));
light.Type = D3DLIGHT_DIRECTIONAL;
light.Diffuse.r = 0.5f;
light.Diffuse.g = 0.5f;
light.Diffuse.b = 0.5f;
light.Diffuse.a = 1.0f;
light.Direction.x = -1.0f;
light.Direction.y = -0.5f;
light.Direction.z = -1.0f;
pDevice->SetLight(0, &light);
pDevice->LightEnable(0, TRUE);
}
These functions do actually get called (checked it with some MessageBoxes) but everything does stay the same in the scene.
Am I applying the light wrong?