dvar dump command
This commit is contained in:
parent
036443c9ea
commit
e2b6c69b79
@ -19,6 +19,8 @@ namespace game
|
||||
Dvar_SetFromStringByName_t Dvar_SetFromStringByName;
|
||||
Dvar_SetString_t Dvar_SetString;
|
||||
|
||||
Dvar_DisplayableValue_t Dvar_DisplayableValue;
|
||||
|
||||
G_RunFrame_t G_RunFrame;
|
||||
G_GetWeaponForName_t G_GetWeaponForName;
|
||||
|
||||
@ -122,6 +124,9 @@ namespace game
|
||||
int* sys_timeBase;
|
||||
unsigned __int64* sys_counterBase;
|
||||
|
||||
int* dvarCount;
|
||||
dvar_t** sortedDvars;
|
||||
|
||||
namespace mp
|
||||
{
|
||||
SV_GetGuid_t SV_GetGuid;
|
||||
@ -983,6 +988,8 @@ namespace game
|
||||
SELECT_VALUE(0x4DD090, 0x5BF740, 0x518DF0));
|
||||
native::Dvar_SetString = native::Dvar_SetString_t(SELECT_VALUE(0x540570, 0x5BF3E0, 0x0));
|
||||
|
||||
native::Dvar_DisplayableValue = native::Dvar_DisplayableValue_t(SELECT_VALUE(0x4AB1D0, 0x5BD260, 0x0));
|
||||
|
||||
native::G_RunFrame = native::G_RunFrame_t(SELECT_VALUE(0x52EAA0, 0x50CB70, 0x48AD60));
|
||||
native::G_GetWeaponForName = native::G_GetWeaponForName_t(SELECT_VALUE(0x495E40, 0x531070, 0x0));
|
||||
|
||||
@ -1107,5 +1114,8 @@ namespace game
|
||||
native::initialized_0 = reinterpret_cast<int*>(SELECT_VALUE(0x1CE1CA0, 0x5AA3058, 0x62F4F9C));
|
||||
native::sys_timeBase = reinterpret_cast<int*>(SELECT_VALUE(0x1CE1C98, 0x5AA3050, 0x5950CE4));
|
||||
native::sys_counterBase = reinterpret_cast<unsigned __int64*>(SELECT_VALUE(0x1CE1C90, 0x5AA3048, 0x5950CE8));
|
||||
|
||||
native::dvarCount = reinterpret_cast<int*>(SELECT_VALUE(0x1C42398, 0x59CCDD8, 0x5879644));
|
||||
native::sortedDvars = reinterpret_cast<native::dvar_t**>(SELECT_VALUE(0x1C423C0, 0x59CCE00, 0x587C5D8));
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,9 @@ namespace game
|
||||
typedef void (*Dvar_SetString_t)(const dvar_t* dvar, const char* value);
|
||||
extern Dvar_SetString_t Dvar_SetString;
|
||||
|
||||
typedef const char* (*Dvar_DisplayableValue_t)(const dvar_t* dvar);
|
||||
extern Dvar_DisplayableValue_t Dvar_DisplayableValue;
|
||||
|
||||
typedef int (*G_RunFrame_t)(int, int);
|
||||
extern G_RunFrame_t G_RunFrame;
|
||||
|
||||
@ -196,6 +199,9 @@ namespace game
|
||||
extern int* sys_timeBase;
|
||||
extern unsigned __int64* sys_counterBase;
|
||||
|
||||
extern int* dvarCount;
|
||||
extern dvar_t** sortedDvars;
|
||||
|
||||
// Global Definitions & Functions
|
||||
constexpr auto JUMP_LAND_SLOWDOWN_TIME = 1800;
|
||||
|
||||
|
@ -1,11 +1,14 @@
|
||||
#include <std_include.hpp>
|
||||
#include <loader/module_loader.hpp>
|
||||
#include <utils/string.hpp>
|
||||
#include <utils/hook.hpp>
|
||||
|
||||
#include "game/game.hpp"
|
||||
|
||||
#include <utils/string.hpp>
|
||||
#include <utils/hook.hpp>
|
||||
#include <utils/io.hpp>
|
||||
|
||||
#include "command.hpp"
|
||||
#include "log_file.hpp"
|
||||
|
||||
|
||||
utils::memory::allocator command::allocator_;
|
||||
std::unordered_map<std::string, std::function<void(const command::params&)>> command::handlers;
|
||||
@ -366,6 +369,33 @@ void command::post_load()
|
||||
}
|
||||
|
||||
add("quit", game::native::Com_Quit_f);
|
||||
add("dvarDump", [](const params& params)
|
||||
{
|
||||
if (params.size() < 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::string file_name = "userraw/";
|
||||
file_name.append(params.get(1));
|
||||
if (!file_name.ends_with(".txt"))
|
||||
{
|
||||
file_name.append(".txt");
|
||||
}
|
||||
|
||||
for (auto i = 0; i < *game::native::dvarCount; ++i)
|
||||
{
|
||||
const auto* dvar = game::native::sortedDvars[i];
|
||||
|
||||
if (dvar != nullptr)
|
||||
{
|
||||
const auto* line = utils::string::va("%s \"%s\"\r\n", dvar->name, game::native::Dvar_DisplayableValue(dvar));
|
||||
utils::io::write_file(file_name, line, i != 0);
|
||||
}
|
||||
}
|
||||
|
||||
log_file::info("%i dvars\n", *game::native::dvarCount);
|
||||
});
|
||||
|
||||
if (game::is_mp())
|
||||
{
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user