From 6575c58ad4d3b897c560b8f3c570306078db0ee6 Mon Sep 17 00:00:00 2001 From: xtne6f Date: Sun, 8 Sep 2024 16:55:12 +0900 Subject: [PATCH 1/4] =?UTF-8?q?=E5=BC=95=E6=95=B0=E3=81=AE=E3=81=AA?= =?UTF-8?q?=E3=81=84=E4=B8=8D=E6=98=8E=E3=81=AAIPC=E3=83=A1=E3=83=83?= =?UTF-8?q?=E3=82=BB=E3=83=BC=E3=82=B8=E3=82=92=E5=8F=97=E3=81=91=E5=8F=96?= =?UTF-8?q?=E3=82=8B=E3=81=A8TVTest=E3=81=8C=E8=90=BD=E3=81=A1=E3=82=8B?= =?UTF-8?q?=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Viewer/TVTComment/IPC/RawIPCMessage.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Viewer/TVTComment/IPC/RawIPCMessage.cpp b/Viewer/TVTComment/IPC/RawIPCMessage.cpp index 000d059..c6d8738 100644 --- a/Viewer/TVTComment/IPC/RawIPCMessage.cpp +++ b/Viewer/TVTComment/IPC/RawIPCMessage.cpp @@ -5,10 +5,9 @@ namespace TVTComment { std::string RawIPCMessage::ToString() const { - std::string ret; + std::string ret = this->MessageName; for (const std::string &content : this->Contents) - ret += content+" "; - ret.pop_back(); - return this->MessageName + ret; + ret += " " + content; + return ret; } } \ No newline at end of file From acffc77ca2d5a549071c927703d2197f0bc3e0d3 Mon Sep 17 00:00:00 2001 From: xtne6f Date: Sun, 8 Sep 2024 16:56:40 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BC=9D=E9=80=81=E3=83=87=E3=83=BC?= =?UTF-8?q?=E3=82=BF=E4=B8=AD=E3=81=ABIPC=E3=81=AE=E3=83=87=E3=83=AA?= =?UTF-8?q?=E3=83=9F=E3=82=BF=E3=82=92=E5=90=AB=E3=82=81=E3=81=AA=E3=81=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TVTComment/Model/IPC/IPCMessage/ChatIPCMessage.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TVTComment/Model/IPC/IPCMessage/ChatIPCMessage.cs b/TVTComment/Model/IPC/IPCMessage/ChatIPCMessage.cs index 3a1906a..60ab7bc 100644 --- a/TVTComment/Model/IPC/IPCMessage/ChatIPCMessage.cs +++ b/TVTComment/Model/IPC/IPCMessage/ChatIPCMessage.cs @@ -17,7 +17,7 @@ public void Decode(IEnumerable content) public IEnumerable Encode() { string[] ret = new string[5]; - ret[0] = Chat.Text; + ret[0] = Chat.Text.Replace('\u001E', '〓').Replace('\u001F', '〓'); switch (Chat.Position) { case Chat.PositionType.Normal: From c3bcfa9e787076ede91ca5e29ee00b4dfb182276 Mon Sep 17 00:00:00 2001 From: xtne6f Date: Sun, 8 Sep 2024 16:59:36 +0900 Subject: [PATCH 3/4] =?UTF-8?q?=E3=82=A6=E3=82=A3=E3=83=B3=E3=83=89?= =?UTF-8?q?=E3=82=A6=E3=82=B9=E3=83=AC=E3=83=83=E3=83=89=E4=BB=A5=E5=A4=96?= =?UTF-8?q?=E3=81=8B=E3=82=89TVTest=E3=81=AEAPI=E3=82=92=E5=91=BC=E3=81=B3?= =?UTF-8?q?=E5=87=BA=E3=81=95=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TVTestへのメッセージの送信はスレッドセーフではないため --- Viewer/TVTComment/TVTComment.cpp | 15 ++++++++++----- Viewer/TVTComment/TVTComment.h | 8 +++++++- Viewer/Viewer.cpp | 2 ++ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Viewer/TVTComment/TVTComment.cpp b/Viewer/TVTComment/TVTComment.cpp index bcae33b..ef13f5c 100644 --- a/Viewer/TVTComment/TVTComment.cpp +++ b/Viewer/TVTComment/TVTComment.cpp @@ -135,7 +135,11 @@ namespace TVTComment } else if (auto message = dynamic_cast(&msg)) { - this->tvtest->SetChannel(message->SpaceIndex, message->ChannelIndex,message->ServiceId); + //タイムアウトつきでウィンドウスレッドにチャンネル変更を指示する + this->channelSelectSpaceIndex = message->SpaceIndex; + this->channelSelectChannelIndex = message->ChannelIndex; + this->channelSelectServiceId = message->ServiceId; + SendMessageTimeout(this->dialog, WM_CHANNELSELECT, 0, 0, SMTO_NORMAL, CHANNELSELECT_TIMEOUT, nullptr); } else if (auto message = dynamic_cast(&msg)) { @@ -146,7 +150,6 @@ namespace TVTComment else if (auto message = dynamic_cast(&msg)) { lastOpacity = (WPARAM)message->Opacity; - this->tvtest->SetPluginCommandState(static_cast(Command::HideComment), 0); PostMessage(this->dialog, WM_SETCHATOPACITY, (WPARAM)message->Opacity, 0); } #pragma warning(pop) @@ -276,6 +279,10 @@ namespace TVTComment case WM_ONCHANNELSELECTIONCHANGE: this->OnChannelSelectionChange(); break; + + case WM_CHANNELSELECT: + this->tvtest->SetChannel(this->channelSelectSpaceIndex, this->channelSelectChannelIndex, this->channelSelectServiceId); + break; } return FALSE; @@ -400,12 +407,10 @@ namespace TVTComment case Command::HideComment: if (this->commentWindow->GetOpacity() != 0) { lastOpacity = this->commentWindow->GetOpacity(); - PostMessage(this->dialog, WM_SETCHATOPACITY, 0, 0); - this->tvtest->SetPluginCommandState(static_cast(Command::HideComment), TVTest::COMMAND_ICON_STATE_CHECKED); + PostMessage(this->dialog, WM_SETCHATOPACITY, 0, 1); } else { PostMessage(this->dialog, WM_SETCHATOPACITY, lastOpacity, 0); - this->tvtest->SetPluginCommandState(static_cast(Command::HideComment), 0); } break; } diff --git a/Viewer/TVTComment/TVTComment.h b/Viewer/TVTComment/TVTComment.h index 9c44a4b..35689fa 100644 --- a/Viewer/TVTComment/TVTComment.h +++ b/Viewer/TVTComment/TVTComment.h @@ -53,6 +53,11 @@ namespace TVTComment std::wstring collectExePath;//起動するEXEのパス + int channelSelectSpaceIndex;//WM_CHANNELSELECTをタイムアウトつきで呼び出すときの引数 + int channelSelectChannelIndex; + uint16_t channelSelectServiceId; + static constexpr int CHANNELSELECT_TIMEOUT = 5000;//WM_CHANNELSELECTの完了を待つタイムアウト(ミリ秒) + static std::wstring_convert, wchar_t> utf8_utf16_conv; private: @@ -69,7 +74,8 @@ namespace TVTComment static constexpr int WM_DISABLEPLUGIN = WM_APP + 1002;//プラグインを無効化する(別スレッドから無効化するときに使う) static constexpr int WM_ONCHANNELLISTCHANGE = WM_APP + 1003;//メンバ関数OnChannelListChangeを呼ぶ(別スレッドから送るときに使う) static constexpr int WM_ONCHANNELSELECTIONCHANGE = WM_APP + 1004;//メンバ関数OnChannelSelectionChangeを呼ぶ(別スレッドから送るときに使う) - static constexpr int WM_SETCHATOPACITY = WM_APP + 1005;//コメント透過度を設定する wParamに透過度を渡す(0~255) + static constexpr int WM_SETCHATOPACITY = WM_APP + 1005;//コメント透過度を設定する wParamに透過度(0~255)、lParamに表示状態(非0で非表示)を渡す + static constexpr int WM_CHANNELSELECT = WM_APP + 1006;//チャンネル変更する enum class UserInteractionRequestType{ConnectSucceed,ConnectFail,InvalidMessage,ReceiveError,SendError, FetalErrorInTask}; diff --git a/Viewer/Viewer.cpp b/Viewer/Viewer.cpp index 5dcaf78..c07ff0f 100644 --- a/Viewer/Viewer.cpp +++ b/Viewer/Viewer.cpp @@ -541,6 +541,8 @@ LRESULT CViewer::ForceWindowProcMain(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM commentWindow_.Destroy(); } commentWindow_.SetOpacity(newOpacity); + bool hideState = lParam != 0; + m_pApp->SetPluginCommandState(static_cast(TVTComment::Command::HideComment), hideState ? TVTest::COMMAND_ICON_STATE_CHECKED : 0); break; } #pragma endregion From acb13b4eec957e2a7a83ad453617d10afce36f3a Mon Sep 17 00:00:00 2001 From: xtne6f Date: Sun, 8 Sep 2024 17:10:55 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BD=BF=E3=82=8F=E3=81=AA=E3=81=84?= =?UTF-8?q?=E3=83=8F=E3=83=B3=E3=83=89=E3=83=AB=E3=82=92=E9=96=89=E3=81=98?= =?UTF-8?q?=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Viewer/TVTComment/TVTComment.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Viewer/TVTComment/TVTComment.cpp b/Viewer/TVTComment/TVTComment.cpp index ef13f5c..1aa0d57 100644 --- a/Viewer/TVTComment/TVTComment.cpp +++ b/Viewer/TVTComment/TVTComment.cpp @@ -48,6 +48,8 @@ namespace TVTComment if (CreateProcessW(NULL, &(this->collectExePath + L" " + receivePipeName.substr(9) + L" " + sendPipeName.substr(9))[0], NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi) == 0) throw std::system_error(std::system_error(GetLastError(), std::system_category())); pid = pi.dwProcessId; + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); this->ipcTunnel->Connect(); }