From 0d32bfba389f77fd0e2b9bbd23b1f6c6296ac32d Mon Sep 17 00:00:00 2001 From: wolf109909 <84360921+wolf109909@users.noreply.github.com> Date: Sat, 6 Jan 2024 01:24:56 +0800 Subject: [PATCH] Update ime.cpp --- NorthstarDLL/igig/ime.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/NorthstarDLL/igig/ime.cpp b/NorthstarDLL/igig/ime.cpp index 7a74587de..c4dadef00 100644 --- a/NorthstarDLL/igig/ime.cpp +++ b/NorthstarDLL/igig/ime.cpp @@ -4,7 +4,6 @@ #include "client/fontawesome.h" #include "client/igig/ime.h" #include "core/memalloc.h" -#include "shared/keyvalues.h" AUTOHOOK_INIT() @@ -14,10 +13,12 @@ typedef void (*MessageFunc_t)(void); typedef __int64(__fastcall* CInputWin32__InternalKeyTyped_t)(__int64, unsigned __int16); typedef __int64(__fastcall* VGUI__FindOrAddPanelMessageMap_t)(const char*); typedef __int64(__fastcall* CUtlVector__MessageMapItem_t__AddToTail_t)(__int64, void*); -typedef __int64(__fastcall* CInputWin32__PostKeyMessage_t)(__int64, KeyValues*); +typedef __int64(__fastcall* CInputWin32__PostKeyMessage_t)(__int64, __int64); typedef __int64(__fastcall* Panel__LocalToScreen_t)(__int64, DWORD*, DWORD*); typedef __int64(__fastcall* Panel__GetSize_t)(__int64, DWORD*, DWORD*); typedef __int64(__fastcall* TextEntry__CursorToPixelSpace_t)(__int64, DWORD, DWORD*, DWORD*); +typedef __int64(__fastcall* KeyValuesSystem__Alloc_t)(__int64); +typedef __int64(__fastcall* KeyValues__Constructor_0_t)(__int64, const char*); bool bShouldDrawCandidateList = false; __int64 CInputWin32__Instance = 0; @@ -29,6 +30,8 @@ CInputWin32__PostKeyMessage_t CInputWin32__PostKeyMessage; Panel__LocalToScreen_t Panel__LocalToScreen; Panel__GetSize_t Panel__GetSize; TextEntry__CursorToPixelSpace_t TextEntry__CursorToPixelSpace; +KeyValuesSystem__Alloc_t KeyValuesSystem__Alloc; +KeyValues__Constructor_0_t KeyValues__Constructor_0; std::vector candidates; std::wstring composite; @@ -189,7 +192,16 @@ bool ImeWndProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ImmReleaseContext(hWnd, hIMC); - CInputWin32__PostKeyMessage(CInputWin32__Instance, new KeyValues("DoIMEUpdateCandidateWindowPos")); + __int64 kv = KeyValuesSystem__Alloc(80); + if (kv) + { + kv = KeyValues__Constructor_0(kv, "DoIMEUpdateCandidateWindowPos"); + CInputWin32__PostKeyMessage(CInputWin32__Instance, kv); + } + else + { + CInputWin32__PostKeyMessage(CInputWin32__Instance, 0); + } return true; } @@ -307,4 +319,6 @@ ON_DLL_LOAD("vgui2.dll", CHATBOX, (CModule module)) CInputWin32__Instance = (__int64)(module.m_nAddress + 0x121A10); CInputWin32__PostKeyMessage = module.Offset(0xEDA0).As(); CInputWin32__InternalKeyTyped = module.Offset(0xCFD0).As(); + KeyValuesSystem__Alloc = module.Offset(0x3B6B0).As(); + KeyValues__Constructor_0 = module.Offset(0x3B3C0).As(); }