2 Copyright 2004-2005 Chris Tallon
\r
4 This file is part of VOMP.
\r
6 VOMP is free software; you can redistribute it and/or modify
\r
7 it under the terms of the GNU General Public License as published by
\r
8 the Free Software Foundation; either version 2 of the License, or
\r
9 (at your option) any later version.
\r
11 VOMP is distributed in the hope that it will be useful,
\r
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 GNU General Public License for more details.
\r
16 You should have received a copy of the GNU General Public License
\r
17 along with VOMP; if not, write to the Free Software
\r
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
26 #define _WIN32_WINNT 0x501
\r
27 #include <winsock2.h>
\r
28 #include <windows.h>
\r
30 #include "vompreswin.h"
\r
32 #include "defines.h"
\r
34 #include "remotewin.h"
\r
38 #include "videowin.h"
\r
39 #include "audiowin.h"
\r
42 #include "viewman.h"
\r
43 #include "command.h"
\r
45 void sighandler(int signalReceived);
\r
46 void shutdown(int code);
\r
48 // Global variables --------------------------------------------------------------------------------------------------
\r
49 int debugEnabled = 0;
\r
61 bool wnd_fullscreen=false;
\r
62 bool wnd_topmost=false;
\r
63 RECT wnd_fs_rect={20,20,768+20,576+20};
\r
64 RECT wnd_fs_rect_client={0,0,768,576};
\r
65 //OSVERSIONINFO windows_ver; //attempt to distigsh windows versions
\r
66 bool remotefnc=false;
\r
67 HINSTANCE hinstance;
\r
71 typedef UINT (WINAPI *GETRAWINPUTDATAFNC) (HRAWINPUT,UINT,LPVOID,PUINT,UINT);
\r
72 typedef UINT (WINAPI *REGISTERRAWINPUTDEVICEFNC) (PCRAWINPUTDEVICE,UINT,UINT);
\r
74 GETRAWINPUTDATAFNC dynGetRawInputData=NULL;
\r
75 REGISTERRAWINPUTDEVICEFNC dynRegisterRawInputDevices=NULL;
\r
77 DWORD lastmousemove;
\r
80 void MILLISLEEP(ULONG a)
87 DWORD WINAPI commandthreadStart(void *arg)
\r
93 void LoadRemoteFunctions() {
\r
94 user32dll=LoadLibrary("user32.dll");
\r
95 if (user32dll!=NULL) {
\r
96 dynGetRawInputData=(GETRAWINPUTDATAFNC)GetProcAddress(user32dll,"GetRawInputData");
\r
97 if (dynGetRawInputData!=NULL) {
\r
98 dynRegisterRawInputDevices=(REGISTERRAWINPUTDEVICEFNC)GetProcAddress(user32dll,"RegisterRawInputDevices");
\r
99 if (dynRegisterRawInputDevices!=NULL) {
\r
106 bool InitApp(HINSTANCE hinst,int cmdshow);
\r
108 HWND win_main;//global window handle
\r
109 HWND win;//global child window handle
\r
112 #define ERROR_MSG(str) MessageBox(win_main,str,"Error!",MB_OK|MB_ICONWARNING)
\r
113 INT WINAPI WinMain( HINSTANCE hinst , HINSTANCE previnst, LPSTR cmdline, int cmdshow)
\r
116 //On Windows we have to init a window, we use DXUT
\r
117 LoadRemoteFunctions();
\r
118 if (!InitApp(hinst,cmdshow)) return false;
\r
119 //Starting Network support
\r
121 int result = WSAStartup(MAKEWORD(2,2),&wsadat);
\r
122 if (result!=NO_ERROR) {
\r
123 ERROR_MSG("Initialising WinSocked: Error at WSAStartup()\n");
\r
127 result= CoInitializeEx(NULL,COINIT_MULTITHREADED );//Initialize COM for DirectShow
\r
128 if (result!=S_OK) {
\r
129 ERROR_MSG("Initialising COM: Error at Coinitialize()\n");
\r
136 // Init global vars ------------------------------------------------------------------------------------------------
\r
138 logger = new Log();
\r
139 remote = new RemoteWin();
\r
140 mtd = new MtdWin();
\r
141 led = new LedWin();
\r
142 timers = new Timers();
\r
143 osd = new OsdWin();
\r
145 video = new VideoWin();
\r
146 audio = new AudioWin();
\r
147 viewman = new ViewMan();
\r
148 command = new Command();
\r
150 if (!logger || !remote || !mtd || !led || !osd || !video || !audio || !viewman || !command)
\r
152 ERROR_MSG("Could not create objects. Memory problems?\n");
\r
158 // Get logging module started --------------------------------------------------------------------------------------
\r
160 if (!logger->init(Log::DEBUG, "vompwin.log", true))
\r
162 ERROR_MSG("Could not initialise log object. Aborting.\n");
\r
168 logger->log("Core", Log::INFO, "Starting up...");
\r
172 // Init modules ----------------------------------------------------------------------------------------------------
\r
175 success = remote->init("/dev/rawir");
\r
178 logger->log("Core", Log::INFO, "Remote module initialised");
\r
182 logger->log("Core", Log::EMERG, "Remote module failed to initialise");
\r
188 success = led->init(0);
\r
191 logger->log("Core", Log::INFO, "LED module initialised");
\r
195 logger->log("Core", Log::EMERG, "LED module failed to initialise");
\r
201 success = mtd->init("/dev/mtd1");
\r
204 logger->log("Core", Log::INFO, "Mtd module initialised");
\r
208 logger->log("Core", Log::EMERG, "Mtd module failed to initialise");
\r
214 success = timers->init();
\r
217 logger->log("Core", Log::INFO, "Timers module initialised");
\r
221 logger->log("Core", Log::EMERG, "Timers module failed to initialise");
\r
227 UCHAR videoFormat = (UCHAR)mtd->getPALorNTSC();
\r
228 if (videoFormat == Video::PAL) logger->log("Core", Log::INFO, "Read from MTD: PAL 720x576");
\r
229 else if (videoFormat == Video::NTSC) logger->log("Core", Log::INFO, "Read from MTD: NTSC 720x480");
\r
230 else logger->log("Core", Log::INFO, "No help from MTD. Assuming NTSC 720x480");
\r
232 success = video->init(videoFormat);
\r
235 logger->log("Core", Log::INFO, "Video module initialised");
\r
239 logger->log("Core", Log::EMERG, "Video module failed to initialise");
\r
245 success = osd->init((void*)&win);
\r
248 logger->log("Core", Log::INFO, "OSD module initialised");
\r
252 logger->log("Core", Log::EMERG, "OSD module failed to initialise");
\r
258 success = audio->init(Audio::MPEG2_PES);
\r
261 logger->log("Core", Log::INFO, "Audio module initialised");
\r
265 logger->log("Core", Log::EMERG, "Audio module failed to initialise");
\r
271 success = vdr->init(3024);
\r
274 logger->log("Core", Log::INFO, "VDR module initialised");
\r
278 logger->log("Core", Log::EMERG, "VDR module failed to initialise");
\r
284 success = viewman->init();
\r
287 logger->log("Core", Log::INFO, "ViewMan module initialised");
\r
291 logger->log("Core", Log::EMERG, "ViewMan module failed to initialise");
\r
297 success = command->init();
\r
300 logger->log("Core", Log::INFO, "Command module initialised");
\r
304 logger->log("Core", Log::EMERG, "Command module failed to initialise");
\r
310 // Other init ------------------------------------------------------------------------------------------------------
\r
312 logger->log("Core", Log::NOTICE, "Startup successful");
\r
314 // Run main loop ---------------------------------------------------------------------------------------------------
\r
316 // Ok, all major device components and other bits are loaded and ready
\r
317 lastmousemove=timeGetTime();
\r
319 HANDLE commandthread;
\r
320 commandthread= CreateThread(NULL, 0, commandthreadStart, NULL,0,
\r
323 message.message=WM_NULL;
\r
325 while(run && WaitForSingleObject(commandthread,0)==WAIT_TIMEOUT) {
\r
326 if (PeekMessage(&message, NULL, 0,0,PM_REMOVE)!=0) {
\r
327 if (TranslateAccelerator(win_main,acc,&message)==NULL) {
\r
328 TranslateMessage(&message);
\r
329 DispatchMessage(&message);
\r
330 switch (message.message) {
\r
332 run=false; //TODO post exit to command Messages
\r
337 ((OsdWin*)osd)->Render();
\r
340 // When that returns quit ------------------------------------------------------------------------------------------
\r
341 WaitForSingleObject(commandthread,INFINITE);
\r
344 if (user32dll) FreeModule(user32dll);
\r
349 bool TranslateMousePosition(POINT *pos) {
\r
352 ScreenToClient(win,pos);
\r
353 GetClientRect(win,&clientrect);
\r
354 if (!PtInRect(&clientrect,*pos)) return false;//Don't pass it further
\r
355 pos->x=((double)pos->x)/((double) (clientrect.right-clientrect.left))
\r
356 *((double)Video::getInstance()->getScreenWidth());
\r
357 pos->y=((double)pos->y)/((double) (clientrect.bottom-clientrect.top))
\r
358 *((double)Video::getInstance()->getScreenHeight());
\r
365 void CalculateWindowSize(RECT * size,ULONG size_mode) {
\r
367 DWORD width, height;
\r
368 DWORD adjheight,adjwidth;
\r
369 if (!wnd_fullscreen) {
\r
370 DWORD flags =WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU
\r
371 |WS_MINIMIZEBOX | WS_SIZEBOX |WS_MAXIMIZEBOX;
\r
372 RECT wnted={50,50,150,150};
\r
373 AdjustWindowRect(&wnted,flags ,false);
\r
374 adjwidth=-wnted.left+wnted.right-100;
\r
375 adjheight=-wnted.top+wnted.bottom-100;
\r
377 adjwidth=adjheight=0;
\r
379 width=size->right-size->left-adjwidth;
\r
380 height=size->bottom-size->top-adjheight;
\r
381 UCHAR mode=video->getMode();
\r
382 UCHAR aspect=((VideoWin*)video)->getAspectRatio();
\r
383 UCHAR tvsize=((VideoWin*)video)->getPseudoTVsize();
\r
384 double aspectrt=4./3.;
\r
385 if (tvsize==Video::ASPECT16X9) {
\r
386 if (aspect==Video::ASPECT16X9) {
\r
387 aspectrt=4./3.; //looks strange, but it is a 16:9 tv
\r
388 } else if (aspect==Video::ASPECT4X3) {
\r
389 aspectrt=4./3./(16./9.)*(4./3.); //I hope this is correct
\r
391 } else if (tvsize==Video::ASPECT4X3) {
\r
392 if (aspect==Video::ASPECT16X9) {
\r
393 if (mode!=Video::NORMAL) {
\r
398 } else if (aspect==Video::ASPECT4X3) {
\r
402 if (!wnd_fullscreen) {
\r
403 switch (size_mode) {
\r
405 case WMSZ_BOTTOMRIGHT:
\r
407 case WMSZ_TOPRIGHT:
\r
408 width=(ULONG)(((double)height)*aspectrt);
\r
409 size->right=size->left+width+adjwidth;
\r
411 case WMSZ_BOTTOMLEFT:
\r
413 width=(ULONG)(((double)height)*aspectrt);
\r
414 size->left=size->right-width-adjwidth;
\r
418 height=(ULONG)(((double)width)/aspectrt);
\r
419 size->bottom=size->top+height+adjheight;
\r
422 MoveWindow(win,0,0,width,height,TRUE);
\r
424 RECT newrect={0,0,width,height};
\r
426 if ((ULONG)(((double)height)*aspectrt)>width) {
\r
427 newlength=(ULONG)(((double)width)/aspectrt);
\r
428 newrect.top+=(height-newlength)/2;
\r
429 newrect.bottom-=(height-newlength);
\r
431 newlength=(ULONG)(((double)height)*aspectrt);
\r
432 newrect.left+=(width-newlength)/2;
\r
433 newrect.right-=(width-newlength);
\r
435 MoveWindow(win,newrect.left,newrect.top,newrect.right,newrect.bottom,TRUE);
\r
440 void AdjustWindow() {
\r
441 if (!wnd_fullscreen) {
\r
443 GetWindowRect(win_main,&winrect);
\r
444 CalculateWindowSize(&winrect,WMSZ_BOTTOM);
\r
445 MoveWindow(win_main,winrect.left,
\r
446 winrect.top,winrect.right-winrect.left,winrect.bottom-winrect.top,true);
\r
449 GetWindowRect(win_main,&winrect);
\r
450 CalculateWindowSize(&winrect,WMSZ_BOTTOM);
\r
455 void ToggleFullscreen() {
\r
456 if (wnd_fullscreen) {
\r
457 wnd_fullscreen=false;
\r
458 SetWindowLong(win_main,GWL_STYLE,WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU
\r
459 |WS_MINIMIZEBOX | WS_SIZEBOX |WS_MAXIMIZEBOX);
\r
460 SetWindowPos(win_main,NULL,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
\r
462 SetWindowPos(win_main,wnd_topmost?HWND_TOPMOST:HWND_TOP,wnd_fs_rect.left,wnd_fs_rect.top,
\r
463 wnd_fs_rect.right-wnd_fs_rect.left,
\r
464 wnd_fs_rect.bottom-wnd_fs_rect.top,
\r
465 SWP_DRAWFRAME | SWP_FRAMECHANGED);
\r
466 MoveWindow(win,wnd_fs_rect_client.left,wnd_fs_rect_client.top,
\r
467 wnd_fs_rect_client.right-wnd_fs_rect_client.left,
\r
468 wnd_fs_rect_client.bottom-wnd_fs_rect_client.top,TRUE);
\r
471 GetWindowRect(win_main,&wnd_fs_rect);
\r
472 GetWindowRect(win,&wnd_fs_rect_client);
\r
473 SetWindowLong(win_main,GWL_STYLE,WS_VISIBLE | WS_POPUP );
\r
474 SetWindowPos(win_main,NULL,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
\r
475 HMONITOR monitor=MonitorFromWindow(win_main,MONITOR_DEFAULTTONEAREST);
\r
476 MONITORINFO moninfo;
\r
477 moninfo.cbSize=sizeof(moninfo);
\r
478 wnd_fullscreen=true;
\r
479 if (!GetMonitorInfo(monitor,&moninfo)) return ;
\r
480 SetWindowPos(win_main,wnd_topmost?HWND_TOPMOST:HWND_TOP,moninfo.rcMonitor.left,moninfo.rcMonitor.top,
\r
481 moninfo.rcMonitor.right,moninfo.rcMonitor.bottom,SWP_FRAMECHANGED);
\r
490 void ToggleTopmost() {
\r
491 wnd_topmost=!wnd_topmost;
\r
492 SetWindowPos(win_main,wnd_topmost?HWND_TOPMOST:HWND_NOTOPMOST,0,0,
\r
493 0,0,SWP_NOMOVE | SWP_NOSIZE);
\r
496 void CursorUpdate() {
\r
498 GetCursorPos(&cursorpos);
\r
500 asswind=WindowFromPoint(cursorpos);
\r
501 if (asswind!=win_main && asswind!=win) {
\r
502 return ; //not our responsibility
\r
504 if ((timeGetTime()-lastmousemove)<4000 || cmenu) {
\r
505 SetCursor(LoadCursor(NULL,IDC_ARROW));
\r
511 bool ContextMenu(HWND wind,int x,int y) {
\r
514 ScreenToClient(wind,&p);
\r
515 GetClientRect(wind,&clientrect);
\r
516 if (!PtInRect(&clientrect,p)) return false;
\r
517 ClientToScreen(wind,&p);
\r
520 menu=LoadMenu(hinstance,MAKEINTRESOURCE(VOMPMENU));
\r
521 popup=GetSubMenu(menu,0);
\r
522 if (wnd_fullscreen) {
\r
523 CheckMenuItem(popup,VOMP_FULL_SCREEN,MF_BYCOMMAND|MF_CHECKED);
\r
525 CheckMenuItem(popup,VOMP_FULL_SCREEN,MF_BYCOMMAND|MF_UNCHECKED);
\r
528 CheckMenuItem(popup,VOMP_TOPMOST,MF_BYCOMMAND|MF_CHECKED);
\r
530 CheckMenuItem(popup,VOMP_TOPMOST,MF_BYCOMMAND|MF_UNCHECKED);
\r
533 TrackPopupMenu(popup,TPM_RIGHTBUTTON|TPM_LEFTALIGN,x,y,0,wind, NULL);
\r
541 LONG FAR PASCAL WindowProc(HWND wind, UINT msg, WPARAM wparam, LPARAM lparam)
\r
546 //TODO: call command
\r
547 logger->log("Core", Log::NOTICE, "Window closed, shutting down...");
\r
549 ((RemoteWin*)Remote::getInstance())->SendPower();
\r
550 PostQuitMessage(0);
\r
553 CalculateWindowSize((RECT*) lparam,wparam);
\r
557 int width = LOWORD(lparam);
\r
558 int height = HIWORD(lparam);
\r
565 if (GetUpdateRect(wind, &r, FALSE)) {
\r
566 BeginPaint(wind, &ps);
\r
567 //Call Painting Mechanism
\r
568 EndPaint(wind, &ps);
\r
572 if (((RemoteWin*)remote)->ReceiveButtonVK(wparam)) {
\r
573 return 0L; //We process that Key
\r
575 return DefWindowProc(wind, msg, wparam, lparam);
\r
579 case WM_APPCOMMAND:
\r
580 if (((RemoteWin*)remote)->ReceiveButtonAP(GET_APPCOMMAND_LPARAM(lparam))){
\r
581 return TRUE; //yes we process that message
\r
583 return DefWindowProc(wind, msg, wparam, lparam);
\r
592 dynGetRawInputData((HRAWINPUT)lparam,RID_INPUT,NULL,&risize,sizeof(RAWINPUTHEADER));
\r
593 lpit=(LPRAWINPUT)malloc(risize);
\r
594 dynGetRawInputData((HRAWINPUT)lparam,RID_INPUT,lpit,&risize,sizeof(RAWINPUTHEADER));
\r
596 if (lpit->header.dwType==RIM_TYPEHID && lpit->data.hid.dwSizeHid>=2) {
\r
597 DWORD button=lpit->data.hid.bRawData[1] | (lpit->data.hid.bRawData[0]<< 8);
\r
598 if (((RemoteWin*)remote)->ReceiveButtonRI(button)){
\r
600 return 0; //yes we process that message
\r
605 return DefWindowProc(wind, msg, wparam, lparam);
\r
610 if (LOWORD(wparam)==VOMP_FULL_SCREEN) {
\r
611 ToggleFullscreen();
\r
614 if (LOWORD(wparam)==VOMP_TOPMOST) {
\r
618 if (((RemoteWin*)remote)->ReceiveButtonAP(LOWORD(wparam))){
\r
619 return 0; //yes we process that message
\r
621 return DefWindowProc(wind, msg, wparam, lparam);
\r
626 if (((HANDLE)wparam)==win) {
\r
630 return DefWindowProc(wind, msg, wparam, lparam);
\r
633 case WM_SYSCOMMAND:
\r
634 if (wparam==SC_MAXIMIZE) {
\r
635 ToggleFullscreen();
\r
637 } else if (wparam==SC_SCREENSAVE || wparam==SC_MONITORPOWER) {
\r
640 return DefWindowProc(wind,msg,wparam, lparam);
\r
643 case WM_MOUSEMOVE: {
\r
645 lastmousemove=timeGetTime();
\r
646 SetCursor(LoadCursor(NULL,IDC_ARROW));
\r
647 SetTimer(wind,VOMP_CURSORUPDATE,4500,NULL);
\r
648 POINT mpos={GET_X_LPARAM(lparam),GET_Y_LPARAM(lparam)};
\r
649 ClientToScreen(wind,&mpos);
\r
650 if (TranslateMousePosition(&mpos)) {
\r
651 Message *mousemes=new Message();
\r
652 mousemes->message=Message::MOUSE_MOVE;
\r
653 mousemes->from=NULL;
\r
654 mousemes->to=ViewMan::getInstance();
\r
655 mousemes->parameter=(mpos.x & 0xFFFF)<< 16| (mpos.y & 0xFFFF);
\r
657 //command->postMessageFromOuterSpace(mousemes);
\r
658 command->postMessageIfNotBusy(mousemes);
\r
662 //return DefWindowProc(wind,msg,wparam, lparam);
\r
666 if (wparam==VOMP_CURSORUPDATE) {
\r
670 return DefWindowProc(wind, msg, wparam, lparam);
\r
673 case WM_CONTEXTMENU:
\r
674 if (!ContextMenu(wind,GET_X_LPARAM(lparam),GET_Y_LPARAM(lparam))) {
\r
675 return DefWindowProc(wind, msg, wparam, lparam);
\r
680 case WM_LBUTTONDOWN:{
\r
681 POINT mpos={GET_X_LPARAM(lparam),GET_Y_LPARAM(lparam)};
\r
682 ClientToScreen(wind,&mpos);
\r
683 if (TranslateMousePosition(&mpos)) {
\r
684 Message *mousemes=new Message();
\r
685 mousemes->message=Message::MOUSE_LBDOWN;
\r
686 mousemes->from=NULL;
\r
687 mousemes->to=ViewMan::getInstance();
\r
688 mousemes->parameter=(mpos.x & 0xFFFF)<< 16| (mpos.y & 0xFFFF);
\r
690 command->postMessageFromOuterSpace(mousemes);
\r
694 return DefWindowProc(wind, msg, wparam, lparam);
\r
700 bool InitApp(HINSTANCE hinst,int cmdshow) {
\r
704 wcs.style = CS_HREDRAW | CS_VREDRAW;
\r
705 wcs.lpfnWndProc = WindowProc;
\r
706 wcs.cbClsExtra = 0;
\r
707 wcs.cbWndExtra = sizeof(DWORD);
\r
708 wcs.hInstance = hinst;
\r
710 wcs.hCursor = NULL;
\r
711 wcs.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
\r
712 wcs.lpszMenuName = NULL;
\r
713 wcs.lpszClassName = "vomp";
\r
714 acc=LoadAccelerators(hinst,MAKEINTRESOURCE(VOMPACCELERATOR));
\r
715 if (!RegisterClass(&wcs))
\r
717 flags =WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU
\r
718 |WS_MINIMIZEBOX | WS_SIZEBOX |WS_MAXIMIZEBOX;
\r
719 RECT wnted={50,50,768+50,576+50};
\r
720 AdjustWindowRect(&wnted,flags ,false);
\r
721 win_main=CreateWindow("vomp","VOMP on Windows",flags, CW_USEDEFAULT,CW_USEDEFAULT,
\r
722 wnted.right-wnted.left,wnted.bottom-wnted.top,NULL,NULL,hinst,NULL);
\r
725 ShowWindow(win_main,SW_SHOWNORMAL);
\r
726 UpdateWindow(win_main);
\r
727 /* in order to handle letterboxing we use a child window */
\r
728 WNDCLASS child_wcs;
\r
729 child_wcs.style = CS_HREDRAW | CS_VREDRAW;
\r
730 child_wcs.lpfnWndProc = WindowProc;
\r
731 child_wcs.cbClsExtra = 0;
\r
732 child_wcs.cbWndExtra = sizeof(DWORD);
\r
733 child_wcs.hInstance = hinst;
\r
734 child_wcs.hIcon = NULL;
\r
735 child_wcs.hCursor = NULL;
\r
736 child_wcs.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
\r
737 child_wcs.lpszMenuName = NULL;
\r
738 child_wcs.lpszClassName = "vomp_playback";
\r
739 if (!RegisterClass(&child_wcs))
\r
742 win=CreateWindow("vomp_playback","Vomp Playback Window",WS_VISIBLE | WS_CHILD |WS_CLIPCHILDREN,
\r
743 0,0,768,576,win_main,NULL,hinst,NULL);
\r
746 ShowWindow(win,SW_SHOWNORMAL);
\r
748 if (remotefnc) {//at least windows XP
\r
749 /* We want to support MCE Remote controls*/
\r
750 RAWINPUTDEVICE remote_control_data[4];
\r
751 ZeroMemory(remote_control_data,sizeof(remote_control_data));
\r
752 remote_control_data[0].usUsagePage=0xFFBC;
\r
753 remote_control_data[0].usUsage=0x88;
\r
754 remote_control_data[0].dwFlags=0;
\r
755 remote_control_data[1].usUsagePage=0x0C;
\r
756 remote_control_data[1].usUsage=0x80;
\r
757 remote_control_data[1].dwFlags=0;
\r
758 remote_control_data[2].usUsagePage=0x0C;
\r
759 remote_control_data[2].usUsage=0x01;
\r
760 remote_control_data[2].dwFlags=0;
\r
761 remote_control_data[3].usUsagePage=0x01;
\r
762 remote_control_data[3].usUsage=0x80;
\r
763 remote_control_data[3].dwFlags=0;
\r
764 if (dynRegisterRawInputDevices(remote_control_data,4,sizeof(remote_control_data[0]))!=TRUE) {
\r
765 MessageBox(0,"Registering remote control failed!","Aborting!",0);
\r
777 // -------------------------------------------------------------------------------------------------------------------
\r
779 void shutdown(int code)
\r
783 viewman->shutdown();
\r
785 logger->log("Core", Log::NOTICE, "ViewMan module shut down");
\r
788 if (command) // shut down command here in case views have posted messages
\r
790 command->shutdown();
\r
792 logger->log("Core", Log::NOTICE, "Command module shut down");
\r
799 logger->log("Core", Log::NOTICE, "VDR module shut down");
\r
806 logger->log("Core", Log::NOTICE, "OSD module shut down");
\r
813 logger->log("Core", Log::NOTICE, "Audio module shut down");
\r
820 logger->log("Core", Log::NOTICE, "Video module shut down");
\r
825 timers->shutdown();
\r
827 logger->log("Core", Log::NOTICE, "Timers module shut down");
\r
834 logger->log("Core", Log::NOTICE, "MTD module shut down");
\r
841 logger->log("Core", Log::NOTICE, "LED module shut down");
\r
846 remote->shutdown();
\r
848 logger->log("Core", Log::NOTICE, "Remote module shut down");
\r
853 logger->log("Core", Log::NOTICE, "Log module shutting down... bye!\n\n");
\r
854 logger->shutdown();
\r
861 // -------------------------------------------------------------------------------------------------------------------
\r
863 ULLONG ntohll(ULLONG a)
\r
868 ULLONG htonll(ULLONG a)
\r
870 return (((ULLONG)htonl((ULONG)((a<<32)>> 32))<<32)
\r
871 |(ULONG)htonl(((ULONG) (a >> 32))));
\r