diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cpu.cpp | 5 | ||||
-rw-r--r-- | src/debug.cpp | 4 | ||||
-rw-r--r-- | src/fileio.cpp | 16 | ||||
-rw-r--r-- | src/fios.cpp | 4 | ||||
-rw-r--r-- | src/gamelog.h | 2 | ||||
-rw-r--r-- | src/gfx.cpp | 5 | ||||
-rw-r--r-- | src/map.cpp | 2 | ||||
-rw-r--r-- | src/openttd.cpp | 5 | ||||
-rw-r--r-- | src/os/windows/win32.cpp | 49 | ||||
-rw-r--r-- | src/stdafx.h | 37 | ||||
-rw-r--r-- | src/video/dedicated_v.cpp | 13 | ||||
-rw-r--r-- | src/video/win32_v.cpp | 37 |
12 files changed, 19 insertions, 160 deletions
diff --git a/src/cpu.cpp b/src/cpu.cpp index c48b8cbd4..9393ea061 100644 --- a/src/cpu.cpp +++ b/src/cpu.cpp @@ -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 diff --git a/src/debug.cpp b/src/debug.cpp index 184615225..d4d547c88 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -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); diff --git a/src/fileio.cpp b/src/fileio.cpp index 0590efd3a..8b5e56fb5 100644 --- a/src/fileio.cpp +++ b/src/fileio.cpp @@ -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; diff --git a/src/fios.cpp b/src/fios.cpp index 5e78fb1b4..f4a25e1ed 100644 --- a/src/fios.cpp +++ b/src/fios.cpp @@ -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; diff --git a/src/gamelog.h b/src/gamelog.h index 7f5b6a776..83694e3ea 100644 --- a/src/gamelog.h +++ b/src/gamelog.h @@ -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(); diff --git a/src/gfx.cpp b/src/gfx.cpp index 719505157..187d197a3 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -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; diff --git a/src/map.cpp b/src/map.cpp index 252f20b60..986aa1bbb 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -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); diff --git a/src/openttd.cpp b/src/openttd.cpp index 24e3e97ff..c97fb6163 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -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); diff --git a/src/os/windows/win32.cpp b/src/os/windows/win32.cpp index 3fd1777fa..8a90db4f7 100644 --- a/src/os/windows/win32.cpp +++ b/src/os/windows/win32.cpp @@ -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; } diff --git a/src/stdafx.h b/src/stdafx.h index 8c0f30252..621b1f61d 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -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); diff --git a/src/video/dedicated_v.cpp b/src/video/dedicated_v.cpp index 52e0b6faa..aaadd9461 100644 --- a/src/video/dedicated_v.cpp +++ b/src/video/dedicated_v.cpp @@ -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(); diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp index 4534b87be..d1d4a4cd5 100644 --- a/src/video/win32_v.cpp +++ b/src/video/win32_v.cpp @@ -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; @@ -821,7 +800,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: console = GB(lParam, 16, 8) == 41; @@ -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(); |