Solved fucking endscene shiet

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

Teuvin

now I am become Death
Dank Tier VIP
Trump Tier Donator
Dec 8, 2016
403
10,388
65
I swear to god I really tried REALLY tried to understand how this thing works and trying to make it work but for some reason when I inject it everything goes well the game doesn't crash no more but I still can't fucking draw something, please halp :rant:

Current code:
Main thread loop
C++:
	HWND hwCSGO = GetForegroundWindow();	if (hwCSGO == NULL) printf("Shit happened");
	///D3D//
	IDirect3D9* d3dobject = Direct3DCreate9(D3D_SDK_VERSION);
	D3DPRESENT_PARAMETERS d3dpresent;
	ZeroMemory(&d3dpresent, sizeof(d3dpresent));
	d3dpresent.Windowed = TRUE;
	d3dpresent.SwapEffect = D3DSWAPEFFECT_DISCARD;
	d3dpresent.hDeviceWindow = hwCSGO;
	IDirect3DDevice9* dummy;
	HRESULT HDA = d3dobject->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, hwCSGO, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpresent, &dummy);
	DWORD *d3dvmt = (DWORD*)*(DWORD*)dummy;
	///D3D END///
	SIZE_T oldProtect;
	oEndScene  = (EndScene )d3dvmt[D3DInformation::EndScene_Index];
	VirtualProtect(&d3dvmt[D3DInformation::EndScene_Index], 4, PAGE_EXECUTE_READWRITE,&oldProtect);
	d3dvmt[D3DInformation::EndScene_Index] = (DWORD)HookedEndScene;
	VirtualProtect(&d3dvmt[D3DInformation::EndScene_Index], 4, oldProtect, &oldProtect);
HookedEndScene function
C++:
HRESULT WINAPI HookedEndScene(IDirect3DDevice9 *d3ddevice) 
{
	D3DRECT rec;
	rec.x1 = 20;
	rec.y1 = 140;
	rec.x2 = 50;
	rec.y2 = 5;
	d3ddevice->Clear(1, &rec, D3DCLEAR_TARGET, D3DCOLOR_ARGB(255,0,255,0), 0, 0);
	return oEndScene(d3ddevice);
}
Declarations(global)
C++:
typedef HRESULT(__stdcall *EndScene )(IDirect3DDevice9 *);
EndScene oEndScene;
I guess if I don't post in the counter-strike section I'll never get my answer
 

Traxin

Escobar Tier VIP
Dank Tier Donator
Aug 3, 2015
1,041
25,378
154
In case you didn't understand what Broihon was saying,
C++:
d3dvmt[D3DInformation::EndScene_Index]
Is basically a pointer to EndScene.

If you overwrite the value of that pointer, you're basically changing it for YOUR object, your Device.
What you need to do, is dereference the pointer which will get you the address of EndScene.
Which IS shared across both devices, your dummy and the games. Both pointers point to the same function, they're just different pointers.
Then you can just hook the function like any other.
 

Broihon

edgy 12 y/o
Escobar Tier VIP
Fleep Tier Donator
Dec 22, 2013
1,745
40,528
316
Of course this won't draw anything since you just replace the pointer to EndScene in the VMT you just created.
The game creates it's own device. You either have to hook into the "real" device or create a detour at the address of EndScene.
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods