diff --git a/src/core/stdafx.h b/src/core/stdafx.h index ce176603..e1da61c5 100644 --- a/src/core/stdafx.h +++ b/src/core/stdafx.h @@ -60,6 +60,7 @@ #include "tier0/module.h" #include "tier0/basetypes.h" #include "tier0/platform.h" +#include "tier0/platwindow.h" #include "tier0/annotations.h" #include "tier0/commonmacros.h" #include "tier0/memalloc.h" @@ -67,6 +68,7 @@ #include "tier0/dbg.h" // Tier1 includes. +#include "tier1/tier1.h" #include "tier1/cvar.h" #include "tier1/cmd.h" #include "common/global.h" diff --git a/src/engine/sys_dll2.h b/src/engine/sys_dll2.h index 443208a0..bdf7b0b6 100644 --- a/src/engine/sys_dll2.h +++ b/src/engine/sys_dll2.h @@ -5,13 +5,13 @@ class CEngineAPI : public IEngineAPI { public: - virtual bool Connect(CreateInterfaceFn factory) = 0; + virtual bool Connect(const CreateInterfaceFn factory) = 0; virtual void Disconnect() = 0; - virtual void* QueryInterface(const char* pInterfaceName) = 0; + virtual void* QueryInterface(const char* const pInterfaceName) = 0; virtual InitReturnVal_t Init() = 0; virtual void Shutdown() = 0; virtual AppSystemTier_t GetTier() = 0; - virtual void Reconnect(CreateInterfaceFn factory, const char* pInterfaceName) = 0; + virtual void Reconnect(const CreateInterfaceFn factory, const char* const pInterfaceName) = 0; // This function must be called before init virtual bool SetStartupInfo(StartupInfo_t& info) = 0; diff --git a/src/public/appframework/IAppSystem.h b/src/public/appframework/IAppSystem.h index 25f2ff19..451abed8 100644 --- a/src/public/appframework/IAppSystem.h +++ b/src/public/appframework/IAppSystem.h @@ -57,12 +57,12 @@ public: virtual ~IAppSystem() = 0; // Prepended on each class derived class in assembly. // Here's where the app systems get to learn about each other - virtual bool Connect(CreateInterfaceFn factory) = 0; + virtual bool Connect(const CreateInterfaceFn factory) = 0; virtual void Disconnect() = 0; // Here's where systems can access other interfaces implemented by this object // Returns NULL if it doesn't implement the requested interface - virtual void* QueryInterface(const char* pInterfaceName) = 0; + virtual void* QueryInterface(const char* const pInterfaceName) = 0; // Init, shutdown virtual InitReturnVal_t Init() = 0; @@ -75,7 +75,7 @@ public: virtual AppSystemTier_t GetTier() = 0; // Reconnect to a particular interface - virtual void Reconnect(CreateInterfaceFn factory, const char* pInterfaceName) = 0; + virtual void Reconnect(const CreateInterfaceFn factory, const char* const pInterfaceName) = 0; }; //----------------------------------------------------------------------------- @@ -88,12 +88,12 @@ public: virtual ~CBaseAppSystem() = 0; // Prepended on each class derived class in assembly. // Here's where the app systems get to learn about each other - virtual bool Connect(CreateInterfaceFn factory) = 0; + virtual bool Connect(const CreateInterfaceFn factory) = 0; virtual void Disconnect() = 0; // Here's where systems can access other interfaces implemented by this object // Returns NULL if it doesn't implement the requested interface - virtual void* QueryInterface(const char* pInterfaceName) = 0; + virtual void* QueryInterface(const char* const pInterfaceName) = 0; // Init, shutdown virtual InitReturnVal_t Init() = 0; @@ -106,7 +106,15 @@ public: virtual AppSystemTier_t GetTier() = 0; // Reconnect to a particular interface - virtual void Reconnect(CreateInterfaceFn factory, const char* pInterfaceName) = 0; + virtual void Reconnect(const CreateInterfaceFn factory, const char* const pInterfaceName) = 0; +}; + +//----------------------------------------------------------------------------- +// Helper implementation of an IAppSystem for tier0 +//----------------------------------------------------------------------------- +template< class IInterface > +class CTier0AppSystem : public CBaseAppSystem< IInterface > +{ }; #endif // IAPPSYSTEM_H \ No newline at end of file diff --git a/src/public/tier0/platwindow.h b/src/public/tier0/platwindow.h new file mode 100644 index 00000000..8a93ca03 --- /dev/null +++ b/src/public/tier0/platwindow.h @@ -0,0 +1,82 @@ +//===== Copyright � 1996-2009, Valve Corporation, All rights reserved. ======// +// +// Purpose: +// +// $NoKeywords: $ +// +//===========================================================================// + +#ifndef PLATWINDOW_H +#define PLATWINDOW_H + +#ifdef COMPILER_MSVC32 +#pragma once +#endif + +#include "tier0/platform.h" +#include "tier0/basetypes.h" + +//----------------------------------------------------------------------------- +// Window handle +//----------------------------------------------------------------------------- +DECLARE_POINTER_HANDLE( PlatWindow_t ); +#define PLAT_WINDOW_INVALID ( (PlatWindow_t)0 ) + + +//----------------------------------------------------------------------------- +// Window creation +//----------------------------------------------------------------------------- +enum WindowCreateFlags_t +{ + WINDOW_CREATE_FULLSCREEN = 0x1, + WINDOW_CREATE_RESIZING = 0x2, + +}; + +PLATFORM_INTERFACE PlatWindow_t Plat_CreateWindow( void *hInstance, const char *pTitle, int nWidth, int nHeight, int nFlags ); + + +//----------------------------------------------------------------------------- +// Window title +//----------------------------------------------------------------------------- +PLATFORM_INTERFACE void Plat_SetWindowTitle( PlatWindow_t hWindow, const char *pTitle ); + + +//----------------------------------------------------------------------------- +// Window movement +//----------------------------------------------------------------------------- +PLATFORM_INTERFACE void Plat_SetWindowPos( PlatWindow_t hWindow, int x, int y ); + + +//----------------------------------------------------------------------------- +// Gets the desktop resolution +//----------------------------------------------------------------------------- +PLATFORM_INTERFACE void Plat_GetDesktopResolution( int *pWidth, int *pHeight ); + + +//----------------------------------------------------------------------------- +// Gets a window size +//----------------------------------------------------------------------------- +PLATFORM_INTERFACE void Plat_GetWindowClientSize( PlatWindow_t hWindow, int *pWidth, int *pHeight ); + + +//----------------------------------------------------------------------------- +// Is the window minimized? +//----------------------------------------------------------------------------- +PLATFORM_INTERFACE bool Plat_IsWindowMinimized( PlatWindow_t hWindow ); + + +//----------------------------------------------------------------------------- +// Gets the shell window in a console app +//----------------------------------------------------------------------------- +PLATFORM_INTERFACE PlatWindow_t Plat_GetShellWindow( ); + + +//----------------------------------------------------------------------------- +// Convert window -> Screen coordinates and back +//----------------------------------------------------------------------------- +PLATFORM_INTERFACE void Plat_WindowToScreenCoords( PlatWindow_t hWnd, int &x, int &y ); +PLATFORM_INTERFACE void Plat_ScreenToWindowCoords( PlatWindow_t hWnd, int &x, int &y ); + + +#endif // PLATWINDOW_H diff --git a/src/public/tier1/tier1.h b/src/public/tier1/tier1.h new file mode 100644 index 00000000..47b69b90 --- /dev/null +++ b/src/public/tier1/tier1.h @@ -0,0 +1,25 @@ +//===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======// +// +// Purpose: A higher level link library for general use in the game and tools. +// +//===========================================================================// +#ifndef TIER1_H +#define TIER1_H +#include "appframework/IAppSystem.h" + +//----------------------------------------------------------------------------- +// Helper empty implementation of an IAppSystem for tier2 libraries +//----------------------------------------------------------------------------- +template< class IInterface, int ConVarFlag = 0 > +class CTier1AppSystem : public CTier0AppSystem< IInterface > +{ + virtual bool Connect( const CreateInterfaceFn factory ) = 0; + virtual void Disconnect( ) = 0; + virtual void* QueryInterface( const char* const pInterfaceName ) = 0; + virtual InitReturnVal_t Init( ) = 0; + virtual void Shutdown( ) = 0; + virtual AppSystemTier_t GetTier( ) = 0; + virtual void Reconnect( const CreateInterfaceFn factory, const char* const pInterfaceName ) = 0; +}; + +#endif // TIER1_H diff --git a/src/vpc/interfaces.h b/src/vpc/interfaces.h index 143f3068..074aae5f 100644 --- a/src/vpc/interfaces.h +++ b/src/vpc/interfaces.h @@ -81,6 +81,6 @@ class VFactory : public IDetour .FollowNearCallSelf().FindPatternSelf("48 8B 1D", CMemory::Direction::DOWN).ResolveRelativeAddressSelf(0x3, 0x7).RCast(); } virtual void GetCon(void) const { } - virtual void Detour(const bool bAttach) const { } + virtual void Detour(const bool /*bAttach*/) const { } }; ///////////////////////////////////////////////////////////////////////////////