diff --git a/GUI/host/host.cc b/GUI/host/host.cc index 6daa845..3056fcf 100644 --- a/GUI/host/host.cc +++ b/GUI/host/host.cc @@ -144,6 +144,7 @@ namespace Host void Start(ProcessEventCallback onAttach, ProcessEventCallback onDetach, ThreadEventCallback onCreate, ThreadEventCallback onRemove) { OnAttach = onAttach; OnDetach = onDetach; OnCreate = onCreate; OnRemove = onRemove; + TextThread::Prefilter = (int(*)(wchar_t*, const wchar_t*))GetProcAddress(LoadLibraryW(L"0_Prefilter.dll"), "OnNewData"); OnCreate(textThreadsByParams[CONSOLE] = new TextThread(CONSOLE, USING_UNICODE)); StartPipe(); } diff --git a/GUI/host/textthread.cc b/GUI/host/textthread.cc index e8d69f5..b518eab 100644 --- a/GUI/host/textthread.cc +++ b/GUI/host/textthread.cc @@ -47,6 +47,7 @@ void TextThread::AddText(const BYTE* data, int len) ? std::wstring((wchar_t*)data, len / 2) : StringToWideString(std::string((char*)data, len), status & USING_UTF8 ? CP_UTF8 : SHIFT_JIS); LOCK(ttMutex); + if (Prefilter) wData.resize(Prefilter(wData.data(), storage.c_str())); buffer.append(wData); timestamp = GetTickCount(); } diff --git a/GUI/host/textthread.h b/GUI/host/textthread.h index a806269..868c81e 100644 --- a/GUI/host/textthread.h +++ b/GUI/host/textthread.h @@ -24,6 +24,7 @@ public: const std::wstring name; const ThreadParam tp; + inline static int(*Prefilter)(wchar_t*, const wchar_t*) = nullptr; inline static int FlushDelay = 250; // flush every 250ms by default inline static int MaxBufferSize = 200; inline static int ThreadCounter = 0;