Remove: WinCE support

save_ext
Patric Stout 6 years ago
parent 85adde7485
commit aef69443e7

@ -558,10 +558,10 @@ check_params() {
log 1 " PREPROCESSOR is only available for OSX"
exit 1
fi
# OS only allows DETECT, UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, MORPHOS, BEOS, HAIKU, SUNOS, CYGWIN, MINGW, OS2, DOS, and WINCE
if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|DRAGONFLY|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS|WINCE)$'`" ]; then
# OS only allows DETECT, UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, MORPHOS, BEOS, HAIKU, SUNOS, CYGWIN, MINGW, OS2, and DOS
if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|DRAGONFLY|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS)$'`" ]; then
log 1 "configure: error: invalid option --os=$os"
log 1 " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|DRAGONFLY|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS|WINCE]"
log 1 " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|DRAGONFLY|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS]"
exit 1
fi
# cpu_type can be either 32 or 64
@ -760,13 +760,13 @@ check_params() {
exit 1
fi
else
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
log 1 "checking GDI video driver... found"
else
log 1 "checking GDI video driver... not Windows, skipping"
fi
if [ -z "$allegro_config" ] && [ -z "$sdl_config" ] && [ "$with_cocoa" = 0 ] && [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
if [ -z "$allegro_config" ] && [ -z "$sdl_config" ] && [ "$with_cocoa" = 0 ] && [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
log 1 "configure: error: no video driver development files found"
log 1 " If you want a dedicated server use --enable-dedicated as parameter"
exit 1
@ -1106,7 +1106,7 @@ check_params() {
fi
if [ "$personal_dir" = "1" ]; then
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ] || [ "$os" = "DOS" ] || [ "$os" = "HAIKU" ]; then
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "DOS" ] || [ "$os" = "HAIKU" ]; then
personal_dir="OpenTTD"
elif [ "$os" = "OSX" ]; then
personal_dir="Documents/OpenTTD"
@ -1594,16 +1594,13 @@ make_cflags_and_ldflags() {
fi
fi
if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "DOS" ] && [ "$os" != "WINCE" ] && [ "$os" != "OS2" ]; then
if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "DOS" ] && [ "$os" != "OS2" ]; then
LIBS="$LIBS -lpthread"
fi
if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "MINGW" ] && [ "$os" != "DOS" ] && [ "$os" != "WINCE" ]; then
if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "MINGW" ] && [ "$os" != "DOS" ]; then
LIBS="$LIBS -lc"
fi
if [ "$os" = "WINCE" ]; then
LIBS="$LIBS -lcoredll -lcorelibc -laygshell -lws2 -e WinMainCRTStartup"
fi
if [ "$os" = "MORPHOS" ]; then
# -Wstrict-prototypes generates much noise because of system headers
@ -1642,14 +1639,14 @@ make_cflags_and_ldflags() {
CFLAGS="$CFLAGS -DUNIX"
fi
# And others like Windows
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
CFLAGS="$CFLAGS -DWIN"
fi
if [ -n "$allegro_config" ]; then
CFLAGS="$CFLAGS -DWITH_ALLEGRO"
CFLAGS="$CFLAGS `$allegro_config --cflags`"
if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
if [ "$enable_static" != "0" ]; then
LIBS="$LIBS `$allegro_config --static --libs`"
else
@ -1662,7 +1659,7 @@ make_cflags_and_ldflags() {
CFLAGS="$CFLAGS -DWITH_SDL"
# SDL must not add _GNU_SOURCE as it breaks many platforms
CFLAGS="$CFLAGS `$sdl_config --cflags | sed 's@-D_GNU_SOURCE[^ ]*@@'`"
if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
if [ "$enable_static" != "0" ]; then
LIBS="$LIBS `$sdl_config --static-libs`"
else
@ -2098,7 +2095,7 @@ check_cxx_host() {
}
check_windres() {
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
check_compiler "host windres" "windres" "$host" "$windres" "$WINDRES" "windres" "windres" "2" "-V"
fi
}
@ -2304,7 +2301,7 @@ detect_awk() {
detect_os() {
if [ "$os" = "DETECT" ]; then
# Detect UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, HPUX, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, DOS, and WINCE
# Detect UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, HPUX, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, and DOS
# Try first via dumpmachine, then via uname
os=`echo "$host" | tr '[A-Z]' '[a-z]' | $awk '
@ -2324,7 +2321,6 @@ detect_os() {
/mingw/ { print "MINGW"; exit}
/os2/ { print "OS2"; exit}
/dos/ { print "DOS"; exit}
/wince/ { print "WINCE"; exit}
'`
if [ -z "$os" ]; then
@ -2350,7 +2346,7 @@ detect_os() {
if [ -z "$os" ]; then
log 1 "detecting OS... none detected"
log 1 "I couldn't detect your OS. Please use --os=OS to force one"
log 1 "Allowed values are: UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, MORPHOS, HPUX, BEOS, HAIKU, SUNOS, CYGWIN, MINGW, OS2, DOS, and WINCE"
log 1 "Allowed values are: UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, MORPHOS, HPUX, BEOS, HAIKU, SUNOS, CYGWIN, MINGW, OS2, and DOS"
exit 1
fi
@ -2793,7 +2789,7 @@ detect_fontconfig() {
fontconfig_config=""
return 0
fi
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
log 1 "checking libfontconfig... WIN32, skipping"
fontconfig_config=""
return 0
@ -3409,7 +3405,7 @@ showhelp() {
echo " --os=OS the OS we are compiling for [DETECT]"
echo " DETECT/UNIX/OSX/FREEBSD/DRAGONFLY/OPENBSD/"
echo " NETBSD/MORPHOS/HPUX/BEOS/SUNOS/CYGWIN/"
echo " MINGW/OS2/DOS/WINCE/HAIKU"
echo " MINGW/OS2/DOS/HAIKU"
echo " --endian=ENDIAN set the endian of the HOST (AUTO/LE/BE)"
echo ""
echo "Paths:"

3
configure vendored

@ -75,7 +75,7 @@ save_params
make_cflags_and_ldflags
EXE=""
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "OS2" ] || [ "$os" = "DOS" ] || [ "$os" = "WINCE" ]; then
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "OS2" ] || [ "$os" = "DOS" ]; then
EXE=".exe"
fi
@ -123,7 +123,6 @@ AWKCOMMAND='
if ($0 == "WIN32" && "'$os'" != "MINGW" &&
"'$os'" != "CYGWIN" && "'$os'" != "MSVC") { next; }
if ($0 == "MORPHOS" && "'$os'" != "MORPHOS") { next; }
if ($0 == "WINCE" && "'$os'" != "WINCE") { next; }
if ($0 == "MSVC" && "'$os'" != "MSVC") { next; }
if ($0 == "DIRECTMUSIC" && "'$with_direct_music'" == "0") { next; }
if ($0 == "LIBTIMIDITY" && "'$libtimidity'" == "" ) { next; }

@ -130,7 +130,6 @@ load_main_data() {
if ($0 == "BEOS" && "'$os'" != "BEOS") { next; }
if ($0 == "WIN32" && "'$os'" != "MINGW" &&
"'$os'" != "CYGWIN" && "'$os'" != "MSVC" ) { next; }
if ($0 == "WINCE" && "'$os'" != "WINCE") { next; }
if ($0 == "MSVC" && "'$os'" != "MSVC") { next; }
if ($0 == "DIRECTMUSIC" && "'$enable_directmusic'" != "1") { next; }
if ($0 == "LIBTIMIDITY" && "'$libtimidity'" == "" ) { next; }

@ -95,22 +95,19 @@ tilearea.cpp
townname.cpp
#if WIN32
#else
#if WINCE
#if OS2
os/os2/os2.cpp
3rdparty/os2/getaddrinfo.c
3rdparty/os2/getaddrinfo.h
3rdparty/os2/getnameinfo.c
3rdparty/os2/getnameinfo.h
#else
#if OS2
os/os2/os2.cpp
3rdparty/os2/getaddrinfo.c
3rdparty/os2/getaddrinfo.h
3rdparty/os2/getnameinfo.c
3rdparty/os2/getnameinfo.h
#if OSX
os/macosx/crashlog_osx.cpp
#else
#if OSX
os/macosx/crashlog_osx.cpp
#else
os/unix/crashlog_unix.cpp
#end
os/unix/unix.cpp
os/unix/crashlog_unix.cpp
#end
os/unix/unix.cpp
#end
#end
vehicle.cpp
@ -1088,9 +1085,6 @@ video/null_v.cpp
#if WIN32
video/win32_v.cpp
#end
#if WINCE
video/win32_v.cpp
#end
#end
# Music
@ -1109,14 +1103,11 @@ music/null_m.cpp
#if WIN32
music/win32_m.cpp
#else
#if WINCE
#if DOS
#else
#if DOS
#if MORPHOS
#else
#if MORPHOS
#else
music/extmidi.cpp
#end
music/extmidi.cpp
#end
#end
#end
@ -1170,10 +1161,6 @@ sound/null_s.cpp
os/windows/ottdres.rc
os/windows/win32.cpp
#end
#if WINCE
os/windows/ottdres.rc
os/windows/win32.cpp
#end
# Threading
thread/thread.h

@ -18,7 +18,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) && !defined(WINCE)
#if defined(_MSC_VER) && !defined(RDTSC_AVAILABLE)
#include <intrin.h>
uint64 ottd_rdtsc()
{
@ -71,10 +71,7 @@ uint64 ottd_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 ottd_rdtsc() {return 0;}
#endif

@ -135,9 +135,7 @@ static void debug_print(const char *dbg, const char *buf)
} else {
char buffer[512];
seprintf(buffer, lastof(buffer), "%sdbg: [%s] %s\n", GetLogPrefix(), dbg, buf);
#if defined(WINCE)
NKDbgPrintfW(OTTD2FS(buffer));
#elif defined(WIN32) || defined(WIN64)
#if defined(WIN32) || defined(WIN64)
_fputts(OTTD2FS(buffer, true), stderr);
#else
fputs(buffer, stderr);

@ -325,15 +325,7 @@ bool FioCheckFileExists(const char *filename, Subdirectory subdir)
*/
bool FileExists(const char *filename)
{
#if defined(WINCE)
/* There is always one platform that doesn't support basic commands... */
HANDLE hand = CreateFile(OTTD2FS(filename), 0, 0, NULL, OPEN_EXISTING, 0, NULL);
if (hand == INVALID_HANDLE_VALUE) return 1;
CloseHandle(hand);
return 0;
#else
return access(OTTD2FS(filename), 0) == 0;
#endif
}
/**
@ -544,7 +536,7 @@ static void FioCreateDirectory(const char *name)
{
/* Ignore directory creation errors; they'll surface later on, and most
* of the time they are 'directory already exists' errors anyhow. */
#if defined(WIN32) || defined(WINCE)
#if defined(WIN32)
CreateDirectory(OTTD2FS(name), NULL);
#elif defined(OS2) && !defined(__INNOTEK_LIBC__)
mkdir(OTTD2FS(name));
@ -988,14 +980,14 @@ bool ExtractTar(const char *tar_filename, Subdirectory subdir)
return true;
}
#if defined(WIN32) || defined(WINCE)
#if defined(WIN32)
/**
* Determine the base (personal dir and game data dir) paths
* @param exe the path from the current path to the executable
* @note defined in the OS related files (os2.cpp, win32.cpp, unix.cpp etc)
*/
extern void DetermineBasePaths(const char *exe);
#else /* defined(WIN32) || defined(WINCE) */
#else /* defined(WIN32) */
/**
* Changes the working directory to the path of the give executable.
@ -1158,7 +1150,7 @@ extern void cocoaSetApplicationBundleDir();
_searchpaths[SP_APPLICATION_BUNDLE_DIR] = NULL;
#endif
}
#endif /* defined(WIN32) || defined(WINCE) */
#endif /* defined(WIN32) */
const char *_personal_dir;

@ -153,9 +153,7 @@ const char *FiosBrowseTo(const FiosItem *item)
{
switch (item->type) {
case FIOS_TYPE_DRIVE:
#if defined(WINCE)
seprintf(_fios_path, _fios_path_last, PATHSEP "");
#elif defined(WIN32) || defined(__OS2__)
#if defined(WIN32) || defined(__OS2__)
seprintf(_fios_path, _fios_path_last, "%c:" PATHSEP, item->title[0]);
#endif
break;

@ -38,7 +38,7 @@ void GamelogReset();
* @param s The string to print.
*/
typedef void GamelogPrintProc(const char *s);
void GamelogPrint(GamelogPrintProc *proc); // needed for WIN32 / WINCE crash.log
void GamelogPrint(GamelogPrintProc *proc); // needed for WIN32 crash.log
void GamelogPrintDebug(int level);
void GamelogPrintConsole();

@ -1214,11 +1214,6 @@ void UndrawMouseCursor()
void DrawMouseCursor()
{
#if defined(WINCE)
/* Don't ever draw the mouse for WinCE, as we work with a stylus */
return;
#endif
/* Don't draw the mouse cursor if the screen is not ready */
if (_screen.dst_ptr == NULL) return;

@ -87,7 +87,7 @@ TileIndex TileAdd(TileIndex tile, TileIndexDiff add,
seprintf(buf, lastof(buf), "TILE_ADD(%s) when adding 0x%.4X and 0x%.4X failed",
exp, tile, add);
#if !defined(_MSC_VER) || defined(WINCE)
#if !defined(_MSC_VER)
fprintf(stderr, "%s:%d %s\n", file, line, buf);
#else
_assert(buf, (char*)file, line);

@ -692,11 +692,6 @@ int openttd_main(int argc, char *argv[])
goto exit_noshutdown;
}
#if defined(WINCE) && defined(_DEBUG)
/* Switch on debug lvl 4 for WinCE if Debug release, as you can't give params, and you most likely do want this information */
SetDebugString("4");
#endif
DeterminePaths(argv[0]);
TarScanner::DoScan(TarScanner::BASESET);

@ -67,11 +67,7 @@ bool LoadLibraryList(Function proc[], const char *dll)
while (*dll++ != '\0') { /* Nothing */ }
if (*dll == '\0') break;
#if defined(WINCE)
p = GetProcAddress(lib, MB_TO_WIDE(dll));
#else
p = GetProcAddress(lib, dll);
#endif
if (p == NULL) return false;
*proc++ = (Function)p;
}
@ -210,14 +206,6 @@ bool FiosIsRoot(const char *file)
void FiosGetDrives(FileList &file_list)
{
#if defined(WINCE)
/* WinCE only knows one drive: / */
FiosItem *fios = file_list.Append();
fios->type = FIOS_TYPE_DRIVE;
fios->mtime = 0;
seprintf(fios->name, lastof(fios->name), PATHSEP "");
strecpy(fios->title, fios->name, lastof(fios->title));
#else
TCHAR drives[256];
const TCHAR *s;
@ -230,7 +218,6 @@ void FiosGetDrives(FileList &file_list)
strecpy(fios->title, fios->name, lastof(fios->title));
while (*s++ != '\0') { /* Nothing */ }
}
#endif
}
bool FiosIsValidFile(const char *path, const struct dirent *ent, struct stat *sb)
@ -306,9 +293,6 @@ static int ParseCommandLine(char *line, char **argv, int max_argc)
void CreateConsole()
{
#if defined(WINCE)
/* WinCE doesn't support console stuff */
#else
HANDLE hand;
CONSOLE_SCREEN_BUFFER_INFO coninfo;
@ -358,7 +342,6 @@ void CreateConsole()
setvbuf(stdin, NULL, _IONBF, 0);
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);
#endif
}
/** Temporary pointer to get the help message to the window */
@ -426,18 +409,14 @@ void ShowInfo(const char *str)
}
}
#if defined(WINCE)
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
#else
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
#endif
{
int argc;
char *argv[64]; // max 64 command line arguments
CrashLog::InitialiseCrashLog();
#if defined(UNICODE) && !defined(WINCE)
#if defined(UNICODE)
/* Check if a win9x user started the win32 version */
if (HasBit(GetVersion(), 31)) usererror("This version of OpenTTD doesn't run on windows 95/98/ME.\nPlease download the win9x binary and try again.");
#endif
@ -451,9 +430,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
CreateConsole();
#endif
#if !defined(WINCE)
_set_error_mode(_OUT_TO_MSGBOX); // force assertion output to messagebox
#endif
/* setup random seed to something quite random */
SetRandomSeed(GetTickCount());
@ -468,35 +445,11 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
return 0;
}
#if defined(WINCE)
void GetCurrentDirectoryW(int length, wchar_t *path)
{
/* Get the name of this module */
GetModuleFileName(NULL, path, length);
/* Remove the executable name, this we call CurrentDir */
wchar_t *pDest = wcsrchr(path, '\\');
if (pDest != NULL) {
int result = pDest - path + 1;
path[result] = '\0';
}
}
#endif
char *getcwd(char *buf, size_t size)
{
#if defined(WINCE)
TCHAR path[MAX_PATH];
GetModuleFileName(NULL, path, MAX_PATH);
convert_from_fs(path, buf, size);
/* GetModuleFileName returns dir with file, so remove everything behind latest '\\' */
char *p = strrchr(buf, '\\');
if (p != NULL) *p = '\0';
#else
TCHAR path[MAX_PATH];
GetCurrentDirectory(MAX_PATH - 1, path);
convert_from_fs(path, buf, size);
#endif
return buf;
}

@ -189,9 +189,7 @@
#define NTDDI_VERSION NTDDI_WIN2K // Windows 2000
#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 WINVER 0x0400 // Windows NT 4.0 / Windows 95
#define _WIN32_IE_ 0x0401 // 4.01 (win98 and NT4SP5+)
#endif
#define NOMINMAX // Disable min/max macros in windows.h.
@ -225,10 +223,7 @@
#define inline __forceinline
#endif
#if !defined(WINCE)
#define CDECL _cdecl
#endif
#define CDECL _cdecl
#define GCC_PACK
#define WARN_FORMAT(string, args)
#define FINAL sealed
@ -240,10 +235,6 @@
#define FALLTHROUGH
#endif
#if defined(WINCE)
int CDECL vsnprintf(char *str, size_t size, const char *format, va_list ap);
#endif
#if defined(WIN32) && !defined(_WIN64) && !defined(WIN64)
#if !defined(_W64)
#define _W64
@ -264,15 +255,8 @@
#endif
#endif
#if defined(WINCE)
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#undef DEBUG
#else
#define strcasecmp stricmp
#define strncasecmp strnicmp
#endif
#define strcasecmp stricmp
#define strncasecmp strnicmp
#define strtoull _strtoui64
/* MSVC doesn't have these :( */
@ -290,10 +274,6 @@
#define SIGBUS SIGNOFP
#endif
#if defined(WINCE)
#define stredup _stredup
#endif /* WINCE */
/* NOTE: the string returned by these functions is only valid until the next
* call to the same function and is not thread- or reentrancy-safe */
#if !defined(STRGEN) && !defined(SETTINGSGEN)
@ -302,12 +282,9 @@
#include <tchar.h>
#include <io.h>
/* XXX - WinCE without MSVCRT doesn't support wfopen, so it seems */
#if !defined(WINCE)
namespace std { using ::_tfopen; }
#define fopen(file, mode) _tfopen(OTTD2FS(file), _T(mode))
#define unlink(file) _tunlink(OTTD2FS(file))
#endif /* WINCE */
namespace std { using ::_tfopen; }
#define fopen(file, mode) _tfopen(OTTD2FS(file), _T(mode))
#define unlink(file) _tunlink(OTTD2FS(file))
const char *FS2OTTD(const TCHAR *name);
const TCHAR *OTTD2FS(const char *name, bool console_cp = false);

@ -75,9 +75,7 @@ static void DedicatedSignalHandler(int sig)
#if defined(WIN32)
# include <windows.h> /* GetTickCount */
# if !defined(WINCE)
# include <conio.h>
# endif
# include <conio.h>
# include <time.h>
# include <tchar.h>
# include "../os/windows/win32.h"
@ -88,10 +86,6 @@ static char _win_console_thread_buffer[200];
/* Windows Console thread. Just loop and signal when input has been received */
static void WINAPI CheckForConsoleInput()
{
#if defined(WINCE)
/* WinCE doesn't support console stuff */
return;
#else
SetWin32ThreadName(-1, "ottd:win-console");
DWORD nb;
@ -106,7 +100,6 @@ static void WINAPI CheckForConsoleInput()
SetEvent(_hInputReady);
WaitForSingleObject(_hWaitForInputHandling, INFINITE);
}
#endif
}
static void CreateWindowsConsoleThread()
@ -157,9 +150,7 @@ const char *VideoDriver_Dedicated::Start(const char * const *parm)
ScreenSizeChanged();
BlitterFactory::GetCurrentBlitter()->PostResize();
#if defined(WINCE)
/* WinCE doesn't support console stuff */
#elif defined(WIN32)
#if defined(WIN32)
/* For win32 we need to allocate a console (debug mode does the same) */
CreateConsole();
CreateWindowsConsoleThread();

@ -60,9 +60,7 @@ bool _force_full_redraw;
bool _window_maximize;
uint _display_hz;
static Dimension _bck_resolution;
#if !defined(WINCE) || _WIN32_WCE >= 0x400
DWORD _imm_props;
#endif
/** Whether the drawing is/may be done in a separate thread. */
static bool _draw_threaded;
@ -272,9 +270,6 @@ bool VideoDriver_Win32::MakeWindow(bool full_screen)
_wnd.main_wnd = 0;
}
#if defined(WINCE)
/* WinCE is always fullscreen */
#else
if (full_screen) {
DEVMODE settings;
@ -318,7 +313,6 @@ bool VideoDriver_Win32::MakeWindow(bool full_screen)
_wnd.width = _bck_resolution.width;
_wnd.height = _bck_resolution.height;
}
#endif
{
RECT r;
@ -337,9 +331,7 @@ bool VideoDriver_Win32::MakeWindow(bool full_screen)
SetRect(&r, 0, 0, _wnd.width, _wnd.height);
}
#if !defined(WINCE)
AdjustWindowRect(&r, style, FALSE);
#endif
w = r.right - r.left;
h = r.bottom - r.top;
@ -497,7 +489,6 @@ static LRESULT HandleCharMsg(uint keycode, WChar charcode)
return 0;
}
#if !defined(WINCE) || _WIN32_WCE >= 0x400
/** Should we draw the composition string ourself, i.e is this a normal IME? */
static bool DrawIMECompositionString()
{
@ -634,15 +625,6 @@ static void CancelIMEComposition(HWND hwnd)
HandleTextInput(NULL, true);
}
#else
static bool DrawIMECompositionString() { return false; }
static void SetCompositionPos(HWND hwnd) {}
static void SetCandidatePos(HWND hwnd) {}
static void CancelIMEComposition(HWND hwnd) {}
#endif /* !defined(WINCE) || _WIN32_WCE >= 0x400 */
static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static uint32 keycode = 0;
@ -653,9 +635,7 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
case WM_CREATE:
SetTimer(hwnd, TID_POLLMOUSE, MOUSE_POLL_DELAY, (TIMERPROC)TrackMouseTimerProc);
SetCompositionPos(hwnd);
#if !defined(WINCE) || _WIN32_WCE >= 0x400
_imm_props = ImmGetProperty(GetKeyboardLayout(0), IGP_PROPERTY);
#endif
break;
case WM_ENTERSIZEMOVE:
@ -784,7 +764,6 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
return 0;
}
#if !defined(WINCE) || _WIN32_WCE >= 0x400
case WM_INPUTLANGCHANGE:
_imm_props = ImmGetProperty(GetKeyboardLayout(0), IGP_PROPERTY);
break;
@ -820,7 +799,6 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
}
HandleCharMsg(0, GB(wParam, 0, 8));
return 0;
#endif
#endif
case WM_DEADCHAR:
@ -914,7 +892,6 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
}
return 0;
#if !defined(WINCE)
case WM_SIZING: {
RECT *r = (RECT*)lParam;
RECT r2;
@ -972,7 +949,6 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
}
return TRUE;
}
#endif
/* needed for wheel */
#if !defined(WM_MOUSEWHEEL)
@ -1003,7 +979,6 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
_wnd.has_focus = false;
break;
#if !defined(WINCE)
case WM_ACTIVATE: {
/* Don't do anything if we are closing openttd */
if (_exit_game) break;
@ -1023,7 +998,6 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
}
break;
}
#endif
}
return DefWindowProc(hwnd, msg, wParam, lParam);
@ -1112,10 +1086,6 @@ static const Dimension default_resolutions[] = {
static void FindResolutions()
{
uint n = 0;
#if defined(WINCE)
/* EnumDisplaySettingsW is only supported in CE 4.2+
* XXX -- One might argue that we assume 4.2+ on every system. Then we can use this function safely */
#else
uint i;
DEVMODEA dm;
@ -1145,7 +1115,6 @@ static void FindResolutions()
}
}
}
#endif
/* We have found no resolutions, show the default list */
if (n == 0) {
@ -1191,9 +1160,7 @@ void VideoDriver_Win32::Stop()
DeleteObject(_wnd.dib_sect);
DestroyWindow(_wnd.main_wnd);
#if !defined(WINCE)
if (_wnd.fullscreen) ChangeDisplaySettings(NULL, 0);
#endif
MyShowCursor(true);
}
@ -1295,10 +1262,8 @@ void VideoDriver_Win32::MainLoop()
if (old_ctrl_pressed != _ctrl_pressed) HandleCtrlChanged();
#if !defined(WINCE)
/* Flush GDI buffer to ensure we don't conflict with the drawing thread. */
GdiFlush();
#endif
/* The game loop is the part that can run asynchronously.
* The rest except sleeping can't. */
@ -1311,10 +1276,8 @@ void VideoDriver_Win32::MainLoop()
UpdateWindows();
CheckPaletteAnim();
} else {
#if !defined(WINCE)
/* Flush GDI buffer to ensure we don't conflict with the drawing thread. */
GdiFlush();
#endif
/* Release the thread while sleeping */
if (_draw_threaded) _draw_mutex->EndCritical();

Loading…
Cancel
Save