Page 1 of 1

Displaying the Find Servers menu manually

PostPosted: Sun Jul 28, 2013 5:51 pm
by SM Sith Lord
I finally figured out how to completely replace the main menu of my mod, but I still want to be able to trigger the standard Options and Find Servers sub-menus from my new main menu.

I looked at Resource/GameMenu.res and found the panel commands that the standard Find Servers and Options buttons call. For example, "OpenServerBrowser" for Find Servers and "OpenOptionsDialog" for the Options sub-menu.

I'm thinking all I need to do is get a pointer to the main menu panel and then issue some OnCommand() calls to it to do what I need, but I don't know how to get a pointer to the main menu panel to issue such calls to.

How do I get a pointer to the main menu panel so I can use ->OnCommand() on it? Thanks.

Re: Displaying the Find Servers menu manually

PostPosted: Thu Aug 22, 2013 3:40 am
by SM Sith Lord
Playing around with the following console commands I was able to *see* a pointer to the panel I need to send commands to, but I don't know how to get this pointer in code lol.

Code: Select all
vgui_drawtree 1
vgui_drawpanelptr 1


You can see the HEX pointer value under this heading:
Code: Select all
MatSystemTopPanel > staticPanel > GameUI Panel > BaseGameUIPanel > GameMenu


If I were able to get that pointer in code, and assuming I could turn it into a Panel*, I am assuming I'd just need to do pPanel->OnCommand("OpenCreateMultiplayerGameDialog") to show the server browser. :(

Re: Displaying the Find Servers menu manually

PostPosted: Thu Aug 22, 2013 4:17 am
by Gary
I might just be really tired but what exactly are you trying to do? It sounds like want to summon the options and server browser menu. Maybe something like engine->ClientCmd("OpenServerBrowser") ?

Re: Displaying the Find Servers menu manually

PostPosted: Thu Aug 22, 2013 4:53 pm
by dark0r
IGameUI::SendMainMenuCommand seems to be the exact method you're looking for. I assume you're using Source 2013?

Re: Displaying the Find Servers menu manually

PostPosted: Sun Sep 08, 2013 2:05 pm
by SM Sith Lord
Gary, that is exactly what I want to do, except that OpenServerBrowser is an unknown command and I need to also do it for the options menu.

dark0r:
That looks like exactly what I need, however I haven't updated to the Source 2013 branch yet.

However, because it took me so long to figure this one out I already worked around it and decided to keep a form of the main menu in there. Thanks for your guys help and I will sure use that method after I port over to 2013.

FYI, another very useful feature that is completely lacking from pre-2013 branches is the ability to force the game window to be borderless. Pre-2013 doesn't even have the borderless settings in their enums. :(