Make 'sig_getadr' a console command

Changed to hidden ConCommand.
This commit is contained in:
Kawe Mazidjatari 2023-03-15 21:11:20 +01:00
parent 49310426fc
commit cac2c6a917
4 changed files with 22 additions and 8 deletions

View File

@ -386,6 +386,9 @@ void ConCommand::Init(void)
// NETCHANNEL |
ConCommand::Create("net_setkey", "Sets user specified base64 net key.", nullptr, FCVAR_RELEASE, NET_SetKey_f, nullptr);
ConCommand::Create("net_generatekey", "Generates and sets a random base64 net key.", nullptr, FCVAR_RELEASE, NET_GenerateKey_f, nullptr);
//-------------------------------------------------------------------------
// TIER0 |
ConCommand::Create("sig_getadr", "Logs the sigscan results to the console.", nullptr, FCVAR_DEVELOPMENTONLY | FCVAR_HIDDEN, SIG_GetAdr_f, nullptr);
}
//-----------------------------------------------------------------------------

View File

@ -5,6 +5,7 @@
//=============================================================================//
#include "core/stdafx.h"
#include "core/init.h"
#include "windows/id3dx.h"
#include "tier0/fasttimer.h"
#include "tier1/cvar.h"
@ -737,6 +738,20 @@ void NET_UseRandomKeyChanged_f(IConVar* pConVar, const char* pOldString, float f
NET_SetKey(DEFAULT_NET_ENCRYPTION_KEY);
}
}
/*
=====================
SIG_GetAdr_f
Logs the sigscan
results to the console.
=====================
*/
void SIG_GetAdr_f(const CCommand& args)
{
DetourAddress();
}
/*
=====================
CON_Help_f

View File

@ -40,6 +40,7 @@ void VPK_Unmount_f(const CCommand& args);
void NET_SetKey_f(const CCommand& args);
void NET_GenerateKey_f(const CCommand& args);
void NET_UseRandomKeyChanged_f(IConVar* pConVar, const char* pOldString, float flOldValue);
void SIG_GetAdr_f(const CCommand& args);
void CON_Help_f(const CCommand& args);
#ifndef DEDICATED
void CON_LogHistory_f(const CCommand& args);

View File

@ -110,6 +110,7 @@ void Console_Init()
MessageBoxA(NULL, "Failed to set console mode 'VirtualTerminalLevel'.\n"
"Please omit the '-ansiclr' parameter and restart \nthe game if output logging appears distorted.", "SDK Warning", MB_ICONEXCLAMATION | MB_OK);
}
SetConsoleBackgroundColor(0x00000000);
AnsiColors_Init();
}
@ -122,7 +123,6 @@ void Console_Init()
DWORD __stdcall ProcessConsoleWorker(LPVOID)
{
// Loop forever
while (true)
{
static std::string sCommand = "";
@ -131,17 +131,12 @@ DWORD __stdcall ProcessConsoleWorker(LPVOID)
//-- Get the user input on the debug console
std::getline(std::cin, sCommand);
//-- Debug toggles
if (sCommand == "sig_getadr") { DetourAddress(); continue; }
// Execute the command.
Cbuf_AddText(Cbuf_GetCurrentPlayer(), sCommand.c_str(), cmd_source_t::kCommandSrcCode);
//g_TaskScheduler->Dispatch(Cbuf_Execute, 0);
sCommand.clear();
if (!sCommand.empty())
sCommand.clear();
///////////////////////////////////////////////////////////////////////
// Sleep and loop
Sleep(50);
}
return NULL;