1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-14 22:03:27 +01:00

properly target windows 2000 in mingw build + allows to build for windows ME now as well

This commit is contained in:
FunkyFr3sh 2024-09-28 19:20:50 +02:00
parent 7175939854
commit beae3c5fb7
6 changed files with 34 additions and 12 deletions

View File

@ -1,15 +1,16 @@
-include config.mk
TARGET = ddraw.dll
LDFLAGS = -Wl,--enable-stdcall-fixup -s -static -shared
CFLAGS = -Iinc -O2 -march=i486 -Wall -std=c99
LIBS = -lgdi32 -lwinmm -ldbghelp -lole32
TARGET ?= ddraw.dll
LDFLAGS ?= -Wl,--enable-stdcall-fixup -s -static -shared
CFLAGS ?= -Iinc -O2 -Wall -std=c99
LIBS = -lgdi32 -lwinmm -ldbghelp -lole32 -lMsimg32
COMMIT := $(shell git describe --match=NeVeRmAtCh --always --dirty || echo UNKNOWN)
BRANCH := $(shell git rev-parse --abbrev-ref HEAD || echo UNKNOWN)
CMDTEST := $(shell echo \"\")
ifeq ($(CMDTEST),\"\")
ECHOTEST := $(shell echo \"\")
ifeq ($(ECHOTEST),\"\")
# Windows
HASH := \#
ECOMMIT := $(shell echo $(HASH)define GIT_COMMIT "$(COMMIT)" > inc/git.h)
@ -20,13 +21,17 @@ else
EBRANCH := $(shell echo "#define GIT_BRANCH" \"$(BRANCH)\" >> inc/git.h)
endif
CC = i686-w64-mingw32-gcc
WINDRES ?= i686-w64-mingw32-windres
ifdef DEBUG
CFLAGS += -D _DEBUG -D _DEBUG_X
endif
ifdef _WIN32_WINNT
CFLAGS += -march=i486 -D _WIN32_WINNT=$(_WIN32_WINNT)
endif
CC = i686-w64-mingw32-gcc
WINDRES ?= i686-w64-mingw32-windres
SRCS := $(wildcard src/*.c) $(wildcard src/*/*.c) res.rc
OBJS := $(addsuffix .o, $(basename $(SRCS)))

View File

@ -10,6 +10,6 @@ set GIT6=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\
set PATH=C:\w64devkit\bin;%GIT1%;%GIT2%;%GIT3%;%GIT4%;%GIT5%;%GIT6%;%PATH%
make clean
make
make _WIN32_WINNT=0x0500
pause

View File

@ -10,6 +10,6 @@ set GIT6=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\
set PATH=C:\w64devkit\bin;%GIT1%;%GIT2%;%GIT3%;%GIT4%;%GIT5%;%GIT6%;%PATH%
make clean
make DEBUG=1
make DEBUG=1 _WIN32_WINNT=0x0500
pause

View File

@ -64,6 +64,18 @@ HRESULT dd_CreateEx(GUID* lpGuid, LPVOID* lplpDD, REFIID iid, IUnknown* pUnkOute
#define CREATE_WAITABLE_TIMER_MANUAL_RESET 0x00000001
#endif
#ifndef GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT
#define GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT 0x00000002
#endif
#ifndef GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
#define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004
#endif
#if (_WIN32_WINNT < _WIN32_WINNT_WIN2K)
#define GdiTransparentBlt TransparentBlt
#endif
typedef struct SPEEDLIMITER
{
DWORD tick_length;

View File

@ -28,6 +28,11 @@
#define _WIN32_WINNT_WIN11 0x0A00
#endif
#if (_WIN32_WINNT < _WIN32_WINNT_WIN2K)
#define RtlVerifyVersionInfo(a,b,c) 1
#define VerifyVersionInfoW(a,b,c) 0
#define VerSetConditionMask(a,b,c) 0
#endif
void verhelp_init();
BOOL verhelp_verify_version(PRTL_OSVERSIONINFOEXW versionInfo, ULONG typeMask, ULONGLONG conditionMask);

View File

@ -73,7 +73,7 @@ LONG WINAPI dbg_exception_handler(EXCEPTION_POINTERS* exception)
HMODULE mod = NULL;
char filename[MAX_PATH] = { 0 };
#if defined(_MSC_VER) /* comment this out just to keep the mingw build win2000 compatible */
#if (_WIN32_WINNT >= _WIN32_WINNT_WINXP)
if (GetModuleHandleExA(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
exception->ExceptionRecord->ExceptionAddress,