From 22e0d38a1ef975993cd3b0e89a95caab1ea7a267 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Fri, 28 Feb 2020 02:34:07 -0700 Subject: [PATCH] small fixes --- GUI/mainwindow.cpp | 8 ++++++-- extensions/extension.h | 2 +- include/const.h | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/GUI/mainwindow.cpp b/GUI/mainwindow.cpp index 611a52c..655c813 100644 --- a/GUI/mainwindow.cpp +++ b/GUI/mainwindow.cpp @@ -190,7 +190,11 @@ void MainWindow::ThreadAdded(TextThread& thread) { std::wstring threadCode = HookCode::Generate(thread.hp, thread.tp.processId); bool savedMatch = savedThreadCtx == thread.tp.ctx && savedThreadCtx2 == thread.tp.ctx2 && savedThreadCode == threadCode; - if (savedMatch) savedThreadCtx = savedThreadCtx2 = savedThreadCode[0] = 0; + if (savedMatch) + { + savedThreadCtx = savedThreadCtx2 = savedThreadCode[0] = 0; + current = &thread; + } QMetaObject::invokeMethod(this, [this, savedMatch, ttString = TextThreadString(thread) + S(FormatString(L" (%s)", threadCode))] { ui->ttCombo->addItem(ttString); @@ -212,7 +216,7 @@ bool MainWindow::SentenceReceived(TextThread& thread, std::wstring& sentence) { if (!DispatchSentenceToExtensions(sentence, GetSentenceInfo(thread).data())) return false; sentence += L'\n'; - if (current == &thread) QMetaObject::invokeMethod(this, [this, sentence = S(sentence)]() mutable + if (&thread == current) QMetaObject::invokeMethod(this, [this, sentence = S(sentence)]() mutable { sanitize(sentence); auto scrollbar = ui->textOutput->verticalScrollBar(); diff --git a/extensions/extension.h b/extensions/extension.h index ad3a847..aa361cd 100644 --- a/extensions/extension.h +++ b/extensions/extension.h @@ -11,7 +11,7 @@ struct InfoForExtension struct SentenceInfo { const InfoForExtension* infoArray; - int64_t operator[](std::string propertyName) + int64_t operator[](std::string_view propertyName) { for (auto info = infoArray; info->name; ++info) // nullptr name marks end of info array if (propertyName == info->name) return info->value; diff --git a/include/const.h b/include/const.h index d68a842..47569a4 100644 --- a/include/const.h +++ b/include/const.h @@ -4,7 +4,7 @@ // 8/23/2013 jichi // Branch: ITH/common.h, rev 128 -enum { STRING = 12, MESSAGE_SIZE = 500, PIPE_BUFFER_SIZE = 10000, SHIFT_JIS = 932, MAX_MODULE_SIZE = 120, PATTERN_SIZE = 30, HOOK_NAME_SIZE = 60, FIXED_SPLIT_VALUE = 0x10001 }; +enum { STRING = 12, MESSAGE_SIZE = 500, PIPE_BUFFER_SIZE = 50000, SHIFT_JIS = 932, MAX_MODULE_SIZE = 120, PATTERN_SIZE = 30, HOOK_NAME_SIZE = 60, FIXED_SPLIT_VALUE = 0x10001 }; enum WildcardByte { XX = 0x11 }; enum HostCommandType { HOST_COMMAND_NEW_HOOK, HOST_COMMAND_REMOVE_HOOK, HOST_COMMAND_FIND_HOOK, HOST_COMMAND_MODIFY_HOOK, HOST_COMMAND_HIJACK_PROCESS, HOST_COMMAND_DETACH };