From f9f75133993bbdac3c37f7bef07991d807dbd667 Mon Sep 17 00:00:00 2001 From: Nick Hastings Date: Sat, 1 Apr 2023 00:02:45 -0400 Subject: [PATCH] Create initial provider split between Source and Source 2. --- core/AMBuilder | 5 +++ core/provider/provider_base.cpp | 2 +- core/provider/source/provider_source.cpp | 30 +++++++++++++++++ core/provider/source/provider_source.h | 38 ++++++++++++++++++++++ core/provider/source2/provider_source2.cpp | 30 +++++++++++++++++ core/provider/source2/provider_source2.h | 38 ++++++++++++++++++++++ 6 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 core/provider/source/provider_source.cpp create mode 100644 core/provider/source/provider_source.h create mode 100644 core/provider/source2/provider_source2.cpp create mode 100644 core/provider/source2/provider_source2.h diff --git a/core/AMBuilder b/core/AMBuilder index 5c68cc0..db21466 100644 --- a/core/AMBuilder +++ b/core/AMBuilder @@ -28,6 +28,11 @@ for sdk_name in MMS.sdks: 'vsp_bridge.cpp' ] + if sdk_name in ['dota']: + binary.sources += ['provider/source2/provider_source2.cpp'] + else: + binary.sources += ['provider/source/provider_source.cpp'] + # Source2 hack. TODO: check this more deterministically, "are we doing an x64 build?" if binary.compiler.target.arch == 'x86': binary.sources += ['sourcehook/sourcehook_hookmangen.cpp'] diff --git a/core/provider/provider_base.cpp b/core/provider/provider_base.cpp index 2998f80..a33bd2c 100644 --- a/core/provider/provider_base.cpp +++ b/core/provider/provider_base.cpp @@ -109,7 +109,7 @@ IEngineServiceMgr *enginesvcmgr = NULL; IVEngineServer *engine = NULL; IServerGameClients *gameclients = NULL; CGlobalVars *gpGlobals = NULL; -IMetamodSourceProvider *provider = &g_Ep1Provider; + ConCommand meta_local_cmd("meta", LocalCommand_Meta, "Metamod:Source control options"); #if SOURCE_ENGINE == SE_DOTA diff --git a/core/provider/source/provider_source.cpp b/core/provider/source/provider_source.cpp new file mode 100644 index 0000000..8a2d0db --- /dev/null +++ b/core/provider/source/provider_source.cpp @@ -0,0 +1,30 @@ +/** + * vim: set ts=4 sw=4 tw=99 noet : + * ====================================================== + * Metamod:Source + * Copyright (C) 2004-2023 AlliedModders LLC and authors. + * All rights reserved. + * ====================================================== + * + * This software is provided 'as-is', without any express or implied warranty. + * In no event will the authors be held liable for any damages arising from + * the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software in a + * product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +#include "provider_source.h" + +static SourceProvider g_SourceProvider; + +IMetamodSourceProvider* provider = &g_SourceProvider; \ No newline at end of file diff --git a/core/provider/source/provider_source.h b/core/provider/source/provider_source.h new file mode 100644 index 0000000..6ce682e --- /dev/null +++ b/core/provider/source/provider_source.h @@ -0,0 +1,38 @@ +/** + * vim: set ts=4 : + * ====================================================== + * Metamod:Source + * Copyright (C) 2004-2023 AlliedModders LLC and authors. + * All rights reserved. + * ====================================================== + * + * This software is provided 'as-is', without any express or implied warranty. + * In no event will the authors be held liable for any damages arising from + * the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software in a + * product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + * Version: $Id$ + */ + +#ifndef _INCLUDE_METAMOD_SOURCE_SOURCE1_PROVIDER_H_ +#define _INCLUDE_METAMOD_SOURCE_SOURCE1_PROVIDER_H_ + +#include "../provider_base.h" + +class SourceProvider : public BaseProvider +{ + +}; + +#endif diff --git a/core/provider/source2/provider_source2.cpp b/core/provider/source2/provider_source2.cpp new file mode 100644 index 0000000..237868d --- /dev/null +++ b/core/provider/source2/provider_source2.cpp @@ -0,0 +1,30 @@ +/** + * vim: set ts=4 sw=4 tw=99 noet : + * ====================================================== + * Metamod:Source + * Copyright (C) 2004-2023 AlliedModders LLC and authors. + * All rights reserved. + * ====================================================== + * + * This software is provided 'as-is', without any express or implied warranty. + * In no event will the authors be held liable for any damages arising from + * the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software in a + * product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +#include "provider_source2.h" + +static Source2Provider g_Source2Provider; + +IMetamodSourceProvider* provider = &g_Source2Provider; \ No newline at end of file diff --git a/core/provider/source2/provider_source2.h b/core/provider/source2/provider_source2.h new file mode 100644 index 0000000..f623762 --- /dev/null +++ b/core/provider/source2/provider_source2.h @@ -0,0 +1,38 @@ +/** + * vim: set ts=4 : + * ====================================================== + * Metamod:Source + * Copyright (C) 2004-2023 AlliedModders LLC and authors. + * All rights reserved. + * ====================================================== + * + * This software is provided 'as-is', without any express or implied warranty. + * In no event will the authors be held liable for any damages arising from + * the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software in a + * product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + * Version: $Id$ + */ + +#ifndef _INCLUDE_METAMOD_SOURCE_SOURCE2_PROVIDER_H_ +#define _INCLUDE_METAMOD_SOURCE_SOURCE2_PROVIDER_H_ + +#include "../provider_base.h" + +class Source2Provider : public BaseProvider +{ + +}; + +#endif