t7x/src/client/component/dedicated_patches.cpp

44 lines
976 B
C++
Raw Normal View History

2023-01-09 17:03:43 -05:00
#include <std_include.hpp>
#include "loader/component_loader.hpp"
#include "game/game.hpp"
2023-02-23 03:55:36 -05:00
#include "scheduler.hpp"
2023-01-09 17:03:43 -05:00
#include <utils/hook.hpp>
2023-02-21 12:00:59 -05:00
namespace dedicated_patches
2023-01-09 17:03:43 -05:00
{
namespace
{
void scr_are_textures_loaded_stub([[maybe_unused]] game::scriptInstance_t inst)
{
game::Scr_AddInt(game::SCRIPTINSTANCE_SERVER, 1);
}
2023-02-23 03:55:36 -05:00
game::eNetworkModes get_online_mode()
{
return game::MODE_NETWORK_ONLINE;
}
2023-01-09 17:03:43 -05:00
}
struct component final : server_component
2023-01-09 17:03:43 -05:00
{
void post_unpack() override
{
// Fix infinite loop
utils::hook::jump(0x1402E86B0_g, scr_are_textures_loaded_stub);
2023-02-23 03:55:36 -05:00
utils::hook::jump(0x1405003E0_g, get_online_mode);
utils::hook::jump(0x1405003B0_g, get_online_mode);
scheduler::once([]()
{
game::Com_SessionMode_SetNetworkMode(game::MODE_NETWORK_ONLINE);
game::Com_SessionMode_SetGameMode(game::MODE_GAME_MATCHMAKING_PLAYLIST);
}, scheduler::pipeline::main, 1s);
2023-01-09 17:03:43 -05:00
}
};
}
2023-02-21 12:00:59 -05:00
REGISTER_COMPONENT(dedicated_patches::component)