Merge branch 'template_train_replacement' into jgrpp
# Conflicts: # src/linkgraph/linkgraphjob.cpp # src/saveload/extended_ver_sl.cpp # src/train_cmd.cpp # src/vehicle_base.h
This commit is contained in:
@@ -13,6 +13,17 @@
|
||||
#define MACOS_STDAFX_H
|
||||
|
||||
|
||||
#include <AvailabilityMacros.h>
|
||||
|
||||
/* We assume if these macros are defined, the SDK is also at least this version or later. */
|
||||
#ifdef MAC_OS_X_VERSION_10_7
|
||||
#define HAVE_OSX_107_SDK
|
||||
#endif
|
||||
|
||||
#ifdef MAC_OS_X_VERSION_10_11
|
||||
#define HAVE_OSX_1011_SDK
|
||||
#endif
|
||||
|
||||
/* It would seem that to ensure backward compability we have to ensure that we have defined MAC_OS_X_VERSION_10_x everywhere */
|
||||
#ifndef MAC_OS_X_VERSION_10_3
|
||||
#define MAC_OS_X_VERSION_10_3 1030
|
||||
@@ -57,8 +68,6 @@
|
||||
# error "Compiling 64 bits without _SQ64 set! (or vice versa)"
|
||||
#endif
|
||||
|
||||
#include <AvailabilityMacros.h>
|
||||
|
||||
/* Name conflict */
|
||||
#define Rect OTTDRect
|
||||
#define Point OTTDPoint
|
||||
|
@@ -785,3 +785,36 @@ uint GetCPUCoreCount()
|
||||
GetSystemInfo(&info);
|
||||
return info.dwNumberOfProcessors;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/* Code from MSDN: https://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx */
|
||||
const DWORD MS_VC_EXCEPTION = 0x406D1388;
|
||||
#pragma pack(push,8)
|
||||
typedef struct {
|
||||
DWORD dwType; ///< Must be 0x1000.
|
||||
LPCSTR szName; ///< Pointer to name (in user addr space).
|
||||
DWORD dwThreadID; ///< Thread ID (-1=caller thread).
|
||||
DWORD dwFlags; ///< Reserved for future use, must be zero.
|
||||
} THREADNAME_INFO;
|
||||
#pragma pack(pop)
|
||||
|
||||
/**
|
||||
* Signal thread name to any attached debuggers.
|
||||
*/
|
||||
void SetWin32ThreadName(DWORD dwThreadID, const char* threadName)
|
||||
{
|
||||
THREADNAME_INFO info;
|
||||
info.dwType = 0x1000;
|
||||
info.szName = threadName;
|
||||
info.dwThreadID = dwThreadID;
|
||||
info.dwFlags = 0;
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 6320 6322)
|
||||
__try {
|
||||
RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(ULONG_PTR), (ULONG_PTR*)&info);
|
||||
} __except (EXCEPTION_EXECUTE_HANDLER) {
|
||||
}
|
||||
#pragma warning(pop)
|
||||
}
|
||||
#endif
|
||||
|
@@ -39,4 +39,10 @@ HRESULT OTTDSHGetFolderPath(HWND, int, HANDLE, DWORD, LPTSTR);
|
||||
#define SHGFP_TYPE_CURRENT 0
|
||||
#endif /* __MINGW32__ */
|
||||
|
||||
#ifdef _MSC_VER
|
||||
void SetWin32ThreadName(DWORD dwThreadID, const char* threadName);
|
||||
#else
|
||||
static inline void SetWin32ThreadName(DWORD dwThreadID, const char* threadName) {}
|
||||
#endif
|
||||
|
||||
#endif /* WIN32_H */
|
||||
|
Reference in New Issue
Block a user