h2-mod/src/client/component/console.cpp

42 lines
619 B
C++
Raw Normal View History

2021-09-06 18:40:37 -04:00
#include <std_include.hpp>
#include "loader/component_loader.hpp"
#include "game_console.hpp"
#include "game/game.hpp"
#include "game/dvars.hpp"
#include <utils/hook.hpp>
namespace console
{
namespace
{
DWORD WINAPI console(LPVOID)
{
ShowWindow(GetConsoleWindow(), SW_SHOW);
std::string cmd;
while (true)
{
std::getline(std::cin, cmd);
game_console::execute(cmd.data());
}
return 0;
}
}
class component final : public component_interface
{
public:
void post_unpack() override
{
CreateThread(0, 0, console, 0, 0, 0);
}
};
}
REGISTER_COMPONENT(console::component)