From 8a7dfdbc1116f6d7a00b14edeb40667a0c7845bd Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 11 Sep 2015 01:52:39 -0700 Subject: [PATCH] Move the "sm" command to core/logic. --- bridge/include/BridgeAPI.h | 2 +- bridge/include/LogicProvider.h | 1 - core/AMBuilder | 1 - core/logic/RootConsoleMenu.cpp | 5 ++++ core/logic/common_logic.cpp | 6 ----- core/sm_srvcmds.cpp | 48 ---------------------------------- 6 files changed, 6 insertions(+), 57 deletions(-) delete mode 100644 core/sm_srvcmds.cpp diff --git a/bridge/include/BridgeAPI.h b/bridge/include/BridgeAPI.h index 702a0b4e..3845963e 100644 --- a/bridge/include/BridgeAPI.h +++ b/bridge/include/BridgeAPI.h @@ -35,7 +35,7 @@ namespace SourceMod { // Add 1 to the RHS of this expression to bump the intercom file // This is to prevent mismatching core/logic binaries -static const uint32_t SM_LOGIC_MAGIC = 0x0F47C0DE - 53; +static const uint32_t SM_LOGIC_MAGIC = 0x0F47C0DE - 54; } // namespace SourceMod diff --git a/bridge/include/LogicProvider.h b/bridge/include/LogicProvider.h index 4817379c..253084f8 100644 --- a/bridge/include/LogicProvider.h +++ b/bridge/include/LogicProvider.h @@ -69,7 +69,6 @@ struct sm_logic_t void (*GenerateError)(IPluginContext *, cell_t, int, const char *, ...); void (*AddNatives)(sp_nativeinfo_t *natives); void (*RegisterProfiler)(IProfilingTool *tool); - void (*OnRootCommand)(const ICommandArgs *args); IDataPack * (*CreateDataPack)(); void (*FreeDataPack)(IDataPack *pack); IScriptManager *scripts; diff --git a/core/AMBuilder b/core/AMBuilder index b4488a0c..7b25a9ce 100644 --- a/core/AMBuilder +++ b/core/AMBuilder @@ -36,7 +36,6 @@ project.sources += [ 'EventManager.cpp', 'MenuStyle_Radio.cpp', 'sm_autonatives.cpp', - 'sm_srvcmds.cpp', 'ConsoleDetours.cpp', 'vprof_tool.cpp', 'smn_commandline.cpp', diff --git a/core/logic/RootConsoleMenu.cpp b/core/logic/RootConsoleMenu.cpp index 265c8494..063ff4c7 100644 --- a/core/logic/RootConsoleMenu.cpp +++ b/core/logic/RootConsoleMenu.cpp @@ -57,6 +57,10 @@ void RootConsoleMenu::OnSourceModStartup(bool late) bridge->DefineCommand("sm_dump_handles", "Dumps Handle usage to a file for finding Handle leaks", sm_dump_handles); + bridge->DefineCommand("sm", "SourceMod Menu", [this] (int client, const ICommandArgs *args) -> bool { + GotRootCmd(args); + return true; + }); } void RootConsoleMenu::OnSourceModAllInitialized() @@ -281,4 +285,5 @@ static bool sm_dump_handles(int client, const ICommandArgs *args) g_HandleSys.Dump(write_handles_to_log); fclose(fp); + return true; } diff --git a/core/logic/common_logic.cpp b/core/logic/common_logic.cpp index d45c1ee7..a39ed8bd 100644 --- a/core/logic/common_logic.cpp +++ b/core/logic/common_logic.cpp @@ -114,11 +114,6 @@ static void RegisterProfiler(IProfilingTool *tool) g_ProfileToolManager.RegisterTool(tool); } -static void OnRootCommand(const ICommandArgs *args) -{ - g_RootMenu.GotRootCmd(args); -} - // Defined in smn_filesystem.cpp. extern bool OnLogPrint(const char *msg); @@ -150,7 +145,6 @@ static sm_logic_t logic = GenerateError, AddNatives, RegisterProfiler, - OnRootCommand, CDataPack::New, CDataPack::Free, &g_PluginSys, diff --git a/core/sm_srvcmds.cpp b/core/sm_srvcmds.cpp deleted file mode 100644 index 4e3ac856..00000000 --- a/core/sm_srvcmds.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/** - * vim: set ts=4 sw=4 tw=99 noet : - * ============================================================================= - * SourceMod - * Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved. - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - * As a special exception, AlliedModders LLC gives you permission to link the - * code of this program (as well as its derivative works) to "Half-Life 2," the - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software - * by the Valve Corporation. You must obey the GNU General Public License in - * all respects for all other code used. Additionally, AlliedModders LLC grants - * this exception to all derivative works. AlliedModders LLC defines further - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), - * or . - * - * Version: $Id$ - */ -#include "sourcemod.h" -#include "sourcemm_api.h" -#include "logic_bridge.h" -#include "sm_globals.h" -#include "CoreConfig.h" -#include "command_args.h" -#include -#include - -CON_COMMAND(sm, "SourceMod Menu") -{ -#if SOURCE_ENGINE <= SE_DARKMESSIAH - CCommand args; -#endif - EngineArgs cargs(args); - - logicore.OnRootCommand(&cargs); -}