- cleaned up the remaining dependencies on windows.h

This file now only gets included by code that really needs it.
This commit is contained in:
Christoph Oelckers 2020-02-03 21:30:57 +01:00
parent 95c906e21a
commit a90185bea9
17 changed files with 20 additions and 265 deletions

View file

@ -73,15 +73,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "menu/menu.h" #include "menu/menu.h"
#include "sound/s_soundinternal.h" #include "sound/s_soundinternal.h"
#ifdef _WIN32
# include <shellapi.h>
# define UPDATEINTERVAL 604800 // 1w
#else
# ifndef GEKKO
# include <sys/ioctl.h>
# endif
#endif /* _WIN32 */
BEGIN_BLD_NS BEGIN_BLD_NS

View file

@ -21,13 +21,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
#include "ns.h" // Must come before everything else! #include "ns.h" // Must come before everything else!
#ifndef NETCODE_DISABLE
#include "enet.h"
#endif
#include "build.h" #include "build.h"
#include "mmulti.h" #include "mmulti.h"
#include "pragmas.h" #include "pragmas.h"
#ifndef NETCODE_DISABLE
#include "enet.h"
#endif
#include "compat.h" #include "compat.h"
#include "config.h" #include "config.h"
#include "controls.h" #include "controls.h"

View file

@ -7,10 +7,6 @@
#pragma once #pragma once
#ifdef _WIN32
# include "windows_inc.h"
#endif
#include "xs_Float.h" #include "xs_Float.h"
////////// Compiler detection ////////// ////////// Compiler detection //////////

View file

@ -1,144 +0,0 @@
// Wrapper for all Windows headers.
// No include guard for this file.
#ifndef _WIN32_IE
# define _WIN32_IE 0x0501
#endif
#ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x0501
#endif
#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
#endif
#ifndef NOMINMAX
# define NOMINMAX
#endif
#ifdef UNREFERENCED_PARAMETER
# undef UNREFERENCED_PARAMETER
#endif
#ifdef NEED_WINSOCK2_H
# include <winsock2.h>
# undef NEED_WINSOCK2_H
#endif
#include <windows.h>
#ifdef NEED_WINDOWSX_H
# include <windowsx.h>
# undef NEED_WINDOWSX_H
#endif
#ifdef NEED_PROCESS_H
# include <process.h>
# undef NEED_PROCESS_H
#endif
#ifdef NEED_SHELLAPI_H
# include <shellapi.h>
# undef NEED_SHELLAPI_H
#endif
#ifdef NEED_SHLWAPI_H
# include <shlwapi.h>
# undef NEED_SHLWAPI_H
#endif
#ifdef NEED_SHLOBJ_H
# include <shlobj.h>
# undef NEED_SHLOBJ_H
#endif
#ifdef NEED_WS2TCPIP_H
# include <ws2tcpip.h>
# undef NEED_WS2TCPIP_H
#endif
#ifdef NEED_COMMCTRL_H
# include <commctrl.h>
# undef NEED_COMMCTRL_H
#endif
#ifdef NEED_MMSYSTEM_H
# include <mmsystem.h>
# undef NEED_MMSYSTEM_H
#endif
#ifdef NEED_DDRAW_H
# define DIRECTDRAW_VERSION 0x0600
# ifndef CINTERFACE
# define CINTERFACE
# endif
# include <ddraw.h>
# undef NEED_DDRAW_H
#endif
#ifdef NEED_DINPUT_H
# define INITGUID
# define DIRECTINPUT_VERSION 0x0700
# ifndef CINTERFACE
# define CINTERFACE
# endif
# include <dinput.h>
# undef NEED_DINPUT_H
# if defined (_MSC_VER) || !defined(__cplusplus)
# define bDIPROP_BUFFERSIZE MAKEDIPROP(1)
# define bDIPROP_DEADZONE MAKEDIPROP(5)
# define bDIPROP_SATURATION MAKEDIPROP(6)
# else
# define bMAKEDIPROP(prop) ((REFGUID)(prop))
# define bDIPROP_BUFFERSIZE bMAKEDIPROP(1)
# define bDIPROP_DEADZONE bMAKEDIPROP(5)
# define bDIPROP_SATURATION bMAKEDIPROP(6)
# endif
# if defined (_MSC_VER) && defined(__cplusplus)
# define bREFGUID (REFGUID)
# define bREFIID (REFIID)
# else
# define bREFGUID &
# define bREFIID &
# endif
# ifndef DIK_PAUSE
# define DIK_PAUSE 0xC5
# endif
#endif
#ifdef NEED_DSOUND_H
# define DIRECTSOUND_VERSION 0x0800
# ifndef CINTERFACE
# define CINTERFACE
# endif
# include <dsound.h>
# undef NEED_DSOUND_H
#endif
#ifdef NEED_CRTDBG_H
# include <crtdbg.h>
# undef NEED_CRTDBG_H
#endif
#ifdef NEED_DBGHELP_H
# if defined _MSC_VER && _MSC_VER < 1300
# define DECLSPEC_DEPRECATED
// VC6: change this path to your Platform SDK headers.
// must be XP version of file
// # include "M:\\dev7\\vs\\devtools\\common\\win32sdk\\include\\dbghelp.h"
# error "VC6 needs an updated dbghelp.h; see source"
# else
// VC7: ships with updated headers
# include <dbghelp.h>
# endif
# undef NEED_DBGHELP_H
#endif
#ifndef UNREFERENCED_PARAMETER
# define UNREFERENCED_PARAMETER(x) (x) = (x)
#endif

View file

@ -1102,7 +1102,6 @@ FString::FString (ELumpNum lumpnum)
//#define WIN32_LEAN_AND_MEAN //#define WIN32_LEAN_AND_MEAN
//#include <windows.h> //#include <windows.h>
#if 0
extern "C" { extern "C" {
__declspec(dllimport) unsigned long __stdcall FormatMessageA( __declspec(dllimport) unsigned long __stdcall FormatMessageA(
unsigned long dwFlags, unsigned long dwFlags,
@ -1116,7 +1115,6 @@ __declspec(dllimport) unsigned long __stdcall FormatMessageA(
__declspec(dllimport) void * __stdcall LocalFree (void *); __declspec(dllimport) void * __stdcall LocalFree (void *);
__declspec(dllimport) unsigned long __stdcall GetLastError (); __declspec(dllimport) unsigned long __stdcall GetLastError ();
} }
#endif
static void PrintLastError () static void PrintLastError ()
{ {
@ -1127,7 +1125,7 @@ static void PrintLastError ()
NULL, NULL,
GetLastError(), GetLastError(),
1 << 10 /*MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT)*/, // Default language 1 << 10 /*MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT)*/, // Default language
(LPSTR)&lpMsgBuf, (char **)&lpMsgBuf,
0, 0,
NULL NULL
); );

View file

@ -835,9 +835,7 @@ void I_Error(const char* error, ...)
va_start(argptr, error); va_start(argptr, error);
vsnprintf(errortext, MAX_ERRORTEXT, error, argptr); vsnprintf(errortext, MAX_ERRORTEXT, error, argptr);
va_end(argptr); va_end(argptr);
#ifdef _WIN32 I_DebugPrint(errortext);
OutputDebugStringA(errortext);
#endif
throw std::runtime_error(errortext); throw std::runtime_error(errortext);
} }
@ -850,9 +848,7 @@ void I_FatalError(const char* error, ...)
va_start(argptr, error); va_start(argptr, error);
vsnprintf(errortext, MAX_ERRORTEXT, error, argptr); vsnprintf(errortext, MAX_ERRORTEXT, error, argptr);
va_end(argptr); va_end(argptr);
#ifdef _WIN32 I_DebugPrint(errortext);
OutputDebugStringA(errortext);
#endif
throw std::runtime_error(errortext); throw std::runtime_error(errortext);
} }

View file

@ -34,6 +34,7 @@
*/ */
// Caution: LzmaDec also pulls in windows.h! // Caution: LzmaDec also pulls in windows.h!
#define NOMINMAX
#include "LzmaDec.h" #include "LzmaDec.h"
#include <zlib.h> #include <zlib.h>
#include <bzlib.h> #include <bzlib.h>

View file

@ -64,15 +64,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# define GAME_STATIC static # define GAME_STATIC static
#endif #endif
#ifdef _WIN32
# include <shellapi.h>
# define UPDATEINTERVAL 604800 // 1w
#else
# ifndef GEKKO
# include <sys/ioctl.h>
# endif
#endif /* _WIN32 */
BEGIN_DUKE_NS BEGIN_DUKE_NS
int32_t g_quitDeadline = 0; int32_t g_quitDeadline = 0;

View file

@ -1,26 +0,0 @@
#define NEED_DBGHELP_H
#define NEED_MMSYSTEM_H
#include "windows_inc.h"
BEGIN_DUKE_NS
// based on dbghelp.h
typedef BOOL (WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess, DWORD dwPid, HANDLE hFile, MINIDUMP_TYPE DumpType,
CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam
);
class MiniDumper
{
private:
static LPCSTR m_szAppName;
static LONG WINAPI TopLevelFilter( struct _EXCEPTION_POINTERS *pExceptionInfo );
public:
MiniDumper( LPCSTR szAppName );
};
END_DUKE_NS

View file

@ -22,6 +22,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "ns.h" // Must come before everything else! #include "ns.h" // Must come before everything else!
#ifndef NETWORK_DISABLE
#include "enet.h"
#endif
/// Preprocessor directives: /// Preprocessor directives:
/// ///
/// ITERATE_ON_UPDATE: Every time the netcode updates the sprite linked lists, attempt to iterate through all of them. /// ITERATE_ON_UPDATE: Every time the netcode updates the sprite linked lists, attempt to iterate through all of them.
@ -39,7 +43,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gamecvars.h" #include "gamecvars.h"
#include "mapinfo.h" #include "mapinfo.h"
#include "enet.h"
#include "m_crc32.h" #include "m_crc32.h"
BEGIN_DUKE_NS BEGIN_DUKE_NS

View file

@ -21,10 +21,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
#include "ns.h" // Must come before everything else! #include "ns.h" // Must come before everything else!
#ifndef NETWORK_DISABLE
#include "enet.h"
#endif
#include "duke3d.h" #include "duke3d.h"
#include "demo.h" #include "demo.h"
#include "enet.h"
#include "sjson.h" #include "sjson.h"
#include "gamecvars.h" #include "gamecvars.h"
#include "d_event.h" #include "d_event.h"

View file

@ -1,14 +1,3 @@
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <windows.h> // Ugh... This needs to go away but since some of the headers pull it in the compilation is creepingly slow without this.
#ifdef min
#undef min
#undef max
#endif
#endif
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@ -26,10 +15,6 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <cassert> #include <cassert>
#ifdef _MSC_VER
#include <direct.h>
#include <io.h>
#endif // _MSC_VER
#include <limits> #include <limits>
#include <memory> #include <memory>
#include <tuple> #include <tuple>
@ -40,5 +25,5 @@
// These two headers get included nearly everywhere so it doesn't matter if changing them forces a few more recompiles. // These two headers get included nearly everywhere so it doesn't matter if changing them forces a few more recompiles.
// The overall savings from PCHing them are more significant. // The overall savings from PCHing them are more significant.
//#include "tarray.h" #include "tarray.h"
//#include "zstring.h" #include "zstring.h"

View file

@ -61,15 +61,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# define GAME_STATIC static # define GAME_STATIC static
#endif #endif
#ifdef _WIN32
# include <shellapi.h>
# define UPDATEINTERVAL 604800 // 1w
#else
# ifndef GEKKO
# include <sys/ioctl.h>
# endif
#endif /* _WIN32 */
BEGIN_RR_NS BEGIN_RR_NS

View file

@ -1,26 +0,0 @@
#define NEED_DBGHELP_H
#define NEED_MMSYSTEM_H
#include "windows_inc.h"
BEGIN_RR_NS
// based on dbghelp.h
typedef BOOL (WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess, DWORD dwPid, HANDLE hFile, MINIDUMP_TYPE DumpType,
CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam
);
class MiniDumper
{
private:
static LPCSTR m_szAppName;
static LONG WINAPI TopLevelFilter( struct _EXCEPTION_POINTERS *pExceptionInfo );
public:
MiniDumper( LPCSTR szAppName );
};
END_RR_NS

View file

@ -21,6 +21,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
#include "ns.h" // Must come before everything else! #include "ns.h" // Must come before everything else!
#ifndef NETWORK_DISABLE
#include "enet.h"
#endif
#include "duke3d.h" #include "duke3d.h"
#include "game.h" #include "game.h"
#include "gamedef.h" #include "gamedef.h"
@ -31,8 +35,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "m_crc32.h" #include "m_crc32.h"
#include "mapinfo.h" #include "mapinfo.h"
#include "enet.h"
BEGIN_RR_NS BEGIN_RR_NS
#define TIMERUPDATESIZ 32 #define TIMERUPDATESIZ 32

View file

@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "duke3d.h" #include "duke3d.h"
#include "demo.h" #include "demo.h"
#include "enet.h"
#include "d_event.h" #include "d_event.h"
BEGIN_RR_NS BEGIN_RR_NS

View file

@ -2,10 +2,6 @@
#include "build.h" #include "build.h"
#ifdef _WIN32
# include "windows_inc.h"
#endif
#include "common.h" #include "common.h"
#include "common_game.h" #include "common_game.h"