VGUI Panels in Source Engine

Posts 1–3 of 3 · Page 1 of 1
VGUI Panels in Source Engine
Okay so I am making an esp for CSS and I've been able to get the locations of all the ents and translate them to screen coordinates and all that, but when I do g_pISurface->DrawOutlinedRect(x1,y1,x2,y2); it doesn't draw anything, none of the drawing functions do anything. So I've looked around and found the best way is to make a vpanel with nothing on it that covers the entire screen, essentially making a surface to draw it on. Unfortunately I have no idea how to set this up, and I've attempted with some public source code on game deception but I'm not getting anywhere. Does anyone know how to set up a vpanel like that to work properly.
Also, I did follow this tutorial:
developer.valvesoftware.com/wiki/VGUI2:_Creating_a_panel

But whenever I call mypanel.Create(parent); it crashes the game

Any help is appreciated, thanks in advance

~lilneo
The reason it's crashing is probably because VGUI interface has been updated and is no longer compatible with the version you have in the SDK.

You could see if DebugOverlay still exists for the game you're working on, I believe that also has rectangle drawing.
I hooked PaintTraverse, well I'm trying. Is PaintTraverse 39 in the vtable? And which module is it, vgui2.dll I assume?

Also, I'm doing this for CSS.

Heres my hooking code:
Code:
DWORD *HookVFunc(DWORD *vtable, int index, DWORD *newFunction)
{
	DWORD dwOldProt, *oldFunc;
	VirtualProtect(&vtable[index], 4, PAGE_EXECUTE_READWRITE, &dwOldProt);
	oldFunc=(DWORD*)vtable[index];
	vtable[index]=(DWORD)newFunction;
	VirtualProtect(&vtable[index], 4, dwOldProt, &dwOldProt);
	return oldFunc;
}
That is used to hook it, you gave that to me
Code:
//In Globals area
void (__stdcall *oPaintTraverse)(VPANEL, bool, bool);

void __stdcall xPaintTraverse(VPANEL hookpanel, bool forceRepaint, bool allowForce)
{
	HANDLE hnd = GetStdHandle(STD_OUTPUT_HANDLE);
	g_pISurface->DrawSetColor(255,0,0,255);
	g_pISurface->DrawFilledRect(0,0,100,100);
	WriteText(hnd,"Paint Traverse");
	oPaintTraverse(hookpanel,forceRepaint,allowForce);
}

//In my winmain
	CreateInterfaceFn PaintTraverseInt = (CreateInterfaceFn)GetProcAddress(GetModuleHandle("vgui2.dll"),"CreateInterface");
	PaintTraverseHook = (DWORD *)PaintTraverseInt(VGUI_PANEL_INTERFACE_VERSION,NULL);
	oPaintTraverse = (void (__stdcall *)(VPANEL, bool, bool))HookVFunc(*(DWORD**)PaintTraverseHook, 39,(DWORD*) &xPaintTraverse);
This doesn't crash or anything, it runs perfectly fine it just doesn't run the xPaintTraverse, to my knowledge. And there is nothing else wrong in the game so.

~lilneo
Posts 1–3 of 3 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Talk with us