Move sm_dump_admcache to AdminCache.
This commit is contained in:
parent
8b4f27a038
commit
c614d19af0
@ -35,7 +35,7 @@ namespace SourceMod {
|
|||||||
|
|
||||||
// Add 1 to the RHS of this expression to bump the intercom file
|
// Add 1 to the RHS of this expression to bump the intercom file
|
||||||
// This is to prevent mismatching core/logic binaries
|
// This is to prevent mismatching core/logic binaries
|
||||||
static const uint32_t SM_LOGIC_MAGIC = 0x0F47C0DE - 51;
|
static const uint32_t SM_LOGIC_MAGIC = 0x0F47C0DE - 52;
|
||||||
|
|
||||||
} // namespace SourceMod
|
} // namespace SourceMod
|
||||||
|
|
||||||
|
@ -69,7 +69,6 @@ struct sm_logic_t
|
|||||||
void (*GenerateError)(IPluginContext *, cell_t, int, const char *, ...);
|
void (*GenerateError)(IPluginContext *, cell_t, int, const char *, ...);
|
||||||
void (*AddNatives)(sp_nativeinfo_t *natives);
|
void (*AddNatives)(sp_nativeinfo_t *natives);
|
||||||
void (*DumpHandles)(void (*dumpfn)(const char *fmt, ...));
|
void (*DumpHandles)(void (*dumpfn)(const char *fmt, ...));
|
||||||
bool (*DumpAdminCache)(const char *filename);
|
|
||||||
void (*RegisterProfiler)(IProfilingTool *tool);
|
void (*RegisterProfiler)(IProfilingTool *tool);
|
||||||
void (*OnRootCommand)(const ICommandArgs *args);
|
void (*OnRootCommand)(const ICommandArgs *args);
|
||||||
IDataPack * (*CreateDataPack)();
|
IDataPack * (*CreateDataPack)();
|
||||||
|
@ -271,6 +271,21 @@ void AdminCache::OnSourceModStartup(bool late)
|
|||||||
NameFlag("custom4", Admin_Custom4);
|
NameFlag("custom4", Admin_Custom4);
|
||||||
NameFlag("custom5", Admin_Custom5);
|
NameFlag("custom5", Admin_Custom5);
|
||||||
NameFlag("custom6", Admin_Custom6);
|
NameFlag("custom6", Admin_Custom6);
|
||||||
|
|
||||||
|
auto sm_dump_admcache = [this] (int client, const ICommandArgs *args) -> bool {
|
||||||
|
char buffer[PLATFORM_MAX_PATH];
|
||||||
|
g_pSM->BuildPath(Path_SM, buffer, sizeof(buffer), "data/admin_cache_dump.txt");
|
||||||
|
|
||||||
|
if (!DumpCache(buffer)) {
|
||||||
|
bridge->ConsolePrint("Could not open file for writing: %s", buffer);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bridge->ConsolePrint("Admin cache dumped to: %s", buffer);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
bridge->DefineCommand("sm_dump_admcache", "Dumps the admin cache for debugging", sm_dump_admcache);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdminCache::OnSourceModAllInitialized()
|
void AdminCache::OnSourceModAllInitialized()
|
||||||
|
@ -114,11 +114,6 @@ static void DumpHandles(void (*dumpfn)(const char *fmt, ...))
|
|||||||
g_HandleSys.Dump(dumpfn);
|
g_HandleSys.Dump(dumpfn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool DumpAdminCache(const char *filename)
|
|
||||||
{
|
|
||||||
return g_Admins.DumpCache(filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void RegisterProfiler(IProfilingTool *tool)
|
static void RegisterProfiler(IProfilingTool *tool)
|
||||||
{
|
{
|
||||||
g_ProfileToolManager.RegisterTool(tool);
|
g_ProfileToolManager.RegisterTool(tool);
|
||||||
@ -160,7 +155,6 @@ static sm_logic_t logic =
|
|||||||
GenerateError,
|
GenerateError,
|
||||||
AddNatives,
|
AddNatives,
|
||||||
DumpHandles,
|
DumpHandles,
|
||||||
DumpAdminCache,
|
|
||||||
RegisterProfiler,
|
RegisterProfiler,
|
||||||
OnRootCommand,
|
OnRootCommand,
|
||||||
CDataPack::New,
|
CDataPack::New,
|
||||||
|
@ -139,18 +139,3 @@ CON_COMMAND(sm_reload_translations, "Reparses all loaded translation files")
|
|||||||
{
|
{
|
||||||
translator->RebuildLanguageDatabase();
|
translator->RebuildLanguageDatabase();
|
||||||
}
|
}
|
||||||
|
|
||||||
CON_COMMAND(sm_dump_admcache, "Dumps the admin cache for debugging")
|
|
||||||
{
|
|
||||||
char buffer[PLATFORM_MAX_PATH];
|
|
||||||
g_SourceMod.BuildPath(Path_SM, buffer, sizeof(buffer), "data/admin_cache_dump.txt");
|
|
||||||
|
|
||||||
if (!logicore.DumpAdminCache(buffer))
|
|
||||||
{
|
|
||||||
UTIL_ConsolePrint("Could not open file for writing: %s", buffer);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
UTIL_ConsolePrint("Admin cache dumped to: %s", buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user