Merge pull request #23 from mjkzy/main

fix hwndBuffer not lining up with inputline/banner
This commit is contained in:
Maurice Heumann 2022-06-03 06:51:17 +02:00 committed by GitHub
commit 15ee2877d5

View File

@ -8,6 +8,7 @@
#include <utils/hook.hpp>
#define CONSOLE_BUFFER_SIZE 16384
#define WINDOW_WIDTH 608
namespace console
{
@ -85,7 +86,7 @@ namespace console
return;
}
RECT rect;
RECT rect{};
rect.left = 0;
rect.right = 620;
rect.top = 0;
@ -97,8 +98,8 @@ namespace console
const auto sheight = GetDeviceCaps(dc, 10);
ReleaseDC(GetDesktopWindow(), dc);
utils::hook::set<int>(game::s_wcd::windowWidth, rect.right - rect.left + 1);
utils::hook::set<int>(game::s_wcd::windowHeight, rect.bottom - rect.top + 1);
utils::hook::set<int>(game::s_wcd::windowWidth, (rect.right - rect.left + 1));
utils::hook::set<int>(game::s_wcd::windowHeight, (rect.bottom - rect.top + 1));
utils::hook::set<HWND>(game::s_wcd::hWnd, CreateWindowExA(
0, class_name, window_name, 0x80CA0000, (swidth - 600) / 2, (sheight - 450) / 2,
@ -129,18 +130,17 @@ namespace console
// create the input line
utils::hook::set<HWND>(game::s_wcd::hwndInputLine, CreateWindowExA(
0, "edit", nullptr, 0x50800080u, 6, 400, 608, 20, *game::s_wcd::hWnd,
0, "edit", nullptr, 0x50800080u, 6, 400, WINDOW_WIDTH, 20, *game::s_wcd::hWnd,
reinterpret_cast<HMENU>(0x65), h_instance, nullptr));
utils::hook::set<HWND>(game::s_wcd::hwndBuffer, CreateWindowExA(
0, "edit", nullptr, 0x50A00844u, 6, 70, 606, 324, *game::s_wcd::hWnd,
0, "edit", nullptr, 0x50A00844u, 6, 70, WINDOW_WIDTH, 324, *game::s_wcd::hWnd,
reinterpret_cast<HMENU>(0x64), h_instance, nullptr));
SendMessageA(*game::s_wcd::hwndBuffer, WM_SETFONT, reinterpret_cast<WPARAM>(*game::s_wcd::hfBufferFont), 0);
utils::hook::set<WNDPROC>(game::s_wcd::SysInputLineWndProc, reinterpret_cast<WNDPROC>(SetWindowLongPtrA(
*game::s_wcd::hwndInputLine, -4,
reinterpret_cast<LONG_PTR>(input_line_wnd_proc))));
SendMessageA(*game::s_wcd::hwndInputLine, WM_SETFONT, reinterpret_cast<WPARAM>(*game::s_wcd::hfBufferFont),
0);
SendMessageA(*game::s_wcd::hwndInputLine, WM_SETFONT, reinterpret_cast<WPARAM>(*game::s_wcd::hfBufferFont), 0);
SetFocus(*game::s_wcd::hwndInputLine);
game::Con_GetTextCopy(text, 0x4000);