From ac60a075564efb0e622581353a5507120ed4089f Mon Sep 17 00:00:00 2001 From: bolrog <81111887+bolrog@users.noreply.github.com> Date: Wed, 12 May 2021 18:06:00 +0200 Subject: [PATCH] Add "frameless" window option in cfg file, for hiding the window frame. --- README.md | 7 +++++-- d2dx-defaults.cfg | 3 ++- src/d2dx/Options.cpp | 6 ++++++ src/d2dx/Options.h | 2 ++ src/d2dx/RenderContext.cpp | 8 +++++++- 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3ffa6fa..6986837 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ D2DX is a Glide-wrapper and mod that makes the classic Diablo II/LoD run well on modern PCs, while honoring the original look and feel of the game. Play in a window or in fullscreen, glitch-free, with or without enhancements like widescreen, true high framerate and anti-aliasing. -Version 0.99.512 +Version 0.99.512c ## Features - Turns the game into a well behaved DirectX 11 title on Windows 10 (also 7, 8 and 8.1). @@ -79,9 +79,12 @@ D2DX uses the following third party libraries: ## Recent release history -### 0.99.512 +### 0.99.512c + - Add "frameless" window option in cfg file, for hiding the window frame. - Fix corrupt graphics in low lighting detail mode. - Fix corrupt graphics in perspective mode. + - Fix distorted automap cross. + - Fix mouse sometimes getting stuck on the edge of the screen when setting a custom resolution in the cfg file. ### 0.99.511 - Change resolution mod from D2HD to the newer SGD2FreeRes (both by Mir Drualga). diff --git a/d2dx-defaults.cfg b/d2dx-defaults.cfg index 9d8f125..bb4bf26 100644 --- a/d2dx-defaults.cfg +++ b/d2dx-defaults.cfg @@ -6,8 +6,9 @@ # [window] -scale=1 # range 1-3, an integer scale factor for the window (in windowed mode) +scale=1 # range 1-3, an integer scale factor for the window position=[-1,-1] # if [-1,-1] the window will be centered, otherwise placed at the explicit position given here +frameless=false # if true, the window frame (caption bar etc) will be removed [game] size=[-1,-1] # if [-1,-1] d2dx will decide a suitable game size, otherwise will use the size given here diff --git a/src/d2dx/Options.cpp b/src/d2dx/Options.cpp index 330de68..4ea30b9 100644 --- a/src/d2dx/Options.cpp +++ b/src/d2dx/Options.cpp @@ -120,6 +120,12 @@ void Options::ApplyCfg( SetWindowPosition({ (int32_t)x.u.i, (int32_t)y.u.i }); } } + + auto frameless = toml_bool_in(window, "frameless"); + if (frameless.ok) + { + SetFlag(OptionsFlag::Frameless, frameless.u.b); + } } auto debug = toml_table_in(root, "debug"); diff --git a/src/d2dx/Options.h b/src/d2dx/Options.h index c25340c..d29707c 100644 --- a/src/d2dx/Options.h +++ b/src/d2dx/Options.h @@ -38,6 +38,8 @@ namespace d2dx TestMotionPrediction, + Frameless, + Count }; diff --git a/src/d2dx/RenderContext.cpp b/src/d2dx/RenderContext.cpp index 140a109..54c2ea7 100644 --- a/src/d2dx/RenderContext.cpp +++ b/src/d2dx/RenderContext.cpp @@ -819,7 +819,13 @@ void RenderContext::AdjustWindowPlacement( const int32_t oldWindowCenterX = (oldWindowRect.left + oldWindowRect.right) / 2; const int32_t oldWindowCenterY = (oldWindowRect.top + oldWindowRect.bottom) / 2; - const DWORD windowStyle = WS_VISIBLE | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU; + DWORD windowStyle = WS_VISIBLE; + + if (!_d2dxContext->GetOptions().GetFlag(OptionsFlag::Frameless)) + { + windowStyle |= WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU; + } + RECT windowRect = { 0, 0, _windowSize.width, _windowSize.height }; AdjustWindowRect(&windowRect, windowStyle, FALSE); const int32_t newWindowWidth = windowRect.right - windowRect.left;