some stuff

This commit is contained in:
Skull Merlin
2022-05-17 22:56:11 +03:00
parent 4a8dcfaf9e
commit 7f1d5e9b20
8 changed files with 101 additions and 107 deletions

View File

@ -41,8 +41,8 @@ namespace branding
if (game::environment::is_mp())
{
//localized_strings::override("LUA_MENU_MULTIPLAYER_CAPS", "H1-MOD: MULTIPLAYER\n");
//localized_strings::override("MENU_MULTIPLAYER_CAPS", "H1-MOD: MULTIPLAYER");
localized_strings::override("LUA_MENU_MULTIPLAYER_CAPS", "H1-MOD: MULTIPLAYER\n");
localized_strings::override("MENU_MULTIPLAYER_CAPS", "H1-MOD: MULTIPLAYER");
}
//dvars::override::set_string("version", utils::string::va("H1-Mod %s", VERSION));

View File

@ -96,7 +96,7 @@ namespace colors
const size_t unk, const size_t unk2)
{
// CL_GetClientName (CL_GetClientNameAndClantag?)
const auto result = utils::hook::invoke<size_t>(0x14025BAA0, local_client_num, index, buf, size, unk, unk2);
const auto result = utils::hook::invoke<size_t>(0x343BA0_b, local_client_num, index, buf, size, unk, unk2);
utils::string::strip(buf, buf, size);
@ -109,11 +109,11 @@ namespace colors
if (index == '8')
{
*color = *reinterpret_cast<DWORD*>(SELECT_VALUE(0x14F142FF8, 0x14FE70634)); // H1(1.4)
*color = *reinterpret_cast<DWORD*>(SELECT_VALUE(0x0, 0xEA749B4_b)); // 1.15
}
else if (index == '9')
{
*color = *reinterpret_cast<DWORD*>(SELECT_VALUE(0x14F142FFC, 0x14FE70638)); // H1(1.4)
*color = *reinterpret_cast<DWORD*>(SELECT_VALUE(0x0, 0xEA749B8_b)); // 1.15
}
else if (index == ':')
{
@ -121,7 +121,7 @@ namespace colors
}
else if (index == ';')
{
*color = *reinterpret_cast<DWORD*>(SELECT_VALUE(0x14F143004, 0x14FE70640)); // H1(1.4)
*color = *reinterpret_cast<DWORD*>(SELECT_VALUE(0x0, 0xEA749C0_b)); // 1.15
}
else if (index == '<')
{
@ -147,17 +147,17 @@ namespace colors
if (!game::environment::is_sp())
{
// allows colored name in-game
utils::hook::jump(0x140503810, com_clean_name_stub); // H1(1.4)
utils::hook::jump(0x5AEDF0_b, com_clean_name_stub); // 1.15
// don't apply colors to overhead names
utils::hook::call(0x1400AB416, get_client_name_stub); // H1(1.4)
utils::hook::call(0xF7B85_b, get_client_name_stub); // 1.15
// patch I_CleanStr
utils::hook::jump(0x140503D00, i_clean_str_stub); // H1(1.4)
utils::hook::jump(0x5AF2E0_b, i_clean_str_stub); // 1.15
}
// force new colors
utils::hook::jump(SELECT_VALUE(0x140524BD0, 0x1406206A0), rb_lookup_color_stub); // H1(1.4)
utils::hook::jump(SELECT_VALUE(0x0, 0x6C9460_b), rb_lookup_color_stub); // 1.15
// add colors
add(0, 0, 0); // 0 - Black
@ -179,4 +179,4 @@ namespace colors
};
}
//REGISTER_COMPONENT(colors::component)
REGISTER_COMPONENT(colors::component)

View File

@ -28,7 +28,6 @@ namespace console
while (true)
{
std::getline(std::cin, cmd);
}
return 0;
@ -47,11 +46,7 @@ namespace console
void dispatch_message(const int type, const std::string& message)
{
//if (native_console())
//{
printf("%s\n", message.data());
// return;
//}
//game_console::print(type, message);
//messages.access([&message](message_queue& msgs)

View File

@ -66,10 +66,10 @@ namespace input
return;
}
cl_char_event_hook.create(SELECT_VALUE(0x1401871A0, 0x14024E810), cl_char_event_stub);
cl_key_event_hook.create(SELECT_VALUE(0x1401874D0, 0x14024EA60), cl_key_event_stub);
cl_char_event_hook.create(SELECT_VALUE(0x0, 0x12C8F0_b), cl_char_event_stub);
cl_key_event_hook.create(SELECT_VALUE(0x0, 0x135A70_b), cl_key_event_stub);
}
};
}
//REGISTER_COMPONENT(input::component)
REGISTER_COMPONENT(input::component)

View File

@ -49,4 +49,4 @@ namespace localized_strings
};
}
//REGISTER_COMPONENT(localized_strings::component)
REGISTER_COMPONENT(localized_strings::component)

View File

@ -60,11 +60,11 @@ namespace network
// Command handled
a.popad64();
a.mov(al, 1);
a.jmp(0x140252AF8);
a.jmp(0x12FCAA_b);
a.bind(return_unhandled);
a.popad64();
a.jmp(0x14025234C);
a.jmp(0x12F3AC_b);
}
int net_compare_base_address(const game::netadr_s* a1, const game::netadr_s* a2)
@ -110,7 +110,7 @@ namespace network
if (net_interface && net_interface != "localhost"s)
{
// Sys_StringToSockaddr
utils::hook::invoke<void>(0x1404F6580, net_interface, &address);
utils::hook::invoke<void>(0x59E810_b, net_interface, &address);
}
address.sin_family = AF_INET;
@ -229,53 +229,52 @@ namespace network
}
// redirect dw_sendto to raw socket
//utils::hook::jump(0x1404D850A, reinterpret_cast<void*>(0x1404D849A));
utils::hook::call(0x140513467, dw_send_to_stub);
utils::hook::call(0x5BDB47_b, dw_send_to_stub);
utils::hook::jump(game::Sys_SendPacket, dw_send_to_stub);
// intercept command handling
utils::hook::jump(0x140252327, utils::hook::assemble(handle_command_stub), true);
utils::hook::jump(0x12F387_b, utils::hook::assemble(handle_command_stub), true);
// handle xuid without secure connection
utils::hook::nop(0x140486AAF, 6);
utils::hook::nop(0x554222_b, 6);
utils::hook::jump(0x140424F20, net_compare_address);
utils::hook::jump(0x140424F70, net_compare_base_address);
utils::hook::jump(0x4F1800_b, net_compare_address);
utils::hook::jump(0x4F1850_b, net_compare_base_address);
// don't establish secure conenction
utils::hook::set<uint8_t>(0x14027EA4D, 0xEB);
utils::hook::set<uint8_t>(0x14027EB1E, 0xEB);
utils::hook::set<uint8_t>(0x14027EF8D, 0xEB);
utils::hook::set<uint8_t>(0x14025081F, 0xEB);
utils::hook::set<uint8_t>(0x358C8D_b, 0xEB);
utils::hook::set<uint8_t>(0x358D5E_b, 0xEB);
utils::hook::set<uint8_t>(0x3591CD_b, 0xEB);
utils::hook::set<uint8_t>(0x12CD0F_b, 0xEB);
// ignore unregistered connection
utils::hook::jump(0x140480F46, 0x140480EE5);
utils::hook::set<uint8_t>(0x140480F3B, 0xEB);
utils::hook::jump(0x54E2D1_b, 0x54E270_b);
utils::hook::set<uint8_t>(0x54E2C6_b, 0xEB);
// disable xuid verification
utils::hook::set<uint8_t>(0x14005B62D, 0xEB);
utils::hook::set<uint8_t>(0x14005B649, 0xEB);
utils::hook::set<uint8_t>(0x728BF_b, 0xEB);
//utils::hook::set<uint8_t>(0x14005B649, 0xEB); // not found
// disable xuid verification
utils::hook::nop(0x14048382C, 2);
utils::hook::set<uint8_t>(0x140483889, 0xEB);
utils::hook::nop(0x5509D9_b, 2);
utils::hook::set<uint8_t>(0x550A36_b, 0xEB);
// ignore configstring mismatch
utils::hook::set<uint8_t>(0x1402591C9, 0xEB);
//utils::hook::set<uint8_t>(0x1402591C9, 0xEB); // not found
// ignore dw handle in SV_PacketEvent
utils::hook::set<uint8_t>(0x1404898E2, 0xEB);
utils::hook::call(0x1404898D6, &net_compare_address);
utils::hook::set<uint8_t>(0x1CBC22_b, 0xEB);
utils::hook::call(0x1CBC16_b, &net_compare_address);
// ignore dw handle in SV_FindClientByAddress
utils::hook::set<uint8_t>(0x140488EFD, 0xEB);
utils::hook::call(0x140488EF1, &net_compare_address);
utils::hook::set<uint8_t>(0x1CB24D_b, 0xEB);
utils::hook::call(0x1CB241_b, &net_compare_address);
// ignore dw handle in SV_DirectConnect
utils::hook::set<uint8_t>(0x140480C58, 0xEB);
utils::hook::set<uint8_t>(0x140480E6F, 0xEB);
utils::hook::call(0x140480C4B, &net_compare_address);
utils::hook::call(0x140480E62, &net_compare_address);
utils::hook::set<uint8_t>(0x54DFE8_b, 0xEB);
utils::hook::set<uint8_t>(0x54E1FD_b, 0xEB);
utils::hook::call(0x54DFDB_b, &net_compare_address);
utils::hook::call(0x54E1F0_b, &net_compare_address);
// increase cl_maxpackets
dvars::override::register_int("cl_maxpackets", 1000, 1, 1000, game::DVAR_FLAG_SAVED);
@ -284,31 +283,31 @@ namespace network
dvars::override::register_int("sv_remote_client_snapshot_msec", 33, 33, 100, game::DVAR_FLAG_NONE);
// ignore impure client
utils::hook::jump(0x140481B58, 0x140481BEE);
utils::hook::jump(0x54EDD3_b, 0x54EE69_b);
// don't send checksum
utils::hook::set<uint8_t>(0x1404F6398, 0);
utils::hook::set<uint8_t>(0x59E628_b, 0);
// don't read checksum
utils::hook::set(0x1404F6620, 0xC301B0);
utils::hook::set(0x59E8B0_b, 0xC301B0);
// don't try to reconnect client
utils::hook::call(0x140480DFF, reconnect_migratated_client);
utils::hook::nop(0x140480DDB, 4); // this crashes when reconnecting for some reason
utils::hook::call(0x54E18C_b, reconnect_migratated_client);
utils::hook::nop(0x54E168_b, 4); // this crashes when reconnecting for some reason
// allow server owner to modify net_port before the socket bind
utils::hook::call(0x140512BE5, register_netport_stub);
utils::hook::call(0x140512D20, register_netport_stub);
utils::hook::call(0x5BD2B5_b, register_netport_stub);
utils::hook::call(0x5BD3F0_b, register_netport_stub);
// increase allowed packet size
const auto max_packet_size = 0x20000;
utils::hook::set<int>(0x1404255F1, max_packet_size);
utils::hook::set<int>(0x140425630, max_packet_size);
utils::hook::set<int>(0x140425522, max_packet_size);
utils::hook::set<int>(0x140425545, max_packet_size);
utils::hook::set<int>(0x4F1ED1_b, max_packet_size);
utils::hook::set<int>(0x4F1F10_b, max_packet_size);
utils::hook::set<int>(0x4F1E02_b, max_packet_size);
utils::hook::set<int>(0x4F1E25_b, max_packet_size);
// ignore built in "print" oob command and add in our own
utils::hook::set<uint8_t>(0x14025280E, 0xEB);
utils::hook::set<uint8_t>(0x12F817_b, 0xEB);
on("print", [](const game::netadr_s&, const std::string_view& data)
{
const std::string message{data};
@ -317,7 +316,7 @@ namespace network
// Use our own socket since the game's socket doesn't work with non localhost addresses
// why? no idea
utils::hook::jump(0x140512B40, create_socket);
utils::hook::jump(0x5BD210_b, create_socket);
}
}
};

View File

@ -185,22 +185,22 @@ namespace ui_scripting
scheduler::loop(ui_scripting::lua::engine::run_frame, scheduler::pipeline::lui);
hks_start_hook.create(SELECT_VALUE(0x1400E4B40, 0x140176A40), hks_start_stub);
hks_shutdown_hook.create(SELECT_VALUE(0x1400DD3D0, 0x14016CA80), hks_shutdown_stub);
hksi_lual_error_hook.create(SELECT_VALUE(0x1400A5EA0, 0x14012F300), hksi_lual_error_stub);
hks_allocator_hook.create(SELECT_VALUE(0x14009B570, 0x14012BAC0), hks_allocator_stub);
lui_error_hook.create(SELECT_VALUE(0x14007D7D0, 0x14010C9E0), lui_error_stub);
hksi_hks_error_hook.create(SELECT_VALUE(0x14009DD80, 0x14012E390), hksi_hks_error_stub);
hks_start_hook.create(SELECT_VALUE(0x0, 0x27A790_b), hks_start_stub); // 1.15
hks_shutdown_hook.create(SELECT_VALUE(0x0, 0x2707C0_b), hks_shutdown_stub); // 1.15
hksi_lual_error_hook.create(SELECT_VALUE(0x0, 0x22F930_b), hksi_lual_error_stub); // 1.15
hks_allocator_hook.create(SELECT_VALUE(0x0, 0x22C010_b), hks_allocator_stub); // 1.15
lui_error_hook.create(SELECT_VALUE(0x0, 0x20BA80_b), lui_error_stub); // 1.15
hksi_hks_error_hook.create(SELECT_VALUE(0x0, 0x22EA10_b), hksi_hks_error_stub); // 1.15
if (game::environment::is_mp())
{
hksi_lual_error_hook2.create(0x1401366B0, hksi_lual_error_stub);
hksi_lual_error_hook2.create(0x2365E0_b, hksi_lual_error_stub); // 1.15
}
command::add("lui_restart", []()
{
utils::hook::invoke<void>(SELECT_VALUE(0x1400DD3D0, 0x14016CA80));
utils::hook::invoke<void>(SELECT_VALUE(0x1400E6170, 0x1401780D0));
utils::hook::invoke<void>(SELECT_VALUE(0x0, 0x2707C0_b)); // 1.15
utils::hook::invoke<void>(SELECT_VALUE(0x0, 0x27BEC0_b)); // 1.15
});
}
};