Changeset 5965 in vbox for trunk/src/VBox/Frontends/VBoxBFE
- Timestamp:
- Dec 5, 2007 2:56:09 PM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxBFE
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxBFE/ConsoleImpl.h
r4071 r5965 103 103 enmHKeyState = HKEYSTATE_NORMAL; 104 104 mfInitialized = false; 105 mfInputGrab = false; 105 106 } 106 107 virtual ~Console() {} 107 108 108 109 virtual void updateTitlebar() = 0; 109 virtual void updateTitlebar Save(int iPercent) = 0;110 virtual void updateTitlebarProgress(const char *pszStr, int iPercent) = 0; 110 111 111 112 virtual void inputGrabStart() = 0; 112 113 virtual void inputGrabEnd() = 0; 114 virtual bool inputGrabbed() { return mfInputGrab; } 113 115 virtual void resetCursor() {} 114 116 … … 122 124 virtual void eventQuit() = 0; 123 125 bool initialized() { return mfInitialized; } 126 virtual void progressInfo(PVM pVM, unsigned uPercent, void *pvUser) = 0; 127 virtual void resetKeys(void) = 0; 124 128 125 129 protected: 126 130 HKEYSTATE enmHKeyState; 127 131 bool mfInitialized; 132 bool mfInputGrab; 128 133 }; 129 134 -
trunk/src/VBox/Frontends/VBoxBFE/DisplayImpl.cpp
r4512 r5965 249 249 checkCoordBounds (&x, &y, &w, &h, mpDrv->Connector.cx, mpDrv->Connector.cy); 250 250 251 if (w == 0 || h == 0) 252 { 253 mFramebuffer->Unlock(); 254 return; 255 } 256 251 257 // special processing for the internal Framebuffer 252 258 if (mInternalFramebuffer) … … 489 495 /* Continue with normal processing because the status here is ResizeStatus_Void. */ 490 496 Assert (pDisplay->mu32ResizeStatus == ResizeStatus_Void); 497 /* Repaint the display because VM continued to run during the framebuffer resize. */ 498 pDrv->pUpPort->pfnUpdateDisplayAll(pDrv->pUpPort); 499 /* Ignore the refresh to replay the logic. */ 500 return; 491 501 } 492 502 else if (u32ResizeStatus == ResizeStatus_InProgress) -
trunk/src/VBox/Frontends/VBoxBFE/DisplayImpl.h
r4512 r5965 57 57 void resetFramebuffer(); 58 58 59 void setRunning(void) { mfMachineRunning = true; }; 60 59 61 60 62 private: -
trunk/src/VBox/Frontends/VBoxBFE/Makefile.kmk
r5586 r5965 52 52 KeyboardImpl.cpp \ 53 53 StatusImpl.cpp \ 54 MachineDebuggerImpl.cpp 54 MachineDebuggerImpl.cpp \ 55 VMControl.cpp 56 57 ifdef VBOX_WITH_HGCM 58 VBoxBFE_DEFS += VBOX_HGCM 59 VBoxBFE_SOURCES += \ 60 HGCM.cpp \ 61 HGCMThread.cpp \ 62 HGCMObjects.cpp 63 endif 55 64 56 65 VBoxBFE_SOURCES.darwin = \ … … 60 69 L4Console.cpp \ 61 70 L4Framebuffer.cpp \ 71 L4IDLInterface.cpp \ 62 72 EmulCpp.cpp 63 73 … … 94 104 /usr/include \ 95 105 /usr/local/include 96 VBoxBFE_INCS.linux = \97 $(PATH_BIN)/sdk/include \98 $(VBOX_XPCOM_INCS)99 106 100 107 VBoxBFE_LIBS = \ … … 119 126 $(L4_LIBDIR)/libl4con-idl.a \ 120 127 $(L4_LIBDIR)/libconstream-server.a \ 128 $(L4_LIBDIR)/libvboxctrl-server.a \ 121 129 $(L4_LIBDIR)/libl4sys.a 122 130 VBoxBFE_LIBS.darwin = \ 123 131 $(LIB_SDK_LIBSDL_SDLMAIN) 124 132 VBoxBFE_LDFLAGS.darwin = -framework Foundation -framework AppKit 125 126 VBoxBFE_LIBPATH.linux = \127 $(LIBPATH_XPCOM) ## why?128 129 133 130 134 VBoxBFE_CXXFLAGS.win = \ … … 137 141 VBoxBFE_CFLAGS.linux += -O ## @todo what's this good for? 138 142 143 VBoxBFE_SDLConsole.cpp_DEPS = $(PATH_VBoxBFE)/Ico64x01.h 144 139 145 140 146 include $(PATH_KBUILD)/footer.kmk 141 147 148 # Convert the pnm-file to a byte array. 149 $(PATH_VBoxBFE)/Ico64x01.h: ico64x01.pnm $(VBOX_BIN2C) | $(call DIRDEP,$(PATH_VBoxBFE)) 150 $(call MSG_TOOL,bin2c,VBoxBFE,$<,$@) 151 $(QUIET)$(VBOX_BIN2C) Ico64x01 $< $@ -
trunk/src/VBox/Frontends/VBoxBFE/SDLConsole.cpp
r4861 r5965 64 64 #include "Framebuffer.h" 65 65 #include "MachineDebuggerImpl.h" 66 #include "VMControl.h" 66 67 67 68 #include "ConsoleImpl.h" 68 69 #include "SDLConsole.h" 70 #include "Ico64x01.h" 69 71 70 72 /******************************************************************************* … … 76 78 int rc; 77 79 78 fInputGrab= false;80 mfInputGrab = false; 79 81 gpDefaultCursor = NULL; 80 82 gpCustomCursor = NULL; … … 82 84 gpCustomWMcursor = NULL; 83 85 mfInitialized = false; 86 mWMIcon = NULL; 84 87 85 88 memset(gaModifiersState, 0, sizeof(gaModifiersState)); … … 110 113 } 111 114 #endif 115 116 if (12320 == g_cbIco64x01) 117 { 118 mWMIcon = SDL_AllocSurface(SDL_SWSURFACE, 64, 64, 24, 0xff, 0xff00, 0xff0000, 0); 119 /** @todo make it as simple as possible. No PNM interpreter here... */ 120 if (mWMIcon) 121 { 122 memcpy(mWMIcon->pixels, g_abIco64x01+32, g_cbIco64x01-32); 123 SDL_WM_SetIcon(mWMIcon, NULL); 124 } 125 } 112 126 113 127 /* … … 120 134 SDLConsole::~SDLConsole() 121 135 { 122 if ( fInputGrab)136 if (mfInputGrab) 123 137 inputGrabEnd(); 138 if (mWMIcon) 139 { 140 SDL_FreeSurface(mWMIcon); 141 mWMIcon = NULL; 142 } 124 143 } 125 144 … … 129 148 130 149 if (SDL_WaitEvent(ev) != 1) 131 {132 150 return CONEVENT_QUIT; 133 }134 151 135 152 switch (ev->type) … … 188 205 { 189 206 /* toggle grabbing state */ 190 if (!fInputGrab) 191 { 207 if (!mfInputGrab) 192 208 inputGrabStart(); 193 }194 209 else 195 {196 210 inputGrabEnd(); 197 }198 211 199 212 /* SDL doesn't always reset the keystates, correct it */ … … 258 271 case SDL_MOUSEMOTION: 259 272 { 260 if (fInputGrab || gMouse->getAbsoluteCoordinates()) 261 { 273 if (mfInputGrab || gMouse->getAbsoluteCoordinates()) 262 274 mouseSendEvent(0); 263 }264 275 break; 265 276 } … … 272 283 { 273 284 SDL_MouseButtonEvent *bev = &ev->button; 274 if (! fInputGrab && !gMouse->getAbsoluteCoordinates())285 if (!mfInputGrab && !gMouse->getAbsoluteCoordinates()) 275 286 { 276 287 if (ev->type == SDL_MOUSEBUTTONDOWN && (bev->state & SDL_BUTTON_LMASK)) … … 301 312 case SDL_ACTIVEEVENT: 302 313 { 303 if ( fInputGrab && (SDL_GetAppState() & SDL_ACTIVEEVENTMASK) == 0)314 if (mfInputGrab && (SDL_GetAppState() & SDL_ACTIVEEVENTMASK) == 0) 304 315 { 305 316 inputGrabEnd(); … … 390 401 } 391 402 403 case SDL_VIDEORESIZE: 404 { 405 /* ignore this */ 406 break; 407 } 408 392 409 default: 393 410 { … … 403 420 * Push the exit event forcing the main event loop to terminate. 404 421 */ 422 void SDLConsole::doEventQuit() 423 { 424 SDL_Event event; 425 426 event.type = SDL_USEREVENT; 427 event.user.type = SDL_USER_EVENT_TERMINATE; 428 event.user.code = VBOXSDL_TERM_NORMAL; 429 SDL_PushEvent(&event); 430 } 431 405 432 void SDLConsole::eventQuit() 406 433 { 407 SDL_Event event; 408 409 event.type = SDL_USEREVENT; 410 event.user.type = SDL_USER_EVENT_TERMINATE; 411 SDL_PushEvent(&event); 434 doEventQuit(); 412 435 } 413 436 … … 1116 1139 // dummy read to avoid moving the mouse 1117 1140 SDL_GetRelativeMouseState(NULL, NULL); 1118 fInputGrab = 1;1141 mfInputGrab = true; 1119 1142 updateTitlebar(); 1120 1143 } … … 1131 1154 DisableGlobalHotKeys(false); 1132 1155 #endif 1133 fInputGrab = 0;1156 mfInputGrab = false; 1134 1157 updateTitlebar(); 1135 1158 } … … 1149 1172 bool abs; 1150 1173 1151 abs = (gMouse->getAbsoluteCoordinates() && ! fInputGrab) || gMouse->getNeedsHostCursor();1174 abs = (gMouse->getAbsoluteCoordinates() && !mfInputGrab) || gMouse->getNeedsHostCursor(); 1152 1175 1153 1176 state = abs ? SDL_GetMouseState(&x, &y) : SDL_GetRelativeMouseState(&x, &y); … … 1220 1243 } 1221 1244 1245 void SDLConsole::progressInfo(PVM pVM, unsigned uPercent, void *pvUser) 1246 { 1247 if (uPercent != g_uProgressPercent) 1248 { 1249 SDL_Event event = {0}; 1250 event.type = SDL_USEREVENT; 1251 event.user.type = SDL_USER_EVENT_UPDATE_TITLEBAR; 1252 SDL_PushEvent(&event); 1253 g_uProgressPercent = uPercent; 1254 } 1255 } 1256 1222 1257 /** 1223 1258 * Build the titlebar string … … 1225 1260 void SDLConsole::updateTitlebar() 1226 1261 { 1227 char title[1024]; 1228 1229 strcpy(title, "innotek VirtualBox"); 1230 1231 if (machineState == VMSTATE_SUSPENDED) 1232 strcat(title, " - [Paused]"); 1233 1234 if (fInputGrab) 1235 strcat(title, " - [Input captured]"); 1262 char pszTitle[1024]; 1263 1264 RTStrPrintf(pszTitle, sizeof(pszTitle), 1265 "innotek VirtualBox%s%s", 1266 g_uProgressPercent == ~0U && machineState == VMSTATE_SUSPENDED ? " - [Paused]" : "", 1267 mfInputGrab ? " - [Input captured]": ""); 1268 1269 if (g_uProgressPercent != ~0U) 1270 RTStrPrintf(pszTitle + strlen(pszTitle), sizeof(pszTitle) - strlen(pszTitle), 1271 " - %s: %u%%", g_pszProgressString, g_uProgressPercent); 1236 1272 1237 1273 #if defined(VBOXSDL_ADVANCED_OPTIONS) && defined(DEBUG) … … 1252 1288 PRTLOGGER pLogger = RTLogDefaultInstance(); 1253 1289 bool fEnabled = (pLogger && !(pLogger->fFlags & RTLOGFLAGS_DISABLED)); 1254 RTStrPrintf( title + strlen(title), sizeof(title) - strlen(title),1290 RTStrPrintf(pszTitle + strlen(pszTitle), sizeof(pszTitle) - strlen(pszTitle), 1255 1291 " [STEP=%d CS=%d PAT=%d RR0=%d RR3=%d LOG=%d]", 1256 1292 singlestepEnabled == TRUE, csamEnabled == TRUE, patmEnabled == TRUE, … … 1259 1295 #endif /* DEBUG */ 1260 1296 1261 SDL_WM_SetCaption( title, "innotek VirtualBox");1297 SDL_WM_SetCaption(pszTitle, "innotek VirtualBox"); 1262 1298 } 1263 1299 … … 1266 1302 * @param iPercent Percentage. 1267 1303 */ 1268 void SDLConsole::updateTitlebar Save(int iPercent)1304 void SDLConsole::updateTitlebarProgress(const char *pszStr, int iPercent) 1269 1305 { 1270 1306 char szTitle[256]; 1271 1307 AssertMsg(iPercent >= 0 && iPercent <= 100, ("%d\n", iPercent)); 1272 RTStrPrintf(szTitle, sizeof(szTitle), "innotek VirtualBox - Saving %d%%...", iPercent);1308 RTStrPrintf(szTitle, sizeof(szTitle), "innotek VirtualBox - %s %d%%...", pszStr, iPercent); 1273 1309 SDL_WM_SetCaption(szTitle, "innotek VirtualBox"); 1274 1310 } … … 1526 1562 case SDLK_f: 1527 1563 { 1528 if (gfAllowFullscreenToggle) 1529 { 1530 gFramebuffer->setFullscreen(!gFramebuffer->getFullscreen()); 1531 1532 /* 1533 * We have switched from/to fullscreen, so request a full 1534 * screen repaint, just to be sure. 1535 */ 1536 gDisplay->InvalidateAndUpdate(); 1537 } 1564 VMCtrlToggleFullscreen(); 1538 1565 break; 1539 1566 } … … 1545 1572 { 1546 1573 if (machineState == VMSTATE_RUNNING) 1547 { 1548 if (fInputGrab) 1549 inputGrabEnd(); 1550 1551 PVMREQ pReq; 1552 int rcVBox = VMR3ReqCall(pVM, &pReq, RT_INDEFINITE_WAIT, 1553 (PFNRT)VMR3Suspend, 1, pVM); 1554 AssertRC(rcVBox); 1555 if (VBOX_SUCCESS(rcVBox)) 1556 { 1557 rcVBox = pReq->iStatus; 1558 VMR3ReqFree(pReq); 1559 } 1560 } 1574 VMCtrlPause(); 1561 1575 else 1562 if (machineState == VMSTATE_SUSPENDED) 1563 { 1564 PVMREQ pReq; 1565 int rcVBox = VMR3ReqCall(pVM, &pReq, RT_INDEFINITE_WAIT, 1566 (PFNRT)VMR3Resume, 1, pVM); 1567 AssertRC(rcVBox); 1568 if (VBOX_SUCCESS(rcVBox)) 1569 { 1570 rcVBox = pReq->iStatus; 1571 VMR3ReqFree(pReq); 1572 } 1573 } 1576 VMCtrlResume(); 1574 1577 updateTitlebar(); 1575 1578 break; … … 1581 1584 case SDLK_r: 1582 1585 { 1583 PVMREQ pReq; 1584 int rcVBox = VMR3ReqCall(pVM, &pReq, RT_INDEFINITE_WAIT, 1585 (PFNRT)VMR3Reset, 1, pVM); 1586 AssertRC(rcVBox); 1587 if (VBOX_SUCCESS(rcVBox)) 1588 { 1589 rcVBox = pReq->iStatus; 1590 VMR3ReqFree(pReq); 1591 } 1586 VMCtrlReset(); 1592 1587 break; 1593 1588 } … … 1607 1602 case SDLK_h: 1608 1603 { 1609 PPDMIBASE pBase; 1610 int vrc = PDMR3QueryDeviceLun (pVM, "acpi", 0, 0, &pBase); 1611 if (VBOX_SUCCESS (vrc)) 1612 { 1613 Assert (pBase); 1614 PPDMIACPIPORT pPort = 1615 (PPDMIACPIPORT) pBase->pfnQueryInterface(pBase, PDMINTERFACE_ACPI_PORT); 1616 vrc = pPort ? pPort->pfnPowerButtonPress(pPort) : VERR_INVALID_POINTER; 1617 } 1604 VMCtrlACPIButton(); 1618 1605 break; 1619 1606 } 1620 1607 1621 #if 01622 1608 /* 1623 1609 * Save the machine's state and exit … … 1625 1611 case SDLK_s: 1626 1612 { 1627 resetKeys(); 1628 RTThreadYield(); 1629 if (fInputGrab) 1630 inputGrabEnd(); 1631 RTThreadYield(); 1632 updateTitlebarSave(0); 1633 gProgress = NULL; 1634 int rc = gConsole->SaveState(gProgress.asOutParam()); 1635 if (rc != S_OK) 1636 { 1637 RTPrintf("Error saving state! rc = 0x%x\n", rc); 1638 return VINF_EM_TERMINATE; 1639 } 1640 Assert(gProgress); 1641 1642 /* 1643 * Wait for the operation to be completed and work 1644 * the title bar in the mean while. 1645 */ 1646 LONG cPercent = 0; 1647 for (;;) 1648 { 1649 BOOL fCompleted; 1650 rc = gProgress->COMGETTER(Completed)(&fCompleted); 1651 if (FAILED(rc) || fCompleted) 1652 break; 1653 LONG cPercentNow; 1654 rc = gProgress->COMGETTER(Percent)(&cPercentNow); 1655 if (FAILED(rc)) 1656 break; 1657 if (cPercentNow != cPercent) 1658 { 1659 UpdateTitlebarSave(cPercent); 1660 cPercent = cPercentNow; 1661 } 1662 1663 /* wait */ 1664 rc = gProgress->WaitForCompletion(100); 1665 if (FAILED(rc)) 1666 break; 1667 /// @todo process gui events. 1668 } 1669 1670 /* 1671 * What's the result of the operation? 1672 */ 1673 HRESULT lrc; 1674 rc = gProgress->COMGETTER(ResultCode)(&lrc); 1675 if (FAILED(rc)) 1676 lrc = ~0; 1677 if (!lrc) 1678 { 1679 UpdateTitlebarSave(100); 1680 RTThreadYield(); 1681 RTPrintf("Saved the state successfully.\n"); 1682 } 1683 else 1684 RTPrintf("Error saving state, lrc=%d (%#x)\n", lrc, lrc); 1685 return VINF_EM_TERMINATE; 1686 } 1687 #endif 1613 VMCtrlSave(doEventQuit); 1614 break; 1615 } 1616 1688 1617 /* 1689 1618 * Not a host key combination. -
trunk/src/VBox/Frontends/VBoxBFE/SDLConsole.h
r4071 r5965 95 95 96 96 virtual void updateTitlebar(); 97 virtual void updateTitlebar Save(int iPercent);97 virtual void updateTitlebarProgress(const char *pszStr, int iPercent); 98 98 99 99 virtual void inputGrabStart(); … … 105 105 uint32_t yHot, uint32_t width, 106 106 uint32_t height, void *pShape); 107 virtual void progressInfo(PVM pVM, unsigned uPercent, void *pvUser); 107 108 108 109 virtual CONEVENT eventWait(); 109 110 virtual void eventQuit(); 110 111 virtual void resetCursor(); 112 virtual void resetKeys(void); 111 113 112 114 private: … … 116 118 void processKey(SDL_KeyboardEvent *ev); 117 119 void setPointerShape (const PointerShapeChangeData *data); 118 119 void resetKeys(void); 120 121 /** flag whether keyboard/mouse events are grabbed */ 122 bool fInputGrab; 120 static void doEventQuit(void); 123 121 124 122 /** modifier keypress status (scancode as index) */ … … 129 127 /** Custom window manager cursor? */ 130 128 WMcursor *gpCustomWMcursor; 129 /** the application Icon */ 130 SDL_Surface *mWMIcon; 131 131 #ifdef VBOXBFE_WITH_X11 132 132 SDL_SysWMinfo gSdlInfo; -
trunk/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp
r5698 r5965 35 35 #include <VBox/types.h> 36 36 #include <VBox/err.h> 37 #include <VBox/log.h> 37 38 #include <VBox/param.h> 38 39 #include <VBox/pdm.h> … … 41 42 # include <VBox/vusb.h> 42 43 #endif 43 #include <VBox/log.h> 44 #ifdef VBOX_HGCM 45 # include <VBox/shflsvc.h> 46 #endif 47 #include <iprt/alloca.h> 48 #include <iprt/assert.h> 49 #include <iprt/ctype.h> 50 #include <iprt/file.h> 44 51 #include <iprt/path.h> 45 #include <iprt/string.h>46 52 #include <iprt/runtime.h> 47 #include <iprt/assert.h>48 53 #include <iprt/semaphore.h> 49 54 #include <iprt/stream.h> 55 #include <iprt/string.h> 50 56 #include <iprt/thread.h> 51 57 #include <iprt/uuid.h> 52 #include <iprt/file.h>53 #include <iprt/alloca.h>54 #include <iprt/ctype.h>55 58 56 59 #include "VBoxBFE.h" … … 65 68 #include <sys/ioctl.h> 66 69 #include <linux/if_tun.h> 67 #endif68 69 #ifndef RT_OS_L470 #include <vector>71 70 #endif 72 71 … … 91 90 #include "L4Console.h" 92 91 #include "L4Framebuffer.h" 92 #include "L4IDLInterface.h" 93 93 #endif 94 94 95 95 #ifdef RT_OS_L4 96 # ifndef L4API_l4v2onv4 97 # include <l4/sys/ktrace.h> 98 # endif 96 # include <l4/sys/ktrace.h> 99 97 # include <l4/vboxserver/file.h> 100 98 #endif … … 122 120 *******************************************************************************/ 123 121 124 PVM pVM = NULL;125 Mouse *gMouse = NULL;126 VMDisplay *gDisplay = NULL;127 Keyboard *gKeyboard = NULL;128 VMMDev *gVMMDev = NULL;129 Framebuffer *gFramebuffer = NULL;130 MachineDebugger *gMachineDebugger = NULL;131 VMStatus *gStatus = NULL;132 Console *gConsole = NULL;122 PVM pVM = NULL; 123 Mouse *gMouse = NULL; 124 VMDisplay *gDisplay = NULL; 125 Keyboard *gKeyboard = NULL; 126 VMMDev *gVMMDev = NULL; 127 Framebuffer *gFramebuffer = NULL; 128 MachineDebugger *gMachineDebugger = NULL; 129 VMStatus *gStatus = NULL; 130 Console *gConsole = NULL; 133 131 #ifdef VBOXBFE_WITH_USB 134 HostUSB *gHostUSB = NULL;132 HostUSB *gHostUSB = NULL; 135 133 #endif 136 134 137 135 VMSTATE machineState = VMSTATE_CREATING; 138 136 139 PPDMLED mapFDLeds[2] = {0}; 140 PPDMLED mapIDELeds[4] = {0}; 137 static PPDMLED mapFDLeds[2] = {0}; 141 138 142 139 /** flag whether keyboard/mouse events are grabbed */ 143 140 #ifdef RT_OS_L4 144 141 /** see <l4/input/macros.h> for key definitions */ 145 int gHostKey; /* not used */146 int gHostKeySym = KEY_RIGHTCTRL;142 int gHostKey; /* not used */ 143 int gHostKeySym = KEY_RIGHTCTRL; 147 144 #elif defined (DEBUG_dmik) 148 145 // my mini kbd doesn't have RCTRL... 149 int gHostKey = KMOD_RSHIFT;150 int gHostKeySym = SDLK_RSHIFT;146 int gHostKey = KMOD_RSHIFT; 147 int gHostKeySym = SDLK_RSHIFT; 151 148 #else 152 int gHostKey = KMOD_RCTRL;153 int gHostKeySym = SDLK_RCTRL;149 int gHostKey = KMOD_RCTRL; 150 int gHostKeySym = SDLK_RCTRL; 154 151 #endif 155 152 bool gfAllowFullscreenToggle = true; 156 153 157 static bool g_fIOAPIC = false;158 static bool g_fACPI = true;159 static bool g_fAudio = false;154 static bool g_fIOAPIC = false; 155 static bool g_fACPI = true; 156 static bool g_fAudio = false; 160 157 #ifdef VBOXBFE_WITH_USB 161 static bool g_fUSB = false; 162 #endif 163 static char *g_pszHdaFile = NULL; 164 static bool g_fHdaSpf = false; 165 static char *g_pszHdbFile = NULL; 166 static bool g_fHdbSpf = false; 167 static char *g_pszCdromFile = NULL; 168 static char *g_pszFdaFile = NULL; 169 static const char *pszBootDevice = "IDE"; 170 static uint32_t g_u32MemorySizeMB = 128; 171 static uint32_t g_u32VRamSize = 4 * _1M; 158 static bool g_fUSB = false; 159 #endif 160 static char *g_pszHdaFile = NULL; 161 static bool g_fHdaSpf = false; 162 static char *g_pszHdbFile = NULL; 163 static bool g_fHdbSpf = false; 164 static char *g_pszCdromFile = NULL; 165 static char *g_pszFdaFile = NULL; 166 const char *g_pszStateFile = NULL; 167 static const char *g_pszBootDevice = "IDE"; 168 static uint32_t g_u32MemorySizeMB = 128; 169 static uint32_t g_u32VRamSize = 4 * _1M; 172 170 #ifdef VBOXSDL_ADVANCED_OPTIONS 173 static bool g_fRawR0 = true; 174 static bool g_fRawR3 = true; 175 static bool g_fPATM = true; 176 static bool g_fCSAM = true; 177 #endif 178 static bool g_fPreAllocRam = false; 179 static int g_iBootMenu = 2; 180 static bool g_fReleaseLog = true; /**< Set if we should open the release. */ 171 static bool g_fRawR0 = true; 172 static bool g_fRawR3 = true; 173 static bool g_fPATM = true; 174 static bool g_fCSAM = true; 175 #endif 176 static bool g_fRestoreState = false; 177 static const char *g_pszShareDir[MaxSharedFolders]; 178 static const char *g_pszShareName[MaxSharedFolders]; 179 static unsigned g_uNumShares; 180 static bool g_fPreAllocRam = false; 181 static int g_iBootMenu = 2; 182 static bool g_fReleaseLog = true; /**< Set if we should open the release. */ 183 const char *g_pszProgressString; 184 unsigned g_uProgressPercent = ~0U; 181 185 182 186 … … 216 220 217 221 /** 222 */ 223 bool fActivateHGCM() 224 { 225 return !!(g_uNumShares > 0); 226 } 227 228 /** 218 229 * Converts the passed in network option 219 230 * … … 241 252 } 242 253 243 244 254 /** 245 255 * Generates a new unique MAC address based on our vendor ID and … … 269 279 return VINF_SUCCESS; 270 280 } 271 272 281 273 282 /** … … 306 315 } 307 316 317 /** 318 * Start progress display. 319 */ 320 void startProgressInfo(const char *pszStr) 321 { 322 g_pszProgressString = pszStr; 323 g_uProgressPercent = 0; 324 } 325 326 /** 327 * Update progress display. 328 */ 329 void callProgressInfo(PVM pVM, unsigned uPercent, void *pvUser) 330 { 331 if (gConsole) 332 gConsole->progressInfo(pVM, uPercent, pvUser); 333 } 334 335 /** 336 * End progress display. 337 */ 338 void endProgressInfo(void) 339 { 340 g_uProgressPercent = ~0U; 341 } 342 308 343 309 344 /** … … 323 358 " -prealloc Force RAM pre-allocation\n" 324 359 " -fullscreen Start VM in fullscreen mode\n" 360 " -statefile <file> Define the file name for VM save/restore\n" 361 " -restore Restore the VM if the statefile exists, normal start otherwise\n" 325 362 " -nofstoggle Forbid switching to/from fullscreen mode\n" 363 " -share <dir><name> Share directory <dir> as name <name>\n" 326 364 " -nohostkey Disable hostkey\n" 327 365 " -[no]acpi Enable or disable ACPI (default: enabled)\n" … … 438 476 case 'a': 439 477 { 440 pszBootDevice = "FLOPPY";478 g_pszBootDevice = "FLOPPY"; 441 479 break; 442 480 } … … 444 482 case 'c': 445 483 { 446 pszBootDevice = "IDE";484 g_pszBootDevice = "IDE"; 447 485 break; 448 486 } … … 450 488 case 'd': 451 489 { 452 pszBootDevice = "DVD";490 g_pszBootDevice = "DVD"; 453 491 break; 454 492 } … … 486 524 return SyntaxError("bad video ram size: %s (error %Vrc)\n", 487 525 argv[curArg], rc); 526 } 527 else if (strcmp(pszArg, "-statefile") == 0) 528 { 529 if (++curArg >= argc) 530 return SyntaxError("missing argument for restore!\n"); 531 g_pszStateFile = argv[curArg]; 532 } 533 else if (strcmp(pszArg, "-restore") == 0) 534 g_fRestoreState = true; 535 else if (strcmp(pszArg, "-share") == 0) 536 { 537 if (g_uNumShares >= MaxSharedFolders) 538 return SyntaxError("too many shared folders specified!\n"); 539 if (++curArg >= argc) 540 return SyntaxError("missing 1s argument for share!\n"); 541 g_pszShareDir[g_uNumShares] = argv[curArg]; 542 if (++curArg >= argc) 543 return SyntaxError("missing 2nd argument for share!\n"); 544 g_pszShareName[g_uNumShares] = argv[curArg]; 545 g_uNumShares++; 488 546 } 489 547 else if (strcmp(pszArg, "-fullscreen") == 0) … … 778 836 } 779 837 838 #ifdef RT_OS_L4 839 /* Start the external IDL interface */ 840 L4CtrlInit(); 841 #endif 842 780 843 /* loop until the powerup processing is done */ 781 844 do … … 796 859 break; 797 860 861 case CONEVENT_USR_TITLEBARUPDATE: 862 gConsole->updateTitlebar(); 863 break; 864 798 865 case CONEVENT_USR_QUIT: 799 866 RTPrintf("Error: failed to power up VM! No error text available.\n"); … … 826 893 * (gDisplay->getBitsPerPixel() / 8)) 827 894 gDisplay->SetVideoModeHint(gFramebuffer->getHostXres(), gFramebuffer->getHostYres(), 0, 0); 895 828 896 /* Limit the VRAM of the guest to the amount of memory we got actually 829 897 * mapped from the L4 console. */ 830 898 u32MaxVRAM = (gFramebuffer->getHostYres() + 18) /* don't omit the status bar */ 831 899 * gFramebuffer->getHostXres() 832 * (g Display->getBitsPerPixel() / 8);900 * (gFramebuffer->getHostBitsPerPixel() / 8); 833 901 if (g_u32VRamSize > u32MaxVRAM) 834 902 { … … 1096 1164 } 1097 1165 1166 #ifdef VBOX_HGCM 1167 /* 1168 * Add shared folders to the VM 1169 */ 1170 if (fActivateHGCM() && gVMMDev->isShFlActive()) 1171 { 1172 for (unsigned i=0; i<g_uNumShares; i++) 1173 { 1174 VBOXHGCMSVCPARM parms[2]; 1175 SHFLSTRING *pFolderName, *pMapName; 1176 int cbString; 1177 PRTUCS2 aHostPath, aMapName; 1178 int rc; 1179 1180 rc = RTStrUtf8ToUcs2(&aHostPath, g_pszShareDir[i]); 1181 AssertRC(rc); 1182 rc = RTStrUtf8ToUcs2(&aMapName, g_pszShareName[i]); 1183 AssertRC(rc); 1184 1185 cbString = (RTStrUcs2Len (aHostPath) + 1) * sizeof (RTUCS2); 1186 pFolderName = (SHFLSTRING *) RTMemAllocZ (sizeof (SHFLSTRING) + cbString); 1187 Assert (pFolderName); 1188 memcpy (pFolderName->String.ucs2, aHostPath, cbString); 1189 1190 pFolderName->u16Size = cbString; 1191 pFolderName->u16Length = cbString - sizeof(RTUCS2); 1192 1193 parms[0].type = VBOX_HGCM_SVC_PARM_PTR; 1194 parms[0].u.pointer.addr = pFolderName; 1195 parms[0].u.pointer.size = sizeof (SHFLSTRING) + cbString; 1196 1197 cbString = (RTStrUcs2Len (aMapName) + 1) * sizeof (RTUCS2); 1198 pMapName = (SHFLSTRING *) RTMemAllocZ (sizeof(SHFLSTRING) + cbString); 1199 Assert (pMapName); 1200 memcpy (pMapName->String.ucs2, aMapName, cbString); 1201 1202 pMapName->u16Size = cbString; 1203 pMapName->u16Length = cbString - sizeof (RTUCS2); 1204 1205 parms[1].type = VBOX_HGCM_SVC_PARM_PTR; 1206 parms[1].u.pointer.addr = pMapName; 1207 parms[1].u.pointer.size = sizeof (SHFLSTRING) + cbString; 1208 1209 rc = gVMMDev->hgcmHostCall ("VBoxSharedFolders", 1210 SHFL_FN_ADD_MAPPING, 2, &parms[0]); 1211 AssertRC(rc); 1212 LogRel(("Added share %s: (%s)\n", g_pszShareName[i], g_pszShareDir[i])); 1213 RTMemFree (pFolderName); 1214 RTMemFree (pMapName); 1215 RTStrUcs2Free (aHostPath); 1216 RTStrUcs2Free (aMapName); 1217 } 1218 } 1219 #endif 1220 1098 1221 #ifdef VBOXBFE_WITH_USB 1099 1222 /* … … 1120 1243 { 1121 1244 PVMREQ pReq; 1122 rc = VMR3ReqCall(pVM, &pReq, RT_INDEFINITE_WAIT, (PFNRT)VMR3PowerOn, 1, pVM); 1123 if (VBOX_SUCCESS(rc)) 1124 { 1125 rc = pReq->iStatus; 1126 AssertRC(rc); 1127 VMR3ReqFree(pReq); 1245 1246 if ( g_fRestoreState 1247 && g_pszStateFile 1248 && *g_pszStateFile 1249 && RTPathExists(g_pszStateFile)) 1250 { 1251 startProgressInfo("Restoring"); 1252 rc = VMR3ReqCall(pVM, &pReq, RT_INDEFINITE_WAIT, 1253 (PFNRT)VMR3Load, 4, pVM, g_pszStateFile, &callProgressInfo, NULL); 1254 endProgressInfo(); 1255 if (VBOX_SUCCESS(rc)) 1256 { 1257 VMR3ReqFree(pReq); 1258 rc = VMR3ReqCall(pVM, &pReq, RT_INDEFINITE_WAIT, 1259 (PFNRT)VMR3Resume, 1, pVM); 1260 if (VBOX_SUCCESS(rc)) 1261 { 1262 rc = pReq->iStatus; 1263 VMR3ReqFree(pReq); 1264 } 1265 gDisplay->setRunning(); 1266 } 1267 else 1268 AssertMsgFailed(("VMR3Load failed, rc=%Vrc\n", rc)); 1128 1269 } 1129 1270 else 1130 AssertMsgFailed(("VMR3PowerOn failed, rc=%Vrc\n", rc)); 1271 { 1272 rc = VMR3ReqCall(pVM, &pReq, RT_INDEFINITE_WAIT, (PFNRT)VMR3PowerOn, 1, pVM); 1273 if (VBOX_SUCCESS(rc)) 1274 { 1275 rc = pReq->iStatus; 1276 AssertRC(rc); 1277 VMR3ReqFree(pReq); 1278 } 1279 else 1280 AssertMsgFailed(("VMR3PowerOn failed, rc=%Vrc\n", rc)); 1281 } 1131 1282 } 1132 1283 … … 1261 1412 rc = CFGMR3InsertNode(pInst, "Config", &pCfg); UPDATE_RC(); 1262 1413 rc = CFGMR3InsertInteger(pCfg, "RamSize", g_u32MemorySizeMB * _1M); UPDATE_RC(); 1263 rc = CFGMR3InsertString(pCfg, "BootDevice0", pszBootDevice);UPDATE_RC();1414 rc = CFGMR3InsertString(pCfg, "BootDevice0", g_pszBootDevice); UPDATE_RC(); 1264 1415 rc = CFGMR3InsertString(pCfg, "BootDevice1", "NONE"); UPDATE_RC(); 1265 1416 rc = CFGMR3InsertString(pCfg, "BootDevice2", "NONE"); UPDATE_RC(); -
trunk/src/VBox/Frontends/VBoxBFE/VBoxBFE.h
r4071 r5965 25 25 #define VBOXSDL_ADVANCED_OPTIONS 26 26 27 /** @todo fix this */ 28 #define NetworkAdapterCount 4 27 enum 28 { 29 NetworkAdapterCount = 4, 30 MaxSharedFolders = 16, 31 }; 29 32 30 33 … … 38 41 /** @} */ 39 42 40 extern VMSTATE machineState; 41 extern PVM pVM; 42 extern int gHostKey; 43 extern int gHostKeySym; 44 extern bool gfAllowFullscreenToggle; 43 extern VMSTATE machineState; 44 extern PVM pVM; 45 extern int gHostKey; 46 extern int gHostKeySym; 47 extern bool gfAllowFullscreenToggle; 48 extern const char *g_pszStateFile; 49 extern const char *g_pszProgressString; 50 extern unsigned g_uProgressPercent; 51 52 void startProgressInfo(const char *pszStr); 53 void callProgressInfo(PVM pVM, unsigned uPercent, void *pvUser); 54 void endProgressInfo(); 55 bool fActivateHGCM(); 45 56 46 57 #endif // __H_VBOXBFE -
trunk/src/VBox/Frontends/VBoxBFE/VMMDevInterface.cpp
r4071 r5965 38 38 #include "DisplayImpl.h" 39 39 #include "ConsoleImpl.h" 40 #ifdef VBOX_HGCM 41 #include "HGCM.h" 42 #endif 40 43 41 44 #ifdef RT_OS_L4 … … 55 58 /** Our VMM device connector interface. */ 56 59 PDMIVMMDEVCONNECTOR Connector; 60 61 #ifdef VBOX_HGCM 62 /** Pointer to the HGCM port interface of the driver/device above us. */ 63 PPDMIHGCMPORT pHGCMPort; 64 /** Our HGCM connector interface. */ 65 PDMIHGCMCONNECTOR HGCMConnector; 66 #endif 57 67 } DRVMAINVMMDEV, *PDRVMAINVMMDEV; 58 68 59 69 /** Converts PDMIVMMDEVCONNECTOR pointer to a DRVMAINVMMDEV pointer. */ 60 70 #define PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface) ( (PDRVMAINVMMDEV) ((uintptr_t)pInterface - RT_OFFSETOF(DRVMAINVMMDEV, Connector)) ) 71 72 #ifdef VBOX_HGCM 73 /** Converts PDMIHGCMCONNECTOR pointer to a DRVMAINVMMDEV pointer. */ 74 #define PDMIHGCMCONNECTOR_2_MAINVMMDEV(pInterface) ( (PDRVMAINVMMDEV) ((uintptr_t)pInterface - RT_OFFSETOF(DRVMAINVMMDEV, HGCMConnector)) ) 75 #endif 76 77 VMMDev::VMMDev() : mpDrv(NULL) 78 { 79 #ifdef VBOX_HGCM 80 int rc = VINF_SUCCESS; 81 if (fActivateHGCM()) 82 rc = HGCMHostInit(); 83 AssertRC(rc); 84 #endif 85 } 86 87 VMMDev::~VMMDev() 88 { 89 #ifdef VBOX_HGCM 90 if (fActivateHGCM()) 91 HGCMHostShutdown (); 92 #endif /* VBOX_HGCM */ 93 } 61 94 62 95 … … 216 249 } 217 250 251 #ifdef VBOX_HGCM 252 253 /* HGCM connector interface */ 254 255 static DECLCALLBACK(int) iface_hgcmConnect (PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, PHGCMSERVICELOCATION pServiceLocation, uint32_t *pu32ClientID) 256 { 257 LogSunlover(("Enter\n")); 258 259 PDRVMAINVMMDEV pDrv = PDMIHGCMCONNECTOR_2_MAINVMMDEV(pInterface); 260 261 if ( !pServiceLocation 262 || ( pServiceLocation->type != VMMDevHGCMLoc_LocalHost 263 && pServiceLocation->type != VMMDevHGCMLoc_LocalHost_Existing)) 264 { 265 return VERR_INVALID_PARAMETER; 266 } 267 268 return HGCMGuestConnect (pDrv->pHGCMPort, pCmd, pServiceLocation->u.host.achName, pu32ClientID); 269 } 270 271 static DECLCALLBACK(int) iface_hgcmDisconnect (PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID) 272 { 273 LogSunlover(("Enter\n")); 274 275 PDRVMAINVMMDEV pDrv = PDMIHGCMCONNECTOR_2_MAINVMMDEV(pInterface); 276 277 return HGCMGuestDisconnect (pDrv->pHGCMPort, pCmd, u32ClientID); 278 } 279 280 static DECLCALLBACK(int) iface_hgcmCall (PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID, uint32_t u32Function, 281 uint32_t cParms, PVBOXHGCMSVCPARM paParms) 282 { 283 LogSunlover(("Enter\n")); 284 285 PDRVMAINVMMDEV pDrv = PDMIHGCMCONNECTOR_2_MAINVMMDEV(pInterface); 286 287 return HGCMGuestCall (pDrv->pHGCMPort, pCmd, u32ClientID, u32Function, cParms, paParms); 288 } 289 290 /** 291 * Execute state save operation. 292 * 293 * @returns VBox status code. 294 * @param pDrvIns Driver instance of the driver which registered the data unit. 295 * @param pSSM SSM operation handle. 296 */ 297 static DECLCALLBACK(int) iface_hgcmSave(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM) 298 { 299 LogSunlover(("Enter\n")); 300 return HGCMHostSaveState (pSSM); 301 } 302 303 304 /** 305 * Execute state load operation. 306 * 307 * @returns VBox status code. 308 * @param pDrvIns Driver instance of the driver which registered the data unit. 309 * @param pSSM SSM operation handle. 310 * @param u32Version Data layout version. 311 */ 312 static DECLCALLBACK(int) iface_hgcmLoad(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM, uint32_t u32Version) 313 { 314 LogFlowFunc(("Enter\n")); 315 316 if (u32Version != HGCM_SSM_VERSION) 317 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 318 319 return HGCMHostLoadState (pSSM); 320 } 321 322 int VMMDev::hgcmLoadService (const char *pszServiceName, const char *pszServiceLibrary) 323 { 324 return HGCMHostLoad (pszServiceName, pszServiceLibrary); 325 } 326 327 int VMMDev::hgcmHostCall (const char *pszServiceName, uint32_t u32Function, 328 uint32_t cParms, PVBOXHGCMSVCPARM paParms) 329 { 330 return HGCMHostCall (pszServiceName, u32Function, cParms, paParms); 331 } 332 #endif /* HGCM */ 333 218 334 /** 219 335 * Queries an interface to the driver. … … 234 350 case PDMINTERFACE_VMMDEV_CONNECTOR: 235 351 return &pDrv->Connector; 352 #ifdef VBOX_HGCM 353 case PDMINTERFACE_HGCM_CONNECTOR: 354 if (fActivateHGCM()) 355 return &pDrv->HGCMConnector; 356 else 357 return NULL; 358 #endif 236 359 default: 237 360 return NULL; … … 297 420 pData->Connector.pfnQueryVisibleRegion = iface_QueryVisibleRegion; 298 421 422 #ifdef VBOX_HGCM 423 if (fActivateHGCM()) 424 { 425 pData->HGCMConnector.pfnConnect = iface_hgcmConnect; 426 pData->HGCMConnector.pfnDisconnect = iface_hgcmDisconnect; 427 pData->HGCMConnector.pfnCall = iface_hgcmCall; 428 } 429 #endif 430 299 431 /* 300 432 * Get the IVMMDevPort interface of the above driver/device. … … 306 438 return VERR_PDM_MISSING_INTERFACE_ABOVE; 307 439 } 440 441 #ifdef VBOX_HGCM 442 if (fActivateHGCM()) 443 { 444 pData->pHGCMPort = (PPDMIHGCMPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_HGCM_PORT); 445 if (!pData->pHGCMPort) 446 { 447 AssertMsgFailed(("Configuration error: No HGCM port interface above!\n")); 448 return VERR_PDM_MISSING_INTERFACE_ABOVE; 449 } 450 } 451 #endif 308 452 309 453 /* … … 320 464 pData->pVMMDev = (VMMDev*)pv; /** @todo Check this cast! */ 321 465 pData->pVMMDev->mpDrv = pData; 466 467 #ifdef VBOX_HGCM 468 if (fActivateHGCM()) 469 { 470 rc = pData->pVMMDev->hgcmLoadService ("VBoxSharedFolders", "VBoxSharedFolders"); 471 pData->pVMMDev->fSharedFolderActive = VBOX_SUCCESS(rc); 472 if (VBOX_SUCCESS(rc)) 473 LogRel(("Shared Folders service loaded.\n")); 474 else 475 LogRel(("Failed to load Shared Folders service %Vrc\n", rc)); 476 477 pDrvIns->pDrvHlp->pfnSSMRegister(pDrvIns, "HGCM", 0, HGCM_SSM_VERSION, 4096/* bad guess */, NULL, iface_hgcmSave, NULL, NULL, iface_hgcmLoad, NULL); 478 } 479 #endif /* VBOX_HGCM */ 480 322 481 return VINF_SUCCESS; 323 482 } -
trunk/src/VBox/Frontends/VBoxBFE/VMMDevInterface.h
r4071 r5965 25 25 { 26 26 public: 27 VMMDev() : mpDrv(NULL) {}; 27 VMMDev(); 28 ~VMMDev(); 28 29 static const PDMDRVREG DrvReg; 29 30 30 31 /** Pointer to the associated VMMDev driver. */ 31 32 struct DRVMAINVMMDEV *mpDrv; 33 34 bool fSharedFolderActive; 35 bool isShFlActive() 36 { 37 return fSharedFolderActive; 38 } 32 39 33 40 PPDMIVMMDEVPORT getVMMDevPort(); … … 36 43 int SetMouseCapabilities(uint32_t mouseCaps); 37 44 int SetAbsoluteMouse(uint32_t mouseXAbs, uint32_t mouseYAbs); 45 46 int hgcmLoadService (const char *pszServiceName, const char *pszServiceLibrary); 47 int hgcmHostCall (const char *pszServiceName, uint32_t u32Function, uint32_t cParms, PVBOXHGCMSVCPARM paParms); 38 48 39 49 private:
Note:
See TracChangeset
for help on using the changeset viewer.