Skip to content

Commit f4325a7

Browse files
committed
#383 add support for Dark Colony
1 parent d45f35a commit f4325a7

File tree

6 files changed

+22
-1
lines changed

6 files changed

+22
-1
lines changed

build.cmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ set GIT6=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\
99

1010
set PATH=C:\w64devkit\bin;%GIT1%;%GIT2%;%GIT3%;%GIT4%;%GIT5%;%GIT6%;%PATH%
1111

12-
make clean
12+
1313
make _WIN32_WINNT=0x0400
1414

1515
pause

inc/config.h

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ typedef struct CNCDDRAWCONFIG
106106
BOOL carma95_hack;
107107
BOOL sirtech_hack;
108108
BOOL flightsim98_hack;
109+
BOOL darkcolony_hack;
109110

110111
} CNCDDRAWCONFIG;
111112

inc/dllmain.h

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ typedef BOOL(__stdcall* SETPROCESSDPIAWARENESSCONTEXTPROC)(DPI_AWARENESS_CONTEXT
3131

3232
#if (_WIN32_WINNT < _WIN32_WINNT_WINXP)
3333
#define SetThreadExecutionState(a)
34+
#define DisableProcessWindowsGhosting()
3435
#endif
3536

3637
#endif

src/config.c

+6
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ void cfg_load()
116116
GET_BOOL(g_config.carma95_hack, "carma95_hack", FALSE);
117117
GET_BOOL(g_config.sirtech_hack, "sirtech_hack", FALSE);
118118
GET_BOOL(g_config.flightsim98_hack, "flightsim98_hack", FALSE);
119+
GET_BOOL(g_config.darkcolony_hack, "darkcolony_hack", FALSE);
119120

120121
GameHandlesClose = GameHandlesClose || g_config.infantryhack;
121122

@@ -874,6 +875,11 @@ static void cfg_create_ini()
874875
"[corsairs]\n"
875876
"adjmouse=true\n"
876877
"\n"
878+
"; Dark Colony\n"
879+
"[dc16]\n"
880+
"maxgameticks=30\n"
881+
"darkcolony_hack=true\n"
882+
"\n"
877883
"; Divine Divinity\n"
878884
"[div]\n"
879885
"resolutions=2\n"

src/dllmain.c

+5
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
5757
g_dbg_exception_handle = add_handler(1, (PVECTORED_EXCEPTION_HANDLER)dbg_vectored_exception_handler);
5858
}
5959

60+
if (g_config.darkcolony_hack)
61+
{
62+
DisableProcessWindowsGhosting();
63+
}
64+
6065
char buf[1024];
6166

6267
if (GetEnvironmentVariable("__COMPAT_LAYER", buf, sizeof(buf)))

src/winapi_hooks.c

+8
Original file line numberDiff line numberDiff line change
@@ -2046,6 +2046,14 @@ HWND WINAPI fake_CreateWindowExA(
20462046
dwStyle &= ~WS_POPUP;
20472047
}
20482048

2049+
/* Dark Colony */
2050+
if (HIWORD(lpClassName) && _strcmpi(lpClassName, "Merc Direct Draw Driver") == 0 &&
2051+
lpWindowName && _strcmpi(lpWindowName, "Direct Draw Driver") == 0 &&
2052+
!dwExStyle)
2053+
{
2054+
dwExStyle |= WS_EX_APPWINDOW;
2055+
}
2056+
20492057
/* Fallout 1/2 */
20502058
if (HIWORD(lpClassName) && _strcmpi(lpClassName, "GNW95 Class") == 0 &&
20512059
lpWindowName && strstr(lpWindowName, "FALLOUT"))

0 commit comments

Comments
 (0)