summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/debug.cpp7
-rw-r--r--src/map.cpp2
-rw-r--r--src/minilzo.cpp2
-rw-r--r--src/misc/strapi.hpp4
-rw-r--r--src/os_timer.cpp5
-rw-r--r--src/stdafx.h18
6 files changed, 29 insertions, 9 deletions
diff --git a/src/debug.cpp b/src/debug.cpp
index 9f25f8faf..2e645e1e2 100644
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -94,7 +94,14 @@ void CDECL debug(const char *dbg, ...)
} else
#endif /* ENABLE_NETWORK */
{
+#if defined(WINCE)
+ /* We need to do OTTD2FS twice, but as it uses a static buffer, we need to store one temporary */
+ TCHAR tbuf[512];
+ _sntprintf(tbuf, sizeof(tbuf), _T("%s"), OTTD2FS(dbg));
+ NKDbgPrintfW(_T("dbg: [%s] %s\n"), tbuf, OTTD2FS(buf));
+#else
fprintf(stderr, "dbg: [%s] %s\n", dbg, buf);
+#endif
IConsoleDebug(dbg, buf);
}
}
diff --git a/src/map.cpp b/src/map.cpp
index 0c0964dfa..6156ecf8e 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -84,7 +84,7 @@ TileIndex TileAdd(TileIndex tile, TileIndexDiff add,
snprintf(buf, lengthof(buf), "TILE_ADD(%s) when adding 0x%.4X and 0x%.4X failed",
exp, tile, add);
-#if !defined(_MSC_VER)
+#if !defined(_MSC_VER) || defined(WINCE)
fprintf(stderr, "%s:%d %s\n", file, line, buf);
#else
_assert(buf, (char*)file, line);
diff --git a/src/minilzo.cpp b/src/minilzo.cpp
index 568c78f2f..68e0bb0f8 100644
--- a/src/minilzo.cpp
+++ b/src/minilzo.cpp
@@ -60,7 +60,7 @@
# define LZO_HAVE_CONFIG_H
#endif
-#if !defined(LZO_NO_SYS_TYPES_H)
+#if !defined(LZO_NO_SYS_TYPES_H) && !defined(WINCE)
# include <sys/types.h>
#endif
#include <stdio.h>
diff --git a/src/misc/strapi.hpp b/src/misc/strapi.hpp
index 33e22d5b9..48cfb0f8c 100644
--- a/src/misc/strapi.hpp
+++ b/src/misc/strapi.hpp
@@ -38,7 +38,7 @@ template <> /*static*/ inline size_t CStrApiBaseT<char>::StrLen(const char *s)
/** ::vsprintf wrapper specialization for char */
template <> /*static*/ inline int CStrApiBaseT<char>::SPrintFL(char *buf, size_t count, const char *fmt, va_list args)
{
-#if defined(_MSC_VER) && (_MSC_VER >= 1400) // VC 8.0 and above
+#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(WINCE) // VC 8.0 and above
return ::vsnprintf_s(buf, count, count - 1, fmt, args);
#else /* ! VC 8.0 and above */
return ::vsnprintf(buf, count, fmt, args);
@@ -55,7 +55,7 @@ template <> /*static*/ inline size_t CStrApiBaseT<wchar_t>::StrLen(const wchar_t
/** ::vsprintf wrapper specialization for wchar_t */
template <> /*static*/ inline int CStrApiBaseT<wchar_t>::SPrintFL(wchar_t *buf, size_t count, const wchar_t *fmt, va_list args)
{
-#if defined(_MSC_VER) && (_MSC_VER >= 1400) // VC 8.0 and above
+#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(WINCE) // VC 8.0 and above
return ::_vsnwprintf_s(buf, count, count - 1, fmt, args);
#else /* ! VC 8.0 and above */
# if defined(_WIN32)
diff --git a/src/os_timer.cpp b/src/os_timer.cpp
index a28bb8982..ca0b279b4 100644
--- a/src/os_timer.cpp
+++ b/src/os_timer.cpp
@@ -8,7 +8,7 @@
/* rdtsc for MSC_VER, uses simple inline assembly, or _rdtsc
* from external win64.asm because VS2005 does not support inline assembly */
-#if defined(_MSC_VER) && !defined(RDTSC_AVAILABLE)
+#if defined(_MSC_VER) && !defined(RDTSC_AVAILABLE) && !defined(WINCE)
# if _MSC_VER >= 1400
#include <intrin.h>
uint64 _rdtsc()
@@ -71,6 +71,9 @@ uint64 _rdtsc()
/* In all other cases we have no support for rdtsc. No major issue,
* you just won't be able to profile your code with TIC()/TOC() */
#if !defined(RDTSC_AVAILABLE)
+/* MSVC (in case of WinCE) can't handle #warning */
+# if !defined(_MSC_VER)
#warning "(non-fatal) No support for rdtsc(), you won't be able to profile with TIC/TOC"
+# endif
uint64 _rdtsc() {return 0;}
#endif
diff --git a/src/stdafx.h b/src/stdafx.h
index 7dae3ebdb..20f565679 100644
--- a/src/stdafx.h
+++ b/src/stdafx.h
@@ -142,7 +142,9 @@
# define _WIN32_WINNT 0x0500 // Windows 2000
# define _WIN32_WINDOWS 0x400 // Windows 95
+#if !defined(WINCE)
# define WINVER 0x0400 // Windows NT 4.0 / Windows 95
+#endif
# define _WIN32_IE_ 0x0401 // 4.01 (win98 and NT4SP5+)
# define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
@@ -168,9 +170,11 @@
# define NORETURN __declspec(noreturn)
# define FORCEINLINE __forceinline
# define inline _inline
-# define CDECL _cdecl
+# if !defined(WINCE)
+# define CDECL _cdecl
+# endif
int CDECL snprintf(char *str, size_t size, const char *format, ...);
-# if _MSC_VER < 1400
+# if _MSC_VER < 1400 || defined(WINCE)
int CDECL vsnprintf(char *str, size_t size, const char *format, va_list ap);
# endif
@@ -191,8 +195,14 @@
# endif
# endif
-# define strcasecmp stricmp
-# define strncasecmp strnicmp
+# if defined(WINCE)
+# define strcasecmp _stricmp
+# define strncasecmp _strnicmp
+# undef DEBUG
+# else
+# define strcasecmp stricmp
+# define strncasecmp strnicmp
+# endif
/* suppress: warning C4005: 'offsetof' : macro redefinition (VC8) */
#endif /* defined(_MSC_VER) */