mirror of
https://github.com/diamante0018/MW3ServerFreezer.git
synced 2025-04-19 11:42:53 +00:00
Console
This commit is contained in:
parent
1ffc5ba3f1
commit
a3e69cae15
54
src/component/console.cpp
Normal file
54
src/component/console.cpp
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#include <stdinc.hpp>
|
||||||
|
|
||||||
|
#include <loader/component_loader.hpp>
|
||||||
|
|
||||||
|
#include "command.hpp"
|
||||||
|
|
||||||
|
namespace console
|
||||||
|
{
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
std::thread thread;
|
||||||
|
std::thread::id async_thread_id;
|
||||||
|
|
||||||
|
LRESULT __stdcall sys_start_console(HWND, UINT, WPARAM, LPARAM)
|
||||||
|
{
|
||||||
|
game::Sys_ShowConsole();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void console_unlock()
|
||||||
|
{
|
||||||
|
const auto callBack = SetWindowLongA(*game::g_wv_hWnd,
|
||||||
|
GWL_WNDPROC, reinterpret_cast<LONG>(sys_start_console));
|
||||||
|
|
||||||
|
SendMessage(*game::g_wv_hWnd, WM_QUIT, 0, 0);
|
||||||
|
SetWindowLongA(*game::g_wv_hWnd, GWL_WNDPROC, callBack);
|
||||||
|
}
|
||||||
|
|
||||||
|
void show_console()
|
||||||
|
{
|
||||||
|
if (*game::s_wcd_hWnd)
|
||||||
|
{
|
||||||
|
ShowWindow(*game::s_wcd_hWnd, SW_SHOW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class component final : public component_interface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void post_unpack() override
|
||||||
|
{
|
||||||
|
thread = std::thread([]()
|
||||||
|
{
|
||||||
|
console_unlock();
|
||||||
|
show_console();
|
||||||
|
});
|
||||||
|
|
||||||
|
async_thread_id = thread.get_id();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
REGISTER_COMPONENT(console::component)
|
@ -6,6 +6,8 @@ namespace game
|
|||||||
{
|
{
|
||||||
// Functions
|
// Functions
|
||||||
WEAK symbol<void()> Sys_ShowConsole{0x515CD0};
|
WEAK symbol<void()> Sys_ShowConsole{0x515CD0};
|
||||||
|
WEAK symbol<void(HINSTANCE__*)> Sys_CreateConsole{0x51B770};
|
||||||
|
WEAK symbol<void(const char* fmt, ...)> Sys_Error{0x434000};
|
||||||
WEAK symbol<void(errorParm_t, const char* fmt, ...)> Com_Error{0x4A6660};
|
WEAK symbol<void(errorParm_t, const char* fmt, ...)> Com_Error{0x4A6660};
|
||||||
WEAK symbol<const char*(int index)> ConcatArgs{0x539060};
|
WEAK symbol<const char*(int index)> ConcatArgs{0x539060};
|
||||||
WEAK symbol<void(LocalClientNum_t, const char* text)> Cbuf_AddText{0x4C1030};
|
WEAK symbol<void(LocalClientNum_t, const char* text)> Cbuf_AddText{0x4C1030};
|
||||||
@ -56,5 +58,5 @@ namespace game
|
|||||||
WEAK symbol<clientConnection_t> localClientConnection{0xB3D360};
|
WEAK symbol<clientConnection_t> localClientConnection{0xB3D360};
|
||||||
WEAK symbol<HWND> g_wv_hWnd{0x5A86AF0};
|
WEAK symbol<HWND> g_wv_hWnd{0x5A86AF0};
|
||||||
WEAK symbol<HWND> s_wcd_hWnd{0x5A86330};
|
WEAK symbol<HWND> s_wcd_hWnd{0x5A86330};
|
||||||
WEAK symbol<int> serverId{0x0FF5058};
|
WEAK symbol<int> serverId{0xFF5058};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user