Fix bindings

This commit is contained in:
Federico Cecchetto 2022-05-30 20:46:21 +02:00
parent 8602b1a5c0
commit 907f5d0b11

View File

@ -15,7 +15,7 @@ namespace binding
int get_num_keys() int get_num_keys()
{ {
return 109; return 110;
} }
int key_write_bindings_to_buffer_stub(int /*localClientNum*/, char* buffer, const int buffer_size) int key_write_bindings_to_buffer_stub(int /*localClientNum*/, char* buffer, const int buffer_size)
@ -83,7 +83,7 @@ namespace binding
int key_get_binding_for_cmd_stub(const char* command) int key_get_binding_for_cmd_stub(const char* command)
{ {
// original binds // original binds
for (auto i = 0; i <= get_num_keys(); i++) for (auto i = 0; i < get_num_keys(); i++)
{ {
if (game::command_whitelist[i] && !strcmp(command, game::command_whitelist[i])) if (game::command_whitelist[i] && !strcmp(command, game::command_whitelist[i]))
{ {
@ -124,10 +124,10 @@ namespace binding
} }
// write all bindings to config file // write all bindings to config file
utils::hook::jump(SELECT_VALUE(0x1AC980_b, 0x199ED0_b), key_write_bindings_to_buffer_stub, true); utils::hook::jump(SELECT_VALUE(0x1AC980_b, 0x199ED0_b), key_write_bindings_to_buffer_stub);
// links a custom command to an index // links a custom command to an index
utils::hook::jump(SELECT_VALUE(0x377280_b, 0x1572B0_b), key_get_binding_for_cmd_stub, true); utils::hook::jump(SELECT_VALUE(0x377280_b, 0x1572B0_b), key_get_binding_for_cmd_stub);
// execute custom binds // execute custom binds
cl_execute_key_hook.create(SELECT_VALUE(0x1A8350_b, 0x130610_b), &cl_execute_key_stub); cl_execute_key_hook.create(SELECT_VALUE(0x1A8350_b, 0x130610_b), &cl_execute_key_stub);