From 1da9f513b4699fa850b56827bd40b05280870664 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Mon, 20 Nov 2006 18:05:28 +0000 Subject: [PATCH] New Windows remote stuff --- readme.win | 20 ++++++++++++++++---- remotewin.cc | 45 +++++++++++++++++++++++++++++++++++++++++++-- remotewin.h | 1 + winmain.cc | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 110 insertions(+), 6 deletions(-) diff --git a/readme.win b/readme.win index 2ac59dd..898a99e 100644 --- a/readme.win +++ b/readme.win @@ -19,6 +19,7 @@ Requirements The vomp client on Windows requires: * Windows 2000 or later +* Windows XP for full remote control support * A DirectShow MPEG2 decoder, which supports Video Mixing Renderer 9 (VMR-9), mostly included within DVD software player * A network connection to the vompserver computer @@ -67,9 +68,9 @@ YELLOW | y BLUE | b MUTE | F8 RADIO | Not implemented -REVERSE | Not implemented (Can work on Remote Controls) +REVERSE | Shift + Control + B PLAY | Shift + P -FORWARD | Shift + F +FORWARD | Shift + Control + F RECORD | Ctrl + R STOP | Ctrl + S PAUSE | Ctrl + P @@ -90,8 +91,19 @@ PREVCHANNEL | Not implemented STAR | * HASH | Not implemented -(Note: Remote Controls for Windows should work also for most buttons, -but this is an yet untested feature.) +Remote Controls tested with vomp on windows +=========================================== + +Compatible +========== +* AR Remote Control MCE (1040050, X10), [All buttons recognized, except POWER] + +Note: Remote Controls for Windows should work also for most buttons, +however full remote control support is restricted to Windows XP and above. +If buttons of your remote control are not supported, please post a message +in the forum at http://www.loggytronic.com and we will add them to vomp. + + Usage ===== diff --git a/remotewin.cc b/remotewin.cc index c4ca8cb..f0aed8f 100644 --- a/remotewin.cc +++ b/remotewin.cc @@ -143,8 +143,8 @@ int RemoteWin::ReceiveButtonVK(UINT button) { pb=STAR;break; case 'J'://j for JUMP TO instead of go to pb=GO;break; - case VK_ESCAPE: - pb=POWER;break; + //case VK_ESCAPE: + // pb=POWER;break; case VK_BACK: pb=BACK;break; case 'M': @@ -171,6 +171,8 @@ int RemoteWin::ReceiveButtonAP(UINT button) { UCHAR pb=NA_NONE; //should we use a translation table ? No APPCOMMAND iS DWORD! switch (button) { //Processing VK_Messages + case APPCOMMAND_BROWSER_BACKWARD: + pb=BACK;break; case APPCOMMAND_MEDIA_CHANNEL_DOWN: pb=CHANNELDOWN;break; case APPCOMMAND_MEDIA_CHANNEL_UP: @@ -205,6 +207,44 @@ int RemoteWin::ReceiveButtonAP(UINT button) { return 1; } +int RemoteWin::ReceiveButtonRI(UINT button) { + UCHAR pb=NA_NONE; + //Raw Input + /* Note Codes above 0x29c are not listed in the specs on usb.org + therefore they are used by try, they might be device dependent + thus please supply codes of your remote control */ + switch (button) { //Processing VK_Messages + case 0x35c: //Green + pb=GREEN;break; + case 0x35b: //Red + pb=RED;break; + case 0x35d: //Yellow + pb=YELLOW;break; + case 0x35e: //Blue + pb=BLUE;break; + case 0x30d: //MCE Button, used for Menu + pb=MENU;break; + case 0x348: //Record Television + pb=RECORD;break; + case 0x28d: //Attach File Mmh, how should we assign this + pb=NA_NONE;break; + case 0x325: //Playback Televison + pb=PLAY;break; + case 0x324: //Playback DVD + pb=PLAY;break; + case 0x209: //Properties + case 0x35a: //Teletext? + pb=OK;break; + + + }; + if (pb==NA_NONE) return 0; + curevent=pb; + //PulseEvent(event); + SetEvent(event); + return 1; +} + void RemoteWin::Signal() { signal=true; //PulseEvent(event); @@ -213,6 +253,7 @@ void RemoteWin::Signal() { void RemoteWin::SendPower() { + curevent=POWER; SetEvent(event); } diff --git a/remotewin.h b/remotewin.h index a4b11e4..7fe280f 100644 --- a/remotewin.h +++ b/remotewin.h @@ -47,6 +47,7 @@ class RemoteWin : public Remote void Signal(); int ReceiveButtonVK(UINT button);//Windows Message from WND_PROC int ReceiveButtonAP(UINT button); + int ReceiveButtonRI(UINT button); void SendPower(); private: diff --git a/winmain.cc b/winmain.cc index 4bd2d31..9fc88ca 100644 --- a/winmain.cc +++ b/winmain.cc @@ -61,6 +61,7 @@ Audio* audio; bool wnd_fullscreen=false; RECT wnd_fs_rect={20,20,768+20,576+20}; RECT wnd_fs_rect_client={0,0,768,576}; +OSVERSIONINFO windows_ver; //attempt to distigsh windows versions void MILLISLEEP(ULONG a) @@ -443,6 +444,7 @@ void ToggleFullscreen() { LONG FAR PASCAL WindowProc(HWND wind, UINT msg, WPARAM wparam, LPARAM lparam) { + switch (msg) { case WM_DESTROY: { //TODO: call command @@ -485,6 +487,29 @@ LONG FAR PASCAL WindowProc(HWND wind, UINT msg, WPARAM wparam, LPARAM lparam) return DefWindowProc(wind, msg, wparam, lparam); } + break; + case WM_INPUT: + if ((windows_ver.dwMajorVersion>5 || + (windows_ver.dwMajorVersion==5 && windows_ver.dwMinorVersion>=1)) ) { + //only on XP! + LPRAWINPUT lpit; + UINT risize; + GetRawInputData((HRAWINPUT)lparam,RID_INPUT,NULL,&risize,sizeof(RAWINPUTHEADER)); + lpit=(LPRAWINPUT)malloc(risize); + GetRawInputData((HRAWINPUT)lparam,RID_INPUT,lpit,&risize,sizeof(RAWINPUTHEADER)); + + if (lpit->header.dwType==RIM_TYPEHID && lpit->data.hid.dwSizeHid>=2) { + DWORD button=lpit->data.hid.bRawData[1] | (lpit->data.hid.bRawData[0]<< 8); + if (((RemoteWin*)remote)->ReceiveButtonRI(button)){ + free(lpit); + return 0; //yes we process that message + } + } + free(lpit); + } + return DefWindowProc(wind, msg, wparam, lparam); + + break; case WM_COMMAND: if (LOWORD(wparam)==VOMP_FULL_SCREEN) { @@ -523,6 +548,8 @@ LONG FAR PASCAL WindowProc(HWND wind, UINT msg, WPARAM wparam, LPARAM lparam) bool InitApp(HINSTANCE hinst,int cmdshow) { /* main window */ + windows_ver.dwOSVersionInfoSize=sizeof(windows_ver); + GetVersionEx(&windows_ver); WNDCLASS wcs; DWORD flags; wcs.style = CS_HREDRAW | CS_VREDRAW; @@ -569,6 +596,29 @@ bool InitApp(HINSTANCE hinst,int cmdshow) { return FALSE; ShowWindow(win,SW_SHOWNORMAL); UpdateWindow(win); + if (windows_ver.dwMajorVersion>5 || + ( windows_ver.dwMajorVersion==5 && windows_ver.dwMinorVersion>=1)) {//at least windows XP + /* We want to support MCE Remote controls*/ + RAWINPUTDEVICE remote_control_data[4]; + ZeroMemory(remote_control_data,sizeof(remote_control_data)); + remote_control_data[0].usUsagePage=0xFFBC; + remote_control_data[0].usUsage=0x88; + remote_control_data[0].dwFlags=0; + remote_control_data[1].usUsagePage=0x0C; + remote_control_data[1].usUsage=0x80; + remote_control_data[1].dwFlags=0; + remote_control_data[2].usUsagePage=0x0C; + remote_control_data[2].usUsage=0x01; + remote_control_data[2].dwFlags=0; + remote_control_data[3].usUsagePage=0x01; + remote_control_data[3].usUsage=0x80; + remote_control_data[3].dwFlags=0; + if (RegisterRawInputDevices(remote_control_data,4,sizeof(remote_control_data[0]))!=TRUE) { + MessageBox(0,"Registering remote control failed!","Aborting!",0); + return FALSE; + } + + } return TRUE; } -- 2.39.5