source-sdk-2013 icon indicating copy to clipboard operation
source-sdk-2013 copied to clipboard

`vgui::Panel` virtual dispatch ABI in the SDK differs from retail

Open drunderscore opened this issue 6 months ago • 1 comments

vgui::Panel::CanAnimate is placed above GetScheme in SDK code, but my analysis of the retail game shows that this virtual is actually placed below GetScheme. I've attached screenshots from my disassembly to visualize the issue.

3602233681365136068 (Before changes) Image

4901806110306273386 (After changes) Image

Introducing differing ABI between the SDK and retail seems very weird and unintended, and following the discourse in #1249, I think this should be looked at again.

See my old Source SDK fork which contains the correct layout as per the retail game, which is used to build CastingEssentials Next.

drunderscore avatar May 19 '25 23:05 drunderscore

I'm debugging a case where apparently virtual offsets from Menu.h are mismatched as well (at least over GameUI module), at some point before GetInvalidMenuID (from the SDK). You can check, for instance, if you get a handle to the Main menu and compare the value obtained while the game process is running (I get a high random int number) vs. the value obtained when calling it from Debug Inspection while paused from Visual Studio (-1, which is correct).

Another affected virtual function is GetItemCount, since it's located after the former. Again, it returns a correct value from VS Debug Inspection (11 items in my case), and -1 while running.

Here is a sample file from my mod which includes recursive panel lookup and performs some custom stuff on the items, which fails now.

@misyltoad Would you or any team member please check for vtable differences in the vgui::Menu class between the SDK and GameUI? Thanks

Adrianilloo avatar Jun 24 '25 10:06 Adrianilloo