Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,11 @@ void W3DDisplay::setGamma(Real gamma, Real bright, Real contrast, Bool calibrate
//=============================================================================
Bool W3DDisplay::setDisplayMode( UnsignedInt xres, UnsignedInt yres, UnsignedInt bitdepth, Bool windowed )
{
const UnsignedInt oldWidth = getWidth();
const UnsignedInt oldHeight = getHeight();
const UnsignedInt oldBitDepth = getBitDepth();
const Bool oldWindowed = getWindowed();

if (WW3D_ERROR_OK == WW3D::Set_Device_Resolution(xres,yres,bitdepth,windowed,true))
{
Render2DClass::Set_Screen_Resolution(RectClass(0, 0, xres, yres));
Expand All @@ -499,9 +504,9 @@ Bool W3DDisplay::setDisplayMode( UnsignedInt xres, UnsignedInt yres, UnsignedInt
}

//set back to the original mode.
WW3D::Set_Device_Resolution(getWidth(),getHeight(),getBitDepth(),getWindowed(), true);
Render2DClass::Set_Screen_Resolution(RectClass(0, 0, getWidth(),getHeight()));
Display::setDisplayMode(getWidth(),getHeight(),getBitDepth(), getWindowed());
WW3D::Set_Device_Resolution(oldWidth, oldHeight, oldBitDepth, oldWindowed, true);
Render2DClass::Set_Screen_Resolution(RectClass(0, 0, oldWidth, oldHeight));
Display::setDisplayMode(oldWidth, oldHeight, oldBitDepth, oldWindowed);
return FALSE; //did not change to a new mode.
}

Expand Down
15 changes: 6 additions & 9 deletions Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,6 @@ void DX8Wrapper::Shutdown()
}
}

if (D3DInterface) {
UINT newRefCount=D3DInterface->Release();
D3DInterface=nullptr;
}

if (D3D8Lib) {
FreeLibrary(D3D8Lib);
D3D8Lib = nullptr;
Expand Down Expand Up @@ -830,7 +825,7 @@ void DX8Wrapper::Resize_And_Position_Window()
// Resize the window to fit this resolution
if (!IsWindowed)
{
::SetWindowPos(_Hwnd, HWND_TOPMOST, 0, 0, width, height, SWP_NOSIZE | SWP_NOMOVE);
::SetWindowPos(_Hwnd, HWND_TOPMOST, 0, 0, width, height, 0);

DEBUG_LOG(("Window resized to w:%d h:%d", width, height));
}
Expand Down Expand Up @@ -883,9 +878,6 @@ bool DX8Wrapper::Set_Render_Device(int dev, int width, int height, int bits, int
if (width != -1) ResolutionWidth = width;
if (height != -1) ResolutionHeight = height;

// Initialize Render2DClass Screen Resolution
Render2DClass::Set_Screen_Resolution( RectClass( 0, 0, ResolutionWidth, ResolutionHeight ) );

if (bits != -1) BitDepth = bits;
if (windowed != -1) IsWindowed = (windowed != 0);
DX8Wrapper_IsWindowed = IsWindowed;
Expand Down Expand Up @@ -1053,6 +1045,11 @@ bool DX8Wrapper::Set_Render_Device(int dev, int width, int height, int bits, int

WWDEBUG_SAY(("Reset/Create_Device done, reset_device=%d, restore_assets=%d", reset_device, restore_assets));

if (ret)
{
Render2DClass::Set_Screen_Resolution( RectClass( 0, 0, ResolutionWidth, ResolutionHeight ) );
}

return ret;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,11 @@ void W3DDisplay::setGamma(Real gamma, Real bright, Real contrast, Bool calibrate
//=============================================================================
Bool W3DDisplay::setDisplayMode( UnsignedInt xres, UnsignedInt yres, UnsignedInt bitdepth, Bool windowed )
{
const UnsignedInt oldWidth = getWidth();
const UnsignedInt oldHeight = getHeight();
const UnsignedInt oldBitDepth = getBitDepth();
const Bool oldWindowed = getWindowed();

if (WW3D_ERROR_OK == WW3D::Set_Device_Resolution(xres,yres,bitdepth,windowed,true))
{
Render2DClass::Set_Screen_Resolution(RectClass(0, 0, xres, yres));
Expand All @@ -549,9 +554,9 @@ Bool W3DDisplay::setDisplayMode( UnsignedInt xres, UnsignedInt yres, UnsignedInt
}

//set back to the original mode.
WW3D::Set_Device_Resolution(getWidth(),getHeight(),getBitDepth(),getWindowed(), true);
Render2DClass::Set_Screen_Resolution(RectClass(0, 0, getWidth(),getHeight()));
Display::setDisplayMode(getWidth(),getHeight(),getBitDepth(), getWindowed());
WW3D::Set_Device_Resolution(oldWidth, oldHeight, oldBitDepth, oldWindowed, true);
Render2DClass::Set_Screen_Resolution(RectClass(0, 0, oldWidth, oldHeight));
Display::setDisplayMode(oldWidth, oldHeight, oldBitDepth, oldWindowed);
return FALSE; //did not change to a new mode.
}

Expand Down
15 changes: 6 additions & 9 deletions GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,6 @@ void DX8Wrapper::Shutdown()
}
}

if (D3DInterface) {
UINT newRefCount=D3DInterface->Release();
D3DInterface=nullptr;
}

if (D3D8Lib) {
FreeLibrary(D3D8Lib);
D3D8Lib = nullptr;
Expand Down Expand Up @@ -896,7 +891,7 @@ void DX8Wrapper::Resize_And_Position_Window()
// Resize the window to fit this resolution
if (!IsWindowed)
{
::SetWindowPos(_Hwnd, HWND_TOPMOST, 0, 0, width, height, SWP_NOSIZE | SWP_NOMOVE);
::SetWindowPos(_Hwnd, HWND_TOPMOST, 0, 0, width, height, 0);

DEBUG_LOG(("Window resized to w:%d h:%d", width, height));
}
Expand Down Expand Up @@ -949,9 +944,6 @@ bool DX8Wrapper::Set_Render_Device(int dev, int width, int height, int bits, int
if (width != -1) ResolutionWidth = width;
if (height != -1) ResolutionHeight = height;

// Initialize Render2DClass Screen Resolution
Render2DClass::Set_Screen_Resolution( RectClass( 0, 0, ResolutionWidth, ResolutionHeight ) );

if (bits != -1) BitDepth = bits;
if (windowed != -1) IsWindowed = (windowed != 0);
DX8Wrapper_IsWindowed = IsWindowed;
Expand Down Expand Up @@ -1120,6 +1112,11 @@ bool DX8Wrapper::Set_Render_Device(int dev, int width, int height, int bits, int

WWDEBUG_SAY(("Reset/Create_Device done, reset_device=%d, restore_assets=%d", reset_device, restore_assets));

if (ret)
{
Render2DClass::Set_Screen_Resolution( RectClass( 0, 0, ResolutionWidth, ResolutionHeight ) );
}

return ret;
}

Expand Down
Loading