diff --git a/panda/src/wdxdisplay/config_wdxdisplay.cxx b/panda/src/wdxdisplay/config_wdxdisplay.cxx index e7de162042..f2c67f159f 100644 --- a/panda/src/wdxdisplay/config_wdxdisplay.cxx +++ b/panda/src/wdxdisplay/config_wdxdisplay.cxx @@ -29,6 +29,7 @@ ConfigureFn(config_wdxdisplay) { init_libwdxdisplay(); } +int dx_use_multimon = config_wdxdisplay.GetInt("dx-multimon", 1); bool dx_force_16bpp_zbuffer = config_wdxdisplay.GetBool("dx-force-16bpp-zbuffer", false); bool bResponsive_minimized_fullscreen_window = config_wdxdisplay.GetBool("responsive-minimized-fullscreen-window",false); diff --git a/panda/src/wdxdisplay/config_wdxdisplay.h b/panda/src/wdxdisplay/config_wdxdisplay.h index 1e6e60e8c9..ac160aa1ab 100644 --- a/panda/src/wdxdisplay/config_wdxdisplay.h +++ b/panda/src/wdxdisplay/config_wdxdisplay.h @@ -27,6 +27,7 @@ NotifyCategoryDecl(wdxdisplay, EXPCL_PANDADX, EXPTP_PANDADX); extern bool bResponsive_minimized_fullscreen_window; extern bool dx_force_16bpp_zbuffer; +extern int dx_use_multimon; extern Filename get_icon_filename(); extern Filename get_mono_cursor_filename(); extern Filename get_color_cursor_filename(); diff --git a/panda/src/wdxdisplay/wdxGraphicsPipe.cxx b/panda/src/wdxdisplay/wdxGraphicsPipe.cxx index 2eaf4aac95..3f4e0b4c39 100644 --- a/panda/src/wdxdisplay/wdxGraphicsPipe.cxx +++ b/panda/src/wdxdisplay/wdxGraphicsPipe.cxx @@ -33,8 +33,8 @@ wdxGraphicsPipe::wdxGraphicsPipe(const PipeSpecifier& spec) : InteractiveGraphicsPipe(spec) { // _width = GetSystemMetrics(SM_CXSCREEN); // _height = GetSystemMetrics(SM_CYSCREEN); - _shift = false; -// global_pipe = this; +// _shift = false; +// global_pipe = this; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/wdxdisplay/wdxGraphicsPipe.h b/panda/src/wdxdisplay/wdxGraphicsPipe.h index 77e826e645..944ab399bd 100644 --- a/panda/src/wdxdisplay/wdxGraphicsPipe.h +++ b/panda/src/wdxdisplay/wdxGraphicsPipe.h @@ -68,7 +68,7 @@ private: // int _width; // int _height; - bool _shift; +// bool _shift; protected: diff --git a/panda/src/wdxdisplay/wdxGraphicsWindow.cxx b/panda/src/wdxdisplay/wdxGraphicsWindow.cxx index 6d9475524e..78470c7ec5 100644 --- a/panda/src/wdxdisplay/wdxGraphicsWindow.cxx +++ b/panda/src/wdxdisplay/wdxGraphicsWindow.cxx @@ -54,6 +54,8 @@ typedef map HWND_PANDAWIN_MAP; HWND_PANDAWIN_MAP hwnd_pandawin_map; wdxGraphicsWindow* global_wdxwinptr = NULL; // need this for temporary windproc +#define MAX_DEVICES 20 + extern bool dx_full_screen_antialiasing; // defined in dxgsg_config.cxx #define MOUSE_ENTERED 0 @@ -1291,24 +1293,35 @@ dx_setup() { // Check for DirectX 7 by looking for DirectDrawCreateEx - HINSTANCE DDHinst = LoadLibrary( "ddraw.dll" ); + HINSTANCE DDHinst = LoadLibrary("ddraw.dll"); if(DDHinst == 0) { - wdxdisplay_cat.fatal() << "can't locate DDRAW.DLL!" << endl; + wdxdisplay_cat.fatal() << "can't locate DDRAW.DLL!\n"; exit(1); } - if(NULL == GetProcAddress( DDHinst, "DirectDrawCreateEx" )) { - wdxdisplay_cat.fatal() << "Panda currently requires at least DirectX 7.0!" << endl; + typedef HRESULT (WINAPI * LPDIRECTDRAWCREATEEX)(GUID FAR * lpGuid, LPVOID *lplpDD, REFIID iid,IUnknown FAR *pUnkOuter); + + // load all ddraw exports dynamically to avoid static link to ddraw.dll, in case system doesnt have it + + LPDIRECTDRAWCREATEEX pDDCreateEx = (LPDIRECTDRAWCREATEEX) GetProcAddress(DDHinst,"DirectDrawCreateEx"); + if(pDDCreateEx == NULL) { + wdxdisplay_cat.fatal() << "Panda currently requires at least DirectX 7.0!\n"; + exit(1); + } + + LPDIRECTDRAWENUMERATEEX pDDEnumEx = (LPDIRECTDRAWENUMERATEEX) GetProcAddress(DDHinst,"DirectDrawEnumerateEx"); + if(pDDEnumEx == NULL) { + wdxdisplay_cat.fatal() << "GetProcAddr failed for DirectDrawEnumerateEx!\n"; exit(1); } GUID DriverGUID; ZeroMemory(&DriverGUID,sizeof(GUID)); - // search for early voodoo-type non-primary display drivers - // if they exist, use them for 3D (could examine 3D devices on all - // drivers and pick the best one, but I'll assume the computer setuper knows what he's doing) - if(hr = DirectDrawEnumerateEx( DriverEnumCallback, &DriverGUID, DDENUM_NONDISPLAYDEVICES )) { + // search for early voodoo-type non-primary display drivers + // if they exist, use them for 3D (could examine 3D devices on all + // drivers and pick the best one, but I'll assume the computer setuper knows what he's doing) + if(hr = (*pDDEnumEx)( DriverEnumCallback, &DriverGUID, DDENUM_NONDISPLAYDEVICES )) { wdxdisplay_cat.fatal() << "config() - DirectDrawEnumerateEx failed : result = " << ConvD3DErrorToString(hr) << endl; exit(1); } @@ -1319,14 +1332,14 @@ dx_setup() { } // Create the Direct Draw Object - hr = DirectDrawCreateEx(pOurDriverGUID, (void **)&pDD, IID_IDirectDraw7, NULL); + hr = (*pDDCreateEx)(pOurDriverGUID, (void **)&pDD, IID_IDirectDraw7, NULL); if(hr != DD_OK) { wdxdisplay_cat.fatal() << "config() - DirectDrawCreateEx failed : result = " << ConvD3DErrorToString(hr) << endl; exit(1); } - FreeLibrary(DDHinst); //undo LoadLib above, decrement ddrawl.dll refcnt (after DDrawCreate, since dont want to unload/reload) + FreeLibrary(DDHinst); //undo LoadLib above, decrement ddraw.dll refcnt (after DDrawCreate, since dont want to unload/reload) pDD->GetDeviceIdentifier(&_DXDeviceID,0x0); @@ -1344,8 +1357,7 @@ dx_setup() { exit(1); } - D3DDEVICEDESC7 d3ddevs[2]; // put HAL in 0, TnLHAL in 1 - + D3DDEVICEDESC7 d3ddevs[MAX_DEVICES]; // put HAL in 0, TnLHAL in 1 // just look for HAL and TnL devices right now. I dont think // we have any interest in the sw rasts at this point