IVGuiModuleLoader

From Valve Developer Community
Jump to navigation Jump to search
Wikipedia - Letter.png
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
Dead End - Icon.png
This article has no Wikipedia icon links to other VDC articles. Please help improve this article by adding links Wikipedia icon that are relevant to the context within the existing text.
January 2024

With this interface not included in the SDK, you can activate the server browser module and the friends module.

public\gameui\IVGuiModuleLoader.h

//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================

#ifndef IVGUIMODULELOADER_H
#define IVGUIMODULELOADER_H
#ifdef _WIN32
#pragma once
#endif

#include "interface.h"

#define APP_FRIENDS 0
#define APP_SERVERS 1

//-----------------------------------------------------------------------------
// Purpose: interface to accessing all loaded modules
//-----------------------------------------------------------------------------
class IVGuiModuleLoader : public IBaseInterface
{
public:
	virtual int			GetModuleCount() = 0;
	virtual const char *		GetModuleLabel(int moduleIndex) = 0;
	virtual CreateInterfaceFn	GetModuleFactory(int moduleIndex) = 0;
	virtual bool			ActivateModule(int moduleIndex) = 0;
	virtual bool			ActivateModule(const char *moduleName) = 0;
	virtual void			SetPlatformToRestart() = 0;
};

#define VGUIMODULELOADER_INTERFACE_VERSION "VGuiModuleLoader003"

#endif // IVGUIMODULELOADER_H

Access

These lines go in the client/server init files:

#include <gameui\IVGuiModuleLoader.h>
IVGuiModuleLoader * moduleloader = NULL;
	CreateInterfaceFn gameUIFactory = Sys_GetFactory("gameui.dll");
	moduleloader = (IVGuiModuleLoader *)gameUIFactory(VGUIMODULELOADER_INTERFACE_VERSION, NULL);