This commit is contained in:
恍兮惚兮 2024-12-01 01:44:53 +08:00
parent 4303400903
commit fc5e81bf57
2 changed files with 7 additions and 7 deletions

View File

@ -50,9 +50,9 @@ namespace
Host::ProcessEventHandler OnConnect, OnDisconnect; Host::ProcessEventHandler OnConnect, OnDisconnect;
Host::ThreadEventHandler OnCreate, OnDestroy; Host::ThreadEventHandler OnCreate, OnDestroy;
Host::HostInfoHandler OnHostInfo = 0; Host::HostInfoHandler OnHostInfo = 0;
bool has_consolethread = false;
Host::HookInsertHandler HookInsert = 0; Host::HookInsertHandler HookInsert = 0;
Host::EmbedCallback embedcallback = 0; Host::EmbedCallback embedcallback = 0;
TextThread *consolethread = nullptr;
void RemoveThreads(std::function<bool(ThreadParam)> removeIf) void RemoveThreads(std::function<bool(ThreadParam)> removeIf)
{ {
std::vector<TextThread *> threadsToRemove; std::vector<TextThread *> threadsToRemove;
@ -218,8 +218,8 @@ namespace Host
if (createconsole) if (createconsole)
{ {
OnCreate(textThreadsByParams->try_emplace(console, console, HookParam{}, CONSOLE).first->second); OnCreate(textThreadsByParams->try_emplace(console, console, HookParam{}, CONSOLE).first->second);
consolethread = &textThreadsByParams->at(console);
Host::AddConsoleOutput(ProjectHomePage); Host::AddConsoleOutput(ProjectHomePage);
has_consolethread = true;
} }
// CreatePipe(); // CreatePipe();
@ -411,7 +411,7 @@ namespace Host
if (OnHostInfo) if (OnHostInfo)
OnHostInfo(type, std::move(text)); OnHostInfo(type, std::move(text));
if (has_consolethread || (type != HOSTINFO::Console)) if (consolethread || (type != HOSTINFO::Console))
{ {
switch (type) switch (type)
{ {
@ -422,8 +422,8 @@ namespace Host
text = L"[Game] " + text; text = L"[Game] " + text;
break; break;
} }
if (has_consolethread) if (consolethread)
GetThread(console).AddSentence(std::move(text)); consolethread->AddSentence(std::move(text));
else if (type != HOSTINFO::Console) else if (type != HOSTINFO::Console)
OnHostInfo(HOSTINFO::Console, std::move(text)); OnHostInfo(HOSTINFO::Console, std::move(text));
} }

View File

@ -65,8 +65,8 @@ void TextThread::Push(BYTE *data, int length)
if (hp.type & FULL_STRING && converted.value().size() > 1) if (hp.type & FULL_STRING && converted.value().size() > 1)
buffer.push_back(L'\n'); buffer.push_back(L'\n');
} }
// else else
// Host::AddConsoleOutput(INVALID_CODEPAGE); //死锁,且没必要 Host::AddConsoleOutput(INVALID_CODEPAGE);
UpdateFlushTime(); UpdateFlushTime();