Skip to content

Commit

Permalink
Update ime.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
wolf109909 committed Jan 5, 2024
1 parent 86379f8 commit 0d32bfb
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions NorthstarDLL/igig/ime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "client/fontawesome.h"
#include "client/igig/ime.h"
#include "core/memalloc.h"
#include "shared/keyvalues.h"

AUTOHOOK_INIT()

Expand All @@ -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;
Expand All @@ -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<std::wstring> candidates;
std::wstring composite;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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__PostKeyMessage_t>();
CInputWin32__InternalKeyTyped = module.Offset(0xCFD0).As<CInputWin32__InternalKeyTyped_t>();
KeyValuesSystem__Alloc = module.Offset(0x3B6B0).As<KeyValuesSystem__Alloc_t>();
KeyValues__Constructor_0 = module.Offset(0x3B3C0).As<KeyValues__Constructor_0_t>();
}

0 comments on commit 0d32bfb

Please sign in to comment.