small fixes

This commit is contained in:
Akash Mozumdar 2020-02-28 02:34:07 -07:00
parent f6cf3c9c62
commit 22e0d38a1e
3 changed files with 8 additions and 4 deletions

View File

@ -190,7 +190,11 @@ void MainWindow::ThreadAdded(TextThread& thread)
{ {
std::wstring threadCode = HookCode::Generate(thread.hp, thread.tp.processId); std::wstring threadCode = HookCode::Generate(thread.hp, thread.tp.processId);
bool savedMatch = savedThreadCtx == thread.tp.ctx && savedThreadCtx2 == thread.tp.ctx2 && savedThreadCode == threadCode; 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))] QMetaObject::invokeMethod(this, [this, savedMatch, ttString = TextThreadString(thread) + S(FormatString(L" (%s)", threadCode))]
{ {
ui->ttCombo->addItem(ttString); ui->ttCombo->addItem(ttString);
@ -212,7 +216,7 @@ bool MainWindow::SentenceReceived(TextThread& thread, std::wstring& sentence)
{ {
if (!DispatchSentenceToExtensions(sentence, GetSentenceInfo(thread).data())) return false; if (!DispatchSentenceToExtensions(sentence, GetSentenceInfo(thread).data())) return false;
sentence += L'\n'; 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); sanitize(sentence);
auto scrollbar = ui->textOutput->verticalScrollBar(); auto scrollbar = ui->textOutput->verticalScrollBar();

View File

@ -11,7 +11,7 @@ struct InfoForExtension
struct SentenceInfo struct SentenceInfo
{ {
const InfoForExtension* infoArray; 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 for (auto info = infoArray; info->name; ++info) // nullptr name marks end of info array
if (propertyName == info->name) return info->value; if (propertyName == info->name) return info->value;

View File

@ -4,7 +4,7 @@
// 8/23/2013 jichi // 8/23/2013 jichi
// Branch: ITH/common.h, rev 128 // 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 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 }; 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 };