Feature: Implement initial macOS SimpleRemoter client
This commit is contained in:
@@ -156,7 +156,13 @@ CScreenSpyDlg::CScreenSpyDlg(CMy2015RemoteDlg* Parent, Server* IOCPServer, CONTE
|
||||
LPBYTE pClientID = m_ContextObject->InDeCompressedBuffer.GetBuffer(41);
|
||||
if (pClientID) {
|
||||
m_ClientID = *((uint64_t*)pClientID);
|
||||
Mprintf("[ScreenSpyDlg] Parsed clientID in constructor: %llu\n", m_ClientID);
|
||||
|
||||
// Notify web clients of resolution (important for clients that only send TOKEN_BITMAPINFO once)
|
||||
if (WebService().IsRunning()) {
|
||||
int width = m_BitmapInfor_Full->bmiHeader.biWidth;
|
||||
int height = abs(m_BitmapInfor_Full->bmiHeader.biHeight);
|
||||
WebService().NotifyResolutionChange(m_ClientID, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
// 从客户端配置初始化自适应质量状态 (QualityLevel: -2=关闭, -1=自适应, 0-5=具体等级)
|
||||
@@ -758,6 +764,12 @@ BOOL CScreenSpyDlg::OnInitDialog()
|
||||
// 注册屏幕上下文到 WebService(用于 Web 端鼠标/键盘控制)
|
||||
WebService().RegisterScreenContext(m_ClientID, m_ContextObject);
|
||||
|
||||
// Hide window if this session was triggered by web client
|
||||
if (WebService().IsWebTriggered(m_ClientID) && WebService().GetHideWebSessions()) {
|
||||
m_bHide = true;
|
||||
ShowWindow(SW_HIDE);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1299,6 +1311,24 @@ VOID CScreenSpyDlg::DrawNextScreenDiff(bool keyFrame)
|
||||
break;
|
||||
}
|
||||
case ALGORITHM_H264: {
|
||||
// Decode locally if dialog is visible
|
||||
if (!m_bHide && NextScreenLength > 0) {
|
||||
if (Decode((LPBYTE)NextScreenData, NextScreenLength)) {
|
||||
bChange = TRUE;
|
||||
}
|
||||
}
|
||||
// Broadcast H264 keyframe to web clients
|
||||
if (NextScreenLength > 0 && WebService().IsRunning()) {
|
||||
std::vector<uint8_t> packet(4 + 1 + 4 + NextScreenLength);
|
||||
uint32_t deviceIdLow = (uint32_t)(m_ClientID & 0xFFFFFFFF);
|
||||
uint8_t frameType = 1; // Keyframe
|
||||
uint32_t dataLen = (uint32_t)NextScreenLength;
|
||||
memcpy(packet.data(), &deviceIdLow, 4);
|
||||
packet[4] = frameType;
|
||||
memcpy(packet.data() + 5, &dataLen, 4);
|
||||
memcpy(packet.data() + 9, NextScreenData, NextScreenLength);
|
||||
WebService().BroadcastH264Frame(m_ClientID, packet.data(), packet.size());
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user