diff --git a/src/client/component/lui.cpp b/src/client/component/lui.cpp index 53f652b4..0738d570 100644 --- a/src/client/component/lui.cpp +++ b/src/client/component/lui.cpp @@ -5,16 +5,67 @@ #include "command.hpp" #include "console.hpp" +#include "scheduler.hpp" #include namespace lui { + namespace + { + uint64_t event_count{}; + bool begin_game_message_event_stub(int a1, const char* name, void* a3) + { + if (event_count > 30) + { + return false; + } + else + { + event_count++; + } + + return utils::hook::invoke(0x2655A0_b, a1, name, a3); + } + } + class component final : public component_interface { public: void post_unpack() override { + if (game::environment::is_mp()) + { + // Patch game message overflow + utils::hook::call(0x266E6B_b, begin_game_message_event_stub); + + scheduler::loop([]() + { + if (event_count > 0) + { + event_count--; + } + }, scheduler::pipeline::lui, 50ms); + } + + // Increase max extra LUI memory + /*const auto max_memory = 0x900000 * 2; + utils::hook::set(0x278E61_b - 4, max_memory); + utils::hook::set(0x27A2C5_b - 4, max_memory); + utils::hook::set(0x27A993_b - 4, max_memory); + utils::hook::set(0x27AB3A_b - 4, max_memory); + utils::hook::set(0x27AB35_b - 4, max_memory); + utils::hook::set(0x27C002_b - 4, max_memory);*/ + + // Increase max extra frontend memory + /*const auto max_frontend_memory = 0x180000 * 2; + utils::hook::set(0x278EA6_b - 4, max_frontend_memory); + utils::hook::set(0x278F01_b - 4, max_frontend_memory); + utils::hook::set(0x27A2D4_b - 4, max_frontend_memory); + utils::hook::set(0x27A2E3_b - 4, max_frontend_memory); + utils::hook::set(0x27F9E9_b - 4, max_frontend_memory); + utils::hook::set(0x27FA84_b - 4, max_frontend_memory);*/ + command::add("lui_open", [](const command::params& params) { if (params.size() <= 1) diff --git a/src/client/game/symbols.hpp b/src/client/game/symbols.hpp index cbe7db08..58f2d64b 100644 --- a/src/client/game/symbols.hpp +++ b/src/client/game/symbols.hpp @@ -295,6 +295,7 @@ namespace game WEAK symbol hksi_lua_getinfo{0xB84D0, 0x22FFE0}; WEAK symbol hksi_lua_getstack{0xB87A0, 0x2302B0}; WEAK symbol hksi_luaL_error{0xBF120, 0x22F930}; + WEAK symbol hksi_lua_gc{0, 0x236EF0}; WEAK symbol typenames{0x98CD20, 0x10AD750}; } }