Disable CMD executor if in-game keyboard is active (#3656)

This commit is contained in:
Arthur 2024-09-05 21:02:40 +03:00 committed by GitHub
parent 95df14f755
commit 21d8a81756
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 22 additions and 1 deletions

View File

@ -228,4 +228,6 @@ namespace big::functions
using is_ped_enemies_with = bool (*)(CPedIntelligence* from, CPed* target, bool check_relationship, bool skip_friend_check, bool skip_combat_task_check); using is_ped_enemies_with = bool (*)(CPedIntelligence* from, CPed* target, bool check_relationship, bool skip_friend_check, bool skip_combat_task_check);
using can_do_damage_to_ped = bool (*)(CPed* from, CWeaponInfo* current_weapon, CPed* target); using can_do_damage_to_ped = bool (*)(CPed* from, CWeaponInfo* current_weapon, CPed* target);
using get_last_keyboard_state = KeyboardState (*)();
} }

View File

@ -2806,4 +2806,12 @@ enum HudColors : int //https://docs.fivem.net/docs/game-references/hud-colors/
HUD_COLOUR_PLACEHOLDER_09, HUD_COLOUR_PLACEHOLDER_09,
HUD_COLOUR_PLACEHOLDER_10, HUD_COLOUR_PLACEHOLDER_10,
HUD_COLOUR_JUNK_ENERGY HUD_COLOUR_JUNK_ENERGY
};
enum KeyboardState : int32_t
{
INVALID = -1,
ACTIVE,
COMPLETED,
CANCELED
}; };

View File

@ -415,6 +415,8 @@ namespace big
bool* m_allow_keyboard_layout_change; bool* m_allow_keyboard_layout_change;
InputMethodEditor* m_ime; InputMethodEditor* m_ime;
functions::get_last_keyboard_state m_get_last_keyboard_state;
}; };
#pragma pack(pop) #pragma pack(pop)
static_assert(sizeof(gta_pointers) % 8 == 0, "Pointers are not properly aligned"); static_assert(sizeof(gta_pointers) % 8 == 0, "Pointers are not properly aligned");

View File

@ -1968,6 +1968,15 @@ namespace big
g_pointers->m_gta.m_allow_keyboard_layout_change = ptr.sub(4).rip().as<bool*>(); g_pointers->m_gta.m_allow_keyboard_layout_change = ptr.sub(4).rip().as<bool*>();
g_pointers->m_gta.m_ime = ptr.add(44).rip().sub(0x278 + 0x8).as<InputMethodEditor*>(); g_pointers->m_gta.m_ime = ptr.add(44).rip().sub(0x278 + 0x8).as<InputMethodEditor*>();
} }
},
// Get Last Keyboard State
{
"GLKS",
"33 C9 38 0D ? ? ? ? 74 ? 8B 05 ? ? ? ? 38 0D",
[](memory::handle ptr)
{
g_pointers->m_gta.m_get_last_keyboard_state = ptr.as<functions::get_last_keyboard_state>();
}
} }
>(); // don't leave a trailing comma at the end >(); // don't leave a trailing comma at the end

View File

@ -579,7 +579,7 @@ namespace big
void view::cmd_executor() void view::cmd_executor()
{ {
if (!g.cmd_executor.enabled) if (!g.cmd_executor.enabled || g_pointers->m_gta.m_get_last_keyboard_state() == KeyboardState::ACTIVE)
return; return;
float screen_x = (float)*g_pointers->m_gta.m_resolution_x; float screen_x = (float)*g_pointers->m_gta.m_resolution_x;