Skip to content

Commit b56a297

Browse files
committed
fix: accidental code change
1 parent 9f62e9e commit b56a297

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

UE4SS/src/Mod/LuaMod.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4217,7 +4217,28 @@ No overload found for function 'FPackageName:IsValidLongPackageName'.
42174217
erase_from_container(this, m_local_player_exec_post_callbacks);
42184218
erase_from_container(this, m_script_hook_callbacks);
42194219

4220-
UE4SSProgram::get_program().unregister_keydown_events_for_lua_mod(this);
4220+
UE4SSProgram::get_program().get_all_input_events([&](auto& key_set) {
4221+
std::erase_if(key_set.key_data,
4222+
[&](auto& item) -> bool {
4223+
auto& [_, key_data] = item;
4224+
std::erase_if(key_data,
4225+
[&](Input::KeyData& key_data) -> bool {
4226+
// custom_data == 1: Bind came from Lua, and custom_data2 is a pointer to LuaMod.
4227+
// custom_data == 2: Bind came from C++, and custom_data2 is a pointer to KeyDownEventData. Must free it.
4228+
if (key_data.custom_data == 1)
4229+
{
4230+
return key_data.custom_data2 == this;
4231+
}
4232+
else
4233+
{
4234+
return false;
4235+
}
4236+
});
4237+
4238+
return key_data.empty();
4239+
});
4240+
});
4241+
42214242

42224243
if (m_hook_lua != nullptr)
42234244
{

0 commit comments

Comments
 (0)