Fixes and update command structure
This commit is contained in:
parent
7dc18695d4
commit
e43a645712
2
deps/mongoose
vendored
2
deps/mongoose
vendored
@ -1 +1 @@
|
||||
Subproject commit 36405545033489ccfeb6c139c6e609998efc3cf9
|
||||
Subproject commit 5f93f7162f23949050335e9b1518c90a9fc0944d
|
2
deps/protobuf
vendored
2
deps/protobuf
vendored
@ -1 +1 @@
|
||||
Subproject commit 96a9d97352436c7284e8194e103ca8d92649ad02
|
||||
Subproject commit 9b8da104c12a2947b6e6d7a7da30a3ae56b31675
|
@ -70,9 +70,9 @@ namespace Components
|
||||
Command::FunctionMapSV[command] = callback;
|
||||
}
|
||||
|
||||
void Command::AddRaw(const char* name, void(*callback)())
|
||||
void Command::AddRaw(const char* name, void(*callback)(), bool key)
|
||||
{
|
||||
Game::Cmd_AddCommand(name, callback, Command::Allocate(), 0);
|
||||
Game::Cmd_AddCommand(name, callback, Command::Allocate(), key);
|
||||
}
|
||||
|
||||
void Command::AddRawSV(const char* name, void(*callback)())
|
||||
@ -145,6 +145,8 @@ namespace Components
|
||||
|
||||
Command::Command()
|
||||
{
|
||||
Assert_Size(Game::cmd_function_t, 24);
|
||||
|
||||
// Disable native noclip command
|
||||
Utils::Hook::Nop(0x474846, 5);
|
||||
|
||||
|
@ -34,7 +34,7 @@ namespace Components
|
||||
|
||||
static void Add(const char* name, Callback* callback);
|
||||
static void AddSV(const char* name, Callback* callback);
|
||||
static void AddRaw(const char* name, void(*callback)());
|
||||
static void AddRaw(const char* name, void(*callback)(), bool key = false);
|
||||
static void AddRawSV(const char* name, void(*callback)());
|
||||
static void Execute(std::string command, bool sync = true);
|
||||
|
||||
|
@ -402,7 +402,15 @@ namespace Components
|
||||
// Force process termination
|
||||
// if the main thread is not responding
|
||||
OutputDebugStringA("Process termination forced, as the main thread is not responding!");
|
||||
ExitProcess(static_cast<uint32_t>(-1));
|
||||
|
||||
// We can not force the termination in this thread
|
||||
// The destructor would be called in this thread
|
||||
// and would try to join this thread, which is impossible
|
||||
std::thread([] ()
|
||||
{
|
||||
std::this_thread::sleep_for(200ms);
|
||||
ExitProcess(static_cast<uint32_t>(-1));
|
||||
}).detach();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -58,11 +58,11 @@ namespace Components
|
||||
|
||||
Lean::Lean()
|
||||
{
|
||||
Game::Cmd_AddCommand("+leanleft", Lean::IN_LeanLeft_Down, Command::Allocate(), 1);
|
||||
Game::Cmd_AddCommand("-leanleft", Lean::IN_LeanLeft_Up, Command::Allocate(), 1);
|
||||
Command::AddRaw("+leanleft", Lean::IN_LeanLeft_Down, true);
|
||||
Command::AddRaw("-leanleft", Lean::IN_LeanLeft_Up, true);
|
||||
|
||||
Game::Cmd_AddCommand("+leanright", Lean::IN_LeanRight_Down, Command::Allocate(), 1);
|
||||
Game::Cmd_AddCommand("-leanright", Lean::IN_LeanRight_Up, Command::Allocate(), 1);
|
||||
Command::AddRaw("+leanright", Lean::IN_LeanRight_Down, true);
|
||||
Command::AddRaw("-leanright", Lean::IN_LeanRight_Up, true);
|
||||
|
||||
Utils::Hook(0x5A6D84, Lean::CL_CmdButtonsStub, HOOK_CALL).Install()->Quick();
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ namespace Game
|
||||
typedef void(__cdecl * CL_SelectStringTableEntryInDvar_f_t)();
|
||||
extern CL_SelectStringTableEntryInDvar_f_t CL_SelectStringTableEntryInDvar_f;
|
||||
|
||||
typedef void(__cdecl * Cmd_AddCommand_t)(const char* cmdName, void(*function), cmd_function_t* allocedCmd, char);
|
||||
typedef void(__cdecl * Cmd_AddCommand_t)(const char* cmdName, void(*function), cmd_function_t* allocedCmd, bool isKey);
|
||||
extern Cmd_AddCommand_t Cmd_AddCommand;
|
||||
|
||||
typedef void(__cdecl * Cmd_AddServerCommand_t)(const char* name, void(*callback), cmd_function_t* data);
|
||||
|
@ -136,7 +136,7 @@ namespace Game
|
||||
const char *autoCompleteDir;
|
||||
const char *autoCompleteExt;
|
||||
void(__cdecl *function)();
|
||||
int unknown;
|
||||
bool isKey; // Looks like this is true when the command is a key/button
|
||||
} cmd_function_t;
|
||||
|
||||
#pragma pack(push, 4)
|
||||
|
Loading…
Reference in New Issue
Block a user