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::ThreadEventHandler OnCreate, OnDestroy;
Host::HostInfoHandler OnHostInfo = 0;
bool has_consolethread = false;
Host::HookInsertHandler HookInsert = 0;
Host::EmbedCallback embedcallback = 0;
TextThread *consolethread = nullptr;
void RemoveThreads(std::function<bool(ThreadParam)> removeIf)
{
std::vector<TextThread *> threadsToRemove;
@ -218,8 +218,8 @@ namespace Host
if (createconsole)
{
OnCreate(textThreadsByParams->try_emplace(console, console, HookParam{}, CONSOLE).first->second);
consolethread = &textThreadsByParams->at(console);
Host::AddConsoleOutput(ProjectHomePage);
has_consolethread = true;
}
// CreatePipe();
@ -411,7 +411,7 @@ namespace Host
if (OnHostInfo)
OnHostInfo(type, std::move(text));
if (has_consolethread || (type != HOSTINFO::Console))
if (consolethread || (type != HOSTINFO::Console))
{
switch (type)
{
@ -422,8 +422,8 @@ namespace Host
text = L"[Game] " + text;
break;
}
if (has_consolethread)
GetThread(console).AddSentence(std::move(text));
if (consolethread)
consolethread->AddSentence(std::move(text));
else if (type != HOSTINFO::Console)
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)
buffer.push_back(L'\n');
}
// else
// Host::AddConsoleOutput(INVALID_CODEPAGE); //死锁,且没必要
else
Host::AddConsoleOutput(INVALID_CODEPAGE);
UpdateFlushTime();