Skip to content

Commit

Permalink
Rename a couple settings and fix a few things
Browse files Browse the repository at this point in the history
  • Loading branch information
elishacloud committed Sep 12, 2023
1 parent 6aa826a commit a2ce4cc
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Dllmain/BuildNo.rc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define BUILD_NUMBER 6811
#define BUILD_NUMBER 6812
2 changes: 1 addition & 1 deletion Settings/AllSettings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ DdrawResolutionHack = 0
DirectShowEmulation = 0

[Dd7to9]
AutoFrameSkip = 0
DdrawAutoFrameSkip = 0
DdrawEmulateSurface = 0
DdrawFixByteAlignment = 0
DdrawRemoveScanlines = 0
Expand Down
12 changes: 10 additions & 2 deletions Settings/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ namespace Settings
size_t BytesToWriteCount = 0; // Count of bytes to hot patch
bool Force16bitColor; // Forces DirectX to use 16bit color
bool Force32bitColor; // Forces DirectX to use 32bit color
DWORD DdrawOverrideRefreshRate = 0; // Legacy setting

// Legacy settings
DWORD AutoFrameSkip = 0;
DWORD DdrawOverrideRefreshRate = 0;
bool DSoundCtrl = false;

// Function declarations
bool IsValueEnabled(char*);
Expand Down Expand Up @@ -280,7 +284,10 @@ void __stdcall Settings::ParseCallback(char* name, char* value)
Config.DisableMaxWindowedModeNotSet = false;
}

// For legacy settings
SET_LOCAL_VALUE(AutoFrameSkip);
SET_LOCAL_VALUE(DdrawOverrideRefreshRate);
SET_LOCAL_VALUE(DSoundCtrl);

// Set Value of local settings
VISIT_LOCAL_SETTINGS(SET_LOCAL_VALUE);
Expand Down Expand Up @@ -605,7 +612,7 @@ void CONFIG::SetConfig()
LoopSleepTime = 30;
}

// Verify DSoundCtrl options
// Verify DirectSoundControl options
EnableDsoundWrapper = (EnableDsoundWrapper || DSoundCtrl || IsSet(DsoundHookSystem32));
if (EnableDsoundWrapper)
{
Expand Down Expand Up @@ -659,6 +666,7 @@ void CONFIG::SetConfig()
DDrawCompat = (DDrawCompat || DDrawCompat20 || DDrawCompat21 || DDrawCompat31);
EnableDdrawWrapper = (EnableDdrawWrapper || IsSet(DdrawHookSystem32) || ConvertToDirectDraw7 || ConvertToDirect3D7 || IsSet(DdrawResolutionHack));
D3d8to9 = (D3d8to9 || IsSet(D3d8HookSystem32));
DdrawAutoFrameSkip = (AutoFrameSkip || DdrawAutoFrameSkip); // For legacy purposes
EnableWindowMode = (FullscreenWindowMode) ? true : EnableWindowMode;
EnableD3d9Wrapper = (IsSet(EnableD3d9Wrapper) || IsSet(D3d9HookSystem32) ||
(EnableD3d9Wrapper == NOT_EXIST && (AnisotropicFiltering || AntiAliasing || IsSet(CacheClipPlane) || EnableVSync || // For legacy purposes
Expand Down
8 changes: 3 additions & 5 deletions Settings/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
visit(AntiAliasing) \
visit(AudioClipDetection) \
visit(AudioFadeOutDelayMS) \
visit(AutoFrameSkip) \
visit(Dd7to9) \
visit(D3d8to9) \
visit(Dinputto8) \
Expand All @@ -25,6 +24,7 @@
visit(DDrawCompat31) \
visit(DDrawCompatDisableGDIHook) \
visit(DDrawCompatNoProcAffinity) \
visit(DdrawAutoFrameSkip) \
visit(DdrawClippedWidth) \
visit(DdrawClippedHeight) \
visit(DdrawRemoveScanlines) \
Expand Down Expand Up @@ -56,7 +56,6 @@
visit(DisableHighDPIScaling) \
visit(DisableLogging) \
visit(DirectShowEmulation) \
visit(DSoundCtrl) \
visit(DxWnd) \
visit(CacheClipPlane) \
visit(ConvertToDirectDraw7) \
Expand Down Expand Up @@ -193,7 +192,6 @@ struct CONFIG
void SetConfig(); // Set additional settings
bool IsSet(DWORD Value); // Check if a value is set
bool Exiting = false; // Dxwrapper is being unloaded
bool AutoFrameSkip = false; // Automatically skips frames to reduce input lag
bool Dd7to9 = false; // Converts DirectDraw/Direct3D (ddraw.dll) to Direct3D9 (d3d9.dll)
bool D3d8to9 = false; // Converts Direct3D8 (d3d8.dll) to Direct3D9 (d3d9.dll) https://github.com/crosire/d3d8to9
bool Dinputto8 = false; // Converts DirectInput (dinput.dll) to DirectInput8 (dinput8.dll)
Expand All @@ -205,6 +203,7 @@ struct CONFIG
bool DDrawCompat31 = false; // Enables DDrawCompat v0.3.1
bool DDrawCompatDisableGDIHook = false; // Disables DDrawCompat GDI hooks
bool DDrawCompatNoProcAffinity = false; // Disables DDrawCompat single processor affinity
bool DdrawAutoFrameSkip = false; // Automatically skips frames to reduce input lag
bool DdrawFixByteAlignment = false; // Fixes lock with surfaces that have unaligned byte sizes
DWORD DdrawResolutionHack = 0; // Removes the artificial resolution limit from Direct3D7 and below https://github.com/UCyborg/LegacyD3DResolutionHack
bool DdrawRemoveScanlines = 0; // Experimental feature to removing interlaced black lines in a single frame
Expand Down Expand Up @@ -237,7 +236,6 @@ struct CONFIG
bool DisableGameUX = false; // Disables the Microsoft Game Explorer which can sometimes cause high CPU in rundll32.exe and hang the game process
bool DisableHighDPIScaling = false; // Disables display scaling on high DPI settings
bool DisableLogging = false; // Disables the logging file
bool DSoundCtrl = false; // Enables DirectSoundControl https://github.com/nRaecheR/DirectSoundControl
bool DxWnd = false; // Enables DxWnd https://sourceforge.net/projects/dxwnd/
DWORD CacheClipPlane = 0; // Caches the ClipPlane for Direct3D9 to fix an issue in d3d9 on Windows 8 and newer
bool ConvertToDirectDraw7 = false; // Converts DirectDraw 1-6 to DirectDraw 7
Expand Down Expand Up @@ -300,7 +298,7 @@ struct CONFIG
DWORD LockColorkey = 0; // DXPrimaryEmulation option that needs a second parameter
bool DisableMaxWindowedModeNotSet = false; // If the DisableMaxWindowedMode option exists in the config file

// DSoundCtrl
// DirectSoundControl https://github.com/nRaecheR/DirectSoundControl
DWORD Num2DBuffers = 0;
DWORD Num3DBuffers = 0;
bool ForceCertification = false;
Expand Down
2 changes: 1 addition & 1 deletion Settings/Settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ConvertToDirect3D7 = 0
DdrawOverrideBitMode = 0

[Dd7to9]
AutoFrameSkip = 0
DdrawAutoFrameSkip = 0
DdrawEmulateSurface = 0
DdrawFixByteAlignment = 0
DdrawRemoveScanlines = 0
Expand Down
2 changes: 1 addition & 1 deletion ddraw/IDirectDrawSurfaceX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4094,7 +4094,7 @@ void m_IDirectDrawSurfaceX::UpdateSurfaceDesc()
surfaceDesc2.lPitch = ComputePitch(GetByteAlignedWidth(surfaceDesc2.dwWidth, BitCount), BitCount);
}
// Set surface format
if (surfaceFormat == D3DFMT_UNKNOWN)
if (surfaceFormat == D3DFMT_UNKNOWN && (surfaceDesc2.dwFlags & DDSD_PIXELFORMAT))
{
surfaceFormat = GetDisplayFormat(surfaceDesc2.ddpfPixelFormat);
}
Expand Down
2 changes: 1 addition & 1 deletion ddraw/IDirectDrawTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void ConvertSurfaceDesc(DDSURFACEDESC2 &Desc2, DDSURFACEDESC &Desc)
{
if ((Desc.dwFlags & DDSD_PIXELFORMAT) && Desc.ddpfPixelFormat.dwFlags)
{
D3DFORMAT Format = GetDisplayFormat(Desc.ddpfPixelFormat);
D3DFORMAT Format = GetDisplayFormat(Desc2.ddpfPixelFormat);
if (Format != D3DFMT_UNKNOWN)
{
LOG_LIMIT(100, __FUNCTION__ << " Warning: overwritting existing pixel format: " << Format << " with zbuffer depth: " << Desc.dwZBufferBitDepth);
Expand Down
4 changes: 2 additions & 2 deletions ddraw/IDirectDrawX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2775,7 +2775,7 @@ HRESULT m_IDirectDrawX::CreateD3D9Device()
}
else
{
if (ExclusiveMode || Config.FullscreenWindowMode)
if (ExclusiveMode || Config.FullscreenWindowMode || Config.ForceExclusiveFullscreen)
{
BackBufferWidth = CurrentWidth;
BackBufferHeight = CurrentHeight;
Expand Down Expand Up @@ -3516,7 +3516,7 @@ HRESULT m_IDirectDrawX::Present(RECT* pSourceRect, RECT* pDestRect)
Logging::LogDebug() << __FUNCTION__ << " (" << this << ")";

// Skip frame if time lapse is too small
if (Config.AutoFrameSkip && !EnableWaitVsync)
if (Config.DdrawAutoFrameSkip && !EnableWaitVsync)
{
Counter.FrameSkipCounter++;

Expand Down

0 comments on commit a2ce4cc

Please sign in to comment.