From b228d6e00a0167f8fc078c4c89d2bb79a9e2ebff Mon Sep 17 00:00:00 2001 From: galaxyhaxz Date: Fri, 12 Apr 2019 22:42:39 -0500 Subject: [PATCH] Palette fix for newer Windows --- Source/diablo.cpp | 2 +- Source/dx.cpp | 9 +++++++++ types.h | 8 +++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 0c8a7b86a..0d4e7e248 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -171,7 +171,7 @@ void run_game_loop(unsigned int uMsg) gbGameLoopStartup = 0; DrawAndBlit(); } -#ifdef SLEEP +#ifdef SLEEPFIX Sleep(1); #endif } diff --git a/Source/dx.cpp b/Source/dx.cpp index 79841dd05..efcb888e6 100644 --- a/Source/dx.cpp +++ b/Source/dx.cpp @@ -67,6 +67,15 @@ void dx_init(HWND hWnd) v3 = dx_DirectDrawCreate(v2, &lpDDInterface, NULL); if (v3) ErrDlg(IDD_DIALOG1, v3, "C:\\Src\\Diablo\\Source\\dx.cpp", 149); + +#ifdef COLORFIX +#ifdef __DDRAWI_INCLUDED__ + ((LPDDRAWI_DIRECTDRAW_INT)lpDDInterface)->lpLcl->dwAppHackFlags |= 0x800; +#else + ((DWORD **)lpDDInterface)[1][18] |= 0x800; +#endif +#endif + fullscreen = 1; #ifdef __cplusplus v4 = lpDDInterface->SetCooperativeLevel(v1, DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT | DDSCL_FULLSCREEN); diff --git a/types.h b/types.h index c427ce332..ef715d13d 100644 --- a/types.h +++ b/types.h @@ -48,13 +48,19 @@ // If defined, use copy protection [Default -> Defined] //#define COPYPROT + // If defined, don't reload for debuggers [Default -> Undefined] // Note that with patch 1.03 the command line was hosed, this is required to pass arguments to the game #ifdef _DEBUG #define DEBUGGER #endif + // If defined, don't fry the CPU [Default -> Undefined] -#define SLEEP +#define SLEEPFIX + +// If defined, fix palette glitch in Windows Vista+ [Default -> Undefined] +//#define COLORFIX + // If defined, use standard memcpy() in place of qmemcpy() [Default -> Undefined] // Will be replaced with [rep movsd] if optimization is used #define FAST_MEMCPY