HelpC++ D3D Menu

Posts 1–4 of 4 · Page 1 of 1
C++ D3D Menu
Could someone help me out here. I am trying to do a D3D menu on CS:GO but whenever I inject some of the menu items dissapear on each inject. It's not the same ones dissapearing it's different menu items that dissapear on each inject. It makes no sense? Am I hooking this correcly? Is it some render state that causes some menu items to dissapear because with a D3D test enviornment it works perfectly fine.


Code:
long __stdcall EndScene(IDirect3DDevice9* pDevice)
{

	pDevice->GetRenderState(D3DRS_COLORWRITEENABLE, &dwOld_D3DRS_COLORWRITEENABLE); /*this is so we can draw without net_graph*/
	pDevice->SetRenderState(D3DRS_COLORWRITEENABLE, 0xffffffff);

		if (!menu)
			createMenu(pDevice);
		else
		{
			menu->DoMenu(pDevice);
		}
	pDevice->SetRenderState(D3DRS_COLORWRITEENABLE, dwOld_D3DRS_COLORWRITEENABLE);

	return oEndScene(pDevice);
}

long __stdcall Reset(IDirect3DDevice9* pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters)
{
	return oReset(pDevice, pPresentationParameters);

	auto hr = oReset(pDevice, pPresentationParameters);
	return hr;
}

DWORD d3d9Device = **(DWORD**)(gBaseAPI.FindPatterns("shaderapidx9.dll", "A1 ?? ?? ?? ?? 50 8B 08 FF 51 0C") + 1);


CVMTHookManager*  pD3DDevice9Hook = new CVMTHookManager((DWORD**)d3d9Device);
oEndScene = (EndSceneFn)pD3DDevice9Hook->dwHookMethod((DWORD)EndScene, 42);
oReset = (ResetFn)pD3DDevice9Hook->dwHookMethod((DWORD)Reset, 16);
Anyone could help me out?
Quote Originally Posted by reroute View Post
Anyone could help me out?
Never done D3D but are you using -nod3dex?
Pattern is fine.
Indexes are fine.
What is createMenu()? It does create a pointer to menu? Or just setup values?
The issue seems to be inside the DoMenu()

Your reset hook is kinda stupid ;-;
return original. save original. return original... Just the first return will work.
Reset hook is just call when your screen/ui/directx needs update. Cuz you probably changed resolution and others...
Code:
const auto h_original = original...
//invalidate/destroy objects.
//create objects
return h_original;
Also please, get a coding style... mix up things is not a good practice. If you cant come with one, use resharper cpp.
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?